|
|
@@ -113,8 +113,17 @@ namespace BulkPrinting
|
|
113
|
113
|
|
|
114
|
114
|
VoucherCount = SelectedRangeEnd - SelectedRangeStart + 1;
|
|
115
|
115
|
decimal VoucherFaceValue = (decimal)Command.ExecuteScalar();
|
|
116
|
|
- int UnprintedVouchersInRange = Utility.GetNumberOfUnprintedVouchersInRange((int)numFirstSeqNum.Value, (int)numLastSeqNum.Value, BatchID);
|
|
117
|
116
|
|
|
|
117
|
+ string countsql = "SELECT COUNT(v.ID) FROM Voucher v LEFT JOIN Logs l ON v.Id=l.VoucherId AND l.EventType=@event WHERE v.BatchId=@batchid AND v.SequenceNumber BETWEEN @startseq AND @endseq AND l.id IS NULL";
|
|
|
118
|
+ SQLiteCommand NewCommand = new SQLiteCommand(countsql, Globals.DBConnection);
|
|
|
119
|
+
|
|
|
120
|
+ NewCommand.Parameters.AddWithValue("@event", (int) VendorEvent.VendorEventType.PrintVoucher);
|
|
|
121
|
+ NewCommand.Parameters.AddWithValue("@batchid", BatchID);
|
|
|
122
|
+ NewCommand.Parameters.AddWithValue("@startseq", SelectedRangeStart);
|
|
|
123
|
+ NewCommand.Parameters.AddWithValue("@endseq", SelectedRangeEnd);
|
|
|
124
|
+
|
|
|
125
|
+ var result = Command.ExecuteScalar();//Utility.GetNumberOfUnprintedVouchersInRange((int)numFirstSeqNum.Value, (int)numLastSeqNum.Value, BatchID);
|
|
|
126
|
+ int UnprintedVouchersInRange = int.Parse(result.ToString());
|
|
118
|
127
|
decimal PrintedVoucherValue = (VoucherCount - UnprintedVouchersInRange) * VoucherFaceValue;
|
|
119
|
128
|
decimal UnprintedVoucherValue = UnprintedVouchersInRange * VoucherFaceValue;
|
|
120
|
129
|
|