//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.) .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_OBSCE), cCadOrig += CFDCarEsp(Alltrim(SF1->F1_OBSCE),.F.) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(Str(SF1->F1_TCUSD)), cCadOrig += Alltrim(Str(SF1->F1_TCUSD)) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(Str(SF1->F1_TOTUSD)), cCadOrig += Alltrim(Str(SF1->F1_TOTUSD,14,2)) + _aTotal[098], "") ///////////DATOS DE LA FACTURA///////////////// (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) (AI0->(MSSeek(xFilial("AI0")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) //Version (PRE) cCadOrig += "4.0" + _aTotal[098] //Serie (PRE) cCadOrig += Alltrim(SF1->F1_SERIE) + _aTotal[098] //Folio (PRE) cCadOrig += Alltrim(SF1->F1_DOC) + _aTotal[098] //Fecha (PRE) cCadOrig += Alltrim(_aTotal[096]) + _aTotal[098] //FormaPago (PRE) cCadOrig += 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 (PRE) cCadOrig += CFDCarEsp(Alltrim(SE4->E4_DESCRI)) + _aTotal[098] //Subtotal (PRE) cCadOrig += Alltrim(STR((SF1->F1_VALMERC + IIF(_aTotal[101], SF1->F1_DESCONT, 0 )) - _aTotal[036],14,2)) + _aTotal[098] //Descuento (PRE) cCadOrig += IIf(SF1->F1_DESCONT==0, "", Alltrim(STR(SF1->F1_DESCONT,14,2)) + _aTotal[098]) //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] //TipoDeComprobante (PRE) cCadOrig += IIf(Alltrim(SF1->F1_ESPECIE) == "NF", "I", "E") + _aTotal[098] //Exportacion (PRE) cCadOrig += IIf(lCCCE,"02", "01") + _aTotal[098] //MetodoPago (PRE) cCadOrig += IIf(Alltrim(SF1->F1_TIPODOC) == "21", "", Alltrim(SE4->E4_MPAGSAT) + _aTotal[098] ) //LugarExpedicion (PRE) cCadOrig += CFDCarEsp(AllTrim(SM0->M0_CEPENT)) + _aTotal[098] //Confirmacion //(PRE) cCadOrig += "ClavePAC" + _aTotal[098] //////////////////////CFDI Relacionados////////////////////////// (PREREG) !Empty(SF1->F1_RELSAT).Or. !Empty(SF1->F1_SERMAN).Or. !Empty(SF1->F1_DOCMAN) (PRE) fGetFolRel("E",.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(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.) + _aTotal[098], .T.) //Nombre (PRE) (cCadOrig += CFDCarEsp(Alltrim(SA1->A1_NOME),.F.) + _aTotal[098], .T.) //DomicilioFiscalReceptor (PRE) (cCadOrig += CFDCarEsp(Alltrim(SA1->A1_CEP),.F.) + _aTotal[098], .T.) //ResidenciaFiscal (PRE) IIf(lCCCE,(cCadOrig += Alltrim(SYA->YA_CCESAT) + _aTotal[098], .T.),"") //NumRegIdTrib (PRE) IIf(lCCCE,(cCadOrig += Alltrim(AI0->AI0_IDFIS) + _aTotal[098], .T.),"") //RegimenFiscalReceptor (PRE) (cCadOrig += IIf(AI0->(ColumnPos("AI0_REGFIS")) > 0,CFDCarEsp(Alltrim(AI0->AI0_REGFIS),.F.) + _aTotal[098],""), .T.) //UsoCFDI (PRE) (cCadOrig += Alltrim(SF1->F1_USOCFDI) + _aTotal[098], .T.) (PRE) (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 (POS) IIf(lCCCE, cCadOrig += CFDCarEsp(AllTrim(SM0->M0_ENDCOB)) + _aTotal[098], "") (POS) IIf(lCCCE .And. !Empty(SM0->M0_BAIRENT), cCadOrig += ObtColSAT("S015",AllTrim(SM0->M0_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], "") (POS) IIf(lCCCE, cCadOrig += "MEX" + _aTotal[098], "") (POS) IIf(lCCCE, cCadOrig += AllTrim(SM0->M0_CEPENT) + _aTotal[098], "") //Receptor Domicilio (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 .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" (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+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' (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/cfdv40.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd ' (PRE) _aTotal[001] += IIF(lCCCE,'http://www.sat.gob.mx/ComercioExterior11 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior11/ComercioExterior11.xsd "','"') (PRE) _aTotal[001] += IIf(lCCCE, ' xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11"' , "") (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) + '"' (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(SF1->F1_ESPECIE) == "NCC","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, ' 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/3 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.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)), ' TotalUSD="' + Alltrim(Str(SF1->F1_TOTUSD,14,2)) + '"', "") (POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") (POS) _aTotal[094] := cNodoCCE [XXX CFDIREL] (PREREG) !Empty(SF1->F1_RELSAT).Or. !Empty(SF1->F1_SERMAN).Or. !Empty(SF1->F1_DOCMAN) (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.) .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) + '"',""), .T.) (PREREG) IIf(lCCCE,(_aTotal[001] += ' ResidenciaFiscal="' + Alltrim(SYA->YA_CCESAT) + '"' , .T.),"") (PREREG) IIf(lCCCE,(_aTotal[001] += ' NumRegIdTrib="' + Alltrim(AI0->AI0_IDFIS) + '"' , .T.),"") (PREREG) (_aTotal[001] += ' UsoCFDI="' + Alltrim(SF1->F1_USOCFDI) + '"' , .T.) (PREREG) (_aTotal[001] += '/>' ,.T.) (PREREG) _aTotal[001] //Emisor (POS) cNodoCCE += IIf(lCCCE, ' <cce11:Emisor' , "") (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="' + CFDCarEsp(AllTrim(ObtColSAT("S015",AllTrim(SM0->M0_CEPENT),5,5,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, ' </cce11:Emisor>' + ( chr(13)+chr(10) ), "")
//Receptor (POS) cNodoCCE += IIf(lCCCE, ' <cce11:Receptor' , "") (POS) cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ), "") //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) + '"', "") (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, ' </cce11:Receptor>' + ( chr(13)+chr(10) ), "") (POS) (cNodoCCE += IIf(lCCCE, ' <cce11:Mercancias>' + ( chr(13)+chr(10) ), ""),.T.) (POS) _aTotal[094] += cNodoCCE [SD1 CONCEPTO] (PRE) lCCCE := IIf(SuperGetMV("MV_CFDIEXP",.F.,.F.) .And. !Empty(SF1->F1_TIPOPE), .T., .F.) (PRE) cNodoCCE := "" (PRE) DbGoTop() (PREREG) (cNodoCCE += IIf(lCCCE, ' <cce11:Mercancia' , ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_ITEM + SD1->D1_COD), ' NoIdentificacion="' + Alltrim(SD1->D1_ITEM + SD1->D1_COD) + '"', ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(SD1->D1_FRACCA), ' FraccionArancelaria="' + Alltrim(SD1->D1_FRACCA) + Alltrim(SD1->D1_NICO) + '"', ""),.T.) (PREREG) (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) (cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD1->D1_VALADU)), ' ValorUnitarioAduana="' + Alltrim(Str(SD1->D1_VALADU,14,2)) + '"', ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE .And. !Empty(Str(SD1->D1_USDADU)), ' ValorDolares="' + Alltrim(Str(SD1->D1_USDADU,14,2)) + '"', ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE, '>' + ( chr(13)+chr(10) ) , ""),.T.) (PREREG) (cNodoCCE += IIf(lCCCE, ' </cce11:Mercancia>' + ( chr(13)+chr(10) ), ""),.T.) (POS) (cNodoCCE += IIf(lCCCE, ' </cce11:Mercancias>' + ( chr(13)+chr(10) ), ""),.T.) (POS) (cNodoCCE += IIf(lCCCE, ' </cce11:ComercioExterior>' , ""),.T.) (POS) _aTotal[094] += cNodoCCE (POS) (_aTotal[034] := fXMLFUN("CO",.F., .F. ,.F.)) [XXX CONCEPTOS] (POS) FsQuery(_aTotal[097],2) (PREREG) (_aTotal[001] := _aTotal[034],.T.) (PREREG) _aTotal[001] [XXX IMPUESTOS] (PREREG) (_aTotal[002] := fXMLFUN("TI",.F., .F. ,.T.)) (PREREG) _aTotal[002] //IMPUESTOS LOCALES// (PRE) (_aTotal[095] := fXMLFUN("IL",.F.),.T.) [XXX COMPLEMENT] (PREREG) (_aTotal[001] := IIF(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095]), ' <cfdi:Complemento', ""), .T.) (PREREG) (_aTotal[001] += IIF(!EMPTY(_aTotal[094] ) .or. !EMPTY(_aTotal[095]),'>',""),.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>',""), .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)) |