Páginas filhas
  • DT EP F120CUST Fixed Assets entry point record saving in work table to use in file EFD Contributions Record F120_F130 BRA

01. GENERAL DATA

Product:

TOTVS Backoffice

Product Line:

Microsiga Protheus Line

Industry:

Services

Module:

Fixed Assets - SIGAATF

Function:

_DeprecAtivo() - FisxAtf

Country:

Brazil

Ticket:

13789163

Requirement/Story/Issue:

DSERCTR1-36362


02. STATUS/REQUISITION

The call of entry point F120CUST is not executed when record F120 is saved. It is only called when record F130 is saved, in the entry of the work file record used by the Tax Records routine to generate the output file.


03. SOLUTION

We have adjusted the source code and documentation of entry point F120CUST, so it is also called when adding/handling the work record file use by the Tax Records routine to generate the output file.

Important: This entry point replaces the default saving of records in the work table related to records F120 and F130. As it is a customization, the customer is fully responsible for the data saved in the output file.


04. OTHER INFORMATION


PE F120CUST

The purpose of this entry point is to replace the default saving in the record entry of the work file used by Tax Records to generate the EFD Contributions file for records F120 and F130 in the output file.

Important !!

The examples used in this documentation are merely illustrative and have pedagogical purposes. The operation and goal of the Entry Point is of the customer's full responsibility.



Entry Point Parameters:

Order (PARAMIXB)

Parameter

Type

Description

Required

Applies to Records

1

cReg

Character

Block to be generated (F120/F130)

Yes

F120/F130

2

 cAliasTmp

Character

Alias of temporary table containing the records to be saved in the files, which can be changed through the EP

Yes

F120/F130

3

 cCodBem

Character

Code of fixed asset

Yes

F120/F130

4

cItem

Character

Item of fixed asset

Yes

F120/F130

5

cDescr

Character

Description of fixed asset

No

F120/F130

6

dData

Date

File creation date

Yes

F120/F130

7

cDescExt

Character

Extended description of fixed asset

No

F120/F130

8

cTabOri

Character

Source table of file creation

No

F120/F130

9

cNumPro

Character

Number of referenced process related to the asset

Yes

F120/F130

10

cIndPro

Character

Type of referenced process related to the asset

Yes

F120/F130

11

nValue

Numeric

Value to be generated in block

Yes

F120/F130

12

cAliasSN1

Character

Temporary table of SN1 (Fixed Assets)

No

F120/F130

13

nBase

Numeric

Base Value

Yes

F120

14

cContaC

Character

Ledger Account 

Yes

F120

15

cCCusto

Character

Cost Center

Yes

F120

16

cOrigCred

Character

Credit Source Ind.      (0=Internal Market Acq;1=External Market Acq.)

Yes

F120

17

cCSTPis

Character

Tax St Code PIS

Yes

F120

18

nAliqPis

Numeric

PIS Rate

Yes

F120

19

cCSTCofins

Character

Tax St Code Cofins     

Yes

F120

20

nAliqCofins

Numeric

Cofins Rate

Yes

F120

21

cIndBem

Character

Asset Identification     (Table 11 SN0)

Yes

F120

22

cUtilBem

Character

Asset Utilization     (Table 12 SN0)

Yes

F120

23

cNatBCCrd

Character

Credit BCC Code     

Yes

F120

24

cNotaFis

Character

Invoice

Yes

F120

25

cSerNF

Character

Invoice Series

Yes

F120

26

cFornec

Character

Supplier Code

Yes

F120

27

cLoja

Character

Supplier Store

Yes

F120

28

nVlrExcl

Numeric

Value to be deleted 

Yes

F120


Parameters 01-12 - Apply to records F120 and F130

Parameters 13-27 - Apply to record F120 only


What the entry point must return

Return

Type

Description

Mandatory

NIL

NIL

Only populates the output file



Example of use:

Example of rule in use
#Include 'Protheus.ch'

User Function F120CUST()

Local cReg := paramixb[1]
Local cAliasTmp := paramixb[2]
Local cCodBem := paramixb[3]
Local cItem := paramixb[4]
Local cDescr := paramixb[5]
Local dData := paramixb[6]
Local cDescExt := paramixb[7]
Local cTabOri := paramixb[8]
Local cNumPro := paramixb[9]
Local cIndPro := paramixb[10]
Local nValor := paramixb[11]
Local cAliasSN1 := paramixb[12]

//from paramixb[13] only applies to record F120
Local nBase      := paramixb[13]
Local cContaC	 :=	paramixb[14]
Local cCCusto	 :=	paramixb[15]
Local cOrigCred	 :=	paramixb[16]
Local cCSTPis	 :=	paramixb[17]
Local nAliqPis	 :=	paramixb[18]
Local cCSTCofins :=	paramixb[19]
Local nAliqCofins :=paramixb[20]
Local cIndBem	 :=	paramixb[21]
Local cUtilBem	 :=	paramixb[22]
Local cNatBCCrd	 :=	paramixb[23]
Local cNotaFis	 :=	paramixb[24]
Local cSerNF	 :=	paramixb[25]
Local cFornec	 :=	paramixb[26]
Local cLoja	     :=	paramixb[27]
Local nVlrExcl   := paramixb[28]

Local lNils	     := .F.

Local cIND_ORIG_C := ""
Local nALIQ_PIS := 0.65
Local nCST_PIS := 0.65
Local nCST_COFINS := 3
Local nALIQ_COFIN := 3

//User customizations

