Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Thread For DryCleaning POS Pickup Form

Status
Not open for further replies.

foxprox558

Programmer
Oct 19, 2013
53
0
0
US
If you will see the picture attached, you will see that I have decided to go with another method. I've decided to only show 14 orders on the screen. The text to the right of the checkboxes are labels, and they only display the total amount of the orders with the following code. Please help with this problem: if there is more than 1 order for a given customer number, the 2nd label just jitters between the 1st order amount and the 2nd order amount indefinintely. Also, when you push pay, it should mark the orders paid, which it does not.

**Code For The Select button (Gets customer orders)**
Code:
USE orders
PUBLIC nPrice1 as number
PUBLIC nPrice2 as number
PUBLIC nPrice3 as number
PUBLIC nPrice4 as number
PUBLIC nPrice5 as number
PUBLIC nPrice6 as number
PUBLIC nPrice7 as number
PUBLIC nPrice8 as number
PUBLIC nPrice9 as number
PUBLIC nPrice10 as number
PUBLIC nPrice11 as number
PUBLIC nPrice12 as number
PUBLIC nPrice13 as number
PUBLIC nPrice14 as number
PUBLIC nOrder1 as Number
PUBLIC nOrder2 as Number
PUBLIC nOrder3 as Number
PUBLIC nOrder4 as Number
PUBLIC nOrder5 as Number
PUBLIC nOrder6 as Number
PUBLIC nOrder7 as Number
PUBLIC nOrder8 as Number

PUBLIC nOrder9 as Number
PUBLIC nOrder10 as Number
PUBLIC nOrder11 as Number
PUBLIC nOrder12 as Number
PUBLIC nOrder13 as Number
PUBLIC nOrder14 as Number
nPrice1=0
nPrice2=0
nPrice3=0
nPrice4=0
nPrice5=0
nPrice6=0
nPrice7=0
nPrice8=0
nPrice9=0
nPrice10=0
nPrice11=0
nPrice12=0
nPrice13=0
nPrice14=0
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
SCAN
nPrice1=orders.total
nOrder1=orders.invoiceno
thisform.label2.Caption=TRANSFORM(orders.total) 
ENDSCAN
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
cancel
thisform.release
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1
SCAN
nPrice2=orders.total
nOrder2=orders.invoiceno
thisform.label3.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2
SCAN
nPrice3=orders.total
nOrder3=orders.invoiceno
thisform.label4.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3
SCAN
nPrice4=orders.total
nOrder4=orders.invoiceno
thisform.label5.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4
SCAN
nPrice5=orders.total
nOrder5=orders.invoiceno
thisform.label6.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5
SCAN
nPrice6=orders.total
nOrder6=orders.invoiceno
thisform.label7.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)=orders.custno  
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6
SCAN
nPrice7=orders.total
nOrder7=orders.invoiceno
thisform.label8.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 
SCAN
nPrice8=orders.total
nOrder8=orders.invoiceno
thisform.label9.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8
SCAN
nPrice9=orders.total
nOrder9=orders.invoiceno
thisform.label10.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
endif
LOCATE FOR orders.custno==VAL(thisform.combo1.value)  
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8 AND orders.total!=nPrice9
SCAN
nPrice10=orders.total
nOrder10=orders.invoiceno
thisform.label11.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR orders.custno==VAL(thisform.combo1.value)  
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8 AND orders.total!=nPrice9 AND orders.total!=nPrice10
SCAN
nPrice11=orders.total
nOrder11=orders.invoiceno
thisform.label12.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8 AND orders.total!=nPrice9 AND orders.total!=nPrice10 AND orders.total!=nPrice11
SCAN
nPrice12=orders.total
nOrder12=orders.invoiceno
thisform.label13.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8 AND orders.total!=nPrice9 AND orders.total!=nPrice10 AND orders.total!=nPrice11 AND orders.total!=nPrice12
SCAN
nPrice13=orders.total
nOrder13=orders.invoiceno
thisform.label14.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
LOCATE FOR VAL(thisform.combo1.value)==orders.custno 
IF FOUND() AND orders.stat!="O"
DO WHILE orders.total!=nPrice1 AND orders.total!=nPrice2 AND orders.total!=nPrice3 AND orders.total!=nPrice4 AND orders.total!=nPrice5 AND orders.total!=nPrice6 AND orders.total!=nPrice7 AND orders.total!=nPrice8 AND orders.total!=nPrice9 AND orders.total!=nPrice10 AND orders.total!=nPrice11 AND orders.total!=nPrice12 AND orders.total!=nPrice13
SCAN
nPrice14=orders.total
nOrer14=orders.invoiceno
thisform.label15.Caption=TRANSFORM(orders.total)
ENDSCAN
ENDDO
ELSE
MESSAGEBOX("This Customer Has No Current Orders",0,"No Orders Available")
endif
** End select code **

