private void btnPrintReceipt_Click(object sender, RoutedEventArgs e) { if (balanceDue >= 0) { printMan.itemNames = names.ToArray(); printMan.itemPrices = prices.ToArray(); printMan.itemQtys = quantities.ToArray(); printMan.gsTotal = totalDue; printMan.gsBalance = balanceDue; printMan.gsPaid = paidAmount; if (StockChecker.getInstance().checkStock(names.ToArray()).Length < 1) { printMan.callPrintReceipt(); if (PrintSuccess.getInstance().gsIsPrintSuccessfull == true) { SalesUpdate.getInstance().gsSoldItemNames = names.ToArray(); SalesUpdate.getInstance().gsSoldItemPrices = prices.ToArray(); SalesUpdate.getInstance().gsSoldItemQuantities = quantities.ToArray(); SalesUpdate.getInstance().updateSales(); names.Clear(); quantities.Clear(); prices.Clear(); //new Checkout().ShowDialog(); //MainWindow.getInstance().Activate(); //this.Close(); } } else { MessageBox.Show("The CheckOut failed Due to Insuffecient Stock For The Following Items: " + " " + string.Join(",", StockChecker.getInstance().checkStock(names.ToArray())) + " Please Restock " + " And Retry", "Insuffecient Stock", MessageBoxButton.OK); names.Clear(); quantities.Clear(); prices.Clear(); } } else { MessageBox.Show("The Amount Paid is Insuffecient. Please top up to avoid loss", "Warning: Insuffecient Funds", MessageBoxButton.OK, MessageBoxImage.Warning); } }
protected virtual void OnPrintSuccess(PrinterEventArgs e) { PrintSuccess?.Invoke(this, e); }