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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ARInvoice
impl<'de> Deserialize<'de> for ARInvoice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ARInvoice
impl RefUnwindSafe for ARInvoice
impl Send for ARInvoice
impl Sync for ARInvoice
impl Unpin for ARInvoice
impl UnsafeUnpin for ARInvoice
impl UnwindSafe for ARInvoice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.