protected void btn_getdetails_Click(object sender, EventArgs e)
    {
        try
        {
            lbldateValidation.Text = "";
            DateTime fromdate  = DateTime.Now;
            DateTime todate    = DateTime.Now;
            string[] datestrig = txtdate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            datestrig = txttodate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }

            if (BranchType == "Plant")
            {
                cmd = new SqlCommand("SELECT despatch_entry.sno AS TransactionNo, despatch_entry.dc_no AS DCNo, CONVERT(VARCHAR(10), despatch_entry.doe, 103) AS Date, vendors.vendorname AS VendorName, despatch_entry.vehciecleno AS VehicleNo, despatch_entry.chemist AS Chemist,despatch_entry.remarks AS Remarks FROM despatch_entry INNER JOIN vendors ON despatch_entry.cc_id = vendors.sno INNER JOIN branchmapping ON despatch_entry.branchid = branchmapping.subbranch WHERE (despatch_entry.doe BETWEEN @d1 AND @d2) AND (branchmapping.superbranch = @BranchID) AND (despatch_entry.trans_type=@Transtype)");
                cmd.Parameters.Add("@d1", GetLowDate(fromdate));
                cmd.Parameters.Add("@d2", GetHighDate(todate));
                cmd.Parameters.Add("@BranchID", BranchID);
                cmd.Parameters.Add("@Transtype", "In");
            }
            else
            {
                cmd = new SqlCommand("SELECT despatch_entry.sno as TransactionNo, despatch_entry.dc_no as DCNo, CONVERT(VARCHAR(10), despatch_entry.doe, 103) AS Date, vendors.vendorname as VendorName, despatch_entry.vehciecleno as VehicleNo, despatch_entry.chemist as Chemist,despatch_entry.remarks as Remarks FROM despatch_entry INNER JOIN vendors ON despatch_entry.cc_id = vendors.sno WHERE  (despatch_entry.branchid = @BranchID) AND (despatch_entry.doe BETWEEN @d1 AND @d2) AND (despatch_entry.trans_type=@Transtype)");
                cmd.Parameters.Add("@d1", GetLowDate(fromdate));
                cmd.Parameters.Add("@d2", GetHighDate(todate));
                cmd.Parameters.Add("@BranchID", BranchID);
                cmd.Parameters.Add("@Transtype", "In");
            }
            DataTable dtDispatch = vdm.SelectQuery(cmd).Tables[0];
            if (dtDispatch.Rows.Count > 0)
            {
                Gridcdata.DataSource = dtDispatch;
                Gridcdata.DataBind();
            }
            else
            {
                lbldateValidation.Text = "No dc were found";
            }
        }
        catch (Exception ex)
        {
            lbldateValidation.Text = ex.Message;
        }
    }
Beispiel #2
0
    protected void ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
    {
        SalesDBManager SalesDB = new SalesDBManager();

        if (ddlBranch.SelectedValue == "All")
        {
            hideVehicles.Visible = false;
        }
        if (ddlBranch.SelectedValue == "Branch Wise")
        {
            hideVehicles.Visible = true;
            cmd = new SqlCommand("SELECT   vendors.sno, vendors.vendorcode, vendors.vendorname, vendors.email, vendors.mobno, vendors.panno, vendors.doe, vendors.branchid, vendors.address FROM    vendors INNER JOIN branch_info ON vendors.sno = branch_info.venorid INNER JOIN branchmapping ON branch_info.sno = branchmapping.subbranch WHERE    (branchmapping.superbranch = @branchid)");
            cmd.Parameters.Add("@branchid", BranchID);
            DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];
            ddlbranches.DataSource     = dttrips;
            ddlbranches.DataTextField  = "vendorname";
            ddlbranches.DataValueField = "sno";
            ddlbranches.DataBind();
        }
        if (ddlBranch.SelectedValue == "Vehicle Wise")
        {
            hideVehicles.Visible = true;
            cmd = new SqlCommand("SELECT sno,vehicleno,capacity,noofqty FROM vehicle_master WHERE branchid=@branchid");
            cmd.Parameters.Add("@branchid", BranchID);
            DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];
            ddlbranches.DataSource     = dttrips;
            ddlbranches.DataTextField  = "vehicleno";
            ddlbranches.DataValueField = "vehicleno";
            ddlbranches.DataBind();
        }
    }
