pub struct CustomerInvoiceItem {
pub base: DocumentLineItem,
pub sales_order_id: Option<String>,
pub so_item: Option<u16>,
pub delivery_id: Option<String>,
pub delivery_item: Option<u16>,
pub revenue_account: Option<String>,
pub cogs_account: Option<String>,
pub cogs_amount: Decimal,
pub discount_amount: Decimal,
pub is_service: bool,
pub returns_reference: Option<String>,
}Expand description
Customer Invoice line item.
Fields§
§base: DocumentLineItemBase line item fields
sales_order_id: Option<String>Reference sales order number
so_item: Option<u16>Reference SO item
delivery_id: Option<String>Reference delivery number
delivery_item: Option<u16>Reference delivery item
revenue_account: Option<String>Revenue account (override from material)
cogs_account: Option<String>COGS account (for statistical tracking)
cogs_amount: DecimalCOGS amount (for margin calculation)
discount_amount: DecimalDiscount amount
is_service: boolIs this a service item?
returns_reference: Option<String>Returns reference (if credit memo for returns)
Implementations§
Source§impl CustomerInvoiceItem
impl CustomerInvoiceItem
Sourcepub fn new(
line_number: u16,
description: impl Into<String>,
quantity: Decimal,
unit_price: Decimal,
) -> Self
pub fn new( line_number: u16, description: impl Into<String>, quantity: Decimal, unit_price: Decimal, ) -> Self
Create a new customer invoice item.
Sourcepub fn from_delivery(
line_number: u16,
description: impl Into<String>,
quantity: Decimal,
unit_price: Decimal,
delivery_id: impl Into<String>,
delivery_item: u16,
) -> Self
pub fn from_delivery( line_number: u16, description: impl Into<String>, quantity: Decimal, unit_price: Decimal, delivery_id: impl Into<String>, delivery_item: u16, ) -> Self
Create from delivery reference.
Sourcepub fn with_material(self, material_id: impl Into<String>) -> Self
pub fn with_material(self, material_id: impl Into<String>) -> Self
Set material.
Sourcepub fn with_sales_order(self, so_id: impl Into<String>, so_item: u16) -> Self
pub fn with_sales_order(self, so_id: impl Into<String>, so_item: u16) -> Self
Set sales order reference.
Sourcepub fn with_revenue_account(self, account: impl Into<String>) -> Self
pub fn with_revenue_account(self, account: impl Into<String>) -> Self
Set revenue account.
Sourcepub fn as_service(self) -> Self
pub fn as_service(self) -> Self
Set as service item.
Sourcepub fn with_discount(self, discount: Decimal) -> Self
pub fn with_discount(self, discount: Decimal) -> Self
Set discount.
Sourcepub fn gross_margin(&self) -> Decimal
pub fn gross_margin(&self) -> Decimal
Calculate gross margin.
Trait Implementations§
Source§impl Clone for CustomerInvoiceItem
impl Clone for CustomerInvoiceItem
Source§fn clone(&self) -> CustomerInvoiceItem
fn clone(&self) -> CustomerInvoiceItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CustomerInvoiceItem
impl Debug for CustomerInvoiceItem
Source§impl<'de> Deserialize<'de> for CustomerInvoiceItem
impl<'de> Deserialize<'de> for CustomerInvoiceItem
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CustomerInvoiceItem
impl RefUnwindSafe for CustomerInvoiceItem
impl Send for CustomerInvoiceItem
impl Sync for CustomerInvoiceItem
impl Unpin for CustomerInvoiceItem
impl UnwindSafe for CustomerInvoiceItem
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
Mutably borrows from an owned value. Read more