Ejemplo n.º 1
0
        private void FillBranchGroupData()
        {
            IndentDB objIndent = new IndentDB();

            try
            {
                cbGroup.DataSource = null;
                cbGroup.Items.Clear();
                DataTable dtGroup = objIndent.IndentGroupList_Get(CommonData.CompanyCode.ToString(), CommonData.BranchCode, CommonData.DocMonth).Tables[0];
                if (dtGroup.Rows.Count > 0)
                {
                    foreach (DataRow dataRow in dtGroup.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        string[]            ename  = dataRow["ENAME"].ToString().Split('~');
                        oclBox.Tag  = dataRow["ENAME"].ToString();
                        oclBox.Text = dataRow["GroupName"].ToString();
                        cbGroup.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
                dtGroup = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objIndent = null;
            }
        }
Ejemplo n.º 2
0
        private void FillBranchData()
        {
            IndentDB objIndent = new IndentDB();

            try
            {
                DataTable dtBranch = objIndent.IndentStockPointList_Get(CommonData.CompanyCode.ToString()).Tables[0];
                DataRow   dr       = dtBranch.NewRow();
                dr[0] = "0";
                dr[1] = "Select";
                dtBranch.Rows.InsertAt(dr, 0);
                dr = null;
                if (dtBranch.Rows.Count > 0)
                {
                    foreach (DataRow dataRow in dtBranch.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = dataRow["branch_code"].ToString();
                        oclBox.Text = dataRow["branch_name"].ToString();
                        cbBranches.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objIndent = null;
            }
        }
Ejemplo n.º 3
0
        private void FillBranchData()
        {
            IndentDB objIndent = new IndentDB();

            try
            {
                DataTable dtBranch = objIndent.IndentStockPointList_Get(CommonData.CompanyCode.ToString()).Tables[0];
                if (dtBranch.Rows.Count > 0)
                {
                    foreach (DataRow dataRow in dtBranch.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = dataRow["branch_code"].ToString();
                        oclBox.Text = dataRow["branch_name"].ToString();
                        cbBranches.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (cbBranches.SelectedIndex > -1)
                {
                    strBranchCode = ((System.Data.DataRowView)(cbBranches.SelectedItem)).Row.ItemArray[0].ToString();
                    FillBranchGroupData();
                }
                objIndent = null;
            }
        }
Ejemplo n.º 4
0
        private void FillTransactionData(string strCmpCode, string strBrCode, string strFinYear, string strTranNo, string sFrom)
        {
            objIndent = new IndentDB();
            Hashtable ht = new Hashtable();

            try
            {
                ht = objIndent.GetGRNInputBranchData(strCmpCode, strBrCode, strFinYear, strTranNo, "");

                DataTable dtH = (DataTable)ht["Head"];
                DataTable dtD = (DataTable)ht["Detail"];
                FillTransactionHead(dtH, dtD);
                dtH = null;
                dtD = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objIndent = null;
                ht        = null;
            }
        }
Ejemplo n.º 5
0
        private DataTable checkCombiHavingProducts()
        {
            objInv = new IndentDB();
            DataTable dt = new DataTable();
            string    sSingleProducts = "";

            //bool bFlag = true;

            try
            {
                if (flagUpdate == false)
                {
                    for (int iVar = 0; iVar < gvProductDetails.Rows.Count; iVar++)
                    {
                        sSingleProducts += gvProductDetails.Rows[iVar].Cells["ProductId"].Value.ToString() +
                                           "(" + gvProductDetails.Rows[iVar].Cells["ProdQty"].Value.ToString() + ")" + ",";
                    }
                    sSingleProducts = sSingleProducts.Remove(sSingleProducts.Length - 1);

                    dt = objInv.Get_CombiHavingProducts(sSingleProducts).Tables[0];
                    return(dt);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objInv = null;
                // dt = null;
            }
            return(dt);
        }
Ejemplo n.º 6
0
        private void FillProducts()
        {
            objIndent = new IndentDB();
            DataSet ds            = new DataSet();
            string  strCategoryId = string.Empty;

            tvProducts.Nodes.Clear();
            TreeNode tNode;

            tNode = tvProducts.Nodes.Add("Products");
            try
            {
                ds = objIndent.ProductList_Get(sCompany, strCategoryId);


                Int16 intNode = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (strCategoryId != ds.Tables[0].Rows[i]["CategoryID"].ToString())
                        {
                            strCategoryId = ds.Tables[0].Rows[i]["CategoryID"].ToString();
                            tvProducts.Nodes[0].Nodes.Add(ds.Tables[0].Rows[i]["CategoryID"].ToString(), ds.Tables[0].Rows[i]["CategoryName"].ToString());
                            tvProducts.Nodes[0].Nodes[intNode].Nodes.Add(ds.Tables[0].Rows[i]["ProductID"].ToString() + '@' + ds.Tables[0].Rows[i]["RATE"].ToString(), ds.Tables[0].Rows[i]["ProductName"].ToString());
                            intNode += 1;
                        }
                        else
                        {
                            tvProducts.Nodes[0].Nodes[intNode - 1].Nodes.Add(ds.Tables[0].Rows[i]["ProductID"].ToString() + '@' + ds.Tables[0].Rows[i]["RATE"].ToString(), ds.Tables[0].Rows[i]["ProductName"].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objIndent = null;
                ds        = null;
            }

            if (this.tvProducts.Nodes[0].Nodes.Count > 0)
            {
                if (this.tvProducts.Nodes[0].Nodes[0].Nodes.Count > 1)
                {
                    this.tvProducts.SelectedNode = tNode.Nodes[0];
                    this.tvProducts.SelectedNode.Expand();
                }
            }
        }
Ejemplo n.º 7
0
        private void FillProducts()
        {
            objIndent = new IndentDB();
            DataSet ds                = new DataSet();
            string  strCatId          = string.Empty;
            string  strSelectedCatgId = string.Empty;

            tvProducts.Nodes.Clear();
            if (cbCategory.SelectedIndex > -1)
            {
                strSelectedCatgId = ((NewCheckboxListItem)(cbCategory.SelectedItem)).Tag.ToString();
                if (strSelectedCatgId == "0")
                {
                    strSelectedCatgId = string.Empty;
                }
            }
            //if (strIndType == "SPDC")
            //    ds = objIndent.IndentProductList_Get(CommonData.CompanyCode, sBranchCode, strSelectedCatgId);
            //else if(strIndType == "SPDCST")
            ds = objIndent.IndentDCSTProductList_Get(CommonData.CompanyCode, sBranchCode, strSelectedCatgId);
            TreeNode tNode;

            tNode = tvProducts.Nodes.Add("Products");
            Int16 intNode = 0;

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (strCatId != ds.Tables[0].Rows[i]["CategoryID"].ToString())
                    {
                        strCatId = ds.Tables[0].Rows[i]["CategoryID"].ToString();
                        tvProducts.Nodes[0].Nodes.Add(ds.Tables[0].Rows[i]["CategoryID"].ToString(), ds.Tables[0].Rows[i]["CategoryName"].ToString());
                        tvProducts.Nodes[0].Nodes[intNode].Nodes.Add(ds.Tables[0].Rows[i]["ProductID"].ToString() + '@' + ds.Tables[0].Rows[i]["RATE"].ToString(), ds.Tables[0].Rows[i]["ProductName"].ToString());
                        intNode += 1;
                    }
                    else
                    {
                        tvProducts.Nodes[0].Nodes[intNode - 1].Nodes.Add(ds.Tables[0].Rows[i]["ProductID"].ToString() + '@' + ds.Tables[0].Rows[i]["RATE"].ToString(), ds.Tables[0].Rows[i]["ProductName"].ToString());
                    }
                }
            }
            if (this.tvProducts.Nodes[0].Nodes.Count > 0)
            {
                if (this.tvProducts.Nodes[0].Nodes[0].Nodes.Count > 1)
                {
                    this.tvProducts.SelectedNode = tNode.Nodes[0];
                    this.tvProducts.SelectedNode.Expand();
                }
            }
        }
Ejemplo n.º 8
0
        private void FillIndentList()
        {
            objData = new IndentDB();
            string strGlCode         = "0";
            string strStockPointCode = string.Empty;

            try
            {
                gvIndentList.Rows.Clear();
                if (cbGroup.SelectedIndex > -1)
                {
                    string[] strArrGlCode = ((NewCheckboxListItem)(cbGroup.SelectedItem)).Tag.ToString().Split('~');
                    strGlCode = strArrGlCode[0];
                }
                if (cbBranches.SelectedIndex > -1)
                {
                    strStockPointCode = ((NewCheckboxListItem)(cbBranches.SelectedItem)).Tag.ToString();
                }
                if (strGlCode != "" && strStockPointCode.Length >= 1)
                {
                    DataTable dt = objData.IndentFromBrnchList_Get(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToInt32(strGlCode), strStockPointCode).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int intRow = 0; intRow < dt.Rows.Count; intRow++)
                        {
                            gvIndentList.Rows.Add();
                            gvIndentList.Rows[intRow].Cells["SLNOList"].Value       = intRow + 1;
                            gvIndentList.Rows[intRow].Cells["IndentNo"].Value       = dt.Rows[intRow]["indent_number"].ToString();
                            gvIndentList.Rows[intRow].Cells["IndentDate"].Value     = Convert.ToDateTime(dt.Rows[intRow]["indent_date"]).ToString("dd/MM/yyyy");
                            gvIndentList.Rows[intRow].Cells["GLName"].Value         = dt.Rows[intRow]["GLECODE"].ToString();
                            gvIndentList.Rows[intRow].Cells["IndentFrom"].Value     = dt.Rows[intRow]["IndentFrom"].ToString();
                            gvIndentList.Rows[intRow].Cells["TotalProducts"].Value  = dt.Rows[intRow]["TotalProducts"].ToString();
                            gvIndentList.Rows[intRow].Cells["TotalReqQty"].Value    = dt.Rows[intRow]["TotalReqQty"].ToString();
                            gvIndentList.Rows[intRow].Cells["IndentFromCode"].Value = dt.Rows[intRow]["IndentFromCode"].ToString();
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objData = null;
            }
        }
Ejemplo n.º 9
0
        private void FillIndentData(string strIndentNo)
        {
            objData = new IndentDB();
            try
            {
                gvIndentDetails.Rows.Clear();
                txtIndentNo.Text  = "";
                meIndentDate.Text = "";

                DataTable dt = objData.IndentProductDetail_Get(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToInt32(strIndentNo)).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    IsModify          = true;
                    txtIndentNo.Text  = strIndentNo;
                    meIndentDate.Text = Convert.ToDateTime(dt.Rows[0]["indent_date"].ToString()).ToString("dd/MM/yyyy");
                    for (int intRow = 0; intRow < dt.Rows.Count; intRow++)
                    {
                        gvIndentDetails.Rows.Add();
                        gvIndentDetails.Rows[intRow].Cells["SLNO"].Value       = dt.Rows[intRow]["indent_sl_no"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["Group"].Value      = dt.Rows[intRow]["SPID_GROUP"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["GLCode"].Value     = dt.Rows[intRow]["SPID_GLECODE"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["EcodeName"].Value  = dt.Rows[intRow]["ENAME"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["StockPoint"].Value = dt.Rows[intRow]["branch_name"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["Category"].Value   = dt.Rows[intRow]["category_name"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["Product"].Value    = dt.Rows[intRow]["pm_product_name"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["Qty"].Value        = dt.Rows[intRow]["qty"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["ProductId"].Value  = dt.Rows[intRow]["product_id"].ToString();
                        gvIndentDetails.Rows[intRow].Cells["BranchCode"].Value = dt.Rows[intRow]["SPID_STOCK_POINT"].ToString();
                    }
                }
                else
                {
                    IsModify          = false;
                    meIndentDate.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objData = null;
            }
        }
Ejemplo n.º 10
0
        private bool isDateCheck()
        {
            objIndentData = new IndentDB();
            objSQLData    = new SQLDB();
            DataSet   ds        = new DataSet();
            DataTable dt        = new DataTable();
            string    strYear   = DateTime.Now.Year.ToString();
            Int32     intYear   = Convert.ToInt32(strYear);
            bool      flagCheck = true;


            try
            {
                string strCommand = "SELECT HSM_HOLIDAY_DATE FROM HR_HOLIDAY_MASTER ";
                dt = objSQLData.ExecuteDataSet(strCommand).Tables[0];
                ds = objIndentData.get_HolidaysList(intYear);
                if (ds.Tables[0].Rows.Count > 0 && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            if (((Convert.ToDateTime(ds.Tables[0].Rows[i]["hsm_holiday_date"].ToString())) == dtpFromdate.Value) || ((Convert.ToDateTime(dt.Rows[j]["HSM_HOLIDAY_DATE"].ToString())) == dtpFromdate.Value))
                            {
                                flagCheck = false;
                                //MessageBox.Show("Selected date is  holiday", "SSCRM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return(flagCheck);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objIndentData = null;
                objSQLData    = null;
                dt            = null;
                ds            = null;
            }
            return(flagCheck);
        }
Ejemplo n.º 11
0
        private void FillBranchGroupData()
        {
            IndentDB objIndent         = new IndentDB();
            string   strStockPointCode = string.Empty;

            try
            {
                if (cbBranches.SelectedIndex > -1)
                {
                    strStockPointCode = ((NewCheckboxListItem)(cbBranches.SelectedItem)).Tag.ToString();
                }

                cbGroup.DataSource = null;
                cbGroup.Items.Clear();
                DataTable dtGroup = objIndent.IndentGroupList_Get(CommonData.CompanyCode.ToString(), strStockPointCode, CommonData.DocMonth).Tables[0];
                DataRow   dr      = dtGroup.NewRow();
                dr[0] = "0";
                dr[1] = "Select";
                dtGroup.Rows.InsertAt(dr, 0);
                dr = null;
                if (dtGroup.Rows.Count > 0)
                {
                    foreach (DataRow dataRow in dtGroup.Rows)
                    {
                        NewCheckboxListItem oclBox = new NewCheckboxListItem();
                        oclBox.Tag  = dataRow["ENAME"].ToString();
                        oclBox.Text = dataRow["GroupName"].ToString();
                        cbGroup.Items.Add(oclBox);
                        oclBox = null;
                    }
                }
                dtGroup = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objIndent = null;
            }
        }
Ejemplo n.º 12
0
        private Int32 NewIndentNumber()
        {
            Int32 nIndNo = 0;

            objData = new IndentDB();
            try
            {
                nIndNo = objData.GenerateNewIndentNo(CommonData.CompanyCode, CommonData.BranchCode);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Indent product search");
            }
            finally
            {
                objData = null;
            }

            return(nIndNo);
        }
Ejemplo n.º 13
0
        private bool CheackData()
        {
            bool blData = true;

            if (txtIndentNo.Text == "")
            {
                MessageBox.Show("Enter Indent No.", "Indent");
                blData = false;
                txtIndentNo.Focus();
                return(blData);
            }
            objData = new IndentDB();
            int Trano = objData.CheckIndentNoDeliver(Convert.ToInt32(txtIndentNo.Text.ToString()));

            if (Trano > 0)
            {
                MessageBox.Show("Indent No already delivered. So you cannot modify.", "Indent");
                blData = false;
                txtIndentNo.Focus();
                return(blData);
            }
            objData = null;
            if ((meIndentDate.Text.IndexOf(" ") >= 0) || (meIndentDate.Text.Length < 10))
            {
                MessageBox.Show("Enter Indent date!");
                blData = false;
                meIndentDate.Focus();
                return(blData);
            }
            else
            {
                if (General.IsDateTime(meIndentDate.Text.ToString()))
                {
                    if (Convert.ToInt32(Convert.ToDateTime(meIndentDate.Text).ToString("yyyy")) < 1950)
                    {
                        MessageBox.Show("Enter valid  Date !");
                        blData = false;
                        meIndentDate.CausesValidation = true;
                        meIndentDate.Focus();
                        return(blData);
                    }
                    if (Convert.ToDateTime(Convert.ToDateTime(meIndentDate.Text).ToString("dd/MM/yyyy")) > Convert.ToDateTime(Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MM/yyyy")))
                    {
                        MessageBox.Show("Date should be less than to day");
                        meIndentDate.CausesValidation = true;
                        blData = false;
                        meIndentDate.Focus();
                        return(blData);
                    }
                }
                else
                {
                    MessageBox.Show("Enter valid Indent Date!");
                    meIndentDate.CausesValidation = true;
                    blData = false;
                    meIndentDate.Focus();
                    return(blData);
                }
            }
            bool isItemExisted = false;

            for (int nRow = 0; nRow < gvIndentDetails.Rows.Count; nRow++)
            {
                if (gvIndentDetails.Rows[nRow].Cells["Qty"].Value.ToString().Trim().Length > 0)
                {
                    if (Convert.ToDouble(gvIndentDetails.Rows[nRow].Cells["Qty"].Value.ToString().Trim()) > 0)
                    {
                        isItemExisted = true;
                        break;
                    }
                }
            }
            if (isItemExisted == false)
            {
                blData = false;
                MessageBox.Show("Enter product quantity");
                return(blData);
            }

            return(blData);
        }
        private void FillProductLicenceDetails()
        {
            objInvDb = new IndentDB();
            DataTable dt = new DataTable();

            gvProdLicenceDetails.Rows.Clear();
            int    intRow     = 1;
            string sCompCode  = cbCompany.SelectedValue.ToString();
            string sStateCode = cbState.SelectedValue.ToString();
            int    sDistrict  = 0;
            string sStatus    = "";

            if (cbDistrict.SelectedIndex > 0)
            {
                sDistrict = Convert.ToInt32(cbDistrict.SelectedValue.ToString());
            }
            else
            {
                sDistrict = 0;
            }
            if (cbStatus.SelectedIndex > 0)
            {
                sStatus = cbStatus.SelectedItem.ToString();
            }
            else
            {
                sStatus = "";
            }

            try
            {
                dt = objInvDb.Get_ProductLicenceDetails(sCompCode, sStateCode, sDistrict, sStatus).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataGridViewRow  tempRow  = new DataGridViewRow();
                        DataGridViewCell cellSLNO = new DataGridViewTextBoxCell();
                        cellSLNO.Value = intRow;
                        intRow         = intRow + 1;
                        tempRow.Cells.Add(cellSLNO);

                        DataGridViewCell cellProdLicenceNo = new DataGridViewTextBoxCell();
                        cellProdLicenceNo.Value = dt.Rows[i]["plm_licence_number"];
                        tempRow.Cells.Add(cellProdLicenceNo);

                        DataGridViewCell cellComapanyName = new DataGridViewTextBoxCell();
                        cellComapanyName.Value = dt.Rows[i]["CM_COMPANY_NAME"];
                        tempRow.Cells.Add(cellComapanyName);

                        DataGridViewCell cellState = new DataGridViewTextBoxCell();
                        cellState.Value = dt.Rows[i]["sm_state"];
                        tempRow.Cells.Add(cellState);

                        DataGridViewCell cellDistrict = new DataGridViewTextBoxCell();
                        cellDistrict.Value = sDistrict + "";
                        tempRow.Cells.Add(cellDistrict);

                        DataGridViewCell cellProdlicenceIssDate = new DataGridViewTextBoxCell();
                        cellProdlicenceIssDate.Value = Convert.ToDateTime(dt.Rows[i]["plm_licence_issu_date"]).ToShortDateString();
                        tempRow.Cells.Add(cellProdlicenceIssDate);

                        DataGridViewCell cellProdLicenceExpDate = new DataGridViewTextBoxCell();
                        cellProdLicenceExpDate.Value = Convert.ToDateTime(dt.Rows[i]["plm_licence_valid_date"]).ToShortDateString();
                        tempRow.Cells.Add(cellProdLicenceExpDate);

                        DataGridViewCell cellProdLicenceStatus = new DataGridViewTextBoxCell();
                        cellProdLicenceStatus.Value = dt.Rows[i]["Status"];
                        tempRow.Cells.Add(cellProdLicenceStatus);


                        gvProdLicenceDetails.Rows.Add(tempRow);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                objInvDb = null;
                dt       = null;
            }
        }