Ejemplo n.º 1
0
        private void relatorioFonecedores_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            {
                int eixoX = 105;
                string expirado;
                // titulo
                e.Graphics.DrawString("Relatório mensal de fornecedores", new Font("Arial", 12, FontStyle.Bold), new SolidBrush(Color.Black), new Point(20, 30));
                //headers
                e.Graphics.DrawString("Nome", new Font("Arial", 11, FontStyle.Bold), new SolidBrush(Color.Black), new Point(20, 85));
                e.Graphics.DrawString("RG", new Font("Arial", 11, FontStyle.Bold), new SolidBrush(Color.Black), new Point(320, 85));
                e.Graphics.DrawString("Entrada", new Font("Arial", 11, FontStyle.Bold), new SolidBrush(Color.Black), new Point(400, 85));
                e.Graphics.DrawString("Saída", new Font("Arial", 11, FontStyle.Bold), new SolidBrush(Color.Black), new Point(550, 85));
                e.Graphics.DrawString("Empresa", new Font("Arial", 11, FontStyle.Bold), new SolidBrush(Color.Black), new Point(700, 85));

                IQueryable<Fornecedor> fornecedores = null;
                string saida = "";
                try
                {
                    var fDAO = new FornecedorDAO();
                    fornecedores = fDAO.get(f => f.entrada.Year.ToString() == cmbRelAno.SelectedItem.ToString() && f.entrada.Month.ToString() == cmbRelMes.SelectedItem.ToString());
                }
                catch (Exception)
                {
                    mensagem("Erro ao gerar relatório");
                }
                foreach (Fornecedor f in fornecedores)
                {
                    if (f.saida == null)
                    {
                        saida = "";
                    }
                    else
                    {
                        saida = f.saida.Value.ToString("dd/mm/yyy hh:mm:ss");
                    }
                    e.Graphics.DrawString(f.nome, new Font("Arial", 11, FontStyle.Regular), new SolidBrush(Color.Black), new Point(20, eixoX));
                    e.Graphics.DrawString(f.rg, new Font("Arial", 11, FontStyle.Regular), new SolidBrush(Color.Black), new Point(320, eixoX));
                    e.Graphics.DrawString(f.entrada.ToString("dd/mm/yyy hh:mm:ss"), new Font("Arial", 11, FontStyle.Regular), new SolidBrush(Color.Black), new Point(400, eixoX));
                    e.Graphics.DrawString(saida, new Font("Arial", 11, FontStyle.Regular), new SolidBrush(Color.Black), new Point(550, eixoX));
                    e.Graphics.DrawString(f.empresa, new Font("Arial", 11, FontStyle.Regular), new SolidBrush(Color.Black), new Point(700, eixoX));
                    eixoX += 15;
                }
            }
        }
Ejemplo n.º 2
0
 private void preencherGridVisitanteFornecedores()
 {
     dgvFornecedores.Rows.Clear();
     dgvVisitante.Rows.Clear();
     FornecedorDAO fDao = new FornecedorDAO();
     VisitanteDAO vDao = new VisitanteDAO();
     var fornecedores = fDao.get(f => f.entrada.Day == DateTime.Now.Day && f.entrada.Month == DateTime.Now.Month && f.entrada.Year == DateTime.Now.Year && f.saida == null);
     var visitantes = vDao.get(v => v.entrada.Day == DateTime.Now.Day && v.entrada.Month == DateTime.Now.Month && v.entrada.Year == DateTime.Now.Year && v.saida == null);
     foreach (Fornecedor item in fornecedores)
     {
         dgvFornecedores.Rows.Add(item.idFornecedor, item.nome, item.empresa, item.entrada);
     }
     foreach (Visitante item in visitantes)
     {
         dgvVisitante.Rows.Add(item.idVisitante, item.nome, item.empresa, item.entrada);
     }
 }