Bläddra i källkod

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 år sedan
förälder
incheckning
4c533bd002
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      BulkPrinting/BulkPrinting/Utility.cs

+ 3 - 2
BulkPrinting/BulkPrinting/Utility.cs

399
 
399
 
400
             int VoucherCount = 0;
400
             int VoucherCount = 0;
401
             int RowCount = 0;
401
             int RowCount = 0;
402
-            int PageCount = 1;
402
+            int PageCount = (int) Math.Ceiling(((decimal)StartSeqNo)/20);
403
             int TotalCount = 0;
403
             int TotalCount = 0;
404
             string SerialNumberTrimmed;
404
             string SerialNumberTrimmed;
405
             bool IsReprint;
405
             bool IsReprint;
414
             List<EventLog> LogEvents = new List<EventLog>();
414
             List<EventLog> LogEvents = new List<EventLog>();
415
 
415
 
416
             IList<PrintVoucher> VoucherRow = new List<PrintVoucher>();
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
             Command.Parameters.Add(new SQLiteParameter("@batch_id", BatchId));
418
             Command.Parameters.Add(new SQLiteParameter("@batch_id", BatchId));
419
             Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
419
             Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
420
             Command.Parameters.Add(new SQLiteParameter("@seqstartno", StartSeqNo));
420
             Command.Parameters.Add(new SQLiteParameter("@seqstartno", StartSeqNo));
465
                         for (int Column = 0; Column < VoucherRow.Count(); Column++)
465
                         for (int Column = 0; Column < VoucherRow.Count(); Column++)
466
                         {
466
                         {
467
                             IndividualVoucher = VoucherRow[Column];
467
                             IndividualVoucher = VoucherRow[Column];
468
+                            int CurrentPage = (int)Math.Ceiling(((decimal)IndividualVoucher.SequenceNumber) / 20);
468
                             PrintRow += (Column == 2 ? " " : "") + String.Format("{0}/{1}/{2}", IndividualVoucher.BatchId, IndividualVoucher.SequenceNumber, PageCount).PadRight(30, ' ');
469
                             PrintRow += (Column == 2 ? " " : "") + String.Format("{0}/{1}/{2}", IndividualVoucher.BatchId, IndividualVoucher.SequenceNumber, PageCount).PadRight(30, ' ');
469
                         }
470
                         }
470
                         PrintRow = PrintRow.TrimEnd() + "\r\n  ";
471
                         PrintRow = PrintRow.TrimEnd() + "\r\n  ";