/// <summary> /// imprimir O.S /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnImprimirOS_Click(object sender, EventArgs e) { if (ViewState["cmpIdOS"].ToString() == "0") { this.GravarOS(); } ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.cmpCoObra = loadObra(); Imprimir.cmpIdOS = ViewState["cmpIdOS"].ToString(); Imprimir.NomeObra = "Serviços de TI"; Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "1") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } Imprimir.ImprimeOrdemServico(); string filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(nomepdf); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); // Impressão ambiente desenvolvimento local //Response.Write("<script language='javascript'>" // + "window.open('" + @"http://*****:*****@"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')" // + "</script>"); }
private void ImprimirTodasOS() { DataTable table = pesquisaOs(); if (table != null && table.Rows.Count > 0) { ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.cmpCoObra = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoObraGrupoLista; Imprimir.NomeObra = cmbObra.SelectedItem.ToString(); Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "True") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } foreach (DataRow lin in table.Rows) { Imprimir.cmpIdOS = lin["cmpIdOs"].ToString(); Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.ImprimeOrdemServico(); } //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(nomepdf); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); // Impressão ambiente produção ambiente interno orion //Response.Write("<script language='javascript'>" // + "window.open('" + @"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')" // + "</script>"); } }
protected void grdOS_RowCommand(object sender, GridViewCommandEventArgs e) { string[] ParImpressao = e.CommandArgument.ToString().Split(new char[] { '$' }); try { string p; switch (e.CommandName.ToLower().Trim()) { case "lnk": if (cmbObra.SelectedItem.ToString().TrimEnd() == "SERVIÇOS DE TI" || chkServicosTI.Checked == true) { p = "webATE_ServicosTI.aspx?id=" + e.CommandArgument.ToString(); } else { p = "webATE_OS.aspx?id=" + e.CommandArgument.ToString(); } Response.Redirect(p, false); break; case "btn": ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.cmpCoObra = ParImpressao[0].ToString(); Imprimir.cmpIdOS = ParImpressao[1].ToString(); Imprimir.NomeObra = cmbObra.SelectedItem.ToString(); Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "1") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } Imprimir.ImprimeOrdemServico(); //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; //string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(Server.MapPath("~/Relatorios/" + filename)); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); break; case "log": DataTable dtLog = tblLogOS.LogOS(Global.GetConnection(), e.CommandArgument.ToString().Trim()); grdLogs.DataSource = dtLog; grdLogs.DataBind(); ModalPopupExtender2.Show(); break; } } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }