Skip to main content

FixedAsset

Struct FixedAsset 

Source
pub struct FixedAsset {
Show 28 fields pub asset_id: String, pub sub_number: u16, pub description: String, pub asset_class: AssetClass, pub company_code: String, pub cost_center: Option<String>, pub location: Option<String>, pub acquisition_date: NaiveDate, pub acquisition_type: AcquisitionType, pub acquisition_cost: Decimal, pub capitalized_date: Option<NaiveDate>, pub depreciation_method: DepreciationMethod, pub useful_life_months: u32, pub salvage_value: Decimal, pub accumulated_depreciation: Decimal, pub net_book_value: Decimal, pub account_determination: AssetAccountDetermination, pub status: AssetStatus, pub disposal_date: Option<NaiveDate>, pub disposal_proceeds: Option<Decimal>, pub serial_number: Option<String>, pub manufacturer: Option<String>, pub model: Option<String>, pub warranty_expiration: Option<NaiveDate>, pub insurance_policy: Option<String>, pub purchase_order: Option<String>, pub vendor_id: Option<String>, pub invoice_reference: Option<String>,
}
Expand description

Fixed asset master data.

Fields§

§asset_id: String

Asset ID (e.g., “FA-001234”)

§sub_number: u16

Asset sub-number (for component accounting)

§description: String

Asset description

§asset_class: AssetClass

Asset class

§company_code: String

Company code

§cost_center: Option<String>

Cost center responsible for the asset

§location: Option<String>

Location/plant

§acquisition_date: NaiveDate

Acquisition date

§acquisition_type: AcquisitionType

Acquisition type

§acquisition_cost: Decimal

Original acquisition cost

§capitalized_date: Option<NaiveDate>

Capitalized date (when depreciation starts)

§depreciation_method: DepreciationMethod

Depreciation method

§useful_life_months: u32

Useful life in months

§salvage_value: Decimal

Salvage/residual value

§accumulated_depreciation: Decimal

Accumulated depreciation as of current period

§net_book_value: Decimal

Net book value (acquisition_cost - accumulated_depreciation)

§account_determination: AssetAccountDetermination

Account determination rules

§status: AssetStatus

Current status

§disposal_date: Option<NaiveDate>

Disposal date (if disposed)

§disposal_proceeds: Option<Decimal>

Disposal proceeds (if disposed)

§serial_number: Option<String>

Serial number (for tracking)

§manufacturer: Option<String>

Manufacturer

§model: Option<String>

Model

§warranty_expiration: Option<NaiveDate>

Warranty expiration date

§insurance_policy: Option<String>

Insurance policy number

§purchase_order: Option<String>

Original PO number

§vendor_id: Option<String>

Vendor ID (who supplied the asset)

§invoice_reference: Option<String>

Invoice reference

Implementations§

Source§

impl FixedAsset

Source

pub fn new( asset_id: impl Into<String>, description: impl Into<String>, asset_class: AssetClass, company_code: impl Into<String>, acquisition_date: NaiveDate, acquisition_cost: Decimal, ) -> Self

Create a new fixed asset.

Source

pub fn with_cost_center(self, cost_center: impl Into<String>) -> Self

Set cost center.

Source

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

Set location.

Source

pub fn with_salvage_value(self, salvage_value: Decimal) -> Self

Set salvage value.

Source

pub fn with_depreciation_method(self, method: DepreciationMethod) -> Self

Set depreciation method.

Source

pub fn with_useful_life_months(self, months: u32) -> Self

Set useful life.

Source

pub fn with_vendor(self, vendor_id: impl Into<String>) -> Self

Set vendor ID.

Source

pub fn months_since_capitalization(&self, as_of_date: NaiveDate) -> u32

Calculate months since capitalization.

Source

pub fn calculate_monthly_depreciation(&self, as_of_date: NaiveDate) -> Decimal

Calculate depreciation for a specific month.

Source

pub fn apply_depreciation(&mut self, depreciation_amount: Decimal)

Apply depreciation and update balances.

Source

pub fn calculate_disposal_gain_loss(&self, proceeds: Decimal) -> Decimal

Calculate gain/loss on disposal.

Source

pub fn dispose(&mut self, disposal_date: NaiveDate, proceeds: Decimal)

Record disposal.

Source

pub fn is_fully_depreciated(&self) -> bool

Check if asset is fully depreciated.

Source

pub fn remaining_useful_life_months(&self, as_of_date: NaiveDate) -> u32

Calculate remaining useful life in months.

Source

pub fn annual_depreciation_rate(&self) -> Decimal

Calculate depreciation rate (annual percentage).

Trait Implementations§

Source§

impl Clone for FixedAsset

Source§

fn clone(&self) -> FixedAsset

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 FixedAsset

Source§

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

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

impl<'de> Deserialize<'de> for FixedAsset

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 FixedAsset

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