** Pay Button Code **
if thisform.credit.value=1
IF thisform.order1.value=1
USE
CLOSE TABLES
CLOSE DATABASES
CLOSE indexes
USE orders
LOCATE FOR nOrder1==orders.invoiceno
IF FOUND()

replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno==nOrder2
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno==nOrder3
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno==nOrder4
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno==nOrder5
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno==nOrder6
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno==nOrder7
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno==nOrder8
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno==nOrder9
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno==nOrder10
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno==nOrder11
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno==nOrder12
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno==nOrder13
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno==nOrder14
IF FOUND()
replace orders.stat WITH "O"
ENDIF
endif
nCard=INPUTBOX("Enter Credit Card Number","Enter Card Info")
IF thisform.order1.value=1
LOCATE FOR orders.invoiceno=nOrder1
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno=nOrder2
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno=nOrder3
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno=nOrder4
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno=nOrder5
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno=nOrder6
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno=nOrder7
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno=nOrder8
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno=nOrder9
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno=nOrder10
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno=nOrder11
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno=nOrder12
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno=nOrder13
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno=nOrder14
replace orders.payby WITH "Credit",;
orders.cardno WITH TRANSFORM(nCard),;
orders.amountpay WITH thisform.text2.value
ENDIF
ENDif
**check**
if thisform.check.value=1
IF thisform.order1.value=1
LOCATE FOR orders.invoiceno=nOrder1
replace orders.stat WITH "O"
ENDIF
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno=nOrder2
replace orders.stat WITH "O"
ENDIF
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno=nOrder3
replace orders.stat WITH "O"
ENDIF
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno=nOrder4
replace orders.stat WITH "O"
ENDIF
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno=nOrder5
replace orders.stat WITH "O"
ENDIF
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno=nOrder6
replace orders.stat WITH "O"
ENDIF
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno=nOrder7
replace orders.stat WITH "O"
ENDIF
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno=nOrder8
replace orders.stat WITH "O"
ENDIF
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno=nOrder9
replace orders.stat WITH "O"
ENDIF
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno=nOrder10
replace orders.stat WITH "O"
ENDIF
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno=nOrder11
replace orders.stat WITH "O"
ENDIF
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno=nOrder12
replace orders.stat WITH "O"
ENDIF
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno=nOrder13
replace orders.stat WITH "O"
ENDIF
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno=nOrder14
replace orders.stat WITH "O"
ENDIF
nChk=INPUTBOX("Enter Check Number.","Collect Check Information")
IF thisform.order1.value=1
LOCATE FOR orders.invoiceno=nOrder1
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno=nOrder2
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno=nOrder3
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno=nOrder4
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno=nOrder5
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno=nOrder6
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno=nOrder7
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno=nOrder8
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno=nOrder9
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno=nOrder10
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno=nOrder11
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno=nOrder12
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno=nOrder13
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno=nOrder14
replace orders.payby WITH "Check",;
orders.checkno WITH TRANSFORM(nChk),;
orders.amountpay WITH thisform.text2.value
ENDIF
endif
**Cash**
if thisform.cash.value=1
IF thisform.order1.value=1
LOCATE FOR orders.invoiceno=nOrder1
replace orders.stat WITH "O"
ENDIF
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno=nOrder2
replace orders.stat WITH "O"
ENDIF
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno=nOrder3
replace orders.stat WITH "O"
ENDIF
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno=nOrder4
replace orders.stat WITH "O"
ENDIF
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno=nOrder5
replace orders.stat WITH "O"
ENDIF
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno=nOrder6
replace orders.stat WITH "O"
ENDIF
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno=nOrder7
replace orders.stat WITH "O"
ENDIF
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno=nOrder8
replace orders.stat WITH "O"
ENDIF
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno=nOrder9
replace orders.stat WITH "O"
ENDIF
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno=nOrder10
replace orders.stat WITH "O"
ENDIF
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno=nOrder11
replace orders.stat WITH "O"
ENDIF
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno=nOrder12
replace orders.stat WITH "O"
ENDIF
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno=nOrder13
replace orders.stat WITH "O"
ENDIF
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno=nOrder14
replace orders.stat WITH "O"
ENDIF
nChg=INPUTBOX("Enter amount of cash receieved","Change Calculator")
MESSAGEBOX("Give Customer $"+(TRANSFORM(VAL(nChg)-thisform.text2.Value))+" Back.",0,"Change Calculator")
IF thisform.order1.value=1
LOCATE FOR orders.invoiceno=nOrder1
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order2.value=1
LOCATE FOR orders.invoiceno=nOrder2
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order3.value=1
LOCATE FOR orders.invoiceno=nOrder3
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order4.value=1
LOCATE FOR orders.invoiceno=nOrder4
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order5.value=1
LOCATE FOR orders.invoiceno=nOrder5
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order6.value=1
LOCATE FOR orders.invoiceno=nOrder6
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order7.value=1
LOCATE FOR orders.invoiceno=nOrder7
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order8.value=1
LOCATE FOR orders.invoiceno=nOrder8
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order9.value=1
LOCATE FOR orders.invoiceno=nOrder9
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order10.value=1
LOCATE FOR orders.invoiceno=nOrder10
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order11.value=1
LOCATE FOR orders.invoiceno=nOrder11
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order12.value=1
LOCATE FOR orders.invoiceno=nOrder12
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order13.value=1
LOCATE FOR orders.invoiceno=nOrder13
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
IF thisform.order14.value=1
LOCATE FOR orders.invoiceno=nOrder14
replace orders.payby WITH "Cash",;
orders.amountpay WITH thisform.text2.value
ENDIF
endif
**End Pay Code **
 
