private void loadBillDataById() { BillInfo _billInfo = new BllBillInfo().GetById(_billId); txtBillNo.Text = "B" + _billId; cmbWaiter.SelectedValue = _billInfo.WaiterId; cmbServiceType.SelectedValue = _billInfo.ServiceTypeId; cmbTableNo.SelectedValue = _billInfo.TableId; txtKotNo.Text = _billInfo.KotNo; cmbPaymentType.SelectedValue = _billInfo.ServiceTypeId; List <BillDetails> listBillDetails = new BllTempBillDetails().GetBillDetailsListByBillId(_billId); ListView1.Items.Clear(); for (int i = 0; i < listBillDetails.Count; i++) { ListViewItem lst = new ListViewItem(); lst.SubItems.Add(listBillDetails[i].MenuItemId.ToString()); lst.SubItems.Add(listBillDetails[i].MenuItemName.ToString()); lst.SubItems.Add(listBillDetails[i].UnitPrice.ToString()); lst.SubItems.Add(listBillDetails[i].Quantity.ToString()); lst.SubItems.Add(listBillDetails[i].TotalPrice.ToString()); ListView1.Items.Add(lst); txtSubTotal.Text = subtot().ToString(); Calculate(); } //setChargeValues(); txtDiscountPer.Text = _billInfo.DiscountPercent.ToString(); txtServiceChargePer.Text = _billInfo.ServiceChargePercent.ToString(); txtTaxPer.Text = _billInfo.VatPercent.ToString(); //cmbMenuItem.Focus(); txtMenuCode.Focus(); }
private void loadBillDataById() { BillInfo _billInfo = new BllBillInfo().GetById(_billId); txtBillNo.Text = "B" + _billId; cmbWaiter.SelectedValue = _billInfo.WaiterId; cmbServiceType.SelectedValue = _billInfo.ServiceTypeId; cmbTableNo.SelectedValue = _billInfo.TableId; txtKotNo.Text = _billInfo.KotNo; cmbPaymentType.SelectedValue = _billInfo.ServiceTypeId; List<BillDetails> listBillDetails = new BllTempBillDetails().GetBillDetailsListByBillId(_billId); ListView1.Items.Clear(); for (int i = 0; i < listBillDetails.Count; i++) { ListViewItem lst = new ListViewItem(); lst.SubItems.Add(listBillDetails[i].MenuItemId.ToString()); lst.SubItems.Add(listBillDetails[i].MenuItemName.ToString()); lst.SubItems.Add(listBillDetails[i].UnitPrice.ToString()); lst.SubItems.Add(listBillDetails[i].Quantity.ToString()); lst.SubItems.Add(listBillDetails[i].TotalPrice.ToString()); ListView1.Items.Add(lst); txtSubTotal.Text = subtot().ToString(); Calculate(); } //setChargeValues(); txtDiscountPer.Text = _billInfo.DiscountPercent.ToString(); txtServiceChargePer.Text = _billInfo.ServiceChargePercent.ToString(); txtTaxPer.Text = _billInfo.VatPercent.ToString(); //cmbMenuItem.Focus(); txtMenuCode.Focus(); }
private void cmbTableNo_SelectedIndexChanged(object sender, EventArgs e) { //Reset(); int tableId = 0; try { tableId = Convert.ToInt32(cmbTableNo.SelectedValue); } catch { //tableId = 1; return; } _billId = new BllBillInfo().GetOpenBillIdByTableId(tableId); if (_billId == 0) { Reset(); } else { Reset(); loadBillDataById(); //cmbMenuItem.Focus(); txtMenuCode.Focus(); } }
private void btnAddToCart_Click(object sender, EventArgs e) { try { if (cmbTableNo.Text == "") { KryptonMessageBox.Show("Please select Table", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (cmbMenuItem.Text == "") { KryptonMessageBox.Show("Please select product name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtSaleQty.Text == "") { KryptonMessageBox.Show("Please enter quantity", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSaleQty.Focus(); return; } int SaleQty = Convert.ToInt32(txtSaleQty.Text); if (SaleQty == 0) { KryptonMessageBox.Show("no. of quantity can not be zero", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSaleQty.Focus(); return; } if (txtKotNo.Text.Trim() == "") { KryptonMessageBox.Show("Please enter KOT No.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtKotNo.Focus(); return; } int parsedValue; if (!int.TryParse(txtPax.Text, out parsedValue)) { KryptonMessageBox.Show("Please enter valid PAX.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPax.Focus(); return; } btnRemove.Enabled = false; //cmbMenuItem.Focus(); txtMenuCode.Focus(); if (ListView1.Items.Count == 0) { ListViewItem lst = new ListViewItem(); lst.SubItems.Add(cmbMenuItem.SelectedValue.ToString()); lst.SubItems.Add(cmbMenuItem.Text); lst.SubItems.Add(txtPrice.Text); lst.SubItems.Add(txtSaleQty.Text); lst.SubItems.Add(txtTotalAmount.Text); ListView1.Items.Add(lst); txtSubTotal.Text = subtot().ToString(); Calculate(); BillInfo billInfo = createBillInfoObject(); _billId = new BllBillInfo().InsertOrUpdate(billInfo); txtBillNo.Text = "B" + _billId.ToString(); BillDetails billDetails = new BillDetails(); billDetails.BillId = _billId; billDetails.MenuItemId = Convert.ToInt32(cmbMenuItem.SelectedValue.ToString()); billDetails.Quantity = Convert.ToInt32(txtSaleQty.Text); billDetails.UnitPrice = Convert.ToDecimal(txtPrice.Text); billDetails.IsDiscountAvailable = false; billDetails.TotalPrice = Convert.ToDecimal(txtTotalAmount.Text); billDetails.ReceivedBy = BaseObject.User_ID; billDetails.IsDeleted = false; new BllTempBillDetails().InsertOrUpdate(billDetails); cmbMenuItem.Text = ""; txtPrice.Text = ""; txtSaleQty.Text = ""; txtTotalAmount.Text = ""; return; } for (int j = 0; j <= ListView1.Items.Count - 1; j++) { if (ListView1.Items[j].SubItems[1].Text == cmbMenuItem.SelectedValue.ToString()) { ListView1.Items[j].SubItems[1].Text = cmbMenuItem.SelectedValue.ToString(); ListView1.Items[j].SubItems[2].Text = cmbMenuItem.Text; ListView1.Items[j].SubItems[3].Text = txtPrice.Text; ListView1.Items[j].SubItems[4].Text = (Convert.ToInt32(ListView1.Items[j].SubItems[4].Text) + Convert.ToInt32(txtSaleQty.Text)).ToString(); ListView1.Items[j].SubItems[5].Text = (Convert.ToDecimal(ListView1.Items[j].SubItems[5].Text) + Convert.ToDecimal(txtTotalAmount.Text)).ToString(); txtSubTotal.Text = subtot().ToString(); Calculate(); BillDetails billDetails = new BillDetails(); billDetails.BillId = _billId; billDetails.MenuItemId = Convert.ToInt32(cmbMenuItem.SelectedValue.ToString()); billDetails.Quantity = Convert.ToInt32(ListView1.Items[j].SubItems[4].Text); billDetails.UnitPrice = Convert.ToDecimal(ListView1.Items[j].SubItems[3].Text); billDetails.IsDiscountAvailable = false; billDetails.TotalPrice = Convert.ToDecimal(ListView1.Items[j].SubItems[5].Text); billDetails.ReceivedBy = BaseObject.User_ID; billDetails.IsDeleted = false; new BllTempBillDetails().InsertOrUpdate(billDetails); BillInfo billInfo = createBillInfoObject(); new BllBillInfo().InsertOrUpdate(billInfo); cmbMenuItem.Text = ""; txtPrice.Text = ""; txtSaleQty.Text = ""; txtTotalAmount.Text = ""; return; } } ListViewItem lst1 = new ListViewItem(); lst1.SubItems.Add(cmbMenuItem.SelectedValue.ToString()); lst1.SubItems.Add(cmbMenuItem.Text); lst1.SubItems.Add(txtPrice.Text); lst1.SubItems.Add(txtSaleQty.Text); lst1.SubItems.Add(txtTotalAmount.Text); ListView1.Items.Add(lst1); txtSubTotal.Text = subtot().ToString(); Calculate(); BillDetails billDetails2 = new BillDetails(); billDetails2.BillId = _billId; billDetails2.MenuItemId = Convert.ToInt32(cmbMenuItem.SelectedValue.ToString()); billDetails2.Quantity = Convert.ToInt32(txtSaleQty.Text); billDetails2.UnitPrice = Convert.ToDecimal(txtPrice.Text); billDetails2.IsDiscountAvailable = false; billDetails2.TotalPrice = Convert.ToDecimal(txtTotalAmount.Text); billDetails2.ReceivedBy = BaseObject.User_ID; billDetails2.IsDeleted = false; new BllTempBillDetails().InsertOrUpdate(billDetails2); BillInfo billInfo2 = createBillInfoObject(); new BllBillInfo().InsertOrUpdate(billInfo2); cmbMenuItem.Text = ""; txtPrice.Text = ""; txtSaleQty.Text = ""; txtTotalAmount.Text = ""; return; } catch (Exception ex) { KryptonMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }