pub struct ARInvoice {Show 31 fields
pub invoice_number: String,
pub company_code: String,
pub customer_id: String,
pub customer_name: String,
pub invoice_date: NaiveDate,
pub posting_date: NaiveDate,
pub due_date: NaiveDate,
pub baseline_date: NaiveDate,
pub invoice_type: ARInvoiceType,
pub status: SubledgerDocumentStatus,
pub lines: Vec<ARInvoiceLine>,
pub net_amount: CurrencyAmount,
pub tax_amount: CurrencyAmount,
pub gross_amount: CurrencyAmount,
pub amount_paid: Decimal,
pub amount_remaining: Decimal,
pub payment_terms: PaymentTerms,
pub tax_details: Vec<TaxInfo>,
pub gl_reference: Option<GLReference>,
pub clearing_info: Vec<ClearingInfo>,
pub dunning_info: DunningInfo,
pub reference_documents: Vec<ARDocumentReference>,
pub cost_center: Option<String>,
pub profit_center: Option<String>,
pub sales_org: Option<String>,
pub distribution_channel: Option<String>,
pub division: Option<String>,
pub created_at: DateTime<Utc>,
pub created_by: Option<String>,
pub modified_at: Option<DateTime<Utc>>,
pub notes: Option<String>,
}Expand description
AR Invoice (customer invoice).
Fields§
§invoice_number: StringUnique invoice number.
company_code: StringCompany code.
customer_id: StringCustomer ID.
customer_name: StringCustomer name.
invoice_date: NaiveDateInvoice date.
posting_date: NaiveDatePosting date.
due_date: NaiveDateDue date.
baseline_date: NaiveDateBaseline date for payment terms.
invoice_type: ARInvoiceTypeInvoice type.
status: SubledgerDocumentStatusInvoice status.
lines: Vec<ARInvoiceLine>Invoice lines.
net_amount: CurrencyAmountNet amount (before tax).
tax_amount: CurrencyAmountTax amount.
gross_amount: CurrencyAmountGross amount (after tax).
amount_paid: DecimalAmount paid.
amount_remaining: DecimalAmount remaining.
payment_terms: PaymentTermsPayment terms.
tax_details: Vec<TaxInfo>Tax details.
gl_reference: Option<GLReference>GL reference.
clearing_info: Vec<ClearingInfo>Clearing information.
dunning_info: DunningInfoDunning information.
reference_documents: Vec<ARDocumentReference>Reference documents (sales order, delivery).
cost_center: Option<String>Cost center.
profit_center: Option<String>Profit center.
sales_org: Option<String>Sales organization.
distribution_channel: Option<String>Distribution channel.
division: Option<String>Division.
created_at: DateTime<Utc>Created timestamp.
created_by: Option<String>Created by user.
modified_at: Option<DateTime<Utc>>Last modified timestamp.
notes: Option<String>Notes.
Implementations§
Source§impl ARInvoice
impl ARInvoice
Sourcepub fn new(
invoice_number: String,
company_code: String,
customer_id: String,
customer_name: String,
invoice_date: NaiveDate,
payment_terms: PaymentTerms,
currency: String,
) -> Self
pub fn new( invoice_number: String, company_code: String, customer_id: String, customer_name: String, invoice_date: NaiveDate, payment_terms: PaymentTerms, currency: String, ) -> Self
Creates a new AR invoice.
Sourcepub fn add_line(&mut self, line: ARInvoiceLine)
pub fn add_line(&mut self, line: ARInvoiceLine)
Adds an invoice line.
Sourcepub fn recalculate_totals(&mut self)
pub fn recalculate_totals(&mut self)
Recalculates totals from lines.
Sourcepub fn apply_payment(&mut self, amount: Decimal, clearing: ClearingInfo)
pub fn apply_payment(&mut self, amount: Decimal, clearing: ClearingInfo)
Applies a payment to the invoice.
Sourcepub fn is_overdue(&self, as_of_date: NaiveDate) -> bool
pub fn is_overdue(&self, as_of_date: NaiveDate) -> bool
Checks if invoice is overdue.
Sourcepub fn days_overdue(&self, as_of_date: NaiveDate) -> i64
pub fn days_overdue(&self, as_of_date: NaiveDate) -> i64
Calculates days overdue.
Sourcepub fn available_discount(&self, payment_date: NaiveDate) -> Decimal
pub fn available_discount(&self, payment_date: NaiveDate) -> Decimal
Gets discount amount if paid by discount date.
Sourcepub fn set_gl_reference(&mut self, reference: GLReference)
pub fn set_gl_reference(&mut self, reference: GLReference)
Sets the GL reference.
Sourcepub fn add_reference(&mut self, reference: ARDocumentReference)
pub fn add_reference(&mut self, reference: ARDocumentReference)
Adds a reference document.