Add saldo/balance in the Note field

AfoHT
Jul 21, 2021, 1:01 PM
Q4VYTFJ74VGREANMVE4ETUQMDLX7VV3HXQXVUY2YZI5LWUDDKYNAC

Dependencies

Change contents

  • replacement in src/main.rs at line 97
    [3.534][2.892:1400]()
    let amount_num =
    record
    .belopp
    .replace(" kr", "")
    .replace(",", ".")
    //.replace("-", "")
    .chars()
    .filter(|c| c.is_ascii())
    .filter(|c| !c.is_whitespace())
    .collect::<String>()
    .parse::<f32>()
    .unwrap();
    //if account_name == "Tillgångar:Likvida Medel:Brukskonto" {
    //amount_num = -amount_num;
    //}
    [3.534]
    [3.534]
    let amount_num = record
    .belopp
    .replace(" kr", "")
    .replace(",", ".")
    //.replace("-", "")
    .chars()
    .filter(|c| c.is_ascii())
    .filter(|c| !c.is_whitespace())
    .collect::<String>()
    .parse::<f32>()
    .unwrap();
    let amount_balance = match record.saldo {
    Some(saldo) => Some(
    saldo
    .replace(" kr", "")
    .replace(",", ".")
    .chars()
    .filter(|c| c.is_ascii())
    .filter(|c| !c.is_whitespace())
    .collect::<String>()
    .parse::<f32>()
    .unwrap(),
    ),
    None => None,
    };
  • replacement in src/main.rs at line 134
    [3.824][3.824:847]()
    "".into(),
    [3.824]
    [3.847]
    // Extra, the account balance stored in a note
    match amount_balance {
    Some(value) => value.to_string(),
    None => "".into(),
    },