Kamis, 11 September 2008

Dapatkan nomor transaksi terakhir (Visual Foxpro)

FUNCTION getnum
PARAMETERS lcalias,lddate,lckey,fld,cPP
PRIVATE lcoldalias,bd,BL
lcoldalias = Alias()
bl=bulan(lddate)
bd=SUBSTR(lckey,1,3)+SUBSTR(DTOC(lddate),9,2)+bl
BLN=MONTH(lddate)
THN=YEAR(lddate)
*------------------------------------------------------
lup="Select * from &lcalias where !DELETED() and MONTH(tgltrn)="+TRANSFORM(MONTH(lddate),'99')+"AND YEAR(tgltrn)="+TRANSFORM(YEAR(lddate),'9999')

ll=SQLEXEC(lnHandle,lup,'temnum')
SELECT temnum
CALCULATE MAX(&fld) FOR SUBSTR(&fld,1,6)=BD TO MCT
MCT=VAL(RIGHT(MCT,5))+1
lcreturn=bd+ALLTRIM(NtoC(mct,5))
SELECT(lcoldalias)
Return lcreturn
ENDFUNC

FUNCTION ntoc
PARAMETER NVAR, NLEN
IF PARAMETERS()=1
NLEN = 10
ENDIF
RETURN STRTRAN(STR(NVAR, NLEN), ' ', '0')
ENDFUNC

Tidak ada komentar:

Mengenai Saya

Foto saya
Bekasi, Jawa Barat, Indonesia
eSoft Software product : - Dental Clinic system - General Ledger (Accounting System) - Manufacturing System - Trading system