LandrixSoftware / XRechnung-for-Delphi

XRechnung Implementation for Delphi
GNU General Public License v3.0
17 stars 6 forks source link

LinePeriod per TradelineItem #21

Open landrix opened 1 month ago

landrix commented 1 month ago

Hi Sven,

arbeite mich gerade in Deine XRechnungs-Files ein. Für mich und wohl viele, die mit zeitlich begrenzten Leistungen in den Rechnungszeilen arbeiten ist folgende Ergänzung nützlich:

im intf.Invoice in die TInvoiceLine zwei Parameter einfügen, z.B. so

TInvoiceLine = class(TObject) public ID : String; //Positionsnummer ... AllowanceCharges : TInvoiceAllowanceCharges;

LinePeriodStartDate : TDate; //Leistungszeitraum Beginn LinePeriodEndDate : TDate; //Leistungszeitraum Ende

SubInvoiceLines : TInvoiceLines; public constructor Create; destructor Destroy; override; end;

Dazu im intf.XRechnung_2_3 im SaveDocumentUBL / InternalAddInvoiceLine

class procedure TXRechnungInvoiceAdapter230.SaveDocumentUBL(_Invoi ce: TInvoice; _Xml: IXMLDocument); var ... procedure InternalAddInvoiceLine(_Invoiceline : TInvoiceLine; _Node : IXMLNode); var subinvoiceline : TInvoiceLine; allowanceCharge : TInvoiceAllowanceCharge; begin _Node.AddChild('cbc:ID').Text := _Invoiceline.ID; ... with _Node.AddChild('cbc:LineExtensionAmount') do begin Attributes['currencyID'] := _Invoice.TaxCurrencyCode; Text := TXRechnungHelper.AmountToStr(_Invoiceline.LineAmou nt); end;

////////////////// Einfügung if (_Invoiceline.LinePeriodStartDate > 100) and (_Invoiceline.LinePeriodEndDate > 100) then with _Node.AddChild('cac:InvoicePeriod') do begin AddChild('cbc:StartDate').Text := TXRechnungHelper.DateToStrUBLFormat(_Invoiceline.L inePeriodStartDate); AddChild('cbc:EndDate').Text := TXRechnungHelper.DateToStrUBLFormat(_Invoiceline.L inePeriodEndDate); end; ////////////////// Einfügung Ende

// // // 916 // for allowanceCharge in _Invoiceline.AllowanceCharges do ...

Und im SaveDocumentUNCEFACT/ InternalAddInvoiceLine class procedure TXRechnungInvoiceAdapter230.SaveDocumentUNCEFACT( _Invoice: TInvoice; _Xml: IXMLDocument); var xRoot : IXMLNode; allowanceCharge : TInvoiceAllowanceCharge; taxSubtotal : TInvoiceTaxAmount; i : Integer; precedingInvoiceReference : TInvoicePrecedingInvoiceReference;

procedure InternalAddInvoiceLine(_Invoiceline : TInvoiceLine; _Node : IXMLNode); var allowanceCharge : TInvoiceAllowanceCharge; begin

... with _Node.AddChild('ram:SpecifiedLineTradeSettlement') do begin with AddChild('ram:ApplicableTradeTax') do begin AddChild('ram:TypeCode').Text := 'VAT'; AddChild('ram:CategoryCode').Text := TXRechnungHelper.InvoiceDutyTaxFeeCategoryCodeToSt r(_Invoiceline.TaxCategory); AddChild('ram:RateApplicablePercent').Text := TXRechnungHelper.PercentageToStr(_Invoiceline.TaxP ercent); end;

////////////////// Einfügung if (_Invoiceline.LinePeriodStartDate > 100) and (_Invoiceline.LinePeriodEndDate > 100) then with AddChild('ram:BillingSpecifiedPeriod') do begin with AddChild('ram:StartDateTime').AddChild('udtateTi meString') do begin Attributes['format'] := '102'; Text := TXRechnungHelper.DateToStrUNCEFACTFormat(_Invoicel ine.LinePeriodStartDate); end; with AddChild('ram:EndDateTime').AddChild('udtateTime String') do begin Attributes['format'] := '102'; Text := TXRechnungHelper.DateToStrUNCEFACTFormat(_Invoicel ine.LinePeriodEndDate); end; end; ////////////////// Einfügung Ende

for allowanceCharge in _Invoiceline.AllowanceCharges do ...

einfügen

Im intf.XRechnung_3_0 das gleiche.