Added txn value in auto_memo.

This commit is contained in:
scoobybejesus 2019-10-03 20:05:08 -04:00
parent e8ed4e0067
commit 29a84d617e
2 changed files with 9 additions and 6 deletions

View File

@ -504,6 +504,7 @@ pub fn _6_transaction_mvmt_detail_to_csv_w_orig(
let mut rows: Vec<Vec<String>> = [].to_vec();
let mut header: Vec<String> = Vec::with_capacity(16);
header.extend_from_slice(&[
"Date".to_string(),
"Txn#".to_string(),
@ -548,7 +549,7 @@ pub fn _6_transaction_mvmt_detail_to_csv_w_orig(
let tx_number = txn.tx_number.to_string();
let tx_type = txn.transaction_type(&ars, &raw_acct_map, &acct_map)?;
let user_memo = txn.user_memo.to_string();
let auto_memo = txn.get_auto_memo(ars, raw_acct_map,acct_map)?;
let auto_memo = txn.get_auto_memo(ars, raw_acct_map,acct_map, &settings.home_currency)?;
let mut amount = d128!(0);
amount += mvmt.amount; // To prevent printing -5E+1 instead of 50, for example
let ticker = raw_acct.ticker.to_string();

View File

@ -217,7 +217,8 @@ impl Transaction {
&self,
ars: &HashMap<u32, ActionRecord>,
raw_accts: &HashMap<u16, RawAccount>,
acct_map: &HashMap<u16, Account>
acct_map: &HashMap<u16, Account>,
home_currency: &String,
) -> Result<String, Box<dyn Error>> {
let auto_memo = if self.action_record_idx_vec.len() == 2 {
@ -238,11 +239,12 @@ impl Transaction {
let ic_raw_acct = raw_accts.get(&ic_acct.raw_key).unwrap();
let ic_ticker = &ic_raw_acct.ticker;
format!("Paid {} {} for {} {}", og_amt, og_ticker, ic_amt, ic_ticker)
format!("Paid {} {} for {} {}, valued at {} {}.",
og_amt, og_ticker, ic_amt, ic_ticker, self.proceeds, home_currency)
} else {
format!("Margin profit or loss")
format!("Margin profit or loss valued at {} {}.", self.proceeds, home_currency)
}
} else {
@ -255,11 +257,11 @@ impl Transaction {
if amt > d128!(0.0) {
format!("Received {} {}", amt, ticker)
format!("Received {} {} valued at {} {}.", amt, ticker, self.proceeds, home_currency)
} else {
format!("Spent {} {}", amt, ticker)
format!("Spent {} {} valued at {} {}.", amt, ticker, self.proceeds, home_currency)
}
};