private void button3_Click(object sender, EventArgs e) => Close(); //Exit private void button2_Click(object sender, EventArgs e) // Pay { if (dataGridView1.RowCount > 0) { while (true) { PaymentWindow source = new PaymentWindow(); source.UpdateTotal(String.Format("{0:0.00}", new Calculator().UpdatePayment(label6, label4))); source.ShowDialog(); if (source.getPayment() != "0.00") { label4.Text = new Calculator().AddPrevPayment(Convert.ToDouble(label4.Text), Convert.ToDouble(source.getPayment())); label6.Text = source.getDiscountedPrice(); } if (source.discountMode() == false) { Show(); break; } else { Hide(); DiscountPicker discPick = new DiscountPicker(); discPick.ShowDialog(); Show(); } } double change = new Calculator().ChangeCalculation(Convert.ToDouble(label4.Text), Convert.ToDouble(label6.Text)); label8.Text = String.Format("{0:0.00}", change); if (change >= 0.00) { string ORNOgenerated = new ORNOGEN().ORNOGENstring(); string Salesperson = new MainDatabase().InteractDB_getCurrentSalesPerson(); inventorySub(); logSales(ORNOgenerated); ReceiptWindow rw = new ReceiptWindow(); rw.setContents(dataGridView1); string VATpercent = Convert.ToString(Convert.ToDouble(getVatPercentage()) * 100); string DiscountPercent = getDiscPercentage(); double[] PriceList = getUpdatedValues(); rw.setTransactionDetails(ORNOgenerated, Salesperson, label4, label8, VATpercent, DiscountPercent, PriceList[0], PriceList[1], PriceList[2]); Hide(); rw.ShowDialog(); Show(); ClearAll(); } } }
//ADDS new BOOKING to booking table in DATABASE & opens RECEIPT window private void Checkout_Click(object sender, RoutedEventArgs e) { if (txtBlockNone.Visibility != Visibility.Visible) { MessageBoxResult mb = MessageBox.Show("Do you wish to checkout?", "Checkout Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (mb == MessageBoxResult.Yes) { ts.TotalCost = finalprice; var newWindow = new ReceiptWindow(color, ts.generateReceipt(username)); newWindow.Top = Window.GetWindow(this).Top; newWindow.Show(); } } else { MessageBox.Show("You have not selected any cart items", "Note"); } }