FOR EACH RowNode OF gMiCFDI.Comprobante.Conceptos ON Concepto // where RowNode:Importe.Value < "0"
Info(RowNode:Cantidad, RowNode:ValorUnitario)
gstUnConcepto.sClaveProdServ = RowNode:ClaveProdServ
gstUnConcepto.cyValorUnitario = RowNode:ValorUnitario
gstUnConcepto.nCantidad = RowNode:Cantidad
Add(garrConcepto,gstUnConcepto)
END
/////////////////////////**************************
LeeXML ROUTINE
DATA
rtn:filtro cstring(256)
rtn:numeroCfdi SHORT
rtn:respuesta SHORT
rtn:nombreArchivo cstring(256)
rtn:bandera BYTE
rtn:UUID cstring(32)
rtn:FechaTimbrado cstring(32)
CODE
if RIGHT(LOC:NombreDirectorio, 1) <> '\' then
rtn:filtro = LOC:NombreDirectorio & '\*.xml'
else
rtn:filtro = LOC:NombreDirectorio & '*.xml'
end
MESSAGE(rtn:filtro)
DIRECTORY(QArchivos,rtn:filtro,ff_:NORMAL)
rtn:numeroCfdi = RECORDS(QArchivos)
LOOP i# = rtn:numeroCfdi TO 1 BY -1
GET(QArchivos,i#)
MESSAGE(QArchivos:name)
if RIGHT(LOC:NombreDirectorio, 1) <> '\' then
rtn:nombreArchivo = LOC:NombreDirectorio & '\' & QArchivos:name
else
rtn:nombreArchivo = LOC:NombreDirectorio & QArchivos:name
end
!!!!!!!!!!!!!!!!!!!!!!!!!!*****!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
LOC:UUID = ''
rtn:respuesta = XML:LoadFromFile(rtn:nombreArchivo)
Xml:GotoTop() ! Sets the pointer to ('tfd:TimbreFiscalDigital','UUID')
If NOT Xml:FindNextNode('tfd:TimbreFiscalDigital','UUID')
IF NOT XML:ReadCurrentData(LOC:UUID)
rtn:bandera = true
END
End
if rtn:bandera = true
clear(cfdi:record)
cfdi:UUID = LOC:UUID
if access:cfdi.fetch(cfdi:PKUUID) = Level:Benign
MESSAGE('El CFDI ya está grabado')
else
clear(cfdi:record)
cfdi:UUID = LOC:UUID
Xml:GotoTop() ! Sets the pointer to ('tfd:TimbreFiscalDigital','FechaTimbrado')
If NOT Xml:FindNextNode('tfd:TimbreFiscalDigital','FechaTimbrado')
IF NOT XML:ReadCurrentData(cfdi:FechaTimbrado)
!!MESSAGE('Fecha de Timbrado es: ' & LOC:FechaTimbrado)
END
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Comprobante','Fecha')
XML:ReadCurrentData(cfdi:Fecha)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Comprobante','Serie')
XML:ReadCurrentData(cfdi:Serie)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Comprobante','Folio')
XML:ReadCurrentData(cfdi:Folio)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Comprobante','SubTotal')
XML:ReadCurrentData(cfdi:Subtotal)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Comprobante','Total')
XML:ReadCurrentData(cfdi:Total)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Emisor','Rfc')
XML:ReadCurrentData(cfdi:EmisorRFC)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Emisor','Nombre')
XML:ReadCurrentData(cfdi:EmisorNombre)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Receptor','Rfc')
XML:ReadCurrentData(cfdi:ReceptorRFC)
End
Xml:GotoTop()
If NOT Xml:FindNextNode('cfdi:Receptor','Nombre')
XML:ReadCurrentData(cfdi:ReceptorNombre)
End
access:cfdi.insert()
!!! Ahora leo los conceptos
free(QConceptos)
Xml:GotoTop()
If NOT xml:FindNextNode('cfdi:Conceptos','cfdi:Concepto')
XML:AutoRootSet()
rtn:respuesta = Xml:loadQueue(QConceptos,False, False)
LOOP Q# = 1 TO RECORDS(QConceptos) BY 1;GET(QConceptos,Q#)
clear(cfde)
cfde:ClaveProdServ = QCo:ClaveProdServ
cfde:ClaveUnidad = QCo:ClaveUnidad
cfde:NoIdentificacion = QCo:NoIdentificacion
cfde:Cantidad = QCo:Cantidad
cfde:Unidad = QCo:Unidad
cfde:Descripcion = QCo:Descripcion
cfde:ValorUnitario = QCo:ValorUnitario
cfde:Importe = QCo:Importe
cfde:Descuento = QCo:Descuento
cfde:UUID = cfdi:UUID
cfde:IdCfde = s_dameIdentificador()
access:cfde.insert()
END
end !!! if NOT xml:FindNextNode('cfdi:Conceptos','cfdi:Concepto')
end ! else
end !if rtn:bandera = true
!!*************************************************************************
XML:Free()
DELETE(QArchivos) !Get rid of all other entries
END !!!! LOOP i# = rtn:numeroCfdi TO 1 BY -1
EXIT
No hay comentarios.:
Publicar un comentario