It's good that you started a new thread for this. The previous one was getting somewhat cluttered and difficult to follow.

But when you post a big chunk of code like that, PLEASE wrap it in [ignore]
Code:
 /
[/ignore] tags. It's very much easier to read that way.

Even so, it's a lot of code for anyone to get to grips with. Would it be possible for you to cut out the unnecessary bits so as to only show the code that's relevant to your problem?

I make these suggestions only to help you show your problem in the clearest possible way, which should in turn help you get a good answer.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Foxpro588

the order database is arranged to store the customer number of the customer, when you choose the customer from the top of the form, search through the orders database and find all the orders so you can select the ones you need to pick up.
I need help with putting them in this grid and having it to where you can select multiple orders and have it auto-total in the bottom text box, then save them all as paid when you push pay.

Well I gave the basic code of a fully working demo (please see former thread).

ad code: Hard to read - I would pretty much appreciate if you could explain in plain English what you're trying to achieve

ad programming: I don't want to push you, but it seems to me that you still think FoxPro instead of Visual FoxPro - you might want to read a little bit on OOP, SQL, and to consult more often the VFP9 HELP in order to feel more comfortable with VFP9. The learning curve is a little steep but at long its worth it.

hth

MarK

 
...

regarding your code, you may also want to check/read the helpfile for

SCAN FOR ... ENDSCAN

SEEK, SEEK(), INDEXSEEK() and

