Example #1
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        db.insert("insert into enquirymaster values('" + lblenquiryno.Text + "' ,'" + drpindentno.SelectedItem.ToString() + "' ,'" + drpcompany.SelectedValue + "' ,'" + txtdate.Text + "' ,'" + txtnarration.Text + "' ,'" + lblTotalAmt.Text + "' ,'" + Session["UserName"].ToString() + "' ,'" + Session["mob"].ToString() + "')");


        foreach (GridViewRow gvrow in GrdRequisition.Rows)
        {
            TextBox      txtqty       = gvrow.FindControl("txtqty") as TextBox;
            DropDownList ddlsupplier  = gvrow.FindControl("ddlsupplier") as DropDownList;
            DropDownList ddlsupplier2 = gvrow.FindControl("ddlsupplier2") as DropDownList;
            DropDownList ddlsupplier3 = gvrow.FindControl("ddlsupplier3") as DropDownList;
            DropDownList ddlsupplier4 = gvrow.FindControl("ddlsupplier4") as DropDownList;

            DropDownList ddlsupplier5 = gvrow.FindControl("ddlsupplier5") as DropDownList;
            DropDownList ddlsupplier6 = gvrow.FindControl("ddlsupplier6") as DropDownList;
            TextBox      txtremark    = gvrow.FindControl("txtremark") as TextBox;
            TextBox      txtitem      = gvrow.FindControl("TxtItemName") as TextBox;
            TextBox      txtitemname  = gvrow.FindControl("txtParticulars") as TextBox;
            if (ddlsupplier.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier.SelectedItem.Text + "'       ,   '" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }
            if (ddlsupplier2.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier2.SelectedItem.Text + "','" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }

            if (ddlsupplier3.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier3.SelectedItem.Text + "','" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }
            if (ddlsupplier4.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier4.SelectedItem.Text + "','" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }

            if (ddlsupplier5.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier5.SelectedItem.Text + "','" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }
            if (ddlsupplier6.SelectedItem.Text != "Select Supplier")
            {
                db.insert("insert into  Enquirydetails values( '" + txtitemname.Text + "','" + txtitem.Text + "' , '" + txtqty.Text + "' ,'" + ddlsupplier6.SelectedItem.Text + "','" + txtremark.Text + "' ,'" + "" + "' , '" + lblenquiryno.Text + "','" + drpindentno.SelectedItem.ToString() + "' ,'" + "open" + "')");
            }
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Enquiry Genrated Successfully ');", true);

            GrdRequisition.DataSource = "";
            GrdRequisition.DataBind();

            ReportGrid.DataSource = db.Displaygrid("select   distinct(Enquirydetails.supplier) , (enquirymaster.id) as #,  Enquirydetails.reamrk , enquirymaster.date , enquirymaster.enno from Enquirydetails  inner join enquirymaster   on enquirymaster.enno=Enquirydetails.enno  order by enquirymaster.enno  desc ");
            ReportGrid.DataBind();
        }
    }
Example #2
0
    protected void drpindentno_SelectedIndexChanged(object sender, EventArgs e)
    {
        string abc = drpindentno.SelectedValue;

        string[] tokens = abc.Split('=');

        int projectid = Convert.ToInt32(db.getDb_Value("select  IsCostCentre  from RequisitionCafeteria  where RequisitionCafeId = '" + drpindentno.SelectedValue + "'"));

        string projectno = db.getDbstatus_Value("select ProjectName from Project_master where id='" + projectid + "' ");

        lblenquiryno.Text         = "ENQ" + "/" + projectno + "/" + "00" + ENNO.ToString();
        GrdRequisition.DataSource = db.Displaygrid(" select IM.ItemName,     ID.ItemDesc,   RCD.Qty as Qty from RequisitionCafeDtls RCD  inner join ItemMaster IM on RCD.ItemId=IM.ItemId left join ItemCategory IC on IC.CategoryId=IM.CategoryId left join SubCategory SC on SC.SubCategoryId=IM.SubcategoryId left join ItemDetails ID on ID.ItemDetailsId=RCD.ItemDetailsId left join UnitConversionDtls UCD on UCD.UnitConvDtlsId=RCD.UnitConvDtlsId Left join StockLocation SL on IM.StockLocationID=SL.StockLocationID left join TemplateDetails TM on RCD.TemplateID=TM.TemplateDtlsID left join SuplierMaster SM on RCD.VendorId=SM.SuplierId left Join PriorityMaster PM on RCD.PriorityID=PM.PriorityID left Join UnitMaster UM on RCD.UnitConvDtlsId=UM.UnitId  where   RCD.RequisitionCafeId='" + drpindentno.SelectedValue + "'");
        GrdRequisition.DataBind();
    }
