|
|
@@ -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")
|