예제 #1
0
 private void ProductGridComboBind(string PLID)
 {
     try
     {
         DataTable tbl = new DataTable();
         this.clsPOS = new clsPOS();
         tbl         = this.clsPOS.CallProduct(PLID);
         //DataGridViewComboBoxCell colProduct = (DataGridViewComboBoxCell)(dgvSalesInfo.Rows[index].Cells["PName"]);
         cboProductName.DataSource    = tbl;
         cboProductName.DisplayMember = "PName";
         cboProductName.ValueMember   = "PID";
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message.ToString());
     }
 }
예제 #2
0
 private void ProductLineGridComboBind()
 {
     try
     {
         DataTable tbl = new DataTable();
         this.clsPOS = new clsPOS();
         tbl         = this.clsPOS.CallProductLine();
         //DataGridViewComboBoxColumn colProductLine = (DataGridViewComboBoxColumn)(dgvSalesInfo.Columns["PLName"]);
         cboProductLineName.DataSource    = tbl;
         cboProductLineName.DisplayMember = "PLName";
         cboProductLineName.ValueMember   = "PLID";
         cboProductLineName.SelectedIndex = -1;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message.ToString());
     }
 }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string tableID = cboTableNo.SelectedValue.ToString();

            clsPOS = new clsPOS();
            int salesID;

            if (this.frmMode == FormMode.New)
            {
                salesID = clsPOS.AutoID_Sales();
            }
            else
            {
                salesID = int.Parse(this.txtSalesID.Text.ToString());
            }
            clsPOS.SalesID    = salesID;
            clsPOS.TID        = tableID;
            clsPOS.SalesDate  = DateTime.Now;
            clsPOS.SalesDesc  = "-";
            clsPOS.CID        = "-";
            clsPOS.CreatedEID = this.EID;

            if (this.frmMode == FormMode.New)
            {
                clsPOS.Ins_Sales();
            }

            foreach (DataGridViewRow item in dgvSalesInfo.Rows)
            {
                string productID = item.Cells["colProductID"].Value.ToString();
                string quantity  = item.Cells["colQuantity"].Value.ToString();

                clsPOS = new clsPOS()
                {
                    SalesID    = salesID,
                    TID        = tableID,
                    SalesQty   = int.Parse(quantity),
                    SPID       = int.Parse(productID),
                    SalesDate  = DateTime.Now,
                    SalesDesc  = "-",
                    CID        = "-",
                    CreatedEID = this.EID,
                    Status     = 0
                };

                clsPOS.Ins_SalesDetail();

                clsPOS.WHID = 1;
                clsPOS.SPID = int.Parse(productID);
                int?invQty = clsPOS.SEL_PQty();

                if (this.frmMode == FormMode.Edit)
                {
                    DataTable tbl = new DataTable();
                    tbl = this.clsPOS.SEL_GetFQty();
                    if (tbl.Rows.Count > 0)
                    {
                        int fQty = int.Parse(tbl.Rows[0][0].ToString());
                        clsPOS.SalesQty = fQty;
                    }
                }

                if (invQty >= clsPOS.SalesQty)
                {
                    clsPOS.IQty = invQty - clsPOS.SalesQty;
                    clsPOS.UPD_Inventory();
                }
            }
            MessageBox.Show("Data has been saved successfully!", "EABBS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.newFormMode();
            //Showing Order List Process
        }