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; } }
protected void btn_getdetails_Click(object sender, EventArgs e) { try { vdm = new VehicleDBMgr(); 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[] Todatestrig = txttodate.Text.Split(' '); if (Todatestrig.Length > 1) { if (Todatestrig[0].Split('-').Length > 0) { string[] dates = Todatestrig[0].Split('-'); string[] times = Todatestrig[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") { cmd = new SqlCommand("SELECT suspense_bill_entry.sno AS refno, suspense_bill_entry.transactionno, suspense_bill_entry.transactiondate, suspense_bill_entry.financialyear, suspense_bill_entry.reqdate, suspense_bill_entry.reqamount,suspense_bill_entry.sectioncode, suspense_bill_entry.particulars, suspense_bill_entry.actualexpenses, suspense_bill_entry.balamount, suspense_bill_entry.status FROM suspense_bill_entry INNER JOIN suspense_bill_subentry ON suspense_bill_entry.sno = suspense_bill_subentry.refno where (suspense_bill_entry.doe BETWEEN @d1 AND @d2)"); cmd.Parameters.Add("@d1", GetLowDate(fromdate)); cmd.Parameters.Add("@d2", GetHighDate(todate)); cmd.Parameters.Add("@BranchID", BranchID); } else { cmd = new SqlCommand("SELECT suspense_bill_entry.sno AS refno, suspense_bill_entry.transactionno, suspense_bill_entry.transactiondate, suspense_bill_entry.financialyear, suspense_bill_entry.reqdate, suspense_bill_entry.reqamount,suspense_bill_entry.sectioncode, suspense_bill_entry.particulars, suspense_bill_entry.actualexpenses, suspense_bill_entry.balamount, suspense_bill_entry.status FROM suspense_bill_entry INNER JOIN suspense_bill_subentry ON suspense_bill_entry.sno = suspense_bill_subentry.refno where (suspense_bill_entry.doe BETWEEN @d1 AND @d2)"); cmd.Parameters.Add("@d1", GetLowDate(fromdate)); cmd.Parameters.Add("@d2", GetHighDate(todate)); } 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; } }
protected void btn_getdetails_Click(object sender, EventArgs e) { try { vdm = new VehicleDBMgr(); 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[] Todatestrig = txttodate.Text.Split(' '); if (Todatestrig.Length > 1) { if (Todatestrig[0].Split('-').Length > 0) { string[] dates = Todatestrig[0].Split('-'); string[] times = Todatestrig[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") { cmd = new SqlCommand("SELECT miscellaneous_billdetails.sno AS refno, miscellaneous_billdetails.transactiondate, miscellaneous_billdetails.advancereqno, miscellaneous_billdetails.advreqdate, financialyeardetails.year as financeyear, miscellaneous_billdetails.natureofwork, natureofwork.shortdescription, employe_login.name, miscellaneous_billdetails.status, Departmentdetails.DepartmentName, miscellaneous_billdetails.particulars, miscellaneous_billdetails.totalamount FROM miscellaneous_billdetails INNER JOIN Departmentdetails ON miscellaneous_billdetails.deptid = Departmentdetails.sno LEFT OUTER JOIN financialyeardetails ON miscellaneous_billdetails.financialyear = financialyeardetails.sno LEFT OUTER JOIN natureofwork ON miscellaneous_billdetails.natureofwork = natureofwork.sno LEFT OUTER JOIN employe_login ON miscellaneous_billdetails.employeid = employe_login.sno WHERE (miscellaneous_billdetails.doe BETWEEN @d1 AND @d2)"); cmd.Parameters.Add("@d1", GetLowDate(fromdate)); cmd.Parameters.Add("@d2", GetHighDate(todate)); cmd.Parameters.Add("@BranchID", BranchID); } else { cmd = new SqlCommand("SELECT miscellaneous_billdetails.sno AS refno, miscellaneous_billdetails.transactiondate, miscellaneous_billdetails.advancereqno, miscellaneous_billdetails.advreqdate, financialyeardetails.year as financeyear , miscellaneous_billdetails.natureofwork, natureofwork.shortdescription, employe_login.name, miscellaneous_billdetails.status, Departmentdetails.DepartmentName, miscellaneous_billdetails.particulars, miscellaneous_billdetails.totalamount FROM miscellaneous_billdetails INNER JOIN Departmentdetails ON miscellaneous_billdetails.deptid = Departmentdetails.sno LEFT OUTER JOIN financialyeardetails ON miscellaneous_billdetails.financialyear = financialyeardetails.sno LEFT OUTER JOIN natureofwork ON miscellaneous_billdetails.natureofwork = natureofwork.sno LEFT OUTER JOIN employe_login ON miscellaneous_billdetails.employeid = employe_login.sno WHERE (miscellaneous_billdetails.doe BETWEEN @d1 AND @d2)"); cmd.Parameters.Add("@d1", GetLowDate(fromdate)); cmd.Parameters.Add("@d2", GetHighDate(todate)); } 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; } }
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; } }