Example #1
0
        public static void impRealVenda()
        {
            List <Camadas.Model.Venda> lstVenda = new List <Camadas.Model.Venda>();

            Camadas.BLL.Venda bllVend = new Camadas.BLL.Venda();
            lstVenda = bllVend.Select();

            string folder  = FunRel.diretorioPasta();
            string arquivo = folder + @"\realVenda.html";

            using (StreamWriter sw = new StreamWriter(arquivo))
            {
                sw.WriteLine("<html>");
                sw.WriteLine("<head>");
                sw.WriteLine(@"<meta http-equiv=\Content-type\Content=\'html; charset=utf-8\'");
                sw.WriteLine("</head>");
                sw.WriteLine("<body>");
                sw.WriteLine("<h1 align='left'><font color=#8B0000> RELATÓRIO DE VENDA</h1>");
                //definição de tabela
                sw.WriteLine("<table>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='30px' align='left'><font color=#FFFAFA>ID</th></font>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='150px' align='center'><font color=#FFFAFA>DATA DA VENDA</th></font>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='150px' align='center'><font color=#FFFAFA>DATA VENCIMENTO</th></font>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='150px' align='center'><font color=#FFFAFA>DATA PAGAMENTO</th></font>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='200px' align='center'><font color=#FFFAFA>CLIENTE</th></font>");
                sw.WriteLine("<th bgcolor=#6B8E23 width ='200px' align='center'><font color=#FFFAFA>FUNCIONARIO</th></font>");
                sw.WriteLine("</tr>");
                //detalhes itens do relatorios
                foreach (Camadas.Model.Venda venda in lstVenda)
                {
                    sw.WriteLine("<tr>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='30px'  align='center'><font color=#FFFAFA>" + venda.Id + "</td></font>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='30px'  align='center'><font color=#FFFAFA>" + venda.DataVenda + "</td></font>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='150px' align='center'><font color=#FFFAFA>" + venda.DataVencimento + "</td></font>>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='150px' align='center'><font color=#FFFAFA>" + venda.DataPagamento + "</td></font>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='200px' align='center'><font color=#FFFAFA>" + venda.Cliente + "</td></font>");
                    sw.WriteLine("<td bgcolor=#8B4513 width ='200px' align='center'><font color=#FFFAFA>" + venda.Funcionario + "</td></font>");
                    sw.WriteLine("</tr>");
                }

                sw.WriteLine("</table>");
                sw.WriteLine("<hr align='left' width='1500px' border='2px' border color='black'>");
                sw.WriteLine("</body>");
                sw.WriteLine("</html>");
            }
            System.Diagnostics.Process.Start(arquivo);
        }
Example #2
0
        public static void impRelVenda()
        {
            Camadas.BLL.Venda          bllVend    = new Camadas.BLL.Venda();
            List <Camadas.Model.Venda> listaVenda = new List <Camadas.Model.Venda>();

            listaVenda = bllVend.Select();

            string       folder  = Funcoes.diretorioPasta();
            string       arquivo = folder + @"\RelVenda.html";
            StreamWriter sw      = new StreamWriter(arquivo);

            using (sw)
            {
                sw.WriteLine("<html>");
                sw.WriteLine("<head>");
                sw.WriteLine("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>");
                sw.WriteLine("<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'>");
                sw.WriteLine("</head>");
                sw.WriteLine("<body>");
                sw.WriteLine("<h2 class='display-4'>Relatório de Venda</h1>");
                sw.WriteLine("<br/>");
                sw.WriteLine("<table class='table table-sm table-striped'>");
                sw.WriteLine("<thead class='thead-dark'>");
                sw.WriteLine("<tr scope='row'>");
                sw.WriteLine("<th scope='col'>ID</th>");
                sw.WriteLine("<th scope='col'>Data</th>");
                sw.WriteLine("<th scope='col'>Cliente</th>");
                sw.WriteLine("<th scope='col'>Nome</th>");
                sw.WriteLine("<th scope='col'>Servico</th>");
                sw.WriteLine("<th scope='col'>Descricao</th>");
                sw.WriteLine("<th scope='col'>ValorServ</th>");
                sw.WriteLine("<th scope='col'>Produto</th>");
                sw.WriteLine("<th scope='col'>NomeProd</th>");
                sw.WriteLine("<th scope='col'>Quantidade</th>");
                sw.WriteLine("<th scope='col'>ValorProd</th>");
                sw.WriteLine("<th scope='col'>Total</th>");
                sw.WriteLine("</tr>");
                sw.WriteLine("</thead>");

                int   cont      = 0;
                float somaGeral = 0;

                foreach (Camadas.Model.Venda venda in listaVenda)
                {
                    if (cont % 2 == 0)
                    {
                        sw.WriteLine("<tr scope='row'>");
                    }
                    else
                    {
                        sw.WriteLine("<tr scope='row'>");
                    }
                    sw.WriteLine("<td scope='col'>" + venda.id + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.data + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.cliente + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.nome + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.servico + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.descricao + "</td>");
                    sw.WriteLine("<td scope='col'>" + string.Format("{0:C2}", venda.valorServ) + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.produto + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.nomeProd + "</td>");
                    sw.WriteLine("<td scope='col'>" + venda.quantidade + "</td>");
                    sw.WriteLine("<td scope='col'>" + string.Format("{0:C2}", venda.valorProd) + "</td>");
                    somaGeral = somaGeral + venda.total;
                    sw.WriteLine("<td scope='col'>" + string.Format("{0:C2}", venda.total) + "</td>");
                    sw.WriteLine("</tr>");
                    cont++;
                }
                sw.WriteLine("</table>");
                sw.WriteLine("<br/>");
                sw.WriteLine("<h3>Total Geral: " + string.Format("{0:C2}", somaGeral) + "</h2>");
                sw.WriteLine("<h4>Total de Registros impressos: " + cont + "</h2>");
                sw.WriteLine("</body>");
                sw.WriteLine("</head>");
                sw.WriteLine("</html>");
            }
            System.Diagnostics.Process.Start(arquivo);
        }