the scope of a DO WHILE ... ENDDO statement

hth

MarK
 
finally two book tips, "must-haves",

- "Hacker's Guide to Visual FoxPro 7" by Tamar Granor & Ted Roche edited by Doug Hennig - Hentzenwerke Publishing
- "What's New in Nine", by Tamar Granor, Doug Hennig, Rick Schummer et al - Hentzenwerke Publishing

and many more should be still available

MarK
 
Hi FoxProx558,

Apart from the excellent advise you have received here from MjcSkr I would strongly advise you to buy / read and study:

"1000 Things you would like to know about Visual FoxPro" written by Andy Kramek c.s.
This book, initialy written for VFP7 is still good even for version VFP9 it gives you all the basics with fully documented codings to produce virtualy everything you want.
Together with the book "What is new in VFP9" you are done.

Good luck.

Jockey(2)

P.S. your picture returns error 404 = not available
 
What I'm trying to do is, You type the customer's last name or phone number in the text box, then you click search, it populates the combobox with all the results in the format of <custno>: <last>, <First>, the customer number is always 6 digits in length or greater. it SHOULD use the customer number to check through the orders table for all the customer numbers that match it, if so, it will put the total amount as a caption aside the checkbox, the checkboxes are coded as:
thisform.checkbox1.click:
nPrice1+nPrice2+nPrice3 [etc to 14|Then sums them to a text box used for numeric values {thisform.text2}]
it runs that code for all the check boxes on the screen, but if the customer has more than 1 order, it freezes up on the 2nd one because I have an IF statement that says : DO WHILE nPrice2!=nPrice1 [etc... and does the label population code for the total prices]
 
hi foxprox558:

my honest suggestion is, find a local VFP programmer and ask to do the coding. once done, you can go over and then try to learn how it was done. i know you have a time limit from your customer as well. if you can not find a local coder, then google it and you will find many(not really) VFP programmers. as i see it, this is just one piece of the project, you may need more coding to make a complete application.

i wish someone could be able to take your code and give you feed back with corrections. it is a big job.

if you are determined to do it on your own, then divide the work into pieces and debug one piece at a time. such as, how to create a grid, how to search - by first name, last name, customer number by reading through one input as you already have. then how to populate the combo box and so on. post small questions, you will get the responses fairly quickly.

as jockey(2) responded earlier, your link to hitout.png may have spelling errors, and it does not work.


nasib
 
copy the link directly as text and use it, I know it doesnt work because tek-tips.com has a type of sub-browser inside of the website, and opens the website from itself.
 
Hi foxproo558,

Did you ever have a look at my code? It just does what you're looking for (except for the phone number)! You have to adapt it of course to your needs.

hth

MarcK
 
Hi,

Link

and now it works. You have wrongly selected the Picture option where you should have selected the link option in the editbox here in TekTips.


Jockey(2)
 
I've recently tried to change the DO WHILEs to IFs and now I'm not getting any results for customer orders.
 
wondering, how the original post has been converted to [ code ] [/code] ? as mike has suggested in his reply to foxprox558.
 
Hi foxpro558

Below the code of a fully working demo - even with a save method - and your request to show the payment options. Please have a thorough look at the methods that drive the demo (cboCustomers.GotFocus(), cboCustomers.Click(), cmdSave.Click()). Almost all the rest is visual stuff.

Please feel free to fine tune and adapt to your needs.

hth

MarK



Code:
**************************************************
PUBLIC go_Form

go_Form = NEWOBJECT("frmForm")

ADDPROPERTY(go_Form, "la_Customers[1]")

go_Form.Show

Read Events
Close all
Clear All
RETURN


