The following code which I have on a form works just fine. It draws information from a library and on Service Fee field I get the balance due for the previous invoice and on the description flied I get Balance on Invoice Number 05892. My problem come when I move to the next record and do the same thing, the service fee field puts the right dollar amount on the field, however the Description field now reads Balance on Invoice Number 5893 and omits the first digit which is the zero. I can only get this to work when the form first opens the all the other records have the first digit missing. Can someone tell me why this happens?
THANKS ALL
method pushButton(var eventInfo Event)
VAR
d Date
newd Date
invoiceNum Number
invoicetbl Table
lineitemtbl Table
endVar
dodefault
BalanceLib.Open("Balance"
outputArray["Invoice_No"] = Invoice_No.Value
outputArray["Balance"] = Balance.Value
BalanceLib.PassArray(outputArray)
If DraftDate=Blank()
then
msgStop("Financial Designs DBS, Inc.","Select a Draft Date for This Invoice"
else
if Balance.Value > 0.00
then
Invoice_No.Moveto()
Invoice.action(databeginedit)
Invoice.Action(DataEnd)
Invoice.Action(FieldDown)
Invoice_No.ReadOnly=False
invoicetbl.attach("Invoice.DB"
d = today()
newD = date(string(month(d)+1)+"/1/"+string(year(d)))
Invoice_Date.Value=Newd
invoicenum = invoicetbl.cmax("Invoice No"+1
Invoice_No.Value = invoiceNum
Action(FieldRight)
Invoice_No.ReadOnly=True
lineitemtbl.attach("lineitem.DB"
Debit_Date.Moveto()
lineitem.action(databeginedit)
lineitem.Action(DataEnd)
lineitem.Action(FieldDown)
Debit_Date.Value = Invoice_Date.Value
Action(FieldRight)
Amount_Paid.Value=0
Debit_Date.Value=Invoice_Date.Value
inputArray = BalanceLib.ReadArray()
Description.Value = "Balance on Invoice Number "+inputArray["Invoice_No"]
Service_Fee.Value = inputArray["Balance"]
Total_Invoice.Value=TotExt.Value
Service_Fee.Moveto()
BalanceLib.close()
else
BalanceLib.close()
Invoice_No.Moveto()
Invoice.action(databeginedit)
Invoice.Action(DataEnd)
Invoice.Action(FieldDown)
Invoice_No.ReadOnly=False
invoicetbl.attach("Invoice.DB"
d = today()
newD = date(string(month(d)+1)+"/1/"+string(year(d)))
Invoice_Date.Value=Newd
invoicenum = invoicetbl.cmax("Invoice No"+1
Invoice_No.Value = invoiceNum
Action(FieldRight)
Invoice_No.ReadOnly=True
Total_Invoice.Value=0
Amount_Paid.Value=0
Balance.Value=0
Endif
If Draft.Value="Yes"
then
DD.Value=DraftDate.Value
Else
DD.Value="N/A"
endif
endif
endmethod
THANKS ALL
method pushButton(var eventInfo Event)
VAR
d Date
newd Date
invoiceNum Number
invoicetbl Table
lineitemtbl Table
endVar
dodefault
BalanceLib.Open("Balance"
outputArray["Invoice_No"] = Invoice_No.Value
outputArray["Balance"] = Balance.Value
BalanceLib.PassArray(outputArray)
If DraftDate=Blank()
then
msgStop("Financial Designs DBS, Inc.","Select a Draft Date for This Invoice"
else
if Balance.Value > 0.00
then
Invoice_No.Moveto()
Invoice.action(databeginedit)
Invoice.Action(DataEnd)
Invoice.Action(FieldDown)
Invoice_No.ReadOnly=False
invoicetbl.attach("Invoice.DB"
d = today()
newD = date(string(month(d)+1)+"/1/"+string(year(d)))
Invoice_Date.Value=Newd
invoicenum = invoicetbl.cmax("Invoice No"+1
Invoice_No.Value = invoiceNum
Action(FieldRight)
Invoice_No.ReadOnly=True
lineitemtbl.attach("lineitem.DB"
Debit_Date.Moveto()
lineitem.action(databeginedit)
lineitem.Action(DataEnd)
lineitem.Action(FieldDown)
Debit_Date.Value = Invoice_Date.Value
Action(FieldRight)
Amount_Paid.Value=0
Debit_Date.Value=Invoice_Date.Value
inputArray = BalanceLib.ReadArray()
Description.Value = "Balance on Invoice Number "+inputArray["Invoice_No"]
Service_Fee.Value = inputArray["Balance"]
Total_Invoice.Value=TotExt.Value
Service_Fee.Moveto()
BalanceLib.close()
else
BalanceLib.close()
Invoice_No.Moveto()
Invoice.action(databeginedit)
Invoice.Action(DataEnd)
Invoice.Action(FieldDown)
Invoice_No.ReadOnly=False
invoicetbl.attach("Invoice.DB"
d = today()
newD = date(string(month(d)+1)+"/1/"+string(year(d)))
Invoice_Date.Value=Newd
invoicenum = invoicetbl.cmax("Invoice No"+1
Invoice_No.Value = invoiceNum
Action(FieldRight)
Invoice_No.ReadOnly=True
Total_Invoice.Value=0
Amount_Paid.Value=0
Balance.Value=0
Endif
If Draft.Value="Yes"
then
DD.Value=DraftDate.Value
Else
DD.Value="N/A"
endif
endif
endmethod