moved ImportProcessParameters and LikeKindSettings to core_functions

This commit is contained in:
scoobybejesus 2019-08-25 21:04:16 -04:00
parent 557546b103
commit 0c00aa869b
7 changed files with 19 additions and 22 deletions

View File

@ -260,18 +260,3 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option<String>) -> (bool, Str
} }
} }
pub struct ImportProcessParameters {
pub export_path: PathBuf,
pub home_currency: String,
pub enable_like_kind_treatment: bool,
pub costing_method: InventoryCostingMethod,
pub lk_cutoff_date_string: String,
}
impl ImportProcessParameters {}
#[derive(Clone)]
pub struct LikeKindSettings {
pub like_kind_cutoff_date: NaiveDate,
pub like_kind_basis_date_preserved: bool,
}

View File

@ -12,7 +12,6 @@ use structopt::StructOpt;
use crate::account::{Account, RawAccount, Lot}; use crate::account::{Account, RawAccount, Lot};
use crate::transaction::{Transaction, ActionRecord}; use crate::transaction::{Transaction, ActionRecord};
use crate::cli_user_choices::{ImportProcessParameters, LikeKindSettings};
use crate::import_accts_txns; use crate::import_accts_txns;
use crate::import_cost_proceeds_etc; use crate::import_cost_proceeds_etc;
use crate::create_lots_mvmts; use crate::create_lots_mvmts;
@ -29,6 +28,20 @@ pub enum InventoryCostingMethod {
FIFObyLotBasisDate, FIFObyLotBasisDate,
} }
#[derive(Clone)]
pub struct LikeKindSettings {
pub like_kind_cutoff_date: NaiveDate,
pub like_kind_basis_date_preserved: bool,
}
pub struct ImportProcessParameters {
pub export_path: PathBuf,
pub home_currency: String,
pub enable_like_kind_treatment: bool,
pub costing_method: InventoryCostingMethod,
pub lk_cutoff_date_string: String,
}
pub fn import_and_process_final( pub fn import_and_process_final(
input_file_path: PathBuf, input_file_path: PathBuf,
settings: &ImportProcessParameters, settings: &ImportProcessParameters,

View File

@ -10,8 +10,7 @@ use chrono::NaiveDate;
use crate::transaction::{Transaction, ActionRecord, TxType, Polarity, TxHasMargin}; use crate::transaction::{Transaction, ActionRecord, TxType, Polarity, TxHasMargin};
use crate::account::{Account, RawAccount, Lot, Movement}; use crate::account::{Account, RawAccount, Lot, Movement};
use crate::core_functions::InventoryCostingMethod; use crate::core_functions::{InventoryCostingMethod, LikeKindSettings, ImportProcessParameters};
use crate::cli_user_choices::{ImportProcessParameters, LikeKindSettings};
use crate::utils::{round_d128_1e8}; use crate::utils::{round_d128_1e8};
pub fn create_lots_and_movements( pub fn create_lots_and_movements(

View File

@ -10,7 +10,7 @@ use decimal::d128;
use crate::transaction::{Transaction, ActionRecord, Polarity, TxType}; use crate::transaction::{Transaction, ActionRecord, Polarity, TxType};
use crate::account::{Account, RawAccount, Term}; use crate::account::{Account, RawAccount, Term};
use crate::cli_user_choices::{ImportProcessParameters}; use crate::core_functions::{ImportProcessParameters};
pub fn _1_account_sums_to_csv( pub fn _1_account_sums_to_csv(

View File

@ -9,7 +9,7 @@ use decimal::d128;
use crate::transaction::{Transaction, TxType, ActionRecord, Polarity}; use crate::transaction::{Transaction, TxType, ActionRecord, Polarity};
use crate::account::{Account, RawAccount}; use crate::account::{Account, RawAccount};
use crate::utils::{round_d128_1e2}; use crate::utils::{round_d128_1e2};
use crate::cli_user_choices::{ImportProcessParameters}; use crate::core_functions::{ImportProcessParameters};
pub fn add_cost_basis_to_movements( pub fn add_cost_basis_to_movements(
settings: &ImportProcessParameters, settings: &ImportProcessParameters,

View File

@ -26,7 +26,7 @@ mod csv_export;
mod utils; mod utils;
mod tests; mod tests;
use crate::cli_user_choices::ImportProcessParameters; use crate::core_functions::ImportProcessParameters;
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]

View File

@ -11,7 +11,7 @@ use decimal::d128;
use chrono::NaiveDate; use chrono::NaiveDate;
use serde_derive::{Serialize, Deserialize}; use serde_derive::{Serialize, Deserialize};
use crate::cli_user_choices::ImportProcessParameters; use crate::core_functions::ImportProcessParameters;
use crate::account::{Account, Movement, RawAccount}; use crate::account::{Account, Movement, RawAccount};
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]