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();
        }
Example #2
0
 public void RegisterCustomer(object sender, System.EventArgs e)
 {
     if (!(POS_Model.getItemName().Count == 0))
     {
         MessageBox.Show("Please finish all transaction first");
     }
 }
Example #3
0
 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();
     }
 }
Example #4
0
        public void UpdateChecker()
        {
            /*
             * --Update unit left in DB--
             * Reusable updating unit left
             * in DB from 2 models (POS and Stock)
             */
            POS_DB pos_db = new POS_DB();

            for (int count = 0; count < ItemsModel.getItemName().Count; count++)
            {
                pos_db.UpdateDataUnitLeft(
                    ItemsModel.getCode()[count].ToString(),
                    StockModel.getUnitLeft()[
                        StockModel.getCode().IndexOf(
                            ItemsModel.getCode()[count].ToString()
                            )
                    ].ToString()
                    );
            }
        }