**************************************************
DEFINE CLASS cboCombo AS ComboBox
	Width = 48
	Height = 24
	Style = 2
	RowSourceType = 1
	RowSource = "Open,Card,Cash,Check"
	ControlSource = "curOpenSales.C_PaidBy"
	
	PROCEDURE Click()
		LOCAL li_RecNo, lc_Alias
		LOCAL ARRAY la_Open[1]
		
		lc_Alias = ALIAS()
		li_RecNo = RECNO(lc_Alias)
		
		DODEFAULT()
		
		GOTO li_RecNo IN (lc_Alias)
		
		SELECT SUM(N_Price) FROM &lc_Alias WHERE &lc_Alias..C_PaidBy = "Open" INTO ARRAY la_Open
		
		IF VARTYPE(la_Open[1]) != "N"
			la_Open[1] = 0

		ENDIF 

		WITH go_Form.txtTotalSales
			.Value = la_Open[1]
			.Refresh()

		ENDWITH
	ENDPROC 
ENDDEFINE 
	
DEFINE CLASS frmForm AS Form
	AutoCenter = .T.
	Caption = "Sales"
	ShowTips = .T.
	Height = 480
	Width = 648
	MinHeight = This.Height
	MinWidth = This.Width
	
ADD OBJECT lblLastName AS Label WITH ;
	Caption = "Customer Lastname", ;
	Left = 12, ;
	Top = 6, ;
	Autosize = .T., ;
	Anchor = 3
	
ADD OBJECT cboCustomers AS ComboBox WITH ;
	Top = 6, Left = 150, Height = 30, Width = 246, Style = 2, BoundColumn = 2
		
	PROCEDURE cboCustomers.GotFocus()
		SELECT C_LName, C_CID FROM curCustomer ;
			ORDER BY 1 ;
			INTO ARRAY go_Form.la_Customers
		
		This.RowSourceType = 5
		This.RowSource = "go_Form.la_Customers"

	ENDPROC 
	
	PROCEDURE cboCustomers.Click()
		LOCAL ARRAY la_Open[1]
		
		SELECT * FROM curSales ;
			WHERE curSales.C_CID = ALLTRIM(This.Value) AND ;
				curSales.C_PaidBy = "Open" ;
			INTO CURSOR curOpenSales READWRITE 
		
		IF _Tally > 0
			WITH go_Form.grdOpenSales
				.Visible = .T.
				.RowHeight = 24
				.ColumnCount = -1
				.RecordSource = "curOpenSales"
				.SetAll("DynamicBackColor", "IIF(curOpenSales.C_PaidBy != [Open], RGB(255,255,255), RGB(0,255,0))", "Column")  && Alternate white and green records
				.Column1.ReadOnly = .T.
				.Column2.ReadOnly = .T.
				.Column3.ReadOnly = .T.
				.Column3.Sparse = .F.
				.Column3.Text1.InputMask = "9999.99"
				.Column4.Width = 120
				.Column4.Sparse = .F.
				.Column4.AddObject("cboPaidBy", "cboCombo")
				.Column4.RemoveObject("Text1")
				.Column4.CurrentControl = "cboPaidBy"
				.Column4.cboPaidBy.Visible = .T.


			ENDWITH 
		ELSE 
			go_Form.grdOpenSales.visible = .F.
			
		ENDIF
		
		SELECT * FROM curSales ;
			WHERE curSales.C_CID = ALLTRIM(This.Value) ;
			INTO CURSOR curSalesSelection READWRITE 
						
		IF _Tally > 0
			WITH go_Form.grdSales
				.Visible = .T.
				.RowHeight = 24
				.ColumnCount = -1
				.RecordSource = "curSalesSelection"
				.SetAll("DynamicBackColor", "IIF(curSalesSelection.C_PaidBy != [Open], RGB(255,255,255), RGB(0,255,0))", "Column")  && Alternate white and green records
				.Column1.ReadOnly = .T.
				.Column2.ReadOnly = .T.
				.Column3.ReadOnly = .T.
				.Column3.Sparse = .F.
				.Column3.Text1.InputMask = "9999.99"
				.Column3.Text1.FontBold = .T.
				.Column4.ReadOnly = .T.
				.Column4.Width = 120
				.Column4.Sparse = .F.
				.Column4.FontBold = .T.
				.Column5.ReadOnly = .T.

			ENDWITH 

			SELECT SUM(N_Price) FROM curSalesSelection WHERE curSalesSelection.C_PaidBy = "Open" INTO ARRAY la_Open

			IF VARTYPE(la_Open[1]) != "N"
				la_Open[1] = 0

			ENDIF 
			
			WITH go_Form
				.cmdSave.Visible = .T.
				.txtTotalSales.Visible = .T.
				.txtTotalSales.Value = la_Open[1]
				.lblOpenSales.Visible = .T.

			ENDWITH 
		ELSE 
			WITH go_Form
				.grdSales.Visible =.F.
				.cmdSave.Visible = .F.
				.txtTotalSales.Visible = .F.
				.lblOpenSales.Visible = .F.

			ENDWITH 

			= MESSAGEBOX("No open orders for this customer!",0, "Open Sales")

		ENDIF 
		
		go_Form.Refresh()
		
	ENDPROC
	
