private void FillListView(int ReservationID) { lvBestellingen.Items.Clear(); Payment_Service payment_Service = Payment_Service.GetPaymentService(); List <OrderDetails> orderDetails = payment_Service.GetOrderDetails(ReservationID); foreach (OrderDetails od in orderDetails) { ListViewItem li = new ListViewItem(od.MenuItemName); li.SubItems.Add(od.Amount.ToString()); li.SubItems.Add(od.Price.ToString()); lvBestellingen.Items.Add(li); } double totaalbedrag = 0; foreach (ListViewItem li in lvBestellingen.Items) { totaalbedrag += (double.Parse(li.SubItems[1].Text) * double.Parse(li.SubItems[2].Text)); } lbl_Totaalbedrag.Text = totaalbedrag.ToString(); totaalbedrag = totaalbedrag * 0.21; lbl_BTW.Text = totaalbedrag.ToString(); lvBestellingen.Refresh(); }
private void FillFinancialsList() { Payment_Service payment_Service = new Payment_Service(); paymentList = payment_Service.Db_Get_PaymentHistory(monthCalendarFrom.SelectionStart, monthCalendarTill.SelectionStart); FillPaymentListview(); }
private void FillListView(int ReservationID) { lvBestellingen.Items.Clear(); Payment_Service payment_Service = Payment_Service.GetPaymentService(); List <OrderDetails> orderDetails = payment_Service.GetOrderDetails(ReservationID); double btw = 0.09; double btw_total = 0; foreach (OrderDetails od in orderDetails) { if (od.MenuTypeID == 2) { btw = 0.21; } double btw_price = double.Parse(od.Price.ToString()) * btw; btw_total += btw_price; ListViewItem li = new ListViewItem(od.MenuItemName); li.SubItems.Add(od.Amount.ToString()); li.SubItems.Add(od.Price.ToString("0.00")); li.SubItems.Add(btw_price.ToString("0.00")); lvBestellingen.Items.Add(li); } double totaalbedrag = 0; foreach (ListViewItem li in lvBestellingen.Items) { totaalbedrag += (double.Parse(li.SubItems[1].Text) * double.Parse(li.SubItems[2].Text)); } lbl_exBedrag.Text = (totaalbedrag - btw_total).ToString("0.00"); lbl_BTW.Text = btw_total.ToString("0.00"); lbl_inclBedrag.Text = totaalbedrag.ToString("0.00"); lvBestellingen.Refresh(); }
//Accesses DB to get all nesessary information for the OrderId that was passed from the Order screen private void ShowData() { //Accesses the data for the database Payment_Service paymentService = new Payment_Service(); Payment payment = paymentService.GetPayment(currentOrderId); //Clears items in case it was not from a previous payment viewing listView_payments.Items.Clear(); //Makes the database payment the currentPayment object currentPayment = payment; //Adds records of data to the listview lbl_paymentTable.Text = payment.Order.Table.tableId.ToString(); lbl_date.Text = payment.Order.DateTime.ToString("dd/MM/yyyy HH:mm:ss"); lbl_orderPrice.Text = payment.TotalPrice.ToString("€ 0.00"); lbl_vat.Text = payment.TotalVAT.ToString("€ 0.00"); textBox_totalPrice.Text = (payment.TotalPrice + payment.TotalVAT).ToString("0.00"); //Adds each order item to the listview foreach (OrderItem item in payment.Order.ListOrderItems) { string[] row = { item.menuItem.Name, item.amount.ToString(), item.menuItem.Price.ToString(), item.status.ToString() }; listView_payments.Items.Add(new ListViewItem(row)); } }
private void FillComboBox() //combobox vullen met alle tafelnummers { Payment_Service payment_Service = Payment_Service.GetPaymentService(); List <int> ids = payment_Service.GetAllReservationID();; foreach (int i in ids) { comboBoxGetReservation.Items.Add(i.ToString()); } }
//The payment button when a waiter/waitress wants to bill a customer/table private void btn_bill_Click(object sender, EventArgs e) { //Checks which payment method is used, else they are warned if (rbtn_cash.Checked) { currentPayment.PaymentMethod = PaymentMethodEnum.Cash; } else if (rbtn_pin.Checked) { currentPayment.PaymentMethod = PaymentMethodEnum.Pin; } else if (rbtn_credit.Checked) { currentPayment.PaymentMethod = PaymentMethodEnum.Credit; } else { lbl_paymentMethodWarning.Text = "Select a payment method"; return; } if (currentPayment.TipAmount < 0) { return; } //If incorrect format, just sets tip to 0 try { currentPayment.TipAmount = decimal.Parse(textBox_tip.Text); } catch (Exception) { currentPayment.TipAmount = 0; } //Puts remaining data in the payment object currentPayment.Feedback = textBox_comments.Text; //Puts new payment/bill in the database and sets order to paid Payment_Service paymentService = new Payment_Service(); paymentService.PayBill(currentPayment); //UI to help show user that bill is paid btn_bill.Hide(); lbl_billSuccess.Show(); }
public PaymentController() { this.payFastSettings = new PayFastSettings { MerchantId = ConfigurationManager.AppSettings["MerchantId"], MerchantKey = ConfigurationManager.AppSettings["MerchantKey"], PassPhrase = ConfigurationManager.AppSettings["PassPhrase"], ProcessUrl = ConfigurationManager.AppSettings["ProcessUrl"], ValidateUrl = ConfigurationManager.AppSettings["ValidateUrl"], ReturnUrl = ConfigurationManager.AppSettings["ReturnUrl"], CancelUrl = ConfigurationManager.AppSettings["CancelUrl"], NotifyUrl = ConfigurationManager.AppSettings["NotifyUrl"] }; order_Service = new Order_Service(); payment_Service = new Payment_Service(); }
private void btn_afreken_Click(object sender, EventArgs e) { Payment_Service payment_Service = Payment_Service.GetPaymentService(); if (radioButtonPIN.Checked || radioButtonContant.Checked) { double Money; bool res = double.TryParse(textBoxFooi.Text, out Money); if (res == false) { Money = 0; } else { Money = double.Parse(textBoxFooi.Text); if (Money < 0) { Money = 0; } } int Payment; if (radioButtonPIN.Checked) { Payment = 2; } else { Payment = 3; } payment_Service.PlacePayment(Money, Payment); MessageBox.Show("Bestelling afgerekend.", "Gelukt!", MessageBoxButtons.OK, MessageBoxIcon.Information); Tafeloverzicht tafeloverzicht = Tafeloverzicht.GetTafeloverzichtScreen(); tafeloverzicht.Show(); tafeloverzicht.RefreshListView(); this.Hide(); } else { MessageBox.Show("Kies een betaalmethode.", "Foutmelding", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CreatePayment() { if ((RadioContant.Checked is true) | (radioCreditcard.Checked is true) | (radioPinpas.Checked is true)) { PayMethod paymethod; if (RadioContant.Checked is true) { paymethod = PayMethod.Contant; } else if (radioPinpas.Checked is true) { paymethod = PayMethod.Pinpas; } else { paymethod = PayMethod.Creditcard; } ChapooLogic.Payment_Service payment_Service = new Payment_Service(); Payment payment = new Payment() { Order = _currentOrder, Table = _currentOrder.Table, PayStatus = PayStatus.Betaald, PayMethod = paymethod, Comment = TextBoxOpmerking.Text, Employee = _CurrentEmployee, TotalPrice = _currentOrder.TotalPrice + numericUpDownFooi.Value, Tip = numericUpDownFooi.Value, TotalVAT = _currentOrder.TotalVAT, Payment_DateTime = DateTime.Now }; payment_Service.DB_Create_New_Payment(payment); FillBillList(); FillListview(); MessageBox.Show($"Betaling van tafelnummer {_currentOrder.Table.Table_ID} is afgerekend", "Chapoo afrekenen", MessageBoxButtons.OK, MessageBoxIcon.Information); }