private void Documento_PrintPage(object sender, PrintPageEventArgs e) { //chamando daoimprimir, puxando dados direto do banco. DaoImprimir daoImprimir = new DaoImprimir(); SqlDataReader dr = daoImprimir.SelectLestFechamento(); string dinheiro = "Dinheiro: ...................... R$ " + dr["FECH_DINHEIRO"].ToString(); string debito = "Débito: ......................... R$ " + dr["FECH_DEBITO"].ToString(); string credito = "Crédito: ........................ R$ " + dr["FECH_CREDITO"].ToString(); string crediario = "Crediário: ..................... R$ " + dr["FECH_CREDIARIO"].ToString(); string total = "Total: ........................... R$ " + dr["FECH_TOTAL"].ToString(); string dataHora = "Data: " + dr["DATA"].ToString() + " Hora: " + dr["HORA"].ToString(); string nome = "LOJINHA DA VERA!"; string fecha = "Fechamento de Caixa"; string espaço = "------------------------------------------------------------"; Font fonte = new Font("Arial", 10); //header e.Graphics.DrawString(nome, fonte, new SolidBrush(Color.Black), new Point(60, 10)); e.Graphics.DrawString(espaço, fonte, new SolidBrush(Color.Black), new Point(0, 18)); //header2 e.Graphics.DrawString(fecha, fonte, new SolidBrush(Color.Black), new Point(60, 30)); e.Graphics.DrawString(espaço, fonte, new SolidBrush(Color.Black), new Point(0, 45)); //center itens e.Graphics.DrawString(dinheiro, fonte, new SolidBrush(Color.Black), new Point(10, 55)); e.Graphics.DrawString(debito, fonte, new SolidBrush(Color.Black), new Point(10, 85)); e.Graphics.DrawString(credito, fonte, new SolidBrush(Color.Black), new Point(10, 115)); e.Graphics.DrawString(crediario, fonte, new SolidBrush(Color.Black), new Point(10, 145)); //botom e.Graphics.DrawString(espaço, fonte, new SolidBrush(Color.Black), new Point(0, 158)); e.Graphics.DrawString(total, fonte, new SolidBrush(Color.Black), new Point(10, 175)); e.Graphics.DrawString(espaço, fonte, new SolidBrush(Color.Black), new Point(0, 195)); //bottom2 e.Graphics.DrawString(dataHora, fonte, new SolidBrush(Color.Black), new Point(10, 215)); }
private void Document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { DaoImprimir DaoImprimir = new DaoImprimir(); DataTable dt = DaoImprimir.SelectNotaFiscal(); int offset = 150; int cont = 0; string linha = ""; string total = ""; string data = ""; string pagamento = ""; foreach (DataRow dataRow in dt.Rows) { if (cont < 1) { //HEADER string empresa = "LOJINHA DA VERA"; string cnpj = "Cnpj: 13.060.953/0001-97"; string end = "Rua Capitão F. Teixeira Nogueira N° 12 "; string cel = "WhatsApp: (11) 9 8862-7715"; string email = "E-mail: [email protected]"; linha = "-----------------------------------------------------"; //ITENS string Desc = "DESC QTD VALOR"; //BOTTOM string cliente = "Cliente: " + dataRow["CLI_NOME"].ToString(); pagamento = dataRow["VEN_PAGAMENTO"].ToString(); data = "Data: " + dataRow["DATA"].ToString(); total = "TOTAL: R$ " + dataRow["VEN_TOTAL"].ToString(); //header center e.Graphics.DrawString(empresa, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(60, 0)); e.Graphics.DrawString(cnpj, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(40, 16)); e.Graphics.DrawString(end, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(13, 30)); e.Graphics.DrawString(cel, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(40, 48)); e.Graphics.DrawString(email, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(31, 66)); e.Graphics.DrawString(linha, new Font("Arial", 14), new SolidBrush(Color.Black), new Point(0, 72)); e.Graphics.DrawString(cliente, new Font("Arial", 10), new SolidBrush(Color.Black), new Point(5, 90)); e.Graphics.DrawString(linha, new Font("Arial", 14), new SolidBrush(Color.Black), new Point(0, 105)); e.Graphics.DrawString(Desc, new Font("Arial", 8), new SolidBrush(Color.Black), new Point(10, 130)); } //Adiciona na lista Especificando a clouna string nome = dataRow["PROD_NOME"].ToString(); string quantidade = dataRow["ITEM_QTD"].ToString(); string preco = dataRow["ITEM_VALOR"].ToString(); // listaProd.Add(new Produto(nome, preco, quantidade)); e.Graphics.DrawString(nome, new Font("Arial", 8), new SolidBrush(Color.Black), 10, offset); e.Graphics.DrawString(quantidade, new Font("Arial", 8), new SolidBrush(Color.Black), 188, offset); e.Graphics.DrawString(preco, new Font("Arial", 8), new SolidBrush(Color.Black), 235, offset); offset += 15; } //bottom e.Graphics.DrawString(linha, new Font("Arial", 14), new SolidBrush(Color.Black), 0, offset); offset += 20; e.Graphics.DrawString(total, new Font("Arial", 8, FontStyle.Bold), new SolidBrush(Color.Black), 10, offset); e.Graphics.DrawString(pagamento, new Font("Arial", 8, FontStyle.Bold), new SolidBrush(Color.Black), 150, offset); offset += 20; e.Graphics.DrawString(data, new Font("Arial", 8), new SolidBrush(Color.Black), 10, offset); offset += 20; }