Esempio n. 1
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        CreateDTTable();
        DataSet DSItemStock = new DataSet();

        switch (DDLItemType.SelectedItem.Text)
        {
        case "Raw Material":
            SqlParameter[] ArrParm = new SqlParameter[3];
            ArrParm[0]  = new SqlParameter("@Action", "SELECT_ItemStock");
            ArrParm[1]  = new SqlParameter("@GodownID", DDLGodown.SelectedValue);
            ArrParm[2]  = new SqlParameter("@ItemType", "Raw Material");
            DSItemStock = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemStock_CRUD", ArrParm);
            break;

        case "Kit Material":
            SqlParameter[] ArrParm1 = new SqlParameter[3];
            ArrParm1[0] = new SqlParameter("@Action", "SELECT_ItemStock");
            ArrParm1[1] = new SqlParameter("@GodownID", DDLGodown.SelectedValue);
            ArrParm1[2] = new SqlParameter("@ItemType", "Kit Material");
            DSItemStock = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemStock_CRUD", ArrParm1);
            break;

        case "Finish Material":
            SqlParameter[] ArrParm2 = new SqlParameter[3];
            ArrParm2[0] = new SqlParameter("@Action", "SELECT_ItemStock");
            ArrParm2[1] = new SqlParameter("@GodownID", DDLGodown.SelectedValue);
            ArrParm2[2] = new SqlParameter("@ItemType", "Finish Material");
            DSItemStock = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemStock_CRUD", ArrParm2);
            break;

        default:
            break;
        }


        DataTable DTItemStock = DSItemStock.Tables[0];

        if (DTItemStock.Rows.Count > 0)
        {
            for (int i = 0; i < DTItemStock.Rows.Count; i++)
            {
                TempDT.Rows.Add(DTItemStock.Rows[i]["ID"],
                                DTItemStock.Rows[i]["Image"],
                                DTItemStock.Rows[i]["Name"],
                                DTItemStock.Rows[i]["ProductCode"],
                                DTItemStock.Rows[i]["HSNCode"],
                                DTItemStock.Rows[i]["Barcode"],
                                DTItemStock.Rows[i]["OpeningStock"],
                                DTItemStock.Rows[i]["OSDate"],
                                DTItemStock.Rows[i]["ReorderQty"],
                                DTItemStock.Rows[i]["BinLocation"]);
            }
            ViewState["DTTable"] = TempDT;
            GVItem.DataSource    = TempDT;
            GVItem.DataBind();
        }
    }
Esempio n. 2
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (DTStockItem.Columns.Count == 0)
        {
            DTStockItem.Columns.Add("ID", typeof(int));
            DTStockItem.Columns.Add("Image", typeof(string));
            DTStockItem.Columns.Add("Name", typeof(string));
            DTStockItem.Columns.Add("PCode", typeof(string));
            DTStockItem.Columns.Add("HSNCode", typeof(string));
            DTStockItem.Columns.Add("BCode", typeof(string));
            DTStockItem.Columns.Add("Price", typeof(string));
            DTStockItem.Columns.Add("TotalStock", typeof(string));
            DTStockItem.Columns.Add("KitQty", typeof(string));
            DTStockItem.Columns.Add("FinishQty", typeof(string));
        }

        DataSet DSItem = new DataSet();

        switch (DDLItemType.SelectedItem.Text)
        {
        case "Raw Material":
            SqlParameter[] arrparm = new SqlParameter[1];
            arrparm[0] = new SqlParameter("@Action", "SELECT");
            DSItem     = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_RawMaterial_CRUD", arrparm);
            break;

        default:
            break;
        }

        DataTable DTItem = DSItem.Tables[0];

        if (DTItem.Rows.Count > 0)
        {
            for (int i = 0; i < DTItem.Rows.Count; i++)
            {
                DTStockItem.Rows.Add(DTItem.Rows[i]["ID"],
                                     DTItem.Rows[i]["Image"],
                                     DTItem.Rows[i]["Name"],
                                     DTItem.Rows[i]["ProductCode"],
                                     DTItem.Rows[i]["HSNCode"],
                                     DTItem.Rows[i]["Barcode"],
                                     DTItem.Rows[i]["PurPrice"],
                                     GetTotalStock(Convert.ToInt32(DTItem.Rows[i]["ID"]), Convert.ToInt32(DDLGodown.SelectedValue)),
                                     0,
                                     0);
            }
            GVItem.DataSource = DTStockItem;
            GVItem.DataBind();
        }
    }
