Árvore de páginas

Versões comparadas

Chave

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

...

04. INFORMACIÓN ADICIONAL

Realizar los ajustes al archivo de Esquema de 

Informações
titleFATSMEX.INI

//FATSMEX.INI V4.0 --- Modelo 2022

[XXX POSICIONAMENTOS]
(PRE) If(AllTrim(SF2->F2_ESPECIE)=="NDI",SA2->(MSSeek(xFilial("SA2")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)<>"NDI",SA1->(MSSeek(xFilial("SA1")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PRE) (SE4->(MSSeek(xFilial("SE4")+SF2->F2_COND)) , .T.)
(PRE) (AI0->(MSSeek(xFilial("AI0")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)

[XXX INICIALIZACION]
(PRE) SD2->(DbSetOrder(1))
(PRE) SB1->(DbSetOrder(1))
(PRE) SYA->(DbSetOrder(1))
(PRE) SC6->(DbSetOrder(1))
(PRE) SE4->(DbSetOrder(1)) 
(PRE) CTO->(DbSetOrder(1)) 
(PRE) SAH->(DbSetOrder(1)) 
(PRE) _aTotal[009] := SuperGetMV("MV_CFDICPG", .F., "")
(PRE) _aTotal[010] := FindFunction("zh_FechaHoraUTC") .And. !Empty(_aTotal[009])
(PRE) _aTotal[011] := FindFunction("LxFunaCaPo")
(PRE) _aTotal[094] := ""
(PRE) _aTotal[095] := ""
(PRE) _aTotal[033] := ""
(PRE) _aTotal[034] := ""
(PRE) _aTotal[035] := ""
(PRE) _aTotal[036] := 0
(PRE) _aTotal[037] := 0
(PRE) _aTotal[038] := 0
(PRE) _aTotal[039] := SuperGetMV("MV_CFDIEXP",.F.,.F.)
(PRE) _aTotal[075] := Alltrim(SM0->M0_NOMECOM)
(PRE) _aTotal[076] := Alltrim(SF2->F2_TIPODOC) == "21" .And. ((!(Alltrim(SF2->F2_TIPOPE) $ "3|4")) .Or. SF2->(ColumnPos("F2_TPCOMPL")) > 0 .And. AllTrim(SF2->F2_TPCOMPL)=="S")
(PRE) IIf(_aTotal[010],_aTotal[096] := zh_FechaHoraUTC(Alltrim(_aTotal[009]),Alltrim(SM0->M0_CEPENT),SF2->F2_EMISSAO,SF2->F2_HORA),"")
(PRE) IIf(!_aTotal[010],_aTotal[096] := DtoS(SF2->F2_EMISSAO),"")
(PRE) IIf(!_aTotal[010],_aTotal[096] := Left(_aTotal[096],4) + "-" + Substr(_aTotal[096],5,2)+ "-" + Right(_aTotal[096],2),"")
(PRE) IIf(!_aTotal[010],_aTotal[096] += "T" + SF2->F2_HORA,"")
(PRE) _aTotal[097] := {"SD2",""}
(PRE) _aTotal[098] := "|"
(PRE) _aTotal[099] := "||"
(PRE) _aTotal[100] := ""
(PRE) _aTotal[101] := "OPERACION DE CONFORMIDAD CON EL ART. 29 FRACCION I DE LIVA Y LO ESTIPULADO EN LAS RGCE 5.2.6. FRACCION I, 5.2.7 Y 4.3.21"
(PRE) _aTotal[102] := "OPERACION DE CONFORMIDAD CON EL ART. 29 FRACCION I DE LIVA Y LO ESTIPULADO EN LAS RGCE 5.2.6. FRACCION II, 5.2.7 Y 4.3.21"
(PRE) _aTotal[103] := fSumBC(SF2->F2_DOC,SF2->F2_SERIE,SF2->F2_CLIENTE,SF2->F2_LOJA)
(PRE) _aTotal[104] := IIf(SF2->(ColumnPos("F2_TPCOMPL")) > 0 .And. AllTrim(SF2->F2_TPCOMPL)=="S",.T.,.F.)
(PRE) _aTotal[105] := ""
(PRE) _aTotal[106] := IIf(Alltrim(SF2->F2_TIPODOC) == "21",0,2)
(PRE) _aTotal[107] := IIf(SF2->(ColumnPos("F2_TPDOC")) > 0,ALLTRIM(SF2->F2_TPDOC),ALLTRIM(AI0->AI0_MPAGO))
(PRE) _aTotal[108] := IIf(_aTotal[076],AllTrim(SM0->M0_CGC),AllTrim(SA1->A1_CGC))
(PRE) _aTotal[109] := IIf(FindFunction("FxDelExp"),FxDelExp(IIf(_aTotal[076],_aTotal[075],Alltrim(SA1->A1_NOME))),IIf(_aTotal[076],_aTotal[075],Alltrim(SA1->A1_NOME)))
(PRE) _aTotal[110] := IIf(_aTotal[076],AllTrim(SM0->M0_CEPENT),Alltrim(SA1->A1_CEP))
(PRE) _aTotal[111] := IIf(_aTotal[076],Alltrim(SM0->M0_DSCCNA),Alltrim(AI0->AI0_REGFIS))
(PRE) _aTotal[112] := FormPagGlo(SF2->F2_DOC,SF2->F2_SERIE)
(PRE) _aTotal[113] := IIf(!_aTotal[039] .Or. (_aTotal[039] .And. Empty(SF2->F2_TIPOPE)),"01",IIf(Alltrim(SF2->F2_TIPOPE)== "4","03",IIf(SF2->F2_CVEPED !="A1" .Or. Alltrim(SF2->F2_TIPOPE)== "3","04","02")))
(PRE) _aTotal[114] := IIf(_aTotal[113] == "03" .Or.(_aTotal[113] == "04" .And.( Empty(SF2->F2_CERORI) .Or. Empty(SF2->F2_INCOTER) .Or. Empty(SF2->F2_SUBDIV) .Or. Empty(SF2->F2_TCUSD) .Or. Empty(SF2->F2_TOTUSD))) ,.F.,.T.)
(PRE) _aTotal[115] := {}
(PRE) lCCCE        := .F.
(PRE) cNodoCCE     := ""
(PREREG) FsQuery(_aTotal[097],1,"D2_DOC='" + SF2->F2_DOC + "' AND D2_SERIE='" + SF2->F2_SERIE + "' AND D2_CLIENTE='" + SF2->F2_CLIENTE + "' AND D2_LOJA='" + SF2->F2_LOJA + "'","SD2->D2_DOC=SF2->F2_DOC .AND. SD2->D2_SERIE=SF2->F2_SERIE .AND. SD2->D2_CLIENTE=SF2->F2_CLIENTE .AND. SD2->D2_LOJA=SF2->F2_LOJA","D2_ITEM") .And. .T.

(PRE) fImptosD(SF2->F2_DOC,SF2->F2_SERIE,SF2->F2_CLIENTE,SF2->F2_LOJA,IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.),"SD2", SF2->F2_GLOBAL == "1",@(_aTotal[036]),_aTotal[104],@_aTotal[037], @_aTotal[038], ,@_aTotal[115]) 

[SD2 CADENAORIGINAL_SELLO]
(PRE) If(AllTrim(SF2->F2_ESPECIE)=="NDI",SA2->(MSSeek(xFilial("SA2")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)=="NDI",SYA->(MsSeek(xFilial("SYA")+SA2->A2_PAIS)) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)=="NDI",CTO->(MsSeek(xFilial("CTO")+Strzero(SF2->F2_MOEDA,2))) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)<>"NDI",SA1->(MSSeek(xFilial("SA1")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)<>"NDI",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.)
(PRE) If(AllTrim(SF2->F2_ESPECIE)<>"NDI",CTO->(MsSeek(xFilial("CTO")+Strzero(SF2->F2_MOEDA,2))) , .T.)
//////////////////////////////////////////////CADENA ORIGINAL//////////////////////////////////////////////
(PRE) cCadOrig   := _aTotal[099]
(PRE) lCCCE      := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.)  .And. !Empty(SF2->F2_TIPOPE)  .And. _aTotal[114], .T., .F.)
(PRE) cCadOriCCE := ""

//Cadena Original | Complemento de Comercio Exterior (Mercancias)
(PREREG) IIf(lCCCE .And. !Empty(SD2->D2_ITEM + SD2->D2_COD), (cCadOriCCE += Alltrim(SD2->D2_ITEM + SD2->D2_COD) + _aTotal[098],.T.),("",,.T.))
(PREREG) IIf(lCCCE .And. !Empty(SD2->D2_FRACCA), (cCadOriCCE += Alltrim(SD2->D2_FRACCA) + Alltrim(SD2->D2_NICO) + _aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. !Empty(Str(SD2->D2_CANADU)), (cCadOriCCE += Alltrim(Str(SD2->D2_CANADU)) + _aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. !Empty(SD2->D2_FRACCA), (cCadOriCCE += AllTrim(ObtColSAT("S014",AllTrim(SD2->D2_FRACCA),1,8,9,2)) + _aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. !Empty(Str(SD2->D2_VALADU)), (cCadOriCCE += Alltrim(Str(SD2->D2_VALADU,14,2)) + _aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. !Empty(Str(SD2->D2_USDADU)), (cCadOriCCE += Alltrim(Str(SD2->D2_USDADU,14,2)) + _aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. SA1->A1_CONTRBE=="1" .And. Alltrim(SF2->F2_ESPECIE) == "NF", (cCadOriCCE += '1.0' +_aTotal[098],.T.), ("",,.T.))
(PREREG) IIf(lCCCE .And. SA1->A1_CONTRBE=="1" .And. SF2->F2_CONUNI=="1", (cCadOriCCE += 'IMMEX:' + ALLTRIM(SA1->A1_PFISICA) + ' ' + _aTotal[101] + _aTotal[098],.T.), IIf (lCCCE .And. SA1->A1_CONTRBE=="1" .And. SF2->F2_CONUNI=="2", (cCadOriCCE += 'IMMEX:' + ALLTRIM(SA1->A1_PFISICA) + ' ' + _aTotal[102] + _aTotal[098],.T.), ("",,.T.)))

///////////DATOS DE LA FACTURA/////////////////
(PRE) (SE4->(MSSeek(xFilial("SE4")+SF2->F2_COND)) , .T.)
(PRE) (AI0->(MSSeek(xFilial("AI0")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
//Version
(PRE) cCadOrig += "4.0" + _aTotal[098]
//Serie
(PRE) cCadOrig += Alltrim(SF2->F2_SERIE) + _aTotal[098]
//Folio
(PRE) cCadOrig += Alltrim(SF2->F2_DOC) + _aTotal[098]
//Fecha
(PRE) cCadOrig += Alltrim(_aTotal[096]) + _aTotal[098]
//FormaPago
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", IIf(SF2->F2_GLOBAL == '1',IIf(!Empty(_aTotal[112]),_aTotal[112],_aTotal[107]),IIf(Empty(_aTotal[107]).Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",_aTotal[107])) + _aTotal[098] )
//NoCertificado
(PRE) cCadOrig += Alltrim(SF2->F2_CERTFOL) + _aTotal[098]
//CondicionesDePago
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", CFDCarEsp(Alltrim(SE4->E4_DESCRI)) + _aTotal[098] ) 
//Subtotal
(PRE) cCadOrig += Alltrim(STR(IIF(ALLTRIM(SF2->F2_TIPODOC) == "21", 0, (SF2->(F2_VALMERC+F2_FRETE+F2_SEGURO+F2_DESPESA) + _aTotal[103] + SF2->F2_DESCONT) - _aTotal[036] - _aTotal[037]),14,_aTotal[106])) + _aTotal[098]
//Descuento
(PRE) cCadOrig += IIF(ALLTRIM(SF2->F2_TIPODOC) == "21", "", IIf( SF2->F2_DESCONT == 0, "", Alltrim(STR(SF2->F2_DESCONT,14,2)) + _aTotal[098]) )
//Moneda
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21","XXX",Alltrim(CTO->CTO_MOESAT)) + _aTotal[098]
//TipoCambio
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21","",IIf(Alltrim(CTO->CTO_MOESAT) <> "MXN", Alltrim(STR(SF2->F2_TXMOEDA,14,2)), "1") + _aTotal[098])
//Total
(PRE) cCadOrig += Alltrim(Str(IIf(ALLTRIM(SF2->F2_TIPODOC) == "21", 0, iif(GetSx3Cache("F2_VALBRUT","X3_DECIMAL")<= 2,SF2->F2_VALBRUT + _aTotal[103]- _aTotal[037] - IIf(Len(_aTotal[115]) > 0,_aTotal[115][1],0),Round(SF2->F2_VALBRUT,2) + _aTotal[103] - _aTotal[037] - IIf(Len(_aTotal[115]) > 0,_aTotal[115][1],0))),14,_aTotal[106])) + _aTotal[098]
//TipoDeComprobante
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_ESPECIE) == "NF",IIf(ALLTRIM(SF2->F2_TIPODOC) == "21", "T", "I" ), "E") + _aTotal[098]
//Exportacion
(PRE) cCadOrig += IIf(!Empty(_aTotal[113]),_aTotal[113],"01") + _aTotal[098]
//MetodoPago
(PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", Alltrim(SE4->E4_MPAGSAT) + _aTotal[098] )
//LugarExpedicion
(PRE) cCadOrig += CFDCarEsp(AllTrim(SM0->M0_CEPENT)) + _aTotal[098]
//Periodicidad
(PRE) cCadOrig += IIf(SF2->(ColumnPos("F2_IDCBAJA")) > 0 .And. SF2->F2_GLOBAL == "1", SF2->F2_IDCBAJA + _aTotal[098],"")
//Meses
(PRE) cCadOrig += IIf(SF2->(ColumnPos("F2_MODCONS")) > 0 .And. SF2->F2_GLOBAL == "1", SF2->F2_MODCONS + _aTotal[098],"")
//Año
(PRE) cCadOrig += IIf(SF2->(ColumnPos("F2_PTOEMIS")) > 0 .And. SF2->F2_GLOBAL == "1", SF2->F2_PTOEMIS + _aTotal[098],"")

//////////////////////CFDI Relacionados//////////////////////////
(PREREG)!Empty(SF2->F2_RELSAT).Or. !Empty(SF2->F2_SERMAN).Or. !Empty(SF2->F2_DOCMAN)
(PRE) IIf(_aTotal[104] .And. Alltrim(SF2->F2_TIPODOC) == "21","",fGetFolRel("S",.T.))

///////////DATOS DEL EMISOR///////////////////////
//Rfc
(PRE) cCadOrig += CFDCarEsp(AllTrim(SM0->M0_CGC),.F.) + _aTotal[098]
//Nombre
(PRE) cCadOrig += CFDCarEsp(_aTotal[075],.F.) + _aTotal[098]
//RegimenFiscal
(PRE) cCadOrig += CFDCarEsp(Alltrim(SM0->M0_DSCCNA)) + _aTotal[098]

//////////////////////DATOS DEL RECEPTOR//////////////////////////
(PRE) AllTrim(SF2->F2_ESPECIE) <> "NDI"
(PRE) SA1->(MSSeek(xFilial("SA1")+SF2->F2_CLIENTE+SF2->F2_LOJA))
(PRE) SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS))
//Rfc
(PRE) (cCadOrig += IIf(SF2->F2_GLOBAL == "1", "XAXX010101000", CFDCarEsp(_aTotal[108], .F.)) + _aTotal[098])
//Nombre
(PRE) (cCadOrig += IIF(SF2->F2_GLOBAL == "1", "PUBLICO EN GENERAL",CFDCarEsp(_aTotal[109],.F.)) + _aTotal[098], .T.)
//DomicilioFiscalReceptor
(PRE) (cCadOrig += CFDCarEsp(_aTotal[110],.F.) + _aTotal[098], .T.)
//ResidenciaFiscal
(PRE) IIf(lCCCE .And. !Empty(CFDCarEsp(Alltrim(SF2->F2_RESIDE))) .And. !_aTotal[076], cCadOrig += AllTrim(Posicione("SYA",1,xFilial("SYA")+SF2->F2_RESIDE,"YA_CCESAT")) + _aTotal[098], "")
//NumRegIdTrib
(PRE) IIf(lCCCE .And. !Empty(CFDCarEsp(Alltrim(SF2->F2_IDTRIB))) .And. !_aTotal[076], cCadOrig += CFDCarEsp(AllTrim(AllTrim(SF2->F2_IDTRIB))) + _aTotal[098], "")
//RegimenFiscalReceptor
(PRE) (cCadOrig += IIf(AI0->(ColumnPos("AI0_REGFIS")) > 0,CFDCarEsp(_aTotal[111],.F.) + _aTotal[098],""), .T.)
//UsoCFDI
(PRE) (cCadOrig += Alltrim(SF2->F2_USOCFDI) + _aTotal[098], .T.)

(PRE) (cCadOrig += fXMLFUN("CO",.T., IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.),_aTotal[104]),.T.)
(PRE) (cCadOrig += fXMLFUN("TI",.T., IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.)),.T.)

(POS) IIf(lCCCE, cCadOrig += "2.0" + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_TRASLA), cCadOrig += Alltrim(SF2->F2_TRASLA) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_CVEPED), cCadOrig += Alltrim(SF2->F2_CVEPED) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_CERORI), cCadOrig += Alltrim(SF2->F2_CERORI) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_NUMCER), cCadOrig += Alltrim(SF2->F2_NUMCER) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_EXPCONF), cCadOrig += Alltrim(SF2->F2_EXPCONF) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SF2->F2_INCOTER), cCadOrig += Alltrim(SF2->F2_INCOTER) + _aTotal[098], "")
(POS) IIf(lCCCE .And. SF2->(ColumnPos("F2_OBSCE")) > 0 .And. !Empty(SF2->F2_OBSCE), cCadOrig += CFDCarEsp(AllTrim(SF2->F2_OBSCE), .F.) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(Str(SF2->F2_TCUSD)), cCadOrig += Alltrim(Str(SF2->F2_TCUSD)) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(Str(SF2->F2_TOTUSD)), cCadOrig += Alltrim(Str(SF2->F2_TOTUSD,14,2)) + _aTotal[098], "")

