Browse Source

Duplicated check from last commit to Reprint

Brett Credo 8 years ago
parent
commit
0e8f8a46e7
1 changed files with 12 additions and 0 deletions
  1. 12 0
      BulkPrinting/BulkPrinting/BatchForm.cs

+ 12 - 0
BulkPrinting/BulkPrinting/BatchForm.cs

@@ -464,6 +464,18 @@ namespace BulkPrinting
464 464
                 return;
465 465
             }
466 466
 
467
+            int DeliveredVoucherCount = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["DeliveredQuantity"].Index].Value;
468
+            string Sql = "SELECT COUNT(*) FROM Voucher WHERE BatchId=@id";
469
+            Command = new SQLiteCommand(Sql, Globals.DBConnection);
470
+            Command.Parameters.Add(new SQLiteParameter("@id", BatchID));
471
+            int DownloadedVoucherCount = Convert.ToInt32(Command.ExecuteScalar());
472
+            if (DownloadedVoucherCount < DeliveredVoucherCount)
473
+            {
474
+                MessageBox.Show(string.Format("Batch {0} has not finished downloading.\nDownloaded {1} of {2} vouchers in batch.", BatchID, DownloadedVoucherCount, DeliveredVoucherCount), "Cannot open print dialog", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
475
+                return;
476
+            }
477
+
478
+
467 479
             if (Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder))
468 480
             { //Only check for undownloaded vouchers if the user is able to see them
469 481
                 if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ReadyForDownload"].Index].Value == "No")