Skip to main content

GoodsReceipt

Struct GoodsReceipt 

Source
pub struct GoodsReceipt {
Show 15 fields pub header: DocumentHeader, pub gr_type: GoodsReceiptType, pub items: Vec<GoodsReceiptItem>, pub total_quantity: Decimal, pub total_value: Decimal, pub purchase_order_id: Option<String>, pub vendor_id: Option<String>, pub bill_of_lading: Option<String>, pub delivery_note: Option<String>, pub plant: String, pub storage_location: String, pub material_doc_year: u16, pub is_posted: bool, pub is_cancelled: bool, pub cancellation_doc: Option<String>,
}
Expand description

Goods Receipt document.

Fields§

§header: DocumentHeader

Document header

§gr_type: GoodsReceiptType

GR type

§items: Vec<GoodsReceiptItem>

Line items

§total_quantity: Decimal

Total quantity received

§total_value: Decimal

Total value

§purchase_order_id: Option<String>

Reference PO (primary)

§vendor_id: Option<String>

Vendor (for info)

§bill_of_lading: Option<String>

Bill of lading

§delivery_note: Option<String>

Delivery note from vendor

§plant: String

Receiving plant

§storage_location: String

Receiving storage location

§material_doc_year: u16

Material document year

§is_posted: bool

Is this GR posted?

§is_cancelled: bool

Is this GR cancelled/reversed?

§cancellation_doc: Option<String>

Cancellation GR reference

Implementations§

Source§

impl GoodsReceipt

Source

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

Create a new goods receipt.

Source

pub fn from_purchase_order( gr_id: impl Into<String>, company_code: impl Into<String>, purchase_order_id: impl Into<String>, vendor_id: impl Into<String>, plant: impl Into<String>, storage_location: impl Into<String>, fiscal_year: u16, fiscal_period: u8, document_date: NaiveDate, created_by: impl Into<String>, ) -> Self

Create from PO reference.

Source

pub fn with_gr_type(self, gr_type: GoodsReceiptType) -> Self

Set GR type.

Source

pub fn with_delivery_note(self, note: impl Into<String>) -> Self

Set delivery note.

Source

pub fn with_bill_of_lading(self, bol: impl Into<String>) -> Self

Set bill of lading.

Source

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

Add a line item.

Source

pub fn recalculate_totals(&mut self)

Recalculate totals.

Source

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

Post the GR and generate GL entry.

Source

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

Cancel/reverse the GR.

Source

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

Generate the GL journal entry for this GR. DR Inventory (or GR/IR for services) CR GR/IR Clearing

Trait Implementations§

Source§

impl Clone for GoodsReceipt

Source§

fn clone(&self) -> GoodsReceipt

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 GoodsReceipt

Source§

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

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

impl<'de> Deserialize<'de> for GoodsReceipt

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 GoodsReceipt

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