...
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include "rwmake.ch"
#include 'tbiconn.ch'
User Function AUTO450()
Local aAutoCab := {}
Local aArea := GetArea()
Local cTabSe1 := "TMPSE1A"
Local cTabSe2 := "TMPSE2A"
Local aSE1450 := {}
Local aSE2450 := {}
Local cFilSe2 := xFilial("SE2")
Local cFilSe1 := xFilial("SE1")
Private lMsHelpAuto := .T.
Private lMsErroAuto := .F.
BeginSql Alias cTabSe1
SELECT R_E_C_N_O_ as RECNO
FROM %Table:SE1% SE1
WHERE SE1.E1_FILIAL = %Exp:cFilSe1%
AND SE1.E1_PREFIXO = 'CPT'
AND SE1.E1_NUM = 'VT001'
AND SE1.E1_TIPO = 'NF'
AND SE1.E1_CLIENTE = 'FIN001'
AND SE1.E1_LOJA = '01'
AND SE1.%NotDel%
EndSql
While (cTabSe1)->(!EOF())
SE1->(DbGoto((cTabSe1)->RECNO))
AAdd(aSE1450, {SE1->E1_FILIAL+SE1->E1_PREFIXO+SE1->E1_NUM+SE1->E1_PARCELA+SE1->E1_TIPO})
(cTabSe1)->(DbSkip())
Enddo
(cTabSe1)->(DbCloseArea())
BeginSql Alias cTabSe2
SELECT R_E_C_N_O_ as RECNO
FROM %Table:SE2% SE2
WHERE SE2.E2_FILIAL = %Exp:cFilSe2%
AND SE2.E2_PREFIXO = 'CPT'
AND SE2.E2_NUM = 'VT001'
AND SE2.E2_TIPO = 'NF'
AND SE2.E2_FORNECE = 'FIN001'
AND SE2.E2_LOJA = '01'
AND SE2.%NotDel%
EndSql
While (cTabSe2)->(!EOF())
SE2->(DbGoto((cTabSe2)->RECNO))
AAdd(aSE2450, {SE2->E2_FILIAL+SE2->E2_PREFIXO+SE2->E2_NUM+SE2->E2_PARCELA+SE2->E2_TIPO+SE2->E2_FORNECE+SE2->E2_LOJA})
(cTabSe2)->(DbSkip())
Enddo
(cTabSe2)->(DbCloseArea())
aAutoCab := { {"AUTDVENINI450", cTod('27/08/19') , nil},;
{"AUTDVENFIM450", cTod('27/08/19') , nil},;
{"AUTNLIM450" , 10000 , nil},;
{"AUTCCLI450" , "FIN001" , nil},;
{"AUTCLJCLI" , "01" , nil},;
{"AUTCFOR450" , "FIN001" , nil},;
{"AUTCLJFOR" , "01" , nil},;
{"AUTCMOEDA450" , "01" , nil},;
{"AUTNDEBCRED" , 1 , nil},;
{"AUTLTITFUTURO", .F. , nil},;
{"AUTARECCHAVE" , aSE1450 , nil},;
{"AUTAPAGCHAVE" , aSE2450 , nil}}
MSExecAuto({|x,y,z| Fina450(x,y,z)}, nil , aAutoCab , 3 )
If !lMsErroAuto
alert("¡Incluido con éxito! ")
confirmsx8()
Else
alert("Erro na inclusao!")
rollbacksx8()
MostraErro()
EndIf
RestArea(aArea)
Return |
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include "rwmake.ch"
#include 'tbiconn.ch'
User Function AUTO450()
Local aAutoCab := {}
Local aArea := GetArea()
Local cTabSe1 := "TMPSE1A"
Local cTabSe2 := "TMPSE2A"
Local aSE1450 := {}
Local aSE2450 := {}
Local cFilSe2 := xFilial("SE2")
Local cFilSe1 := xFilial("SE1")
Private lMsHelpAuto := .T.
Private lMsErroAuto := .F.
BeginSql Alias cTabSe1
SELECT R_E_C_N_O_ as RECNO
FROM %Table:SE1% SE1
WHERE SE1.E1_FILIAL = %Exp:cFilSe1%
AND SE1.E1_PREFIXO = 'CPT'
AND SE1.E1_NUM = 'VT001'
AND SE1.E1_TIPO = 'NF'
AND SE1.E1_CLIENTE = 'FIN001'
AND SE1.E1_LOJA = '01'
AND SE1.%NotDel%
EndSql
While (cTabSe1)->(!EOF())
SE1->(DbGoto((cTabSe1)->RECNO))
AAdd(aSE1450, {SE1->E1_FILIAL+SE1->E1_PREFIXO+SE1->E1_NUM+SE1->E1_PARCELA+SE1->E1_TIPO})
(cTabSe1)->(DbSkip())
Enddo
(cTabSe1)->(DbCloseArea())
BeginSql Alias cTabSe2
SELECT R_E_C_N_O_ as RECNO
FROM %Table:SE2% SE2
WHERE SE2.E2_FILIAL = %Exp:cFilSe2%
AND SE2.E2_PREFIXO = 'CPT'
AND SE2.E2_NUM = 'VT001'
AND SE2.E2_TIPO = 'NF'
AND SE2.E2_FORNECE = 'FIN001'
AND SE2.E2_LOJA = '01'
AND SE2.%NotDel%
EndSql
While (cTabSe2)->(!EOF())
SE2->(DbGoto((cTabSe2)->RECNO))
AAdd(aSE2450, {SE2->E2_FILIAL+SE2->E2_PREFIXO+SE2->E2_NUM+SE2->E2_PARCELA+SE2->E2_TIPO+SE2->E2_FORNECE+SE2->E2_LOJA})
(cTabSe2)->(DbSkip())
Enddo
(cTabSe2)->(DbCloseArea())
aAutoCab := { {"AUTDVENINI450", cTod('27/08/19') , nil},;
{"AUTDVENFIM450", cTod('27/08/19') , nil},;
{"AUTNLIM450" , 10000 , nil},;
{"AUTCCLI450" , "FIN001" , nil},;
{"AUTCLJCLI" , "01" , nil},;
{"AUTCFOR450" , "FIN001" , nil},;
{"AUTCLJFOR" , "01" , nil},;
{"AUTCMOEDA450" , "01" , nil},;
{"AUTNDEBCRED" , 1 , nil},;
{"AUTLTITFUTURO", .F. , nil},;
{"AUTARECCHAVE" , aSE1450 , nil},;
{"AUTAPAGCHAVE" , aSE2450 , nil}}
MSExecAuto({|x,y,z| Fina450(x,y,z)}, nil , aAutoCab , 3 )
If !lMsErroAuto
alert("¡Incluido con éxito! ")
confirmsx8()
Else
alert("¡Error en la inclusión!")
rollbacksx8()
MostraErro()
EndIf
RestArea(aArea)
Return |
...