Example #3
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gvrow in GrdRequisition.Rows)
        {
            TextBox txtparticular = (TextBox)gvrow.FindControl("TxtItemName");
            TextBox txtrate       = (TextBox)gvrow.FindControl("txtrate");
            TextBox txtqty        = (TextBox)gvrow.FindControl("txtqty");
            TextBox txtamount     = (TextBox)gvrow.FindControl("txtamount");
            TextBox itemname      = (TextBox)gvrow.FindControl("txtparti1");



            TextBox cgstper = (TextBox)gvrow.FindControl("GrdtxtCGSTPer");
            TextBox cgstamt = (TextBox)gvrow.FindControl("GrdtxtCGSTAmt");
            TextBox sgstper = (TextBox)gvrow.FindControl("GrdtxtSGSTPer");
            TextBox sgstamt = (TextBox)gvrow.FindControl("GrdtxtSGSTAmt");
            TextBox igstper = (TextBox)gvrow.FindControl("GrdtxtIGSTPer");

            TextBox igstamt = (TextBox)gvrow.FindControl("GrdtxtIGSTAmt");

            TextBox txtgst = (TextBox)gvrow.FindControl("GrdtxtPerVAT");



            // string particular = txtparticular.Text;

            double a = double.Parse(txtamount.Text);
            db.insert("insert into Supplierenquiryitem values( '" + est.Text + "' ,'" + drpenquiry.SelectedValue + "' , '" + itemname.Text + "','" + txtparticular.Text + " ' , '" + txtqty.Text + " ' ,'" + txtrate.Text + "' ,'" + Math.Round(a) + "'  ,'" + drpsupplier.SelectedValue + "' ,'" + cgstper.Text + "' ,'" + cgstamt.Text + "' ,'" + sgstper.Text + "' ,'" + sgstamt.Text + "' ,'" + igstper.Text + "' ,'" + igstamt.Text + "' ,'" + txtgst.Text + "')");
        }
        db.insert("insert into supplierenquirydetails values('" + est.Text + "','" + drpenquiry.SelectedValue + "' ,'" + txtdate.Text + "' ,'" + drpsupplier.SelectedValue + "' ,'" + txtSubTotal.Text + "' ,'" + 0 + "' ,'" + 0 + "' ,'" + 0 + "' ,'" + 0 + "' ,'" + txtvatper.Text + "' ,'" + txtSGSTPer.Text + "' ,'" + txtIGSTPer.Text + "' ,'" + txtvatamt.Text + "' ,'" + txtSGSTAmt.Text + "' ,'" + txtIGSTAmt.Text + "' ,'" + txtNetTotal.Text + "' ,'" + Session["UserName"].ToString() + "' ,'" + Session["mob"].ToString() + "' ,'" + txtnarration.Text + "')");

        db.insert("update Enquirydetails set status='" + "close" + "' where  supplier='" + drpsupplier.SelectedValue + "'");


        lblSuppname.Text = drpsupplier.SelectedItem.ToString();
        lblenno.Text     = drpenquiry.SelectedItem.ToString();
        // lblnarration.Text = txtnarration.Text;
        lblsuppadd.Text     = db.getDbstatus_Value("select Address from SuplierMaster where SuplierName='" + drpsupplier.SelectedValue + "' ");
        lblsuppcontact.Text = db.getDbstatus_Value("select MobileNo from SuplierMaster where SuplierName='" + drpsupplier.SelectedValue + "' ");
        clear();
        ScriptManager.RegisterStartupScript(this, this.GetType(), "PrintAftersave", "PrintAftersave();", true);
        GrdRequisition.DataSource = "";
        GrdRequisition.DataBind();
        ReportGrid.DataSource = db.Displaygrid(" select enqid as ENQ_No ,  id as #, supplier  as Supplier from supplierenquirydetails order by id desc");
        ReportGrid.DataBind();
        bindsupplier();
        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Record Save Succesfully ');", true);
        //  Response.Write(" ");
    }