//Emisor
(POS) IIf(lCCCE , cCadOrig += CFDCarEsp(AllTrim(SM0->M0_ENDCOB)) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SM0->M0_CEPENT), cCadOrig += CFDCarEsp(AllTrim(ObtColSAT("S015",AllTrim(SM0->M0_CODZOSE)+ALLTRIM(SM0->M0_CEPENT),1,9,1,4))) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(SM0->M0_CODMUN), cCadOrig += AllTrim(SM0->M0_CODMUN) + _aTotal[098], "")
(POS) IIf(lCCCE , cCadOrig += CFDCarEsp(Alltrim(ObtColSAT("S004",AllTrim(SM0->M0_CEPENT),1,5,6,3))) + _aTotal[098], "")
(POS) IIf(lCCCE , cCadOrig += "MEX" + _aTotal[098], "")
(POS) IIf(lCCCE , cCadOrig += AllTrim(SM0->M0_CEPENT) + _aTotal[098], "")

//Receptor Domicilio
(POS) IIf(lCCCE .And. _aTotal[108] == "XEXX010101000", cCadOrig += CFDCarEsp(AllTrim(AllTrim(SF2->F2_IDTRIB))) + _aTotal[098], "")
(POS) IIf(lCCCE, cCadOrig += CFDCarEsp(AllTrim(SA1->A1_END)) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NR_END)), cCadOrig += AllTrim(SA1->A1_NR_END) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NROINT)), cCadOrig += AllTrim(SA1->A1_NROINT) + _aTotal[098], "")
(POS) IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))), cCadOrig +=  CFDCarEsp(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))) + _aTotal[098],"")
(POS) IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SA1->A1_MUN))), cCadOrig +=  CFDCarEsp(AllTrim(SA1->A1_MUN),.F.) + _aTotal[098],"")
(POS) IIf(lCCCE, cCadOrig += CFDCarEsp(Alltrim(Posicione("SX5",1,xFilial("SX5")+"12"+SA1->A1_EST,"X5_DESCRI"))) + _aTotal[098],"")
(POS) IIf(lCCCE, cCadOrig += AllTrim(Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT")) + _aTotal[098], "")
(POS) IIf(lCCCE, cCadOrig += AllTrim(SA1->A1_CEP) + _aTotal[098], "")

//Destinatarios
(POS) IIf(lCCCE .And. FindFunction("LxCEDest") .And. SF2->(ColumnPos("F2_ACOPLA")) > 0, cCadOrig += LxCEDest(SF2->F2_CLIENTE,SF2->F2_LOJA,SF2->F2_ACOPLA, .T.), "")

(POS) cCadOrig += IIf(!Empty(cCadOriCCE), cCadOriCCE, "")

//Carta Porte
(POS) IIf(_aTotal[011],(cCadOrig += LxFunaCaPo(SF2->F2_FILIAL,SF2->F2_DOC,SF2->F2_SERIE,.T.,IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.),_aTotal[104]),.T.),"")

(POS) (cCadOrig += fXMLFUN("IL",.T., IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.)),.T.)