Beispiel #3
0
 void FillRouteName()
 {
     try
     {
         vdm = new SalesDBManager();
         if (Session["LevelType"].ToString() == "2" || Session["LevelType"].ToString() == "1")
         {
             cmd = new SqlCommand("SELECT Plant_Code, Plant_Name FROM Plant_Master WHERE (Plant_Code = @BranchID)");
             cmd.Parameters.Add("@BranchID", Session["branch"].ToString());
             DataTable dtPlant = vdm.SelectQuery(cmd).Tables[0];
             ddlSalesOffice.DataSource     = dtPlant;
             ddlSalesOffice.DataTextField  = "Plant_Name";
             ddlSalesOffice.DataValueField = "Plant_Code";
             ddlSalesOffice.DataBind();
         }
         else
         {
             cmd = new SqlCommand("SELECT Plant_Code, Plant_Name FROM Plant_Master ");
             DataTable dtPlant = vdm.SelectQuery(cmd).Tables[0];
             ddlSalesOffice.DataSource     = dtPlant;
             ddlSalesOffice.DataTextField  = "Plant_Name";
             ddlSalesOffice.DataValueField = "Plant_Code";
             ddlSalesOffice.DataBind();
         }
     }
     catch
     {
     }
 }
 protected void btn_getdetails_Click(object sender, EventArgs e)
 {
     try
     {
         lbldateValidation.Text = "";
         DateTime fromdate  = DateTime.Now;
         DateTime todate    = DateTime.Now;
         string[] datestrig = txtdate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = txttodate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         if (BranchID == "1" || BranchID == "23")
         {
             //SELECT silo_outward_transaction.sno AS ref_no,processingdepartments.departmentname, silo_outward_transaction.date, silo_outward_transaction.qty_kgs, silo_outward_transaction.qty_ltrs, silo_outward_transaction.fat, silo_outward_transaction.snf, processingdepartments.departmentname FROM silo_outward_transaction INNER JOIN processingdepartm nts ON silo_outward_transaction.departmentid = processingdepartments.departmentid WHERE (silo_outward_transaction.date BETWEEN @d1 AND @d2) AND (silo_outward_transaction.departmentid = '3' OR silo_outward_transaction.departmentid = '10') AND (processingdepartments.branchid = @branchid)
             cmd = new SqlCommand("SELECT  silo_outward_transaction.sno, silo_outward_transaction.date, processingdepartments.departmentname, silo_outward_transaction.qty_kgs, silo_outward_transaction.qty_ltrs, silo_outward_transaction.fat, silo_outward_transaction.snf, silomaster.SiloName FROM silo_outward_transaction INNER JOIN processingdepartments ON silo_outward_transaction.departmentid = processingdepartments.departmentid INNER JOIN silomaster ON silo_outward_transaction.siloid = silomaster.SiloId WHERE (silo_outward_transaction.branchid = @BranchID) AND (silo_outward_transaction.date BETWEEN @d1 AND @d2) AND (processingdepartments.departmentname = 'Ghee' OR processingdepartments.departmentname = 'Butter Section')");
             cmd.Parameters.Add("@d1", GetLowDate(fromdate));
             cmd.Parameters.Add("@d2", GetHighDate(todate));
             cmd.Parameters.Add("@BranchID", BranchID);
         }
         else
         {
         }
         DataTable dtDispatch = vdm.SelectQuery(cmd).Tables[0];
         if (dtDispatch.Rows.Count > 0)
         {
             Gridcdata.DataSource = dtDispatch;
             Gridcdata.DataBind();
         }
         else
         {
             lbldateValidation.Text = "No data were found";
         }
     }
     catch (Exception ex)
     {
         lbldateValidation.Text = ex.Message;
     }
 }
Beispiel #5
0
    private void bindbranches()
    {
        cmd = new SqlCommand("SELECT   vendors.sno, vendors.vendorcode, vendors.vendorname, vendors.email, vendors.mobno, vendors.panno, vendors.doe, vendors.branchid, vendors.address FROM    vendors INNER JOIN branch_info ON vendors.sno = branch_info.venorid INNER JOIN branchmapping ON branch_info.sno = branchmapping.subbranch WHERE (branchmapping.superbranch = @branchid)");
        cmd.Parameters.Add("@branchid", BranchID);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlbranches.DataSource     = dttrips;
        ddlbranches.DataTextField  = "vendorname";
        ddlbranches.DataValueField = "sno";
        ddlbranches.DataBind();
    }
    private void bindsilos()
    {
        string         branch_id = Context.Session["Branch_ID"].ToString();
        SalesDBManager SalesDB   = new SalesDBManager();

        cmd = new SqlCommand("SELECT SiloId, SiloName,branchid FROM silomaster where branchid=@branchid ");
        cmd.Parameters.Add("@branchid", branch_id);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlfromsilo.DataSource     = dttrips;
        ddlfromsilo.DataTextField  = "SiloName";
        ddlfromsilo.DataValueField = "SiloId";
        ddlfromsilo.DataBind();
        ddlfromsilo.Items.Insert(0, new ListItem {
            Value = "0", Text = "Select Silo", Selected = true
        });
        ddlfromsilo.SelectedValue = "0";

        ddltosilo.DataSource     = dttrips;
        ddltosilo.DataTextField  = "SiloName";
        ddltosilo.DataValueField = "SiloId";
        ddltosilo.DataBind();
        ddltosilo.Items.Insert(0, new ListItem {
            Value = "0", Text = "Select Silo", Selected = true
        });
        ddltosilo.SelectedValue = "0";
    }
