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