void LoadData() { DataTable dt = new DataTable(); if (ddlSites.SelectedIndex != 0) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 3; obj.SourceSiteID = Convert.ToInt32(ddlSites.SelectedValue); obj.DestinationSiteID = Convert.ToInt32(ddlSites.SelectedValue); dt = obj.MachineTransfer(obj).Tables[0]; } else { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 4; dt = obj.MachineTransfer(obj).Tables[0]; } grdMachines.DataSource = dt; grdMachines.DataBind(); pnlUpdate.Visible = false; if (grdMachines.Rows.Count > 0) { lblError.Text = ""; } else { lblError.Text = "No Records Found"; } }
/* * Op=1 Insert Data * Op=2 Update Status * Op=3 Get Data By Site * Op=4 Get All Data * Op=5 Get All Data by Date */ //ID, SourceSiteID, DestinationSiteID, SiteMachineID, StartDate, UpdateDate, UpdatedBy, Status, Remarks public DataSet MachineTransfer(clsMachineTransfer obj) { try { connect(); SqlParameter[] param = new SqlParameter[11]; param[0] = new SqlParameter("@ID", obj._ID); param[1] = new SqlParameter("@SourceSiteID", obj._SourceSiteID); param[2] = new SqlParameter("@DestinationSiteID", obj._DestinationSiteID); param[3] = new SqlParameter("@SiteMachineID", obj._SiteMachineID); param[4] = new SqlParameter("@StartDate", obj._StartDate); param[5] = new SqlParameter("@UpdateDate", obj._UpdateDate); param[6] = new SqlParameter("@UpdatedBy", obj._UpdatedBy); param[7] = new SqlParameter("@Status", obj._Status); param[8] = new SqlParameter("@DriverName", obj._DriverName); param[9] = new SqlParameter("@DriverPhone", obj._DriverPhone); param[10] = new SqlParameter("@Op", obj._Op); DataSet ds = SqlHelper.ExecuteDataset(co, "procMachineTransfer", param); return(ds); } catch { return(null); } finally { co.Close(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 2; obj.UpdateDate = DateTime.Today.ToShortDateString(); obj.UpdatedBy = Convert.ToInt32(Request.Cookies["User"].Value); obj.Status = Convert.ToInt32(ddlStatus.SelectedValue); //obj.Remarks = txtERemarks.Text; obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedRow.RowIndex].Value); obj.MachineTransfer(obj); if (Convert.ToInt32(ddlStatus.SelectedValue) == 3) { obj.Op = 6; obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedRow.RowIndex].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; clsSiteMachines objSM = new clsSiteMachines(); objSM.Op = 4; objSM.ID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]); objSM.UpdateDate = DateTime.Today.ToShortDateString(); objSM.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); objSM.SiteMachines(objSM); } grdMachines.SelectedIndex = 1; LoadData(); pnlUpdate.Visible = false; pnlRequests.Visible = true; }
Panel LoadDetailForPDF() { try { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 6; obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedRow.RowIndex].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; DataTable dtSourceSite, dtDestinationSite, dtMachineDetail; clsSite obSite = new clsSite(); clsSiteMachines objSM = new clsSiteMachines(); objSM.Op = 5; objSM.ID = Convert.ToInt32(dt.Rows[0]["SiteMachineID"]); dtMachineDetail = objSM.SiteMachines(objSM).Tables[0]; obSite.Op = 5; obSite.ID = Convert.ToInt32(dt.Rows[0]["SourceSiteID"]); dtSourceSite = obSite.SiteMaster(obSite).Tables[0]; obSite.ID = Convert.ToInt32(dt.Rows[0]["DestinationSiteID"]); dtDestinationSite = obSite.SiteMaster(obSite).Tables[0]; LiteralControl lc = new LiteralControl(); lc.Text = lc.Text + "<table width='100%'>"; lc.Text = lc.Text + "<tr><td align='center' colspan='12'><h3>MACHINE TRANSFER RECEIPT</h3></td></tr>"; lc.Text = lc.Text + "<tr><td align='center' colspan='12'><h4>T.K. Engineering Consortium Pvt. Ltd.</h4></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='3'>"; if (dtSourceSite.Rows.Count > 0) { lc.Text = lc.Text + dtSourceSite.Rows[0]["Name"] + "<br>" + dtSourceSite.Rows[0]["Location"] + "<br>" + dtSourceSite.Rows[0]["Address"]; } else { lc.Text = lc.Text + lblSourceSite.Text; } lc.Text = lc.Text + "</td><td colspan='6'></td><td colspan='3'>"; if (dtDestinationSite.Rows.Count > 0) { lc.Text = lc.Text + dtDestinationSite.Rows[0]["Name"] + "<br>" + dtDestinationSite.Rows[0]["Location"] + "<br>" + dtDestinationSite.Rows[0]["Address"]; } else { lc.Text = lc.Text + lblDestinationSite.Text; } lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='3'><b>Machine</b></td><td colspan='2'><b>Serial No</b></td><td colspan='3'><b>Status</b></td><td colspan='2'><b>Thesis No</b></td><td colspan='2'><b>Engine No</b></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='3'>" + dtMachineDetail.Rows[0]["Machine"] + "</td><td colspan='2'>" + dtMachineDetail.Rows[0]["SerialNo"] + "</td><td colspan='3'>" + dtMachineDetail.Rows[0]["Status"] + "</td><td colspan='2'>" + dtMachineDetail.Rows[0]["ThesisNo"] + "</td><td colspan='2'>" + dtMachineDetail.Rows[0]["EngineNo"] + "</td></tr>"; lc.Text = lc.Text + "</table>"; Panel p = new Panel(); p.Controls.Add(lc); return(p); } catch { return(null); } }
public void GetMachineTransferByDate(string Date1, string Date2) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 5; obj.StartDate = Date1; obj.UpdateDate = Date2; DataTable dt = obj.MachineTransfer(obj).Tables[0]; Context.Response.Write(JsonConvert.SerializeObject(dt)); }
protected void btnDelete_Click(object sender, EventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedIndex].Value); obj.Op = 7; obj.MachineTransfer(obj); pnlUpdate.Visible = false; pnlRequests.Visible = true; grdMachines.SelectedIndex = -1; LoadData(); }
protected void btnUpdate_Click(object sender, EventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 2; obj.UpdateDate = DateTime.Today.ToShortDateString(); obj.UpdatedBy = Convert.ToInt32(Request.Cookies["User"].Value); obj.Status = Convert.ToInt32(ddlStatus.SelectedValue); obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedRow.RowIndex].Value); obj.MachineTransfer(obj); grdMachines.SelectedIndex = -1; LoadData(); pnlUpdate.Visible = false; pnlRequests.Visible = true; }
public void SaveMachineTransfer(int SourceSiteID, int DestinationSiteID, int SiteMachineID, string StartDate, string UpdateDate, int Status, string DriverName, string DriverPhone) { clsMachineTransfer obj = new clsMachineTransfer(); obj.SourceSiteID = SourceSiteID; obj.DestinationSiteID = DestinationSiteID; obj.SiteMachineID = SiteMachineID; obj.StartDate = StartDate; obj.UpdateDate = UpdateDate; obj.Status = Status; obj.DriverName = DriverName; obj.DriverPhone = DriverPhone; obj.Op = 1; obj.MachineTransfer(obj); Context.Response.Write(JsonConvert.SerializeObject("Saved")); }
Panel LoadDetailForPDF() { try { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 6; obj.ID = Convert.ToInt32(grdMachines.DataKeys[grdMachines.SelectedRow.RowIndex].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; //select a.ID,a.SourceSiteID,SourceSiteName,SourceSiteAddress,SourceSitePhoneNo,SourceSiteEmail,SSiteIncharge,SSiteInchargePh,a.DestinationSiteID,DestSiteName, //DestSiteAddress,DestSitePhoneNo,DestSiteEmail,DSiteIncharge,DSiteInchargePh,a.SiteMachineID,Machine,StartDate,UpdateDate,UpdatedBy,Status,a.DriverName,a.DriverPhone StringBuilder str = new StringBuilder(); str.Append("<table width='100%' style='font-size:8;'>"); str.Append("<tr><td colspan='8'>"); str.Append("<h4>TK Engineering Consortium Pvt. Limited</h4>"); str.Append("<h5>Date: " + dt.Rows[0]["StartDate"] + "</h5>"); str.Append("</td><td colspan='4'>"); str.Append("<img src='" + MapPath("~/images/logo.jpg") + "' width='150'/>"); str.Append("</tr>"); str.Append("<tr><td colspan='4'>"); str.Append("Source Site:<br><b>" + dt.Rows[0]["SourceSiteName"] + "</b><br>"); str.Append("Address: " + dt.Rows[0]["SourceSiteAddress"].ToString().Replace("\n", "<br>") + "<br>"); str.Append("Phone No: " + dt.Rows[0]["SourceSitePhoneNo"] + "<br>"); str.Append("Email: " + dt.Rows[0]["SourceSiteEmail"] + "<br>"); str.Append("Site Incharge: " + dt.Rows[0]["SSiteIncharge"] + "<br>Phone No" + dt.Rows[0]["SSiteInchargePh"]); str.Append("</td><td colspan='4'></td><td align='right' colspan='4'><div style='text-align:left;'>"); str.Append("Destination Site:<br><b>" + dt.Rows[0]["DestSiteName"] + "</b><br>"); str.Append("Address: " + dt.Rows[0]["DestSiteAddress"].ToString().Replace("\n", "<br>") + "<br>"); str.Append("Phone No: " + dt.Rows[0]["DestSitePhoneNo"] + "<br>"); str.Append("Email: " + dt.Rows[0]["DestSiteEmail"] + "<br>"); str.Append("Site Incharge: " + dt.Rows[0]["DSiteIncharge"] + "<br>Phone No" + dt.Rows[0]["DSiteInchargePh"]); str.Append("</div></td></tr>"); str.Append("</table>"); str.Append("<h5>Machine Log No / Model: " + dt.Rows[0]["Machine"] + "</h5>"); str.Append("<h5>Driver Name: " + dt.Rows[0]["DriverName"] + "</h5>"); str.Append("<h5>Driver Phone No: " + dt.Rows[0]["DriverPhone"] + "</h5>"); str.Append("<h5>Current Status: " + dt.Rows[0]["CurrStatus"] + "</h5>"); Label lbl = new Label(); lbl.Text = str.ToString(); Panel pnl = new Panel(); pnl.Controls.Add(lbl); return(pnl); } catch { return(null); } }
protected void grdMachines_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 6; obj.ID = Convert.ToInt32(grdMachines.DataKeys[e.NewSelectedIndex].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; pnlUpdate.Visible = true; pnlRequests.Visible = false; lblMachineName.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[2].Text; lblSourceSite.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[0].Text; lblDestinationSite.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[1].Text; lblPlacedOn.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[3].Text; lblCurrentStatus.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[6].Text; }
protected void btnSave_Click(object sender, EventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); //ID, SourceSiteID, DestinationSiteID, SiteMachineID, StartDate, UpdateDate, UpdatedBy, Status, Remarks obj.SourceSiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.DestinationSiteID = Convert.ToInt32(ddlDestSite.SelectedValue); obj.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); obj.StartDate = DateTime.Today.ToShortDateString(); obj.UpdateDate = DateTime.Today.ToShortDateString(); obj.UpdatedBy = Convert.ToInt32(Request.Cookies["User"].Value); obj.Status = 0; // obj.Remarks = txtRemarks.Text; obj.Op = 1; obj.MachineTransfer(obj); LoadData(); }
void SendSMS(int ID) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 5; obj.ID = ID; DataTable dt = obj.MachineTransfer(obj).Tables[0]; string Mobile = ""; try { if (dt.Rows[0]["SourceSitePhoneNo"].ToString().Trim() != "") { Mobile = Mobile + dt.Rows[0]["SourceSitePhoneNo"].ToString(); } if (dt.Rows[0]["DestSitePhoneNo"].ToString().Trim() != "") { if (Mobile != "") { Mobile = Mobile + ","; } Mobile = Mobile + dt.Rows[0]["DestSitePhoneNo"].ToString(); } clsPTItems obPTI = new clsPTItems(); obPTI.PTID = Convert.ToInt32(dt.Rows[0]["ID"]); obPTI.Op = 2; DataTable dtPTI = obPTI.PTITems(obPTI).Tables[0]; int total = 0; foreach (DataRow dr in dtPTI.Rows) { total = total + Convert.ToInt32(dr["Quantity"]); } string Message = "From: " + dt.Rows[0]["SourceSiteName"] + ", To: " + dt.Rows[0]["DestSiteName"] + ", Machine: " + dt.Rows[0]["Machine"] + ", Vehicle No: " + dt.Rows[0]["VehicleNo"]; Message = Message + ", Driver Name:" + dt.Rows[0]["DriverName"] + ", Driver Phone: " + dt.Rows[0]["DriverPhone"] + ", Status: Dispatched"; string URL = "http://sambsms.com/app/smsapi/index.php?key=458AD34748890B&campaign=0&routeid=7&type=text&contacts=" + Mobile + "&senderid=TKECON&msg=" + Message + ""; HttpWebRequest request = WebRequest.Create(URL) as HttpWebRequest; //optional HttpWebResponse response = request.GetResponse() as HttpWebResponse; } catch { } }
void LoadData() { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 3; obj.SourceSiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.DestinationSiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; grdMachines.DataSource = dt; grdMachines.DataBind(); pnlUpdate.Visible = false; if (grdMachines.Rows.Count > 0) { lblError.Text = ""; } else { lblError.Text = "No Records found"; } }
protected void grdMachines_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); obj.Op = 6; obj.ID = Convert.ToInt32(grdMachines.DataKeys[e.NewSelectedIndex].Value); DataTable dt = obj.MachineTransfer(obj).Tables[0]; pnlUpdate.Visible = true; pnlRequests.Visible = false; if (grdMachines.Rows[e.NewSelectedIndex].Cells[6].Text == "Pending for Approval" || grdMachines.Rows[e.NewSelectedIndex].Cells[6].Text == "Canceled" || grdMachines.Rows[e.NewSelectedIndex].Cells[6].Text == "Delivered") { ddlStatus.Enabled = false; txtERemarks.Enabled = false; btnUpdate.Enabled = false; } else { ddlStatus.Enabled = true; txtERemarks.Enabled = true; btnUpdate.Enabled = true; } if (Convert.ToInt32(Request.Cookies["SiteID"].Value) == Convert.ToInt32(dt.Rows[0]["SourceSiteID"])) { ddlStatus.Items[0].Enabled = true; ddlStatus.Items[1].Enabled = false; } else { ddlStatus.Items[0].Enabled = false; ddlStatus.Items[1].Enabled = true; } txtERemarks.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[7].Text; lblMachineName.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[2].Text; lblSourceSite.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[0].Text; lblDestinationSite.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[1].Text; lblPlacedOn.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[3].Text; lblCurrentStatus.Text = grdMachines.Rows[e.NewSelectedIndex].Cells[6].Text; }
protected void btnSave_Click(object sender, EventArgs e) { clsMachineTransfer obj = new clsMachineTransfer(); //ID, SourceSiteID, DestinationSiteID, SiteMachineID, StartDate, UpdateDate, UpdatedBy, Status, Remarks obj.SourceSiteID = Convert.ToInt32(ddlSourceSite.Text); obj.DestinationSiteID = Convert.ToInt32(ddlDestSite.SelectedValue); obj.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); try { obj.StartDate = Convert.ToDateTime(txtDate.Text).ToShortDateString(); } catch { } try { obj.UpdateDate = Convert.ToDateTime(txtDate.Text).ToShortDateString(); } catch { } obj.UpdatedBy = Convert.ToInt32(Request.Cookies["User"].Value); obj.Status = 0; obj.DriverName = txtDriverName.Text; obj.DriverPhone = txtDriverPhone.Text; obj.Op = 1; obj.MachineTransfer(obj); obj.Op = 9; DataTable dt = obj.MachineTransfer(obj).Tables[0]; SendSMS(Convert.ToInt32(dt.Rows[0][0])); LoadData(); }
public void GetMachineHistory(int SiteMachineID, string DateFrom, string DateTo, int SiteID) { DataTable[] dt = new DataTable[8]; clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = SiteMachineID; obSM.Op = 5; DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; dt[0] = dtSM; /*ID,Site,MachineID,Machine,SerialNo,AddedOn,Status,UpdateDate,a.UsageUnit,a.ThesisNo,a.EngineNo,a.RegistrationNo*/ /*Machine Damage History*/ clsMachineDamage obMD = new clsMachineDamage(); obMD.SiteMachineID = SiteMachineID; obMD.EntryDate1 = DateFrom; obMD.EntryDate2 = DateTo; obMD.Op = 6; DataTable dtMD = obMD.MachineDamage(obMD).Tables[0]; dt[1] = dtMD; /*ID, SiteID,Site,SiteMachineID,Machine,EntryDate,Remarks,IndentID,Indent*/ /*Machine Progress History*/ clsMachineryUsage obMU = new clsMachineryUsage(); obMU.Op = 8; obMU.SiteID = SiteID; obMU.SiteMachineID = SiteMachineID; obMU.EntryDate1 = DateFrom; obMU.EntryDate2 = DateTo; DataTable dtMU = obMU.MachineryUsage(obMU).Tables[0]; dt[2] = dtMU; obMU.Op = 14; DataTable dtFuel = obMU.MachineryUsage(obMU).Tables[0]; dt[3] = dtFuel; obMU.Op = 13; DataTable dtBreakdown = obMU.MachineryUsage(obMU).Tables[0]; dt[4] = dtBreakdown; /*ID,,EntryDate,Shift,ShiftText,SiteID,Site,SiteMachineID,Machine,OpenKMReading,CloseKMReading,TotalKMReading,OpenHRReading,CloseHRReading,TotalHRReading,OpenHSDReading, * CloseHSDReading,HSDIssue,TotalHSDReading,Breakdown,Idle,DriverName,Remarks,Status,EnteredBy*/ /*Issue Slips*/ clsSitePartIssue obSPI = new clsSitePartIssue(); obSPI.Op = 7; obSPI.EntryDate1 = DateFrom; obSPI.EntryDate2 = DateTo; obSPI.SiteMachineID = SiteMachineID; DataTable dtSPI = obSPI.SitePartIssue(obSPI).Tables[0]; dt[5] = dtSPI; /*ID,SiteID,Site,SiteMachineID,Machine,IssueDate,IssueType,Issue,Detail,Quantity,Rate,Total,Remarks*/ /*Machine Transfer*/ clsMachineTransfer obMT = new clsMachineTransfer(); obMT.Op = 8; obMT.SiteMachineID = SiteMachineID; DataTable dtMT = obMT.MachineTransfer(obMT).Tables[0]; dt[6] = dtMT; DataTable dtMTFinal = new DataTable(); dtMTFinal.Columns.Add("Site"); dtMTFinal.Columns.Add("FromDate"); dtMTFinal.Columns.Add("ToDate"); if (dtMT.Rows.Count > 0) { dtMTFinal.Rows.Add(); dtMTFinal.Rows[0]["Site"] = dtMT.Rows[0]["SourceSite"]; dtMTFinal.Rows[0]["FromDate"] = Convert.ToDateTime(dtMT.Rows[0]["AddedOn"]).ToShortDateString(); dtMTFinal.Rows[0]["ToDate"] = Convert.ToDateTime(dtMT.Rows[0]["StartDate"]).ToShortDateString(); for (int i = 1; i < dtMT.Rows.Count; i++) { dtMTFinal.Rows.Add(); dtMTFinal.Rows[i]["Site"] = dtMT.Rows[i]["SourceSite"]; dtMTFinal.Rows[i]["FromDate"] = Convert.ToDateTime(dtMTFinal.Rows[i - 1]["UpdatedDate"]).ToShortDateString(); dtMTFinal.Rows[i]["ToDate"] = Convert.ToDateTime(dtMTFinal.Rows[i]["StartDate"]).ToShortDateString(); } } dt[7] = dtMTFinal; Context.Response.Write(JsonConvert.SerializeObject(dt)); }
void LoadData() { /*Site Machine Detail*/ clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(ddlMachine.SelectedValue); obSM.Op = 5; DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; /*ID,Site,MachineID,Machine,SerialNo,AddedOn,Status,UpdateDate,a.UsageUnit,a.ThesisNo,a.EngineNo,a.RegistrationNo*/ /*Machine Damage History*/ clsMachineDamage obMD = new clsMachineDamage(); obMD.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); try { obMD.EntryDate1 = Convert.ToDateTime(txtDateFrom.Text).ToShortDateString(); } catch { } try { obMD.EntryDate2 = Convert.ToDateTime(txtDateTo.Text).ToShortDateString(); } catch { } obMD.Op = 6; DataTable dtMD = obMD.MachineDamage(obMD).Tables[0]; /*ID, SiteID,Site,SiteMachineID,Machine,EntryDate,Remarks,IndentID,Indent*/ /*Machine Progress History*/ clsMachineryUsage obMU = new clsMachineryUsage(); obMU.Op = 8; obMU.SiteID = Convert.ToInt32(ddlSite.SelectedValue); obMU.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); try { obMU.EntryDate1 = Convert.ToDateTime(txtDateFrom.Text).ToShortDateString(); } catch { } try { obMU.EntryDate2 = Convert.ToDateTime(txtDateTo.Text).ToShortDateString(); } catch { } DataTable dtMU = obMU.MachineryUsage(obMU).Tables[0]; obMU.Op = 14; DataTable dtFuel = obMU.MachineryUsage(obMU).Tables[0]; obMU.Op = 13; DataTable dtBreakdown = obMU.MachineryUsage(obMU).Tables[0]; /*ID,,EntryDate,Shift,ShiftText,SiteID,Site,SiteMachineID,Machine,OpenKMReading,CloseKMReading,TotalKMReading,OpenHRReading,CloseHRReading,TotalHRReading,OpenHSDReading, * CloseHSDReading,HSDIssue,TotalHSDReading,Breakdown,Idle,DriverName,Remarks,Status,EnteredBy*/ /*Issue Slips*/ clsSitePartIssue obSPI = new clsSitePartIssue(); obSPI.Op = 7; try { obSPI.EntryDate1 = Convert.ToDateTime(txtDateFrom.Text).ToShortDateString(); } catch { } try { obSPI.EntryDate2 = Convert.ToDateTime(txtDateTo.Text).ToShortDateString(); } catch { } obSPI.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); DataTable dtSPI = obSPI.SitePartIssue(obSPI).Tables[0]; /*ID,SiteID,Site,SiteMachineID,Machine,IssueDate,IssueType,Issue,Detail,Quantity,Rate,Total,Remarks*/ /*Machine Transfer*/ clsMachineTransfer obMT = new clsMachineTransfer(); obMT.Op = 8; obMT.SiteMachineID = Convert.ToInt32(ddlMachine.SelectedValue); DataTable dtMT = obMT.MachineTransfer(obMT).Tables[0]; DataTable dtMTFinal = new DataTable(); dtMTFinal.Columns.Add("Site"); dtMTFinal.Columns.Add("FromDate"); dtMTFinal.Columns.Add("ToDate"); if (dtMT.Rows.Count > 0) { dtMTFinal.Rows.Add(); dtMTFinal.Rows[0]["Site"] = dtMT.Rows[0]["SourceSite"]; dtMTFinal.Rows[0]["FromDate"] = Convert.ToDateTime(dtMT.Rows[0]["AddedOn"]).ToShortDateString(); dtMTFinal.Rows[0]["ToDate"] = Convert.ToDateTime(dtMT.Rows[0]["StartDate"]).ToShortDateString(); for (int i = 1; i < dtMT.Rows.Count; i++) { dtMTFinal.Rows.Add(); dtMTFinal.Rows[i]["Site"] = dtMT.Rows[i]["SourceSite"]; dtMTFinal.Rows[i]["FromDate"] = Convert.ToDateTime(dtMTFinal.Rows[i - 1]["UpdatedDate"]).ToShortDateString(); dtMTFinal.Rows[i]["ToDate"] = Convert.ToDateTime(dtMTFinal.Rows[i]["StartDate"]).ToShortDateString(); } } /*ID,SourceSiteID,AddedOn,SourceSite,DestinationSiteID,DestinationSite,SiteMachineID,StartDate,UpdateDate,UpdatedBy,Status,Remarks*/ LiteralControl lc = new LiteralControl(); lc.Text = "<h4>T K ENGINEERING CONSORTIUM PVT. LTD.</h4>"; lc.Text = lc.Text + "<br><br><h5>Basic Detail:</h5>"; lc.Text = lc.Text + "<table width='100%' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td>Site: " + dtSM.Rows[0]["Site"] + "</td><td>Machine: " + dtSM.Rows[0]["Machine"] + "</td><td>Log No: " + dtSM.Rows[0]["SerialNo"] + "</td><td>Registration No: " + dtSM.Rows[0]["RegistrationNo"] + "</td></tr>"; lc.Text = lc.Text + "<tr><td>Engine No: " + dtSM.Rows[0]["EngineNo"] + "</td><td>Current Status: " + dtSM.Rows[0]["Status"] + "</td><td colspan='2'>Chessis No: " + dtSM.Rows[0]["ThesisNo"] + "</td></tr>"; lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<h5>List of locations of the machine:</h5><br>"; lc.Text = lc.Text + "<table width='100%' border='1' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td><b>From Date</b></td><td><b>To Date</b></td><td><b>Location</b></td></tr>"; foreach (DataRow dr in dtMTFinal.Rows) { lc.Text = lc.Text + "<tr><td>" + dr["FromDate"] + "</td><td>" + dr["ToDate"] + "</b></td><td>" + dr["Site"] + "</td></tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<h5>Fuel Issues</h5><br>"; lc.Text = lc.Text + "<table width='100%' border='1' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td><b>Date</b></td><td><b>Site</b></td><td><b>Amount</b></td></tr>"; foreach (DataRow dr in dtFuel.Rows) { lc.Text = lc.Text + "<tr><td>" + Convert.ToDateTime(dr["EntryDate"]).ToShortDateString() + "</td><td>" + dr["Site"] + "</td><td>" + Convert.ToInt32(dr["HSDIssue"]) + "</td></tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<h5>Spare Part Issue:</h5><br>"; //ID,SiteID,Site,SiteMachineID,Machine,IssueDate,IssueType,Issue,Detail,Quantity,Rate,Total,Remarks lc.Text = lc.Text + "<table width='100%' border='1' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td><b>Date</b></td><td><b>Site</b></td><td><b>Part No</b></td><td><b>Part Name</b></td><td><b>Quantity</b></td></tr>"; foreach (DataRow dr in dtSPI.Rows) { if (Convert.ToInt32(dr["IssueType"]) == 2) { lc.Text = lc.Text + "<tr><td>" + Convert.ToDateTime(dr["IssueDate"]).ToShortDateString() + "</td><td>" + Convert.ToDateTime(dr["Site"]) + "</td><td>" + dr["PartNo"] + "</td><td>" + Convert.ToInt32(dr["PartName"]) + "</td><td>" + dr["Quantity"] + "</td></tr>"; } } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<h5>Breakdowns:</h5><br>"; lc.Text = lc.Text + "<table width='100%' border='1' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td><b>Date</b></td><td><b>Remarks</b></td><td><b>Indent</b></td></tr>"; foreach (DataRow dr in dtMD.Rows) { lc.Text = lc.Text + "<tr><td>" + Convert.ToDateTime(dr["EntryDate"]).ToShortDateString() + "</td><td>" + dr["Remarks"] + "</td><td>" + dr["Indent"] + "</td></tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<h5>Daily Progress Report:</h5><br>"; /*ID,EntryDate,Shift,ShiftText,SiteID,Site,SiteMachineID,Machine,OpenKMReading,CloseKMReading,TotalKMReading,OpenHRReading,CloseHRReading,TotalHRReading,OpenHSDReading, * CloseHSDReading,HSDIssue,TotalHSDReading,Breakdown,Idle,DriverName,Remarks,Status,EnteredBy*/ lc.Text = lc.Text + "<table width='100%' border='1' style='font-size:6'>"; lc.Text = lc.Text + "<tr><td><b>Site</b></td><td><b>Entry Date</b></td><td><b>Shift</b></td><td><b>Open KM Reading</b></td><td><b>Close KM Reading</b></td><td><b>Total KM Reading</b></td>"; lc.Text = lc.Text + "<td><b>Open HR Reading</b></td><td><b>Close HR Reading</b></td><td><b>Total HR Reading</b></td><td><b>Open HSD Reading</b></td><td><b>Close HSD Reading</b></td>"; lc.Text = lc.Text + "<td><b>HSD Issue</b></td><td><b>Total HSD Reading</b></td><td><b>Breakdown</b></td><td><b>Idle</b></td><td><b>Driver Name</b></td><td><b>Remarks</b></td>"; foreach (DataRow dr in dtMU.Rows) { lc.Text = lc.Text + "<tr>"; lc.Text = lc.Text + "<td>" + dr["Site"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["EntryDate"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["ShiftText"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["OpenKMReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["CloseKMReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["TotalKMReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["OpenHRReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["CloseHRReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["TotalHRReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["OpenHSDReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["CloseHSDReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["HSDIssue"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["TotalHSDReading"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["Breakdown"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["Idle"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["DriverName"] + "</td>"; lc.Text = lc.Text + "<td>" + dr["Remarks"] + "</td>"; lc.Text = lc.Text + "</tr>"; } lc.Text = lc.Text + "</table>"; pnlDetail.Controls.Add(lc); }