public ActionResult RelatorioPDF_Antigo(IEnumerable<PROCESSOS> proc) { try { var flt = (Filtro)Session["Filtro"]; if (flt == null) throw new Exception("Nenhum registro encontrado, tente novamente..."); var lista = new Processo().ListaAnoMes(flt.DataRefDoc, flt.Tipo, flt.DocCaixa, flt.NotaEmp, flt.DataInicio, flt.DataFim); string HTMLContent = "<div>" + espaco(60) + "Gerenciamento Eletrônico de Documentos</div>"; HTMLContent += "<div>" + espaco(60) + "Sesconti Serviços</div> \n"; HTMLContent += "<div style='font-size:8px'>" + espaco(30) + "Município: " + new Entidade().NomeEntidade(); if (flt.Tipo != 0) { HTMLContent += "<div style='font-size:8px'>" + espaco(30) + "Documentos: " + new Retorno().TipoDocumento(flt.Tipo); } if (flt.DataRefDoc != "") { HTMLContent += "<div style='font-size:8px'>" + espaco(30) + "Referente: " + flt.DataRefDoc + "</div> \n\n"; } if (flt.DataInicio != "") { HTMLContent += "<div style='font-size:8px'>" + espaco(30) + "Período: " + new Funcoes().DDMMAAAA(flt.DataInicio) + " à " + new Funcoes().DDMMAAAA(flt.DataFim) + "</div> \n\n"; } HTMLContent += "<table border=0 bordercolor=#222 cellpadding=2 cellspacing=0 style='font-size:6px; width:100%;'>"; HTMLContent += "<thead>"; HTMLContent += "<tr>"; HTMLContent += "<th>Doc.Caixa</th><th>Empenho</th><th>Credor</th><th>Data Pagamento</th><th>UNG</th><th>Valor</th><th>Qtd.Doc</th>"; HTMLContent += "</tr>"; HTMLContent += "</thead>"; HTMLContent += "<tbody>"; // HTMLContent += "<tr><td>00001</td><td>CARLOS SILVA</td></tr>"; if (lista == null) { throw new Exception("Nenhum registro encontrado, tente novamente..."); } foreach (var itm in lista) { //HTMLContent += "<tr><td>" + itm.PRC_ID.ToString()+"</td><td>"+itm.PRC_DTPAGAM.ToString()+"</td></tr>"; HTMLContent += "<tr>"; string doccaixa = new Funcoes().NaoNull(itm.PRC_DOCCAIXA); string notaemp = new Funcoes().NaoNull(itm.PRC_NOTAEMP); string credor = new Funcoes().NaoNull(itm.PRC_CREDOR); string dtpagam = new Funcoes().NaoNull(itm.PRC_DTPAGAM); string undgest = new Funcoes().NaoNull(itm.PRC_UND_GEST); string vrpagam = new Funcoes().NaoNullDec(itm.PRC_VRPAGAM); string totdocumento = new Documento().TotalDocumento(itm.PRC_ID).ToString(); HTMLContent += coluna(doccaixa) + coluna(notaemp) + coluna(credor, 6, 50) + coluna(dtpagam) + coluna(undgest) + coluna(vrpagam) + coluna(totdocumento); HTMLContent += "</tr>"; } HTMLContent += "</tbody>"; HTMLContent += "</table>"; HTMLContent += "</ hr>"; //HTMLContent += "______________________________________________________________________________________________________"; Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + "RelProcessos.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(new GeraPDF().GetPDF(HTMLContent)); Response.End(); return RedirectToAction("Index"); } catch (Exception ex) { TempData["MsgErro"] = "Erro, " + ex.Message; return View("Index", new Processo().ListaAnoMes("199001")); //throw new Exception("Erro, " + ex.Message); } }
public ActionResult RetornaDocCaixa(FormCollection frm) { int ProcID = new Processo().RetornaDocCaixa(frm["doccaixa"]); return RedirectToAction("Edit", new { id = ProcID }); }
public ActionResult PesquisaNotaEmp(FormCollection frm) { var listaProc = new Processo().RetornaListaNotaEmp(frm["notaemp"]); return View("Index", listaProc); }
public void RelatorioPDF(IEnumerable<PROCESSOS> proc) { byte[] bPDF = null; MemoryStream ms = new MemoryStream(); TextReader txtReader = new StringReader(""); // 1: create object of a itextsharp document class Document doc = new Document(PageSize.A4, 5, 5, 25, 70); // 2: we create a itextsharp pdfwriter that listens to the document and directs a XML-stream to a file PdfWriter oPdfWriter = PdfWriter.GetInstance(doc, ms); oPdfWriter.PageEvent = new Paginacao(); // 3: we create a worker parse the document HTMLWorker htmlWorker = new HTMLWorker(doc); // 4: we open document and start the worker on the document doc.Open(); //doc.NewPage(); doc.Add(new Paginacao().Paragrafo("Gerenciamento Eletrônico de Documentos \n", 18f)); doc.Add(new Paginacao().Paragrafo("Sesconti Serviços \n", 18f)); /* var paragrafo = new Paragraph("RELATÓRIO LICITAÇÃO \n", new Font(Font.NORMAL, 24)); paragrafo.Alignment = Element.ALIGN_CENTER; paragrafo.Font = new Font(Font.FontFamily.HELVETICA); doc.Add(paragrafo);*/ var _flt = (Filtro)Session["Filtro"]; /*var municipio = new Paragraph("Municipio: " + new Entidade().NomeEntidade() + "\n", new Font(Font.NORMAL, 10f)); municipio.Alignment = Element.ALIGN_CENTER; municipio.Font = new Font(Font.FontFamily.HELVETICA); doc.Add(municipio);*/ doc.Add(new Paginacao().Paragrafo("Município: " + new Entidade().NomeEntidade() + "\n", 10f)); if (_flt.UnidadeGestora > 0) { doc.Add(new Paginacao().Paragrafo("Unidade Gestora: " + _flt.CodigoNomeUnidadeGestora + "\n", 10f)); } if (_flt.DataRefDoc != "") { doc.Add(new Paginacao().Paragrafo("Referente MÊS/ANO: " + new Funcoes().MMAAAABARRA(_flt.DataRefDoc) + "\n", 10f)); } if (_flt.DataInicio != "") { var periodo = new Paragraph("Período: " + new Funcoes().DDMMAAAA(_flt.DataInicio) + " à " + new Funcoes().DDMMAAAA(_flt.DataFim) + "\n", new Font(Font.NORMAL, 10f)); periodo.Alignment = Element.ALIGN_CENTER; periodo.Font = new Font(Font.FontFamily.HELVETICA); doc.Add(periodo); } if (_flt.CodigoUnidadeGestora != "") { doc.Add(new Paginacao().Paragrafo("Unidade Gestora: " + _flt.CodigoNomeUnidadeGestora + "\n", 10f)); } if (_flt.Conta != "") { doc.Add(new Paginacao().Paragrafo("Conta: " + _flt.Conta + "\n", 10f)); } if (_flt.Credor != "") { doc.Add(new Paginacao().Paragrafo("Credor: " + _flt.Credor + "\n", 10f)); } if (_flt.DocCaixa != "") { doc.Add(new Paginacao().Paragrafo("Doc. Caixa: " + _flt.DocCaixa + "\n", 10f)); } if (_flt.NotaEmp != "") { doc.Add(new Paginacao().Paragrafo("Nota Empenho: " + _flt.NotaEmp + "\n", 10f)); } //if (_flt.Tipo != 0) //{ doc.Add(new Paginacao().Paragrafo("Documentos: " + new Retorno().TipoDocumento(_flt.Tipo) + "\n", 10f)); //} doc.Add(new Paginacao().Paragrafo("___________________________________________________________________________________________ \n", 10f)); PdfPTable tbl = new PdfPTable(7); //3 é quantidade de colunas float[] anchoDeColumnas = new float[] { 50f, 50f, 200f, 50f, 40f, 45f, 50f }; tbl.SetWidths(anchoDeColumnas); tbl.DefaultCell.Border = Rectangle.NO_BORDER; Filtro flt = (Filtro)Session["Filtro"]; if (flt == null) throw new Exception("Nenhum registro encontrado, tente novamente..."); if (flt != null) { var lista = new Processo().ListaAnoMes(flt.DataRefDoc, flt.Tipo, flt.DocCaixa, flt.NotaEmp, flt.DataInicio, flt.DataFim, flt.Credor, flt.Conta, flt.CodigoUnidadeGestora); tbl.AddCell(new Paginacao().ColCabecalho("Doc.caixa")); tbl.AddCell(new Paginacao().ColCabecalho("Empenho")); tbl.AddCell(new Paginacao().ColCabecalho("Credor")); tbl.AddCell(new Paginacao().ColCabecalho("Data Pagam",Alinhar.ESQUERDA)); tbl.AddCell(new Paginacao().ColCabecalho("Ung")); tbl.AddCell(new Paginacao().ColCabecalho("Valor",Alinhar.DIREITA)); tbl.AddCell(new Paginacao().ColCabecalho("Qtd.Docs",Alinhar.DIREITA)); int totDocs = 0; int reg = 0; var lstDocumentos = db.DOCUMENTOS.ToList(); foreach (var itm in lista) { string doccaixa = new Funcoes().NaoNull(itm.PRC_DOCCAIXA); string notaemp = new Funcoes().NaoNull(itm.PRC_NOTAEMP); string credor = new Funcoes().NaoNull(itm.PRC_CREDOR); string dtpagam = new Funcoes().NaoNull(itm.PRC_DTPAGAM); string undgest = new Funcoes().NaoNull(itm.PRC_UND_GEST); string vrpagam = new Funcoes().NaoNullDec(itm.PRC_VRPAGAM); //string totdocumento = new Documento().TotalDocumento(itm.PRC_ID).ToString(); string totdocumento = lstDocumentos.Where(x => x.DOC_PROC_ID == itm.PRC_ID).Count().ToString(); tbl.AddCell(new Paginacao().ColValor(doccaixa)); tbl.AddCell(new Paginacao().ColValor(notaemp)); tbl.AddCell(new Paginacao().ColValor(credor)); tbl.AddCell(new Paginacao().ColValor(dtpagam,Alinhar.ESQUERDA)); tbl.AddCell(new Paginacao().ColValor(undgest)); tbl.AddCell(new Paginacao().ColValor(vrpagam,Alinhar.DIREITA)); tbl.AddCell(new Paginacao().ColValor(totdocumento,Alinhar.CENTRO)); totDocs += int.Parse(totdocumento); reg++; } doc.Add(tbl); doc.Add(new Paginacao().Paragrafo("___________________________________________________________________________________________ \n\n", 10f)); doc.Add(new Paginacao().Paragrafo("Total de processos listados: " + reg.ToString() + " Total Documentos: " + totDocs.ToString() + "\n", 10f)); doc.NewPage(); htmlWorker.StartDocument(); // 5: parse the html into the document htmlWorker.Parse(txtReader); // 6: close the document and the worker htmlWorker.EndDocument(); htmlWorker.Close(); doc.Close(); bPDF = ms.ToArray(); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + "RelProcessos.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(bPDF); Response.End(); } else { TempData["MsgErro"] = "Sem registros para listar em relatório..."; } //return RedirectToAction("Index"); }
public ActionResult PesquisaDocCaixa(FormCollection frm) { var listaProc = new Processo().RetornaListaDocCaixa(frm["doccaixa"]); return View("Index", listaProc); }
public ActionResult IncluirCheque(FormCollection frm) { int prcid = int.Parse(frm["txt_procid"].ToString()); try { var proc = new Processo().GetProcesso(prcid); var db = new GedEntities(); var chq = new CHEQUES(); chq.TPDOC = "605"; chq.CODMUN = proc.PRC_CODMUN.ToString(); ; chq.EXEORC = proc.PRC_DTREFDOC.Substring(2, 4) + "00"; chq.ORGAO = proc.PRC_ORGAO.ToString(); ; chq.UNDORC = proc.PRC_UND_ORC.ToString(); ; chq.DTEMISNOTA = new Funcoes().AAAAMMDDSEMBARRA(proc.PRC_DTPAGAM.ToString()); chq.NOTAEMP = proc.PRC_NOTAEMP.ToString(); chq.NUMSUBEMP = proc.PRC_NUMSUBEMP ?? "000"; chq.NOTAPAG = proc.PRC_NOTAPAG ?? "00000000"; chq.DTREFDOC = proc.PRC_DTREFDOC.Substring(2,4) + proc.PRC_DTREFDOC.Substring(0,2); chq.DTEMISCHQ = new Funcoes().AAAAMMDDDataAtual(); chq.TIPO = "2"; chq.SITU = 9; chq.BANCO = new Funcoes().ZeroEsquerda(frm["txt_banco"].ToString(), 4); chq.CONTA = new Funcoes().ZeroEsquerda(frm["txt_conta"].ToString(), 9); chq.AGENCIA = new Funcoes().ZeroEsquerda(frm["txt_agencia"].ToString(), 6); chq.NCHQNDOC = frm["txt_numchq"].ToString(); chq.VRCHEQUE = Convert.ToDecimal(frm["txt_valor"].Replace(".", ",")); var _db = new GedEntities(); _db.CHEQUES.Add(chq); _db.SaveChanges(); TempData["Msg"] = "Cheque gravado com sucesso."; }catch(Exception ex) { TempData["MsgErro"] = "Erro, " + ex.Message; } return RedirectToAction("Edit", new { id = prcid }); }
public ActionResult EnviarPDF(int? procID) { try { var docs = db.DOCUMENTOS.Where(d => d.DOC_PROC_ID == procID).ToList(); string _arquivo = ""; string path = HttpContext.Server.MapPath("~/DOCS/"); //TODO: 17/03/2016 var proc = new Processo().GetProcesso(procID); string _nrodoccaixa = proc.PRC_DOCCAIXA.ToString(); string _diamesano = new DAO.Documento().DiaMesAnoAtual(); string pdfpath = HttpContext.Server.MapPath("~/PDF/") + _nrodoccaixa + _diamesano + ".pdf"; string nomearquivo = _nrodoccaixa + _diamesano + ".pdf"; //string pdfpath = HttpContext.Server.MapPath("~/PDF/") + procID.ToString() + ".pdf"; if (System.IO.File.Exists(pdfpath)) { System.IO.File.Delete(pdfpath); } using (var doc = new iTextSharp.text.Document()) { if (doc.IsOpen()) doc.Close(); iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(pdfpath, FileMode.Create)); doc.Open(); //DADOS CAPA doc.Add(new Paginacao().ParagrafoNegrito("ESTADO DO CEARÁ \n\n", 24f)); doc.Add(new Paginacao().ParagrafoNegrito(new Entidade().NomeEntidade()+"\n\n\n", 24f)); doc.Add(new Paginacao().ParagrafoNegrito("PROCESSO DE PAGAMENTO \n\n", 24f)); doc.Add(new Paginacao().ParagrafoNegrito("Exercício:" + proc.PRC_DTREFDOC.Substring(2, 4) + " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", 24f)); Single _tamfont = 10f; var fun = new Funcoes(); doc.Add(new Paginacao().Paragrafo("Credor: " + fun.NaoNull(proc.PRC_CREDOR.ToString()) + "", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Documento Caixa: " + fun.NaoNull(proc.PRC_DOCCAIXA.ToString()) + "", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Empenho: " + fun.NaoNull(proc.PRC_NOTAEMP.ToString()) + "", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Valor: " + fun.NaoNull(proc.PRC_VRPAGAM.ToString()) + "", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Código Orgão: " + fun.NaoNull(proc.PRC_ORGAO.ToString()) + "", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Código Unidade Orç: " + fun.NaoNull(proc.PRC_UND_ORC.ToString()) + "", _tamfont, 1)); if(proc.PRC_UND_GEST!=null) doc.Add(new Paginacao().Paragrafo("Unidade Gestora: " + new UnidadeGestora(proc.PRC_UND_GEST).NomeUnidGestora + "", _tamfont, 1)); else doc.Add(new Paginacao().Paragrafo("Unidade Gestora: Não Informada", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("\n\n\n\n\n\n\n\n", _tamfont, 1)); doc.Add(new Paginacao().Paragrafo("Ged SESCONTI", _tamfont, 0)); doc.Add(new Paginacao().Paragrafo("Emissão em "+Funcoes.DataAtual(), _tamfont, 0)); doc.NewPage(); foreach (var itm in docs) { _arquivo = path + itm.DOC_ARQUIVO; iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(_arquivo); image.ScaleToFit(doc.PageSize.Width - 120, doc.PageSize.Height - 80); image.ScaleAbsoluteHeight(doc.PageSize.Height - 80); image.ScaleAbsoluteWidth(doc.PageSize.Width - 80); doc.Add(image); } } ViewBag.PDFEnviado = nomearquivo; TempData["MsgFixa"] = "Documentos gravados em PDF com sucesso."; } catch (Exception ex) { TempData["MsgErro"] = "Occoreu um erro: " + ex.Message; } PROCESSOS pROCESSOS = db.PROCESSOS.Find(procID); return View("Edit", pROCESSOS); }
public ActionResult EditarProcesso(string notaEmp) { var lista = new Processo().Lista(notaEmp); //return PartialView("_EditarProcesso", lista); ViewBag.NotaEmp = notaEmp; //return View("~/Views/Shared/_EditarProcesso.cshtml", lista); return View("Edit", new { id = lista.PRC_ID }); }
/*public IEnumerable<CHEQUES> ListaCheques(string notaemp) { string anomes = Conexao.Exercicio.Substring(2, 4) + Conexao.Exercicio.Substring(0, 2); return Conexao.Banco.CHEQUES.Where(p => p.NOTAEMP.Equals(notaemp) && p.DTREFDOC.Contains(anomes)).AsEnumerable(); }*/ public IEnumerable<CHEQUES> ListaCheques(int procID) { var proc = new Processo().GetProcesso(procID); //select * from CHEQUES where NOTAEMP=02010007 and ORGAO=05 and UNDORC=07 and NOTAPAG=05010002 and EXEORC=201500 string anomes = Conexao.Exercicio.Substring(2, 4) + Conexao.Exercicio.Substring(0, 2); //string exerc = Conexao.Exercicio.Substring(2, 4) + "00"; //TODO: 19/05/2016 Cheques novos incluidos pelo usuario o campo situ=9 e se processo EXTRA o campo recebe NOTAPAG="00000000" if (proc.PRC_NOTAPAG != null) return Conexao.Banco.CHEQUES.Where(p => p.NOTAEMP.Equals(proc.PRC_NOTAEMP) && p.DTREFDOC.Contains(anomes) && p.ORGAO.Equals(proc.PRC_ORGAO) && p.UNDORC.Equals(proc.PRC_UND_ORC) && p.NOTAPAG.Equals(proc.PRC_NOTAPAG)).AsEnumerable(); else return Conexao.Banco.CHEQUES.Where(p => p.NOTAEMP.Equals(proc.PRC_NOTAEMP) && p.DTREFDOC.Contains(anomes) && p.ORGAO.Equals(proc.PRC_ORGAO) && p.UNDORC.Equals(proc.PRC_UND_ORC) && p.NOTAPAG.Equals("00000000")).AsEnumerable(); }