|
|
@@ -300,6 +300,18 @@ namespace BulkPrinting
|
|
300
|
300
|
MessageBox.Show("A print dialog is already open for this batch","Cannot open print dialog",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
|
|
301
|
301
|
return;
|
|
302
|
302
|
}
|
|
|
303
|
+
|
|
|
304
|
+ int DeliveredVoucherCount = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["DeliveredQuantity"].Index].Value;
|
|
|
305
|
+ string Sql = "SELECT COUNT(*) FROM Voucher WHERE BatchId=@id";
|
|
|
306
|
+ SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
|
|
|
307
|
+ Command.Parameters.Add(new SQLiteParameter("@id", BatchID));
|
|
|
308
|
+ int DownloadedVoucherCount = Convert.ToInt32(Command.ExecuteScalar());
|
|
|
309
|
+ if (DownloadedVoucherCount < DeliveredVoucherCount) {
|
|
|
310
|
+ 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);
|
|
|
311
|
+ return;
|
|
|
312
|
+ }
|
|
|
313
|
+
|
|
|
314
|
+
|
|
303
|
315
|
this.BeginInvoke((Action)delegate {
|
|
304
|
316
|
PrintForm PrintFormInstance = new PrintForm();
|
|
305
|
317
|
Globals.OpenBatches.Add(BatchID);
|