//INCLUSIÓN DE FACTURA PREVIA
#INCLUDE "RWMAKE.CH"
#INCLUDE "TBICONN.CH"
User Function EXEC140I()
Local nOpc := 3
Private aCabec := {}
Private aItens := {}
Private aLinha := {}
Private lMsErroAuto := .F.
PREPARE ENVIRONMENT EMPRESA "T1" FILIAL "D MG 01" MODULO "COM" TABLES "SF1","SD1","SA1","SA2","SB1","SB2","SF4" USER "admin" PASSWORD "1234"
aAdd(aCabec,{'F1_TIPO','N',NIL})
aAdd(aCabec,{'F1_FORMUL','N',NIL})
aAdd(aCabec,{'F1_DOC','INC000001',NIL})
aAdd(aCabec,{"F1_SERIE","001",NIL})
aAdd(aCabec,{"F1_EMISSAO",dDataBase,NIL})
aAdd(aCabec,{'F1_FORNECE','000001',NIL})
aAdd(aCabec,{'F1_LOJA','01',NIL})
aAdd(aCabec,{"F1_ESPECIE","NFE",NIL})
aAdd(aCabec,{"F1_COND",'001',NIL})
aAdd(aCabec,{"F1_STATUS",'',NIL})
aAdd(aItens,{'D1_ITEM',StrZero(1,4),NIL})
aAdd(aItens,{'D1_COD',"01",NIL})
aAdd(aItens,{"D1_QUANT",1,Nil})
aAdd(aItens,{"D1_VUNIT",1,Nil})
aAdd(aItens,{"D1_TOTAL",1,Nil})
aAdd(aItens,{"D1_TES",'',NIL})
aAdd(aLinha,aItens)
MSExecAuto({|x,y,z,a,b| MATA140(x,y,z,a,b)}, aCabec, aLinha, nOpc,,)
If lMsErroAuto
mostraerro()
Else
Alert("¡Execauto MATA140 de inclusión ejecutado con éxito!")
EndIf
RESET ENVIRONMENT
Return
//MODIFICACIÓN DE FACTURA PREVIA
#INCLUDE "RWMAKE.CH"
#INCLUDE "TBICONN.CH"
User Function EXEC140A()
Local nOpc := 4
Local nX
Private aCabec := {}
Private aItens := {}
Private aLinha := {}
Private lMsErroAuto := .F.
PREPARE ENVIRONMENT EMPRESA "T1" FILIAL "D MG 01" MODULO "COM" TABLES "SF1","SD1","SA1","SA2","SB1","SB2","SF4" USER "admin" PASSWORD "1234"
aAdd(aCabec,{'F1_TIPO','N',NIL})
aAdd(aCabec,{'F1_FORMUL','N',NIL})
aAdd(aCabec,{'F1_DOC','INC000001',NIL})
aAdd(aCabec,{"F1_SERIE","001",NIL})
aAdd(aCabec,{"F1_EMISSAO",dDataBase,NIL})
aAdd(aCabec,{'F1_FORNECE','000001',NIL})
aAdd(aCabec,{'F1_LOJA','01',NIL})
aAdd(aCabec,{"F1_ESPECIE","NFE",NIL})
aAdd(aCabec,{"F1_COND",'001',NIL})
aAdd(aCabec,{"F1_STATUS",'',NIL})
For nX := 1 To 2
aItens := {}
aAdd(aItens,{'D1_ITEM',StrZero(nX,4),NIL})
aAdd(aItens,{'D1_COD',IIF(nX==1,"01","001"),NIL})
aAdd(aItens,{"D1_QUANT",1,Nil})
aAdd(aItens,{"D1_VUNIT",1,Nil})
aAdd(aItens,{"D1_TOTAL",1,Nil})
aAdd(aItens,{"D1_TES",'',NIL})
aAdd(aLinha,aItens)
Next
MSExecAuto({|x,y,z,a,b| MATA140(x,y,z,a,b)}, aCabec, aLinha, nOpc,,)
If lMsErroAuto
mostraerro()
Else
Alert("¡Execauto MATA140 de modificación ejecutado con éxito!")
EndIf
RESET ENVIRONMENT
Return
//BORRADO DE FACTURA PREVIA
#INCLUDE "RWMAKE.CH"
#INCLUDE "TBICONN.CH"
User Function EXEC140EX()
Local nOpc := 5
Local nX
Private aCabec := {}
Private aItens := {}
Private aLinha := {}
Private lMsErroAuto := .F.
PREPARE ENVIRONMENT EMPRESA "T1" FILIAL "D MG 01" MODULO "COM" TABLES "SF1","SD1","SA1","SA2","SB1","SB2","SF4" USER "admin" PASSWORD "1234"
aAdd(aCabec,{'F1_TIPO','N',NIL})
aAdd(aCabec,{'F1_FORMUL','N',NIL})
aAdd(aCabec,{'F1_DOC','INC000001',NIL})
aAdd(aCabec,{"F1_SERIE","001",NIL})
aAdd(aCabec,{"F1_EMISSAO",dDataBase,NIL})
aAdd(aCabec,{'F1_FORNECE','000001',NIL})
aAdd(aCabec,{'F1_LOJA','01',NIL})
aAdd(aCabec,{"F1_ESPECIE","NFE",NIL})
aAdd(aCabec,{"F1_COND",'001',NIL})
aAdd(aCabec,{"F1_STATUS",'',NIL})
For nX := 1 To 2
aItens := {}
aAdd(aItens,{'D1_ITEM',StrZero(nX,4),NIL})
aAdd(aItens,{'D1_COD',IIF(nX==1,"01","001"),NIL})
aAdd(aItens,{"D1_QUANT",1,Nil})
aAdd(aItens,{"D1_VUNIT",1,Nil})
aAdd(aItens,{"D1_TOTAL",1,Nil})
aAdd(aItens,{"D1_TES",'',NIL})
aAdd(aLinha,aItens)
Next
MSExecAuto({|x,y,z,a,b| MATA140(x,y,z,a,b)}, aCabec, aLinha, nOpc,,)
If lMsErroAuto
mostraerro()
Else
Alert("¡Execauto MATA140 de borrado ejecutado con éxito!")
EndIf
RESET ENVIRONMENT
Return
//REVERSIÓN DE CLASIFICACIÓN DE FACTURA PREVIA
#INCLUDE "RWMAKE.CH"
#INCLUDE "TBICONN.CH"
User Function EXEC140EST()
Local nOpc := 7
Private aCabec := {}
Private aItens := {}
Private aLinha := {}
Private lMsErroAuto := .F.
PREPARE ENVIRONMENT EMPRESA "T1" FILIAL "D MG 01" MODULO "COM" TABLES "SF1","SD1","SA1","SA2","SB1","SB2","SF4" USER "admin" PASSWORD "1234"
aAdd(aCabec,{'F1_TIPO','N',NIL})
aAdd(aCabec,{'F1_DOC','INC000001',NIL})
aAdd(aCabec,{"F1_SERIE","001",NIL})
aAdd(aCabec,{'F1_FORNECE','000001',NIL})
aAdd(aCabec,{'F1_LOJA','01',NIL})
aItens := {}
aAdd(aItens,{'D1_ITEM',StrZero(1,4),NIL})
aAdd(aItens,{'D1_COD',"01","001",NIL})
aAdd(aItens,{"D1_QUANT",1,Nil})
aAdd(aItens,{"D1_VUNIT",1,Nil})
aAdd(aItens,{"D1_TOTAL",1,Nil})
aAdd(aLinha,aItens)
MSExecAuto({|x,y,z,a,b| MATA140(x,y,z,a,b)}, aCabec, aLinha, nOpc,,)
If lMsErroAuto
mostraerro()
Else
Alert("¡Execauto MATA140 de reversión de clasificación ejecutado con éxito!")
EndIf
RESET ENVIRONMENT
Return
|