pub struct AccrualDefinition {Show 16 fields
pub accrual_id: String,
pub company_code: String,
pub description: String,
pub accrual_type: AccrualType,
pub expense_revenue_account: String,
pub accrual_account: String,
pub calculation_method: AccrualCalculationMethod,
pub fixed_amount: Option<Decimal>,
pub percentage_rate: Option<Decimal>,
pub base_account: Option<String>,
pub frequency: AccrualFrequency,
pub auto_reverse: bool,
pub cost_center: Option<String>,
pub is_active: bool,
pub effective_from: NaiveDate,
pub effective_to: Option<NaiveDate>,
}Expand description
Accrual definition for recurring period-end entries.
Fields§
§accrual_id: StringAccrual ID.
company_code: StringCompany code.
description: StringDescription.
accrual_type: AccrualTypeAccrual type.
expense_revenue_account: StringExpense/Revenue account to debit/credit.
accrual_account: StringAccrual liability/asset account.
calculation_method: AccrualCalculationMethodCalculation method.
fixed_amount: Option<Decimal>Fixed amount (if applicable).
percentage_rate: Option<Decimal>Percentage rate (if applicable).
base_account: Option<String>Base account for percentage calculation.
frequency: AccrualFrequencyFrequency.
auto_reverse: boolAuto-reverse on first day of next period.
cost_center: Option<String>Cost center.
is_active: boolActive flag.
effective_from: NaiveDateStart date.
effective_to: Option<NaiveDate>End date (if defined).
Implementations§
Source§impl AccrualDefinition
impl AccrualDefinition
Sourcepub fn new(
accrual_id: String,
company_code: String,
description: String,
accrual_type: AccrualType,
expense_revenue_account: String,
accrual_account: String,
) -> Self
pub fn new( accrual_id: String, company_code: String, description: String, accrual_type: AccrualType, expense_revenue_account: String, accrual_account: String, ) -> Self
Creates a new accrual definition.
Sourcepub fn with_fixed_amount(self, amount: Decimal) -> Self
pub fn with_fixed_amount(self, amount: Decimal) -> Self
Sets the fixed amount.
Sourcepub fn with_percentage(self, rate: Decimal, base_account: &str) -> Self
pub fn with_percentage(self, rate: Decimal, base_account: &str) -> Self
Sets percentage-based calculation.
Sourcepub fn is_effective_on(&self, date: NaiveDate) -> bool
pub fn is_effective_on(&self, date: NaiveDate) -> bool
Checks if the accrual is effective for a given date.
Trait Implementations§
Source§impl Clone for AccrualDefinition
impl Clone for AccrualDefinition
Source§fn clone(&self) -> AccrualDefinition
fn clone(&self) -> AccrualDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AccrualDefinition
impl RefUnwindSafe for AccrualDefinition
impl Send for AccrualDefinition
impl Sync for AccrualDefinition
impl Unpin for AccrualDefinition
impl UnwindSafe for AccrualDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more