If cReg == "F120"


    lNils	:=	cContaC==Nil .And. cCCusto==Nil .And. cOrigCred==Nil .And. cCSTPis==Nil .And. nAliqPis==Nil .And.;
					cCSTCofins==Nil .And. 	nAliqCofins==Nil .And. cIndBem==Nil .And. cUtilBem==Nil

    //registro F120
	(cAliasTmp)->(dbSetOrder(1))
	If !(cAliasTmp)->(dbSeek(cCodBem+cItem+dtos(dData)))
		
		//Processing of complementary description of asset SN2.
		If !lNils
			cDescExt	:= U_Atf130DExt(cCodBem,cItem)
			cDescExt	:= If(Empty(cDescExt),cDescr,cDescExt)
		EndIf
		
		RecLock(cAliasTmp,.T.)
		(cAliasTmp)->BEM	:= cCodBem
		(cAliasTmp)->ITEM	:= cItem
		(cAliasTmp)->DESCRI	:= cDescr

		(cAliasTmp)->DTAPR	:= dData
		
		If !lNils	
			(cAliasTmp)->NATBCCRED	:=	cNatBCCrd
			(cAliasTmp)->INDBEMIMOB	:=	cIndBem		
			(cAliasTmp)->INDORIGCRD	:=	cOrigCred	
			(cAliasTmp)->INDUTILBEM	:=	cUtilBem	
			(cAliasTmp)->CSTPIS		:=	cCSTPis
			(cAliasTmp)->ALIQPIS		:=	nAliqPis
			(cAliasTmp)->CSTCOFINS	:=	cCSTCofins
			(cAliasTmp)->ALIQCOFINS	:=	nAliqCofins
			(cAliasTmp)->CODCONTA	:=	cContaC
			(cAliasTmp)->CODCCUSTO	:=	cCCusto
			(cAliasTmp)->DESCBEMIMO	:=	cDescExt
		EndIf
		
	Else
		RecLock(cAliasTmp,.F.)
	Endif
	(cAliasTmp)->BASE	+= nBase
	(cAliasTmp)->VRET	+= nValor    //nRet

	(cAliasTmp)->VLRBCEXC    := nVlrExcl
	(cAliasTmp)->VLRBCPIS	:=	(cAliasTmp)->VRET - (cAliasTmp)->VLRBCEXC
	(cAliasTmp)->VLRPIS		:=	(cAliasTmp)->(VLRBCPIS*(ALIQPIS/100))	
	(cAliasTmp)->VLRBCCOFIN	:=	(cAliasTmp)->VRET - (cAliasTmp)->VLRBCEXC	
	(cAliasTmp)->VLRCOFINS	:=	(cAliasTmp)->(VLRBCCOFIN*(ALIQCOFINS/100))		

	//fields to be used by N3-FISCAL personnel
    (cAliasTmp)->NOTAFISCAL 	:=	cNotaFis
	(cAliasTmp)->SERIE 		:=	cSerNF
	(cAliasTmp)->FORNECEDOR 	:=	cFornec
	(cAliasTmp)->LOJA 		:=	cLoja
	(cAliasTmp)->NUMPRO 		:=	cNumPro
	(cAliasTmp)->INDPRO 		:=	cIndPro

	MsUnLock()


ElseIf cReg == "F130"

    //registro F130
	(cAliasTmp)->(dbSetOrder(1))
	If !(cAliasTmp)->(dbSeek(cCodBem+cItem+dtos(dData)))
		RecLock(cAliasTmp,.T.)
		(cAliasTmp)->REG := "F130"
		(cAliasTmp)->NAT_BC_CRE := "09"
		(cAliasTmp)->IDENT_BEM := 05
		(cAliasTmp)->IND_ORIG_C := cIND_ORIG_C
		(cAliasTmp)->IND_UTIL_B := 2
		(cAliasTmp)->MES_OPER_A := Int(Val(Subs(Dtos(dData),5,2)+Subs(Dtos(dData),1,4)))
		(cAliasTmp)->VL_OPER_AQ += nValor
		(cAliasTmp)->PARC_OPER += 0
		(cAliasTmp)->VL_BC_CRED := (cAliasTmp)->(VL_OPER_AQ-PARC_OPER)
		(cAliasTmp)->IND_NR_PAR := 0
		(cAliasTmp)->CST_PIS := nCST_PIS
		(cAliasTmp)->ALIQ_PIS := nALIQ_PIS
		(cAliasTmp)->VL_PIS := (cAliasTmp)->(VL_BC_PIS*ALIQ_PIS/100)
		(cAliasTmp)->CST_COFINS := nCST_COFINS
		(cAliasTmp)->ALIQ_COFIN := nALIQ_COFIN
		(cAliasTmp)->VL_COFINS := (cAliasTmp)->(VL_BC_COFI*ALIQ_COFIN/100)
		(cAliasTmp)->COD_CTA := '101010100'
		(cAliasTmp)->COD_CCUS := '01'
		(cAliasTmp)->NOTAFISCAL := ''
		(cAliasTmp)->SERIE := ''
		(cAliasTmp)->FORNECEDOR := ''
		(cAliasTmp)->LOJA := ''
		(cAliasTmp)->NUMPRO := cNumPro
		(cAliasTmp)->INDPRO := cIndPro
	EndIf
	
EndIf

Return

//User function for extended description
User Function Atf130DExt(cCodBem,cItem)
Local cString := ""
dbSelectArea("SN2")
dbSetOrder(1)
If dbSeek(xFilial("SN2")+cCodBem+cItem+"01")
	While SN2->(!Eof() .And. N2_FILIAL+N2_CBASE+N2_ITEM+N2_TIPO==xFilial("SN2")+cCodBem+cItem+"01")
		cString += Alltrim(SN2->N2_HISTOR)+Space(1)
		SN2->(dbSkip())
	EndDo
EndIf
cString := Alltrim(StrTran(cString,CRLF,' '))
Return(cString)

 


05. RELATED SUBJECTS

  • Not Applicable.