//FATEMEX.INI V4.0 --- Modelo 2022 [XXX POSICIONAMENTOS] (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SA2->(MSSeek(xFilial("SA2")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) [XXX INICIALIZACION] (PRE) SD1->(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[094] := "" (PRE) _aTotal[095] := "" (PRE) _aTotal[033] := "" (PRE) _aTotal[034] := "" (PRE) _aTotal[035] := "" (PRE) _aTotal[036] := 0 (PRE) _aTotal[075] := Alltrim(SM0->M0_NOMECOM) (PRE) _aTotal[096] := DtoS(SF1->F1_EMISSAO) (PRE) _aTotal[096] := Left(_aTotal[096],4) + "-" + Substr(_aTotal[096],5,2)+ "-" + Right(_aTotal[096],2) (PRE) _aTotal[096] += "T" + SF1->F1_HORA (PRE) _aTotal[097] := {"SD1",""} (PRE) _aTotal[098] := "|" (PRE) _aTotal[099] := "||" (PRE) _aTotal[100] := "" (PRE) _aTotal[101] := IIF(SuperGetMv("MV_DESCSAI",.T.,"2") == "1", .T., .F.) (PRE) lCCCE := .F. (PRE) cNodoCCE := "" (PREREG) FsQuery(_aTotal[097],1,"D1_DOC='" + SF1->F1_DOC + "' AND D1_SERIE='" + SF1->F1_SERIE + "' AND D1_FORNECE='" + SF1->F1_FORNECE + "' AND D1_LOJA='" + SF1->F1_LOJA + "'","SD1->D1_DOC=SF1->F1_DOC .AND. SD1->D1_SERIE=SF1->F1_SERIE .AND. SD1->D1_FORNECE=SF1->F1_FORNECE .AND. SD1->D1_LOJA=SF1->F1_LOJA","D1_ITEM") .And. .T. (PRE) fImptosD(SF1->F1_DOC,SF1->F1_SERIE,SF1->F1_FORNECE,SF1->F1_LOJA, .F. , "SD1", .F., @(_aTotal[036])) [SD1 CADENAORIGINAL_SELLO] (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",CTO->(MsSeek(xFilial("CTO")+Strzero(SF1->F1_MOEDA,2))) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",SA2->(MSSeek(xFilial("SA2")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",CTO->(MsSeek(xFilial("CTO")+Strzero(SF1->F1_MOEDA,2))) , .T.) //////////////////////////////////////////////CADENA ORIGINAL////////////////////////////////////////////// (PRE) cCadOrig := _aTotal[099] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) (PREREG) FsQuery(_aTotal[097],1,"D1_DOC='" + SF1->F1_DOC + "' AND D1_SERIE='" + SF1->F1_SERIE + "' AND D1_FORNECE='" + SF1->F1_FORNECE + "' AND D1_LOJA='" + SF1->F1_LOJA + "'","SD1->D1_DOC=SF1->F1_DOC .AND. SD1->D1_SERIE=SF1->F1_SERIE .AND. SD1->D1_FORNECE=SF1->F1_FORNECE .AND. SD1->D1_LOJA=SF1->F1_LOJA","D1_ITEM") .And. .T. (PRE) fImptosD(SF1->F1_DOC,SF1->F1_SERIE,SF1->F1_FORNECE,SF1->F1_LOJA, .F. , "SD1", .F., @(_aTotal[036])) [SD1 CADENAORIGINAL_SELLO] (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",CTO->(MsSeek(xFilial("CTO")+Strzero(SF1->F1_MOEDA,2))) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",SA2->(MSSeek(xFilial("SA2")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) If(AllTrim(SF1->F1_ESPECIE)<>"NCC",CTO->(MsSeek(xFilial("CTO")+Strzero(SF1->F1_MOEDA,2))) , .T.) //////////////////////////////////////////////CADENA ORIGINAL////////////////////////////////////////////// (PRE) cCadOrig := _aTotal[099] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PRE) cCadOriCCE := "" //Cadena Original | Complemento de Comercio Exterior (PREREG) IIf(lCCCE .And. !Empty(SD1->D1_ITEM + SD1->D1_COD), (cCadOriCCE += Alltrim(SD1->D1_ITEM + SD1->D1_COD) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(SD1->D1_FRACCA), (cCadOriCCE += Alltrim(SD1->D1_FRACCA) + Alltrim(SD1->D1_NICO) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(Str(SD1->D1_CANADU)), (cCadOriCCE += Alltrim(Str(SD1->D1_CANADU)) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(SD1->D1_FRACCA), (cCadOriCCE += AllTrim(ObtColSAT("S014",AllTrim(SD1->D1_FRACCA),1,8,9,2)) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(Str(SD1->D1_VALADU)), (cCadOriCCE += Alltrim(Str(SD1->D1_VALADU,14,2)) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(Str(SD1->D1_USDADU)), (cCadOriCCE += Alltrim(Str(SD1->D1_USDADU,14,2)) + _aTotal[098],.T.), ("",,.T.)) //Cadena Original | Complemento de Comercio Exterior (POS) IIf(lCCCE, cCadOrig += "1.1" + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_TRASLA), cCadOrig += Alltrim(SF1->F1_TRASLA) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_TIPOPE), cCadOrig += Alltrim(SF1->F1_TIPOPE) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_CVEPED), cCadOrig += Alltrim(SF1->F1_CVEPED) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_CERORI), cCadOrig += Alltrim(SF1->F1_CERORI) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_NUMCER), cCadOrig += Alltrim(SF1->F1_NUMCER) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_EXPCONF), cCadOrig += Alltrim(SF1->F1_EXPCONF) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_INCOTER), cCadOrig += Alltrim(SF1->F1_INCOTER) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_SUBDIV), cCadOrig += Alltrim(SF1->F1_SUBDIV) + _aTotal[098], "") (POS) IIf(lCCCE .And. SF1->(ColumnPos("F1_OBSCE")) > 0 .And. !Empty(SF1->F1_OBSCETIPOPE), cCadOrig += CFDCarEsp(Alltrim(SF1->F1_OBSCE),.F..T., .F.) (PRE) cCadOriCCE := "" //Cadena Original | Complemento de Comercio Exterior (PREREG) IIf(lCCCE .And. !Empty(SD1->D1_ITEM + SD1->D1_COD), (cCadOriCCE += Alltrim(SD1->D1_ITEM + SD1->D1_COD) + _aTotal[098],.T.), ("",,.T.)) (POSPREREG) IIf(lCCCE .And. !Empty(Str(SF1SD1->F1>D1_TCUSDFRACCA)), cCadOrig (cCadOriCCE += Alltrim(Str(SF1->F1_TCUSD)) SD1->D1_FRACCA) + Alltrim(SD1->D1_NICO) + _aTotal[098],.T.), ("",,.T.)) (POSPREREG) IIf(lCCCE .And. !Empty(Str(SF1SD1->F1>D1_TOTUSDCANADU)), cCadOrig (cCadOriCCE += Alltrim(Str(SF1SD1->F1_TOTUSD,14,2>D1_CANADU)) + _aTotal[098],.T.), ("")///////////DATOS DE LA FACTURA///////////////// (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) ,,.T.)) (PREREG) IIf(lCCCE .And. !Empty(SD1->D1_FRACCA), (cCadOriCCE += AllTrim(ObtColSAT("S014",AllTrim(SD1->D1_FRACCA),1,8,9,2)) + _aTotal[098],.T.), ("",,.T.)) (PREPREREG) IIf(lCCCE .And. !Empty(Str(SD1->D1_VALADU)), (cCadOriCCE += Alltrim(Str(SD1->D1_VALADU,14,2)) + _aTotal[098],.T.), ("",,.T.)) (PREREG) IIf(lCCCE .And. !Empty(Str(SD1->D1_USDADU)), (cCadOriCCE += Alltrim(Str(SD1->D1_USDADU,14,2)) + _aTotal[098],.T.), ("",,.T.)) //Cadena Original | Complemento de Comercio Exterior (POS) IIf(lCCCE, cCadOrig += "1.1 (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) //Version (PRE) cCadOrig += "4.0" + _aTotal[098] //Serie (PRE) , "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_TRASLA), cCadOrig += Alltrim(SF1->F1_SERIETRASLA) + _aTotal[098] //Folio (PRE) , "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_TIPOPE), cCadOrig += Alltrim(SF1->F1_DOCTIPOPE) + _aTotal[098] //Fecha (PRE) , "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_CVEPED), cCadOrig += Alltrim(_aTotal[096]SF1->F1_CVEPED) + _aTotal[098] //FormaPago (PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", IIf(SF2->F2_GLOBAL == '1',FormPagGlo(SF2->F2_DOC,SF2->F2_SERIE),IIf(Empty(AI0->AI0_MPAGO).Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",Alltrim(AI0->AI0_MPAGO))) ) (POS) IIf(lCCCE .And. !Empty(SF1->F1_CERORI), cCadOrig += Alltrim(SF1->F1_CERORI) + _aTotal[098] ) //NoCertificado (PRE) , "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_NUMCER), cCadOrig += Alltrim(SF1->F1_CERTFOLNUMCER) + _aTotal[098] //CondicionesDePago (PRE) , "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_EXPCONF), cCadOrig += CFDCarEsp( Alltrim(SE4SF1->E4>F1_DESCRIEXPCONF) ) + _aTotal[098] //Subtotal (PRE) cCadOrig += Alltrim(STR((, "") (POS) IIf(lCCCE .And. !Empty(SF1->F1_VALMERC + IIF(_aTotal[101], INCOTER), cCadOrig += Alltrim(SF1->F1_DESCONT, 0 )) - INCOTER) + _aTotal[036098], 14,2)) + _aTotal[098] //Descuento (PRE) cCadOrig += IIf"") (POS) IIf(lCCCE .And. !Empty(SF1->F1_DESCONT==0, "", SUBDIV), cCadOrig += Alltrim(STR(SF1->F1_DESCONT,14,2SUBDIV) ) + _aTotal[098], "") //Moneda (PRE) cCadOrig += Alltrim(CTO->CTO_MOESATPOS) IIf(lCCCE .And. SF1->(ColumnPos("F1_OBSCE")) > 0 .And. !Empty(SF1->F1_OBSCE), cCadOrig += CFDCarEsp(Alltrim(SF1->F1_OBSCE),.F.) + _aTotal[098] //TipoCambio, "") (PREPOS) cCadOrig += IIf(Alltrim(CTO->CTO_MOESAT) <> "MXN", Alltrim(STRlCCCE .And. !Empty(Str(SF1->F1_TCUSD)), cCadOrig += Alltrim(Str(SF1->F1_TXMOEDA,14,2)), "1"TCUSD)) + _aTotal[098] //Total, "") (PRE) cCadOrig += Alltrim(STR(iif(GetSx3Cache("F1_VALBRUT","X3_DECIMAL")<= 2,POS) IIf(lCCCE .And. !Empty(Str(SF1->F1_VALBRUT,RoundTOTUSD)), cCadOrig += Alltrim(Str(SF1->F1_VALBRUTTOTUSD,2)),14,2)) + _aTotal[098], "") //TipoDeComprobante (PRE) cCadOrig += IIf(Alltrim(/////////DATOS DE LA FACTURA///////////////// (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_ESPECIE) == "NF", "I", "E") + _aTotal[098] //ExportacionCOND)) , .T.) (PRE) (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) //Version (PRE) cCadOrig += IIf(lCCCE,"02", "01") "4.0" + _aTotal[098] //MetodoPagoSerie (PRE) cCadOrig += IIf( Alltrim(SF1->F1_TIPODOC) == "21", "", Alltrim(SE4->E4_MPAGSATSERIE) + _aTotal[098] ) //LugarExpedicionFolio (PRE) cCadOrig += CFDCarEspAlltrim(AllTrim(SM0SF1->M0>F1_CEPENTDOC) ) + _aTotal[098] //ConfirmacionFecha //(PRE) cCadOrig += "ClavePAC" Alltrim(_aTotal[096]) + _aTotal[098] //////////////////////CFDI Relacionados////////////////////////// (PREREG) AllTrim(SF1->F1_RELSAT) <> "" (PRE) fGetFolRel("E",.T.)FormaPago (PRE) cCadOrig += IIf(Alltrim(SF2->F2_TIPODOC) == "21", "", IIf(SF2->F2_GLOBAL == '1',FormPagGlo(SF2->F2_DOC,SF2->F2_SERIE),IIf(Empty(AI0->AI0_MPAGO).Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",Alltrim(AI0->AI0_MPAGO))) + _aTotal[098] ) //NoCertificado (PRE) cCadOrig += Alltrim(SF1->F1_CERTFOL) + _aTotal[098] //CondicionesDePago///////////DATOS DEL EMISOR/////////////////////// //Rfc (PRE) cCadOrig += CFDCarEsp(AllTrimAlltrim(SM0SE4->M0>E4_CGCDESCRI),.F.) + _aTotal[098] //NombreSubtotal (PRE) cCadOrig += CFDCarEspAlltrim(STR((SF1->F1_VALMERC + IIF(_aTotal[075],.F.101], SF1->F1_DESCONT, 0 )) - _aTotal[036],14,2)) + _aTotal[098] //RegimenFiscalDescuento (PRE) cCadOrig += CFDCarEsp(Alltrim(SM0->M0_DSCCNAIIf(SF1->F1_DESCONT==0, "", Alltrim(STR(SF1->F1_DESCONT,14,2)) + _aTotal[098]) //////////////////////DATOS DEL RECEPTOR////////////////////////// (PRE) AllTrim(SF1->F1_ESPECIE) == "NCC" (PRE) SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) (PRE) SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) //Rfc (PRE) (cCadOrig += CFDCarEsp(AllTrim(SA1->A1_CGC), .F.Moneda (PRE) cCadOrig += Alltrim(CTO->CTO_MOESAT) + _aTotal[098] //TipoCambio (PRE) cCadOrig += IIf(!(Alltrim(CTO->CTO_MOESAT) $ "MXN|XXX"), Alltrim(STR(SF1->F1_TXMOEDA,14,2)), "1") + _aTotal[098] //Total (PRE) cCadOrig += Alltrim(STR(iif(GetSx3Cache("F1_VALBRUT","X3_DECIMAL")<= 2,SF1->F1_VALBRUT,Round(SF1->F1_VALBRUT,2)),14,2)) + _aTotal[098], .T.) //NombreTipoDeComprobante (PRE) ( cCadOrig += CFDCarEspIIf(Alltrim(SA1SF1->A1>F1_NOME),.F.ESPECIE) == "NF", "I", "E") + _aTotal[098], .T.) //DomicilioFiscalReceptorExportacion (PRE) ( cCadOrig += IIf(SF2->F2_GLOBAL <> "1",CFDCarEsp(Alltrim(SA1->A1_CEP),.F.lCCCE,"02", "01") + _aTotal[098],""), .T.) //ResidenciaFiscalMetodoPago (PRE) cCadOrig += IIf(lCCCE,(cCadOrig += Alltrim(SYA->YA_CCESATAlltrim(SF1->F1_TIPODOC) == "21", "", Alltrim(SE4->E4_MPAGSAT) + _aTotal[098] , .T. ),"") //NumRegIdTribLugarExpedicion (PRE) IIf(lCCCE,( cCadOrig += AlltrimCFDCarEsp(AllTrim(AI0SM0->AI0>M0_IDFISCEPENT)) + _aTotal[098], .T.),"") //RegimenFiscalReceptorConfirmacion //(PRE) ( cCadOrig += IIf(SF2->F2_GLOBAL <> "1" .And. AI0->(ColumnPos("AI0_REGFIS")) > 0,CFDCarEsp(Alltrim(AI0->AI0_REGFIS),.F.) "ClavePAC" + _aTotal[098],""), .T.) //////////////////////CFDI Relacionados////////////////////////// (PREREG) AllTrim //UsoCFDI (PRE) (cCadOrig += Alltrim(SF1->F1_USOCFDI) + _aTotal[098], .T.)(PRE) (cCadOrig += fXMLFUN("CORELSAT) <> "" (PRE) fGetFolRel("E",.T., .F. ,.F.))) ///////////DATOS DEL EMISOR/////////////////////// //Rfc (PRE) ( cCadOrig += fXMLFUN("TI",.T., .F. ,.T.))CFDCarEsp(AllTrim(SM0->M0_CGC),.F.) + _aTotal[098] //Nombre (PRE) ( cCadOrig += fXMLFUN("IL",.T., .F. ,.T.)) //Cadena Original | Complemento de Comercio Exterior //Emisor (POS) IIf(lCCCE, CFDCarEsp(_aTotal[075],.F.) + _aTotal[098] //RegimenFiscal (PRE) cCadOrig += CFDCarEsp(AllTrimAlltrim(SM0->M0_ENDCOBDSCCNA)) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SM0->M0_BAIRENT), cCadOrig += ObtColSAT("S015",AllTrim(SM0->M0 //////////////////////DATOS DEL RECEPTOR////////////////////////// (PRE) AllTrim(SF1->F1_ESPECIE) == "NCC" (PRE) SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) (PRE) SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) //Rfc (PRE) (cCadOrig += CFDCarEsp(AllTrim(SA1->A1_CGC), .F.) _CEPENT),5,5,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], "").T.) //Nombre (POSPRE) IIf (lCCCE, cCadOrig += "MEX" CFDCarEsp(Alltrim(SA1->A1_NOME),.F.) + _aTotal[098], "".T.) //DomicilioFiscalReceptor (POSPRE) IIf (lCCCE, cCadOrig += AllTrim(SM0->M0_CEPENTIIf(SF2->F2_GLOBAL <> "1",CFDCarEsp(Alltrim(SA1->A1_CEP),.F.) + _aTotal[098],""), .T.) //Receptor DomicilioResidenciaFiscal (POSPRE) IIf(lCCCE,(cCadOrig += CFDCarEspAlltrim(AllTrim(SA1SYA->A1>YA_ENDCCESAT) ) + _aTotal[098], ".T.),"") //NumRegIdTrib (POSPRE) IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NR_END)), ,(cCadOrig += AllTrimAlltrim(SA1AI0->A1>AI0_NR_ENDIDFIS) + _aTotal[098], .T.),"") //RegimenFiscalReceptor (POSPRE) (cCadOrig += IIf(lCCCE SF2->F2_GLOBAL <> "1" .And. !Empty(AllTrim(SA1->A1_NROINT)), cCadOrig += AllTrim(SA1->A1_NROINTAI0->(ColumnPos("AI0_REGFIS")) > 0,CFDCarEsp(Alltrim(AI0->AI0_REGFIS),.F.) + _aTotal[098],""), .T.) //UsoCFDI (POSPRE) IIf (lCCCE .And. !Empty(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))), cCadOrig += CFDCarEsp(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))) Alltrim(SF1->F1_USOCFDI) + _aTotal[098], "".T.) (POSPRE) (cCadOrig += fXMLFUN("CO",.T., .F. ,.F.)) (PRE) (cCadOrig += fXMLFUN("TI",.T., .F. ,.T.)) (PRE) (cCadOrig += fXMLFUN("IL",.T., .F. ,.T.)) //Cadena Original | Complemento de Comercio Exterior //Emisor 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")AllTrim(SM0->M0_ENDCOB)) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(AllTrim(SA1SM0->A1>M0_PAISBAIRENT)), cCadOrig += AllTrimObtColSAT(Posicione("SYAS015",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT")) AllTrim(SM0->M0_CEPENT),5,5,1,4) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(AllTrim(SA1SM0->A1>M0_CEPCODMUN)), cCadOrig += AllTrim(SA1SM0->A1>M0_CEPCODMUN) + _aTotal[098], "") (POS) IIf(lCCCE, cCadOrig += IIf(!Empty(cCadOriCCE), cCadOriCCECFDCarEsp(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[033] := cCadOrig098], "") //SELLOReceptor Domicilio (POS) IIf(lCCCE, cCadOrig += CFDCarEsp(AllTrim(SA1->A1_END)) + _aTotal[100098] := EVPDigest(cCadOrig,5, "") (POS) _aTotal[100] := PrivSignRSA(&(SuperGetMv("MV_CFDDIRS",,""))+SuperGetMv("MV_CFDARQS",,""),_aTotal[100],6,"assinaturaIIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NR_END)), cCadOrig += AllTrim(SA1->A1_NR_END) + _aTotal[098], "") (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"?>' 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 .And. !Empty(AllTrim(SA1->A1_PAIS)), cCadOrig += AllTrim(Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT")) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_CEP)), cCadOrig += AllTrim(SA1->A1_CEP) + _aTotal[098], "") (POS) cCadOrig += IIf(!Empty(cCadOriCCE), cCadOriCCE, "") (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 := "MIIFyDCCA7CgAwIBAgIUMzAwMDEwMDAwMDA0MDAwMDI0NDMwDQYJKoZIhvcNAQEL[XXX FACTURA] //Certificado del SAT incluido para pruebas (PRE) cCert := "MIIFyDCCA7CgAwIBAgIUMzAwMDEwMDAwMDA0MDAwMDI0NDMwDQYJKoZIhvcNAQEL" (PRE) cCert += "BQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFE" (PRE) cCert += "TUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9y" (PRE) cCert += "aXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0w" (PRE) cCert += "GwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWRpejEOMAwGA1UEEQwFMDYzNzAxCzAJ" (PRE) cCert += "BgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhD" (PRE) cCert += "T1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3Bv" (PRE) cCert += "bnNhYmxlOiBBQ0RNQS1TQVQwHhcNMTkwNjE3MjA0MDUxWhcNMjMwNjE3MjA0MDUx" (PRE) cCert += "WjCB7zEqMCgGA1UEAxMhWEVOT04gSU5EVVNUUklBTCBBUlRJQ0xFUyBTIERFIENW" (PRE) cCert += "MSowKAYDVQQpEyFYRU5PTiBJTkRVU1RSSUFMIEFSVElDTEVTIFMgREUgQ1YxKjAo" (PRE) cCert += "BgNVBAoTIVhFTk9OIElORFVTVFJJQUwgQVJUSUNMRVMgUyBERSBDVjElMCMGA1UE" (PRE) cCert += "LRMcWElBMTkwMTI4SjYxIC8gS0FITzY0MTEwMUIzOTEeMBwGA1UEBRMVIC8gS0FI" (PRE) cCert += "TzY0MTEwMUhOVExLUzA2MSIwIAYDVQQLExlYZW5vbiBJbmR1c3RyaWFsIEFydGlj" (PRE) cCert += "bGVzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiJQ5YcSgjwsGf29+" (PRE) cCert += "3go7VGdtMZCcH9wUpn46ZMAlFwUojnCPTvwJ3+cSwjqJnw8ahr3DuRwekvGR4BJA" (PRE) cCert += "b5b9Xi8kyoiWtwcGOSWxO38Bp9J1e/BO9HMbQBPAtLDuG47oqnH8zWLOeaoYRJDp" (PRE) cCert += "ARw4RX1ko2+9tbj0ntBtM7Vk1E8EWiA/h2Meq0LIv1+ySGTUrEW46FM01J5pzELv" (PRE) cCert += "5XupBghuJxR5DG9fiOW7u3dR5s3tZoVLwA1KdjJtY0mmnfCwxg6i5AqhvY+FAI5D" (PRE) cCert += "6CF6/lHA8PWg63WasvrhuIv70xCLjgPT/j00ZcPrLvBf1DefGVic980Ch/SDvC+M" (PRE) cCert += "dJ1F5wIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQEAwIGwDANBgkqhkiG" (PRE) cCert += "9w0BAQsFAAOCAgEACjfTPoKY2N5MxjmAMltd5XZCV1vgAwEtrIRYTodhE8R0Tp1Q" (PRE) cCert += "anAXb0luPyBv5hIXWK4VqAI4fcTtP+n7kkrwfha6ErkPWFNJWJm8ZsMmby/3WgVo" (PRE) cCert += "JkOFyRYQqr5Il3N6wMa5kiDBtDRbqB3iEXmvtrvjWSHyxAER+zo3jWGFlhBZ0nQN" (PRE) cCert += "Rtjx8sPFihVc5TUH682HJiU4oWvT63Dnra8ncqiW/uCuY86crnUq0fW7Lw/3+PY5" (PRE) cCert += "xXjNxR/Hh3sUPITfJrGaLWurD1J9npr9yGAJ6t9zrhhZnepIC0DUMc5+j4pg1DrOBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFE" (PRE) cCert += "32jzwUOLQqErDizh84NoJCWwbg+US8wi3zD0ZKiDv7XsTNWAW2Ap2JkzykKHjFTZTUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9y" (PRE) cCert += "iEm3uZOkJNfcu3o+kefr5HfXFT+iN9K5FUEhaQwgUeZBRJ8V5F6gmhz3d6ixVbiZaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0w" (PRE) cCert += "oFNhYR8e2k8gF9gGrVMrEbJGQrl+6+ZYQLFiauXeG7fu1svk19PuyredRJGnseJqGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWRpejEOMAwGA1UEEQwFMDYzNzAxCzAJ" (PRE) cCert += "yV4RzcRGhJA+cLnmpdDOTEhignnvnhEuY6HVRYYXhOTyeeluET7KRCxbJGqO7TdWBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhD" (PRE) cCert += "gjrHL3HRbNE4NY5GAdOZuLaWxElG5ZVCHqtG0Nh7UQAhcz+EKyZBAewv5XuH0OomT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3Bv" (PRE) cCert += "ZXw6mM2mY2soL6z1224NusM8/BbJcYTQUlAEKblEChhGK1XlxiVOU2nc9KE=bnNhYmxlOiBBQ0RNQS1TQVQwHhcNMTkwNjE3MjA0MDUxWhcNMjMwNjE3MjA0MDUx" (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.)cCert += "WjCB7zEqMCgGA1UEAxMhWEVOT04gSU5EVVNUUklBTCBBUlRJQ0xFUyBTIERFIENW" (PRE) cCert += "MSowKAYDVQQpEyFYRU5PTiBJTkRVU1RSSUFMIEFSVElDTEVTIFMgREUgQ1YxKjAo" (PRE) cNodoCCE :cCert += "BgNVBAoTIVhFTk9OIElORFVTVFJJQUwgQVJUSUNMRVMgUyBERSBDVjElMCMGA1UE" (PRE) If(AllTrim(SF1->F1_ESPECIE)=cCert += "LRMcWElBMTkwMTI4SjYxIC8gS0FITzY0MTEwMUIzOTEeMBwGA1UEBRMVIC8gS0FI" (PRE) cCert += "TzY0MTEwMUhOVExLUzA2MSIwIAYDVQQLExlYZW5vbiBJbmR1c3RyaWFsIEFydGlj" (PRE) cCert += "bGVzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiJQ5YcSgjwsGf29+" (PRE) cCert += "3go7VGdtMZCcH9wUpn46ZMAlFwUojnCPTvwJ3+cSwjqJnw8ahr3DuRwekvGR4BJA" (PRE) cCert += "b5b9Xi8kyoiWtwcGOSWxO38Bp9J1e/BO9HMbQBPAtLDuG47oqnH8zWLOeaoYRJDp" (PRE) cCert += "ARw4RX1ko2+9tbj0ntBtM7Vk1E8EWiA/h2Meq0LIv1+ySGTUrEW46FM01J5pzELv" (PRE) cCert += "5XupBghuJxR5DG9fiOW7u3dR5s3tZoVLwA1KdjJtY0mmnfCwxg6i5AqhvY+FAI5D" (PRE) cCert += "6CF6/lHA8PWg63WasvrhuIv70xCLjgPT/j00ZcPrLvBf1DefGVic980Ch/SDvC+M" (PRE) cCert += "dJ1F5wIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQEAwIGwDANBgkqhkiG" (PRE) cCert += "9w0BAQsFAAOCAgEACjfTPoKY2N5MxjmAMltd5XZCV1vgAwEtrIRYTodhE8R0Tp1Q" (PRE) cCert += "anAXb0luPyBv5hIXWK4VqAI4fcTtP+n7kkrwfha6ErkPWFNJWJm8ZsMmby/3WgVo" (PRE) cCert += "JkOFyRYQqr5Il3N6wMa5kiDBtDRbqB3iEXmvtrvjWSHyxAER+zo3jWGFlhBZ0nQN" (PRE) cCert += "Rtjx8sPFihVc5TUH682HJiU4oWvT63Dnra8ncqiW/uCuY86crnUq0fW7Lw/3+PY5" (PRE) cCert += "xXjNxR/Hh3sUPITfJrGaLWurD1J9npr9yGAJ6t9zrhhZnepIC0DUMc5+j4pg1DrO" (PRE) cCert += "32jzwUOLQqErDizh84NoJCWwbg+US8wi3zD0ZKiDv7XsTNWAW2Ap2JkzykKHjFTZ" (PRE) cCert += "iEm3uZOkJNfcu3o+kefr5HfXFT+iN9K5FUEhaQwgUeZBRJ8V5F6gmhz3d6ixVbiZ" (PRE) cCert += "oFNhYR8e2k8gF9gGrVMrEbJGQrl+6+ZYQLFiauXeG7fu1svk19PuyredRJGnseJq" (PRE) cCert += "yV4RzcRGhJA+cLnmpdDOTEhignnvnhEuY6HVRYYXhOTyeeluET7KRCxbJGqO7TdW" (PRE) cCert += "gjrHL3HRbNE4NY5GAdOZuLaWxElG5ZVCHqtG0Nh7UQAhcz+EKyZBAewv5XuH0Oom" (PRE) cCert += "ZXw6mM2mY2soL6z1224NusM8/BbJcYTQUlAEKblEChhGK1XlxiVOU2nc9KE=" (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PRE) cNodoCCE := "" (PRE) If(AllTrim(SF1->F1_ESPECIE)=="NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) _aTotal[001] := '<cfdi:Comprobante'NCC",SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_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] += ' xmlns:implocal="http://www.sat.gob.mx/implocal"' (PRE) _aTotal[001] += ' xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv4.0.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd"' (PRE) _aTotal[001] += ' Version="4.0"' (PRE) _aTotal[001] += ' Serie="' + Alltrim(SF1->F1_SERIE) + '"' (PRE) _aTotal[001] += ' Folio="' + Alltrim(SF1->F1_DOC) + '"' (PRE) _aTotal[001] += ' Fecha="' + Alltrim(_aTotal[096]) + '"' (PRE) _aTotal[001] += ' Sello="' + Alltrim(_aTotal[100]) + '"' (PRE) _aTotal[001] += ' FormaPago="' + Iif(Empty(AI0→AI0_MPAGO) .Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",Alltrim(AI0->AI0_MPAGO)) + '"' (PRE) _aTotal[001] += ' NoCertificado="' + Alltrim(SF1->F1_CERTFOL) + '"' (PRE) _aTotal[001] += ' Certificado="' + cCert + '"' (PRE) _aTotal[001] += ' CondicionesDePago="' + CFDCarEsp(Alltrim(SE4->E4_DESCRI)) + '"' (PRE) _aTotal[001] += ' SubTotal="' + Alltrim(STR((SF1->F1_VALMERC + IIF(_aTotal[101], SF1->F1_DESCONT, 0 )) - _aTotal[036],14,2)) + '"' (PRE) _aTotal[001] += IIf(SF1->F1_DESCONT==0, "", ' Descuento="' + Alltrim(STR(SF1->F1_DESCONT,14,2)) + '"') (PRE) _aTotal[001] += ' Moneda="' + Alltrim(CTO->CTO_MOESAT) + 'xmlns:cfdi="http://www.sat.gob.mx/cfd/4"' (PRE) _aTotal[001] += ' TipoCambio="' + IIf(Alltrim(CTO->CTO_MOESAT) <> "MXN", Alltrim(STR(SF1->F1_TXMOEDA,14,2)), "1") + '"'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' (PRE) _aTotal[001] += ' Total="' + Alltrim(STR(iif(GetSx3Cache("F1_VALBRUT","X3_DECIMAL")<= 2,SF1->F1_VALBRUT,Round(SF1->F1_VALBRUT,2)),14,2)) + '"xmlns:implocal="http://www.sat.gob.mx/implocal"' (PRE) _aTotal[001] += ' TipoDeComprobante="' + IIf(Alltrim(SF1->F1_ESPECIE) == "NF", "I", "E") + '"xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv4.0.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd"' (PRE) _aTotal[001] += ' ExportacionVersion="'+IIf(lCCCE .And. Alltrim(SF2->F2_ESPECIE) == "NF","02","01")+'"'4.0"' (PRE) _aTotal[001] += IIf(Alltrim(SF1->F1_TIPODOC) == "21", "", ' MetodoPago' Serie="' + Alltrim(SE4SF1->E4>F1_MPAGSATSERIE) + '"' ) (PRE) _aTotal[001] += ' LugarExpedicionFolio="' + CFDCarEspAlltrim(AllTrim(SM0SF1->M0>F1_CEPENT)DOC) + '"' (PRE) _aTotal[001] += ' >' (PREREG) Fecha="' + Alltrim(_aTotal[001096]) + '"' (PRE) _aTotal[001] += ' Sello="' + Alltrim(_aTotal[100]) + '"' (PRE) _aTotal[001] += ' FormaPago="' + Iif(Empty(AI0→AI0_MPAGO) .Or. Alltrim(SE4->E4_MPAGSAT) == "PPD","99",Alltrim(AI0->AI0_MPAGO)) + '"' (PRE) _aTotal[001] += ' NoCertificado="' + Alltrim(SF1->F1_CERTFOL) + '"' (PRE) _aTotal[001] += ' Certificado="' + cCert + '"' (PRE) _aTotal[001] += ' CondicionesDePago="' + CFDCarEsp(Alltrim(SE4->E4_DESCRI)) + '"' (PRE) _aTotal[001] += ' SubTotal="' + Alltrim(STR((SF1->F1_VALMERC + IIF(_aTotal[101], SF1->F1_DESCONT, 0 )) - _aTotal[036],14,2)) + '"' (PRE) _aTotal[001] += IIf(SF1->F1_DESCONT==0, "", ' Descuento="' + Alltrim(STR(SF1->F1_DESCONT,14,2)) + '"') (PRE) _aTotal[001] += ' Moneda="' + Alltrim(CTO->CTO_MOESAT) + '"' (PRE) _aTotal[001] += ' TipoCambio="' + IIf(Alltrim(CTO->CTO_MOESAT) <> "MXN", Alltrim(STR(SF1->F1_TXMOEDA,14,2)), "1") + '"' (PRE) _aTotal[001] += ' Total="' + Alltrim(STR(iif(GetSx3Cache("F1_VALBRUT","X3_DECIMAL")<= 2,SF1->F1_VALBRUT,Round(SF1->F1_VALBRUT,2)),14,2)) + '"' (PRE) _aTotal[001] += ' TipoDeComprobante="' + IIf(Alltrim(SF1->F1_ESPECIE) == "NF", "I", "E") + '"' (PRE) _aTotal[001] += ' Exportacion="'+IIf(lCCCE .And. Alltrim(SF2->F2_ESPECIE) == "NF","02","01")+'"' (PRE) _aTotal[001] += IIf(Alltrim(SF1->F1_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, ' <cce11:ComercioExterior(POS) cNodoCCE := IIf(lCCCE, ' <cce11:ComercioExterior' , "") (POS) cNodoCCE += IIf(lCCCE, ' xmlns:cfdi="http://www.sat.gob.mx/cfd/4"' , "") (POS) cNodoCCE += IIf(lCCCE, ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' , "") (POS) cNodoCCE += IIf(lCCCE, ' xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11"' , "") (POS) cNodoCCE += IIf(lCCCE, ' xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv4.0.xsd http://www.sat.gob.mx/ComercioExterior11 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior11/ComercioExterior11.xsd"' , "") (POS) cNodoCCE += IIf(lCCCE, ' Version="1.1"' , "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_TRASLA), ' MotivoTraslado="' + Alltrim(SF1->F1_TRASLA) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_TIPOPE), ' TipoOperacion="' + Alltrim(SF1->F1_TIPOPE) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_CVEPED), ' ClaveDePedimento="' + Alltrim(SF1->F1_CVEPED) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_CERORI), ' CertificadoOrigen="' + Alltrim(SF1->F1_CERORI) +'"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_NUMCER), ' NumCertificadoOrigen="' + Alltrim(SF1->F1_NUMCER) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_EXPCONF), ' NumeroExportadorConfiable="' + Alltrim(SF1->F1_EXPCONF) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_INCOTER), ' Incoterm="' + Alltrim(SF1->F1_INCOTER) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_SUBDIV), ' Subdivision="' + Alltrim(SF1->F1_SUBDIV) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. SF1->(ColumnPos("F1_OBSCE")) > 0 .And. !Empty(SF1->F1_OBSCE), ' Observaciones="' + CFDCarEsp(Alltrim(SF1->F1_OBSCE), .F.) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(Str(SF1->F1_TCUSD)), ' TipoCambioUSD="' + Alltrim(Str(SF1->F1_TCUSD)) + '"' , "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(Str(SF1->F1_TOTUSD)), ' TotalUSDxmlns:cfdi="' + Alltrim(Str(SF1->F1_TOTUSD,14,2)) + '"http://www.sat.gob.mx/cfd/4"' , "") (POS) cNodoCCE += IIf(lCCCE, ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' , "") (POS) cNodoCCE += IIf(lCCCE, ' >' + ( chr(13)+chr(10) )xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11"' , "") (POS) _aTotal[094] := cNodoCCE [XXX CFDIREL] (PREREG) AllTrim(SF1->F1_RELSAT) <> "" (PREREG) (_aTotal[001] := fGetFolRel("E"),.T.) (PREREG) _aTotal[001] [XXX EMISOR] (PRE) _aTotal[001] := ' <cfdi:Emisor' (PRE) _aTotal[001] += ' Rfc="' + CFDCarEsp(AllTrim(SM0->M0_CGC)) + '"' (PRE) _aTotal[001] += ' Nombre="' + CFDCarEsp(_aTotal[075],.T.) + '"' (PRE) _aTotal[001] += ' RegimenFiscal="' + CFDCarEsp(Alltrim(SM0->M0_DSCCNA)) + '"' (PRE) _aTotal[001] += '/>' (PREREG) _aTotal[001] [XXX RECEPTOR_CLIENTE] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .cNodoCCE += IIf(lCCCE, ' xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv4.0.xsd http://www.sat.gob.mx/ComercioExterior11 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior11/ComercioExterior11.xsd"' , "") (POS) cNodoCCE += IIf(lCCCE, ' Version="1.1"' , "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_TRASLA), ' MotivoTraslado="' + Alltrim(SF1->F1_TRASLA) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_TIPOPE), ' TipoOperacion="' + Alltrim(SF1->F1_TIPOPE) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_TIPOPECVEPED), .T., .F.) (PRE) cNodoCCE := ""(PREREG) AllTrim(' ClaveDePedimento="' + Alltrim(SF1->F1_ESPECIE) == "NCC" (PREREG) (SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+CVEPED) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_CERORI), ' CertificadoOrigen="' + Alltrim(SF1->F1_LOJA)) , .T.CERORI) +'"', "") (PREREGPOS) (SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PREREG) (_aTotal[001] := ' <cfdi:Receptor' , .T.) (PREREG) (_aTotal[001] += ' Rfc="' + CFDCarEsp(AllTrim(SA1->A1_CGC)) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_NUMCER), ' NumCertificadoOrigen="' + Alltrim(SF1->F1_NUMCER) + '"', .T."") (PREREG) (_aTotal[001] += ' NombrePOS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_EXPCONF), ' NumeroExportadorConfiable="' + CFDCarEsp( Alltrim(SA1SF1->A1>F1_NOMEEXPCONF) ,.T.) + '"', .T."") (PREREGPOS) cNodoCCE += IIf(_aTotal[001] += ' DomicilioFiscalReceptorlCCCE .And. !Empty(SF1->F1_INCOTER), ' Incoterm="' + Alltrim(SA1SF1->A1>F1_CEPINCOTER) + '"', .T."") (PREREG) (_aTotal[001] += Iif(AI0->(ColumnPos("AI0_REGFIS")) > 0,' RegimenFiscalReceptorPOS) cNodoCCE += IIf(lCCCE .And. !Empty(SF1->F1_SUBDIV), ' Subdivision="' + Alltrim(AI0SF1->AI0>F1_REGFISSUBDIV) + '"', ""), .T.) (PREREGPOS) cNodoCCE += IIf(lCCCE ,(_aTotal[001] += ' ResidenciaFiscal.And. SF1->(ColumnPos("F1_OBSCE")) > 0 .And. !Empty(SF1->F1_OBSCE), ' Observaciones="' + CFDCarEsp(Alltrim(SYASF1->YA_CCESAT>F1_OBSCE), .F.) + '"', .T.), "") (PREREGPOS) cNodoCCE += IIf(lCCCE ,(_aTotal[001] += ' NumRegIdTrib.And. !Empty(Str(SF1->F1_TCUSD)), ' TipoCambioUSD="' + Alltrim(Str(AI0SF1->AI0>F1_IDFISTCUSD)) + '"', .T.), "") (PREREG) (_aTotal[001] += ' UsoCFDIPOS) cNodoCCE += IIf(lCCCE .And. !Empty(Str(SF1->F1_TOTUSD)), ' TotalUSD="' + Alltrim(Str(SF1->F1_USOCFDI) + '"' , .T.) (PREREG) (_aTotal[001] += '/>' ,.T.) (PREREG) _aTotal[001]//Emisor (POS) cNodoCCE += IIf(lCCCE, ' <cce11:EmisorTOTUSD,14,2)) + '"', "") (POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") (POS) cNodoCCE += IIf(lCCCE, ' <cce11:Domicilio' , "") (POS) cNodoCCE += IIf(lCCCE, ' Calle="' + CFDCarEsp(AllTrim(SM0->M0_ENDCOB)) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(CFDCarEsp(AllTrim(SM0->M0_CEPENT)))), ' Colonia_aTotal[094] := cNodoCCE [XXX CFDIREL] (PREREG) AllTrim(SF1->F1_RELSAT) <> "" (PREREG) (_aTotal[001] := fGetFolRel("E"),.T.) (PREREG) _aTotal[001] [XXX EMISOR] (PRE) _aTotal[001] := ' <cfdi:Emisor' (PRE) _aTotal[001] += ' Rfc="' + CFDCarEsp(AllTrim(ObtColSAT("S015",AllTrim(SM0->M0_CEPENT),5,5,1,4CGC)) ) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SM0->M0_CEPENT))), ' MunicipioPRE) _aTotal[001] += ' Nombre="' + CFDCarEsp(_aTotal[075],.T.) + '"' (PRE) _aTotal[001] += ' RegimenFiscal="' + CFDCarEsp(AllTrimAlltrim(SM0->M0_CODMUNDSCCNA)) + '"', "") (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, ' </cce11:Emisor>' + ( chr(13)+chr(10) ), "") //Receptor (POS) cNodoCCE += IIf(lCCCE, ' <cce11:Receptor' , "") (POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") (PRE) _aTotal[001] += '/>' (PREREG) _aTotal[001]
[XXX RECEPTOR_CLIENTE] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PRE) cNodoCCE := "" (PREREG) AllTrim(SF1->F1_ESPECIE) == "NCC" (PREREG) (SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PREREG) (SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) , .T.) (PREREG) (_aTotal[001] := ' <cfdi:Receptor' , .T.) (PREREG) (_aTotal[001] += ' Rfc="' + CFDCarEsp(AllTrim(SA1->A1_CGC)) + '"' , .T.) (PREREG) (_aTotal[001] += ' Nombre="' + CFDCarEsp(Alltrim(SA1->A1_NOME),.T.) + '"' , .T.) (PREREG) (_aTotal[001] += ' DomicilioFiscalReceptor="' + Alltrim(SA1->A1_CEP) + '"' , .T.) (PREREG) (_aTotal[001] += Iif(AI0->(ColumnPos("AI0_REGFIS")) > 0,' RegimenFiscalReceptor="' + Alltrim(AI0->AI0_REGFIS//Domicilio Receptor (POS) cNodoCCE += IIf(lCCCE, ' <cce11: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) + '"',""), .T.) (POSPREREG) cNodoCCE += IIf(lCCCE .And. !Empty(AllTrim(SA1->A1_NROINT)), ' NumeroInterior,(_aTotal[001] += ' ResidenciaFiscal="' + AllTrimAlltrim(SA1SYA->A1>YA_NROINTCCESAT) + '"' , "").T.),"") (POSPREREG) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SA1->A1_BAIRRO))), ' Colonia,(_aTotal[001] += ' NumRegIdTrib="' + CFDCarEspAlltrim(AllTrim(SA1AI0->A1>AI0_BAIRROIDFIS) ) + '"' , .T.),"") (PREREG) (_aTotal[001] += ' UsoCFDI="' + Alltrim(SF1->F1_USOCFDI) + '"' , .T.) (PREREG) (_aTotal[001] += '/>' ,.T.) (PREREG) _aTotal[001] //Emisor (POS) cNodoCCE += IIf(lCCCE, ' <cce11:EmisorPOS) 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"))) chr(13)+chr(10) ), "") (POS) cNodoCCE += IIf(lCCCE, ' <cce11:Domicilio' , "") (POS) cNodoCCE += IIf(lCCCE, ' Calle="' + CFDCarEsp(AllTrim(SM0->M0_ENDCOB)) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(CFDCarEsp(AllTrim(SM0->M0_CEPENT)))), ' PaisColonia="' + CFDCarEsp(AllTrim(PosicioneObtColSAT("SYAS015",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT"AllTrim(SM0->M0_CEPENT),5,5,1,4))) + '"', "") (POS) cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(AllTrim(SM0->M0_CEPENT))), ' CodigoPostalMunicipio="' + CFDCarEsp(AllTrim(SA1SM0->A1>M0_CEPCODMUN)) + '"', "") (POS) cNodoCCE += IIf(lCCCE, ' />Estado="' + ( chr(13)+chr(10) )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, ' </cce11:Receptor>>' + ( chr(13)+chr(10) ), "") (POS) ( cNodoCCE += IIf(lCCCE, ' <cce11</cce11:Mercancias>Emisor>' + ( chr(13)+chr(10) ), "")
//Receptor,.T.) (POS) _aTotal[094] += cNodoCCE [SD1 CONCEPTO] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PRE) cNodoCCE := "" cNodoCCE += IIf(lCCCE, ' <cce11:Receptor' , "") (POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") //Domicilio Receptor (POS) (PRE) DbGoTop() (PREREG) ( cNodoCCE += IIf(lCCCE, ' <cce11:MercanciaDomicilio' , ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_ITEM + SD1->D1_COD), ' NoIdentificacionCalle="' + AlltrimCFDCarEsp(AllTrim(SD1SA1->D1_ITEM + SD1->D1_COD>A1_END)) + '"', ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_FRACCAAllTrim(SA1->A1_NR_END)), ' FraccionArancelariaNumeroExterior="' + AlltrimAllTrim(SD1SA1->D1_FRACCA) + Alltrim(SD1->D1_NICO>A1_NR_END) + '"', ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(StrAllTrim(SD1SA1->D1>A1_CANADUNROINT)), ' CantidadAduanaNumeroInterior="' + AlltrimAllTrim(Str(SD1SA1->D1>A1_CANADU)NROINT) + '"', ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(CFDCarEsp(SD1AllTrim(SA1->D1>A1_FRACCABAIRRO))), ' UnidadAduanaColonia="' + AllTrim(ObtColSAT("S014",CFDCarEsp(AllTrim(SD1SA1->D1_FRACCA),1,8,9,2>A1_BAIRRO)) + '"', ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(StrAllTrim(SD1SA1->D1>A1_VALADUMUN)), ' ValorUnitarioAduanaMunicipio="' + AlltrimCFDCarEsp(StrAllTrim(SD1SA1->D1>A1_VALADU,14,2)) MUN),.T.) + '"', ""),.T.) (PREREGPOS) ( cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD1->D1_USDADU)), ' ValorDolaresEstado="' + CFDCarEsp(Alltrim(Str(SD1->D1_USDADU,14,2)) + '"', ""),.T.) (PREREG) (Posicione("SX5",1,xFilial("SX5")+"12"+SA1->A1_EST,"X5_DESCRI"))) + '"', "") (POS) cNodoCCE += IIf(lCCCE, ' >Pais="' + ( chr(13)+chr(10) ) , ""),.T.) (PREREG) (AllTrim(Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCESAT")) + '"', "") (POS) cNodoCCE += IIf(lCCCE, ' CodigoPostal="' + AllTrim(SA1->A1_CEP) + '"', "") (POS) cNodoCCE += IIf(lCCCE, ' </cce11:Mercancia>>' + ( chr(13)+chr(10) ), ""),.T.) (POS) ( cNodoCCE += IIf(lCCCE, ' </cce11:Mercancias>Receptor>' + ( chr(13)+chr(10) ), ""),.T.) (POS) (cNodoCCE += IIf(lCCCE, ' </cce11<cce11:ComercioExterior>' Mercancias>' + ( chr(13)+chr(10) ), ""),.T.) (POS) _aTotal[094] += cNodoCCE [SD1 CONCEPTO] (POS) (_aTotal[034] := fXMLFUN("COPRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F. ,) .F.)) [XXX CONCEPTOS] (POS) FsQuery(_aTotal[097],2) (PREREG) (_aTotal[001] := _aTotal[034]And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PREREG) _aTotal[001][XXX IMPUESTOS] (PREREG) (_aTotal[002] := fXMLFUN("TI",.F., .F. ,.T.)PRE) cNodoCCE := "" (PRE) DbGoTop()
(PREREG) _aTotal[002]//IMPUESTOS LOCALES// (PRE) (_aTotal[095] := fXMLFUN("IL",.F.(cNodoCCE += IIf(lCCCE, ' <cce11:Mercancia' , ""),.T.) [XXX COMPLEMENT] (PREREG) (_aTotal[001] := IIF(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095]), ' <cfdi:ComplementocNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_ITEM + SD1->D1_COD), ' NoIdentificacion="' + Alltrim(SD1->D1_ITEM + SD1->D1_COD) + '"', ""),.T.) (PREREG) (_aTotal[001] cNodoCCE += IIFIIf(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095]),'>lCCCE .And. !Empty(SD1->D1_FRACCA), ' FraccionArancelaria="' + Alltrim(SD1->D1_FRACCA) + Alltrim(SD1->D1_NICO) + '"', ""),.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 IMPUESTOLOC] (PREREG) (_aTotal[001] := _aTotal[095],.T.) (PREREG) _aTotal[001] [XXX COMPLEMENT] (PREREG) (_aTotal[001] := IIF(!EMPTY(_aTotal[094]) .or. !EMPTY(_aTotal[095]) ,' </cfdi:Complemento>(cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD1->D1_CANADU)), ' CantidadAduana="' + Alltrim(Str(SD1->D1_CANADU)) + '"', ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_FRACCA), ' UnidadAduana="' + AllTrim(ObtColSAT("S014",AllTrim(SD1->D1_FRACCA),1,8,9,2)) + '"', ""),.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_CFDNAF1","Lower(AllTrim(SF1->F1_ESPECIE)) + '_' + Lower(AllTrim(SF1->F1_SERIE)) + '_' + Lower(AllTrim(SF1->F1_DOC)) + '.xml'")) (ARQ) _aTotal[095] FACTURA C 019 0 ENCODEUTF8(XMLConv("",,,"cfdi:Comprobante",.F.,.T.,0)) |