public void AppendCredit() { //Update unit left in DB Update_UnitLeft update_unitLeft = new Update_UnitLeft( ItemsModel, StockModel ); update_unitLeft.UpdateChecker(); POS_DB pos_db = new POS_DB(); for (int count = 0; count < ItemsModel.getItemName().Count; count++) { pos_db.AddToCredit( CB_CustomerList.Text.Split('/')[1], ItemsModel.getItemName()[count].ToString(), ItemsModel.getCode()[count].ToString(), ItemsModel.getPrice()[count].ToString(), DateTime.Now.ToString(), ItemsModel.getUnit()[count].ToString(), "Unpaid", dh.getUsername() + "/" + dh.getUserFullName(), RTB_Description.Text); } MessageBox.Show("Successfuly added " + ItemsModel.getItemName().Count + " items to" + CB_CustomerList.Text.Split('/')[0] + " as credit!"); ItemsModel.ClearCart(); pos.AddItemsData(); }
public void AddItemsData() { this.DGV_Items.Rows.Clear(); for (int count = 0; count < ItemsModel.getItemName().Count; count++) { int id = int.Parse(ItemsModel.getStockID()[count].ToString()); string ItemName = ItemsModel.getItemName()[count].ToString(); string Price = ItemsModel.getPrice()[count].ToString(); string Unit = ItemsModel.getUnit()[count].ToString(); string Total = (Double.Parse(ItemsModel.getPrice()[count].ToString()) * int.Parse(ItemsModel.getPrice()[count].ToString())).ToString("N0"); string POS_item_id = ItemsModel.getPOS_itemID()[count].ToString(); DGV_Items.Rows.Add( id, ItemName, Price, Unit, Total, POS_item_id ); } if (ItemsModel.getItemName().Count == 0) { LabelTotal.Text = "----"; } else { SetTotal(); } }