Skip to main content

AssetDisposal

Struct AssetDisposal 

Source
pub struct AssetDisposal {
Show 27 fields pub disposal_id: String, pub asset_number: String, pub sub_number: String, pub company_code: String, pub disposal_date: NaiveDate, pub posting_date: NaiveDate, pub disposal_type: DisposalType, pub disposal_reason: DisposalReason, pub asset_description: String, pub asset_class: AssetClass, pub acquisition_cost: Decimal, pub accumulated_depreciation: Decimal, pub net_book_value: Decimal, pub sale_proceeds: Decimal, pub disposal_costs: Decimal, pub net_proceeds: Decimal, pub gain_loss: Decimal, pub is_gain: bool, pub customer_id: Option<String>, pub invoice_reference: Option<String>, pub gl_references: Vec<GLReference>, pub approval_status: DisposalApprovalStatus, pub approved_by: Option<String>, pub approval_date: Option<NaiveDate>, pub created_by: String, pub created_at: DateTime<Utc>, pub notes: Option<String>,
}
Expand description

Asset disposal transaction.

Fields§

§disposal_id: String

Disposal ID.

§asset_number: String

Asset number.

§sub_number: String

Sub-number.

§company_code: String

Company code.

§disposal_date: NaiveDate

Disposal date.

§posting_date: NaiveDate

Posting date.

§disposal_type: DisposalType

Disposal type.

§disposal_reason: DisposalReason

Disposal reason.

§asset_description: String

Asset description.

§asset_class: AssetClass

Asset class.

§acquisition_cost: Decimal

Original acquisition cost.

§accumulated_depreciation: Decimal

Accumulated depreciation at disposal.

§net_book_value: Decimal

Net book value at disposal.

§sale_proceeds: Decimal

Sale proceeds (if sold).

§disposal_costs: Decimal

Disposal costs (removal, transport, etc.).

§net_proceeds: Decimal

Net proceeds.

§gain_loss: Decimal

Gain or loss on disposal.

§is_gain: bool

Is gain (vs loss).

§customer_id: Option<String>

Customer (if sold).

§invoice_reference: Option<String>

Invoice reference.

§gl_references: Vec<GLReference>

GL references.

§approval_status: DisposalApprovalStatus

Approval status.

§approved_by: Option<String>

Approved by.

§approval_date: Option<NaiveDate>

Approval date.

§created_by: String

Created by.

§created_at: DateTime<Utc>

Created at.

§notes: Option<String>

Notes.

Implementations§

Source§

impl AssetDisposal

Source

pub fn new( disposal_id: String, asset: &FixedAssetRecord, disposal_date: NaiveDate, disposal_type: DisposalType, disposal_reason: DisposalReason, created_by: String, ) -> Self

Creates a new disposal record.

Source

pub fn sale( disposal_id: String, asset: &FixedAssetRecord, disposal_date: NaiveDate, sale_proceeds: Decimal, customer_id: String, created_by: String, ) -> Self

Creates a sale disposal.

Source

pub fn scrap( disposal_id: String, asset: &FixedAssetRecord, disposal_date: NaiveDate, reason: DisposalReason, created_by: String, ) -> Self

Creates a scrapping disposal.

Source

pub fn with_sale_proceeds(self, proceeds: Decimal) -> Self

Sets sale proceeds.

Source

pub fn with_disposal_costs(self, costs: Decimal) -> Self

Sets disposal costs.

Source

pub fn calculate_gain_loss(&mut self)

Calculates gain or loss on disposal.

Source

pub fn approve(&mut self, approver: String, approval_date: NaiveDate)

Approves the disposal.

Source

pub fn reject(&mut self, reason: String)

Rejects the disposal.

Source

pub fn post(&mut self)

Posts the disposal.

Source

pub fn add_gl_reference(&mut self, reference: GLReference)

Adds a GL reference.

Source

pub fn gain(&self) -> Decimal

Gets the gain (or zero if loss).

Source

pub fn loss(&self) -> Decimal

Gets the loss (or zero if gain).

Source

pub fn requires_approval(&self, threshold: Decimal) -> bool

Requires approval based on threshold.

Trait Implementations§

Source§

impl Clone for AssetDisposal

Source§

fn clone(&self) -> AssetDisposal

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 AssetDisposal

Source§

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

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

impl<'de> Deserialize<'de> for AssetDisposal

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 AssetDisposal

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