Просмотр исходного кода

Fixed page numbers not printed with correct association to sequence numbers (ceiling of seqno/20)
Fixed sequence number ordering in fetching from DB for printing

Brett Credo лет назад: 8
Родитель
Сommit
4c533bd002
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      BulkPrinting/BulkPrinting/Utility.cs

+ 3 - 2
BulkPrinting/BulkPrinting/Utility.cs

@@ -399,7 +399,7 @@ namespace BulkPrinting
399 399
 
400 400
             int VoucherCount = 0;
401 401
             int RowCount = 0;
402
-            int PageCount = 1;
402
+            int PageCount = (int) Math.Ceiling(((decimal)StartSeqNo)/20);
403 403
             int TotalCount = 0;
404 404
             string SerialNumberTrimmed;
405 405
             bool IsReprint;
@@ -414,7 +414,7 @@ namespace BulkPrinting
414 414
             List<EventLog> LogEvents = new List<EventLog>();
415 415
 
416 416
             IList<PrintVoucher> VoucherRow = new List<PrintVoucher>();
417
-            SQLiteCommand Command = new SQLiteCommand("SELECT DISTINCT v.Id,v.SequenceNumber,v.Serial,v.EncryptedPIN,v.BatchId,b.ProductDescription,l.VoucherId From Voucher v LEFT JOIN Batch b on v.BatchId = b.Id LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType = @eventtype WHERE v.BatchId=@batch_id AND v.SequenceNumber BETWEEN @seqstartno AND @seqendno", Globals.DBConnection);
417
+            SQLiteCommand Command = new SQLiteCommand("SELECT DISTINCT v.Id,v.SequenceNumber,v.Serial,v.EncryptedPIN,v.BatchId,b.ProductDescription,l.VoucherId From Voucher v LEFT JOIN Batch b on v.BatchId = b.Id LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType = @eventtype WHERE v.BatchId=@batch_id AND v.SequenceNumber BETWEEN @seqstartno AND @seqendno ORDER BY v.SequenceNumber", Globals.DBConnection);
418 418
             Command.Parameters.Add(new SQLiteParameter("@batch_id", BatchId));
419 419
             Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
420 420
             Command.Parameters.Add(new SQLiteParameter("@seqstartno", StartSeqNo));
@@ -465,6 +465,7 @@ namespace BulkPrinting
465 465
                         for (int Column = 0; Column < VoucherRow.Count(); Column++)
466 466
                         {
467 467
                             IndividualVoucher = VoucherRow[Column];
468
+                            int CurrentPage = (int)Math.Ceiling(((decimal)IndividualVoucher.SequenceNumber) / 20);
468 469
                             PrintRow += (Column == 2 ? " " : "") + String.Format("{0}/{1}/{2}", IndividualVoucher.BatchId, IndividualVoucher.SequenceNumber, PageCount).PadRight(30, ' ');
469 470
                         }
470 471
                         PrintRow = PrintRow.TrimEnd() + "\r\n  ";