Beispiel #7
0
 void GetReport()
 {
     try
     {
         SalesDBManager SalesDB = new SalesDBManager();
         lblmsg.Text = "";
         DataTable dtIssueTyre = new DataTable();
         string    branchid    = Session["Po_BranchID"].ToString();
         cmd = new SqlCommand("SELECT  supplierid, name, description, companyname, contactname, street1, street2, city, state, country, zipcode, phoneno, mobileno, emailid, websiteurl, createdby,createdon, status, warranty, warrantytype, insurance, insuranceamount, contactnumber, branchid, name + '_' + street1 AS Address FROM suppliersdetails WHERE (branchid = @branchid)");
         //cmd = new SqlCommand("SELECT sno, productid, qty, doe, vehicleno, branchid FROM diesel_consumptiondetails ORDER BY doe");
         cmd.Parameters.Add("@branchid", branchid);
         DataTable dtoutward = SalesDB.SelectQuery(cmd).Tables[0];
         if (dtoutward.Rows.Count > 0)
         {
             grdReports.DataSource = dtoutward;
             grdReports.DataBind();
             string title = "Supplier Details";
             Session["title"]     = title;
             Session["filename"]  = "Supplier Details Report";
             Session["xportdata"] = dtoutward;
         }
         else
         {
             lblmsg.Text = "No data found";
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
 protected void btn_Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text = "";
         SalesDBManager SalesDB   = new SalesDBManager();
         DateTime       fromdate  = DateTime.Now;
         DateTime       todate    = DateTime.Now;
         string[]       datestrig = dtp_FromDate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = dtp_Todate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         lblFromDate.Text = fromdate.ToString("dd/MM/yyyy");
         lbltodate.Text   = todate.ToString("dd/MM/yyyy");
         if (BranchID == "1" || BranchID == "22")
         {
             cmd = new SqlCommand("SELECT    CONVERT(varchar, doe, 103) AS Date,  type AS Type, time AS Time, coldroom1 AS ColdRoom1, coldroom2 AS ColdRoom2, incubationroom AS IncubationRoom, remarks AS Remarks, CONVERT(varchar, doe, 103) AS Date FROM curdcoldroom_details WHERE  (branchid = @branchid) AND (doe BETWEEN @d1 AND @d2) ORDER BY doe");
         }
         else
         {
             cmd = new SqlCommand("SELECT    CONVERT(varchar, doe, 103) AS Date, time AS Time, coldroom1 AS ColdRoom1, coldroom2 AS ColdRoom2, coldroom3 AS ColdRoom3, coldroom4 AS BlastRoom, coldroom5 AS ContainerNo1, coldroom6 AS ContainerNo2, coldroom7 AS IBT,  incubationroom AS IncubationRoom, remarks AS Remarks FROM   curdcoldroom_details WHERE   (branchid = @branchid) AND (doe BETWEEN @d1 AND @d2) ORDER BY doe ");
         }
         cmd.Parameters.Add("@branchid", BranchID);
         cmd.Parameters.Add("@d1", GetLowDate(fromdate));
         cmd.Parameters.Add("@d2", GetHighDate(todate));
         DataTable tabledetails = SalesDB.SelectQuery(cmd).Tables[0];
         if (tabledetails.Rows.Count > 0)
         {
             grdReports.DataSource = tabledetails;
             grdReports.DataBind();
             hidepanel.Visible = true;
         }
         else
         {
             lblmsg.Text       = "No data found";
             hidepanel.Visible = false;
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text       = ex.Message;
         hidepanel.Visible = false;
     }
 }
    private void get_serveyresponce_dtls(HttpContext context)
    {
        try
        {
            vdm = new SalesDBManager();
            string fromdate = context.Request["fromdate"].ToString();
            string todate   = context.Request["todate"].ToString();

            DateTime dtfromdate = Convert.ToDateTime(fromdate);
            DateTime dttodate   = Convert.ToDateTime(todate);
            cmd = new SqlCommand("SELECT COUNT(*) AS count, Status FROM   tbl_TRN_SurveyResponse WHERE  (SynchedOn BETWEEN @d1 AND @d2) GROUP BY Status");
            cmd.Parameters.Add("@d1", GetLowDate(dtfromdate));
            cmd.Parameters.Add("@d2", GetHighDate(dttodate));
            DataTable             dtcount       = vdm.SelectQuery(cmd).Tables[0];
            List <companydetails> SectionMaster = new List <companydetails>();
            foreach (DataRow dr in dtcount.Rows)
            {
                companydetails getsectiondetails = new companydetails();
                getsectiondetails.count    = dr["count"].ToString();
                getsectiondetails.status   = dr["Status"].ToString();
                getsectiondetails.fromdate = fromdate;
                getsectiondetails.todate   = todate;
                SectionMaster.Add(getsectiondetails);
            }
            string response = GetJson(SectionMaster);
            context.Response.Write(response);
        }
        catch (Exception ex)
        {
            string Response = GetJson(ex.Message);
            context.Response.Write(Response);
        }
    }
Beispiel #10
0
 void Getvendordetails()
 {
     try
     {
         Session["filename"] = "Vendor Details";
         Session["title"]    = "Vendor SAP Codes Details Information";
         lblmsg.Text         = "";
         cmd = new SqlCommand("SELECT vendorname, ccname, tallyoh, ledgertype, ledgertype1, mobno2, sapcode, salesledgertype, salestallyoh, salesledgercode, sapvendorcode, purchaseohcode, salesohcode, customername, sapcustomercode FROM   vendors");
         //cmd.Parameters.Add("@BranchID", BranchID);
         DataTable dtDispatch = vdm.SelectQuery(cmd).Tables[0];
         if (dtDispatch.Rows.Count > 0)
         {
             grdReports.DataSource = dtDispatch;
             grdReports.DataBind();
             Session["xportdata"] = dtDispatch;
             hidepanel.Visible    = true;
         }
         else
         {
             hidepanel.Visible = false;
             lblmsg.Text       = "No data were found";
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
    private void bindvehicleno()
    {
        string         vehicletype = ddlslct_vtype.SelectedItem.Text;
        SalesDBManager SalesDB     = new SalesDBManager();

        try
        {
            cmd = new SqlCommand("SELECT distinct(vehicleno) FROM weighbridge where vehicletype = @vehicletype");
            cmd.Parameters.AddWithValue("@vehicletype", vehicletype);
            DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];
            ddlvehicleno.DataSource    = dttrips;
            ddlvehicleno.DataTextField = "vehicleno";
            //   ddl_vehicleno.DataValueField = "sno";
            ddlvehicleno.DataBind();
            ddlvehicleno.ClearSelection();
            ddlvehicleno.Items.Insert(0, new ListItem {
                Value = "0", Text = "All", Selected = true
            });
            ddlvehicleno.SelectedValue = "0";

            // dataGridView1.DataBindings();
        }
        catch (Exception ex)
        {
        }
    }
 void Getvendordetails()
 {
     try
     {
         Session["filename"] = "Vendor Details";
         Session["title"]    = "Vendor Details Information";
         lblmsg.Text         = "";
         cmd = new SqlCommand("SELECT vendors.vendorname, vendors.email, vendors.mobno, vendor_subtable.rate_on, vendor_subtable.calc_on, vendor_subtable.cost, vendor_subtable.overheadon AS OH, vendor_subtable.overheadcost AS OHCost,vendor_subtable.fatplus_on, Round(vendor_subtable.m_fatpluscost,2) as m_fatpluscost, round(vendor_subtable.p_fatpluscost,2) as p_fatpluscost,  vendor_subtable.m_std_fat, vendor_subtable.p_std_fat, vendor_subtable.m_std_snf, vendor_subtable.p_std_snf, vendor_subtable.snfplus_on, ROUND(vendor_subtable.m_snfpluscost, 2) AS m_snfpluscost, ROUND(vendor_subtable.p_snfpluscost, 2) AS p_snfpluscost, vendor_subtable.transport_on, vendor_subtable.transportcost FROM vendors LEFT OUTER JOIN vendor_subtable ON vendors.sno = vendor_subtable.vendor_refno WHERE (vendors.branchid = @BranchID)");
         cmd.Parameters.Add("@BranchID", BranchID);
         DataTable dtDispatch = vdm.SelectQuery(cmd).Tables[0];
         if (dtDispatch.Rows.Count > 0)
         {
             grdReports.DataSource = dtDispatch;
             grdReports.DataBind();
             Session["xportdata"] = dtDispatch;
             hidepanel.Visible    = true;
         }
         else
         {
             hidepanel.Visible = false;
             lblmsg.Text       = "No data were found";
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
Beispiel #13
0
    protected void btn_Generate_Click(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            SalesDBManager SalesDB   = new SalesDBManager();
            DateTime       fromdate  = DateTime.Now;
            DateTime       todate    = DateTime.Now;
            string[]       datestrig = dtp_FromDate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            datestrig = dtp_Todate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            int plantcode = Convert.ToInt32(ddlplantname.SelectedItem.Value);
            lblFromDate.Text = fromdate.ToString("dd/MMM/yyyy");
            lbltodate.Text   = todate.ToString("dd/MMM/yyyy");
            DateTime.Now.ToString("hh:mm:ss tt");
            hidepanel.Visible = true;
            Datatable dtdiff = new Datatable();

            cmd = new SqlCommand("SELECT Tid, Agent_id, Prdate, Sessions, Milk_kg, Fat, Snf, Plant_Code, modify_Kg, modify_fat, modify_snf, DIFFKG, DIFFFAT, DIFFSNF,  Remark FROM Procurementimport WHERE Plant_Code=@plantcode AND Prdate between @d1 and @d2");
            // cmd = new SqlCommand("SELECT date,session,starttime,ibttempstart,stoptime,ibttempstop FROM cmpruntime where Plant_code=@plantcode  and  date between @d1 and @d2");
            cmd.Parameters.Add("@plantcode", plantcode);
            cmd.Parameters.Add("@d1", GetLowDate(fromdate));
            cmd.Parameters.Add("@d2", GetHighDate(todate));
            DataTable dtcompresssionrunninghours = SalesDB.SelectQuery(cmd).Tables[0];
            if (dtcompresssionrunninghours.Rows.Count > 0)
            {
                grdcompressor.DataSource = dtcompresssionrunninghours;
                grdcompressor.DataBind();
                hidepanel.Visible = true;
            }
            else
            {
                lblmsg.Text       = "No dasta were found";
                hidepanel.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text       = ex.Message;
            hidepanel.Visible = false;
        }
    }
    private void bindbranches()
    {
        SalesDBManager SalesDB = new SalesDBManager();

        cmd = new SqlCommand("SELECT batchid, batch, batchcode FROM batchmaster");
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlslct_Batch.DataSource     = dttrips;
        ddlslct_Batch.DataTextField  = "batch";
        ddlslct_Batch.DataValueField = "batchid";
        ddlslct_Batch.DataBind();
        ddlslct_Batch.ClearSelection();
        ddlslct_Batch.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Batch--", Selected = true
        });
        ddlslct_Batch.SelectedValue = "0";
    }
    private void bindcompanydetails()
    {
        SalesDBManager SalesDB = new SalesDBManager();

        cmd = new SqlCommand("select sno, cmpname, cmpcode from companymaster");
        DataTable dtcmp = vdm.SelectQuery(cmd).Tables[0];

        ddlcompany.DataSource     = dtcmp;
        ddlcompany.DataTextField  = "cmpname";
        ddlcompany.DataValueField = "sno";
        ddlcompany.DataBind();
        ddlcompany.ClearSelection();
        ddlcompany.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Company--", Selected = true
        });
        ddlcompany.SelectedValue = "0";
    }
Beispiel #16
0
    private void bindbranches()
    {
        string branchid1 = Session["Po_BranchID"].ToString();

        cmd = new SqlCommand("SELECT  branchid, branchname FROM branchmaster");
        cmd.Parameters.Add("@branchid", branchid1);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlbranchname.DataSource     = dttrips;
        ddlbranchname.DataTextField  = "branchname";
        ddlbranchname.DataValueField = "branchid";
        ddlbranchname.DataBind();
        ddlbranchname.ClearSelection();
        ddlbranchname.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Branch--", Selected = true
        });
        ddlbranchname.SelectedValue = "0";
    }
    protected void finalize_stockclosing(object sender, EventArgs e)
    {
        vdm = new SalesDBManager();
        DataTable dt          = (DataTable)Session["xportdata"];
        DateTime  doe         = SalesDBManager.GetTime(vdm.conn);
        DateTime  closingdate = doe.AddDays(1);
        string    entryby     = Session["Employ_Sno"].ToString();
        string    branchid    = Session["Po_BranchID"].ToString();

        foreach (DataRow dr in dt.Rows)
        {
            try
            {
                string productname = dr["Product Name"].ToString();
                if (productname != "Total")
                {
                    string qty = dr["ClosingQty"].ToString();
                    if (qty != "0")
                    {
                        double price = Convert.ToDouble(dr["OpPrice"].ToString());
                        if (price > 1)
                        {
                        }
                        else
                        {
                            price = Convert.ToDouble(dr["ReceiptPrice"].ToString());
                        }
                        cmd = new SqlCommand("select productid from productmaster where productname = @productname");
                        cmd.Parameters.Add("@productname", productname);
                        DataTable dt_productid = vdm.SelectQuery(cmd).Tables[0];
                        string    productid    = dt_productid.Rows[0]["productid"].ToString();
                        cmd = new SqlCommand("insert into stockclosingdetails (productid,qty,price,doe,entryby,branchid) values (@productid,@qty,@price,@doe,@entryby,@branchid)");
                        cmd.Parameters.Add("@productid", productid);
                        cmd.Parameters.Add("@qty", qty);
                        cmd.Parameters.Add("@price", price);
                        cmd.Parameters.Add("@doe", closingdate);
                        cmd.Parameters.Add("@entryby", entryby);
                        cmd.Parameters.Add("@branchid", branchid);
                        vdm.insert(cmd);
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                string productname = dr["Product Name"].ToString();
            }
        }
        lblmsg.Text = "Saved successfully";
        DataTable dtempty = new DataTable();

        grdReports.DataSource = dtempty;
        grdReports.DataBind();
    }
    public void btn_Generate_Click()
    {
        try
        {
            Report.Columns.Add("sno");
            Report.Columns.Add("ERP Code");
            Report.Columns.Add("Item Name");
            Report.Columns.Add("UOM");
            Report.Columns.Add("Opening Balance");
            Report.Columns.Add("Per Day Concsumption");
            Report.Columns.Add("No of Days");
            Report.Columns.Add("Remarks");
            lblmsg.Text = "";
            SalesDBManager SalesDB  = new SalesDBManager();
            DateTime       fromdate = DateTime.Now;
            DateTime       todate   = DateTime.Now;
            string         branchid = Session["Po_BranchID"].ToString();
            cmd = new SqlCommand("SELECT productmoniter.productid, uimmaster.uim, productmoniter.qty, productmoniter.price, productmoniter.branchid, productmoniter.minstock, productmoniter.maxstock, productmoniter.perdayconcsumption, productmaster.productname, productmaster.itemcode FROM productmoniter INNER JOIN productmaster ON productmoniter.productid = productmaster.productid INNER JOIN  uimmaster ON productmaster.uim = uimmaster.sno WHERE        (productmoniter.perdayconcsumption IS NOT NULL) AND (productmoniter.branchid = @branchid) ORDER BY productmaster.productid");
            cmd.Parameters.Add("@branchid", branchid);
            DataTable dtproducts = SalesDB.SelectQuery(cmd).Tables[0];
            var       i          = 1;
            if (dtproducts.Rows.Count > 0)
            {
                foreach (DataRow dr in dtproducts.Rows)
                {
                    DataRow newrow = Report.NewRow();
                    newrow["Sno"]             = i++.ToString();
                    newrow["ERP Code"]        = dr["itemcode"].ToString();
                    newrow["Item Name"]       = dr["productname"].ToString();
                    newrow["UOM"]             = dr["uim"].ToString();
                    newrow["Opening Balance"] = dr["qty"].ToString();
                    double minqty             = 0;
                    double OBQTY              = Convert.ToDouble(dr["qty"].ToString());
                    string perdayconcsumption = dr["perdayconcsumption"].ToString();
                    double days = 0;
                    if (perdayconcsumption != "0")
                    {
                        minqty = Convert.ToDouble(perdayconcsumption);
                        days   = OBQTY / minqty;
                    }

                    newrow["Per Day Concsumption"] = perdayconcsumption;
                    newrow["No of Days"]           = Math.Round(days, 2);
                    newrow["Remarks"] = "Based on need vary the perday consumption";
                    Report.Rows.Add(newrow);
                }
                grdReports.DataSource = Report;
                grdReports.DataBind();
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text       = ex.Message;
            hidepanel.Visible = false;
        }
    }
    void fillbranches()
    {
        cmd = new SqlCommand("SELECT sno, branchname, address, branchtype, tinno, cstno, mitno, branchcode FROM    branch_info");
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlbranchname.DataSource     = dttrips;
        ddlbranchname.DataTextField  = "branchname";
        ddlbranchname.DataValueField = "sno";
        ddlbranchname.DataBind();
    }
 protected void btn_Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text = "";
         SalesDBManager SalesDB   = new SalesDBManager();
         DateTime       fromdate  = DateTime.Now;
         DateTime       todate    = DateTime.Now;
         string[]       datestrig = dtp_FromDate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = dtp_Todate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         lblFromDate.Text = fromdate.ToString("dd/MMM/yyyy");
         lbltodate.Text   = todate.ToString("dd/MMM/yyyy");
         //cmd = new SqlCommand("SELECT milktransactions.dcno AS DCNo,  milktransactions.inwardno as InwardNo, milktransactions.vehicleno ,processingdept.deptname AS DeptName, milktransactions.transtype as Type, milktransactions.qty_ltr AS QtyLtr, milktransactions.qty_kgs AS QtyKgs,  milktransactions.percentageon AS PercentageOn, milktransactions.snf AS SNF, milktransactions.fat AS FAT, milktransactions.clr AS CLR, milktransactions.cob AS COB, milktransactions.hs AS HS, milktransactions.phosps as Phosps, milktransactions.alcohol as Alcohol, milktransactions.temp AS Temp, processingdept_1.deptname AS SectionName, milktransactions.remarks, milktransactions.qco, milktransactions.chemist FROM milktransactions INNER JOIN processingdept ON milktransactions.transid = processingdept.sno INNER JOIN processingdept processingdept_1 ON milktransactions.sectionid = processingdept_1.sno WHERE (milktransactions.doe BETWEEN @d1 AND @d2) AND (milktransactions.transtype = @transtype) ");
         cmd = new SqlCommand("SELECT CONVERT(VARCHAR(10), milktransactions.doe, 103) AS Date, milktransactions.dcno AS DCNo, milktransactions.inwardno AS InwardNo, milktransactions.vehicleno AS VehicleNo,milktransactions.qty_kgs AS KGS, milktransactions.qty_ltr AS LTR, milktransactions.snf AS SNF, milktransactions.fat AS FAT, milktransactions.clr AS CLR, milktransactions.cob1 AS COB, milktransactions.hs AS HS, milktransactions.phosps1 AS Phosps, milktransactions.alcohol AS Alcohol, milktransactions.temp AS Temp, milktransactions.acidity AS Acidity, milktransactions.mbrt AS MBRT,vendors.vendorname as VendorName,  milktransactions.qco AS QCO, milktransactions.chemist AS Chemist FROM milktransactions INNER JOIN vendors ON milktransactions.sectionid = vendors.sno WHERE  (milktransactions.doe BETWEEN @d1 AND @d2) AND (milktransactions.transtype = @transtype) AND (milktransactions.branchid = @branchid)");
         cmd.Parameters.Add("@d1", GetLowDate(fromdate));
         cmd.Parameters.Add("@d2", GetHighDate(todate));
         cmd.Parameters.Add("@transtype", "in");
         cmd.Parameters.Add("@branchid", BranchID);
         DataTable dtInward = SalesDB.SelectQuery(cmd).Tables[0];
         if (dtInward.Rows.Count > 0)
         {
             grdReports.DataSource = dtInward;
             grdReports.DataBind();
             hidepanel.Visible = true;
         }
         else
         {
             lblmsg.Text       = "No data were found";
             hidepanel.Visible = false;
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text       = ex.Message;
         hidepanel.Visible = false;
     }
 }
    void FillRouteName()
    {
        vdm = new SalesDBManager();
        cmd = new SqlCommand("SELECT Plant_Code, Plant_Name FROM Plant_Master ");
        DataTable dtPlant = vdm.SelectQuery(cmd).Tables[0];

        ddlSalesOffice.DataSource     = dtPlant;
        ddlSalesOffice.DataTextField  = "Plant_Name";
        ddlSalesOffice.DataValueField = "Plant_Code";
        ddlSalesOffice.DataBind();
    }
Beispiel #22
0
    protected void ddlSalesOffice_SelectedIndexChanged(object sender, EventArgs e)
    {
        vdm = new SalesDBManager();
        cmd = new SqlCommand("SELECT accountheads.HeadName, accountheads.Sno FROM subpayable INNER JOIN accountheads ON subpayable.HeadSno = accountheads.Sno INNER JOIN cashpayables ON subpayable.RefNo = cashpayables.Sno WHERE (cashpayables.BranchID = @BranchID) AND (cashpayables.VoucherType = 'Debit') GROUP BY accountheads.Sno,accountheads.HeadName ORDER BY accountheads.HeadName,accountheads.Sno");
        cmd.Parameters.Add("@BranchID", ddlSalesOffice.SelectedValue);
        DataTable dtHead = vdm.SelectQuery(cmd).Tables[0];

        ddlHeadOfaccounts.DataSource     = dtHead;
        ddlHeadOfaccounts.DataTextField  = "HeadName";
        ddlHeadOfaccounts.DataValueField = "Sno";
        ddlHeadOfaccounts.DataBind();
        ddlHeadOfaccounts.Items.Insert(0, new ListItem("Select", "0"));
    }
    public void benficerydetails(string WorkItemCode, string SurveyWorkItemMappingCode, string Type)
    {
        vdm     = new SalesDBManager();
        postvdm = new SAPdbmanger();

        string workitemcode = "51621535";
        string mappingcode  = "51621535";
        string servaytype   = "51621535";

        cmd = new SqlCommand("SELECT tbl_TRN_WorkItem.WorkItemCode, tbl_TRN_WorkItem.MileStoneCode, tbl_TRN_WorkItem.WorkItemName, tbl_TRN_WorkItem.WorkItemDesc, tbl_TRN_WorkItem.WorkItemType,  tbl_TRN_WorkItem.ParentWorkItemCode, tbl_TRN_WorkItem.PlanStartDate, tbl_TRN_WorkItem.PlanEndDate, tbl_TRN_WorkItem.PlanBudget, tbl_TRN_WorkItem.NonActivityBudget,  tbl_TRN_WorkItem.NonActivityBudgetPercentage, tbl_TRN_WorkItem.ActualStartDate, tbl_TRN_WorkItem.ActualEndDate, tbl_TRN_WorkItem.ActualExpenses, tbl_TRN_WorkItem.PrimaryOwner,  tbl_TRN_WorkItem.LocationCode, tbl_TRN_WorkItem.Target, tbl_TRN_WorkItem.TargetMeasurementUnit, tbl_TRN_WorkItem.Achievement, tbl_TRN_WorkItem.PercentageCompleted, tbl_TRN_WorkItem.Remarks,  tbl_TRN_WorkItem.Status, tbl_TRN_WorkItem.CreatedBy, tbl_TRN_WorkItem.CreatedOn, tbl_TRN_WorkItem.ModifiedBy, tbl_TRN_WorkItem.ModifiedOn, tbl_TRN_WorkItem.DisplayOrder,  tbl_TRN_WorkItem.SynchedOn, tbl_MMP_SurveyWorkItem.SurveyWorkItemMappingCode, tbl_MMP_SurveyWorkItem.SurveyCode, tbl_MMP_SurveyWorkItem.WorkItemCode AS Expr1,  tbl_MMP_SurveyWorkItem.LocationCode AS Expr2, tbl_MMP_SurveyWorkItem.Status AS Expr3, tbl_MMP_SurveyWorkItem.isActive, tbl_MMP_SurveyWorkItem.CreatedBy AS Expr4,  tbl_MMP_SurveyWorkItem.CreatedOn AS Expr5, tbl_MMP_SurveyWorkItem.ModifiedBy AS Expr6, tbl_MMP_SurveyWorkItem.ModifiedOn AS Expr7, tbl_MMP_SurveyWorkItem.Frequncy, tbl_MMP_SurveyWorkItem.StartDate, tbl_MMP_SurveyWorkItem.EndDDate FROM            tbl_TRN_WorkItem INNER JOIN  tbl_MMP_SurveyWorkItem ON tbl_TRN_WorkItem.WorkItemCode = tbl_MMP_SurveyWorkItem.WorkItemCode WHERE tbl_MMP_SurveyWorkItem.SurveyWorkItemMappingCode=@mappingcode AND  tbl_TRN_WorkItem.WorkItemCode=@workitemcode");
        cmd.Parameters.Add("@workitemcode", WorkItemCode);
        cmd.Parameters.Add("@mappingcode", SurveyWorkItemMappingCode);
        DataTable dtworkitemdetails = vdm.SelectQuery(cmd).Tables[0];

        cmd = new SqlCommand("SELECT  RowCode, WorkItemCode, LocationCode, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn FROM   tbl_MMP_WorkItemLocation WHERE WorkItemCode=@workitemcode");
        cmd.Parameters.Add("@workitemcode", workitemcode);
        DataTable dtWorkItemLocationdtls = vdm.SelectQuery(cmd).Tables[0];

        cmd = new SqlCommand("SELECT  SurveyCode, SurveyName, SurveyDesc, SectorCode, QuestionSetCode, Status, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn, Type, Frequency, StartDate, EndDate, ProgramCode, InterventionCode FROM tbl_MST_Survey WHERE Type=@type");
        cmd.Parameters.Add("@type", Type);
        DataTable dtsurveydtls = vdm.SelectQuery(cmd).Tables[0];
    }
Beispiel #24
0
    private void bindbranches()
    {
        cmd = new SqlCommand("SELECT  branchid, branchname FROM branchmaster");
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlagentname.DataSource     = dttrips;
        ddlagentname.DataTextField  = "branchname";
        ddlagentname.DataValueField = "branchid";
        ddlagentname.DataBind();
        ddlagentname.ClearSelection();
        ddlagentname.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Branch--", Selected = true
        });
        ddlagentname.SelectedValue = "0";
    }
Beispiel #25
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        try
        {
            devdm = new VehicleDBMgr();
            SalesDBManager vdm           = new SalesDBManager();
            DateTime       fromdate      = DateTime.Now;
            string[]       dateFromstrig = txtFromdate.Text.Split(' ');
            if (dateFromstrig.Length > 1)
            {
                if (dateFromstrig[0].Split('-').Length > 0)
                {
                    string[] dates = dateFromstrig[0].Split('-');
                    string[] times = dateFromstrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            DateTime Todate      = DateTime.Now;
            string[] dateTostrig = txtTodate.Text.Split(' ');
            if (dateTostrig.Length > 1)
            {
                if (dateTostrig[0].Split('-').Length > 0)
                {
                    string[] dates = dateTostrig[0].Split('-');
                    string[] times = dateTostrig[1].Split(':');
                    Todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }

            cmd = new SqlCommand("SELECT productid, qty, doe, vehicleno, dieselcost FROM   diesel_consumptiondetails  WHERE (doe BETWEEN @d1 AND @d2) AND branchid=@branchid");
            cmd.Parameters.Add("@d1", GetLowDate(fromdate));
            cmd.Parameters.Add("@d2", GetLowDate(Todate));
            cmd.Parameters.Add("@branchid", "2");
            DataTable dttotal = vdm.SelectQuery(cmd).Tables[0];
            grdReports.DataSource = dttotal;
            grdReports.DataBind();
            string title = "DieselReport From: " + fromdate.ToString() + "  To: " + Todate.ToString();
            Session["title"]     = title;
            Session["filename"]  = "DieselReport";
            Session["xportdata"] = dttotal;
            pvisible.Visible     = true;
            //Session["quantity"] = quantity;
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }
    private void bindproducts()
    {
        cmd = new SqlCommand("SELECT productmaster.sno, productmaster.batchid, productmaster.productname, batchmaster.batch FROM productmaster INNER JOIN batchmaster ON productmaster.batchid = batchmaster.batchid where (productmaster.departmentid='2') AND (productmaster.branchid=@branchid)");
        cmd.Parameters.Add("@branchid", BranchID);
        DataTable dtproduct = vdm.SelectQuery(cmd).Tables[0];

        ddlslct_product.DataSource     = dtproduct;
        ddlslct_product.DataTextField  = "productname";
        ddlslct_product.DataValueField = "sno";
        ddlslct_product.DataBind();
        ddlslct_product.ClearSelection();
        ddlslct_product.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select--", Selected = true
        });
        ddlslct_product.SelectedValue = "0";
    }
    private void bindvechicle()
    {
        vdm = new SalesDBManager();
        cmd = new SqlCommand("select sectionid,name from sectionmaster where name like '%AP%'");
        DataTable dtvehcle = vdm.SelectQuery(cmd).Tables[0];

        ddl_vehicle_no.DataSource     = dtvehcle;
        ddl_vehicle_no.DataTextField  = "name";
        ddl_vehicle_no.DataValueField = "name";
        ddl_vehicle_no.DataBind();
        ddl_vehicle_no.ClearSelection();
        ddl_vehicle_no.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select VehcleNumber--", Selected = true
        });
        ddl_vehicle_no.SelectedValue = "0";
    }
