//FATECOL.INI -- NFE Colombia v2 - Resolucion 0019 / FEB. 2016 [XXX POSICIONAMENTOS] (PRE) SA2->(DbSetOrder(1)) (PRE) _aTotal[116] := If(SF1->(ColumnPos("F1_SOPORT")) > 0 ,If(SF1->F1_SOPORT =='S'.AND. Alltrim(SF1->F1_TIPOPE) $'10|11', .T.,.F. ) , .F.) (PRE) _aTotal[117] := If(SF1->(ColumnPos("F1_MARK")) > 0 ,If(SF1->F1_MARK =='S'.AND. Alltrim(SF1->F1_TIPOPE) $'10|11', .T.,.F. ) , .F.) (PRE) _aTotal[089] := If(_aTotal[117] .AND. SF1->(ColumnPos("F1_TIPNOTA")) > 0, SF1->F1_TIPNOTA , "") (PRE) _aTotal[090] := "" (PRE) If(_aTotal[116] .OR. _aTotal[117] ,SA2->(MSSeek(xFilial("SA2")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) If(_aTotal[116] .OR. _aTotal[117] ,SA1->(MSSeek(xFilial("SA1")+SA2->A2_CLIENTE+SA2->A2_LOJCLI)) , .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" .AND. !_aTotal[116] .AND. !_aTotal[117] ,SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA)) , .T.) (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) IF( _aTotal[116] .OR. _aTotal[117], AI0->(MSSeek(xFilial("AI0")+SA2->(A2_CLIENTE+A2_LOJCLI))) , AI0->(MSSeek(xFilial("AI0")+SF1->(F1_FORNECE+F1_LOJA))) ) [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) SE1→(DbSetOrder(2)) (PRE) _aTotal[033] := ALLTRIM (SF1->F1_ESPECIE) (PRE) _aTotal[075] := Alltrim(SM0->M0_NOMECOM) (PRE) _aTotal[092] := IIF(_aTotal[116] .OR. _aTotal[117], Posicione("SA1",1,xFilial("SA1")+SA2->A2_CLIENTE+SA2->A2_LOJCLI,"A1_EST") ,Posicione("SA1",1,xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA,"A1_EST")) (PRE) _aTotal[093] := "" (PRE) _aTotal[094] := "" (PRE) _aTotal[095] := DtoS(SF1->F1_EMISSAO) (PRE) _aTotal[095] := Left(_aTotal[095],4) + "-" + Substr(_aTotal[095],5,2)+ "-" + Right(_aTotal[095],2) (PRE) _aTotal[096] := SF1->F1_HORA (PRE) _aTotal[097] := fGetTaxas(SF1->F1_DOC, SF1->F1_SERIE, SF1->F1_FORNECE, SF1->F1_LOJA, If(_aTotal[116], "NCC",SF1->F1_ESPECIE)) (PRE) _aTotal[098] := ALLTRIM( GETNEWPAR( "MV_ID_PROV" , "" ) ) (PRE) _aTotal[099] := ALLTRIM( GETNEWPAR( "MV_ID_SOFT" , "" ) ) (PRE) _aTotal[100] := ALLTRIM( GETNEWPAR( "MV_CODESEC" , "" ) ) (PRE) _aTotal[101] := {"SD1",""} (PRE) _aTotal[102] := IIF( _aTotal[033] == "NF" , "1" , IIF( _aTotal[033] == "NCC" , "2" , IIF( _aTotal[033] == "NDC" , "3" , IIF( _aTotal[033] == "NDI" , "4" , IIF( _aTotal[033] == "NCI" , "5" , "" ) ) ) ) ) (PRE) _aTotal[103] := "" (PRE) _aTotal[104] := PADR( Alltrim(SM0->M0_CGC) , 10 , "0" ) (PRE) _aTotal[105] := IIF( _aTotal[033] == "NF" , "f" , IIF( _aTotal[033] == "NCC" .or. _aTotal[033] == "NCI" , "c" , IIF( _aTotal[033] == "NDC" .or. _aTotal[033] == "NDI" , "d" , IIF( _aTotal[033] == "NDP" , "n" , "f" )) ) ) (PRE) _aTotal[106] := M486XHEX(PADR( ALLTRIM( substr( SF1->F1_DOC , 4 , Len(SF1->F1_DOC) - 3 ) ) , 10 , "0" ),10) (PRE) _aTotal[107] := fGetRef(SF1->F1_DOC, SF1->F1_SERIE, SF1->F1_FORNECE, SF1->F1_LOJA, SF1->F1_ESPECIE,_aTotal[089]) (PRE) _aTotal[108] := "" (PRE) _aTotal[109] := Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") (PRE) _aTotal[110] := {"SFP",""} (PRE) _aTotal[111] := "" (PRE) _aTotal[112] := "" (PRE) _aTotal[113] := "" (PRE) _aTotal[114] := "FP_FILUSO='" + cFilAnt + "' AND FP_SERIE='" + SF1->F1_SERIE + "' AND FP_ESPECIE= " + If(_aTotal[116], "'1'",IIf(_aTotal[117] ,"'9'","'2'")) + " AND FP_NUMINI <='" + SF1->F1_DOC + "' AND FP_NUMFIM >='" + SF1->F1_DOC + "' AND FP_ATIVO ='1'" (PRE) _aTotal[115] := "SFP->FP_FILUSO=cFilAnt .AND. SFP->FP_SERIE=SF1->F1_SERIE .AND. SFP->FP_ESPECIE=" + If(_aTotal[116], "'1'",IIf(_aTotal[117] ,"'9'","'2'")) + ".AND. SFP->FP_NUMINI<=SF1->F1_DOC .AND. FP_NUMFIM >=SF1->F1_DOC .AND. SFP->FP_ATIVO = '1'","FP_ATIVO" (PREREG) FsQuery(_aTotal[101],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. (PREREG) FsQuery(_aTotal[110],1,_aTotal[114],_aTotal[115]) .And. .T. [SFP CONTROL FOMULARIOS] (PRE) _aTotal[103] := Dtos( SFP->FP_DTRESOL ) (PRE) _aTotal[103] := Left(_aTotal[103],4) + "-" + Substr(_aTotal[103],5,2)+ "-" + Right(_aTotal[103],2) (PRE) _aTotal[111] := Alltrim( SFP->FP_NUMINI ) (PRE) _aTotal[112] := Alltrim( SFP->FP_NUMFIM ) (PRE) _aTotal[113] := Alltrim( SFP->FP_CAI ) [SD1 GENERANDO_XML] (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")+SA2->A2_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",If(_aTotal[116] .OR. _aTotal[117], SA1->(MSSeek(xFilial("SA1")+SA2->A2_CLIENTE+SA2->A2_LOJCLI)),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.) [XXX CABECERA] Linha1 C 060 0 Chr(239) + Chr(187) + Chr(191) + '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' [XXX FACTURA] (PRE) IIf(AllTrim(SF1->F1_ESPECIE)=="NCC",SYA->(MsSeek(xFilial("SYA")+SA2->A2_PAIS)) , .T.) (PRE) (SE4->(MSSeek(xFilial("SE4")+SF1->F1_COND)) , .T.) (PRE) _aTotal[001] := IIF(_aTotal[116] .OR. _aTotal[117],'<fe:Invoice ','<fe:CreditNote ') (PRE) _aTotal[001] += 'xmlns:fe="http://www.dian.gov.co/contratos/facturaelectronica/v1" ' (PRE) _aTotal[001] += 'xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" ' (PRE) _aTotal[001] += 'xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" ' (PRE) _aTotal[001] += 'xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001" ' (PRE) _aTotal[001] += 'xmlns:clm66411="urn:un:unece:uncefact:codelist:specification:66411:2001" ' (PRE) _aTotal[001] += 'xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003" ' (PRE) _aTotal[001] += 'xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" ' (PRE) _aTotal[001] += 'xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" ' (PRE) _aTotal[001] += 'xmlns:sts="http://www.dian.gov.co/contratos/facturaelectronica/v1/Structures" ' (PRE) _aTotal[001] += 'xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" ' (PRE) _aTotal[001] += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' (PRE) _aTotal[001] += 'xsi:schemaLocation="http://www.dian.gov.co/contratos/facturaelectronica/v1 ../xsd/DIAN_UBL.xsd ' (PRE) _aTotal[001] += 'urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2 ../../ubl2/common/UnqualifiedDataTypeSchemaModule-2.0.xsd ' (PRE) _aTotal[001] += 'urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2 ../../ubl2/common/UBL-QualifiedDatatypes-2.0.xsd" ' (PRE) _aTotal[001] += '>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <ext:UBLExtensions>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <ext:UBLExtension>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <ext:ExtensionContent>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:DianExtensions>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:InvoiceControl>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:InvoiceAuthorization>'+ _aTotal[113] +'</sts:InvoiceAuthorization>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:AuthorizationPeriod>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:StartDate>'+ _aTotal[103] +'</cbc:StartDate>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:EndDate>'+ _aTotal[103] +'</cbc:EndDate>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:AuthorizationPeriod>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:AuthorizedInvoices>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:Prefix>'+ SF1->F1_SERIE2 +'</sts:Prefix>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:From>'+ _aTotal[111] +'</sts:From>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:To>'+ _aTotal[112] +'</sts:To>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:AuthorizedInvoices>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:InvoiceControl>' + ( chr(13)+chr(10) (PRE) _aTotal[001] += ' <sts:InvoiceSource>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IdentificationCode listAgencyID="6" listAgencyName="United Nations Economic Commission for Europe" listSchemeURI="urn:oasis:names:specification:ubl:codelist:gc:CountryIdentificationCode-2.0">CO</cbc:IdentificationCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:InvoiceSource>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:SoftwareProvider>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:ProviderID schemeAgencyID="195" schemeAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" schemeURI="http://www.unece.org/trade/untdid/d08a/tred/tred3055.htm" schemeName="NIT, RUT" schemeDataURI="www.dian.gov.co/contenidos/servicios/rut_preguntasfrecuentes.html">'+ _aTotal[098] +'</sts:ProviderID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:SoftwareID schemeAgencyID="195" schemeAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" schemeURI="http://www.unece.org/trade/untdid/d08a/tred/tred3055.htm" schemeName="Código de Activación" schemeDataURI="http://www.dian.gov.co/micrositios/fac_electronica/documentos/Guia_del_usuario_Habilitacion_Adquirente.pdf">'+_aTotal[099] +'</sts:SoftwareID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:SoftwareProvider>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <sts:SoftwareSecurityCode schemeAgencyID="195" schemeAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" schemeURI="http://www.unece.org/trade/untdid/d08a/tred/tred3055.htm" schemeName="Código de Seguridad del Software" schemeDataURI="http://www.dian.gov.co/micrositios/fac_electronica/documentos/Anexo_Tecnico_003_Mecanismos_Sistema_Tecnico_de_Control.pdf">'+ _aTotal[100] +'</sts:SoftwareSecurityCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </sts:DianExtensions>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </ext:ExtensionContent>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </ext:UBLExtension>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <ext:UBLExtension>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <ext:ExtensionContent>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </ext:ExtensionContent>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </ext:UBLExtension>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </ext:UBLExtensions>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:UBLVersionID>UBL 2.0</cbc:UBLVersionID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ProfileID>DIAN 1.0</cbc:ProfileID>' + ( chr(13)+chr(10) ) // Manual con serie //(PRE) _aTotal[001] += ' <cbc:ID>'+ SF1->F1_SERIE2 + Alltrim( Str( Val( Substr( SF1->F1_DOC , 4 , 10) ) ) ) +'</cbc:ID>' + ( chr(13)+chr(10) ) // Manual sin serie (PRE) _aTotal[001] += ' <cbc:ID>'+ Alltrim( Str( Val( Substr( SF1->F1_DOC , 4 , 10) ) ) ) +'</cbc:ID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IssueDate>'+ _aTotal[095] +'</cbc:IssueDate>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IssueTime>'+ _aTotal[096] +'</cbc:IssueTime>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Note><![CDATA['+ Alltrim(SF1->F1_MOTIVO) + ']]></cbc:Note>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:InvoiceTypeCode listAgencyID="195" listAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" listSchemeURI="http://www.dian.gov.co/contratos/facturaelectronica/v1/InvoiceType">91</cbc:InvoiceTypeCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:DocumentCurrencyCode>'+ Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) +'</cbc:DocumentCurrencyCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CustomizationID>'+ Alltrim(SF1->F1_TIPOPE) +'</cbc:CustomizationID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:DiscrepancyResponse>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ReferenceID/>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ResponseCode>' + Alltrim(SF1->F1_TIPREF) + '</cbc:ResponseCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:DiscrepancyResponse>' + ( chr(13)+chr(10) ) // BillingReference (PRE) _aTotal[001] += _aTotal[107] (PRE) _aTotal[001] := ENCODEUTF8(_aTotal[001]) (PREREG) _aTotal[001] [XXX EMISOR] (PRE) _aTotal[001] := ' <fe:AccountingSupplierParty>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:AdditionalAccountID>'+ "1" +'</cbc:AdditionalAccountID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:Party>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:PartyIdentification>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ID schemeAgencyID="195" schemeAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" schemeID="31">'+ Alltrim(SM0->M0_CGC) +'</cbc:ID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:PartyIdentification>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:PartyName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Name><![CDATA['+ _aTotal[075] +']]></cbc:Name>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:PartyName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:PhysicalLocation>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:Address>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Department><![CDATA['+ AllTrim(SM0->M0_BAIRENT) +']]></cbc:Department>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CitySubdivisionName><![CDATA['+ AllTrim(SM0->M0_CODMUN) +']]></cbc:CitySubdivisionName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CityName><![CDATA['+ Alltrim(SM0->M0_CIDENT) +']]></cbc:CityName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Line><![CDATA['+ Alltrim(SM0->M0_ENDENT) + " " + Alltrim(SM0->M0_COMPENT) +']]></cbc:Line>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IdentificationCode>'+ "CO" +'</cbc:IdentificationCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:Address>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:PhysicalLocation>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:PartyTaxScheme>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:TaxLevelCode>'+ AllTrim(SM0->M0_DSCCNA) +'</cbc:TaxLevelCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:TaxScheme/>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:PartyTaxScheme>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:PartyLegalEntity>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:RegistrationName><![CDATA['+ _aTotal[075] + ']]></cbc:RegistrationName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:PartyLegalEntity>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:Party>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:AccountingSupplierParty>' (PRE) _aTotal[001] := ENCODEUTF8(_aTotal[001]) (PREREG) _aTotal[001] [XXX RECEPTOR] (PRE) AllTrim(SF1->F1_ESPECIE) <> "NCC" (PRE) If(_aTotal[116] .OR. _aTotal[117], SA1->(MSSeek(xFilial("SA1")+SA2->A2_CLIENTE+SA2->A2_LOJCLI)) ,SA1->(MSSeek(xFilial("SA1")+SF1->F1_FORNECE+SF1->F1_LOJA))) (PRE) SYA->(MsSeek(xFilial("SYA")+SA1->A1_PAIS)) (PRE) _aTotal[001] := '<fe:AccountingCustomerParty>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:AdditionalAccountID>'+ IIF( AllTrim(SA1->A1_PESSOA) == "F" , "2" , "1" ) +'</cbc:AdditionalAccountID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:Party>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:PartyTaxScheme>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:RegistrationName><![CDATA['+ Alltrim(SA1->A1_NOME) +']]></cbc:RegistrationName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CompanyID schemeID="' + Right( Alltrim(SA1->A1_CGC), 1 ) + '" schemeName="' + AllTrim(SA1->A1_TIPDOC)+ '" schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195">'+ IIF(AllTrim(SA1->A1_TIPDOC) == "31",Left(Alltrim(SA1->A1_CGC),Len(Alltrim(SA1->A1_CGC))-1),AllTrim(SA1->A1_PFISICA))+'</cbc:CompanyID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:TaxLevelCode listName="' + Alltrim(AI0->AI0_TPREG) + '">' + AllTrim(M486RESOBL(SA1->A1_COD,SA1->A1_LOJA,"R")) + '</cbc:TaxLevelCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:RegistrationAddress>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ID>' + Alltrim(SA1->A1_COD_MUN) + '</cbc:ID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CityName><![CDATA[' + Alltrim(POSICIONE("CC2",3,xFilial("CC2") + SA1->A1_COD_MUN,"CC2_MUN")) + ']]></cbc:CityName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:PostalZone>' + Alltrim(SA1->A1_CEP) + '</cbc:PostalZone>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CountrySubentity><![CDATA[' + Alltrim(M486VALSX5('12' + SA1->A1_EST)) + ']]></cbc:CountrySubentity>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CountrySubentityCode>' + Alltrim(SA1->A1_EST) + '</cbc:CountrySubentityCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Line><![CDATA[' + Alltrim(SA1->A1_END) + ']]></cbc:Line>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IdentificationCode>'+Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCEDIAN")+'</cbc:IdentificationCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:RegistrationAddress>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:PartyTaxScheme>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:PartyIdentification>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CompanyID schemeID="' + Right( Alltrim(SA1->A1_CGC), 1 ) + '" schemeAgencyID="195" schemeAgencyName="CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)" schemeName="' + AllTrim(SA1->A1_TIPDOC)+ '">'+ IIF(AllTrim(SA1->A1_TIPDOC) == "31",Left(Alltrim(SA1->A1_CGC),Len(Alltrim(SA1->A1_CGC))-1),AllTrim(SA1->A1_PFISICA))+'</cbc:CompanyID>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:PartyIdentification>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' <cac:PartyName>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' <cbc:Name><![CDATA['+ Alltrim(SA1->A1_NOME) +']]></cbc:Name>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' </cac:PartyName>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += ' <fe:PhysicalLocation>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <fe:Address>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Department><![CDATA['+ AllTrim(SA1->A1_BAIRRO) +']]></cbc:Department>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CitySubdivisionName><![CDATA['+ AllTrim(SA1->A1_MUN) +']]></cbc:CitySubdivisionName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:CityName><![CDATA['+ Alltrim(Posicione("SX5",1,xFilial("SX5")+"12"+SA1->A1_EST,"X5_DESCRI")) +']]></cbc:CityName>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Line><![CDATA['+ AllTrim(SA1->A1_END) +']]></cbc:Line>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:AddressLine>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:IdentificationCode>'+Posicione("SYA",1,xFilial("SYA")+SA1->A1_PAIS,"YA_CCEDIAN")+'</cbc:IdentificationCode>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:Country>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:Address>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:PhysicalLocation>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:Contact>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:ElectronicMail>' + AllTrim(SA1->A1_EMAIL) + '</cbc:ElectronicMail>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Telephone>' + AllTrim(SA1->A1_TEL) + '</cbc:Telephone>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:Contact>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' <fe:PartyLegalEntity>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' <cbc:RegistrationName><![CDATA['+ Alltrim(SA1->A1_NOME) +']]></cbc:RegistrationName>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , "" , ' </fe:PartyLegalEntity>' + ( chr(13)+chr(10) ) ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , ' <fe:Person>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , ' <cbc:FirstName><![CDATA[' + Alltrim(SA1->A1_NOMEPRI) +']]></cbc:FirstName>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , ' <cbc:MiddleName><![CDATA[' + Alltrim(SA1->A1_NOMEPES) +']]></cbc:MiddleName>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , ' <cbc:FamilyName><![CDATA[' + Alltrim(SA1->A1_NOMEPAT) + ' ' + Alltrim(SA1->A1_NOMEMAT) +']]></cbc:FamilyName>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIF( AllTrim(SA1->A1_PESSOA) == "F" , ' </fe:Person>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += ' </fe:Party>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </fe:AccountingCustomerParty>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:PaymentTerms>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:Amount currencyID="' + Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) + '">' + Alltrim(Str(SF1->F1_VALBRUT,14,2)) + '</cbc:Amount>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cac:SettlementPeriod>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:StartDate>' + Transform( DtoS( Posicione("SE1",2,xFilial("SE1")+SF1->(F1_FORNECE+F1_LOJA+F1_SERIE+F1_DOC),"E1_EMISSAO") ) , "@R 9999-99-99") + '</cbc:StartDate>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' <cbc:EndDate>' + Transform( DtoS( Posicione("SE1",2,xFilial("SE1")+SF1->(F1_FORNECE+F1_LOJA+F1_SERIE+F1_DOC),"E1_VENCTO") ) , "@R 9999-99-99") + '</cbc:EndDate>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:SettlementPeriod>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += ' </cac:PaymentTerms>' + ( chr(13)+chr(10) ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cac:PaymentExchangeRate>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:SourceCurrencyCode>' + Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) + '</cbc:SourceCurrencyCode>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:SourceCurrencyBaseRate>1.00</cbc:SourceCurrencyBaseRate>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:TargetCurrencyCode>' + "COP" + '</cbc:TargetCurrencyCode>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:TargetCurrencyBaseRate>1.00</cbc:TargetCurrencyBaseRate>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:CalculationRate>' + Alltrim(Str(SF1->F1_TXMOEDA,11,2)) + '</cbc:CalculationRate>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' <cbc:Date>' + _aTotal[095] + '</cbc:Date>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] += IIf( _aTotal[109] <> "COP" , ' </cac:PaymentExchangeRate>' + ( chr(13)+chr(10) ) , "" ) (PRE) _aTotal[001] := ENCODEUTF8(_aTotal[001]) (PREREG) _aTotal[001] [XXX IMPUESTOS] (PRE) _aTotal[001] := _aTotal[097][1] (PRE) _aTotal[001] := ENCODEUTF8(_aTotal[001]) (PREREG) _aTotal[001] [XXX TOTALES] (PRE) _aTotal[001] := _aTotal[097][2] (PRE) _aTotal[001] := ENCODEUTF8(_aTotal[001]) (PREREG) _aTotal[001] [SD1 INVOICE] (PRE) DbGoTop() (PREREG) (SB1->(DbSeek(xFilial("SB1") + SD1->D1_COD)),.T.) (PREREG) (SAH->(DbSeek(xFilial("SAH") + SB1->B1_UM)),.T.) (PREREG) _aTotal[108] := fGetTaxDet(SD1->D1_DOC,SD1->D1_SERIE,SD1->D1_FORNECE,SD1->D1_LOJA,SD1->D1_TES,If(_aTotal[116] .OR. _aTotal[117], "NCC",AllTrim(SF1->F1_ESPECIE))) (PREREG) (_aTotal[001] := IIF( _aTotal[116] .OR. _aTotal[117],' <fe:InvoiceLine>' + ( chr(13)+chr(10) ),' <cac:CreditNoteLine>' + ( chr(13)+chr(10) )),.T.) (PREREG) (_aTotal[001] += ' <cbc:ID>' + Alltrim(Str(Val(SD1->D1_ITEM))) + '</cbc:ID>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += IIF(_aTotal[116] .OR. _aTotal[117],' <cbc:InvoicedQuantity unitCode="' + Alltrim(_aTotal[108][3]) + '">'+ Alltrim(Str(SD1->D1_QUANT, 14, 2)) +'</cbc:InvoicedQuantity>' + ( chr(13)+chr(10) ),' <cbc:CreditedQuantity unitCode="' + Alltrim(_aTotal[108][3]) + '">'+ Alltrim(Str(SD1->D1_QUANT)) +'</cbc:CreditedQuantity>' + ( chr(13)+chr(10) )),.T.) (PREREG) (_aTotal[001] += ' <cbc:LineExtensionAmount currencyID=' + '"' + Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) + '"' + '>' + Alltrim(Str(SD1->D1_TOTAL,14,2)) +'</cbc:LineExtensionAmount>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += _aTotal[108][1],.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' <cac:AllowanceCharge>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' <cbc:ChargeIndicator>false</cbc:ChargeIndicator>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' <cbc:AllowanceChargeReason><![CDATA[Aplicación de descuento]]></cbc:AllowanceChargeReason>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' <cbc:MultiplierFactorNumeric>' + Alltrim(Str(SD1->D1_DESC,5,2)) + '</cbc:MultiplierFactorNumeric>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' <cbc:Amount currencyID="' + Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) + '">' + Alltrim(Str(SD1->D1_VALDESC,14,2)) + '</cbc:Amount>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += IIF(SD1->D1_VALDESC > 0, ' </cac:AllowanceCharge>' + chr(13)+chr(10), ""),.T.) (PREREG) (_aTotal[001] += _aTotal[108][2],.T.) (PREREG) (_aTotal[001] += IIF(_aTotal[116] .OR. _aTotal[117] ,' <fe:Item>', ' <cac:Item>') + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' <cbc:Description><![CDATA[' + Alltrim(SB1->B1_DESC) +']]></cbc:Description>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' <cbc:PackSizeNumeric>'+ IIf(!Empty(SB1->B1_CONV),Alltrim(STR(SB1->B1_CONV)),"1") +'</cbc:PackSizeNumeric>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' <cac:SellersItemIdentification>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' <cbc:ID>' + Alltrim(SD1->D1_COD) + '</cbc:ID>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' </cac:SellersItemIdentification>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += IIF( _aTotal[116] .OR. _aTotal[117],' </fe:Item>', ' </cac:Item>') + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += IIF( _aTotal[116] .OR. _aTotal[117],' <fe:Price>',' <cac:Price>') + ( chr(13)+chr(10) ),.T.) (PREREG) _aTotal[090] := Alltrim(IIf(AllTrim(SF1->F1_ESPECIE)=="NCC" .And. AllTrim(SA1->A1_EST) == "EX" .And. SF1->F1_MOEDA<>1,Str(Round(xMoeda(SD1->D1_VUNIT,SF1->F1_MOEDA,1,,MsDecimais(1)+1,SF1->F1_TXMOEDA),MsDecimais(1)),14,2),Str(SD1->D1_VUNIT,14,2))) (PREREG) (_aTotal[001] += ' <cbc:PriceAmount currencyID=' + '"' + Alltrim( Posicione("CTO",1,xFilial("CTO")+Strzero(SF1->F1_MOEDA,2),"CTO_MOESAT") ) + '"' + '>' + _aTotal[090] +'</cbc:PriceAmount>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += ' <cbc:BaseQuantity unitCode="' + Alltrim(_aTotal[108][3]) + '">' + Alltrim(Str(SD1->D1_QUANT)) + '</cbc:BaseQuantity>' + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += IIF(_aTotal[116] .OR. _aTotal[117],' </fe:Price>', ' </cac:Price>') + ( chr(13)+chr(10) ),.T.) (PREREG) (_aTotal[001] += IIF( _aTotal[116] .OR. _aTotal[117],' </fe:InvoiceLine>' ,' </cac:CreditNoteLine>') ,.T.) (PREREG) ENCODEUTF8(_aTotal[001]) [XXX INVOICE_FIN] (POS) FsQuery(_aTotal[101],2) [XXX FACTURA] (PRE) _aTotal[094] := &("Lower('face') + '_' + Lower(_aTotal[105]) + Lower(_aTotal[104]) + Lower(_aTotal[106]) + '.xml'") (ARQ) _aTotal[094] FACTURA C 019 0 ENCODEUTF8( IIF( _aTotal[116] .OR. _aTotal[117], '</fe:Invoice>','</fe:CreditNote>')) |