Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Bloco de código
languagephp
themeRDark
titleMATA540 - Rotina Automática de Cadastro de Exceção Fiscal - Inclusão
#INCLUDE "RWMAKE.CH"
#INCLUDE "TBICONN.CH"
#INCLUDE 'Protheus.ch'
#INCLUDE 'FWMVCDef.ch'
 
//------------------------------------------------------------------------
/*
EXEMPLO DE INCLUSÃO MODELO 1
*/
//------------------------------------------------------------------------
User Function m540Inc()
Local oModel := Nil
Local nSeq := 1
Local cSequen := 0
Private lMsErroAuto := .F.
 
PREPARE ENVIRONMENT EMPRESA "99T1" FILIAL "01XIFIS26"
 
cSequen := StrZero(nSeq,TamSx3("F7_SEQUEN")[1],0)
 
oModel := FwLoadModel ("MATA540")
oModel:SetOperation(MODEL_OPERATION_INSERT)
oModel:Activate()
oModel:SetValue("SF7MASTER","F7_GRTRIB" ,"050" )
oModel:SetValue("SF7DETAIL","F7_SEQUEN" ,cSequen )
oModel:SetValue("SF7DETAIL","F7_EST" ,"**" )
oModel:SetValue("SF7DETAIL","F7_TIPOCLI","*" )
oModel:SetValue("SF7DETAIL","F7_ALIQINT",12 )
oModel:SetValue("SF7DETAIL","F7_ALIQEXT",12 )
oModel:SetValue("SF7DETAIL","F7_MARGEM" ,12 )
oModel:SetValue("SF7DETAIL","F7_ALIQDST",12 )
oModel:SetValue("SF7DETAIL","F7_GRPCLI" ,"001" )
oModel:SetValue("SF7DETAIL","F7_ISS" ,"N" )
oModel:SetValue("SF7DETAIL","F7_VLR_ICM",12 )
oModel:SetValue("SF7DETAIL","F7_VLR_IPI",12 )
oModel:SetValue("SF7DETAIL","F7_VLR_PIS",0 )
oModel:SetValue("SF7DETAIL","F7_VLR_COF",0 )
oModel:SetValue("SF7DETAIL","F7_VLRICMP",12 )
oModel:SetValue("SF7DETAIL","F7_ALIQIPI",12 )
oModel:SetValue("SF7DETAIL","F7_ALIQPIS",0 )
oModel:SetValue("SF7DETAIL","F7_ALIQCOF",0 )
oModel:SetValue("SF7DETAIL","F7_BASEICM",0 )
oModel:SetValue("SF7DETAIL","F7_BASEIPI",0 )
oModel:SetValue("SF7DETAIL","F7_REDPIS" ,0 )
oModel:SetValue("SF7DETAIL","F7_REDCOF" ,0 )
oModel:SetValue("SF7DETAIL","F7_ICMPAUT","1" )
oModel:SetValue("SF7DETAIL","F7_UFBUSCA","1" )
oModel:SetValue("SF7DETAIL","F7_BSICMST",0 )
oModel:SetValue("SF7DETAIL","F7_PRCUNIC",0 )
oModel:SetValue("SF7DETAIL","F7_DTINCLU",dDataBase )
oModel:SetValue("SF7DETAIL","F7_ORIGEM" ,"0" )
oModel:SetValue("SF7DETAIL","F7_SITTRIB","00" )
 
 
If oModel:VldData()
   oModel:CommitData()
   MsgInfo("Registro INCLUIDO!", "Atenção")
Else
   VarInfo("",oModel:GetErrorMessage())
EndIf
 
oModel:DeActivate()
oModel:Destroy()
 
oModel := NIL
 
Return Nil