(POS) cCadOrig += _aTotal[098]
(POS) _aTotal[033] := cCadOrig

//SELLO
(POS) _aTotal[100] := EVPDigest(cCadOrig,5)
(POS) _aTotal[100] := PrivSignRSA(&(SuperGetMv("MV_CFDDIRS",,""))+SuperGetMv("MV_CFDARQS",,""),_aTotal[100],6,"assinatura")
(POS) _aTotal[100] := ENCODE64(_aTotal[100])
[XXX CABECERA]
Linha1     C 041 0 Chr(239) + Chr(187) + Chr(191) + '<?xml version="1.0" encoding="UTF-8"?>'
[XXX FACTURA]
//Certificado del SAT incluido para pruebas 
(PRE) cCert := "MIIFuTCCA6GgAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0NDIwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDA"
(PRE) cCert +="ZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQ"
(PRE) cCert +="kBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWxpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYS"
(PRE) cCert +="UNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMjMwNTE4MTI1OTI2WhcNMjcwNTE4MTI1OTI2WjCB4DEqM"
(PRE) cCert +="CgGA1UEAxMhWEVOT04gSU5EVVNUUklBTCBBUlRJQ0xFUyBTIERFIENWMSowKAYDVQQpEyFYRU5PTiBJTkRVU1RSSUFMIEFSVElDTEVTIFMgREUgQ1YxKjAoBgNVBAoTIVhFTk9OIElORFVTVFJJQUwgQVJUSUNMRVMgUyBERSBDVjElMCMGA1UEL"
(PRE) cCert +="RMcWElBMTkwMTI4SjYxIC8gVkFEQTgwMDkyN0RKMzEeMBwGA1UEBRMVIC8gVkFEQTgwMDkyN0hTUlNSTDA1MRMwEQYDVQQLEwpTdWN1cnNhbCAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAga5zxQ4mEBE4LobElO0+UyMDcAYbY0NJbg4x"
(PRE) cCert +="Nbvwd66CUuTjyK2q11Y6nTzod1I1Nhv75cfZbJzdW/4EO/1bGLEt3zpTnP0yDVh9KL4/WJ0QW5kR4QVpxd84aBkJe7FltC5j+FUiDSCCLpSBlGvwZdFAwZhSZvHeFB1i1pDc3rA/PvqJwn35goEdIfhgfymg+31LuL1stU30pOSYtxltiEoM3QFePVurYhYq"
(PRE) cCert +="sxNmZMGkRvVNrf/SnZsiaLUonM8CNLfhJIFxBraH3qeZ3iCaeFgL8zO5ux+8D1XAg2RpJLf7gFVC9fWOc9yaHKNsjkt1E2YauH9KpHxRAjt3zKniywIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQEAwIGwDANBgkqhkiG9w0BAQsFAAOCAgEAR73vD"
(PRE) cCert +="0WGeWtnZyIFixfsNtvM3068JFvn4LJ0aF0ZZwTJhcff7OrUrpsrCjMzpIOB3Lfq5DLtaIPNeEkSa5W4yi1XJ930kcJ4kubi16jmTIMIZ7w9fy8p99gggTMbYiFf0Jzvfz+PQqqpsfnc3lMVV/GkHvs8QHEekZxpWHS22oE/S5wKq7b85oW649fC834EoZGIsb8"
(PRE) cCert +="0Rna4ATuDxbt3dvzTR/b/eyricihMBqQ1MPCi9D81o1/3EPEOZNYFcC+yQK7M+/C7pivs0A972q8LYxG8DzmaKV8zLg+IR9ygdYdl/y/Snoeo0udV4yUlzug7i5IGZbfUh2jo3WEkEdIpty+lcVt2PtWOTdR70V0oCivE0MV0qw9GRzFAr6G71fra6r+sUKUwxQB"
(PRE) cCert +="n07pi6hHmmZ7/DZ9QCaheqD9ttdhlQhpTTt0UPpWY9CDUJKpbWlkKYUzLPkdf/ppjiizbP1fqDcoIfZxl4RPKKtr0eIJWhEnuVirZ0kevHXEspI+igdMqk8MRndZSoohuIuLdjKjfXEGBALoqUzAB6avN2zzEy6ERRCGfR3cVhVUTcpd/iQffeGvw7tRZZOiWgwG3"
(PRE) cCert +="Sjc/zgUppnFXfVFHCTmRz1nr0dOqKjOpMEMncRSfY2Mk+Xm8rmJ7toBu4iAyJUDCP6v24as1uxiE9DVDaFwlugdYL9c="
(PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF2->F2_TIPOPE) .And. _aTotal[114], .T., .F.)
(PRE) cNodoCCE := ""

