pub struct Delivery {Show 28 fields
pub header: DocumentHeader,
pub delivery_type: DeliveryType,
pub delivery_status: DeliveryStatus,
pub items: Vec<DeliveryItem>,
pub total_quantity: Decimal,
pub total_weight: Decimal,
pub total_volume: Decimal,
pub customer_id: String,
pub ship_to: Option<String>,
pub sales_order_id: Option<String>,
pub shipping_point: String,
pub route: Option<String>,
pub carrier: Option<String>,
pub shipping_condition: Option<String>,
pub incoterms: Option<String>,
pub planned_gi_date: NaiveDate,
pub actual_gi_date: Option<NaiveDate>,
pub delivery_date: Option<NaiveDate>,
pub pod_date: Option<NaiveDate>,
pub pod_signed_by: Option<String>,
pub bill_of_lading: Option<String>,
pub tracking_number: Option<String>,
pub number_of_packages: u32,
pub is_goods_issued: bool,
pub is_complete: bool,
pub is_cancelled: bool,
pub cancellation_doc: Option<String>,
pub total_cogs: Decimal,
}Expand description
Delivery document.
Fields§
§header: DocumentHeaderDocument header
delivery_type: DeliveryTypeDelivery type
delivery_status: DeliveryStatusDelivery status
items: Vec<DeliveryItem>Line items
total_quantity: DecimalTotal quantity
total_weight: DecimalTotal weight (kg)
total_volume: DecimalTotal volume (m³)
customer_id: StringCustomer ID
ship_to: Option<String>Ship-to party (if different)
sales_order_id: Option<String>Reference sales order (primary)
shipping_point: StringShipping point
route: Option<String>Route
carrier: Option<String>Carrier/forwarder
shipping_condition: Option<String>Shipping condition
incoterms: Option<String>Incoterms
planned_gi_date: NaiveDatePlanned goods issue date
actual_gi_date: Option<NaiveDate>Actual goods issue date
delivery_date: Option<NaiveDate>Delivery date
pod_date: Option<NaiveDate>Proof of delivery
pod_signed_by: Option<String>POD signed by
bill_of_lading: Option<String>Bill of lading
tracking_number: Option<String>Tracking number
number_of_packages: u32Number of packages
is_goods_issued: boolIs goods issued?
is_complete: boolIs delivery complete?
is_cancelled: boolIs this delivery cancelled/reversed?
cancellation_doc: Option<String>Cancellation document reference
total_cogs: DecimalTotal COGS (for GL posting)
Implementations§
Source§impl Delivery
impl Delivery
Sourcepub fn new(
delivery_id: impl Into<String>,
company_code: impl Into<String>,
customer_id: impl Into<String>,
shipping_point: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
document_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn new( delivery_id: impl Into<String>, company_code: impl Into<String>, customer_id: impl Into<String>, shipping_point: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create a new delivery.
Sourcepub fn from_sales_order(
delivery_id: impl Into<String>,
company_code: impl Into<String>,
sales_order_id: impl Into<String>,
customer_id: impl Into<String>,
shipping_point: impl Into<String>,
fiscal_year: u16,
fiscal_period: u8,
document_date: NaiveDate,
created_by: impl Into<String>,
) -> Self
pub fn from_sales_order( delivery_id: impl Into<String>, company_code: impl Into<String>, sales_order_id: impl Into<String>, customer_id: impl Into<String>, shipping_point: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self
Create from sales order reference.
Sourcepub fn with_delivery_type(self, delivery_type: DeliveryType) -> Self
pub fn with_delivery_type(self, delivery_type: DeliveryType) -> Self
Set delivery type.
Sourcepub fn with_ship_to(self, ship_to: impl Into<String>) -> Self
pub fn with_ship_to(self, ship_to: impl Into<String>) -> Self
Set ship-to party.
Sourcepub fn with_carrier(self, carrier: impl Into<String>) -> Self
pub fn with_carrier(self, carrier: impl Into<String>) -> Self
Set carrier.
Sourcepub fn with_route(self, route: impl Into<String>) -> Self
pub fn with_route(self, route: impl Into<String>) -> Self
Set route.
Sourcepub fn with_planned_gi_date(self, date: NaiveDate) -> Self
pub fn with_planned_gi_date(self, date: NaiveDate) -> Self
Set planned GI date.
Sourcepub fn add_item(&mut self, item: DeliveryItem)
pub fn add_item(&mut self, item: DeliveryItem)
Add a line item.
Sourcepub fn recalculate_totals(&mut self)
pub fn recalculate_totals(&mut self)
Recalculate totals.
Sourcepub fn release_for_picking(&mut self, user: impl Into<String>)
pub fn release_for_picking(&mut self, user: impl Into<String>)
Release for picking.
Sourcepub fn start_picking(&mut self)
pub fn start_picking(&mut self)
Start picking.
Sourcepub fn confirm_pick(&mut self)
pub fn confirm_pick(&mut self)
Confirm pick complete.
Sourcepub fn confirm_pack(&mut self, num_packages: u32)
pub fn confirm_pack(&mut self, num_packages: u32)
Confirm packing.
Sourcepub fn post_goods_issue(&mut self, user: impl Into<String>, gi_date: NaiveDate)
pub fn post_goods_issue(&mut self, user: impl Into<String>, gi_date: NaiveDate)
Post goods issue.
Sourcepub fn confirm_delivery(&mut self, delivery_date: NaiveDate)
pub fn confirm_delivery(&mut self, delivery_date: NaiveDate)
Confirm delivery.
Sourcepub fn record_pod(&mut self, pod_date: NaiveDate, signed_by: impl Into<String>)
pub fn record_pod(&mut self, pod_date: NaiveDate, signed_by: impl Into<String>)
Record proof of delivery.
Sourcepub fn cancel(&mut self, user: impl Into<String>, reason: impl Into<String>)
pub fn cancel(&mut self, user: impl Into<String>, reason: impl Into<String>)
Cancel the delivery.
Sourcepub fn generate_gl_entries(&self) -> Vec<(String, Decimal, Decimal)>
pub fn generate_gl_entries(&self) -> Vec<(String, Decimal, Decimal)>
Generate GL entries for goods issue. DR COGS (or expense), CR Inventory
Sourcepub fn total_value(&self) -> Decimal
pub fn total_value(&self) -> Decimal
Get total value (sales value).
Sourcepub fn is_fully_picked(&self) -> bool
pub fn is_fully_picked(&self) -> bool
Check if all items are picked.
Sourcepub fn is_fully_issued(&self) -> bool
pub fn is_fully_issued(&self) -> bool
Check if all items are issued.