Exemplos: | #INCLUDE "PROTHEUS.CH" #INCLUDE "TBICONN.CH" User Function Tmata490MyMata490() Local aVetor aAuto := {} Private lMsErroAuto := .F. Private lMsHelpAuto := .T. aVetor:={ { PREPARE ENVIRONMENT EMPRESA "99" FILIAL "01" MODULO "FAT" TABLES "SE3","SA1","SA3" SA1->(dbSetOrder(1)) SA1->(dbSeek(xFilial("SA1")+"00000402")) SA3->(dbSetOrder(1)) SA3->(dbSeek(xFilial("SA3")+"000001")) aAdd(aAuto,{"E3_VEND" ,"000002",NIL},; SA3->A3_COD ,Nil}) aAdd(aAuto,{"E3_NUM" ,"000000233123456" ,NILNil}) aAdd(aAuto,; {"E3_EMISSAO" ,dDataBase ,NILNil}) aAdd(aAuto,; {"E3_SERIE" ,"1UNI" ,NILNil}) aAdd(aAuto,; {"E3_CODCLI" ,"000005",NIL},; SA1->A1_COD ,Nil}) aAdd(aAuto,{"E3_LOJA" ,"16",NIL},; SA1->A1_LOJA ,Nil}) aAdd(aAuto,{"E3_BASE" ,2000.001000 ,NILNil}) aAdd(aAuto,; {"E3_PORC" ,10 ,NILNil},; ) aAdd(aAuto,{"E3_DATA" ,dDataBase ,Nil}) aAdd(aAuto,{"E3_PREFIXO" ,"1001" ,NILNil}) aAdd(aAuto,; {"E3_PARCELA" ,"A1" ,NILNil}) aAdd(aAuto,; {"E3_SEQTIPO" ,"DH" ,NILNil}) aAdd(aAuto,; {"E3_MOEDAPEDIDO" ,"01654321" ,NILNil}) aAdd(aAuto,; {"E3_VENCTO" ,dDataBase ,NILNil}) aAdd(aAuto,; {"E3_PROCCOM" ,"TESTE INCLUSAO" ,NIL}} Nil}) aAdd(aAuto,{"E3_MOEDA" ,"01" ,Nil}) MSExecAuto({|x,y| mata490Mata490(x,y)},aVetoraAuto,3) //Inclusao If lMsErroAuto Alert Conout("Erro Inclusão") MOSTRAERRO() Else MostraErro( Conout("Incluído com sucesso.") Endif SE3->(dbSetOrder(1)) SE3->(dbSeek(xFilial("SE3")+"1 "+"000000233"+"A"+" "+"000002"))
aVetor:={ {"E3_VEND","000002",NIL},; {"E3_NUM","000000233",NIL},; {"E3_EMISSAO",dDataBase,NIL},; {"E3_SERIE","1 ",NIL},; {"E3_CODCLI","000005",NIL},; {"E3_LOJA","16",NIL},; {"E3_BASE",1000.00,NIL},; {"E3_PORC",5,NIL},; {"E3_PREFIXO","1 ",NIL},; {"E3_PARCELA","A",NIL},; {"E3_SEQ"," ",NIL},; {"E3_MOEDA","01",NIL},; {"E3_VENCTO",dDataBase+4,NIL},; {"E3_PROCCOM","TESTE INCLUSAO",NIL}}
lMsErroAuto := .F. MSExecAuto({|x,y| mata490(x,y)},aVetor,4) //Alteracao
If lMsErroAuto Alert("Erro Alteração") MostraErro() Endif
SE3->(dbSetOrder(1)) SE3->(dbSeek(xFilial("SE3")+"1 "+"000000233"+"A"+" "+"000002"))
aVetor:={ {"E3_VEND","000002",NIL},; {"E3_NUM","000000233",NIL},; {"E3_EMISSAO",dDataBase,NIL},; {"E3_SERIE","1 ",NIL},; {"E3_CODCLI","000005",NIL},; {"E3_LOJA","16",NIL},; {"E3_PREFIXO","1 ",NIL},; {"E3_PARCELA","A",NIL},; {"E3_SEQ"," ",NIL},; {"E3_MOEDA","01",NIL}}
lMsErroAuto := .F. MSExecAuto({|x,y| mata490(x,y)},aVetor,5) //Exclusao
If lMsErroAuto Alert("Erro Exclusão") MostraErro() Endif
Alert("Teste MSEXECAUTO MATA490 finalizado...")
Return |
---|