(PRE) If(AllTrim(SF2->F2_ESPECIE)=="NDI",SYA->(MsSeek(xFilial("SYA")+SA2->A2_PAIS)) , .T.)
(PRE) (SE4->(MSSeek(xFilial("SE4")+SF2->F2_COND)) , .T.)
(PRE) (AI0->(MSSeek(xFilial("AI0")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PRE) _aTotal[001] := '<cfdi:Comprobante'
(PRE) _aTotal[001] += ' xmlns:cfdi="http://www.sat.gob.mx/cfd/4"'
(PRE) _aTotal[001] += ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
(PRE) _aTotal[001] += Iif(_aTotal[104],' xmlns:cartaporte31="http://www.sat.gob.mx/CartaPorte31"','')
(PRE) _aTotal[001] += ' xmlns:implocal="http://www.sat.gob.mx/implocal"'
(PRE) _aTotal[001] += IIf(lCCCE .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF", ' xmlns:leyendasFisc="http://www.sat.gob.mx/leyendasFiscales"' , "")
(PRE) _aTotal[001] += ' xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd '
(PRE) _aTotal[001] += IIF(lCCCE,'http://www.sat.gob.mx/ComercioExterior20 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior20/ComercioExterior20.xsd ','http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd')
(PRE) _aTotal[001] += IIf(_aTotal[104],' http://www.sat.gob.mx/CartaPorte31 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte31.xsd','')
(PRE) _aTotal[001] += IIf(lCCCE .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF", ' http://www.sat.gob.mx/leyendasFiscales http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd"' , '"')
(PRE) _aTotal[001] += IIf(lCCCE, ' xmlns:cce20="http://www.sat.gob.mx/ComercioExterior20" ' , "")
(PRE) _aTotal[001] += ' Version="4.0"'
(PRE) _aTotal[001] += ' Serie="' + Alltrim(SF2->F2_SERIE) + '"'
(PRE) _aTotal[001] += ' Folio="' + Alltrim(SF2->F2_DOC) + '"'
(PRE) _aTotal[001] += ' Fecha="' + Alltrim(_aTotal[096]) + '"'
(PRE) _aTotal[001] += ' Sello="' + Alltrim(_aTotal[100]) + '"'
(PRE) _aTotal[001] += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", ' FormaPago="' +  IIf(SF2->F2_GLOBAL == '1',IIf(!Empty(_aTotal[112]),_aTotal[112],_aTotal[107]),IIf(Empty(_aTotal[107]) .Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",_aTotal[107])) + '"' )
(PRE) _aTotal[001] += ' NoCertificado="' + Alltrim(SF2->F2_CERTFOL) + '"'
(PRE) _aTotal[001] += ' Certificado="' + cCert + '"'
(PRE) _aTotal[001] += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", ' CondicionesDePago="' +  CFDCarEsp(Alltrim(SE4->E4_DESCRI)) + '"' ) 
(PRE) _aTotal[001] += ' SubTotal="' + Alltrim(STR(IIF(ALLTRIM(SF2->F2_TIPODOC) == "21", 0, (SF2->(F2_VALMERC+F2_FRETE+F2_SEGURO+F2_DESPESA)  + _aTotal[103] + SF2->F2_DESCONT) - _aTotal[036] - _aTotal[037] ),14,_aTotal[106])) + '"'
(PRE) _aTotal[001] += IIF(ALLTRIM(SF2->F2_TIPODOC) == "21", "", IIf( SF2->F2_DESCONT == 0, "", ' Descuento="' + Alltrim(STR(SF2->F2_DESCONT,14,2)) + '"' ))
(PRE) _aTotal[001] += ' Moneda="' + IIf(Alltrim(SF2->F2_TIPODOC) == "21","XXX",Alltrim(CTO->CTO_MOESAT)) + '"'
(PRE) _aTotal[001] += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", ' TipoCambio="' + IIf(Alltrim(CTO->CTO_MOESAT) <> "MXN", Alltrim(STR(SF2->F2_TXMOEDA,14,2)), "1") + '"') 
(PRE) _aTotal[001] += ' Total="' + Alltrim(Str(IIf(Alltrim(SF2->F2_TIPODOC) == "21", 0, IIf(GetSx3Cache("F2_VALBRUT","X3_DECIMAL") <= 2,SF2->F2_VALBRUT + _aTotal[103] - _aTotal[037] - _aTotal[038] - IIf(Len(_aTotal[115]) > 0,_aTotal[115][1],0),Round(SF2->F2_VALBRUT,2) + _aTotal[103] - _aTotal[037] - _aTotal[038] - IIf(Len(_aTotal[115]) > 0,_aTotal[115][1],0))),14,_aTotal[106])) +  '"'
(PRE) _aTotal[001] += ' TipoDeComprobante="' + IIf(Alltrim(SF2->F2_ESPECIE) == "NF",IIf(Alltrim(SF2->F2_TIPODOC) == "21", "T", "I"), "E") + '"'
(PRE) _aTotal[001] += ' Exportacion="'+IIf(!Empty(_aTotal[113]),_aTotal[113],"01")+'"'
(PRE) _aTotal[001] += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", ' MetodoPago="' +  Alltrim(SE4->E4_MPAGSAT) + '"' )
(PRE) _aTotal[001] += ' LugarExpedicion="' + CFDCarEsp(AllTrim(SM0->M0_CEPENT)) + '"'
(PRE) _aTotal[001] += '>'
(PREREG) _aTotal[001]

(POS) cNodoCCE := IIf(lCCCE, '        <cce20:ComercioExterior' , "")
(POS) cNodoCCE += IIf(lCCCE, ' Version="2.0"' , "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_TRASLA), ' MotivoTraslado="' + Alltrim(SF2->F2_TRASLA) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_CVEPED), ' ClaveDePedimento="' + Alltrim(SF2->F2_CVEPED) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_CERORI), ' CertificadoOrigen="' + Alltrim(SF2->F2_CERORI) +'"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_NUMCER), ' NumCertificadoOrigen="' + Alltrim(SF2->F2_NUMCER) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_EXPCONF), ' NumeroExportadorConfiable="' + Alltrim(SF2->F2_EXPCONF) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF2->F2_INCOTER), ' Incoterm="' + Alltrim(SF2->F2_INCOTER) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. SF2->(ColumnPos("F2_OBSCE")) > 0 .And. !Empty(SF2->F2_OBSCE), ' Observaciones="' + CFDCarEsp(AllTrim(SF2->F2_OBSCE), .T.) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(Str(SF2->F2_TCUSD)), ' TipoCambioUSD="' + Alltrim(Str(SF2->F2_TCUSD)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(Str(SF2->F2_TOTUSD)), ' TotalUSD="' + Alltrim(Str(SF2->F2_TOTUSD,14,2)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "")
(POS) _aTotal[094] := cNodoCCE

[XXX CFDIREL]
(PREREG) !Empty(SF2->F2_RELSAT).Or. !Empty(SF2->F2_SERMAN).Or. !Empty(SF2->F2_DOCMAN)
(PREREG) (_aTotal[001] := IIf(_aTotal[104] .And. Alltrim(SF2->F2_TIPODOC) == "21","",fGetFolRel("S")))
(PREREG) _aTotal[001]

[XXX FACTURA GLOBAL]
(PRE) (_aTotal[001] := IIF(SF2->F2_GLOBAL == "1",'    <cfdi:InformacionGlobal ',""))
(PRE) (_aTotal[001] += Iif(SF2->(ColumnPos("F2_IDCBAJA")) > 0 .and. SF2->F2_GLOBAL == "1" ,' Periodicidad="' + SF2->F2_IDCBAJA  + '"',""))
(PRE) (_aTotal[001] += Iif(SF2->(ColumnPos("F2_MODCONS")) > 0 .and. SF2->F2_GLOBAL == "1" ,' Meses="' + SF2->F2_MODCONS  + '"',""))
(PRE) (_aTotal[001] += Iif(SF2->(ColumnPos("F2_PTOEMIS")) > 0 .and. SF2->F2_GLOBAL == "1" ,' Año="' + SF2->F2_PTOEMIS  + '"',""))
(PRE) (_aTotal[001] += IIF(SF2->F2_GLOBAL == "1",'/>' ,""))
(PRE) (_aTotal[001] := IIF(SF2->F2_GLOBAL == "1",_aTotal[001] ,""))
(PREREG) _aTotal[001]

[XXX EMISOR]
(PRE) (_aTotal[001] := '    <cfdi:Emisor'  , .T.)
(PRE) (_aTotal[001] += ' Rfc="' + CFDCarEsp(AllTrim(SM0->M0_CGC))+ '"'  , .T.)
(PRE) (_aTotal[001] += ' Nombre="' + CFDCarEsp(_aTotal[075],.T.) + '"'  , .T.)
(PRE) (_aTotal[001] += ' RegimenFiscal="' + CFDCarEsp(Alltrim(SM0->M0_DSCCNA)) + '"'  , .T.)
(PRE) (_aTotal[001] += '/>'  , .T.)
(PRE) (_aTotal[001] := _aTotal[001]  , .T.)
(PREREG) _aTotal[001]

[XXX RECEPTOR_CLIENTE]
(PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.)  .And. !Empty(SF2->F2_TIPOPE) .And. _aTotal[114], .T., .F.)
(PRE) cNodoCCE := ""

(PREREG) AllTrim(SF2->F2_ESPECIE) <> "NDI"
(PREREG) (SA1->(MSSeek(xFilial("SA1")+SF2->F2_CLIENTE+SF2->F2_LOJA)) , .T.)
(PREREG) (SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.)
(PREREG) (_aTotal[001] := '    <cfdi:Receptor' , .T.)
(PREREG) (_aTotal[001] += ' Rfc="' + CFDCarEsp(IIf(SF2->F2_GLOBAL == "1", "XAXX010101000", _aTotal[108])) + '"' , .T.)
(PREREG) (_aTotal[001] += ' Nombre="' + iif(SF2->F2_GLOBAL == "1","PUBLICO EN GENERAL",CFDCarEsp(_aTotal[109],.T.)) + '"' , .T.)
(PREREG) (_aTotal[001] += ' DomicilioFiscalReceptor="' + _aTotal[110] + '"' , .T.)
(PREREG) (_aTotal[001] += Iif(AI0->(ColumnPos("AI0_REGFIS")) > 0,' RegimenFiscalReceptor="' + _aTotal[111] + '"',""), .T.)
(PREREG) (_aTotal[001] += ' UsoCFDI="' + Alltrim(SF2->F2_USOCFDI) + '"' , .T.)
(PREREG) IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(AllTrim(SF2->F2_IDTRIB)))) .And. !_aTotal[076], (_aTotal[001] += ' NumRegIdTrib="' + CFDCarEsp(AllTrim(AllTrim(SF2->F2_IDTRIB))) + '"' , .T.), "") 
(PREREG) IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(AllTrim(SF2->F2_RESIDE)))) .And. !_aTotal[076], (_aTotal[001] += ' ResidenciaFiscal="' + AllTrim(Posicione("SYA",1,xFilial("SYA")+SF2->F2_RESIDE,"YA_CCESAT")) + '"' , .T.), "")
(PREREG) (_aTotal[001] += '/>' ,.T.)
(PREREG) (_aTotal[001] := _aTotal[001] , .T.)
(PREREG) _aTotal[001]

