Skip to main content

SalesOrder

Struct SalesOrder 

Source
pub struct SalesOrder {
Show 28 fields pub header: DocumentHeader, pub so_type: SalesOrderType, pub customer_id: String, pub sold_to: Option<String>, pub ship_to: Option<String>, pub bill_to: Option<String>, pub payer: Option<String>, pub sales_org: String, pub distribution_channel: String, pub division: String, pub sales_office: Option<String>, pub sales_group: Option<String>, pub items: Vec<SalesOrderItem>, pub total_net_amount: Decimal, pub total_tax_amount: Decimal, pub total_gross_amount: Decimal, pub payment_terms: String, pub incoterms: Option<String>, pub shipping_condition: Option<String>, pub requested_delivery_date: Option<NaiveDate>, pub customer_po_number: Option<String>, pub is_complete: bool, pub credit_status: CreditStatus, pub credit_block_reason: Option<String>, pub is_delivery_released: bool, pub is_billing_released: bool, pub quote_id: Option<String>, pub contract_id: Option<String>,
}
Expand description

Sales Order document.

Fields§

§header: DocumentHeader

Document header

§so_type: SalesOrderType

SO type

§customer_id: String

Customer ID

§sold_to: Option<String>

Sold-to party (if different from customer)

§ship_to: Option<String>

Ship-to party

§bill_to: Option<String>

Bill-to party

§payer: Option<String>

Payer

§sales_org: String

Sales organization

§distribution_channel: String

Distribution channel

§division: String

Division

§sales_office: Option<String>

Sales office

§sales_group: Option<String>

Sales group

§items: Vec<SalesOrderItem>

Line items

§total_net_amount: Decimal

Total net amount

§total_tax_amount: Decimal

Total tax amount

§total_gross_amount: Decimal

Total gross amount

§payment_terms: String

Payment terms

§incoterms: Option<String>

Incoterms

§shipping_condition: Option<String>

Shipping condition

§requested_delivery_date: Option<NaiveDate>

Requested delivery date

§customer_po_number: Option<String>

Customer PO number

§is_complete: bool

Is this order complete?

§credit_status: CreditStatus

Credit status

§credit_block_reason: Option<String>

Credit block reason

§is_delivery_released: bool

Is order released for delivery?

§is_billing_released: bool

Is order released for billing?

§quote_id: Option<String>

Related quote (if from quote)

§contract_id: Option<String>

Contract reference

Implementations§

Source§

impl SalesOrder

Source

pub fn new( so_id: impl Into<String>, company_code: impl Into<String>, customer_id: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self

Create a new sales order.

Source

pub fn with_so_type(self, so_type: SalesOrderType) -> Self

Set SO type.

Source

pub fn with_sales_org( self, sales_org: impl Into<String>, dist_channel: impl Into<String>, division: impl Into<String>, ) -> Self

Set sales organization.

Source

pub fn with_partners( self, sold_to: impl Into<String>, ship_to: impl Into<String>, bill_to: impl Into<String>, ) -> Self

Set partner functions.

Source

pub fn with_customer_po(self, po_number: impl Into<String>) -> Self

Set customer PO.

Source

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

Set requested delivery date.

Source

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

Add a line item.

Source

pub fn recalculate_totals(&mut self)

Recalculate totals.

Source

pub fn check_credit(&mut self, passed: bool, block_reason: Option<String>)

Perform credit check.

Source

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

Release credit block.

Source

pub fn release_for_delivery(&mut self)

Release for delivery.

Source

pub fn release_for_billing(&mut self)

Release for billing.

Source

pub fn check_complete(&mut self)

Check if order is complete.

Source

pub fn open_delivery_value(&self) -> Decimal

Get total open delivery value.

Source

pub fn open_billing_value(&self) -> Decimal

Get total open billing value.

Trait Implementations§

Source§

impl Clone for SalesOrder

Source§

fn clone(&self) -> SalesOrder

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 SalesOrder

Source§

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

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

impl<'de> Deserialize<'de> for SalesOrder

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 SalesOrder

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>,