Sign in to follow this  
Followers 0
Swift

Reading Second List View Item

10 posts in this topic

I know I'd probably need the _GUICtrlListView_GetItemCount()

And then do a for/next loop using that, But how can I get the 2nd list view item

like this

oranges      9.60
fruit      1.50

I need to get the 9.60 and 1.50, and add them together,

So I need the $Number = _GUICtrlListView_GetItemCount()

For $i=1 To $number

function to get it

$SubTotal=$SubTotal+$Functiontogetit

Next

so, if anyone could help me with this, im game to anything

If you need a sample code of what im doing, just say so!

Thanks everyone!

Share this post


Link to post
Share on other sites



So, I need to use this inside my loop using:

$Number[$i] for the reading part?

I'll try it Zedna, thanks!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, why isnt this working Zedna? It says: Subscript used with non-array variable

I really hope its not just like so stupid thing I did wrong...

$Number = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView))
            For $i=1 To $Number
            _GUICtrlListView_GetItemText(GUICtrlGetHandle($ListView), $Number[$i], 1)
            $SubTot=$SubTot+$N[$i]
            Next
                MsgBox(0, "", $SubTot)

Ok, I found out that It shouldn't be a array, so basically:

$i instead of $Number[$i], although it has no errors, it's not giving me the wrong total.

Edited by R6V2

Share this post


Link to post
Share on other sites

Something like this:

$SubTot = 0
$Number = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView))
            For $i=1 To $Number
              $N = _GUICtrlListView_GetItemText(GUICtrlGetHandle($ListView), $Number[$i], 1)
              $SubTot=$SubTot+Number($N)
            Next
                MsgBox(0, "", $SubTot)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

No, It's just returning 0. I changed your code a little, because its not a array. This is my full code. Just click some of the buttons and hit total, it gives me 0... :) .