(POS) cNodoCCE += IIf(lCCCE, '            <cce20:Emisor' , "")
(POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") 
(POS) cNodoCCE += IIf(lCCCE, '                <cce20:Domicilio' , "")        
(POS) cNodoCCE += IIf(lCCCE, ' Calle="' + CFDCarEsp(AllTrim(SM0->M0_ENDCOB)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(CFDCarEsp(AllTrim(SM0->M0_CEPENT)))), ' Colonia="' + CFDCarEsp(AllTrim(ObtColSAT("S015",AllTrim(SM0->M0_CODZOSE)+ALLTRIM(SM0->M0_CEPENT),1,9,1,4))) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SM0->M0_CEPENT))), ' Municipio="' + CFDCarEsp(AllTrim(SM0->M0_CODMUN)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' Estado="' + CFDCarEsp(Alltrim(ObtColSAT("S004",AllTrim(SM0->M0_CEPENT),1,5,6,3))) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' Pais="' + AllTrim("MEX") + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' CodigoPostal="' + AllTrim(SM0->M0_CEPENT) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, '/>' + ( chr(13)+chr(10) ), "")
(POS) cNodoCCE += IIf(lCCCE, '            </cce20:Emisor>' + ( chr(13)+chr(10) ), "")
(POS) cNodoCCE += IIf(lCCCE, '            <cce20:Receptor ' + IIf(_aTotal[108]=="XEXX010101000", 'NumRegIdTrib="' + CFDCarEsp(AllTrim(SF2->F2_IDTRIB)) + '"',""), "")     
(POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") 
(POS) cNodoCCE += IIf(lCCCE, '                <cce20:Domicilio' , "")        
(POS) cNodoCCE += IIf(lCCCE, ' Calle="' + CFDCarEsp(AllTrim(SA1->A1_END)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NR_END)), ' NumeroExterior="' + AllTrim(SA1->A1_NR_END) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NROINT)), ' NumeroInterior="' + AllTrim(SA1->A1_NROINT) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))), ' Colonia="' + CFDCarEsp(AllTrim(SA1->A1_BAIRRO)) + '"', "")
(POS) cNodoCCE += IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_MUN)), ' Municipio="' + CFDCarEsp(AllTrim(SA1->A1_MUN),.T.) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' Estado="' + CFDCarEsp(Alltrim(Posicione("SX5",1,xFilial("SX5")+"12"+SA1->A1_EST,"X5_DESCRI"))) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' Pais="' + AllTrim(Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT")) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, ' CodigoPostal="' + AllTrim(SA1->A1_CEP) + '"', "")
(POS) cNodoCCE += IIf(lCCCE, '/>' + ( chr(13)+chr(10) ), "")
(POS) cNodoCCE += IIf(lCCCE, '            </cce20:Receptor>' + ( chr(13)+chr(10) ), "") 
//Destintarios
(POS) cNodoCCE += IIf(lCCCE .And. FindFunction("LxCEDest") .And. SF2->(ColumnPos("F2_ACOPLA")) > 0, LxCEDest(SF2->F2_CLIENTE,SF2->F2_LOJA,SF2->F2_ACOPLA,.F.),"")
(POS) (cNodoCCE += IIf(lCCCE, '            <cce20:Mercancias>' + ( chr(13)+chr(10) ), ""),.T.)
(POS) _aTotal[094] += cNodoCCE

[SD2 CONCEPTO]
(PRE) lCCCE    := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.)  .And. !Empty(SF2->F2_TIPOPE) .And. _aTotal[114] , .T., .F.)
(PRE) cNodoCCE := ""

