![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
|||
|
|||
|
Como verás lo he simplificado al máximo. y escribo el xml casi de forma literal
Código:
/// Tipo TFacturae
type
TFacturae = class
private
fFileHeader: TFileHeader;
fParties: TParties;
fInvoices: TInvoices;
// fExtensions: TExtensions;
public
constructor Create;
///
function ToXml: IXMLDOMElement;
///
property FileHeader: TFileHeader read fFileHeader write fFileHeader;
property Parties: TParties read fParties write fParties;
property Invoices: TInvoices read fInvoices write fInvoices;
// property fExtensions: TExtensions read fExtensions write fExtensions;
end;
{ TFacturae }
XMLNode_eFact_32_Facturae = 'fe:Facturae';
XMLNode_eFact_32_FileHeader = 'FileHeader';
XMLNode_eFact_32_SchemaVersion = 'SchemaVersion';
XMLNode_eFact_32_Modality = 'Modality';
XMLNode_eFact_32_InvoiceIssuerType = 'InvoiceIssuerType';
constructor TFacturae.Create;
begin
fFileHeader := TFileHeader.Create;
fParties := TParties.Create;
fInvoices := TInvoices.Create;
end;
function TFacturae.ToXml: IXMLDOMElement;
var
XMLDoc: IXMLDOMDocument;
XMLElement: IXMLDOMElement;
begin
XMLDoc := CoFreeThreadedDOMDocument30.Create;
try
XMLElement := XMLDoc.createElement( XMLNode_eFact_32_Facturae );
if XMLElement <> nil then
begin
XMLElement.AppendChild(Self.fFileHeader.ToXml);
XMLElement.AppendChild(Self.fParties.ToXml);
XMLElement.AppendChild(Self.fInvoices.ToXml);
end;
result := XMLElement;
finally
end;
end;
type
TFileHeader = class
private
fSchemaVersion: string; // (E)
fModality: string; // (E)
fInvoiceIssuerType: string; // (E)
// fThirdParty: TThirdParty;
fBatch: TBatch;
// fFactoringAssignmentData: TFactoringAssignmentData;
public
constructor Create;
function ToXml: IXMLDOMNode;
property SchemaVersion: string read fSchemaVersion write fSchemaVersion;
property Modality: string read fModality write fModality;
property InvoiceIssuerType: string read fInvoiceIssuerType write fInvoiceIssuerType;
property Batch: TBatch read fBatch write fBatch;
end;
{ FFileHeaderType }
C_SchemaVersion_3_2 = '3.2';
C_Modality_Individual = 'I';
C_PersonTypeCode_Fisica = 'F';
C_PersonTypeCode_Juridica = 'J';
C_ResidenceTypeCodeType_R = 'R'; /// - Residente en España
C_ResidenceTypeCodeType_U = 'U'; /// - Residente en la UE
C_InvoiceIssuerType_Emisor = 'EM';
constructor TFileHeader.Create;
begin
fSchemaVersion := C_SchemaVersion_3_2_1;
fModality := C_Modality_Individual;
fInvoiceIssuerType := C_InvoiceIssuerType_Emisor;
fBatch := TBatch.Create;
end;
function TFileHeader.ToXml: IXMLDOMNode;
var
XMLElement: IXMLDOMElement;
begin
XMLElement := NewElementNode( nil, XMLNode_eFact_32_FileHeader );
if XMLElement <> nil then
begin
XMLElement.appendChild(NewTextNode(XMLElement, XMLNode_eFact_32_SchemaVersion, Self.fSchemaVersion, 0));
XMLElement.appendChild(NewTextNode(XMLElement, XMLNode_eFact_32_Modality, Self.fModality, 0));
XMLElement.appendChild(NewTextNode(XMLElement, XMLNode_eFact_32_InvoiceIssuerType, Self.fInvoiceIssuerType, 0));
XMLElement.appendChild(Self.fBatch.ToXml);
end;
result := XMLElement;
end;
...
|
|
#2
|
|||
|
|||
|
Perdón pero he andado liado y no he podido responder antes... Pues es un gran trabajo, interesante la aproximación que has hecho al problema y la manera que has encontrado de resolverlo.. Me lo miraré más a fondo a ver si consigo rehacer mi código también . una lástima que el binding no consiga hacerlo directamente
¡Muchísimas gracias! |
|
#3
|
||||
|
||||
|
__________________
Al hacer una consulta SQL, haz que los demás te entiendan y disfruten de ella, será tú reflejo de tú saber. |
|
#4
|
|||
|
|||
|
¡Muchas gracias, olbeup! ¡Muy amable! Gran aporte este post que has puesto.. Una pregunta, si me permites, tu no trabajas a partir de la interface del Data Binding, no? ¿ Son todo IXMLNode's, que vas colocando según correspndo no?
|
|
#5
|
||||
|
||||
|
Cita:
Un saludo.
__________________
Al hacer una consulta SQL, haz que los demás te entiendan y disfruten de ella, será tú reflejo de tú saber. |
|
#6
|
|||
|
|||
|
Cita:
Esta es mi primera (bueno segunda) vez , no se si lo hago correctamente, en cualquier caso gracias. Veo que has implementado codigo para la facturae, podrias pasarme algun ejemplo o las clases, muchas gracias . |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Mexico - Como crear sellos en FACTURA ELECTRONICA.. | pcicom | API de Windows | 12 | 10-11-2012 18:46:55 |
| Factura Electrónica | aig | Varios | 13 | 10-12-2010 17:12:44 |
| factura electronica | spia | Varios | 2 | 22-02-2009 21:30:06 |
| Factura electronica AUNA | Aprendiz | Varios | 5 | 01-09-2005 10:44:15 |
| programa para validar formato de archivo de texto | n3mohack | Varios | 4 | 21-04-2005 00:27:00 |
|