Fix: To prevent accidental double printing, the print bill and print kot buttons are greyed out once clicked till the end of the function
This commit is contained in:
parent
3d3c21b853
commit
7733b16611
@ -405,6 +405,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
}
|
||||
private void btnPrintBill_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnPrintBill.Enabled = false;
|
||||
bool isPrinted = false, isVoid = false;
|
||||
if (_controller._voucher.VoucherID != Guid.Empty)
|
||||
using (var bi = new VoucherBI())
|
||||
@ -414,14 +415,14 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
isVoid = dbVoucher.Void;
|
||||
}
|
||||
|
||||
if (!_controller.CanSaveBill(isPrinted, isVoid))
|
||||
return;
|
||||
if (_controller.CanSaveBill(isPrinted, isVoid))
|
||||
{
|
||||
var amount = _controller._bill.NetAmount;
|
||||
_controller.SetDiscount();
|
||||
ShowInfo();
|
||||
var printed = _controller.SaveAndPrintBill(isPrinted, amount);
|
||||
if (!printed)
|
||||
return;
|
||||
if (printed)
|
||||
{
|
||||
if (_controller._editVoucherID.HasValue)
|
||||
this.Close();
|
||||
else
|
||||
@ -430,12 +431,17 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
FormState = SaleFormState.Waiting;
|
||||
}
|
||||
}
|
||||
}
|
||||
btnPrintBill.Enabled = true;
|
||||
|
||||
}
|
||||
|
||||
private void btnPrintKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnPrintKot.Enabled = false;
|
||||
var printed = _controller.SaveAndPrintKot();
|
||||
if (!printed)
|
||||
return;
|
||||
if (printed)
|
||||
{
|
||||
if (_controller._editVoucherID.HasValue)
|
||||
this.Close();
|
||||
else
|
||||
@ -444,6 +450,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
FormState = SaleFormState.Waiting;
|
||||
}
|
||||
}
|
||||
btnPrintKot.Enabled = true;
|
||||
}
|
||||
|
||||
private void btnQuantity_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user