pub struct VendorInvoice {Show 26 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,
}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
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more