Example #4
0
    protected void ReportGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Delete"):
            {
                ViewState["DeleteID"] = Convert.ToInt32(e.CommandArgument);

                string enq      = db.getDbstatus_Value("select enno from enquirymaster where id='" + ViewState["DeleteID"] + "' ");
                string supplier = db.getDbstatus_Value("select  supplier from  Enquirydetails where enno='" + enq + "'");
                db.insert(" delete  Enquirydetails where supplier='" + supplier + "' and  enno='" + enq + "'");
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Record Deleted Successfully ');", true);
            }
            break;



            case ("Select"):
            {
                string      enq = db.getDbstatus_Value("select enno from enquirymaster where id='" + Convert.ToInt32(e.CommandArgument) + "' ");
                GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                int rowIndex = gvr.RowIndex;



                lblenquiryno.Text = enq.ToString();


                // int rowIndex = Convert.ToInt32(e.CommandArgument);


                GridViewRow row = ReportGrid.Rows[rowIndex];



                //Fetch value of Country
                string supplier = ReportGrid.Rows[rowIndex].Cells[4].Text;


                GrdRequisition.DataSource = db.Displaygrid("select  itemname as Itemname , particulars  as ItemDesc , qty as Qty, reamrk as Remark  from  Enquirydetails   where   enno='" + enq + "' and  supplier='" + supplier + "' ");
                GrdRequisition.DataBind();
                DataSet ds = new DataSet();
                ds = db.dgv_display("select  itemname as Itemname , particulars  as ItemDesc , qty as Qty, reamrk as Remark  ,supplier from  Enquirydetails   where   enno='" + enq + "' and  supplier='" + supplier + "' ");
                for (int g = 0; g < ds.Tables[0].Rows.Count; g++)
                {
                    DropDownList ddlItemDescription = GrdRequisition.Rows[g].FindControl("ddlsupplier") as DropDownList;

                    ddlItemDescription.SelectedValue = ds.Tables[0].Rows[g]["supplier"].ToString();
                }
            }
            break;



            case ("Print"):
            {
                DataTable dt = new DataTable();
                ViewState["printid"] = Convert.ToInt32(e.CommandArgument);



                GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                int rowIndex = gvr.RowIndex;



                // int rowIndex = Convert.ToInt32(e.CommandArgument);


                GridViewRow row = ReportGrid.Rows[rowIndex];



                //Fetch value of Country
                string supplier = ReportGrid.Rows[rowIndex].Cells[4].Text;



                string enq = db.getDbstatus_Value("select enno from enquirymaster where id='" + ViewState["printid"] + "' ");

                grdprint.DataSource = db.Displaygrid("select  itemname as Itemname , particulars  as Particular , qty as Qty, reamrk as Remark from  Enquirydetails   where   enno='" + enq + "' and  supplier='" + supplier + "' ");
                grdprint.DataBind();
                lblenno.Text          = enq.ToString();
                lblsuppadd.Text       = db.getDbstatus_Value("select Address from SuplierMaster where SuplierName='" + supplier + "' ");
                lblsuppcontact.Text   = db.getDbstatus_Value("select MobileNo from SuplierMaster where SuplierName='" + supplier + "' ");
                lblSuppname.Text      = supplier.ToString();
                image.ImageUrl        = db.getDbstatus_Value("select  CLogo from  CompanyMaster where  CompanyId='" + "1" + "'");
                lblcontactperson.Text = db.getDbstatus_Value("select  contactname from enquirymaster where  id='" + ViewState["printid"] + "' ");
                lblcontactno.Text     = db.getDbstatus_Value("select  contctmob from enquirymaster where  id='" + ViewState["printid"] + "' ");
                ScriptManager.RegisterStartupScript(this, this.GetType(), "PrintPanel", "PrintPanel();", true);
            }
            break;
            }
        }
        catch (Exception ex)
        {
        }
    }
Example #5
0
 protected void drpenquiry_SelectedIndexChanged(object sender, EventArgs e)
 {
     GrdRequisition.DataSource = db.Displaygrid("      select Enquirydetails.*    from  Enquirydetails  where  Enquirydetails.enno  ='" + drpenquiry.SelectedValue + "' and Enquirydetails.supplier='" + drpsupplier.SelectedValue + "'");
     GrdRequisition.DataBind();
 }