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)
|
private void btnPrintBill_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
btnPrintBill.Enabled = false;
|
||||||
bool isPrinted = false, isVoid = false;
|
bool isPrinted = false, isVoid = false;
|
||||||
if (_controller._voucher.VoucherID != Guid.Empty)
|
if (_controller._voucher.VoucherID != Guid.Empty)
|
||||||
using (var bi = new VoucherBI())
|
using (var bi = new VoucherBI())
|
||||||
@ -414,35 +415,42 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
|||||||
isVoid = dbVoucher.Void;
|
isVoid = dbVoucher.Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_controller.CanSaveBill(isPrinted, isVoid))
|
if (_controller.CanSaveBill(isPrinted, isVoid))
|
||||||
return;
|
|
||||||
var amount = _controller._bill.NetAmount;
|
|
||||||
_controller.SetDiscount();
|
|
||||||
ShowInfo();
|
|
||||||
var printed = _controller.SaveAndPrintBill(isPrinted, amount);
|
|
||||||
if (!printed)
|
|
||||||
return;
|
|
||||||
if (_controller._editVoucherID.HasValue)
|
|
||||||
this.Close();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
var amount = _controller._bill.NetAmount;
|
||||||
|
_controller.SetDiscount();
|
||||||
ShowInfo();
|
ShowInfo();
|
||||||
FormState = SaleFormState.Waiting;
|
var printed = _controller.SaveAndPrintBill(isPrinted, amount);
|
||||||
|
if (printed)
|
||||||
|
{
|
||||||
|
if (_controller._editVoucherID.HasValue)
|
||||||
|
this.Close();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowInfo();
|
||||||
|
FormState = SaleFormState.Waiting;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
btnPrintBill.Enabled = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPrintKot_Click(object sender, EventArgs e)
|
private void btnPrintKot_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
btnPrintKot.Enabled = false;
|
||||||
var printed = _controller.SaveAndPrintKot();
|
var printed = _controller.SaveAndPrintKot();
|
||||||
if (!printed)
|
if (printed)
|
||||||
return;
|
|
||||||
if (_controller._editVoucherID.HasValue)
|
|
||||||
this.Close();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ShowInfo();
|
if (_controller._editVoucherID.HasValue)
|
||||||
FormState = SaleFormState.Waiting;
|
this.Close();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowInfo();
|
||||||
|
FormState = SaleFormState.Waiting;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
btnPrintKot.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnQuantity_Click(object sender, EventArgs e)
|
private void btnQuantity_Click(object sender, EventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user