ADD OBJECT lblSelection AS Label WITH ;
	Caption = "Open Orders", ;
	FontBold = .T., ;
	Left = 12, ;
	Top = 36, ;
	Autosize = .T., ;
	Anchor = 1 + 2

ADD OBJECT lblOrders AS Label WITH ;
	Caption = "All Orders", ;
	FontBold = .T., ;
	Left = 12, ;
	Top = 192, ;
	Autosize = .T., ;
	Anchor = 2 + 8 + 16 + 64

ADD OBJECT shpLine as Line WITH ;
	Top = 180, ;
	Left = 12, ;
	Height = 0, ;
	Width = 624, ;
	Drawmode = 16, ;
	Anchor = 2 + 8 + 16 + 64

ADD OBJECT grdSales AS Grid WITH ;
	Left = 12, ;
	Top = 214, ;
	Width = 624, ;
	Height = 186, ;
	Anchor = 2 + 4 + 8 + 16, ;
	Visible = .F.

ADD OBJECT grdOpenSales AS Grid WITH ;
	Left = 12, ;
	Top = 54, ;
	Width = 624, ;
	Height = 120, ;
	Anchor = 1 + 2 + 8 + 64, ;
	Visible = .F.
	
ADD OBJECT txtTotalSales AS Textbox WITH ;
	Left = 276, Top = 408, Height = 42, Width = 360, Value = 0, InputMask = "999,999.99", Anchor = 2 + 4 + 8, Visible = .F. , ;
	FontBold = .T., FontSize = 24 
	
ADD OBJECT cmdSave AS CommandButton WITH ;
	Left = 12, Top = 408, Height = 42, Width = 60, Caption = "Save", Anchor = 2 + 4, Visible = .F.

	PROCEDURE cmdSave.Click()
		UPDATE curSales SET curSales.C_PaidBy = curOpenSales.C_PaidBy, curSales.C_CCNumber = curOpenSales.C_CCNumber ;
			WHERE curSales.C_CID = curOpenSales.C_CID AND curSales.N_Price = curOpenSales.N_Price
	
		go_Form.cboCustomers.Click()
		
	ENDPROC 

ADD OBJECT lblOpenSales AS Label WITH ;
	Caption = "Open Orders", ;
	Left = 78, ;
	Top = 408, ;
	Height = 42, ;
	Autosize = .T., ;
	FontBold = .T., ;
	FontSize = 24, ;
	Anchor = 2 + 4, ;
	Visible = .F.
	
	
PROCEDURE Destroy
	CLOSE ALL
	Clear Events

ENDPROC

