pub struct BalanceRelationshipRule {
pub rule_id: String,
pub name: String,
pub relationship_type: RelationshipType,
pub target_value: Option<Decimal>,
pub min_value: Option<Decimal>,
pub max_value: Option<Decimal>,
pub tolerance: Decimal,
pub enabled: bool,
pub severity: RuleSeverity,
pub numerator_accounts: Vec<String>,
pub denominator_accounts: Vec<String>,
pub multiplier: Decimal,
}Expand description
A balance relationship rule definition.
Fields§
§rule_id: StringRule identifier.
name: StringRule name.
relationship_type: RelationshipTypeRelationship type.
target_value: Option<Decimal>Target value (if applicable).
min_value: Option<Decimal>Minimum acceptable value.
max_value: Option<Decimal>Maximum acceptable value.
tolerance: DecimalTolerance for deviation from target.
enabled: boolIs this rule enabled?
severity: RuleSeveritySeverity if rule fails.
numerator_accounts: Vec<String>Account codes for numerator calculation.
denominator_accounts: Vec<String>Account codes for denominator calculation.
multiplier: DecimalMultiplier (e.g., 365 for DSO).
Implementations§
Source§impl BalanceRelationshipRule
impl BalanceRelationshipRule
Sourcepub fn new_dso_rule(target_days: u32, tolerance_days: u32) -> Self
pub fn new_dso_rule(target_days: u32, tolerance_days: u32) -> Self
Create a new DSO rule.
Sourcepub fn new_dpo_rule(target_days: u32, tolerance_days: u32) -> Self
pub fn new_dpo_rule(target_days: u32, tolerance_days: u32) -> Self
Create a new DPO rule.
Sourcepub fn new_gross_margin_rule(target_margin: Decimal, tolerance: Decimal) -> Self
pub fn new_gross_margin_rule(target_margin: Decimal, tolerance: Decimal) -> Self
Create a new gross margin rule.
Sourcepub fn new_balance_equation_rule() -> Self
pub fn new_balance_equation_rule() -> Self
Create balance sheet equation rule.
Sourcepub fn is_within_range(&self, value: Decimal) -> bool
pub fn is_within_range(&self, value: Decimal) -> bool
Check if a calculated value is within acceptable range.
Sourcepub fn deviation_from_target(&self, value: Decimal) -> Option<Decimal>
pub fn deviation_from_target(&self, value: Decimal) -> Option<Decimal>
Get the deviation from target.
Trait Implementations§
Source§impl Clone for BalanceRelationshipRule
impl Clone for BalanceRelationshipRule
Source§fn clone(&self) -> BalanceRelationshipRule
fn clone(&self) -> BalanceRelationshipRule
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 moreSource§impl Debug for BalanceRelationshipRule
impl Debug for BalanceRelationshipRule
Source§impl<'de> Deserialize<'de> for BalanceRelationshipRule
impl<'de> Deserialize<'de> for BalanceRelationshipRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BalanceRelationshipRule
impl RefUnwindSafe for BalanceRelationshipRule
impl Send for BalanceRelationshipRule
impl Sync for BalanceRelationshipRule
impl Unpin for BalanceRelationshipRule
impl UnwindSafe for BalanceRelationshipRule
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