Beispiel #28
0
    private void bindproducts()
    {
        cmd = new SqlCommand("SELECT sno, productname FROM productmaster where departmentid='2' AND branchid=@branchid");
        cmd.Parameters.Add("@branchid", BranchID);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlproductType.DataSource     = dttrips;
        ddlproductType.DataTextField  = "productname";
        ddlproductType.DataValueField = "sno";
        ddlproductType.DataBind();
        ddlproductType.ClearSelection();
        ddlproductType.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Product--", Selected = true
        });
        ddlproductType.SelectedValue = "0";
    }
    private void bindsilos()
    {
        SalesDBManager SalesDB = new SalesDBManager();

        cmd = new SqlCommand("SELECT SiloId, SiloName FROM silomaster where branchid=@branchid");
        cmd.Parameters.Add("@branchid", BranchID);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlfromsilo.DataSource     = dttrips;
        ddlfromsilo.DataTextField  = "SiloName";
        ddlfromsilo.DataValueField = "SiloId";
        ddlfromsilo.DataBind();
        ddlfromsilo.ClearSelection();
        ddlfromsilo.Items.Insert(0, new ListItem {
            Value = "0", Text = "--Select Silo--", Selected = true
        });
        ddlfromsilo.SelectedValue = "0";
    }
    public void binddepartments()
    {
        SalesDBManager SalesDB = new SalesDBManager();

        cmd = new SqlCommand("SELECT departmentid, departmentname, quantity, branchid FROM processingdepartments ");
        cmd.Parameters.Add("@branchid", BranchID);
        DataTable dttrips = vdm.SelectQuery(cmd).Tables[0];

        ddlsection.DataSource     = dttrips;
        ddlsection.DataTextField  = "departmentname";
        ddlsection.DataValueField = "departmentid";
        ddlsection.DataBind();
        ddlsection.ClearSelection();
        ddlsection.Items.Insert(0, new ListItem {
            Value = "0", Text = "Select Section", Selected = true
        });
        ddlsection.SelectedValue = "0";
    }