PROCEDURE Load

	CREATE CURSOR curCustomer (C_CID C(3), C_LName C(20))
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI1", "Smith Frank")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI2", "Smithes Joe")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI3", "Klein Frank")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI4", "Klinert Suzy")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI5", "Dummy Peter")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI6", "Bogart Humphrey")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI7", "Bofort Percy")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI8", "Peterson Jane")
	INSERT INTO curCustomer (C_CID, C_LName) VALUES ("CI9", "Peterborough Haly")
	LOCATE 

	CREATE CURSOR curSales (C_CID C(3), C_Descri C(20), N_Price N(6,2), C_PaidBy C(5), C_CCNumber C(24)) 
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI1", "Description", 4.25, "Card","4566 5421 5445 6666 5564")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI1", "Description", 114.24, "Check","1234")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI1", "Description", 24.22, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI1", "Description", 324.23, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI2", "Description", 54.29, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI2", "Description", 654.27, "Check","1235")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI2", "Description", 47.28, "Check","1236")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI2", "Description", 468.26, "Card","6542 2451 5896 7458 4711")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI3", "Description", 447.24, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI3", "Description", 426.23, "Card","4712 7896 5412 3657 5411")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI3", "Description", 644.24, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI4", "Description", 954.25, "Check","1237")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI4", "Description", 384.27, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI4", "Description", 274.29, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI8", "Description", 164.25, "Card","5478 6895 5213 4652 7444")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI9", "Description", 104.25, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI3", "Description", 384.27, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI4", "Description", 274.29, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI7", "Description", 164.25, "Card","5478 6895 5213 4652 7444")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI6", "Description", 104.25, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI7", "Description", 384.27, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI9", "Description", 274.29, "Card","5478 6895 5213 4652 7444")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI6", "Description", 164.25, "Card","5478 6895 5213 4652 7444")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI4", "Description", 104.25, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI8", "Description", 384.27, "Check","1235")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI7", "Description", 274.29, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI9", "Description", 164.25, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI9", "Description", 104.25, "Open","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI6", "Description", 384.27, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI7", "Description", 274.29, "Check","1255")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI8", "Description", 164.25, "Cash","")
	INSERT INTO curSales (C_CID, C_Descri, N_Price, C_PaidBy, C_CCNumber ) VALUES ("CI9", "Description", 104.25, "Check","4125")

ENDPROC

ENDDEFINE
*********************************************
 
DO WHILE and IF are not interchangable. IF is checking a condition for truth once, WHILE is a loop repeated as lang as a conditon is true, when repeatedly tested. Obviously to end a DO WHILE you need to change part of the data, variables or other values tested in the WHILE condition. I don't see the logic you put there, but I have too little knowledge about your data. It seems odd to nest the DO WHILE and SCAN loops in this way. What I think is you want to process certain records, and that would be done by SCAN FOR, LOCATE FOR and SCAN REST or SCAN WHILE, neither by IF nor by DO WHILE. Check out your code flow.

Bye, Olaf.
 
mjcmkrsr, I really did enjoy your code, but I don't know how to convert it over to using my databases. Please Help Me!
 
Hi Foxpro588

I'd really love to but I don't know how. We gave you all the ingredients (please see also the other thread). What did you try? What does not work? Please ask precise and specific questions.

hth

MarK
 
I don't know how to populate the grid fields with my database information, the loop I guess you would say. I don't know how I would work that loop to put the info into it.
 
Well you set the RECORDSOURCE of your grid to your table/cursor/view.

Code:
		WITH go_Form.grdSales
			.Visible = .T.
			.RowHeight = 24
			.ColumnCount = -1
		        [u][i].RecordSource = "curSalesSelection"[/i][/u]
			.SetAll("DynamicBackColor", "IIF(curSalesSelection.C_PaidBy != [Open], RGB(255,255,255), RGB(0,255,0))", "Column")
			.Column1.ReadOnly = .T.
			.Column2.ReadOnly = .T.
			.Column3.ReadOnly = .T.
			.Column3.Sparse = .F.
			.Column3.Text1.InputMask = "9999.99"
			.Column3.Text1.FontBold = .T.
			.Column4.ReadOnly = .T.
			.Column4.Width = 120
			.Column4.Sparse = .F.
			.Column4.FontBold = .T.
			.Column5.ReadOnly = .T.

ENDWITH

Please have also a look at the following properties of your grid: LINKMASTER, CHILDORDER and RELATIONALEXPR

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top