protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(strDetails); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oTPM = new TPM(intProfile, dsn, intEnvironment); oProject = new Projects(intProfile, dsn); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oVariable = new Variables(intEnvironment); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intId = Int32.Parse(Request.QueryString["id"]); lblId.Text = Request.QueryString["id"]; } if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { panFinish.Visible = true; } else { if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } if (!IsPostBack) { bool boolDeny = true; if (intId > 0) { ds = oTPM.GetCSRC(intId, intProfile); if (ds.Tables[0].Rows.Count > 0) { boolDeny = false; bool boolButtons = false; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["status"].ToString() == "0") { boolButtons = true; lblStep.Text = dr["step"].ToString(); } } btnApprove.Enabled = boolButtons; btnDeny.Enabled = boolButtons; } } if (boolDeny == false) { panWorkflow.Visible = true; int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); DataSet dsResource = oResourceRequest.Get(intRequest, intItem, intNumber); string strUsers = ""; foreach (DataRow drResource in dsResource.Tables[0].Rows) { int intUser = Int32.Parse(drResource["userid"].ToString()); if (strUsers != "") { strUsers += ", "; } strUsers += oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")"; } sb.Append("<tr><td nowrap><b>Submitter:</b></td><td width=\"100%\">"); sb.Append(strUsers); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Submitted On:</b></td><td width=\"100%\">"); sb.Append(ds.Tables[0].Rows[0]["modified"].ToString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>CSRC Document:</b></td><td width=\"100%\"><a href=\""); sb.Append(oVariable.URL()); sb.Append("/"); sb.Append(ds.Tables[0].Rows[0]["path"].ToString().Replace("\\", "/")); sb.Append("\" target=\"_blank\">Click Here to View</a></td></tr>"); sb.Append("<tr><td nowrap><b>Project Information:</b></td><td width=\"100%\"><a href=\""); sb.Append(oPage.GetFullLink(intViewRequest)); sb.Append("?rid="); sb.Append(intRequest.ToString()); sb.Append("\" target=\"_blank\">Click Here to View</a></td></tr>"); lblDetailId.Text = ds.Tables[0].Rows[0]["detailid"].ToString(); if (ds.Tables[0].Rows[0]["ds"].ToString() != "") { sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); sb.Append("<tr><td nowrap><b>Discovery Phase Start Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["ds"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Discovery Phase End Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["de"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Discovery Internal Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["di"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Discovery External Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["dex"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Discovery HW/SW/One Time Cost:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["dh"].ToString()).ToString("F")); sb.Append("</td></tr>"); } if (ds.Tables[0].Rows[0]["ps"].ToString() != "") { sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); sb.Append("<tr><td nowrap><b>Planning Phase Start Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["ps"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Planning Phase End Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["pe"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Planning Internal Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["pi"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Planning External Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["pex"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Planning HW/SW/One Time Cost:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["ph"].ToString()).ToString("F")); sb.Append("</td></tr>"); } if (ds.Tables[0].Rows[0]["es"].ToString() != "") { sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); sb.Append("<tr><td nowrap><b>Execution Phase Start Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["es"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Execution Phase End Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["ee"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Execution Internal Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["ei"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Execution External Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["eex"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Execution HW/SW/One Time Cost:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["eh"].ToString()).ToString("F")); sb.Append("</td></tr>"); } if (ds.Tables[0].Rows[0]["cs"].ToString() != "") { sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); sb.Append("<tr><td nowrap><b>Closing Phase Start Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["cs"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Closing Phase End Date:</b></td><td width=\"100%\">"); sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["ce"].ToString()).ToLongDateString()); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Closing Internal Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["ci"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Closing External Labor:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["cex"].ToString()).ToString("F")); sb.Append("</td></tr>"); sb.Append("<tr><td nowrap><b>Closing HW/SW/One Time Cost:</b></td><td width=\"100%\">$"); sb.Append(double.Parse(ds.Tables[0].Rows[0]["ch"].ToString()).ToString("F")); sb.Append("</td></tr>"); } sb.Insert(0, "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\">"); sb.Append("</table>"); } else { panDenied.Visible = true; } } } strDetails = sb.ToString(); btnClose.Attributes.Add("onclick", "return CloseWindow();"); btnFinish.Attributes.Add("onclick", "return CloseWindow();"); btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?');"); btnDeny.Attributes.Add("onclick", "return ValidateText('" + txtComments.ClientID + "','Please enter some comments') && confirm('Are you sure you want to DENY this request?');"); }
private void UpdatePDF(string strPath) { Document doc = new Document(); Cell cell; string strPhysicalPath = oVariable.DocumentsFolder() + strPath; FileStream fs = new FileStream(strPhysicalPath, FileMode.Create); PdfWriter.GetInstance(doc, fs); iTextSharp.text.Table oTable = new iTextSharp.text.Table(2); oTable.BorderWidth = 0; oTable.BorderColor = new iTextSharp.text.Color(255, 255, 255); oTable.Padding = 2; oTable.Width = 100; iTextSharp.text.Font oFontHeader = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 10, 1); iTextSharp.text.Font oFontBold = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 1); iTextSharp.text.Font oFont = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 0); string strHeader = "ClearView CSRC Information"; HeaderFooter header = new HeaderFooter(new Phrase(strHeader, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false); header.Border = iTextSharp.text.Rectangle.NO_BORDER; header.Alignment = 2; doc.Header = header; string strFooter = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); HeaderFooter footer = new HeaderFooter(new Phrase(strFooter, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false); footer.Border = iTextSharp.text.Rectangle.NO_BORDER; footer.Alignment = 2; doc.Footer = footer; doc.Open(); ds = oTPM.GetCSRC(intId); int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); DataSet dsResource = oCustomized.GetTPM(intRequest, intItem, intNumber); cell = new Cell(new Phrase("Project Capital Service Review Committee Report", oFontHeader)); cell.Colspan = 2; cell.BackgroundColor = new iTextSharp.text.Color(169, 162, 141); oTable.AddCell(cell); cell = new Cell(new Phrase("PMM Phase", oFontBold)); cell.Colspan = 2; oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Discovery", oFont))); oTable.AddCell(new Cell(new Phrase((chkDiscovery.Checked ? "Yes" : "No"), oFont))); oTable.AddCell(new Cell(new Phrase("Planning", oFont))); oTable.AddCell(new Cell(new Phrase((chkPlanning.Checked ? "Yes" : "No"), oFont))); oTable.AddCell(new Cell(new Phrase("Execution", oFont))); oTable.AddCell(new Cell(new Phrase((chkExecution.Checked ? "Yes" : "No"), oFont))); oTable.AddCell(new Cell(new Phrase("Closing", oFont))); oTable.AddCell(new Cell(new Phrase((chkClosing.Checked ? "Yes" : "No"), oFont))); cell = new Cell(new Phrase("Discovery", oFontBold)); cell.Colspan = 2; oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Phase start date", oFont))); if (txtCSRCSD.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCSD.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Phase end date", oFont))); if (txtCSRCED.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCED.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Internal Labor", oFont))); if (txtCSRCID.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCID.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("External Labor", oFont))); if (txtCSRCExD.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCExD.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("HW/SW/One Time Cost", oFont))); if (txtCSRCHD.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCHD.Text).ToString("F"), oFont))); } cell = new Cell(new Phrase("Planning", oFontBold)); cell.Colspan = 2; oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Phase start date", oFont))); if (txtCSRCSP.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCSP.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Phase end date", oFont))); if (txtCSRCEP.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCEP.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Internal Labor", oFont))); if (txtCSRCIP.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCIP.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("External Labor", oFont))); if (txtCSRCExP.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCExP.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("HW/SW/One Time Cost", oFont))); if (txtCSRCHP.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCHP.Text).ToString("F"), oFont))); } cell = new Cell(new Phrase("Execution", oFontBold)); cell.Colspan = 2; oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Phase start date", oFont))); if (txtCSRCSE.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCSE.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Phase end date", oFont))); if (txtCSRCEE.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCEE.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Internal Labor", oFont))); if (txtCSRCIE.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCIE.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("External Labor", oFont))); if (txtCSRCExE.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCExE.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("HW/SW/One Time Cost", oFont))); if (txtCSRCHE.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCHE.Text).ToString("F"), oFont))); } cell = new Cell(new Phrase("Closing", oFontBold)); cell.Colspan = 2; oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Phase start date", oFont))); if (txtCSRCSC.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCSC.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Phase end date", oFont))); if (txtCSRCEC.Text == "") { oTable.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable.AddCell(new Cell(new Phrase(GetDate(txtCSRCEC.Text), oFont))); } oTable.AddCell(new Cell(new Phrase("Internal Labor", oFont))); if (txtCSRCIC.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCIC.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("External Labor", oFont))); if (txtCSRCExC.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCExC.Text).ToString("F"), oFont))); } oTable.AddCell(new Cell(new Phrase("HW/SW/One Time Cost", oFont))); if (txtCSRCHC.Text == "") { oTable.AddCell(new Cell(new Phrase("$0.0", oFont))); } else { oTable.AddCell(new Cell(new Phrase("$" + GetFloat(txtCSRCHC.Text).ToString("F"), oFont))); } doc.Add(oTable); doc.Close(); fs.Close(); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oPage = new Pages(intProfile, dsn); oUser = new Users(intProfile, dsn); oTPM = new TPM(intProfile, dsn, intEnvironment); oVariable = new Variables(intEnvironment); oProject = new Projects(intProfile, dsn); oOrganization = new Organizations(intProfile, dsn); oCustomized = new Customized(intProfile, dsn); if (Request.QueryString["pid"] != "" && Request.QueryString["pid"] != null) { intProject = Int32.Parse(Request.QueryString["pid"]); } if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null) { intId = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["work"] != "" && Request.QueryString["work"] != null) { intWorking = Int32.Parse(Request.QueryString["work"]); } if (Request.QueryString["exec"] != "" && Request.QueryString["exec"] != null) { intExecutive = Int32.Parse(Request.QueryString["exec"]); } if (!IsPostBack) { ds = oTPM.GetCSRC(intId); chkDiscovery.Checked = ds.Tables[0].Rows[0]["d"].ToString() == "1" ? true : false; divDiscovery.Style["display"] = chkDiscovery.Checked ? "inline" : "none"; chkPlanning.Checked = ds.Tables[0].Rows[0]["p"].ToString() == "1" ? true : false; divPlanning.Style["display"] = chkPlanning.Checked ? "inline" : "none"; chkExecution.Checked = ds.Tables[0].Rows[0]["e"].ToString() == "1" ? true : false; divExecution.Style["display"] = chkExecution.Checked ? "inline" : "none"; chkClosing.Checked = ds.Tables[0].Rows[0]["c"].ToString() == "1" ? true : false; divClosing.Style["display"] = chkClosing.Checked ? "inline" : "none"; //Discovery txtCSRCSD.Text = ds.Tables[0].Rows[0]["ds"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["ds"].ToString()).ToShortDateString() : ""; txtCSRCED.Text = ds.Tables[0].Rows[0]["de"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["de"].ToString()).ToShortDateString() : ""; txtCSRCID.Text = ds.Tables[0].Rows[0]["di"].ToString(); txtCSRCExD.Text = ds.Tables[0].Rows[0]["dex"].ToString(); txtCSRCHD.Text = ds.Tables[0].Rows[0]["dh"].ToString(); //Planning txtCSRCSP.Text = ds.Tables[0].Rows[0]["ps"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["ps"].ToString()).ToShortDateString() : ""; txtCSRCEP.Text = ds.Tables[0].Rows[0]["pe"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["pe"].ToString()).ToShortDateString() : ""; txtCSRCIP.Text = ds.Tables[0].Rows[0]["pi"].ToString(); txtCSRCExP.Text = ds.Tables[0].Rows[0]["pex"].ToString(); txtCSRCHP.Text = ds.Tables[0].Rows[0]["ph"].ToString(); // Execution txtCSRCSE.Text = ds.Tables[0].Rows[0]["es"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["es"].ToString()).ToShortDateString() : ""; txtCSRCEE.Text = ds.Tables[0].Rows[0]["ee"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["ee"].ToString()).ToShortDateString() : ""; txtCSRCIE.Text = ds.Tables[0].Rows[0]["ei"].ToString(); txtCSRCExE.Text = ds.Tables[0].Rows[0]["eex"].ToString(); txtCSRCHE.Text = ds.Tables[0].Rows[0]["eh"].ToString(); //Closing txtCSRCSC.Text = ds.Tables[0].Rows[0]["cs"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["cs"].ToString()).ToShortDateString() : ""; txtCSRCEC.Text = ds.Tables[0].Rows[0]["ce"].ToString() != "" ? DateTime.Parse(ds.Tables[0].Rows[0]["ce"].ToString()).ToShortDateString() : ""; txtCSRCIC.Text = ds.Tables[0].Rows[0]["ci"].ToString(); txtCSRCExC.Text = ds.Tables[0].Rows[0]["cex"].ToString(); txtCSRCHC.Text = ds.Tables[0].Rows[0]["ch"].ToString(); if (ds.Tables[0].Rows[0]["status"].ToString() == "1") { strStatus = "Approved"; } if (ds.Tables[0].Rows[0]["status"].ToString() == "-1") { strStatus = "Denied"; } hdnStatus.Value = strStatus; } chkDiscovery.Attributes.Add("onclick", "CheckCSRC('" + chkDiscovery.ClientID + "','" + chkPlanning.ClientID + "','" + chkExecution.ClientID + "','" + chkClosing.ClientID + "','" + divCSRC.ClientID + "');ShowHideDivCheck('" + divDiscovery.ClientID + "',this);"); chkPlanning.Attributes.Add("onclick", "CheckCSRC('" + chkDiscovery.ClientID + "','" + chkPlanning.ClientID + "','" + chkExecution.ClientID + "','" + chkClosing.ClientID + "','" + divCSRC.ClientID + "');ShowHideDivCheck('" + divPlanning.ClientID + "',this);"); chkExecution.Attributes.Add("onclick", "CheckCSRC('" + chkDiscovery.ClientID + "','" + chkPlanning.ClientID + "','" + chkExecution.ClientID + "','" + chkClosing.ClientID + "','" + divCSRC.ClientID + "');ShowHideDivCheck('" + divExecution.ClientID + "',this);"); chkClosing.Attributes.Add("onclick", "CheckCSRC('" + chkDiscovery.ClientID + "','" + chkPlanning.ClientID + "','" + chkExecution.ClientID + "','" + chkClosing.ClientID + "','" + divCSRC.ClientID + "');ShowHideDivCheck('" + divClosing.ClientID + "',this);"); if (strStatus != "Pending") { btnUpdate.Attributes.Add("onclick", "return confirm('This CSRC has already been " + strStatus.ToUpper() + "!! By updating this CSRC will initiate the re-routal process.\\nAre you sure ?');"); } }
private void ExportToPDF(int id) { oVariables = new Variables(intEnvironment); Document doc = new Document(); Cell cell; iTextSharp.text.Table oTable = new iTextSharp.text.Table(2); oTable.BorderWidth = 0; oTable.BorderColor = new iTextSharp.text.Color(255, 255, 255); oTable.Padding = 2; oTable.Width = 100; iTextSharp.text.Font oFontHeader = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 10, 1); iTextSharp.text.Font oFontBold = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 1); iTextSharp.text.Font oFont = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 0); DataSet ds; if (strRoute == "CSRC") { ds = oTPM.GetCSRC(id); } else { ds = oTPM.GetPCR(id); } int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); DataSet dsResource = oCustomized.GetTPM(intRequest, intItem, intNumber); string strFile = DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "_" + intProfile.ToString() + ".pdf"; string strPath = oVariables.UploadsFolder() + strFile; string strVirtualPath = oVariables.UploadsFolder() + strFile; FileStream fs = new FileStream(strPath, FileMode.Create); PdfWriter.GetInstance(doc, fs); // PdfWriter.GetInstance(doc, Response.OutputStream); string strHeader = "ClearView PCR Information"; HeaderFooter header = new HeaderFooter(new Phrase(strHeader, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false); header.Border = iTextSharp.text.Rectangle.NO_BORDER; header.Alignment = 2; doc.Header = header; string strFooter = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); HeaderFooter footer = new HeaderFooter(new Phrase(strFooter, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false); footer.Border = iTextSharp.text.Rectangle.NO_BORDER; footer.Alignment = 2; doc.Footer = footer; doc.Open(); cell = new Cell(new Phrase("Project Change Request Report", oFontHeader)); cell.Colspan = 2; cell.BackgroundColor = new iTextSharp.text.Color(169, 162, 141); oTable.AddCell(cell); oTable.AddCell(new Cell(new Phrase("Scope:", oFontBold))); oTable.AddCell(new Cell(new Phrase((ds.Tables[0].Rows[0]["scope"].ToString() == "1" ? "Yes" : "No"), oFont))); oTable.AddCell(new Cell(new Phrase("Schedule:", oFontBold))); oTable.AddCell(new Cell(new Phrase((ds.Tables[0].Rows[0]["s"].ToString() == "1" ? "Yes" : "No"), oFont))); oTable.AddCell(new Cell(new Phrase("Financial:", oFontBold))); oTable.AddCell(new Cell(new Phrase((ds.Tables[0].Rows[0]["f"].ToString() == "1" ? "Yes" : "No"), oFont))); doc.Add(oTable); //style=\"border:dashed 1px #CCCCCC\" class=\"lightdefault\" iTextSharp.text.Table oTable2 = new iTextSharp.text.Table(3); oTable2.BorderWidth = 0; oTable2.BorderColor = new iTextSharp.text.Color(255, 255, 255); oTable2.Padding = 2; oTable2.Width = 100; cell = new Cell(new Phrase("Schedule Change Details", oFontBold)); cell.Colspan = 3; oTable2.AddCell(cell); oTable2.AddCell(new Cell(new Phrase("Phase", oFontBold))); oTable2.AddCell(new Cell(new Phrase("Approved Dates", oFontBold))); oTable2.AddCell(new Cell(new Phrase("Modified Dates", oFontBold))); oTable2.AddCell(new Cell(new Phrase("Discovery", oFont))); if (dsResource.Tables[0].Rows[0]["appsd"] == DBNull.Value || dsResource.Tables[0].Rows[0]["apped"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(dsResource.Tables[0].Rows[0]["appsd"].ToString()) + " - " + GetDate(dsResource.Tables[0].Rows[0]["apped"].ToString()), oFont))); } if (ds.Tables[0].Rows[0]["sds"] == DBNull.Value || ds.Tables[0].Rows[0]["sde"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(ds.Tables[0].Rows[0]["sds"].ToString()) + " - " + GetDate(ds.Tables[0].Rows[0]["sde"].ToString()), oFont))); } oTable2.AddCell(new Cell(new Phrase("Planning", oFont))); if (dsResource.Tables[0].Rows[0]["appsp"] == DBNull.Value || dsResource.Tables[0].Rows[0]["appep"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(dsResource.Tables[0].Rows[0]["appsp"].ToString()) + " - " + GetDate(dsResource.Tables[0].Rows[0]["appep"].ToString()), oFont))); } if (ds.Tables[0].Rows[0]["sps"] == DBNull.Value || ds.Tables[0].Rows[0]["spe"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(ds.Tables[0].Rows[0]["sps"].ToString()) + " - " + GetDate(ds.Tables[0].Rows[0]["spe"].ToString()), oFont))); } oTable2.AddCell(new Cell(new Phrase("Execution", oFont))); if (dsResource.Tables[0].Rows[0]["appse"] == DBNull.Value || dsResource.Tables[0].Rows[0]["appee"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(dsResource.Tables[0].Rows[0]["appse"].ToString()) + " - " + GetDate(dsResource.Tables[0].Rows[0]["appee"].ToString()), oFont))); } if (ds.Tables[0].Rows[0]["ses"] == DBNull.Value || ds.Tables[0].Rows[0]["see"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(ds.Tables[0].Rows[0]["ses"].ToString()) + " - " + GetDate(ds.Tables[0].Rows[0]["see"].ToString()), oFont))); } oTable2.AddCell(new Cell(new Phrase("Closing", oFont))); if (dsResource.Tables[0].Rows[0]["appsc"] == DBNull.Value || dsResource.Tables[0].Rows[0]["appec"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(dsResource.Tables[0].Rows[0]["appsc"].ToString()) + " - " + GetDate(dsResource.Tables[0].Rows[0]["appec"].ToString()), oFont))); } if (ds.Tables[0].Rows[0]["scs"] == DBNull.Value || ds.Tables[0].Rows[0]["sce"] == DBNull.Value) { oTable2.AddCell(new Cell(new Phrase("N / A", oFont))); } else { oTable2.AddCell(new Cell(new Phrase(GetDate(ds.Tables[0].Rows[0]["scs"].ToString()) + " - " + GetDate(ds.Tables[0].Rows[0]["sce"].ToString()), oFont))); } doc.Add(oTable2); iTextSharp.text.Table oTable3 = new iTextSharp.text.Table(3); oTable3.BorderWidth = 0; oTable3.BorderColor = new iTextSharp.text.Color(255, 255, 255); oTable3.Padding = 2; oTable3.Width = 100; cell = new Cell(new Phrase("Financial Change Details", oFontBold)); cell.Colspan = 3; oTable3.AddCell(cell); oTable3.AddCell(new Cell(new Phrase("Phase", oFontBold))); oTable3.AddCell(new Cell(new Phrase("Approved Financials", oFontBold))); oTable3.AddCell(new Cell(new Phrase("Modified Financials", oFontBold))); double dblAppDI = GetFloat(dsResource.Tables[0].Rows[0]["appid"].ToString()); double dblAppDE = GetFloat(dsResource.Tables[0].Rows[0]["appexd"].ToString()); double dblAppDH = GetFloat(dsResource.Tables[0].Rows[0]["apphd"].ToString()); double dblAppD = dblAppDI + dblAppDE + dblAppDH; double dblFD = GetFloat(ds.Tables[0].Rows[0]["fd"].ToString()); double dblFP = GetFloat(ds.Tables[0].Rows[0]["fp"].ToString()); double dblFE = GetFloat(ds.Tables[0].Rows[0]["fe"].ToString()); double dblFC = GetFloat(ds.Tables[0].Rows[0]["fc"].ToString()); double dblAppPI = GetFloat(dsResource.Tables[0].Rows[0]["appip"].ToString()); double dblAppPE = GetFloat(dsResource.Tables[0].Rows[0]["appexp"].ToString()); double dblAppPH = GetFloat(dsResource.Tables[0].Rows[0]["apphp"].ToString()); double dblAppP = dblAppPI + dblAppPE + dblAppPH; double dblAppEI = GetFloat(dsResource.Tables[0].Rows[0]["appie"].ToString()); double dblAppEE = GetFloat(dsResource.Tables[0].Rows[0]["appexe"].ToString()); double dblAppEH = GetFloat(dsResource.Tables[0].Rows[0]["apphe"].ToString()); double dblAppE = dblAppEI + dblAppEE + dblAppEH; double dblAppCI = GetFloat(dsResource.Tables[0].Rows[0]["appic"].ToString()); double dblAppCE = GetFloat(dsResource.Tables[0].Rows[0]["appexc"].ToString()); double dblAppCH = GetFloat(dsResource.Tables[0].Rows[0]["apphc"].ToString()); double dblAppC = dblAppCI + dblAppCE + dblAppCH; oTable3.AddCell(new Cell(new Phrase("Discovery", oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblAppD.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblFD.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("Planning", oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblAppP.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblFP.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("Execution", oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblAppE.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblFE.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("Closing", oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblAppC.ToString("N"), oFont))); oTable3.AddCell(new Cell(new Phrase("$" + dblFC.ToString("N"), oFont))); doc.Add(oTable3); iTextSharp.text.Table oTable4 = new iTextSharp.text.Table(3); oTable4.BorderWidth = 0; oTable4.BorderColor = new iTextSharp.text.Color(255, 255, 255); oTable4.Padding = 2; oTable4.Width = 100; cell = new Cell(new Phrase("Reason for PCR ", oFontBold)); cell.Colspan = 3; oTable4.AddCell(cell); string[] strReasons = ds.Tables[0].Rows[0]["reasons"].ToString().Split(';'); foreach (string str in strReasons) { if (str != "") { oTable4.AddCell(new Cell(new Phrase(str, oFont))); } } doc.Add(oTable4); doc.Close(); fs.Close(); string strURL = oVariables.UploadsFolder() + strFile; oTPM.UpdatePCRPath(id, oVariables.UploadsFolder() + strFile); strAttachement += "<tr><td><a href=\"" + strURL + "\" target=\"_blank\"><img src=\"/images/icons/pdf.gif \" align=\"absmiddle\" border=\"0\" /> View PCR Document (" + ds.Tables[0].Rows[0]["name"] + ")</a></td></tr> "; //Response.ContentType = "application/pdf"; //Response.AddHeader("Content-Disposition", "attachment; filename=closure_form.pdf"); //Response.End(); //Response.Flush(); }