Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Number at mytext
Message
De
21/02/2005 13:21:10
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00966918
Message ID:
00988920
Vues:
59
hi,
thank you for reply,
yes,i agree Mr.Tore's solution is the solution.
thanks.
best regards.
m.qasem

>Tore's solution is the solution. You have a billing number where the left part of the number is the year of a date and the right side is a sequence key.
>
>The left side of the number would be (as Tore suggested):
>
SET CENTRURY ON
>strLeft_Side_of_Billing_Number=str(year(ldBilling_Date),4) && "2005"
>strRight_Side_of_Billing_Number=right(str(GetNextBillingSeuence()+10000,5),4)
>strBillingNumber=strLeft_Side_of_Billing_Number+"-";
>                +strRight_Side_of_Billing_Number &&"2005-1234"
>* ......
>procedure GetNextBillingSeuence
>* get the last billing sequence from your key generator
>* for example
>lnCurrentBillingSequence=Field_WIth_Last_Billing_Sequence && 1233
>repl Field_WIth_Last_Billing_Sequence with ;
>     Field_WIth_Last_Billing_Sequence + 1
>return lnCurrentBillingSequence+1 &&1234
>endproc
>
>>hi,
>>thanks,
>>the customer want one field for billno and date as 2005-0001,
>>no field(date) at myform any more, is that possible or not,
>>thanks.
>>>I have already given you a good sugegstion on how to do this the right way, but I will repeat.
>>>
>>>The important thing to understand is that what you keep in the table, and what you print on the invoice, is different! Don't hang up in how you show the invoice, because that is only a question of how you want it to look.
>>>
>>>In the billinfo file, you already have a field for the date. I suggest that the billno field is an integer field which you start from 1 each new year. Then, on the invoice and on the screen, you have a function which transforms this info into how you want it to look.
>>>
>>>If you want 2005-1, you use this function: lcPrintable=Str(Year(billdate()),4) + '-' + LTRIM(str(billno))
>>>If you want 2005-0001 (which I and most people prefer) you use lcPrintable=Str(Year(billdate()),4) + '-' + Substr(Str(1000000+billno,7),4)
>>>If you want 2005-00001 (allows 99999 invoices per year) you use lcPrintable=Str(Year(billdate()),4) + '-' + Substr(Str(1000000+billno,7),3)
>>>If you want 2005-000001 (allows 999999 invoices per year) you use lcPrintable=Str(Year(billdate()),4) + '-' + Substr(Str(1000000+billno,7),2)
>>>
>>>But in the tabel billno is 1 in all these cases.
>>>
>>>>hi,
>>>>thanks,
>>>>but many months ago i ask when i have to fields,one for billno another for date,
>>>>my qustion for one field only, have billno as 1 and year(date) as 2005,
>>>>to be somthing as 2005-1.
>>>>all code under this is what you send to me months ago, with thanks so much.
>>>>
>>>>thanks.
>>>>
>>>>
>>>>
>>>>>Unless I misunderstand you completely, you now ask exactly the same question as you asked many months ago?
>>>>>
>>>>>>hi,
>>>>>>thank you for reply,
>>>>>>this code under for query it works,
>>>>>>but first how i can insert mybillno as 2005-1, to one field (billno),
>>>>>>and increment 1, evry new bill autamatic.as 2005-2....
>>>>>>
>>>>>>
>>>>>>lcBillno=thisform.txtBillno.value
>>>>>>Select * from billinfo where billno=lcBillno into cursor curBill
>>>>>>
>>>>>>thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>This code will select the data into a cursor curBill.
>>>>>>>lcBillno=yourpage.txtBillno.value
>>>>>>>Select * from billinfo where billno=lcBillno into cursor curBill
>>>>>>>
>>>>>>>>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.
>>>>>>>>
>>>>>>>----- SNIP -----
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform