Add exclude negative allocation statistics option to overhead allocation

This commit is contained in:
Piv
2023-03-09 21:29:25 +10:30
parent 887e7c950b
commit 5603ccfd25

View File

@@ -60,6 +60,9 @@ enum Commands {
#[arg(long, default_value = "E")] #[arg(long, default_value = "E")]
account_type: String, account_type: String,
#[arg(short, long)]
exclude_negative_allocation_statistics: bool,
#[arg(short, long, value_name = "FILE")] #[arg(short, long, value_name = "FILE")]
output: Option<PathBuf>, output: Option<PathBuf>,
}, },
@@ -94,6 +97,7 @@ fn main() -> anyhow::Result<()> {
cost_centres, cost_centres,
use_numeric_accounts, use_numeric_accounts,
account_type, account_type,
exclude_negative_allocation_statistics,
output, output,
} => allocate_overheads( } => allocate_overheads(
lines, lines,
@@ -103,6 +107,7 @@ fn main() -> anyhow::Result<()> {
cost_centres, cost_centres,
use_numeric_accounts, use_numeric_accounts,
account_type, account_type,
exclude_negative_allocation_statistics,
output, output,
), ),
} }
@@ -136,6 +141,7 @@ fn allocate_overheads(
cost_centres: PathBuf, cost_centres: PathBuf,
use_numeric_accounts: bool, use_numeric_accounts: bool,
account_type: String, account_type: String,
exclude_negative_allocation_statistics: bool,
output: Option<PathBuf>, output: Option<PathBuf>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
coster_rs::reciprocal_allocation( coster_rs::reciprocal_allocation(
@@ -146,7 +152,7 @@ fn allocate_overheads(
csv::Reader::from_path(cost_centres)?, csv::Reader::from_path(cost_centres)?,
&mut csv::Writer::from_path(output.unwrap_or(PathBuf::from("alloc_output.csv")))?, &mut csv::Writer::from_path(output.unwrap_or(PathBuf::from("alloc_output.csv")))?,
use_numeric_accounts, use_numeric_accounts,
false, exclude_negative_allocation_statistics,
true, true,
account_type, account_type,
) )