add method

Operation add({
  1. dynamic date,
  2. dynamic cplus,
  3. dynamic cminus,
  4. dynamic desc,
  5. dynamic cur,
  6. dynamic valuta,
  7. dynamic mod,
})

batch setterr Adds a batch of attributes to the operation (e.g., date, account, description, etc.).

This allows adding multiple journal lines in one go.

Implementation

Operation add({date, cplus, cminus, desc, cur, valuta, mod}) {
  if (date != null) {
    if (date is String)
      this.datum.add(DateTime.parse(date));
    else if (date is DateTime)
      this.datum.add(date);
    else
      this.datum.add(DateTime.now());
  }
  this.cplus.add((cplus != null) ? "$cplus".trim() : "none");
  this.cminus.add((cminus != null) ? "$cminus".trim() : "none");
  this.desc.add((desc != null) ? desc.trim() : "none");
  this.cur.add((cur != null) ? cur : "EUR");
  this.valuta.add((valuta != null) ? valuta : "");
  this.mod.add((mod != null) ? mod : "");
  //print("incoming : $date,$cplus,$cminus,$desc,$cur,$valuta. $mod gives "+toString());
  return this;
}