Esempio n. 3
0
    private void bindGridItem()

    {
        List <ParaList> para = new List <ParaList>()
        {
            new ParaList {
                Key = "@i_CompId", Value = CurrentUser.CompId
            }
        };

        dsitem            = crmclient.list(para, "Item");
        GVItem.DataSource = dsitem.Tables[0];
        GVItem.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ds           = cn.RunSql("sp_getsrno '2','0','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
        TxtSRNo.Text = ds.Tables[0].Rows[0]["srno"] != DBNull.Value ? ds.Tables[0].Rows[0]["srno"].ToString() : "";

        if (IsPostBack == false)
        {
            if (Request.QueryString["id"] != null)
            {
                ds                     = cn.RunSql("sp_listReceipt '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                TxtSRNo.Text           = ds.Tables[0].Rows[0]["nVouchNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["nVouchNo"].ToString() : "";
                TxtDate.Text           = ds.Tables[0].Rows[0]["dVochDate"] != DBNull.Value ? ds.Tables[0].Rows[0]["dVochDate"].ToString() : "";
                DDLCType.SelectedValue = ds.Tables[0].Rows[0]["cCashBank"] != DBNull.Value ? ds.Tables[0].Rows[0]["cCashBank"].ToString() : "";
                TxtCustomer.Text       = ds.Tables[0].Rows[0]["cName"] != DBNull.Value ? ds.Tables[0].Rows[0]["cName"].ToString() : "";
                HifCustomer.Value      = ds.Tables[0].Rows[0]["cAcPay"] != DBNull.Value ? ds.Tables[0].Rows[0]["cAcPay"].ToString() : "";
                LblNetRs.Text          = ds.Tables[0].Rows[0]["nTotalAmt"] != DBNull.Value ? ds.Tables[0].Rows[0]["nTotalAmt"].ToString() : "";

                GVItem.DataSource = ds.Tables[1];
                GVItem.DataBind();


                if (Request.QueryString["cid"] != null)
                {
                    ds = cn.RunSql("sp_listReceipt '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "','" + Request.QueryString["cid"] + "'", "select");
                    HIFAccount.Value             = ds.Tables[2].Rows[0]["cAccID"] != DBNull.Value ? ds.Tables[2].Rows[0]["cAccID"].ToString() : "";
                    TxtAccount.Text              = ds.Tables[2].Rows[0]["cName"] != DBNull.Value ? ds.Tables[2].Rows[0]["cName"].ToString() : "";
                    TxtAmount.Text               = ds.Tables[2].Rows[0]["nAmount"] != DBNull.Value ? ds.Tables[2].Rows[0]["nAmount"].ToString() : "";
                    DDLAgainstBill.SelectedValue = ds.Tables[2].Rows[0]["cAgainstBill"] != DBNull.Value ? ds.Tables[2].Rows[0]["cAgainstBill"].ToString() : "";
                    TxtKasar.Text   = ds.Tables[2].Rows[0]["nKasar"] != DBNull.Value ? ds.Tables[2].Rows[0]["nKasar"].ToString() : "";
                    TxtTDS.Text     = ds.Tables[2].Rows[0]["nTDS"] != DBNull.Value ? ds.Tables[2].Rows[0]["nTDS"].ToString() : "";
                    TxtRefNO.Text   = ds.Tables[2].Rows[0]["nRefNo"] != DBNull.Value ? ds.Tables[2].Rows[0]["nRefNo"].ToString() : "";
                    TxtRefdate.Text = ds.Tables[2].Rows[0]["dRefDate"] != DBNull.Value ? ds.Tables[2].Rows[0]["dRefDate"].ToString() : "";
                    TxtRemarks.Text = ds.Tables[2].Rows[0]["cRemark"] != DBNull.Value ? ds.Tables[2].Rows[0]["cRemark"].ToString() : "";
                }
                if (Request.QueryString["D"] != null)
                {
                    ddldelete.Visible = true;
                    btnsave.Text      = "Delete";
                }
            }
        }
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            try
            {

                ds = cn.RunSql("sp_getsrno '3','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                TxtSRNo.Text = ds.Tables[0].Rows[0]["srno"] != DBNull.Value ? ds.Tables[0].Rows[0]["srno"].ToString() : "";

                if (Request.QueryString["id"] != null)
                {
                    ds = cn.RunSql("sp_liststock '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                    TxtSRNo.Text = ds.Tables[0].Rows[0]["nSrNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["nSrNo"].ToString() : "";
                    TxtDate.Text = ds.Tables[0].Rows[0]["dDate"] != DBNull.Value ? ds.Tables[0].Rows[0]["dDate"].ToString() : "";

                    GVItem.DataSource = ds.Tables[1];
                    GVItem.DataBind();

                    if (Request.QueryString["cid"] != null)
                    {
                        ds = cn.RunSql("sp_liststock '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "','" + Request.QueryString["cid"] + "'", "select");
                        TxtItemGroupName.Text = ds.Tables[3].Rows[0]["cItemGroupName"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItemGroupName"].ToString() : "";
                        TxtItemName.Text = ds.Tables[3].Rows[0]["cItem"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItem"].ToString() : "";
                        HifItemGroup.Value = ds.Tables[3].Rows[0]["itemgrpid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemgrpid"].ToString() : "";
                        HifItem.Value = ds.Tables[3].Rows[0]["itemid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemid"].ToString() : "";
                        TxtTotalQty.Text = ds.Tables[3].Rows[0]["nqty"] != DBNull.Value ? ds.Tables[3].Rows[0]["nqty"].ToString() : "";

                    }
                    if (Request.QueryString["D"] != null)
                    {
                        ddldelete.Visible = true;
                        btnsave.Text = "Delete";
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            try
            {
                ds                   = cn.RunSql("sp_getsrno '1','0','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                TxtSRNo.Text         = ds.Tables[0].Rows[0]["srno"] != DBNull.Value ? ds.Tables[0].Rows[0]["srno"].ToString() : "";
                ds                   = cn.RunSql("sp_getaddlesspurchase '2'", "select");
                GvAddLess.DataSource = ds;
                GvAddLess.DataBind();

                ds = cn.RunSql("sp_Searchaccount 'Purchase','" + Request.Cookies["CompID"].Value + "'", "Sales");
                DDLSalesAccount.DataSource = ds;
                DDLSalesAccount.DataBind();

                if (Request.QueryString["id"] != null)
                {
                    ds           = cn.RunSql("sp_listPurchase '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                    TxtSRNo.Text = ds.Tables[0].Rows[0]["nSrNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["nSrNo"].ToString() : "";
                    TxtDate.Text = ds.Tables[0].Rows[0]["dDate"] != DBNull.Value ? ds.Tables[0].Rows[0]["dDate"].ToString() : "";
                    DDLSalesAccount.SelectedValue = ds.Tables[0].Rows[0]["cSalesAcc"] != DBNull.Value ? ds.Tables[0].Rows[0]["cSalesAcc"].ToString() : "";
                    LblGrossRs.Text = ds.Tables[0].Rows[0]["nGrossRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nGrossRs"].ToString() : "";
                    TxtVatPer.Text  = ds.Tables[0].Rows[0]["nVatPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nVatPer"].ToString() : "";

                    TxtVatRs.Text    = ds.Tables[0].Rows[0]["nCGSTRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nCGSTRs"].ToString() : "";
                    TxtExtraPer.Text = ds.Tables[0].Rows[0]["nExtraPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nExtraPer"].ToString() : "";
                    TxtExtraRs.Text  = ds.Tables[0].Rows[0]["nSGSTRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nSGSTRs"].ToString() : "";

                    TxtIGST.Text = ds.Tables[0].Rows[0]["nIGSTRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nIGSTRs"].ToString() : "";

                    TxtDisPer.Text              = ds.Tables[0].Rows[0]["nDiscPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nDiscPer"].ToString() : "";
                    TxtDisRs.Text               = ds.Tables[0].Rows[0]["nDiscRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nDiscRs"].ToString() : "";
                    LblNetRs.Text               = ds.Tables[0].Rows[0]["nNetRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nNetRs"].ToString() : "";
                    LblAmt.Text                 = ds.Tables[0].Rows[0]["nAmt"] != DBNull.Value ? ds.Tables[0].Rows[0]["nAmt"].ToString() : "";
                    HifCustomer.Value           = ds.Tables[0].Rows[0]["ccustomer"] != DBNull.Value ? ds.Tables[0].Rows[0]["ccustomer"].ToString() : "";
                    TxtCustomer.Text            = ds.Tables[0].Rows[0]["cName"] != DBNull.Value ? ds.Tables[0].Rows[0]["cName"].ToString() : "";
                    LblTotalQty.Text            = ds.Tables[2].Rows[0]["TotalQty"] != DBNull.Value ? ds.Tables[2].Rows[0]["TotalQty"].ToString() : "";
                    TxtTransporterID.Text       = ds.Tables[0].Rows[0]["cTransporterID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cTransporterID"].ToString() : "";
                    TxtTransporterName.Text     = ds.Tables[0].Rows[0]["cTransporterName"] != DBNull.Value ? ds.Tables[0].Rows[0]["cTransporterName"].ToString() : "";
                    TxtVehicleNo.Text           = ds.Tables[0].Rows[0]["cVehicleNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["cVehicleNo"].ToString() : "";
                    DDLCashCredit.SelectedValue = ds.Tables[0].Rows[0]["nCashCredit"] != DBNull.Value ? Convert.ToBoolean(ds.Tables[0].Rows[0]["nCashCredit"]) == true ? "1" : "0" : "0";
                    LblRoundOff.Text            = ds.Tables[0].Rows[0]["nRoundOff"] != DBNull.Value ? ds.Tables[0].Rows[0]["nRoundOff"].ToString() : "";

                    if (LblAmt.Text == "")
                    {
                        LblAmt.Text = ds.Tables[0].Rows[0]["nGrossRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nGrossRs"].ToString() : "";
                    }
                    GVItem.DataSource = ds.Tables[1];
                    GVItem.DataBind();
                    GvAddLess.DataSource = ds.Tables[4];
                    GvAddLess.DataBind();
                    if (Request.QueryString["cid"] != null)
                    {
                        ds = cn.RunSql("sp_listPurchase '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "','" + Request.QueryString["cid"] + "'", "select");
                        TxtItemGroupName.Text = ds.Tables[3].Rows[0]["cItemGroupName"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItemGroupName"].ToString() : "";
                        TxtItemName.Text      = ds.Tables[3].Rows[0]["cItem"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItem"].ToString() : "";
                        HifItemGroup.Value    = ds.Tables[3].Rows[0]["itemgrpid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemgrpid"].ToString() : "";
                        HifItem.Value         = ds.Tables[3].Rows[0]["itemid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemid"].ToString() : "";
                        TxtDescription.Text   = ds.Tables[3].Rows[0]["cDescription"] != DBNull.Value ? ds.Tables[3].Rows[0]["cDescription"].ToString() : "";
                        TxtSize.Text          = ds.Tables[3].Rows[0]["nSize"] != DBNull.Value ? ds.Tables[3].Rows[0]["nSize"].ToString() : "";
                        TxtMRP.Text           = ds.Tables[3].Rows[0]["nSaleRate"] != DBNull.Value ? ds.Tables[3].Rows[0]["nSaleRate"].ToString() : "";
                        txtDiscPerChild.Text  = ds.Tables[3].Rows[0]["nDisPer"] != DBNull.Value ? ds.Tables[3].Rows[0]["nDisPer"].ToString() : "";
                        TxtDisRsChild.Text    = ds.Tables[3].Rows[0]["nDisRs"] != DBNull.Value ? ds.Tables[3].Rows[0]["nDisRs"].ToString() : "";
                        TxtQty.Text           = ds.Tables[3].Rows[0]["nqty"] != DBNull.Value ? ds.Tables[3].Rows[0]["nqty"].ToString() : "";
                        TxtPurchaseRate.Text  = ds.Tables[3].Rows[0]["nPurchaseRate"] != DBNull.Value ? ds.Tables[3].Rows[0]["nPurchaseRate"].ToString() : "";
                        LblTotal.Text         = ds.Tables[3].Rows[0]["nTotal"] != DBNull.Value ? ds.Tables[3].Rows[0]["nTotal"].ToString() : "";
                    }
                    if (Request.QueryString["D"] != null)
                    {
                        ddldelete.Visible = true;
                        btnsave.Text      = "Delete";
                    }

                    TxtItemName.Focus();
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
Esempio n. 7
0
    protected void LBMaterial_Click(object sender, EventArgs e)
    {
        int MaterialID = Convert.ToInt32(DDLMaterial.SelectedValue);

        string RBText = "";

        if (RBKit.Checked)
        {
            RBText = "Kit";
        }
        else if (RBFinish.Checked)
        {
            RBText = "Finish";
        }

        switch (RBText)
        {
        case "Kit":
            LBLMaterialName.Text = "Kit Material";
            SqlParameter[] arrParam = new SqlParameter[2];
            arrParam[0] = new SqlParameter("@Action", "SELECTView_ByMID");
            arrParam[1] = new SqlParameter("@MID", MaterialID);
            DataSet DSRecordKit = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_KitDetails_CRUD", arrParam);
            if (DSRecordKit.Tables[0].Rows.Count > 0)
            {
                if (DTStockItem.Columns.Count == 0)
                {
                    DTStockItem.Columns.Add("ID", typeof(int));
                    DTStockItem.Columns.Add("Image", typeof(string));
                    DTStockItem.Columns.Add("Name", typeof(string));
                    DTStockItem.Columns.Add("PCode", typeof(string));
                    DTStockItem.Columns.Add("HSNCode", typeof(string));
                    DTStockItem.Columns.Add("BCode", typeof(string));
                    DTStockItem.Columns.Add("Price", typeof(string));
                    DTStockItem.Columns.Add("TotalStock", typeof(string));
                    DTStockItem.Columns.Add("KitQty", typeof(string));
                    DTStockItem.Columns.Add("FinishQty", typeof(string));
                }

                DataSet DSItem = new DataSet();

                switch (DDLItemType.SelectedItem.Text)
                {
                case "Raw Material":
                    string str = " SELECT dbo.RawMaterial.*,dbo.KitDetails.* FROM dbo.RawMaterial INNER JOIN dbo.KitDetails ON ";
                    str   += " dbo.RawMaterial.ID = dbo.KitDetails.PID INNER JOIN dbo.ItemStock ON dbo.RawMaterial.ID = dbo.ItemStock.ItemID ";
                    str   += " WHERE (dbo.KitDetails.MID = '" + MaterialID + "') AND (dbo.ItemStock.GodownID = '" + DDLGodown.SelectedValue + "')";
                    DSItem = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, str);
                    break;

                default:
                    break;
                }

                DataTable DTItem = DSItem.Tables[0];

                if (DTItem.Rows.Count > 0)
                {
                    for (int i = 0; i < DTItem.Rows.Count; i++)
                    {
                        DTStockItem.Rows.Add(DTItem.Rows[i]["ID"],
                                             DTItem.Rows[i]["Image"],
                                             DTItem.Rows[i]["Name"],
                                             DTItem.Rows[i]["ProductCode"],
                                             DTItem.Rows[i]["HSNCode"],
                                             DTItem.Rows[i]["Barcode"],
                                             DTItem.Rows[i]["PurPrice"],
                                             GetTotalStock(Convert.ToInt32(DTItem.Rows[i]["ID"]), Convert.ToInt32(DDLGodown.SelectedValue)),
                                             GetTotalStock(Convert.ToInt32(DTItem.Rows[i]["ID"]), Convert.ToInt32(DDLGodown.SelectedValue)) / Convert.ToInt32(DSRecordKit.Tables[0].Rows[i]["Qty"]),
                                             0);
                    }
                    GVItem.DataSource = DTStockItem;
                    GVItem.DataBind();
                }
            }
            break;

        case "Finish":
            LBLMaterialName.Text = "Finish Material";
            SqlParameter[] arrparam = new SqlParameter[2];
            arrparam[0] = new SqlParameter("@Action", "SELECTView_ByMID");
            arrparam[1] = new SqlParameter("@MID", MaterialID);
            DataSet DSRecordFinish = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_FinishDetails_CRUD", arrparam);
            if (DSRecordFinish.Tables[0].Rows.Count > 0)
            {
                if (DTStockItem.Columns.Count == 0)
                {
                    DTStockItem.Columns.Add("ID", typeof(int));
                    DTStockItem.Columns.Add("Image", typeof(string));
                    DTStockItem.Columns.Add("Name", typeof(string));
                    DTStockItem.Columns.Add("PCode", typeof(string));
                    DTStockItem.Columns.Add("HSNCode", typeof(string));
                    DTStockItem.Columns.Add("BCode", typeof(string));
                    DTStockItem.Columns.Add("Price", typeof(string));
                    DTStockItem.Columns.Add("TotalStock", typeof(string));
                    DTStockItem.Columns.Add("KitQty", typeof(string));
                    DTStockItem.Columns.Add("FinishQty", typeof(string));
                }

                DataSet DSItem = new DataSet();

                switch (DDLItemType.SelectedItem.Text)
                {
                case "Raw Material":
                    string str = " SELECT dbo.RawMaterial.*,dbo.FinishDetails.* FROM dbo.RawMaterial INNER JOIN dbo.FinishDetails ON ";
                    str   += " dbo.RawMaterial.ID = dbo.FinishDetails.PID INNER JOIN dbo.ItemStock ON dbo.RawMaterial.ID = dbo.ItemStock.ItemID ";
                    str   += " WHERE (dbo.FinishDetails.MID = '" + MaterialID + "') AND (dbo.ItemStock.GodownID = '" + DDLGodown.SelectedValue + "')";
                    DSItem = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, str);
                    break;

                default:
                    break;
                }

                DataTable DTItem = DSItem.Tables[0];

                if (DTItem.Rows.Count > 0)
                {
                    for (int i = 0; i < DTItem.Rows.Count; i++)
                    {
                        DTStockItem.Rows.Add(DTItem.Rows[i]["ID"],
                                             DTItem.Rows[i]["Image"],
                                             DTItem.Rows[i]["Name"],
                                             DTItem.Rows[i]["ProductCode"],
                                             DTItem.Rows[i]["HSNCode"],
                                             DTItem.Rows[i]["Barcode"],
                                             DTItem.Rows[i]["PurPrice"],
                                             GetTotalStock(Convert.ToInt32(DTItem.Rows[i]["ID"]), Convert.ToInt32(DDLGodown.SelectedValue)),
                                             0,
                                             GetTotalStock(Convert.ToInt32(DTItem.Rows[i]["ID"]), Convert.ToInt32(DDLGodown.SelectedValue)) / Convert.ToInt32(DSRecordFinish.Tables[0].Rows[i]["Qty"]));
                    }
                    GVItem.DataSource = DTStockItem;
                    GVItem.DataBind();
                }
            }
            break;

        default:
            break;
        }
    }
Esempio n. 8
0
 public void BindInnerGV()
 {
     GVItem.DataSource = ViewState["DTTable"] as DataTable;
     GVItem.DataBind();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            try
            {
                ds           = cn.RunSql("sp_getsrno '0','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                TxtSRNo.Text = ds.Tables[0].Rows[0]["srno"] != DBNull.Value ? ds.Tables[0].Rows[0]["srno"].ToString() : "";

                if (Request.QueryString["id"] != null)
                {
                    ds                      = cn.RunSql("sp_listsales '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "'", "select");
                    TxtSRNo.Text            = ds.Tables[0].Rows[0]["nSrNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["nSrNo"].ToString() : "";
                    TxtDate.Text            = ds.Tables[0].Rows[0]["dDate"] != DBNull.Value ? ds.Tables[0].Rows[0]["dDate"].ToString() : "";
                    LblGrossRs.Text         = ds.Tables[0].Rows[0]["nGrossRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nGrossRs"].ToString() : "";
                    TxtVatPer.Text          = ds.Tables[0].Rows[0]["nVatPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nVatPer"].ToString() : "";
                    TxtVatRs.Text           = ds.Tables[0].Rows[0]["nVatRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nVatRs"].ToString() : "";
                    TxtExtraPer.Text        = ds.Tables[0].Rows[0]["nExtraPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nExtraPer"].ToString() : "";
                    TxtExtraRs.Text         = ds.Tables[0].Rows[0]["nExtraRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nExtraRs"].ToString() : "";
                    TxtDisPer.Text          = ds.Tables[0].Rows[0]["nDiscPer"] != DBNull.Value ? ds.Tables[0].Rows[0]["nDiscPer"].ToString() : "";
                    TxtDisRs.Text           = ds.Tables[0].Rows[0]["nDiscRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nDiscRs"].ToString() : "";
                    LblNetRs.Text           = ds.Tables[0].Rows[0]["nNetRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nNetRs"].ToString() : "";
                    LblAmt.Text             = ds.Tables[0].Rows[0]["nAmt"] != DBNull.Value ? ds.Tables[0].Rows[0]["nAmt"].ToString() : "";
                    HifCustomer.Value       = ds.Tables[0].Rows[0]["ccustomer"] != DBNull.Value ? ds.Tables[0].Rows[0]["ccustomer"].ToString() : "";
                    TxtCustomer.Text        = ds.Tables[0].Rows[0]["cName"] != DBNull.Value ? ds.Tables[0].Rows[0]["cName"].ToString() : "";
                    LblTotalQty.Text        = ds.Tables[2].Rows[0]["TotalQty"] != DBNull.Value ? ds.Tables[2].Rows[0]["TotalQty"].ToString() : "";
                    TxtTransporterID.Text   = ds.Tables[0].Rows[0]["cTransporterID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cTransporterID"].ToString() : "";
                    TxtTransporterName.Text = ds.Tables[0].Rows[0]["cTransporterName"] != DBNull.Value ? ds.Tables[0].Rows[0]["cTransporterName"].ToString() : "";
                    TxtVehicleNo.Text       = ds.Tables[0].Rows[0]["cVehicleNo"] != DBNull.Value ? ds.Tables[0].Rows[0]["cVehicleNo"].ToString() : "";
                    if (LblAmt.Text == "")
                    {
                        LblAmt.Text = ds.Tables[0].Rows[0]["nGrossRs"] != DBNull.Value ? ds.Tables[0].Rows[0]["nGrossRs"].ToString() : "";
                    }
                    GVItem.DataSource = ds.Tables[1];
                    GVItem.DataBind();

                    if (Request.QueryString["cid"] != null)
                    {
                        ds = cn.RunSql("sp_listsales '" + Request.QueryString["id"] + "','" + Request.Cookies["CompID"].Value + "','" + Request.Cookies["BranchID"].Value + "','" + Request.Cookies["AccYear"].Value + "','" + Request.QueryString["cid"] + "'", "select");
                        TxtItemGroupName.Text = ds.Tables[3].Rows[0]["cItemGroupName"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItemGroupName"].ToString() : "";
                        TxtItemName.Text      = ds.Tables[3].Rows[0]["cItem"] != DBNull.Value ? ds.Tables[3].Rows[0]["cItem"].ToString() : "";
                        HifItemGroup.Value    = ds.Tables[3].Rows[0]["itemgrpid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemgrpid"].ToString() : "";
                        HifItem.Value         = ds.Tables[3].Rows[0]["itemid"] != DBNull.Value ? ds.Tables[3].Rows[0]["itemid"].ToString() : "";
                        TxtDescription.Text   = ds.Tables[3].Rows[0]["cDescription"] != DBNull.Value ? ds.Tables[3].Rows[0]["cDescription"].ToString() : "";
                        TxtSize.Text          = ds.Tables[3].Rows[0]["nSize"] != DBNull.Value ? ds.Tables[3].Rows[0]["nSize"].ToString() : "";
                        TxtMRP.Text           = ds.Tables[3].Rows[0]["nSaleRate"] != DBNull.Value ? ds.Tables[3].Rows[0]["nSaleRate"].ToString() : "";
                        TxtQty.Text           = ds.Tables[3].Rows[0]["nqty"] != DBNull.Value ? ds.Tables[3].Rows[0]["nqty"].ToString() : "";
                        LblTotal.Text         = ds.Tables[3].Rows[0]["nTotal"] != DBNull.Value ? ds.Tables[3].Rows[0]["nTotal"].ToString() : "";
                    }
                    if (Request.QueryString["D"] != null)
                    {
                        ddldelete.Visible = true;
                        btnsave.Text      = "Delete";
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
    }