pub struct VendorInvoice {Show 27 fields
pub header: DocumentHeader,
pub invoice_type: VendorInvoiceType,
pub vendor_id: String,
pub vendor_invoice_number: String,
pub invoice_date: NaiveDate,
pub items: Vec<VendorInvoiceItem>,
pub net_amount: Decimal,
pub tax_amount: Decimal,
pub gross_amount: Decimal,
pub withholding_tax_amount: Decimal,
pub payable_amount: Decimal,
pub payment_terms: String,
pub due_date: NaiveDate,
pub discount_due_date: Option<NaiveDate>,
pub cash_discount_percent: Decimal,
pub cash_discount_amount: Decimal,
pub verification_status: InvoiceVerificationStatus,
pub payment_block: bool,
pub payment_block_reason: Option<String>,
pub purchase_order_id: Option<String>,
pub goods_receipt_id: Option<String>,
pub is_paid: bool,
pub amount_paid: Decimal,
pub balance: Decimal,
pub payment_references: Vec<String>,
pub baseline_date: NaiveDate,
pub vendor_name: Option<String>,
}Expand description
Vendor Invoice document.
Fields§
§header: DocumentHeaderDocument header
invoice_type: VendorInvoiceTypeInvoice type
vendor_id: StringVendor ID
vendor_invoice_number: StringVendor invoice number (external reference)
invoice_date: NaiveDateInvoice date from vendor
items: Vec<VendorInvoiceItem>Line items
net_amount: DecimalNet amount
tax_amount: DecimalTax amount
gross_amount: DecimalGross amount
withholding_tax_amount: DecimalWithholding tax amount
payable_amount: DecimalAmount to pay (gross - withholding)
payment_terms: StringPayment terms
due_date: NaiveDateDue date for payment
discount_due_date: Option<NaiveDate>Discount due date (for early payment)
cash_discount_percent: DecimalCash discount percentage
cash_discount_amount: DecimalCash discount amount
verification_status: InvoiceVerificationStatusVerification status
payment_block: boolIs blocked for payment?
payment_block_reason: Option<String>Payment block reason
purchase_order_id: Option<String>Reference PO (primary)
goods_receipt_id: Option<String>Reference GR (primary)
is_paid: boolIs this invoice paid?
amount_paid: DecimalAmount paid
balance: DecimalRemaining balance
payment_references: Vec<String>Payment document references
baseline_date: NaiveDateBaseline date for payment
vendor_name: Option<String>Vendor display name (denormalized, DS-011)
Implementations§
Source§impl VendorInvoice
impl VendorInvoice
Sourcepub fn new(
invoice_id: impl Into<String>,
company_code: impl Into<String>,
vendor_id: impl Into<String>,
vendor_invoice_number: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
invoice_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new( invoice_id: impl Into<String>, company_code: impl Into<String>, vendor_id: impl Into<String>, vendor_invoice_number: impl Into<String>, fiscal_year: u16, fiscal_period: u8, invoice_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new vendor invoice.
Sourcepub fn from_po_gr(
invoice_id: impl Into<String>,
company_code: impl Into<String>,
vendor_id: impl Into<String>,
vendor_invoice_number: impl Into<String>,
po_id: impl Into<String>,
gr_id: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
invoice_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn from_po_gr( invoice_id: impl Into<String>, company_code: impl Into<String>, vendor_id: impl Into<String>, vendor_invoice_number: impl Into<String>, po_id: impl Into<String>, gr_id: impl Into<String>, fiscal_year: u16, fiscal_period: u8, invoice_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create invoice referencing PO and GR.
Sourcepub fn with_invoice_type(self, invoice_type: VendorInvoiceType) -> Self
pub fn with_invoice_type(self, invoice_type: VendorInvoiceType) -> Self
Set invoice type.
Sourcepub fn with_payment_terms(self, terms: impl Into<String>, due_days: i64) -> Self
pub fn with_payment_terms(self, terms: impl Into<String>, due_days: i64) -> Self
Set payment terms.
Sourcepub fn with_cash_discount(self, percent: Decimal, discount_days: i64) -> Self
pub fn with_cash_discount(self, percent: Decimal, discount_days: i64) -> Self
Set cash discount.
Sourcepub fn block_payment(&mut self, reason: impl Into<String>)
pub fn block_payment(&mut self, reason: impl Into<String>)
Block payment.
Sourcepub fn unblock_payment(&mut self)
pub fn unblock_payment(&mut self)
Unblock payment.
Sourcepub fn add_item(&mut self, item: VendorInvoiceItem)
pub fn add_item(&mut self, item: VendorInvoiceItem)
Add a line item.
Sourcepub fn recalculate_totals(&mut self)
pub fn recalculate_totals(&mut self)
Recalculate totals.
Sourcepub fn record_payment(
&mut self,
amount: Decimal,
payment_doc_id: impl Into<String>,
)
pub fn record_payment( &mut self, amount: Decimal, payment_doc_id: impl Into<String>, )
Record payment.
Sourcepub fn discount_available(&self, as_of_date: NaiveDate) -> bool
pub fn discount_available(&self, as_of_date: NaiveDate) -> bool
Check if discount is still available.
Sourcepub fn discounted_amount(&self, as_of_date: NaiveDate) -> Decimal
pub fn discounted_amount(&self, as_of_date: NaiveDate) -> Decimal
Get amount with discount.
Trait Implementations§
Source§impl Clone for VendorInvoice
impl Clone for VendorInvoice
Source§fn clone(&self) -> VendorInvoice
fn clone(&self) -> VendorInvoice
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VendorInvoice
impl Debug for VendorInvoice
Source§impl<'de> Deserialize<'de> for VendorInvoice
impl<'de> Deserialize<'de> for VendorInvoice
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 VendorInvoice
impl RefUnwindSafe for VendorInvoice
impl Send for VendorInvoice
impl Sync for VendorInvoice
impl Unpin for VendorInvoice
impl UnsafeUnpin for VendorInvoice
impl UnwindSafe for VendorInvoice
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.