#include <GUIConstants.au3>
#include <GUIListView.au3>
#include <File.au3>
#Region ### START Koda GUI section ### Form=c:\security\koda_1.6.0.2\forms\aform2.kx
$Form1_1 = GUICreate("Simple POS", 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, 22, 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("LG SODA", 292, 48, 75, 49, 0)
$Button14 = GUICtrlCreateButton("BURGER", 292, 96, 75, 49, 0)
$Button15 = GUICtrlCreateButton("COCOA", 292, 144, 75, 49, 0)
$Button16 = GUICtrlCreateButton("LG CANDY", 292, 192, 75, 49, 0)
$Button17 = GUICtrlCreateButton("RG SODA", 364, 48, 75, 49, 0)
$Button18 = GUICtrlCreateButton("HOTDOG", 364, 96, 75, 49, 0)
$Button19 = GUICtrlCreateButton("CAPPICINO", 364, 144, 75, 49, 0)
$Button20 = GUICtrlCreateButton("SM CANDY", 364, 192, 75, 49, 0)
$Button21 = GUICtrlCreateButton("WATER", 436, 48, 75, 49, 0)
$Button22 = GUICtrlCreateButton("POPCORN", 436, 96, 75, 49, 0)
$Button23 = GUICtrlCreateButton("ICE", 436, 144, 75, 49, 0)
$Button24 = GUICtrlCreateButton("LG CHIPS", 508, 144, 75, 49, 0)
$Button25 = GUICtrlCreateButton("CHILI", 508, 48, 75, 49, 0)
$Button26 = GUICtrlCreateButton("NACHOS", 508, 96, 75, 49, 0)
$Button27 = GUICtrlCreateButton("SM CHIPS", 508, 192, 75, 49, 0)
$Button28 = GUICtrlCreateButton("MUFFINS", 436, 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")
$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)
$TabSheet3 = GUICtrlCreateTabItem("BATCH")
$Group3 = GUICtrlCreateGroup("", 20, 32, 577, 529)
$Date2 = GUICtrlCreateDate("2007/06/06 17:15:22", 212, 56, 186, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $1 = GUICtrlRead($ListView)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GuiCtrlSetData($Label1, "1")
        Case $Button2
            GuiCtrlSetData($Label1, "2")
        Case $Button3
            GuiCtrlSetData($Label1, "3")
        Case $Button4
            GuiCtrlSetData($Label1, "4")
        Case $Button5
            GuiCtrlSetData($Label1, "5")
        Case $Button6
            GuiCtrlSetData($Label1, "6")
        Case $Button7
            GuiCtrlSetData($Label1, "7")
        Case $Button8
            GuiCtrlSetData($Label1, "8")
        Case $Button9
            GuiCtrlSetData($Label1, "9")
        Case $Button10
            GuiCtrlSetData($Label1, "0")
        Case $Button11
            GuiCtrlSetData($Label1, "+")
        Case $Button12
            GuiCtrlSetData($Label1, "-")
        Case $Button13
           GUICtrlCreateListViewItem("LARGE SODA|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button14
            GUICtrlCreateListViewItem("HAMBURGER|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button15
            GUICtrlCreateListViewItem("HOT COCOA|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button16
            GUICtrlCreateListViewItem("LARGE CANDY|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button17
            GUICtrlCreateListViewItem("REGULAR SODA|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button18
            GUICtrlCreateListViewItem("HOTDOG|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button19
            GUICtrlCreateListViewItem("CAPPUCINO|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button20
            GUICtrlCreateListViewItem("SMALL CANDY|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button21
            GUICtrlCreateListViewItem("WATER|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button22
            GUICtrlCreateListViewItem("POPCORN|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button23
            GUICtrlCreateListViewItem("CUP OF ICE|1.00", $ListView)
            GuiCtrlSetData($Label1, "1.00")
        Case $Button24
            GUICtrlCreateListViewItem("LG CHIPS|1.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button25
            GUICtrlCreateListViewItem("CHILI|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button26
            GUICtrlCreateListViewItem("NACHOS|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button27
            GUICtrlCreateListViewItem("SM CHIPS|1.00", $ListView)
            GuiCtrlSetData($Label1, "1.00")
        Case $Button28
            GUICtrlCreateListViewItem("MUFFINS|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button29
            _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button30
            _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button31;This should be $Cash - $Total = $FullTotal
            $Cash = InputBox("Cash Pay", "Enter Amount Paid", "", "", 5, 5)
        Case $Button32;Total
            $SubTot = 0
            $Number = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView))
            For $i=1 To $Number
              $N = _GUICtrlListView_GetItemText(GUICtrlGetHandle($ListView), $Number, 1)
              $SubTot=$SubTot+Number($N)
            Next
                MsgBox(0, "", $SubTot)
        Case $Button33;X
        Case $Button34
            $COUPON = InputBox("COUPON", "ENTER COUPON PRICE", "1.00", "", 5, 5)
            If Not @error Then
            GUICtrlCreateListViewItem("COUPON:|-"& $COUPON, $ListView)
            GUICtrlSetData($Label1, "-" & $COUPON)
            EndIf
        Case $Manual
            $1 = InputBox("MANUAL ENTER", "ENTER THE NAME", "", "", 5, 5)
            If Not @error Then
            $2 = InputBox("MANUAL ENTER", "ENTER THE PRICE", "", "", 5, 5)
            If Not @error Then
            $3 = InputBox("MANUAL ENTER", "ENTER QUANITY", "1", "", 5, 5)
            If Not @error Then
            For $i=1 To $3
            GUICtrlCreateListViewItem($1 & "|" & $2, $ListView)
            GuiCtrlSetData($Label1, $2)
            Next
            EndIf
            EndIf
            EndIf
    EndSwitch
WEnd

Thanks Zedna!

Edited by R6V2

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Could anyone please explain or give me a example of why this isnt working right? It's just not working, and I don't see any other function to do this. Please, and thanks for the help guys! Sorry if I bumped a little to early...im kinda eager to get this done.

Edited by R6V2

Share this post


Link to post
Share on other sites

Upon retry, after retry, I stumbled upon a working code! Yay! If you would like to see this code, post and I'll show it! :) Thanks everyone

Share this post


Link to post
Share on other sites

Hi!

Try this:

#include <GUIConstants.au3>
#include <GUIListView.au3>
#include <File.au3>

$Form1_1 = GUICreate("Simple POS", 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, 22, 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("LG SODA", 292, 48, 75, 49, 0)
$Button14 = GUICtrlCreateButton("BURGER", 292, 96, 75, 49, 0)
$Button15 = GUICtrlCreateButton("COCOA", 292, 144, 75, 49, 0)
$Button16 = GUICtrlCreateButton("LG CANDY", 292, 192, 75, 49, 0)
$Button17 = GUICtrlCreateButton("RG SODA", 364, 48, 75, 49, 0)
$Button18 = GUICtrlCreateButton("HOTDOG", 364, 96, 75, 49, 0)
$Button19 = GUICtrlCreateButton("CAPPICINO", 364, 144, 75, 49, 0)
$Button20 = GUICtrlCreateButton("SM CANDY", 364, 192, 75, 49, 0)
$Button21 = GUICtrlCreateButton("WATER", 436, 48, 75, 49, 0)
$Button22 = GUICtrlCreateButton("POPCORN", 436, 96, 75, 49, 0)
$Button23 = GUICtrlCreateButton("ICE", 436, 144, 75, 49, 0)
$Button24 = GUICtrlCreateButton("LG CHIPS", 508, 144, 75, 49, 0)
$Button25 = GUICtrlCreateButton("CHILI", 508, 48, 75, 49, 0)
$Button26 = GUICtrlCreateButton("NACHOS", 508, 96, 75, 49, 0)
$Button27 = GUICtrlCreateButton("SM CHIPS", 508, 192, 75, 49, 0)
$Button28 = GUICtrlCreateButton("MUFFINS", 436, 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")
$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)
$TabSheet3 = GUICtrlCreateTabItem("BATCH")
$Group3 = GUICtrlCreateGroup("", 20, 32, 577, 529)
$Date2 = GUICtrlCreateDate("2007/06/06 17:15:22", 212, 56, 186, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)

Global $1 = GUICtrlRead($ListView)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GuiCtrlSetData($Label1, "1")
        Case $Button2
            GuiCtrlSetData($Label1, "2")
        Case $Button3
            GuiCtrlSetData($Label1, "3")
        Case $Button4
            GuiCtrlSetData($Label1, "4")
        Case $Button5
            GuiCtrlSetData($Label1, "5")
        Case $Button6
            GuiCtrlSetData($Label1, "6")
        Case $Button7
            GuiCtrlSetData($Label1, "7")
        Case $Button8
            GuiCtrlSetData($Label1, "8")
        Case $Button9
            GuiCtrlSetData($Label1, "9")
        Case $Button10
            GuiCtrlSetData($Label1, "0")
        Case $Button11
            GuiCtrlSetData($Label1, "+")
        Case $Button12
            GuiCtrlSetData($Label1, "-")
        Case $Button13
           GUICtrlCreateListViewItem("LARGE SODA|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button14
            GUICtrlCreateListViewItem("HAMBURGER|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button15
            GUICtrlCreateListViewItem("HOT COCOA|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button16
            GUICtrlCreateListViewItem("LARGE CANDY|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button17
            GUICtrlCreateListViewItem("REGULAR SODA|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button18
            GUICtrlCreateListViewItem("HOTDOG|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button19
            GUICtrlCreateListViewItem("CAPPUCINO|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button20
            GUICtrlCreateListViewItem("SMALL CANDY|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button21
            GUICtrlCreateListViewItem("WATER|2.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button22
            GUICtrlCreateListViewItem("POPCORN|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button23
            GUICtrlCreateListViewItem("CUP OF ICE|1.00", $ListView)
            GuiCtrlSetData($Label1, "1.00")
        Case $Button24
            GUICtrlCreateListViewItem("LG CHIPS|1.00", $ListView)
            GuiCtrlSetData($Label1, "2.00")
        Case $Button25
            GUICtrlCreateListViewItem("CHILI|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button26
            GUICtrlCreateListViewItem("NACHOS|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button27
            GUICtrlCreateListViewItem("SM CHIPS|1.00", $ListView)
            GuiCtrlSetData($Label1, "1.00")
        Case $Button28
            GUICtrlCreateListViewItem("MUFFINS|3.00", $ListView)
            GuiCtrlSetData($Label1, "3.00")
        Case $Button29
            _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button30
            _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))
            GUICtrlSetData($Label1, "")
        Case $Button31;This should be $Cash - $Total = $FullTotal
            $Cash = InputBox("Cash Pay", "Enter Amount Paid", "", "", 5, 5)
        
        Case $Button32;Total
            $Number = _GUICtrlListView_GetItemCount($ListView)
            $Total = _GetTotal($Number)
            MsgBox(0, "Total", "Total sum is " & $Total)
            
        Case $Button33;X
        Case $Button34
            $COUPON = InputBox("COUPON", "ENTER COUPON PRICE", "1.00", "", 5, 5)
            If Not @error Then
            GUICtrlCreateListViewItem("COUPON:|-"& $COUPON, $ListView)
            GUICtrlSetData($Label1, "-" & $COUPON)
            EndIf
        Case $Manual
            $1 = InputBox("MANUAL ENTER", "ENTER THE NAME", "", "", 5, 5)
            If Not @error Then
            $2 = InputBox("MANUAL ENTER", "ENTER THE PRICE", "", "", 5, 5)
            If Not @error Then
            $3 = InputBox("MANUAL ENTER", "ENTER QUANITY", "1", "", 5, 5)
            If Not @error Then
            For $i=1 To $3
            GUICtrlCreateListViewItem($1 & "|" & $2, $ListView)
            GuiCtrlSetData($Label1, $2)
            Next
            EndIf
            EndIf
            EndIf
    EndSwitch
WEnd

Func _GetTotal($sCount)
    If $sCount = 0 Then Return 0
    
    Local $iData, $iTotal = 0, $i
    
    For $i = 0 To $sCount - 1
        $iData = _GUICtrlListView_GetItemText($ListView, $i, 1)
        $iTotal += Number($iData)
    Next
    
    Return $iTotal
EndFunc

:)

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