Skip to main content

Delivery

Struct Delivery 

Source
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: DocumentHeader

Document header

§delivery_type: DeliveryType

Delivery type

§delivery_status: DeliveryStatus

Delivery status

§items: Vec<DeliveryItem>

Line items

§total_quantity: Decimal

Total quantity

§total_weight: Decimal

Total weight (kg)

§total_volume: Decimal

Total volume (m³)

§customer_id: String

Customer ID

§ship_to: Option<String>

Ship-to party (if different)

§sales_order_id: Option<String>

Reference sales order (primary)

§shipping_point: String

Shipping point

§route: Option<String>

Route

§carrier: Option<String>

Carrier/forwarder

§shipping_condition: Option<String>

Shipping condition

§incoterms: Option<String>

Incoterms

§planned_gi_date: NaiveDate

Planned 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: u32

Number of packages

§is_goods_issued: bool

Is goods issued?

§is_complete: bool

Is delivery complete?

§is_cancelled: bool

Is this delivery cancelled/reversed?

§cancellation_doc: Option<String>

Cancellation document reference

§total_cogs: Decimal

Total COGS (for GL posting)

Implementations§

Source§

impl Delivery

Source

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.

Source

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.

Source

pub fn with_delivery_type(self, delivery_type: DeliveryType) -> Self

Set delivery type.

Source

pub fn with_ship_to(self, ship_to: impl Into<String>) -> Self

Set ship-to party.

Source

pub fn with_carrier(self, carrier: impl Into<String>) -> Self

Set carrier.

Source

pub fn with_route(self, route: impl Into<String>) -> Self

Set route.

Source

pub fn with_planned_gi_date(self, date: NaiveDate) -> Self

Set planned GI date.

Source

pub fn add_item(&mut self, item: DeliveryItem)

Add a line item.

Source

pub fn recalculate_totals(&mut self)

Recalculate totals.

Source

pub fn release_for_picking(&mut self, user: impl Into<String>)

Release for picking.

Source

pub fn start_picking(&mut self)

Start picking.

Source

pub fn confirm_pick(&mut self)

Confirm pick complete.

Source

pub fn confirm_pack(&mut self, num_packages: u32)

Confirm packing.

Source

pub fn post_goods_issue(&mut self, user: impl Into<String>, gi_date: NaiveDate)

Post goods issue.

Source

pub fn confirm_delivery(&mut self, delivery_date: NaiveDate)

Confirm delivery.

Source

pub fn record_pod(&mut self, pod_date: NaiveDate, signed_by: impl Into<String>)

Record proof of delivery.

Source

pub fn cancel(&mut self, user: impl Into<String>, reason: impl Into<String>)

Cancel the delivery.

Source

pub fn generate_gl_entries(&self) -> Vec<(String, Decimal, Decimal)>

Generate GL entries for goods issue. DR COGS (or expense), CR Inventory

Source

pub fn total_value(&self) -> Decimal

Get total value (sales value).

Source

pub fn is_fully_picked(&self) -> bool

Check if all items are picked.

Source

pub fn is_fully_issued(&self) -> bool

Check if all items are issued.

Trait Implementations§

Source§

impl Clone for Delivery

Source§

fn clone(&self) -> Delivery

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Delivery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Delivery

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Delivery

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,