Updated/improved formatting of txt exports, including samples.

This commit is contained in:
scoobybejesus 2019-11-23 14:06:06 -05:00
parent 247c24551e
commit a843a5407b
1 changed files with 52 additions and 35 deletions

View File

@ -27,35 +27,35 @@ pub fn _1_account_lot_detail_to_txt(
// Account balance: 0.5000000 BTC; Total cost basis: 450.0000000 // Account balance: 0.5000000 BTC; Total cost basis: 450.0000000
// ------------------------- // -------------------------
// Lot 1 // Lot 1
// • Σ: 0E-7, with remaining cost basis of 0E-7 and basis date of 2016-01-01 // • Σ: 0.00, with remaining cost basis of 0.00 and basis date of 2016-01-01
// Movements: // Movements:
// 1. 0.2500000 BTC (Txn #1) Exchange txn on 1/1/16. - FIRST // 1. 0.2500000 BTC (Txn #1) Exchange txn on 2016-01-01. - FIRST
// Proceeds: 0.0; Cost basis: 220.0000000; for Gain/loss: LT 0; Inc.: 0; Exp.: 0. // Proceeds: 0.0; Cost basis: 220.0000000; for Gain/loss: LT 0; Inc.: 0; Exp.: 0.
// 2. -0.2500000 BTC (Txn #2) Exchange txn on 2/1/16. - SECOND // 2. -0.2500000 BTC (Txn #2) Exchange txn on 2016-02-01. - SECOND
// Proceeds: 250.0; Cost basis: -220.0; for Gain/loss: ST 30.0; Inc.: 0; Exp.: 0. // Proceeds: 250.0; Cost basis: -220.0; for Gain/loss: ST 30.0; Inc.: 0; Exp.: 0.
// ------------------------- // -------------------------
// Lot 2 // Lot 2
// • Σ: 0E-7, with remaining cost basis of 0.0 and basis date of 2016-03-01 // • Σ: 0.00, with remaining cost basis of 0.00 and basis date of 2016-03-01
// Movements: // Movements:
// 1. 0.3000000 BTC (Txn #3) Exchange txn on 3/1/16. - THIRD // 1. 0.3000000 BTC (Txn #3) Exchange txn on 2016-03-01. - THIRD
// Proceeds: 0.0; Cost basis: 160.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0. // Proceeds: 0.0; Cost basis: 160.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0.
// 2. -0.3 BTC (Txn #5) Exchange txn on 7/1/16. - FIFTH // 2. -0.3 BTC (Txn #5) Exchange txn on 2016-07-01. - FIFTH
// Proceeds: 100.0; Cost basis: -160.0; for Gain/loss: ST -60.0; Inc.: 0; Exp.: 0. // Proceeds: 100.0; Cost basis: -160.0; for Gain/loss: ST -60.0; Inc.: 0; Exp.: 0.
// ------------------------- // -------------------------
// Lot 3 // Lot 3
// • Σ: 0E-7, with remaining cost basis of 0.0 and basis date of 2016-04-01 // • Σ: 0.00, with remaining cost basis of 0.00 and basis date of 2016-04-01
// Movements: // Movements:
// 1. 0.3000000 BTC (Txn #4) Exchange txn on 4/1/16. - FOURTH // 1. 0.3000000 BTC (Txn #4) Exchange txn on 2016-04-01. - FOURTH
// Proceeds: 0.0; Cost basis: 210.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0. // Proceeds: 0.0; Cost basis: 210.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0.
// 2. -0.3 BTC (Txn #5) Exchange txn on 7/1/16. - FIFTH // 2. -0.3 BTC (Txn #5) Exchange txn on 2016-07-01. - FIFTH
// Proceeds: 100.0; Cost basis: -210.0; for Gain/loss: ST -110.0; Inc.: 0; Exp.: 0. // Proceeds: 100.0; Cost basis: -210.0; for Gain/loss: ST -110.0; Inc.: 0; Exp.: 0.
// ------------------------- // -------------------------
// Lot 4 // Lot 4
// • Σ: 0.5000000, with remaining cost basis of 450.0 and basis date of 2016-10-01 // • Σ: 0.5000000, with remaining cost basis of 450.0 and basis date of 2016-10-01
// Movements: // Movements:
// 1. 1.0000000 BTC (Txn #6) Exchange txn on 10/1/16. - SIXTH // 1. 1.0000000 BTC (Txn #6) Exchange txn on 2016-10-01. - SIXTH
// Proceeds: 0.0; Cost basis: 900.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0. // Proceeds: 0.0; Cost basis: 900.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0.
// 2. -0.5000000 BTC (Txn #7) ToSelf txn on 1/1/18. - SEVENTH // 2. -0.5000000 BTC (Txn #7) ToSelf txn on 2018-01-01. - SEVENTH
// Proceeds: 0.0; Cost basis: -450.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0. // Proceeds: 0.0; Cost basis: -450.0; for Gain/loss: LT 0; Inc.: 0; Exp.: 0.
@ -109,15 +109,26 @@ Enable like-kind treatment: {}",
for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() { for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() {
let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot(); let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot();
let formatted_basis: String;
if lk_lot_basis == d128!(0) {
formatted_basis = "0.00".to_string()
} else { formatted_basis = lk_lot_basis.to_string() }
let movements_sum = lot.get_sum_of_amts_in_lot(); let movements_sum = lot.get_sum_of_amts_in_lot();
let formatted_sum: String;
if movements_sum == d128!(0) {
formatted_sum = "0.00".to_string()
} else { formatted_sum = movements_sum.to_string() }
if acct.list_of_lots.borrow().len() > 0 { if acct.list_of_lots.borrow().len() > 0 {
writeln!(file, "-------------------------")?; writeln!(file, "-------------------------")?;
writeln!(file, " Lot {}", (lot_idx+1))?; writeln!(file, " Lot {}", (lot_idx+1))?;
writeln!(file, "\t• Σ: {}, with remaining cost basis of {} and basis date of {}", writeln!(file, "\t• Σ: {}, with remaining cost basis of {} and basis date of {}",
movements_sum, formatted_sum,
lk_lot_basis, formatted_basis,
lot.date_for_basis_purposes lot.date_for_basis_purposes
)?; )?;
writeln!(file, "\t Movements:")?; writeln!(file, "\t Movements:")?;
@ -133,7 +144,7 @@ Enable like-kind treatment: {}",
raw_acct.ticker, raw_acct.ticker,
mvmt.transaction_key, mvmt.transaction_key,
tx_type, tx_type,
mvmt.date_as_string, mvmt.date,
txn.user_memo txn.user_memo
); );
@ -168,17 +179,6 @@ Enable like-kind treatment: {}",
writeln!(file, "{}", activity_str)?; writeln!(file, "{}", activity_str)?;
// if settings.enable_like_kind_treatment {
// let dg_prev = mvmt.proceeds_lk.get();
// let dg_curr = mvmt.cost_basis_lk.get();
// let activity_str = format!("\t\t\tGain deferred in this txn: {}; Accumulated in prior txns: {}",
// dg_curr,
// dg_prev,
// );
// writeln!(file, "{}", activity_str)?
// }
} }
} }
} }
@ -196,15 +196,15 @@ pub fn _2_account_lot_summary_to_txt(
// ===================================== // =====================================
// Bank USD // Bank USD
// Account balance: -220.0000000 USD; Total cost basis: -220.0000000 // Account balance: -220.0000000 USD; Total cost basis: -220.0000000
// Lot 1 • Σ: -220.0000000, with remaining cost basis of -220.0000000 and basis date of 2016-01-01 // Lot 1 created 2016-01-01 w/ basis date 2016-01-01 • Σ: -220.0000000, and cost basis of -220.0000000
// ===================================== // =====================================
// Exchange BTC // Exchange BTC
// Account balance: 0.5000000 BTC; Total cost basis: 450.0000000 // Account balance: 0.5000000 BTC; Total cost basis: 450.0000000
// Lot 1 • Σ: 0E-7, with remaining cost basis of 0E-7 and basis date of 2016-01-01 // Lot 1 created 2016-01-01 w/ basis date 2016-01-01 • Σ: 0.00, and cost basis of 0.00
// Lot 2 • Σ: 0E-7, with remaining cost basis of 0.0 and basis date of 2016-03-01 // Lot 2 created 2016-03-01 w/ basis date 2016-03-01 • Σ: 0.00, and cost basis of 0.00
// Lot 3 • Σ: 0E-7, with remaining cost basis of 0.0 and basis date of 2016-04-01 // Lot 3 created 2016-04-01 w/ basis date 2016-04-01 • Σ: 0.00, and cost basis of 0.00
// Lot 4 • Σ: 0.5000000, with remaining cost basis of 450.0 and basis date of 2016-10-01 // Lot 4 created 2016-10-01 w/ basis date 2016-10-01 • Σ: 0.5000000, and cost basis of 450.00
@ -255,16 +255,27 @@ Enable like-kind treatment: {}",
for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() { for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() {
let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot(); let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot();
let formatted_basis: String;
if lk_lot_basis == d128!(0) {
formatted_basis = "0.00".to_string()
} else { formatted_basis = lk_lot_basis.to_string() }
let movements_sum = lot.get_sum_of_amts_in_lot(); let movements_sum = lot.get_sum_of_amts_in_lot();
let formatted_sum: String;
if movements_sum == d128!(0) {
formatted_sum = "0.00".to_string()
} else { formatted_sum = movements_sum.to_string() }
if acct.list_of_lots.borrow().len() > 0 { if acct.list_of_lots.borrow().len() > 0 {
writeln!(file, " Lot {} created {} w/ basis date {} • Σ: {}, and cost basis of {}", writeln!(file, " Lot {} created {} w/ basis date {} • Σ: {}, and cost basis of {}",
(lot_idx+1), (lot_idx+1),
lot.date_of_first_mvmt_in_lot, lot.date_of_first_mvmt_in_lot,
lot.date_for_basis_purposes, lot.date_for_basis_purposes,
movements_sum, formatted_sum,
lk_lot_basis, formatted_basis,
)?; )?;
} }
} }
@ -282,12 +293,12 @@ pub fn _3_account_lot_summary_non_zero_to_txt(
// ===================================== // =====================================
// Exchange BTC // Exchange BTC
// Account balance: 0.5000000 BTC; Total cost basis: 450.0000000 // Account balance: 0.5000000 BTC; Total cost basis: 450.0000000
// Lot 4 • Σ: 0.5000000, with remaining cost basis of 450.0 and basis date of 2016-10-01 // Lot 4 created 2016-10-01 w/ basis date 2016-10-01 • Σ: 0.5000000, and cost basis of 450.00
// ===================================== // =====================================
// Simplewallet XMR // Simplewallet XMR
// Account balance: 400.0000000 XMR; Total cost basis: 2000.0 // Account balance: 400.0000000 XMR; Total cost basis: 2000.0
// Lot 1 • Σ: 400.0000000, with remaining cost basis of 2000.0 and basis date of 2018-02-01 // Lot 1 created 2018-02-01 w/ basis date 2018-02-01 • Σ: 400.0000000, and cost basis of 2000.00
@ -343,6 +354,12 @@ Enable like-kind treatment: {}",
for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() { for (lot_idx, lot) in acct.list_of_lots.borrow().iter().enumerate() {
let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot(); let lk_lot_basis = lot.get_sum_of_lk_basis_in_lot();
let formatted_basis: String;
if lk_lot_basis == d128!(0) {
formatted_basis = "0.00".to_string()
} else { formatted_basis = lk_lot_basis.to_string() }
let movements_sum = lot.get_sum_of_amts_in_lot(); let movements_sum = lot.get_sum_of_amts_in_lot();
if acct.list_of_lots.borrow().len() > 0 { if acct.list_of_lots.borrow().len() > 0 {
@ -353,7 +370,7 @@ Enable like-kind treatment: {}",
lot.date_of_first_mvmt_in_lot, lot.date_of_first_mvmt_in_lot,
lot.date_for_basis_purposes, lot.date_for_basis_purposes,
movements_sum, movements_sum,
lk_lot_basis, formatted_basis,
)?; )?;
} }
} }