[XXX INICIALIZACION] (PRE) SD2->(DbSetOrder(1)) (PRE) SB1->(DbSetOrder(1)) (PRE) SYA->(DbSetOrder(1)) (PRE) SAH->(DbSetOrder(1)) (PRE) _aTotal[002] := chr(13) + chr(10) (PRE) _aTotal[003] := "99999999999999.99" (PRE) _aTotal[004] := {"SD2",""} (PRE) _aTotal[005] := IIf(Alltrim(SF2->F2_ESPECIE)=="NF","factura","notaDebito") (PRE) _aTotal[006] := Alltrim(SF2->F2_SERIE) + Alltrim(SF2->F2_DOC) + Alltrim(SF2->F2_ESPECIE) (PRE) _aTotal[007] := SuperGetMV("MV_CFDIAMB",.F.,"2") (PRE) _aTotal[008] := M485TotEnc(1, SF2->F2_SERIE, SF2->F2_CLIENTE, SF2->F2_LOJA, SF2->F2_DOC, SF2->F2_ESPECIE, _aTotal[007],SF2->F2_SERIE2) (PRE) _aTotal[009] := TamSX3("F2_DOC")[1] (PRE) _aTotal[010] := "" (PRE) _aTotal[011] := SUBSTR(DTOS(SF2->F2_EMISSAO),0,4) + "-" + SUBSTR(DTOS(SF2->F2_EMISSAO),5,2) + "-" + SUBSTR(DTOS(SF2->F2_EMISSAO),7,2) + "T" + SF2->F2_HORA+"Z" (PRE) _aTotal[012] := "" (PRE) _aTotal[013] := alltrim(SA1->A1_EST) == "EX" (PRE) _aTotal[014] := alltrim(fGetSX5("XQ" + STR(SF2->F2_MOEDA,2))) (PRE) _aTotal[015] := "" (PRE) _aTotal[016] := "" (PRE) _aTotal[017] := IIf(Alltrim(SF2->F2_ESPECIE)=="NF",IIf(Substr(SF2->F2_SERIE2,1,1)=="F","01","03"),"08") (PRE) _aTotal[018] := M485TPPAG(xFilial("SE4"), SF2->F2_COND) (PRE) _aTotal[019] := M485CUOTA(SF2->F2_FILIAL,SF2->F2_CLIENTE,SF2->F2_LOJA,SF2->F2_SERIE,SF2->F2_DOC,SF2->F2_ESPECIE,SF2->F2_HORA,_aTotal[008][7]) (PRE) _aTotal[020] := Alltrim(SuperGetMV("MV_TKN_EMP",.F.,"")) (PREREG) FsQuery(_aTotal[004],1,"D2_DOC='" + SF2->F2_DOC + "' AND D2_SERIE='" + SF2->F2_SERIE + "' AND D2_CLIENTE='" + SF2->F2_CLIENTE + "' AND D2_LOJA='" + SF2->F2_LOJA + "'","SD2->D2_DOC=SF2->F2_DOC .AND. SD2->D2_SERIE=SF2->F2_SERIE .AND. SD2->D2_CLIENTE=SF2->F2_CLIENTE .AND. SD2->D2_LOJA=SF2->F2_LOJA","D2_ITEM") .And. .T. [XXX ENCABEZADO] (PRE) SA1->(MSSeek(xFilial("SA1") + SF2->F2_CLIENTE + SF2->F2_LOJA)) (PRE) SYA->(MsSeek(xFilial("SYA") + SA1->A1_PAIS)) (PREREG) (_aTotal[001] := '<?xml version="1.0" encoding="iso-8859-1"?>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '<DTE version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DTE_v1.0.xsd">' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '<Documento ID="'+ ALLTRIM(SF2->F2_SERIE2) + ALLTRIM(SF2->F2_DOC) +'">' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '<Encabezado>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <IdDoc>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Ambiente>' + _aTotal[007] + '</Ambiente>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <TipoEmision>' + IIf(Alltrim(SF2->F2_ESPECIE)=="NF",SF2->F2_TIPONF,"NORMAL") + '</TipoEmision>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <ContenidoTC></ContenidoTC>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Tipo>' + _aTotal[017] + '</Tipo>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Serie>' + Alltrim(SF2->F2_SERIE2) + '</Serie>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Numero>' + ALLTRIM(substr(SF2->F2_DOC,(_aTotal[009]-7),8)) + '</Numero>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Estado>ORIGINAL</Estado>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NumeroInterno>' + Alltrim(SF2->F2_DOC) + '</NumeroInterno>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <FechaEmis>' + _aTotal[011] + '</FechaEmis>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += IIf(Len(_aTotal[008])>= 6 .And. _aTotal[008][6],' <FormaPago>' + Alltrim(_aTotal[020]) + '</FormaPago>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += IIf(SF2->(ColumnPos("F2_MODCONS")) > 0 .And. _aTotal[008][6],' <MedioPago>' + Alltrim(SF2->F2_MODCONS) + '</MedioPago>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += IIF(Alltrim(SF2->F2_ESPECIE)=="NF" .And. Substr(SF2->F2_SERIE2,1,1)=="F",' <CondPago>' + IIf(_aTotal[018] == "1","Contado","Credito") + '</CondPago>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += ' </IdDoc>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Emisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <TipoContribuyente></TipoContribuyente>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <RegimenContable></RegimenContable>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <IDEmisor>' + Alltrim(SM0->M0_CGC) + '</IDEmisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NmbEmisor>' + Alltrim(SM0->M0_NOME) + '</NmbEmisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NombreEmisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <PrimerNombre>' + Alltrim(SM0->M0_NOMECOM) + '</PrimerNombre>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </NombreEmisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <FechaInicioActividades>2016-01-01</FechaInicioActividades>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <DomFiscal>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Calle>' + Alltrim(SM0->M0_ENDENT) + " " + Alltrim(SM0->M0_COMPENT) + '</Calle>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Departamento>' + Alltrim(SM0->M0_CIDENT) + '</Departamento>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Distrito>' + Alltrim(SM0->M0_CIDENT) + '</Distrito>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Ciudad>' + Alltrim(SM0->M0_CIDENT) + '</Ciudad>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Municipio>' + Alltrim(SM0->M0_CIDENT) + '</Municipio>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Pais>PE</Pais>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <CodigoPostal>' + ALLTRIM(SM0->M0_CEPENT) + '</CodigoPostal>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <GLN>' + Alltrim(SM0->M0_DSCCNA)+ '</GLN>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </DomFiscal>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <LugarExped>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Calle>' + Alltrim(SM0->M0_ENDENT) + " " + Alltrim(SM0->M0_COMPENT) + '</Calle>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </LugarExped>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </Emisor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Receptor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <DocRecep>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <TipoDocRecep>' + Alltrim(SA1->A1_TIPDOC) + '</TipoDocRecep>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NroDocRecep>' + IIF(Alltrim(SA1->A1_TIPDOC) $ "06",ALLTRIM(SA1->A1_CGC),IIF(_aTotal[013],"-",ALLTRIM(SA1->A1_PFISICA))) + '</NroDocRecep>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </DocRecep>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NmbRecep>' + Alltrim(SA1->A1_NOME) + '</NmbRecep>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += IIF(!Empty(SA1->A1_EMAIL),' <Contacto>' + ALLTRIM(SA1->A1_EMAIL) + '</Contacto>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += ' <DomFiscalRcp>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Calle>'+ Alltrim(SA1->A1_END) +'</Calle>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Departamento>'+ fGetSX5("12"+SA1->A1_EST) + '</Departamento>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Distrito>' + alltrim(SA1->A1_BAIRRO) + '</Distrito>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Ciudad>' + alltrim(SA1->A1_BAIRRO) + '</Ciudad>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Municipio>' + alltrim(SA1->A1_MUN) + '</Municipio>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Pais>' + Alltrim(Posicione("SYA",1,xFilial("SYA") + SA1->A1_PAIS,"SYA->YA_CODERP")) + '</Pais>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <CodigoPostal>' + Alltrim(SA1->A1_CEP) + '</CodigoPostal>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <GLN>' + Alltrim(SA1->A1_GLN) + '</GLN>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </DomFiscalRcp>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </Receptor>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Transporte>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <MedioTransporte>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <MetodoTransp>MetodoTransp</MetodoTransp>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </MedioTransporte>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </Transporte>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Totales>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Moneda>' + _aTotal[014] + '</Moneda>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <SubTotal>' + Alltrim(TRANSFORM(_aTotal[008][2], _aTotal[003])) + '</SubTotal>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += IIF(SF2->F2_DESCONT > 0,' <MntDcto>' + Alltrim(TRANSFORM(SF2->F2_DESCONT, _aTotal[003])) + '</MntDcto>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += IIf(Len(_aTotal[008])>= 6 .And. _aTotal[008][6] .And. _aTotal[018] == "2",' <MntRet>' + Alltrim(TRANSFORM(SF2->F2_VALBRUT-_aTotal[008][7],_aTotal[003])) + '</MntRet>' + _aTotal[002],""),.T.) (PREREG) (_aTotal[001] += ' <VlrPagar>' + Alltrim(TRANSFORM( IIF(!_aTotal[008][3],SF2->F2_VALBRUT,0), _aTotal[003])) + '</VlrPagar>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <VlrPalabras>' + IIF(!_aTotal[008][3],EXTENSO(SF2->F2_VALBRUT,.f.,SF2->F2_MOEDA), fCero2Txt(SF2->F2_MOEDA))+ '</VlrPalabras>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <MontoPropina>0.00</MontoPropina>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += _aTotal[008][4],.T.) (PREREG) (_aTotal[001] += ' </Totales>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += _aTotal[008][5],.T.) (PREREG) (_aTotal[001] += '</Encabezado>' + _aTotal[002],.T.) [SD2 INVOICE] (PRE) DbGoTop() (PREREG) (SB1->(DbSeek(xFilial("SB1") + SD2->D2_COD)),.T.) (PREREG) (SAH->(DbSeek(xFilial("SAH") + SB1->B1_UM)),.T.) (PREREG) _aTotal[010] := M485DETIMP(SD2->D2_SERIE,SD2->D2_CLIENTE,SD2->D2_LOJA,SD2->D2_DOC,SD2->D2_ITEM,SF2->F2_ESPECIE,SD2->D2_COD, 1) (PREREG) _aTotal[016] := Posicione("SAH",1,xFilial("SAH")+ SB1->B1_UM,"AH_COD_CO") (PREREG) (_aTotal[001] += '<Detalle>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NroLinDet>' + Alltrim(SD2->D2_ITEM) + '</NroLinDet>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <CdgItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <TpoCodigo>' + Alltrim(SB1->B1_PRODSAT) + '</TpoCodigo>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <VlrCodigo>' + Alltrim(SB1->B1_COD) + '</VlrCodigo>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' </CdgItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <IndExe>1</IndExe>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <DscLang>ES</DscLang>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <DscItem>' + Alltrim(SB1->B1_DESC) + '</DscItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <QtyItem>' + Alltrim(TRANSFORM(SD2->D2_QUANT,_aTotal[003])) + '</QtyItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <UnmdItem>' + _aTotal[016] + '</UnmdItem>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <PrcBrutoItem>' + Alltrim(TRANSFORM(IIF(!_aTotal[010][7],_aTotal[010][1],0),_aTotal[003])) + '</PrcBrutoItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <PrcNetoItem>' + Alltrim(TRANSFORM(_aTotal[010][2],_aTotal[003])) + '</PrcNetoItem>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <DescuentoMonto>' + Alltrim(TRANSFORM(SD2->D2_DESCON,_aTotal[003])) + '</DescuentoMonto>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += _aTotal[010][3],.T.) (PREREG) (_aTotal[001] += _aTotal[010][5],.T.) (PREREG) (_aTotal[001] += ' <MontoBrutoItem>' + ALLTRIM(TRANSFORM(_aTotal[010][1] ,_aTotal[003])) +'</MontoBrutoItem>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <MontoNetoItem>' + ALLTRIM(TRANSFORM(_aTotal[010][1] ,_aTotal[003])) +'</MontoNetoItem>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <MontoTotalItem>' + ALLTRIM(TRANSFORM(_aTotal[010][4] ,_aTotal[003])) +'</MontoTotalItem>'+ _aTotal[002],.T.) (PREREG) (_aTotal[001] += _aTotal[010][6],.T.) (PREREG) (_aTotal[001] += '</Detalle>' + _aTotal[002],.T.) [XXX INVOICE_FIN] (PREREG) (_aTotal[001] := IIF(Alltrim(SF2->F2_ESPECIE)=="NF" .And. Substr(SF2->F2_SERIE2,1,1)=="F" .And. _aTotal[018] == "2",_aTotal[019][1],""),.T.) (PREREG) _aTotal[015] += IIF(Alltrim(SF2->F2_ESPECIE)=="NF","",M485GETREF(SF2->F2_NFREF,SF2->F2_SERREF,SF2->F2_CLIENTE,SF2->F2_LOJA,SF2->F2_ESPECIE,.F.,SF2->F2_MOTIVO,SF2->F2_TIPREF)) (PREREG) (_aTotal[001] += _aTotal[015],.T.) (PREREG) (_aTotal[001] += '<CAE>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <Tipo>String</Tipo>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NumeroInicial>' + Alltrim(SF2->F2_DOC) + '</NumeroInicial>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NumeroFinal>' + Alltrim(SF2->F2_DOC) + '</NumeroFinal>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <NroResolucion>' + Alltrim(SF2->F2_DOC) + '</NroResolucion>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += ' <FechaResolucion>' + Substr(_aTotal[011],1,10) + '</FechaResolucion>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '</CAE>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '<TimeStamp>' + _aTotal[011] + '</TimeStamp>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '</Documento>' + _aTotal[002],.T.) (PREREG) (_aTotal[001] += '</DTE>',.T.) (PREREG) ENCODEUTF8(_aTotal[001]) (POS) FsQuery(_aTotal[004],2) [XXX FACTURA] (PRE) _aTotal[094] := _aTotal[006] + ".XML" (ARQ) _aTotal[094] |