(PRE) DbGoTop()

(PREREG) (cNodoCCE += IIf(lCCCE, '                  <cce20:Mercancia' , ""),.T.)      
(PREREG) (cNodoCCE += IIf(lCCCE , ' NoIdentificacion="' + Alltrim(SD2->D2_ITEM + SD2->D2_COD) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(SD2->D2_FRACCA), ' FraccionArancelaria="' + Alltrim(SD2->D2_FRACCA) + Alltrim(SD2->D2_NICO) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD2->D2_CANADU)), ' CantidadAduana="' + Alltrim(Str(SD2->D2_CANADU)) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(SD2->D2_FRACCA), ' UnidadAduana="' + AllTrim(ObtColSAT("S014",AllTrim(SD2->D2_FRACCA),1,8,9,2)) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD2->D2_VALADU)), ' ValorUnitarioAduana="' + Alltrim(Str(SD2->D2_VALADU,14,2)) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE, ' ValorDolares="' + Alltrim(Str(SD2->D2_USDADU,14,2)) + '"', ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ) , ""),.T.)
(PREREG) (cNodoCCE += IIf(lCCCE, '                  </cce20:Mercancia>' + ( chr(13)+chr(10) ), ""),.T.)

(POS) (cNodoCCE += IIf(lCCCE, '            </cce20:Mercancias>' + ( chr(13)+chr(10) ), ""),.T.)
(POS) (cNodoCCE += IIf(lCCCE, '        </cce20:ComercioExterior>' , ""),.T.)
(POS) _aTotal[094] += cNodoCCE

