Sign in to follow this  
Followers 0
Swift

AutoIt POS (Point of Sale) Finished!

30 posts in this topic

#1 ·  Posted (edited)

After I noticed that ShaneHale, had a great idea and project, I decided to take it over and finish it. Now has 'Void item' Manual enter (Products that dont have a key, you enter them). Coupons/discounts. CREDITS: ShaneHale(GUI Design), myself (some functions), and Jon...! :)

=Notice=This program does not yet save transations for the day, I am working on using SQLite Database now. =Notice= 10-key does not work yet, it really serves no purpose in this, so if you want to add to it, its buttons 1-13 I belive. -/+ dont work either. =Notice= Does not do tax yet. =Notice= Does not print reciets. It will automatically turn caps on when you click Manual, and turn them off the second that dialog closes :)

How To Use

1) Click some items or use the manual enter to input stuff into the listview.

2) Once your done click: "TOTAL" and this will give you the total displaying on the label

3) Clicking total enables the CASH button, click this enter the amount given, and click on, it does the work by subtracting, displaying the cash back.

4) Clear it.

() You can void items by clicking on the and pressing: "v" or clicking VOID, also you can add coupons/discounts which will be taken off at the end.

ENJOY!

CODE!:

#include <GUIConstants.au3>
#include <GUIListView.au3>
#include <File.au3>
#include <Misc.au3>
#NoTrayIcon
If Not FileExists(@ScriptDir & "\PoSConfig.ini") Then MakeIt()
Dim $Array
_FileReadToArray(@ScriptDir & "\PoSConfig.ini", $Array)
If $Array[0] < 16 Then
    MsgBox(0, "PoS", "PoS Config Error")
    Exit
