Skip to main content

PurchaseOrder

Struct PurchaseOrder 

Source
pub struct PurchaseOrder {
Show 18 fields pub header: DocumentHeader, pub po_type: PurchaseOrderType, pub vendor_id: String, pub purchasing_org: String, pub purchasing_group: String, pub payment_terms: String, pub incoterms: Option<String>, pub incoterms_location: Option<String>, pub items: Vec<PurchaseOrderItem>, pub total_net_amount: Decimal, pub total_tax_amount: Decimal, pub total_gross_amount: Decimal, pub is_complete: bool, pub is_closed: bool, pub requisition_id: Option<String>, pub contract_id: Option<String>, pub release_status: Option<String>, pub output_complete: bool,
}
Expand description

Purchase Order document.

Fields§

§header: DocumentHeader

Document header

§po_type: PurchaseOrderType

PO type

§vendor_id: String

Vendor ID

§purchasing_org: String

Purchasing organization

§purchasing_group: String

Purchasing group

§payment_terms: String

Payment terms

§incoterms: Option<String>

Incoterms

§incoterms_location: Option<String>

Incoterms location

§items: Vec<PurchaseOrderItem>

Line items

§total_net_amount: Decimal

Total net amount

§total_tax_amount: Decimal

Total tax amount

§total_gross_amount: Decimal

Total gross amount

§is_complete: bool

Is this PO completely delivered?

§is_closed: bool

Is this PO closed?

§requisition_id: Option<String>

Related purchase requisition

§contract_id: Option<String>

Contract reference

§release_status: Option<String>

Release status (for framework orders)

§output_complete: bool

Output control - PO printed/sent

Implementations§

Source§

impl PurchaseOrder

Source

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

Create a new purchase order.

Source

pub fn with_po_type(self, po_type: PurchaseOrderType) -> Self

Set PO type.

Source

pub fn with_purchasing_org(self, org: impl Into<String>) -> Self

Set purchasing organization.

Source

pub fn with_purchasing_group(self, group: impl Into<String>) -> Self

Set purchasing group.

Source

pub fn with_payment_terms(self, terms: impl Into<String>) -> Self

Set payment terms.

Source

pub fn with_incoterms( self, incoterms: impl Into<String>, location: impl Into<String>, ) -> Self

Set incoterms.

Source

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

Add a line item.

Source

pub fn recalculate_totals(&mut self)

Recalculate totals from items.

Source

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

Release the PO for processing.

Source

pub fn check_complete(&mut self)

Check if all items are fully received.

Source

pub fn open_gr_amount(&self) -> Decimal

Get total open amount for goods receipt.

Source

pub fn open_iv_amount(&self) -> Decimal

Get total open amount for invoice.

Source

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

Close the PO.

Trait Implementations§

Source§

impl Clone for PurchaseOrder

Source§

fn clone(&self) -> PurchaseOrder

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 PurchaseOrder

Source§

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

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

impl<'de> Deserialize<'de> for PurchaseOrder

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 PurchaseOrder

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