Restore account links to dynamic reports
This commit is contained in:
parent
d326b3ae43
commit
0d680275df
@ -73,13 +73,13 @@ impl DbConnection {
|
||||
// System accounts
|
||||
account_configurations.push(AccountConfiguration {
|
||||
id: None,
|
||||
account: "Current Year Earnings".to_string(),
|
||||
account: crate::CURRENT_YEAR_EARNINGS.to_string(),
|
||||
kind: "drcr.equity".to_string(),
|
||||
data: None,
|
||||
});
|
||||
account_configurations.push(AccountConfiguration {
|
||||
id: None,
|
||||
account: "Retained Earnings".to_string(),
|
||||
account: crate::RETAINED_EARNINGS.to_string(),
|
||||
kind: "drcr.equity".to_string(),
|
||||
data: None,
|
||||
});
|
||||
|
@ -5,4 +5,10 @@ pub mod reporting;
|
||||
pub mod serde;
|
||||
pub mod util;
|
||||
|
||||
/// Data type used to represent transaction and account quantities
|
||||
pub type QuantityInt = i64;
|
||||
|
||||
// Magic strings
|
||||
// TODO: Make this configurable
|
||||
pub const CURRENT_YEAR_EARNINGS: &'static str = "Current Year Earnings";
|
||||
pub const RETAINED_EARNINGS: &'static str = "Retained Earnings";
|
||||
|
@ -535,13 +535,23 @@ pub fn entries_for_kind(
|
||||
.map(|b| b.get(account).unwrap_or(&0) * if invert { -1 } else { 1 })
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Some exceptions for the link
|
||||
let link;
|
||||
if account == crate::CURRENT_YEAR_EARNINGS {
|
||||
link = Some("/income-statement".to_string());
|
||||
} else if account == crate::RETAINED_EARNINGS {
|
||||
link = None
|
||||
} else {
|
||||
link = Some(format!("/transactions/{}", account));
|
||||
}
|
||||
|
||||
let entry = LiteralRow {
|
||||
text: account.to_string(),
|
||||
quantity: quantities,
|
||||
id: None,
|
||||
visible: true,
|
||||
auto_hide: true,
|
||||
link: None,
|
||||
link,
|
||||
heading: false,
|
||||
bordered: false,
|
||||
};
|
||||
|
@ -951,7 +951,7 @@ impl ReportingStep for CurrentYearEarningsToEquity {
|
||||
id: None,
|
||||
transaction_id: None,
|
||||
description: None,
|
||||
account: "Current Year Earnings".to_string(),
|
||||
account: crate::CURRENT_YEAR_EARNINGS.to_string(),
|
||||
quantity: *balance,
|
||||
commodity: context.reporting_commodity.clone(),
|
||||
quantity_ascost: None,
|
||||
@ -1511,7 +1511,7 @@ impl ReportingStep for RetainedEarningsToEquity {
|
||||
id: None,
|
||||
transaction_id: None,
|
||||
description: None,
|
||||
account: "Retained Earnings".to_string(),
|
||||
account: crate::RETAINED_EARNINGS.to_string(),
|
||||
quantity: *balance,
|
||||
commodity: context.reporting_commodity.clone(),
|
||||
quantity_ascost: None,
|
||||
@ -1648,7 +1648,7 @@ impl ReportingStep for TrialBalance {
|
||||
id: None,
|
||||
visible: true,
|
||||
auto_hide: true,
|
||||
link: None,
|
||||
link: Some(format!("/transactions/{}", account)),
|
||||
heading: false,
|
||||
bordered: false,
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user