EndIf
$But1 = StringSplit($Array[1], "|")
$But2 = StringSplit($Array[2], "|")
$But3 = StringSplit($Array[3], "|")
$But4 = StringSplit($Array[4], "|")
$But5 = StringSplit($Array[5], "|")
$But6 = StringSplit($Array[6], "|")
$But7 = StringSplit($Array[7], "|")
$But8 = StringSplit($Array[8], "|")
$But9 = StringSplit($Array[9], "|")
$But10 = StringSplit($Array[10], "|")
$But11 = StringSplit($Array[11], "|")
$But12 = StringSplit($Array[12], "|")
$But13 = StringSplit($Array[13], "|")
$But14 = StringSplit($Array[14], "|")
$But15 = StringSplit($Array[15], "|")
$But16 = StringSplit($Array[16], "|")
$Form1_1 = GUICreate("Simple Register It! (A Cash Register Program)", 618, 586, 209, 116)
$Tab1 = GUICtrlCreateTab(8, 8, 601, 569)
$TabSheet1 = GUICtrlCreateTabItem("REGISTER")
GUICtrlSetState(-1, $GUI_SHOW)
$Group1 = GUICtrlCreateGroup("", 20, 32, 577, 529)
GUICtrlSetColor(-1, 0xFFFF00)
$ListView = GUICtrlCreateListView("Item|Price", 36, 112, 249, 374)
_GUICtrlListView_SetColumnWidth($ListView, 0, 165)
_GUICtrlListView_SetColumnWidth($ListView, 1, 60)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x00FFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("", 36, 48, 249, 60, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN, $WS_BORDER))
GUICtrlSetFont(-1, 20, 800, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetBkColor(-1, 0x008000)
$Button1 = GUICtrlCreateButton("1", 292, 384, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button2 = GUICtrlCreateButton("2", 364, 384, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button3 = GUICtrlCreateButton("3", 436, 384, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button4 = GUICtrlCreateButton("4", 292, 336, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button5 = GUICtrlCreateButton("5", 364, 336, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button6 = GUICtrlCreateButton("6", 436, 336, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button7 = GUICtrlCreateButton("7", 292, 288, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button8 = GUICtrlCreateButton("8", 364, 288, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button9 = GUICtrlCreateButton("9", 436, 288, 75, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button10 = GUICtrlCreateButton("0", 292, 432, 147, 49, 0)
GUICtrlSetFont(-1, 18, 400, 0, "Lucida Console")
$Button11 = GUICtrlCreateButton("+", 508, 288, 75, 97, 0)
GUICtrlSetFont(-1, 28, 400, 0, "Lucida Console")
$Button12 = GUICtrlCreateButton("-", 508, 384, 75, 49, 0)
GUICtrlSetFont(-1, 28, 400, 0, "Lucida Console")
$Button13 = GUICtrlCreateButton($But1[1], 292, 48, 75, 49, 0)
$Button14 = GUICtrlCreateButton($But2[1], 292, 96, 75, 49, 0)
$Button15 = GUICtrlCreateButton($But3[1], 292, 144, 75, 49, 0)
$Button16 = GUICtrlCreateButton($But4[1], 292, 192, 75, 49, 0)
$Button17 = GUICtrlCreateButton($But5[1], 364, 48, 75, 49, 0)
$Button18 = GUICtrlCreateButton($But6[1], 364, 96, 75, 49, 0)
$Button19 = GUICtrlCreateButton($But7[1], 364, 144, 75, 49, 0)
$Button20 = GUICtrlCreateButton($But8[1], 364, 192, 75, 49, 0)
$Button21 = GUICtrlCreateButton($But9[1], 436, 48, 75, 49, 0)
$Button22 = GUICtrlCreateButton($But10[1], 436, 96, 75, 49, 0)
$Button23 = GUICtrlCreateButton($But11[1], 436, 144, 75, 49, 0)
$Button24 = GUICtrlCreateButton($But12[1], 436, 192, 75, 49, 0)
$Button25 = GUICtrlCreateButton($But13[1], 508, 48, 75, 49, 0)
$Button26 = GUICtrlCreateButton($But14[1], 508, 96, 75, 49, 0)
$Button27 = GUICtrlCreateButton($But15[1], 508, 144, 75, 49, 0)
$Button28 = GUICtrlCreateButton($But16[1], 508, 192, 75, 49, 0)
$Button29 = GUICtrlCreateButton("VOID", 36, 496, 99, 41, 0)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button34 = GUICtrlCreateButton("COUPON", 140, 496, 99, 41, 0)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button30 = GUICtrlCreateButton("CLEAR/DONE", 292, 496, 145, 41, 0)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$CheckBox = GUICtrlCreateCheckbox("Add Tax?", 292, 538, 145)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button31 = GUICtrlCreateButton("TENDER CASH", 436, 496, 147, 41, 0)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button32 = GUICtrlCreateButton("TOTAL", 436, 432, 147, 49, 0)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Button33 = GUICtrlCreateButton("X", 292, 240, 145, 49, 0)
GUICtrlSetFont(-1, 36, 400, 0, "Lucida Console")
$Manual = GUICtrlCreateButton("Manual", 438, 240, 145, 49)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$TabSheet2 = GUICtrlCreateTabItem("TRANSACTIONS")
$Group2 = GUICtrlCreateGroup("", 20, 32, 577, 529)
$Date1 = GUICtrlCreateDate("2007/06/06 17:04:58", 212, 56, 186, 21)
$ListView1 = GUICtrlCreateListView("", 166, 95, 285, 432)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
$Dll = DllOpen("User32.dll")
While 1
    If _IsPressed("56", $Dll) Then VOID()
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $CheckBox
            If GUICtrlRead($CheckBox) = $GUI_CHECKED Then
            Global $in = InputBox("TAX", "ENTER AMOUNT AS A %", "6", "", 5, 5)
            If @error Then GUICtrlSetState($CheckBox, $GUI_UNCHECKED)
            EndIf
        Case $Button1
        Case $Button2
        Case $Button3
        Case $Button4
        Case $Button5
        Case $Button6
        Case $Button7
        Case $Button8
        Case $Button9
        Case $Button10
        Case $Button11
        Case $Button12
        Case $Button13
            GUICtrlCreateListViewItem($But1[1]&"|"&$But1[2], $ListView)
            GUICtrlSetData($Label1, $But1[2])
        Case $Button14
            GUICtrlCreateListViewItem($But2[1]&"|"&$But2[2], $ListView)
            GUICtrlSetData($Label1, $But2[2])
        Case $Button15
            GUICtrlCreateListViewItem($But3[1]&"|"&$But3[2], $ListView)
            GUICtrlSetData($Label1, $But3[2])
        Case $Button16
            GUICtrlCreateListViewItem($But4[1]&"|"&$But4[2], $ListView)
            GUICtrlSetData($Label1, $But4[2])
        Case $Button17
            GUICtrlCreateListViewItem($But5[1]&"|"&$But5[2], $ListView)
            GUICtrlSetData($Label1, $But5[2])
        Case $Button18
            GUICtrlCreateListViewItem($But6[1]&"|"&$But6[2], $ListView)
            GUICtrlSetData($Label1, $But6[2])
        Case $Button19
            GUICtrlCreateListViewItem($But7[1]&"|"&$But7[2], $ListView)
            GUICtrlSetData($Label1, $But7[2])
        Case $Button20
            GUICtrlCreateListViewItem($But8[1]&"|"&$But8[2], $ListView)
            GUICtrlSetData($Label1, $But8[2])
        Case $Button21
            GUICtrlCreateListViewItem($But9[1]&"|"&$But9[2], $ListView)
            GUICtrlSetData($Label1, $But9[2])
        Case $Button22
            GUICtrlCreateListViewItem($But10[1]&"|"&$But10[2], $ListView)
            GUICtrlSetData($Label1, $But10[2])
        Case $Button23
            GUICtrlCreateListViewItem($But11[1]&"|"&$But11[2], $ListView)
            GUICtrlSetData($Label1, $But11[2])
        Case $Button24
            GUICtrlCreateListViewItem($But12[1]&"|"&$But12[2], $ListView)
            GUICtrlSetData($Label1, $But12[2])
        Case $Button25
            GUICtrlCreateListViewItem($But13[1]&"|"&$But13[2], $ListView)
            GUICtrlSetData($Label1, $But13[2])
        Case $Button26
            GUICtrlCreateListViewItem($But14[1]&"|"&$But14[2], $ListView)
            GUICtrlSetData($Label1, $But14[2])
        Case $Button27
            GUICtrlCreateListViewItem($But15[1]&"|"&$But15[2], $ListView)
            GUICtrlSetData($Label1, $But15[2])
        Case $Button28
            GUICtrlCreateListViewItem($But16[1]&"|"&$But16[2], $ListView)
            GUICtrlSetData($Label1, $But16[2])
        Case $Button29
            _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button30
            _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button32;Total
            $SubTot = ""
            $TotalTax=""
            $Number = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView))
            For $i = 0 To $Number
                $N = _GUICtrlListView_GetItemText(GUICtrlGetHandle($ListView), $i, 1)
                $SubTot = $SubTot + $N
            Next
            If $SubTot < 0 Then
                MsgBox(0, "POS ERROR", "You Cannot Have A Negative Number")
            Else
                If GUICtrlRead($CheckBox) = $GUI_CHECKED Then
                $price=$SubTot*($in * .01)+$SubTot
                $FixedPrice = StringFormat("%.2f", Round($price, 2))
                GUICtrlSetData($Label1, "Total: $" & $FixedPrice)
                Global $Tot = True
            Else
                $FixedSubTot = StringFormat("%.2f", Round($SubTot, 2))
                GUICtrlSetData($Label1, "Total: $" & $FixedSubTot)
                Global $Tot = True
                EndIf
            EndIf
        Case $Button31;This should be $Cash - $Total = $CashBack
            $Cash = ""
            If $Tot = True Then
                $Cash = InputBox("Cash Pay", "Enter Amount Paid", "", "", 5, 5)
                If Not @error Then
                    If GUICtrlRead($CheckBox) = $GUI_CHECKED Then
                    $Cash = $Cash - $FixedPrice
                    $FixedCash = StringFormat("%.2f", Round($Cash, 2))
                    GUICtrlSetData($Label1, "Change: $" &$Cash)
                    Global $Tot = False
                Else
                    $Cash = $Cash - $FixedSubTot
                    $FixedCash = StringFormat("%.2f", Round($Cash, 2))
                    GUICtrlSetData($Label1, "Change: $" &$FixedCash)
                    Global $Tot = False
                    EndIf
                EndIf
            EndIf
        Case $Button34
            $COUPON = InputBox("COUPON", "ENTER COUPON PRICE", "1.00", "", 5, 5)
            If Not @error Then
                $FixedCOUPON = StringFormat("%.2f", $COUPON)
                GUICtrlCreateListViewItem("COUPON:|-" & $FixedCOUPON, $ListView)
                GUICtrlSetData($Label1, "-" & $FixedCOUPON)
            EndIf
        Case $Manual
            Send("{CAPSLOCK ON}")
            $1 = InputBox("MANUAL ENTER", "ENTER THE NAME", "", "", 5, 5)
            If Not @error Then
                $2 = InputBox("MANUAL ENTER", "ENTER THE PRICE", "1.00", "", 5, 5)
                If Not @error Then
                    $Fixed2 = StringFormat("%.2f", $2)
                    $3 = InputBox("MANUAL ENTER", "ENTER QUANITY", "1", "", 5, 5)
                    If Not @error Then
                        For $i = 1 To $3
                            GUICtrlCreateListViewItem($1 & "|" & $Fixed2, $ListView)
                            GUICtrlSetData($Label1, $Fixed2)
                        Next
                    EndIf
                EndIf
            EndIf
            Send("{CAPSLOCK ON}")
    EndSwitch
WEnd

Func VOID()
    _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView))
    GUICtrlSetData($Label1, "")
EndFunc   ;==>VOID
Func MakeIt()
    $file = FileOpen(@ScriptDir & "\PosConfig.ini", 1)
    For $i=1 To 16
        FileWrite($file, "Button"&$i&"|1.00"&@CRLF)
    Next
    FileClose($file)
    MsgBox(0, "PoS", "This Is Your First Time Running This Program, Please Configure The Buttons"&@CRLF& _
    "It is simple to configure, just name the button (Left side of |) then name the price (Right side of |) Make sure"&@CRLF& _
    "Not to edit or move the | that is the seperator. No more than 12 characters in the name")
    ShellExecuteWait(@ScriptDir & "\PoSConfig.ini")
EndFunc
Edited by R6V2

Share this post


Link to post
Share on other sites



Thats cool. Good job. :) :)

Share this post


Link to post
Share on other sites

Thats cool. Good job. :) :)

Thanks Justin, it took me a while because I was tring to use the _GUICtrlListView_* Functions, without using: GUICtrlGetHandle(), so it kept giving me errors, I kept checking the helpfile, and finally it showed a example using that! Yay... :party: So im happy with it!

Share this post


Link to post
Share on other sites

I like the idea, but seriously, arrays would shorten this a TON

:)

Share this post


Link to post
Share on other sites

I like the idea, but seriously, arrays would shorten this a TON

:)

