User Function MyCTBA102Inc()
Local nX
Local aArea := GetArea()
Local nDoc := 1
Local lRet := .T.
Local aCab := {}
Local aItens := {}
Local aLinha := {}
Local dDataLanc := ctod("11/28/2013")
Private lMsErroAuto := .F.
Private lMsHelpAuto := .T.
Private CTF_LOCK := 0
Private lSubLote := .T.
PREPARE COMPANY ENVIRONMENT "T1" BRANCH "D MG 01 " MODULE "CTB" TABLES "CT2"
aCab := {}
aAdd(aCab, {'DDATALANC' ,dDataBase ,NIL} )
aAdd(aCab, {'CLOTE' ,'333333' ,NIL} )
aAdd(aCab, {'CSUBLOTE' ,'001' ,NIL} )
aAdd(aCab, {'CDOC' ,'000001' ,NIL} )
aAdd(aCab, {'CPADRAO' ,'' ,NIL} )
aAdd(aCab, {'NTOTINF' ,0 ,NIL} )
aAdd(aCab, {'NTOTINFLOT' ,0 ,NIL} )
//entry 1
aAdd(aItens, { {'CT2_FILIAL' ,'0101 ' , NIL},;
{'CT2_LINHA' , '001' , NIL},;
{'CT2_MOEDLC' ,'01' , NIL},;
{'CT2_DC' ,'3' , NIL},;
{'CT2_DEBITO' ,'101010100' , NIL},;
{'CT2_CREDIT' ,'201010100' , NIL},;
{'CT2_VALOR' , 3000 , NIL},;
{'CT2_ORIGEM' ,'MSEXECAUT' , NIL},;
{'CT2_HP' ,'' , NIL},;
{'CT2_CONVER' ,'11' , NIL},;
{'CT2_HIST' ,'MSEXECCT2' , NIL} } )
//entry 2
aAdd(aItens, { {'CT2_FILIAL' ,'0101 ' , NIL},;
{'CT2_LINHA' , '002' , NIL},;
{'CT2_MOEDLC' ,'01' , NIL},;
{'CT2_DC' ,'3' , NIL},;
{'CT2_DEBITO' ,'101010100' , NIL},;
{'CT2_CREDIT' ,'201010100' , NIL},;
{'CT2_VALOR' , 4000 , NIL},;
{'CT2_ORIGEM' ,'MSEXECAUT' , NIL},;
{'CT2_HP' ,'' , NIL},;
{'CT2_CONVER' ,'11' , NIL},;
{'CT2_HIST' ,'MSEXECCT2LINHA2' , NIL} })
//add to the aItens array the needed quantity of entries you want to make
MSExecAuto({|x, y,z| CTBA102(x,y,z)}, aCab ,aItens, 3)
If lMsErroAuto
lMsErroAuto := .F.
MsgAlert("Entry ERROR" , "Load Test CT2")
mostraErro()
Exit
Endif
RestArea(aArea)
RESET ENVIRONMENT
Return