//add item to the list private void addItemToTheList(MDB_ProductModel product) { //create new product MDB_SingleItemSale item = new MDB_SingleItemSale() { id = product.id, item_id = product.id, name = this.getSimpleName(product.name), //product.name,//remove all the app price = product.retail_price, discount = product.discount_amt, //if product is on offer vat = (product.vat_inclusive == 1)? Convert.ToSingle((product.retail_price * 0.18)) : product.vat_amt, //product.vat_amt, vat_inclusive = product.vat_inclusive, qty = 1 }; //MessageBox.Show(item.name); //itemsListForReceipt.Add(item); itemsListForReceipt.Insert(0, item); itemsForReceiptDataGridView.Update(); itemsForReceiptDataGridView.Refresh(); //refresh the list this.do_calculations(); //command the parent form to clear the search for the next scan POSForm pf = (POSForm)this.ParentForm; pf.connect_receipt_2_store_clear_search_Key(); }//
private void gunaButton1_Click(object sender, EventArgs e) { txtqty.Text = lblcurrentqty.Text; if (CheckAndGetMiscID(miscitem)) { if (CheckQty()) { POSForm f2 = (POSForm)Application.OpenForms["POSForm"]; f2.POSForm_Load(f2, EventArgs.Empty); } } }
// //update the existing item private void updateTheExistingProduct(MDB_ProductModel product) { /*MessageBox.Show(itemsListForReceipt.Count + " items"); * List<M_ReceiptDataModel> list = itemsListForReceipt.ToList(); * //check if item is present in the list item * M_ReceiptDataModel existing_product = list.Find(i => i.item_id == product.id); * if (existing_product != null) * { * //item already exists * list.Where(i => i.item_id == existing_product.item_id).ToList().ForEach(s => s.Qty = existing_product.Qty + 1); * itemsListForReceipt = new BindingList<M_ReceiptDataModel>(list); * * itemsForReceiptDataGridView.Update(); * itemsForReceiptDataGridView.Refresh(); //refresh the list * this.do_calculations(); * } * else { MessageBox.Show("Is null"); }*/ /*List<M_ReceiptDataModel> list = itemsListForReceipt.ToList(); * for (int i = 0; i < list.Count; i++) * { * if (Convert.ToInt32(list[i].item_id) == Convert.ToInt32(product.id)) * { * // MessageBox.Show(list.Count + " items f"); * //update * list[i].Qty = list[i].Qty + 1; * itemsListForReceipt = new BindingList<M_ReceiptDataModel>(list);//update entirelist * // break; * } * } * itemsForReceiptDataGridView.Update(); * itemsForReceiptDataGridView.Refresh(); //refresh the list * this.do_calculations();*/ List <MDB_SingleItemSale> list = itemsListForReceipt.ToList(); for (int i = 0; i < itemsListForReceipt.Count; i++) { if (Convert.ToInt32(itemsListForReceipt[i].id) == Convert.ToInt32(product.id)) { //update itemsListForReceipt[i].qty = itemsListForReceipt[i].qty + 1; break; } } itemsForReceiptDataGridView.Update(); itemsForReceiptDataGridView.Refresh(); //refresh the list this.do_calculations(); //command the parent form to clear the search for the next scan POSForm pf = (POSForm)this.ParentForm; pf.connect_receipt_2_store_clear_search_Key(); }
// -1 ,0 pending ,1-success public void Connecter_in_internal_order_status_results(int status) { //TODO:: check status if (status == 0) { this.clearAllItems(); POSForm pf = (POSForm)this.ParentForm; pf.connect_receipt_2_store_clear_search_Key_after_sale(); } else { } }
private void gunaButton3_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(lblqty.Text) && !string.IsNullOrEmpty(txtqty.Text)) { if (CheckAndGetMiscID(miscitem)) { if (CheckQty()) { POSForm f2 = (POSForm)Application.OpenForms["POSForm"]; f2.POSForm_Load(f2, EventArgs.Empty); } } } }
}// private void clearAllItems() { //command the parent form to clear the search for the next scan POSForm pf = (POSForm)this.ParentForm; pf.connect_receipt_2_store_clear_search_Key(); this.itemsListForReceipt.Clear(); itemsForReceiptDataGridView.DataSource = itemsListForReceipt; itemsForReceiptDataGridView.Refresh(); this.ITEM_COUNTER = 0; this.qtyCounterNumericUpDown.Value = 1; this.do_calculations(); }
}// #region UI CLICKS private void UI_BTN_CLICKS(object sender, EventArgs e) { // Button input = (Button)sender; switch (input.Name) { case "clearOrderBtn": { this.clearAllItems(); break; } case "removeItemBtn": { //int id = this.getCurrentSelectedIdFromGridView(); //this.removeItemFromTheList(id); break; } case "completeOrder": { if (this.itemsListForReceipt.Count != 0) { CompleteOrderForm frm = new CompleteOrderForm(this, this.itemsListForReceipt.ToList()); frm.ShowDialog(); } break; } case "applyQtyBtn": int qty = Convert.ToInt32(qtyCounterNumericUpDown.Value); applyQtyToSelectedItem(qty); POSForm pf = (POSForm)this.ParentForm; pf.connect_receipt_2_store_clear_search_Key(); break; case "x": break; //applyQtyBtn } }
private void buttonItemPOS_Click(object sender, EventArgs e) { POSForm frm = new POSForm(); CheckFormStatus(frm); }