Shhh Senton! I'm not very good with arrays!

Share this post


Link to post
Share on other sites

Shhh Senton! I'm not very good with arrays!

Don't worry. 90% of my support forum inquiries are about arrays :)

Share this post


Link to post
Share on other sites

Don't worry. 90% of my support forum inquiries are about arrays :)

Hey, Senton, did you want to help me rewrite part of this script, and show me how to use arrays better within this script and others? I'd be really helpful! :)

Share this post


Link to post
Share on other sites

Hey, Senton, did you want to help me rewrite part of this script, and show me how to use arrays better within this script and others? I'd be really helpful! :)

I might if I get the chance :)

Back on topic!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Very nice indeed!! Just need to add a couple ini or dat files to hold programmable prices/inventory and another to hold transactions/history and will be great! :) Just ideas :) ...

edit: typos..

Edited by gesller

Share this post


Link to post
Share on other sites

I'll work on that GSeller, hey, do you know a simple way to get tax from a variable

like this:

$Total = "150.00"

$Tax = "6.5%"

and then calculate the tax?

I cant figure it out!

Share this post


Link to post
Share on other sites

I'll work on that GSeller, hey, do you know a simple way to get tax from a variable

like this:

$Total = "150.00"

$Tax = "6.5%"

and then calculate the tax?

I cant figure it out!

Divide then Add :)

(($Total/$Tax)+$Total)= Total w/ tax

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Wow. I was doing something more complicated just to get that tax! Thanks!

EDIT: It says unable to parse line? O.o?

Edited by R6V2

Share this post


Link to post
Share on other sites

$price = $total * ($tax * .01)  + $total


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

$price = $total * ($tax * .01)  + $total
I forgot to tack on the part about converting it to a decimal, and multiplying it instead of dividing it the way it was. Oopsies :)

Share this post


Link to post
Share on other sites

Sall good. =]


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

Yay! That works! Now it has tax! woot

Now time to work on customizable buttons and prices!

Share this post


Link to post
Share on other sites

Hmm, I have another small question...why isnt this working? Im tring to use a array from the button names..

Dim $Array
_FileReadToArray(@ScriptDir & "\PoSConfig.ini", $Array)
If $Array[0] < 16 Then
    MsgBox(0, "PoS", "PoS Config Error")
    Exit
EndIf
For $i=1 To 16
    $Button[$i] = StringSplit($Array[$i], "|")
Next

It gives me a error saying:

$Button[$i] = ...

$Button ^ Expected a "="?

I don't get why its saying that, I have a = sign right after the array part..

Share this post


Link to post
Share on other sites

Hehehe.. nough said.. LOL Good answers all!

Share this post


Link to post
Share on other sites

Don't worry. 90% of my support forum inquiries are about arrays :)

Senton-Bomb - So where ya got this support hiding? LOL I am awful at arrays, know just enough to get myself into trouble.. LOL

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Hmm, I have another small question...why isnt this working? Im tring to use a array from the button names..

CODE: AutoIt

Dim $Array

_FileReadToArray(@ScriptDir & "\PoSConfig.ini", $Array)

If $Array[0] < 16 Then

MsgBox(0, "PoS", "PoS Config Error")

Exit

EndIf

For $i=1 To 16

$Button[$i] = StringSplit($Array[$i], "|")

Next

It gives me a error saying:

$Button[$i] = ...

$Button ^ Expected a "="?

I don't get why its saying that, I have a = sign right after the array part..

\

Doesn't string split return an array? So u are trying to put an array into a non array variable. Autoit wants u to have $button = the array (because $button is an array) rather than $button[$i] = the array (because $button[$i] is not an array)

Edited by sccrstvn93

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0