(POS) (_aTotal[034] := fXMLFUN("CO",.F., IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.),_aTotal[104]),.T.)
 
[XXX CONCEPTOS]
(POS) FsQuery(_aTotal[097],2)

(PREREG) (_aTotal[001] := _aTotal[034] ,.T.)
(PREREG) _aTotal[001]

[XXX IMPUESTOS]
(PREREG) (_aTotal[002] := fXMLFUN("TI",.F.,IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.)),.T.)
(PREREG) _aTotal[002]

//IMPUESTOS LOCALES//
(PRE) (_aTotal[095] := fXMLFUN("IL",.F.),.T.)

[XXX COMPLEMENT]
(PREREG) IIf(_aTotal[011],_aTotal[105] := LxFunaCaPo(SF2->F2_FILIAL,SF2->F2_DOC,SF2->F2_SERIE,.F.,IIf(ALLTRIM(SF2->F2_TIPODOC) == "21",.T.,.F.),_aTotal[104]),"")
(PREREG) (_aTotal[001] := IIF(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095] ) .Or. !Empty(_aTotal[105]) .or. _aTotal[104] , '    <cfdi:Complemento', ""), .T.)
(PREREG) (_aTotal[001] += IIF(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095] ) .Or. !Empty(_aTotal[105]),'>',""),.T.)
(PREREG) _aTotal[001]
COMPLEMENT  C 021 0 ENCODEUTF8(XMLConv("",,,"cfdi:Complemento",.T.,.F.,4))


