Wed, 18 Jun 1902 08:00:00 GMT
First time in Pascal
This is the first time that I write code in BP7. Could anybody tell me if this sounds right. The code referenced various units. I am sure that they are OK. What I am trying to do is to generate a numbering sequence and place it in the short_note field. This is declared as short_note: String [7] procedure BeforeSave(pParamForInvc: ptParamForInvc); export; {************************************************************************} {DESC: Called just before the Document is written to disk. } {Sigo: Will open a file on the C:\ (root) (c:\terminv.txt) } {to take the last invoice number used and save it to Short_Note } {************************************************************************} var mycBuff: string[5]; mycShortNote: string[5]; myHandle1: shortint; myInvcnum:longint; myFileNam: string[15]; begin myFileNam:= 'C:\TERMINV.TXT'; myHandle1:= FileOpen(MyFileNam); FileSeek(myHandle,-5,2) FileRead(myHandle,MycBuff,5); Val(MycBuff, MyInvcnum, code); MyInvcnum:= MyInvcnum+1; Str(MyInvcnum,myShortNote); pParamForInvc^.pInvoice.^.Header_Data.Short_Note:= myShort_Note; Fileclose(Myhandle1) end; Thanks in advance
|