pub struct APInvoice {Show 31 fields
pub invoice_number: String,
pub vendor_invoice_number: String,
pub company_code: String,
pub vendor_id: String,
pub vendor_name: String,
pub invoice_date: NaiveDate,
pub posting_date: NaiveDate,
pub document_date: NaiveDate,
pub due_date: NaiveDate,
pub baseline_date: NaiveDate,
pub invoice_type: APInvoiceType,
pub status: SubledgerDocumentStatus,
pub lines: Vec<APInvoiceLine>,
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 match_status: MatchStatus,
pub reference_po: Option<String>,
pub reference_gr: Option<String>,
pub payment_block: Option<PaymentBlockReason>,
pub withholding_tax: Option<WithholdingTax>,
pub created_at: DateTime<Utc>,
pub created_by: Option<String>,
pub modified_at: Option<DateTime<Utc>>,
pub notes: Option<String>,
}Expand description
AP Invoice (vendor invoice).
Fields§
§invoice_number: StringUnique invoice number (internal).
vendor_invoice_number: StringVendor’s invoice number.
company_code: StringCompany code.
vendor_id: StringVendor ID.
vendor_name: StringVendor name.
invoice_date: NaiveDateInvoice date (vendor’s date).
posting_date: NaiveDatePosting date.
document_date: NaiveDateDocument date (receipt date).
due_date: NaiveDateDue date.
baseline_date: NaiveDateBaseline date for payment terms.
invoice_type: APInvoiceTypeInvoice type.
status: SubledgerDocumentStatusInvoice status.
lines: Vec<APInvoiceLine>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.
match_status: MatchStatusThree-way match status.
reference_po: Option<String>Reference purchase order.
reference_gr: Option<String>Reference goods receipt.
payment_block: Option<PaymentBlockReason>Payment block reason.
withholding_tax: Option<WithholdingTax>Withholding tax applicable.
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 APInvoice
impl APInvoice
Sourcepub fn new(
invoice_number: String,
vendor_invoice_number: String,
company_code: String,
vendor_id: String,
vendor_name: String,
invoice_date: NaiveDate,
payment_terms: PaymentTerms,
currency: String,
) -> Self
pub fn new( invoice_number: String, vendor_invoice_number: String, company_code: String, vendor_id: String, vendor_name: String, invoice_date: NaiveDate, payment_terms: PaymentTerms, currency: String, ) -> Self
Creates a new AP invoice.
Sourcepub fn add_line(&mut self, line: APInvoiceLine)
pub fn add_line(&mut self, line: APInvoiceLine)
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 with_po_reference(self, po_number: String) -> Self
pub fn with_po_reference(self, po_number: String) -> Self
Sets purchase order reference.
Sourcepub fn with_gr_reference(self, gr_number: String) -> Self
pub fn with_gr_reference(self, gr_number: String) -> Self
Sets goods receipt reference.
Sourcepub fn block_payment(&mut self, reason: PaymentBlockReason)
pub fn block_payment(&mut self, reason: PaymentBlockReason)
Sets payment block.
Sourcepub fn unblock_payment(&mut self)
pub fn unblock_payment(&mut self)
Removes payment block.
Sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Checks if payment is blocked.
Sourcepub fn set_match_status(&mut self, status: MatchStatus)
pub fn set_match_status(&mut self, status: MatchStatus)
Sets three-way match status.
Sourcepub fn is_payable(&self) -> bool
pub fn is_payable(&self) -> bool
Checks if ready for payment.
Sourcepub fn with_withholding_tax(self, wht: WithholdingTax) -> Self
pub fn with_withholding_tax(self, wht: WithholdingTax) -> Self
Sets withholding tax.
Sourcepub fn net_payable(&self) -> Decimal
pub fn net_payable(&self) -> Decimal
Gets net payable amount (after withholding).