[XXX COMERCIOEX]
(PREREG) (_aTotal[001] := _aTotal[094],.T.)
(PREREG) _aTotal[001]

[XXX CARTAPORTE]
(PREREG) (_aTotal[001] := _aTotal[105],.T.)
(PREREG) _aTotal[001]

[XXX IMPUESTOLOC]
(PREREG) (_aTotal[001] := _aTotal[095],.T.)
(PREREG) _aTotal[001]

[XXX LEYENDASFIS]
(PREREG) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.)  .And. !Empty(SF2->F2_TIPOPE) .And. _aTotal[114], .T., .F.) .And. SF2->(FieldPos("F2_CONUNI")) > 0
(PREREG) lCCCE
(PREREG) (_aTotal[001] := IIF((!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095])) .And. !EMPTY(SF2->F2_CONUNI) .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF" , '        <leyendasFisc:LeyendasFiscales version="1.0" >'+ ( chr(13)+chr(10) ), ""), .T.)
(PREREG) (_aTotal[001] += IIF((!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095])) .And. !EMPTY(SF2->F2_CONUNI) .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF" , '            <leyendasFisc:Leyenda textoLeyenda=', ""), .T.)
(PREREG) (_aTotal[001] += IIF((!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095])) .And. SF2->F2_CONUNI=="1" .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF", '"IMMEX:'+ AllTrim(SA1->A1_PFISICA) +' ' + _aTotal[101] +'" />', IIF((!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095])) .And. SF2->F2_CONUNI=="2" .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF",'"IMMEX:'+ AllTrim(SA1->A1_PFISICA) + ' ' + _aTotal[102] +'" />',"")), .T.)
(PREREG) _aTotal[001]
(PREREG) (_aTotal[001] := IIF((!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095])) .And. !EMPTY(SF2->F2_CONUNI) .And. SA1->A1_CONTRBE == "1" .And. Alltrim(SF2->F2_ESPECIE) == "NF",'        </leyendasFisc:LeyendasFiscales>', ""), .T.)
(PREREG) _aTotal[001]


[XXX COMPLEMENT]
(PREREG) (_aTotal[001] := IIF(!EMPTY(_aTotal[094]) .or. !EMPTY(_aTotal[095]) .or. !EMPTY(_aTotal[105]),'    </cfdi:Complemento>',""), .T.)
(PREREG) _aTotal[001]
COMPLEMENT  C 021 0 ENCODEUTF8(XMLConv("",,,"cfdi:Complemento",.F.,.T.,4))

//[XXX CAD_ORIG]
//(PREREG) _aTotal[033] 

[XXX FACTURA]
(PRE) _aTotal[095] := &(GetNewPar("MV_CFDNAF2","Lower(AllTrim(SF2->F2_ESPECIE)) + '_' + Lower(AllTrim(SF2->F2_SERIE)) + '_'  + Lower(AllTrim(SF2->F2_DOC)) + '.xml'"))
(ARQ) _aTotal[095]
FACTURA    C 019 0 ENCODEUTF8(XMLConv("",,,"cfdi:Comprobante",.F.,.T.,0))



Card documentos
InformacaoUtilice este box para resaltar información relevante y/o de destaque.
Titulo¡IMPORTANTE!

...