protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow dr in grd.Rows) { HiddenField hdSiteMachineID = dr.FindControl("hdSiteMachineID") as HiddenField; HiddenField hdIndentID = dr.FindControl("hdIndentID") as HiddenField; TextBox txtRemark = dr.FindControl("txtRemark") as TextBox; CheckBox chkBreak = dr.FindControl("chkBreak") as CheckBox; if (chkBreak.Checked == true) { clsMachineDamage obj = new clsMachineDamage(); obj.SiteID = Convert.ToInt32(ddlSite.SelectedValue); obj.SiteMachineID = Convert.ToInt32(hdSiteMachineID.Value); try { obj.EntryDate1 = Convert.ToDateTime(txtDate.Text).ToShortDateString(); } catch { obj.EntryDate1 = DateTime.Today.ToShortDateString(); } obj.Remarks = txtRemark.Text; try { obj.IndentID = Convert.ToInt32(hdIndentID.Value); } catch { obj.IndentID = 0; } obj.Op = 1; obj.MachineDamage(obj); clsSiteMachines obSM = new clsSiteMachines(); obSM.Op = 2; try { obSM.UpdateDate = Convert.ToDateTime(txtDate.Text).ToShortDateString(); } catch { } obSM.Status = 3; obSM.ID = Convert.ToInt32(hdSiteMachineID.Value); obSM.SiteMachines(obSM); } } pnlExisting.Visible = true; pnlNewEntry.Visible = false; LoadDamage(); }
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; }
public void GetAllSiteMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.Op = 7; DataTable dt = obj.SiteMachines(obj).Tables[0]; Context.Response.Write(JsonConvert.SerializeObject(dt)); }
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 GetMachinesBySite(int SiteID) { clsSiteMachines obj = new clsSiteMachines(); obj.Op = 3; obj.SiteID = SiteID; DataTable dt = obj.SiteMachines(obj).Tables[0]; Context.Response.Write(JsonConvert.SerializeObject(dt)); }
protected void btnUpdate_Click(object sender, EventArgs e) { clsSiteMachines obj = new clsSiteMachines(); obj.ID = Convert.ToInt32(hdEid.Value); obj.Op = 2; obj.Status = Convert.ToInt32(ddlStatus.SelectedValue); obj.UpdateDate = DateTime.Today.ToShortDateString(); obj.SiteMachines(obj); pnlChange.Visible = false; pnlExisting.Visible = true; LoadMachines(); }
void LoadMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(ddlSite.SelectedValue); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; ddlMachine.DataSource = dt; ddlMachine.DataTextField = "Machine"; ddlMachine.DataValueField = "ID"; ddlMachine.DataBind(); }
void LoadMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; ddlMachine.DataSource = dt; ddlMachine.DataValueField = "ID"; ddlMachine.DataTextField = "Machine"; ddlMachine.DataBind(); }
void SavePOItems(int POID) { foreach (GridViewRow dr in grd.Rows) { clsPOParticulars ob = new clsPOParticulars(); //POID, PartNo, Item,CurrentStock, Qty, UGM, Rate,Tax, Amount,Remark TextBox txtQuantity1 = (TextBox)dr.FindControl("txtQuantity1"); //TextBox txtLogNo1 = (TextBox)dr.FindControl("txtLogNo1"); TextBox txtPartNo1 = (TextBox)dr.FindControl("txtPartNo1"); TextBox txtPartName1 = (TextBox)dr.FindControl("txtPartName1"); TextBox txtUOM1 = (TextBox)dr.FindControl("txtUOM1"); Label lblCurrentStock1 = (Label)dr.FindControl("lblCurrentStock1"); TextBox txtRate1 = (TextBox)dr.FindControl("txtRate1"); TextBox txtCGST = (TextBox)dr.FindControl("txtCGST1"); TextBox txtSGST = (TextBox)dr.FindControl("txtSGST1"); TextBox txtIGST = (TextBox)dr.FindControl("txtIGST1"); TextBox txtTotal1 = (TextBox)dr.FindControl("txtTotal1"); TextBox txtRemark1 = (TextBox)dr.FindControl("txtRemark1"); HiddenField hdPartID = (HiddenField)dr.FindControl("hdPartID"); if (txtPartNo1.Text != "" && txtRate1.Text != "" && txtQuantity1.Text != "") { ob.POID = POID; ob.PartNo = txtPartNo1.Text; ob.Item = txtPartName1.Text; ob.CurrentStock = Convert.ToInt32(lblCurrentStock1.Text); ob.Qty = Convert.ToInt32(txtQuantity1.Text); ob.UGM = txtUOM1.Text; ob.Rate = Convert.ToDouble(txtRate1.Text); ob.CGST = Convert.ToDouble(txtCGST.Text); ob.SGST = Convert.ToDouble(txtSGST.Text); ob.IGST = Convert.ToDouble(txtIGST.Text); ob.Amount = Convert.ToDouble(txtTotal1.Text); ob.Remark = txtRemark1.Text; ob.Op = 1; ob.POParticularsMaster(ob); if (hdPartID.Value == "") { clsPart obPart = new clsPart(); clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(ddlSite.SelectedValue); obSM.Op = 5; DataTable dtMDetail = obSM.SiteMachines(obSM).Tables[0]; obPart.MachineID = Convert.ToInt32(dtMDetail.Rows[0]["MachineID"]); obPart.PartName = txtPartName1.Text; obPart.SerialNo = txtPartNo1.Text; obPart.Op = 1; obPart.PartMaster(obPart); } } } }
void LoadMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; ddlMachine.DataSource = dt; ddlMachine.DataValueField = "ID"; ddlMachine.DataTextField = "Machine"; ddlMachine.DataBind(); ddlMachine.Items.Insert(0, new System.Web.UI.WebControls.ListItem("All", "0")); }
//ID, SiteID, MachineID, SerialNo, AddedOn, Status, UpdateDate, UsageUnit protected void btnSave_Click(object sender, EventArgs e) { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.MachineID = Convert.ToInt32(hdMachine.Value); obj.SerialNo = txtSerial.Text; obj.AddedOn = txtAddedOn.Text; obj.Status = 1; obj.UpdateDate = txtAddedOn.Text; obj.UsageUnit = txtUnit.Text; obj.Op = 1; obj.SiteMachines(obj); LoadMachines(); pnlNew.Visible = false; pnlExisting.Visible = true; }
void LoadMachines() { try { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(ddlSite.SelectedValue); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; ddlMachine.DataSource = dt; ddlMachine.DataValueField = "ID"; ddlMachine.DataTextField = "Machine"; ddlMachine.DataBind(); ddlMachine.Items.Insert(0, new ListItem("Select")); } catch { } }
void AddTempItemsToIndent(int IndentID) { foreach (GridViewRow dr in grd.Rows) { clsIndentItems obj = new clsIndentItems(); //TextBox txtLogNo = dr.FindControl("txtLogNo") as TextBox; TextBox txtPartNo = dr.FindControl("txtPartNo") as TextBox; TextBox txtItem = dr.FindControl("txtItem") as TextBox; TextBox txtCurrentStock = dr.FindControl("txtCurrentStock") as TextBox; TextBox txtQuantity = dr.FindControl("txtQuantity") as TextBox; TextBox txtUOM = dr.FindControl("txtUOM") as TextBox; TextBox txtRemark = dr.FindControl("txtRemark") as TextBox; FileUpload file = dr.FindControl("file") as FileUpload; HiddenField hdPartID = dr.FindControl("hdPartID") as HiddenField; if (((txtPartNo.Text != "" && txtItem.Text != "") || file.HasFile) && Convert.ToInt32(txtQuantity.Text) != 0) { clsIndentItems objItems = new clsIndentItems(); objItems.Op = 1; objItems.IndentID = IndentID; //objItems.LogNo = txtLogNo.Text; objItems.PartNo = txtPartNo.Text; objItems.Particular = txtItem.Text; objItems.CurrentStock = Convert.ToInt32(txtCurrentStock.Text); objItems.Quantity = Convert.ToInt32(txtQuantity.Text); objItems.UOM = txtUOM.Text; objItems.Remarks = txtRemark.Text; objItems.Photo = UploadPhoto(file); objItems.IndentItemMaster(objItems); if (hdPartID.Value == "0") { clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(ddlMachine.SelectedValue); obSM.Op = 5; DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; clsPart obPart = new clsPart(); obPart.SerialNo = txtPartNo.Text; obPart.PartName = txtItem.Text; obPart.MachineID = Convert.ToInt32(dtSM.Rows[0]["SiteMachineID"]); obPart.Op = 1; obPart.PartMaster(obPart); } } } }
void LoadMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; grdMachines.DataSource = dt; grdMachines.DataBind(); if (grdMachines.Rows.Count > 0) { lblError.Text = ""; } else { lblError.Text = "No Records found"; } }
void LoadMachines() { clsSiteMachines obj = new clsSiteMachines(); obj.SiteID = Convert.ToInt32(ddlSite.SelectedValue); obj.Op = 3; DataTable dt = obj.SiteMachines(obj).Tables[0]; DataTable dtNew = new DataTable(); dtNew.Columns.Add("SL"); dtNew.Columns.Add("Machine"); dtNew.Columns.Add("SiteMachineID"); for (int i = 0; i < dt.Rows.Count; i++) { dtNew.Rows.Add(); dtNew.Rows[i][0] = i + 1; dtNew.Rows[i][1] = dt.Rows[i]["Machine"].ToString(); dtNew.Rows[i][2] = dt.Rows[i]["ID"]; } grd.DataSource = dtNew; grd.DataBind(); }
void LoadOrderForPDF() { clsIndent obIndent = new clsIndent(); clsCustomer obCustomer = new clsCustomer(); clsSite obSite = new clsSite(); clsIndentItems obIndentItems = new clsIndentItems(); clsUser obU = new clsUser(); clsCompany obC = new clsCompany(); clsSiteMachines obSM = new clsSiteMachines(); DataTable dtCustomer; //Company Detail obC.Op = 3; DataTable dtCompany = obC.CompanyMster(obC).Tables[0]; //Indent detail obIndent.ID = Convert.ToInt32(Request.QueryString["ID"]); obIndent.Op = 4; DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0]; //User Detail obU.Op = 5; obU.ID = Convert.ToInt32(dtIndent.Rows[0]["Indentor"]); DataTable dtIndentor = obU.UserMaster(obU).Tables[0]; obU.ID = Convert.ToInt32(dtIndent.Rows[0]["ApprovedBy"]); DataTable dtApprovedBy = obU.UserMaster(obU).Tables[0]; //Customer Detail if (Convert.ToInt32(dtIndent.Rows[0]["OrderFrom"]) == 1) { //Site Detail obSite.Op = 5; obSite.ID = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]); dtCustomer = obSite.SiteMaster(obSite).Tables[0]; } else { //Customer Detail obCustomer.ID = Convert.ToInt32(dtIndent.Rows[0]["OrderFromID"]); obCustomer.Op = 4; dtCustomer = obCustomer.CustomerMaster(obCustomer).Tables[0]; } //Indent Items obIndentItems.IndentID = Convert.ToInt32(Request.QueryString["ID"]); obIndentItems.Op = 2; DataTable dtIndentItems = obIndentItems.IndentItemMaster(obIndentItems).Tables[0]; //Machine Detail obSM.Op = 5; obSM.ID = Convert.ToInt32(dtIndent.Rows[0]["SiteMachineID"]); DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; LiteralControl lc = new LiteralControl(); lc.Text = ""; lc.Text = lc.Text + "<table width='100%' style='font-size:8;'>"; lc.Text = lc.Text + "<tr><td colspan='12' align='center'><h3>" + dtCompany.Rows[0]["Name"] + "</h3></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12' align='center'>Project Name: " + dtIndent.Rows[0]["ProjectNo"] + "</h3></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12' align='center'>Job No: " + dtIndent.Rows[0]["JobNo"] + "</h3></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12' align='center'><h3><u>INDENT FORM</u></h3></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'>" + dtCustomer.Rows[0]["Name"]; lc.Text = lc.Text + "<br>Address :" + dtCustomer.Rows[0]["Address"].ToString().Replace("\n", "<br>"); lc.Text = lc.Text + "<br>Phone No: " + dtCustomer.Rows[0]["PhoneNo"]; lc.Text = lc.Text + "<br>Email: " + dtCustomer.Rows[0]["Email"]; lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'>Machine Detail:"; lc.Text = lc.Text + "<br>Model/Make: " + dtSM.Rows[0]["Machine"]; lc.Text = lc.Text + "<br>Log No: " + dtSM.Rows[0]["SerialNo"]; lc.Text = lc.Text + "<br>Registration No: " + dtSM.Rows[0]["RegistrationNo"]; lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='9' align='left'>Ref No:" + dtIndent.Rows[0]["RefNo"] + "</td>"; lc.Text = lc.Text + "<td colspan='3' align='right'>Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString() + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12' style='height:50'></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'>"; //Items// lc.Text = lc.Text + "<table width='100%' border='1' align='center'>"; lc.Text = lc.Text + "<tr><td colspan='1' align='center'>Serial No</td><td colspan='2' align='left'>Part No</td><td colspan='4' align='left'>Particular Description</td><td colspan='1' align='center'>Current Stock</td><td colspan='1' align='center'>Quantity</td><td colspan='3' align='left'>Remarks</td></tr>"; int i = 0; foreach (DataRow drItems in dtIndentItems.Rows) { i++; lc.Text = lc.Text + "<tr>"; lc.Text = lc.Text + "<td colspan='1' align='center'>" + i.ToString() + "</td>"; lc.Text = lc.Text + "<td colspan='2' align='left'>" + drItems["PartNo"] + "</td>"; lc.Text = lc.Text + "<td colspan='4' align='left'>" + drItems["Particular"].ToString().Replace("\n", "<br>") + "</td>"; lc.Text = lc.Text + "<td colspan='1' align='center'>" + drItems["CurrentStock"] + "</td>"; lc.Text = lc.Text + "<td colspan='1' align='center'>" + drItems["Quantity"] + "</td>"; lc.Text = lc.Text + "<td colspan='3' align='left'>" + drItems["Remarks"] + "</td>"; lc.Text = lc.Text + "</tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<table width='100%'>"; if (i < 20) { i = 20 - i; while (i > 0) { lc.Text = lc.Text + "<tr style='border:none;'><td colspan='12' style='border:none;'><br></td></tr>"; i--; } } lc.Text = lc.Text + "</table>"; //Items lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'>"; lc.Text = lc.Text + "<table width='100%' border='1' align='center'>"; lc.Text = lc.Text + "<tr height='100'><td align='center'>"; try { if (dtIndentor.Rows[0]["Signature"].ToString().Trim() != "") { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtIndentor.Rows[0]["Signature"]) + "' height='50' width='120'/>"; } lc.Text = lc.Text + "<br>Indentor: " + dtIndentor.Rows[0]["Name"] + "</td>"; } catch { } lc.Text = lc.Text + "<td align='center'>"; if (dtApprovedBy.Rows.Count > 0) { try { if (dtApprovedBy.Rows[0]["Signature"].ToString().Trim() != "") { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtApprovedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>"; } lc.Text = lc.Text + "<br>Approved By: " + dtApprovedBy.Rows[0]["Name"]; } catch { } } lc.Text = lc.Text + "</td></tr></table>"; lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "</table>"; Label lb = new Label(); lb.Text = lc.ToString(); pnlDetail.Controls.Add(lc); }
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); }
void LoadOrder() { clsIndent obIndent = new clsIndent(); clsCustomer obCustomer = new clsCustomer(); clsSite obSite = new clsSite(); clsPurchaseOrder obPO = new clsPurchaseOrder(); clsPOParticulars obPOP = new clsPOParticulars(); clsPOTerms obPOT = new clsPOTerms(); clsUser obU = new clsUser(); clsCompany obC = new clsCompany(); clsSiteMachines obSM = new clsSiteMachines(); DataTable dtCustomer; //Company Detail obC.Op = 3; DataTable dtCompany = obC.CompanyMster(obC).Tables[0]; //Purchase Order Detail obPO.Op = 3; obPO.ID = Convert.ToInt32(Request.QueryString["ID"]); DataTable dtPO = obPO.PurchaseOrderMaster(obPO).Tables[0]; //Indent detail obIndent.RefNo = dtPO.Rows[0]["IndentRefNo"].ToString(); obIndent.Op = 8; DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0]; //Purchase Order Particulars obPOP.POID = Convert.ToInt32(Request.QueryString["ID"]); obPOP.Op = 2; DataTable dtPOItems = obPOP.POParticularsMaster(obPOP).Tables[0]; //Purchase Order terms obPOT.POID = Convert.ToInt32(Request.QueryString["ID"]); obPOT.Op = 3; DataTable dtPOTerms = obPOT.POTermsMaster(obPOT).Tables[0]; //User Detail obU.Op = 5; obU.ID = Convert.ToInt32(dtPO.Rows[0]["PreparedBy"]); DataTable dtPreparedBy = obU.UserMaster(obU).Tables[0]; obU.ID = Convert.ToInt32(dtPO.Rows[0]["CheckedBy"]); DataTable dtCheckedBy = obU.UserMaster(obU).Tables[0]; //Site Detail obSite.Op = 5; obSite.ID = Convert.ToInt32(dtPO.Rows[0]["SiteID"]); dtCustomer = obSite.SiteMaster(obSite).Tables[0]; //Machine Detail obSM.Op = 5; obSM.ID = Convert.ToInt32(dtPO.Rows[0]["SiteMachineID"]); DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; //Machine Detail LiteralControl lc = new LiteralControl(); lc.Text = ""; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<div class='col-lg-9'>"; lc.Text = lc.Text + "<h3>" + dtCompany.Rows[0]["Name"] + "<br>" + dtCompany.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "</h3>"; lc.Text = lc.Text + "<h4>TIN:" + dtCompany.Rows[0]["Tin"] + "<br>CST:" + dtCompany.Rows[0]["Cst"] + "</h4>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-3'>"; lc.Text = lc.Text + "<img src='../" + dtCompany.Rows[0]["Logo"] + "' height='150' width='150' />"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<center><h4><b>Purchase Order</b></h4></center>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<div class='col-lg-9'>"; lc.Text = lc.Text + "PO Ref No: " + dtPO.Rows[0]["PORefNo"] + "<br />"; lc.Text = lc.Text + "To,<br />"; lc.Text = lc.Text + dtCustomer.Rows[0]["Name"] + "<br>"; lc.Text = lc.Text + dtCustomer.Rows[0]["Location"] + "<br>"; lc.Text = lc.Text + dtCustomer.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "<br>"; if (dtCustomer.Rows[0]["PhoneNo"].ToString() != "") { lc.Text = lc.Text + "Phone No:" + dtCustomer.Rows[0]["PhoneNo"] + "<br>"; } if (dtCustomer.Rows[0]["Email"].ToString() != "") { lc.Text = lc.Text + "Email ID:" + dtCustomer.Rows[0]["Email"] + "<br>"; } lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-3'>"; lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["PODate"]).ToShortDateString(); lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<div class='col-lg-4'>Machine: " + dtSM.Rows[0]["Machine"] + "</div>"; lc.Text = lc.Text + "<div class='col-lg-4'>Log No: " + dtSM.Rows[0]["SerialNo"] + "</div>"; lc.Text = lc.Text + "<div class='col-lg-4'>Registration No: " + dtSM.Rows[0]["RegistrationNo"] + "</div>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<table width='95%' align='center' border='1'><tr><td>"; lc.Text = lc.Text + "Quotation No:" + dtPO.Rows[0]["QuotationNo"] + "<br />"; lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["QuotationDate"]).ToShortDateString(); lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "<td>"; if (dtIndent.Rows.Count > 0) { lc.Text = lc.Text + "Indent Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString(); } lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "</tr></table>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "Subject:" + dtPO.Rows[0]["Subject"]; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + txtMessage.Text.Replace("\n", "<br>"); lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12' style='min-height:300'>"; //Items// lc.Text = lc.Text + "<table width='98%' border='1' align='center'>"; lc.Text = lc.Text + "<tr><td>Serial No</td><td>Part No</td><td>Item</td><td>Current Stock</td><td>Quantity</td><td>UOM</td><td>Remarks</td><td>Rate</td><td>Tax</td><td>Amount</td></tr>"; int i = 0; foreach (DataRow drItems in dtPOItems.Rows) { i++; lc.Text = lc.Text + "<tr>"; lc.Text = lc.Text + "<td>" + i.ToString() + "</td>"; lc.Text = lc.Text + "<td>" + drItems["PartNo"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Item"].ToString().Replace("\n", "<br>") + "</td>"; lc.Text = lc.Text + "<td>" + drItems["CurrentStock"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Qty"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["UGM"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Remark"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Rate"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Tax"] + " %</td>"; lc.Text = lc.Text + "<td width='75' align='right'>" + drItems["Amount"] + "</td>"; lc.Text = lc.Text + "</tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<table width='98%' align='center'>"; lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Total Amount</td><td width='50'></td><td width='75' align='right'>" + dtPO.Rows[0]["TotalAmount"] + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='9' align='right'>" + dtPO.Rows[0]["TaxName"] + "</td><td></td><td align='right'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["TaxPercentage"]) / 100).ToString() + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Discount " + dtPO.Rows[0]["DiscountPercentage"] + "%</td><td></td><td align='right'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["DiscountPercentage"]) / 100).ToString() + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='9' align='right'>Net Payable</td><td></td><td align='right'>" + dtPO.Rows[0]["NetPayable"] + "</td></tr>"; lc.Text = lc.Text + "</table>"; //Items lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'><h4><i>Terms & Conditions:</i></h4><br>"; //Terms lc.Text = lc.Text + "<table width='98%' border='1' align='center'>"; foreach (DataRow drTerms in dtPOTerms.Rows) { lc.Text = lc.Text + "<tr><td>" + drTerms["Heading"] + "</td><td>" + drTerms["Detail"] + "</td></tr>"; } lc.Text = lc.Text + "</table>"; //Terms lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'><br><br>"; lc.Text = lc.Text + "</div>"; lc.Text = lc.Text + "<div class='col-lg-12'>"; lc.Text = lc.Text + "<table width='98%' border='1' align='center'>"; lc.Text = lc.Text + "<tr height='100'><td width='25%'>"; lc.Text = lc.Text + "<img src='../" + dtPreparedBy.Rows[0]["Signature"] + "' height='50' width='120'/>"; lc.Text = lc.Text + "<br>Prepared By</td>"; lc.Text = lc.Text + "<td width='25%'>"; lc.Text = lc.Text + "<img src='../" + dtCheckedBy.Rows[0]["Signature"] + "' height='50' width='120'/>"; lc.Text = lc.Text + "<br>Checked By</td>"; lc.Text = lc.Text + "<td width='48%'><center>Authorized Signatory<br /><br /><br />" + dtCompany.Rows[0]["Name"] + "</center></td></tr></table>"; lc.Text = lc.Text + "</div>"; Label lb = new Label(); lb.Text = lc.ToString(); pnlDetail.Controls.Add(lc); }
void LoadOrderForPDF() { clsIndent obIndent = new clsIndent(); clsCustomer obCustomer = new clsCustomer(); clsSite obSite = new clsSite(); clsPurchaseOrder obPO = new clsPurchaseOrder(); clsPOParticulars obPOP = new clsPOParticulars(); clsPOTerms obPOT = new clsPOTerms(); clsUser obU = new clsUser(); clsCompany obC = new clsCompany(); clsSiteMachines obSM = new clsSiteMachines(); DataTable dtCustomer; //Company Detail obC.Op = 3; DataTable dtCompany = obC.CompanyMster(obC).Tables[0]; //Purchase Order Detail obPO.Op = 3; obPO.ID = Convert.ToInt32(Request.QueryString["ID"]); DataTable dtPO = obPO.PurchaseOrderMaster(obPO).Tables[0]; //Indent detail obIndent.RefNo = dtPO.Rows[0]["IndentRefNo"].ToString(); obIndent.Op = 8; DataTable dtIndent = obIndent.IndentMaster(obIndent).Tables[0]; //Purchase Order Particulars obPOP.POID = Convert.ToInt32(Request.QueryString["ID"]); obPOP.Op = 2; DataTable dtPOItems = obPOP.POParticularsMaster(obPOP).Tables[0]; //Purchase Order terms obPOT.POID = Convert.ToInt32(Request.QueryString["ID"]); obPOT.Op = 3; DataTable dtPOTerms = obPOT.POTermsMaster(obPOT).Tables[0]; //User Detail obU.Op = 5; obU.ID = Convert.ToInt32(dtPO.Rows[0]["PreparedBy"]); DataTable dtPreparedBy = obU.UserMaster(obU).Tables[0]; obU.ID = Convert.ToInt32(dtPO.Rows[0]["CheckedBy"]); DataTable dtCheckedBy = obU.UserMaster(obU).Tables[0]; //Site Detail obSite.Op = 5; obSite.ID = Convert.ToInt32(dtPO.Rows[0]["SiteID"]); dtCustomer = obSite.SiteMaster(obSite).Tables[0]; //Machine Detail obSM.Op = 5; obSM.ID = Convert.ToInt32(dtPO.Rows[0]["SiteMachineID"]); DataTable dtSM = obSM.SiteMachines(obSM).Tables[0]; //Machine Detail //Purchase Order To detail// clsCustomer ObPOTo = new clsCustomer(); ObPOTo.Op = 4; ObPOTo.ID = Convert.ToInt32(dtPO.Rows[0]["POTo"]); DataTable dtPOTo = ObPOTo.CustomerMaster(ObPOTo).Tables[0]; //Purchase order to detail// LiteralControl lc = new LiteralControl(); lc.Text = "<div style='width:100%; margin:50 padding:50;'>"; lc.Text = lc.Text + "<table width='100%' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td align='left' colspan='9'>"; lc.Text = lc.Text + "<h5>" + dtCompany.Rows[0]["Name"] + "<br>" + dtCompany.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "</h5>"; lc.Text = lc.Text + "<h6>TIN:" + dtCompany.Rows[0]["Tin"] + "<br>CST:" + dtCompany.Rows[0]["Cst"] + "</h6>"; lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "<td align='right' colspan='3'>"; try { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCompany.Rows[0]["Logo"]) + "' height='100' width='100' />"; } catch { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCompany.Rows[0]["Logo"]) + "' height='100' width='100' />"; } lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td align='center' colspan='12'><h5><b>Purchase Order</b></h5></td></tr>"; lc.Text = lc.Text + "<tr><td align='left' colspan='6'>"; lc.Text = lc.Text + "PO Ref No: " + dtPO.Rows[0]["PORefNo"] + "<br />"; lc.Text = lc.Text + "To,<br />"; lc.Text = lc.Text + dtCustomer.Rows[0]["Name"] + "<br>"; lc.Text = lc.Text + dtCustomer.Rows[0]["Location"] + "<br>"; lc.Text = lc.Text + dtCustomer.Rows[0]["Address"].ToString().Replace("\n", "<br>") + "<br>"; if (dtCustomer.Rows[0]["PhoneNo"].ToString() != "") { lc.Text = lc.Text + "Phone No:" + dtCustomer.Rows[0]["PhoneNo"] + "<br>"; } if (dtCustomer.Rows[0]["Email"].ToString() != "") { lc.Text = lc.Text + "Email ID:" + dtCustomer.Rows[0]["Email"] + "<br>"; } if (dtPOTo.Rows.Count > 0) { lc.Text = lc.Text + "<b>Purchase Order To,</b><br>"; lc.Text = lc.Text + dtPOTo.Rows[0]["Name"].ToString() + "<br>"; lc.Text = lc.Text + "Phone No:" + dtPOTo.Rows[0]["Phone"].ToString() + "<br>"; lc.Text = lc.Text + dtPOTo.Rows[0]["Address"].ToString().Replace("\n", "<br>"); } lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "<td align='right' colspan='6'>"; lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["PODate"]).ToShortDateString(); lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'><br></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='4'>Machine: " + dtSM.Rows[0]["Machine"] + "</td><td colspan='4'>Log No: " + dtSM.Rows[0]["SerialNo"] + "</td><td colspan='4'>Registration No: " + dtSM.Rows[0]["RegistrationNo"] + "</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='12'>"; lc.Text = lc.Text + "<table width='100%' align='center' border='1'><tr align='left'><td colspan='6'>"; lc.Text = lc.Text + "Quotation No:" + dtPO.Rows[0]["QuotationNo"] + "<br />"; lc.Text = lc.Text + "Date:" + Convert.ToDateTime(dtPO.Rows[0]["QuotationDate"]).ToShortDateString(); lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "<td colspan='6'>"; if (dtIndent.Rows.Count > 0) { lc.Text = lc.Text + "Indent Date:" + Convert.ToDateTime(dtIndent.Rows[0]["IndentDate"]).ToShortDateString(); } lc.Text = lc.Text + "</td>"; lc.Text = lc.Text + "</tr></table></td></tr>"; lc.Text = lc.Text + "<tr><td align='left' colspan='12'>Subject:" + dtPO.Rows[0]["Subject"] + "</td></tr>"; lc.Text = lc.Text + "<tr><td align='left' colspan='12'>"; lc.Text = lc.Text + txtMessage.Text.Replace("\n", "<br>"); lc.Text = lc.Text + "</td></tr>"; lc.Text = lc.Text + "</table>"; /*TEST*/ lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>"; lc.Text = lc.Text + "<tr align='left'><td>SL</td><td>Part No</td><td colspan='2'>Item</td><td>Stock</td><td>Qty</td><td>UOM</td><td>Rate</td><td>Tax</td><td>Amount</td><td colspan='2'>Remarks</td></tr>"; int i = 0; foreach (DataRow drItems in dtPOItems.Rows) { i++; lc.Text = lc.Text + "<tr align='left'><td>" + i.ToString() + "</td>"; lc.Text = lc.Text + "<td>" + drItems["PartNo"] + "</td>"; lc.Text = lc.Text + "<td colspan='2'>" + drItems["Item"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["CurrentStock"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Qty"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["UGM"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Rate"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Tax"] + "</td>"; lc.Text = lc.Text + "<td>" + drItems["Amount"] + "</td>"; lc.Text = lc.Text + "<td colspan='2'>" + drItems["Remark"] + "</td></tr>"; } lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<table width='100%' style='font-size:8'>"; lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<table width='100%' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td colspan='12'><h6>Summery</h6></td></tr>"; lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Total Amount</td><td></td><td align='right' colspan='3'>" + dtPO.Rows[0]["TotalAmount"] + "/- INR</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='8' align='right'>" + dtPO.Rows[0]["TaxName"] + "</td><td></td><td align='right' colspan='3'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["TaxPercentage"]) / 100).ToString() + "/- INR</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Discount " + dtPO.Rows[0]["DiscountPercentage"] + "%</td><td></td><td align='right' colspan='3'>" + (Convert.ToDouble(dtPO.Rows[0]["TotalAmount"]) * Convert.ToDouble(dtPO.Rows[0]["DiscountPercentage"]) / 100).ToString() + "/-INR</td></tr>"; lc.Text = lc.Text + "<tr><td colspan='8' align='right'>Net Payable</td><td></td><td align='right' colspan='3'>" + dtPO.Rows[0]["NetPayable"] + "/-INR</td></tr>"; lc.Text = lc.Text + "</table>"; /*TEST*/ lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>"; //---------------- lc.Text = lc.Text + "<tr><td colspan='12' align='left'><h6><i>Terms & Conditions:</i></h6></td></tr>"; //Terms lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "<table width='100%' style='font-size:8' border='1'>"; foreach (DataRow drTerms in dtPOTerms.Rows) { lc.Text = lc.Text + "<tr align='left'><td colspan='3'>" + drTerms["Heading"] + "</td><td colspan='9'>" + drTerms["Detail"] + "</td></tr>"; } lc.Text = lc.Text + "</table>"; //Terms lc.Text = lc.Text + "<table width='100%' style='font-size:8'>"; lc.Text = lc.Text + "<tr><td colspan='12' align='center'><br><br></td></tr>"; lc.Text = lc.Text + "<tr height='100'><td colspan='4'>"; if (dtPreparedBy.Rows[0]["Signature"].ToString().Trim() != "") { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtPreparedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>"; } lc.Text = lc.Text + "<br>Prepared By</td>"; lc.Text = lc.Text + "<td colspan='4' align='center'>"; if (dtCheckedBy.Rows[0]["Signature"].ToString().Trim() != "") { lc.Text = lc.Text + "<img src='" + MapPath("~/" + dtCheckedBy.Rows[0]["Signature"]) + "' height='50' width='120'/>"; } lc.Text = lc.Text + "<br>Checked By</td>"; lc.Text = lc.Text + "<td colspan='4' align='right'>Authorized Signatory<br /><br /><br />" + dtCompany.Rows[0]["Name"] + "</td></tr>"; lc.Text = lc.Text + "</table>"; lc.Text = lc.Text + "</div>"; Label lb = new Label(); lb.Text = lc.ToString(); pnlDetail.Controls.Add(lc); }
protected void btnSave_Click(object sender, EventArgs e) { clsMachineryUsage obj = new clsMachineryUsage(); obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obj.Shift = Convert.ToInt32(ddlShift.SelectedValue); obj.EntryDate1 = Convert.ToDateTime(txtDate.Text).ToShortDateString(); obj.Op = 12; obj.MachineryUsage(obj); double TotalFuelUsed = 0; foreach (GridViewRow dr in grd.Rows) { Label lblMachine = dr.FindControl("lblMachine") as Label; HiddenField hdSiteMachineID = dr.FindControl("hdSiteMachineID") as HiddenField; TextBox txtOpenKMReading = dr.FindControl("txtOpenKMReading") as TextBox; TextBox txtCloseKMReading = dr.FindControl("txtCloseKMReading") as TextBox; Label lblTotalKMReading = dr.FindControl("lblTotalKMReading") as Label; TextBox txtOpenHReading = dr.FindControl("txtOpenHReading") as TextBox; TextBox txtOpenMReading = dr.FindControl("txtOpenMReading") as TextBox; TextBox txtCloseHReading = dr.FindControl("txtCloseHReading") as TextBox; TextBox txtCloseMReading = dr.FindControl("txtCloseMReading") as TextBox; Label lblTotalHRReading = dr.FindControl("lblTotalHRReading") as Label; TextBox txtOpenHSDReading = dr.FindControl("txtOpenHSDReading") as TextBox; TextBox txtHSDIssue = dr.FindControl("txtHSDIssue") as TextBox; TextBox txtCloseHSDReading = dr.FindControl("txtCloseHSDReading") as TextBox; Label lblTotalHSDReading = dr.FindControl("lblTotalHSDReading") as Label; CheckBox chkBreakdown = dr.FindControl("chkBreakdown") as CheckBox; CheckBox chkIdle = dr.FindControl("chkIdle") as CheckBox; TextBox txtDriver = dr.FindControl("txtDriver") as TextBox; TextBox txtRemarks = dr.FindControl("txtRemarks") as TextBox; obj.SiteMachineID = Convert.ToInt32(hdSiteMachineID.Value); obj.OpenKMReading = Convert.ToDouble(txtOpenKMReading.Text); obj.CloseKMReading = Convert.ToDouble(txtCloseKMReading.Text); obj.TotalKMReading = Convert.ToDouble(lblTotalKMReading.Text); obj.OpenHRReading = txtOpenHReading.Text + ":" + txtOpenMReading.Text; obj.CloseHRReading = txtCloseHReading.Text + ":" + txtCloseMReading.Text; obj.TotalHRReading = lblTotalHRReading.Text; obj.OpenHSDReading = Convert.ToDouble(txtOpenHSDReading.Text); obj.CloseHSDReading = Convert.ToDouble(txtCloseHSDReading.Text); obj.HSDIssue = Convert.ToDouble(txtHSDIssue.Text); TotalFuelUsed = TotalFuelUsed + Convert.ToDouble(txtHSDIssue.Text); obj.TotalHSDReading = Convert.ToDouble(lblTotalHSDReading.Text); if (chkBreakdown.Checked == true) { obj.Breakdown = 1; } if (chkIdle.Checked == true) { obj.Idle = 1; } obj.DriverName = txtDriver.Text; obj.Remarks = txtRemarks.Text; obj.Status = 1; obj.EnteredBy = Convert.ToInt32(Request.Cookies["User"].Value); obj.Op = 1; obj.MachineryUsage(obj); if (chkBreakdown.Checked == true) { clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(hdSiteMachineID.Value); obSM.Op = 2; obSM.Status = 3; try { obSM.UpdateDate = txtDate.Text; } catch { } obSM.SiteMachines(obSM); clsMachineDamage obMD = new clsMachineDamage(); obMD.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); obMD.SiteMachineID = Convert.ToInt32(hdSiteMachineID.Value); obMD.EntryDate1 = Convert.ToDateTime(txtDate.Text).ToShortDateString(); obMD.Remarks = "Entry From Daily Progress Report"; obMD.Op = 1; obMD.MachineDamage(obMD); } else { if (chkIdle.Checked == true) { clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(hdSiteMachineID.Value); obSM.Op = 2; obSM.Status = 2; try { obSM.UpdateDate = txtDate.Text; } catch { } obSM.SiteMachines(obSM); } else { clsSiteMachines obSM = new clsSiteMachines(); obSM.ID = Convert.ToInt32(hdSiteMachineID.Value); obSM.Op = 2; obSM.Status = 1; try { obSM.UpdateDate = txtDate.Text; } catch { } obSM.SiteMachines(obSM); } } } clsSiteFuelIssue obSFI = new clsSiteFuelIssue(); obSFI.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value); try { obSFI.IssueDate1 = Convert.ToDateTime(txtDate.Text).ToShortDateString(); } catch { } obSFI.InAmount = Convert.ToDouble(txtFuelIssued.Text); obSFI.OutAmount = TotalFuelUsed; obSFI.Balance = Convert.ToDouble(txtFuelBalance.Text); obSFI.Rate = 0; obSFI.Total = 0; obSFI.Remarks = "Entry from Daily Progress Report"; obSFI.Op = 1; obSFI.SiteFuelIssue(obSFI); LoadMachines(); LoadFuel(); }
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)); }