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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Delivery
impl<'de> Deserialize<'de> for Delivery
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 Delivery
impl RefUnwindSafe for Delivery
impl Send for Delivery
impl Sync for Delivery
impl Unpin for Delivery
impl UnsafeUnpin for Delivery
impl UnwindSafe for Delivery
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.