Skip to main content

ARInvoice

Struct ARInvoice 

Source
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: String

Unique invoice number.

§company_code: String

Company code.

§customer_id: String

Customer ID.

§customer_name: String

Customer name.

§invoice_date: NaiveDate

Invoice date.

§posting_date: NaiveDate

Posting date.

§due_date: NaiveDate

Due date.

§baseline_date: NaiveDate

Baseline date for payment terms.

§invoice_type: ARInvoiceType

Invoice type.

§status: SubledgerDocumentStatus

Invoice status.

§lines: Vec<ARInvoiceLine>

Invoice lines.

§net_amount: CurrencyAmount

Net amount (before tax).

§tax_amount: CurrencyAmount

Tax amount.

§gross_amount: CurrencyAmount

Gross amount (after tax).

§amount_paid: Decimal

Amount paid.

§amount_remaining: Decimal

Amount remaining.

§payment_terms: PaymentTerms

Payment terms.

§tax_details: Vec<TaxInfo>

Tax details.

§gl_reference: Option<GLReference>

GL reference.

§clearing_info: Vec<ClearingInfo>

Clearing information.

§dunning_info: DunningInfo

Dunning 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

Source

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.

Source

pub fn add_line(&mut self, line: ARInvoiceLine)

Adds an invoice line.

Source

pub fn recalculate_totals(&mut self)

Recalculates totals from lines.

Source

pub fn apply_payment(&mut self, amount: Decimal, clearing: ClearingInfo)

Applies a payment to the invoice.

Source

pub fn is_overdue(&self, as_of_date: NaiveDate) -> bool

Checks if invoice is overdue.

Source

pub fn days_overdue(&self, as_of_date: NaiveDate) -> i64

Calculates days overdue.

Source

pub fn available_discount(&self, payment_date: NaiveDate) -> Decimal

Gets discount amount if paid by discount date.

Source

pub fn set_gl_reference(&mut self, reference: GLReference)

Sets the GL reference.

Source

pub fn add_reference(&mut self, reference: ARDocumentReference)

Adds a reference document.

Source

pub fn reverse(&mut self, reversal_date: NaiveDate, reason: String)

Reverses the invoice.

Trait Implementations§

Source§

impl Clone for ARInvoice

Source§

fn clone(&self) -> ARInvoice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ARInvoice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ARInvoice

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ARInvoice

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,