Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Number at mytext
Message
De
21/02/2005 06:46:50
 
 
À
11/12/2004 09:16:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00966918
Message ID:
00988815
Vues:
52
hi,
i need your help,if you have a time, to insert this code under at one field (billno ),and if i want to make query to any bill
becuse my customer need to make query about his bills via billno only
as 2005-1
i think myfield must be character,
lnYear=YEAR(DATE())
SELECT MAX(billno) from billinfo WHERE YEAR(billinfo.billdate)=lnYear INTO ARRAY laAarray
if _tally=0
  laArray=1
  thisform.text1.value=RIGHT(STR(YEAR(DATE()),4),2) + '_'+RIGHT(STR(10000+(billinfo.billno+1),5),4) else
  thisform.text1.value=(RIGHT(STR(YEAR(billinfo.billdate),4),2) + '_'+RIGHT(STR(10000+billinfo.billno+1,5),4))
endif
INSERT  INTO  billinfo(billno,billdate) VALUES (val(right(thisform.text1.Value,4)),DATE())
thanks.

>Try this:
>lnYear=YEAR(DATE())
>SELECT MAX(billno) from billinfo WHERE YEAR(billinfo.billdate)=lnYear INTO ARRAY laAarray
>if _tally=0
>  laArray=1
>  thisform.text1.value=(RIGHT(STR(lnYear),4),2) + '_'+RIGHT(STR(10000+1,5),4))
>else
>  thisform.text1.value=(RIGHT(STR(YEAR(billinfo.billdate),4),2) + '_'+RIGHT(STR(10000+billinfo.billno+1,5),4))
>endif
>INSERT  INTO  billinfo(billno,billdate) VALUES (val(right(thisform.text1.Value,4)),DATE())
>>hi,
>>ok ,i try ,it works,
>>
>>i try to change mypc calander to 2005 to get new bill as 05_0001
>>but i get ex...05_0009.
>>
>>SELECT MAX(billno) from billinfo INTO ARRAY laAarray
>>thisform.text1.value=(RIGHT(STR(YEAR(billinfo.billdate),4),2) + '_'+RIGHT(STR(10000+billinfo.billno+1,5),4))
>>INSERT  INTO  billinfo(billno,billdate) VALUES (val(right(thisform.text1.Value,4)),DATE())
>>
>>thanks.
>>m.qasem
>>
>>>Not that I can think of which is foolproof. In theory you can set traps in KeyPress, but it would be a lot of work.
>>>Why not have two textboxes very close, one with 04_ which is readonly, and the other with only the billno?
>>>
>>>>hi,
>>>>thank you so much,it works.
>>>>any way to let 04_ at mytext all the time at myform.
>>>>just can i insert billno as 0003 at my text.
>>>>
>>>>thanks.
>>>>best regards.
>>>>m.qasem
>>>>
>>>>>
>>>>>inyearofbill=2000+VAL(LEFT(thisform.text1.Value,2))
>>>>>inbillno=INT(VAL(SUBSTR(thisform.text1.value,4)))
>>>>>IF USED('billinfo')
>>>>>  SELECT Billinfo
>>>>>ELSE
>>>>>  SELECT 0
>>>>>  USE billinfo AGAIN && Billinfo may be used in another work area with another alias, so use AGAIN to be safe
>>>>>ENDIF
>>>>>LOCATE for YEAR(billdate)=inyearofbill AND billno=inbillno
>>>>>IF FOUND()
>>>>>  thisform.text2.value=name
>>>>>  .
>>>>>  .
>>>>>  .
>>>>>ELSE
>>>>>  =MESSAGEBOX("not found")
>>>>>endif
>>>>>
>>>>>>hi,
>>>>>>thank you very much,it works
>>>>>>i need to change this code with locate or scan as under
>>>>>>
>>>>>>
>>>>>>inyearofbill=2000+VAL(LEFT(thisform.text1.Value,2))
>>>>>>inbillno=INT(VAL(SUBSTR(thisform.text1.value,4)))
>>>>>>SELECT * from billinfo WHERE YEAR(billdate)=inyearofbill AND billno=inbillno INTO CURSOR curbilldata
>>>>>>************
>>>>>>LOCATE for YEAR(billdate)=inyearofbill AND billno=inbillno
>>>>>>IF FOUND()
>>>>>>thisform.text2.value=name
>>>>>>.
>>>>>>.
>>>>>>.
>>>>>>ELSE
>>>>>>=MESSAGEBOX("not found")
>>>>>>endif
>>>>>>********************
>>>>>>
>>>>>>
>>>>>>thanks.
>>>>>>m.qasem
>>>>>>
>>>>>>>
>>>>>>>INSERT  INTO  billinfo(billno,billdate) VALUES (val(right(thisform.text1.Value,4)),DATE())
>>>>>>>
>>>>>>>Remember that the value showed in thisform.text1.Value, 04-0001, is ONLY ment to show nicely, it is not the actual billno.
>>>>>>>
>>>>>>>>hi,
>>>>>>>>thank you very much,it works
>>>>>>>>i try to insert myvalue as under ,but i get error messag(data type mismatch)
>>>>>>>>
>>>>>>>>INSERT  INTO  billinfo(billno,billdate) VALUES (thisform.text1.Value,DATE())
>>>>>>>>
>>>>>>>>thanks.
>>>>>>>>m.qasem
>>>>>>>>
>>>>>>>>>Try this.
>>>>>>>>>
>>>>>>>>>thisform.text1.value=RIGHT(STR(YEAR(DATE()),4),2) + '_'+RIGHT(STR(10000+(billinfo.billno+1),5),4)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform