Exemplo n.º 1
0
        private void UpdateStock()
        {
            try
            {
                t_return_detail trans = new t_return_detail();
                trans.returnNo = txt_no.Text.Trim();
                List <t_return_detail> Transins = new List <t_return_detail>();
                Transins = new T_return_detailDL().SelectT_return_detailMulti(trans);

                foreach (t_return_detail det in Transins)
                {
                    T_Stock objt_Stock = new T_Stock();
                    objt_Stock.StockCode = det.stockCode;
                    objt_Stock.Compcode  = commonFunctions.GlobalCompany;
                    objt_Stock.Locacode  = commonFunctions.GlobalLocation;
                    objt_Stock           = new T_StockDL().Selectt_Stock_new(objt_Stock);

                    decimal currentst = decimal.Zero;
                    currentst        = commonFunctions.ToDecimal(objt_Stock.Stock.ToString()) - commonFunctions.ToDecimal(det.quantity.ToString());
                    objt_Stock.Stock = currentst;

                    new T_StockDL().SaveT_StockSP(objt_Stock, 3, 1);
                }
            }
            catch (Exception ex)
            {
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                throw ex;
            }
        }
Exemplo n.º 2
0
        private void GetStockdetails()
        {
            try
            {
                T_Stock stk = new T_Stock();
                stk.Locacode  = commonFunctions.GlobalLocation;
                stk.Compcode  = commonFunctions.GlobalCompany;
                stk.StockCode = txt_code.Text;
                stk           = new T_StockDL().Selectt_Stock_new(stk);

                txt_cost.Text      = stk.CostPrice.ToString();
                txt_selling.Text   = stk.SellingPrice.ToString();
                lbl_name.Text      = stk.Descr;
                lbl_available.Text = stk.Stock.ToString();
            }
            catch (Exception ex)
            {
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void UpdateStock()
        {
            try
            {
                t_adjustment_details trans = new t_adjustment_details();
                trans.adju_no = txt_no.Text.Trim();
                List <t_adjustment_details> Transins = new List <t_adjustment_details>();
                Transins = new T_adjustment_detailDL().SelectT_adjustment_detailMulti(trans);

                foreach (t_adjustment_details det in Transins)
                {
                    T_Stock objt_Stock = new T_Stock();
                    objt_Stock.StockCode = det.item_code;
                    objt_Stock.Compcode  = commonFunctions.GlobalCompany;
                    objt_Stock.Locacode  = commonFunctions.GlobalLocation;
                    objt_Stock           = new T_StockDL().Selectt_Stock_new(objt_Stock);

                    decimal currentst = decimal.Zero;
                    //currentst = commonFunctions.ToDecimal(objt_Stock.Stock.ToString()) + commonFunctions.ToDecimal(det.stock.ToString());
                    currentst = objt_Stock.Stock.Value;
                    if (det.triggerVal == 1)
                    {
                        currentst += det.stock.Value;
                    }
                    if (det.triggerVal == 2)
                    {
                        currentst -= det.stock.Value;
                    }
                    objt_Stock.Stock = currentst;

                    new T_StockDL().SaveT_StockSP(objt_Stock, 3, 1);
                }
            }
            catch (Exception ex)
            {
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                throw ex;
            }
        }
Exemplo n.º 4
0
        private void UpdateStock()
        {
            try
            {
                t_transferIn_detail trans = new t_transferIn_detail();
                trans.transinrNo = txt_no.Text.Trim();
                List <t_transferIn_detail> Transins = new List <t_transferIn_detail>();
                Transins = new T_transferIn_detailDL().SelectT_transferIn_detailMulti(trans);

                foreach (t_transferIn_detail det in Transins)
                {
                    //reduce stock from this location
                    T_StockDL.AddStock_Update(det.stockCode, commonFunctions.GlobalCompany, commonFunctions.GlobalLocation, det.quantity.Value);

                    //update stock on destination
                    if (T_StockDL.ExistingT_Stock_new(det.stockCode.Trim(), commonFunctions.GlobalCompany, txt_destinationLocId.Text.Trim()))
                    {
                        //modify is already has record
                        T_StockDL.ReduceStock_Update(det.stockCode, commonFunctions.GlobalCompany, txt_destinationLocId.Text.Trim(), det.quantity.Value);
                    }
                    else
                    {
                        //insert
                        T_Stock objt_Stock = new T_Stock();
                        objt_Stock.StockCode = det.stockCode;
                        objt_Stock.Compcode  = commonFunctions.GlobalCompany;
                        objt_Stock.Locacode  = commonFunctions.GlobalLocation;
                        objt_Stock           = new T_StockDL().Selectt_Stock_new(objt_Stock);
                        T_StockDL.AddStock_Insert(objt_Stock, commonFunctions.GlobalCompany, txt_destinationLocId.Text.Trim(), det.quantity.Value);
                    }
                }
            }
            catch (Exception ex)
            {
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                throw ex;
            }
        }
Exemplo n.º 5
0
        private void txt_code_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (txt_destinationLocId.Text.Trim() == string.Empty)
                {
                    errorProvider1.SetError(txt_destinationLocId, "Please enter destination location code");
                    return;
                }
                if (ActiveControl.Name.Trim() == txt_code.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductStockFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductStockSQL"].ToString() + " WHERE T_Stock.Locacode = '" + txt_destinationLocId.Text.Trim() + "'";

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductStockField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
                errorProvider1.Clear();
            }

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    //txt_code.Text = commonFunctions.GetProcutCode(txt_code.Text.Trim());
                    if (T_StockDL.ExistingT_Stock_new(txt_code.Text, commonFunctions.GlobalCompany, commonFunctions.GlobalLocation))
                    {
                        if (!commonFunctions.IsExist(dataGridView1, txt_code.Text))
                        {
                            GetStockdetails(txt_destinationLocId.Text.Trim());
                            txt_qty.Text = "0";
                            txt_qty.Focus();

                            errorProvider1.Clear();
                            already = false;
                        }
                        else
                        {
                            already = true;
                            GetStockdetails(txt_destinationLocId.Text.Trim());

                            DataGridViewRow drowx = new DataGridViewRow();
                            drowx = commonFunctions.GetRow(dataGridView1, txt_code.Text.Trim());

                            txt_qty.Text = drowx.Cells["Quntity"].Value.ToString();

                            txt_qty.Focus();
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(txt_code, "Product you have entered not exist in the bin card");
                        commonFunctions.SetMDIStatusMessage("Product you have entered not exist in the bin card", 1);
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error", 1);
                    throw ex;
                }
            }
        }
        private void txt_code_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_code.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                //FindExisitingSupplier();
                errorProvider1.Clear();
            }

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    //txt_code.Text = commonFunctions.GetProcutCode(txt_code.Text.Trim());
                    if (T_StockDL.ExistingT_Stock_Product(txt_code.Text, commonFunctions.GlobalCompany, commonFunctions.GlobalLocation))
                    {
                        if (!commonFunctions.IsExistINV(dataGridView1, txt_code.Text))
                        {
                            M_Products stk = new M_Products();
                            stk.Locacode = commonFunctions.GlobalLocation;
                            stk.Compcode = commonFunctions.GlobalCompany;
                            stk.IDX      = txt_code.Text;
                            stk          = new M_ProductDL().Selectm_Product(stk);

                            txt_cost.Text    = stk.CostPrice.ToString();
                            txt_selling.Text = stk.SellingPrice.ToString();
                            lbl_name.Text    = stk.Namex;

                            txt_qty.Text = "0";
                            txt_qty.Focus();

                            errorProvider1.Clear();
                            already = false;
                        }
                        else
                        {
                            already = true;
                            //errorProvider1.SetError(txt_code, "Already exists");
                            M_Products stk = new M_Products();
                            stk.Locacode = commonFunctions.GlobalLocation;
                            stk.Compcode = commonFunctions.GlobalCompany;
                            stk.IDX      = txt_code.Text;
                            stk          = new M_ProductDL().Selectm_Product(stk);

                            txt_cost.Text    = stk.CostPrice.ToString();
                            txt_selling.Text = stk.SellingPrice.ToString();
                            lbl_name.Text    = stk.Namex;

                            DataGridViewRow drowx = new DataGridViewRow();
                            drowx = commonFunctions.GetRow(dataGridView1, txt_code.Text.Trim());

                            txt_qty.Text = drowx.Cells["Quntity"].Value.ToString();

                            txt_qty.Focus();
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(txt_code, "Product you have entered not exist in the product master file");
                        commonFunctions.SetMDIStatusMessage("Product you have entered not exist in the product master file", 1);
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error", 2);
                }
            }
        }