pub struct Invoice {Show 38 fields
pub profile: Profile,
pub specification_id: Option<String>,
pub kind: DocumentKind,
pub number: String,
pub currency: String,
pub issue_date: Option<Date>,
pub type_code: Option<Code>,
pub tax_currency: Option<Code>,
pub due_date: Option<Date>,
pub tax_point_date: Option<Date>,
pub tax_point_code: Option<Code>,
pub business_process: Option<String>,
pub buyer_reference: Option<DocumentReference>,
pub project: Option<DocumentReference>,
pub contract: Option<DocumentReference>,
pub purchase_order: Option<DocumentReference>,
pub sales_order: Option<DocumentReference>,
pub receiving_advice: Option<DocumentReference>,
pub despatch: Option<DocumentReference>,
pub tender: Option<DocumentReference>,
pub invoiced_object: Option<Identifier>,
pub buyer_accounting: Option<String>,
pub payment_terms: Option<String>,
pub notes: Vec<InvoiceNote>,
pub preceding: Vec<PrecedingInvoice>,
pub seller: Party,
pub buyer: Party,
pub payee: Option<Payee>,
pub tax_representative: Option<TaxRepresentative>,
pub delivery: Option<Delivery>,
pub period: Option<Period>,
pub payment: Option<PaymentInstructions>,
pub document_allowances: Vec<AllowanceCharge>,
pub document_charges: Vec<AllowanceCharge>,
pub tax_breakdown: Vec<TaxBreakdown>,
pub totals: Option<DocumentTotals>,
pub supporting_documents: Vec<SupportingDocument>,
pub lines: Vec<Line>,
}Expand description
Semantic invoice. Fields are pub on 2.x so embedders can Invoice::blank
then set terms. Do not match on the struct layout — #[non_exhaustive] would
be a 3.0 break. A proved document is crate::Validated.
Fields§
§profile: Profile§specification_id: Option<String>BT-24 specification identifier.
kind: DocumentKindSyntax root analogue. Not derived from BT-3.
number: StringBT-1 invoice number.
currency: StringBT-5 invoice currency.
issue_date: Option<Date>BT-2 issue date.
type_code: Option<Code>BT-3 invoice type code.
tax_currency: Option<Code>BT-6 VAT accounting currency.
due_date: Option<Date>BT-9 payment due date.
tax_point_date: Option<Date>BT-7 / BT-8. BR-CO-03 when both the date and the code rules apply.
tax_point_code: Option<Code>BT-8 VAT point date code.
business_process: Option<String>BT-23 business process type.
buyer_reference: Option<DocumentReference>BT-10 buyer reference. Do not overload with BT-13.
project: Option<DocumentReference>BT-11 project reference.
contract: Option<DocumentReference>BT-12 contract reference.
purchase_order: Option<DocumentReference>BT-13 purchase order reference (Peppol R003 with BT-10).
sales_order: Option<DocumentReference>BT-14 sales order reference.
receiving_advice: Option<DocumentReference>BT-15 receiving advice reference.
despatch: Option<DocumentReference>BT-16 despatch advice reference.
tender: Option<DocumentReference>BT-17 tender or lot reference.
invoiced_object: Option<Identifier>BT-18 invoiced object identifier (not a BG-24 supporting document).
buyer_accounting: Option<String>BT-19 buyer accounting reference.
payment_terms: Option<String>BT-20 payment terms.
notes: Vec<InvoiceNote>BG-1 notes (BT-21/22).
preceding: Vec<PrecedingInvoice>BG-3 preceding invoice reference.
seller: PartyBG-4 seller.
buyer: PartyBG-7 buyer.
payee: Option<Payee>BG-10 payee.
tax_representative: Option<TaxRepresentative>BG-11 seller tax representative.
delivery: Option<Delivery>BG-13 delivery.
period: Option<Period>BG-14 invoicing period.
payment: Option<PaymentInstructions>BG-16 payment instructions.
document_allowances: Vec<AllowanceCharge>BG-20 document level allowances.
document_charges: Vec<AllowanceCharge>BG-21 document level charges.
tax_breakdown: Vec<TaxBreakdown>BG-23 VAT/GST/SST breakdown.
totals: Option<DocumentTotals>BG-22 document totals.
supporting_documents: Vec<SupportingDocument>BG-24 additional supporting documents.
lines: Vec<Line>BG-25 invoice lines.
Implementations§
Source§impl Invoice
impl Invoice
pub fn blank( profile: Profile, number: impl Into<String>, currency: impl Into<String>, seller: Party, buyer: Party, ) -> Self
Sourcepub fn payable(&self) -> Option<Amount>
pub fn payable(&self) -> Option<Amount>
BT-115 from DocumentTotals. Absent BG-22 or absent PayableAmount is not 0.00 (BR-15).
Sourcepub fn tax_total(&self) -> Option<Amount>
pub fn tax_total(&self) -> Option<Amount>
BT-110 from DocumentTotals. Absent totals is not 0.00.
Sourcepub fn stamp_profile(&mut self, profile: Profile)
pub fn stamp_profile(&mut self, profile: Profile)
BT-24 and BT-23 come from the proved profile, not leftover fields on Invoice.
EN 16931 has no required ProfileID: BT-23 is left as-is (the UBL writer omits it).
pub fn line_net_sum(&self) -> Option<Amount>
Sourcepub fn to_credit_note(
&self,
new_number: impl Into<String>,
new_issue_date: Date,
) -> Self
pub fn to_credit_note( &self, new_number: impl Into<String>, new_issue_date: Date, ) -> Self
Credit note: new number/date, BG-3 to the original, amounts not negated.