Skip to content

Commit

Permalink
Allow unbalanced vouchers when reading documents
Browse files Browse the repository at this point in the history
  • Loading branch information
idstam committed Mar 2, 2024
1 parent 3244e84 commit 39a6627
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ To read a file create an instance of SieDocument and call ReadDocument.

There are some properties on SieDocument that changes how the parsing works:

+ AllowUnbalancedVoucher: If true the parser will allow vouchers that do not sum to zero.
+ IgnoreMissingOMFATTNING: If true the parser will not flag a missing #OMFATTN as an error.
+ IgnoreBTRANS: If true #BTRANS (removed voucher rows) will be ignored.
+ IgnoreRTRANS: If true #RTRANS (added voucher rows) will be ignored.
Expand Down
9 changes: 7 additions & 2 deletions jsiSIE/jsiSIE/SieDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class SieDocument
public bool IgnoreMissingOMFATTNING = false;
public bool IgnoreRTRANS = false;
public bool IgnoreMissingDate = true;
public bool AllowUnbalancedVoucher { get; private set; }


public string DateFormat = "yyyyMMdd";
public Encoding Encoding;
Expand Down Expand Up @@ -543,7 +545,10 @@ private void closeVoucher(SieVoucher v)

check += r.Amount;
}
if (check != 0) Callbacks.CallbackException(new SieVoucherMissmatchException(v.Series + "." + v.Number + " Sum is not zero."));
if (check != 0 && !this.AllowUnbalancedVoucher)
{
Callbacks.CallbackException(new SieVoucherMissmatchException(v.Series + "." + v.Number + " Sum is not zero."));
}

Callbacks.CallbackVER(v);
if (!StreamValues) VER.Add(v);
Expand Down Expand Up @@ -867,6 +872,6 @@ private void validateDocument()
}

public SieBookingYear rar { get; set; }

}
}

0 comments on commit 39a6627

Please sign in to comment.