tatiana.sch com impressora não fiscal de 40 colunas.
- Anexos
- pedido.zip
- Você não tem permissão para fazer download dos arquivos anexados.
- (76 Kb) Baixado 93 vez(es)
Última edição por JUNGLI em 15/5/2012, 18:09, editado 1 vez(es)
Sub Cupom()
Dim nPed, DtVenda, Fpag
'Variável para o número da venda
nPed = StrNumVenda
'Variável para a data da venda
DtVenda = Format(Date, "dd/mm/yyyy")
'Variável para o tipo de pagamento
Fpag = StrTipoPgto
'cupon para impressora termica de 40 colunas
'Open "LPT1:" For Output Access Write As #1
Open CurrentProject.Path & "\Cupom.txt" For Output Access Write As #1
Print #1, Tab(0); "TESTE DE EMPRESA"
Print #1, Tab(0); "Rua: " & "erua" & " - " & "ebairro";
Print #1, Tab(0); "ecid" & " - " & "eest"; " Cep: " & "ecep";
Print #1, Tab(0); "Tel: " & "etel";
Print #1, Tab(0); "Site: " & "esite";
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(10); "Codigo do Pedido : " & nPed;
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(0); "Data :" & DtVenda; " " & " "; "Hora :" & Time;
Print #1, Tab(0); "F. Pagamento: " & Fpag
Print #1, Tab(0); "------------------------------------------------";
'cabeça do cupon do items
Print #1, Tab(0); "Descrição "; "(Código)";
Print #1, Tab(0); " Und "; " Pco.Unit."; " Qtd./Peso "; " Vlr.Total "
Print #1, Tab(0); "------------------------------------------------";
'selecionar items do cupon
Dim StrSQL As String
Dim Rs As DAO.Recordset
Dim Db As DAO.Database
'Instrução SQL para uso no recordset
StrSQL = "SELECT tblProdutos.Codigo, tblVendas.CodigoBarras, tblProdutos.Descricao, tblUnidadeMed.Sigla," _
& "tblVendas.Qtde, tblVendas.PrecoUnitario, tblVendas.SubTotal" _
& " FROM tblUnidadeMed INNER JOIN (tblProdutos INNER JOIN tblVendas" _
& " ON tblProdutos.CodigoBarras = tblVendas.CodigoBarras)" _
& " ON tblUnidadeMed.CodigoUnidadeMedida = tblProdutos.CodigoUnidadeMedida;"
'Seta o Db
Set Db = CurrentDb
'Seta o Recordser com a SQL
Set Rs = CurrentDb.OpenRecordset(StrSQL)
Do While Not Rs.EOF
'Imprime os campos: Sigla, Descrição e Código de Barras
Print #1, Tab(0); Format(Left(Rs!Descricao, 20), "@@@@@@@@@@@@@@@@@@@@"); "(Cod.:" & _
Format(Rs!CodigoBarras, "0000000000000"); ")"
'Imprime os dados: Sigla, Preço Unitário, Quantidade e SubTotal
Print #1, Tab(0); " "; Format(Rs!Sigla, "@@"); " "; Format$(Format$(Rs!PrecoUnitario, "#,##0.00"), "@@@@@@@@"); _
" "; ; Format(Rs!Qtde, "000"); " "; Format$(Format$(Rs!subtotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); ""
Rs.MoveNext
Loop
Rs.Close
'Caso venda Fracionada vai para RodapeVendaFracionada
If Me.TipoPgto = 3 Then GoTo RodapeVendaFracionada
'Caso venda Fracionada vai para RodapeCartãoTicket
If StrTipoPgto = "Cartão" Or StrTipoPgto = "Ticket" Then GoTo RodapeCartãoTicket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(21); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(21); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "Dinheiro R$: "; Format$(Format$(Me.Dinheiro, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "Troco R$: "; Format$(Format$(Me.Troco, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); "------------------------------------------------";
'mensagem de no rodape do cupom
Print #1, Tab(10); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(10); " "
Print #1, Tab(10); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); "------------------------------------------------";
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
RodapeVendaFracionada:
'Caso a venda seja fracionada e a diferença em cartão ou ticket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(21); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(21); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "Dinheiro R$: "; Format$(Format$(Me.Dinheiro1, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "" & StrTipoFrac & " R$: "; Format$(Format$(Me.txtCartao, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); "------------------------------------------------";
'mensagem de no rodape do cupom
Print #1, Tab(10); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(10); " "
Print #1, Tab(10); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); "------------------------------------------------";
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
RodapeCartãoTicket:
'Caso a venda seja em cartão ou ticket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(21); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(21); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "" & StrTipoPgto & " R$: "; Format$(Format$(Me.Dinheiro, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(21); "Troco R$: "; Format$(Format$(Me.Troco, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); "------------------------------------------------";
'mensagem de no rodape do cupom
Print #1, Tab(10); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(10); " "
Print #1, Tab(10); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); "------------------------------------------------";
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); "------------------------------------------------";
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
End Sub
Dim nPed, DtVenda, Fpag
'Variável para o número da venda
nPed = StrNumVenda
'Variável para a data da venda
DtVenda = Format(Date, "dd/mm/yyyy")
'Variável para o tipo de pagamento
Fpag = StrTipoPgto
'cupon para impressora termica de 40 colunas
'Open "LPT1:" For Output Access Write As #1
Open CurrentProject.Path & "\Cupom.txt" For Output Access Write As #1
Print #1, Tab(0); "TESTE DE EMPRESA"
Print #1, Tab(0); "Rua: " & "erua" & " - " & "ebairro";
Print #1, Tab(0); "ecid" & " - " & "eest"; " Cep: " & "ecep";
Print #1, Tab(0); "Tel: " & "etel";
Print #1, Tab(0); "Site: " & "esite";
Print #1, Tab(0); String(40, "-");
Print #1, Tab(10); "Codigo do Pedido : " & nPed;
Print #1, Tab(0); String(40, "-");
Print #1, Tab(0); "Data :" & DtVenda; " " & " "; "Hora :" & Time;
Print #1, Tab(0); "F. Pagamento: " & Fpag
Print #1, Tab(0); String(40, "-");
'cabeça do cupon do items
Print #1, Tab(0); "Descrição "; "(Código)";
Print #1, Tab(0); "Und "; " Pco.Unit."; " Qtd./Peso "; " Vlr.Total "
Print #1, Tab(0); String(40, "-");
'selecionar items do cupon
Dim StrSQL As String
Dim Rs As DAO.Recordset
Dim Db As DAO.Database
'Instrução SQL para uso no recordset
StrSQL = "SELECT tblProdutos.Codigo, tblVendas.CodigoBarras, tblProdutos.Descricao, tblUnidadeMed.Sigla," _
& "tblVendas.Qtde, tblVendas.PrecoUnitario, tblVendas.SubTotal" _
& " FROM tblUnidadeMed INNER JOIN (tblProdutos INNER JOIN tblVendas" _
& " ON tblProdutos.CodigoBarras = tblVendas.CodigoBarras)" _
& " ON tblUnidadeMed.CodigoUnidadeMedida = tblProdutos.CodigoUnidadeMedida;"
'Seta o Db
Set Db = CurrentDb
'Seta o Recordser com a SQL
Set Rs = CurrentDb.OpenRecordset(StrSQL)
Do While Not Rs.EOF
'Imprime os campos: Sigla, Descrição e Código de Barras
Print #1, Tab(0); Left(Rs!Descricao, 24); " "; "(" & Format(Rs!CodigoBarras, "0000000000000"); ")" '@ alinha à direita
'Imprime os dados: Sigla, Preço Unitário, Quantidade e SubTotal
Print #1, Tab(0); Format(Rs!Sigla, "@@"); " "; Format$(Format$(Rs!PrecoUnitario, "#,##0.00"), "@@@@@@@@"); _
" "; Format(Rs!Qtde, "000"); " "; Format$(Format$(Rs!subtotal, "#,##0.00"), "@@@@@@@@")
'Print #1, Tab(0); ""
Rs.MoveNext
Loop
'Fecha o recorset
Rs.Close
'Caso venda Fracionada vai para RodapeVendaFracionada
If Me.TipoPgto = 3 Then GoTo RodapeVendaFracionada
'Caso venda Fracionada vai para RodapeCartãoTicket
If StrTipoPgto = "Cartão" Or StrTipoPgto = "Ticket" Then GoTo RodapeCartãoTicket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); String(40, "-");
Print #1, Tab(16); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(16); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "Dinheiro R$: "; Format$(Format$(Me.Dinheiro, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "Troco R$: "; Format$(Format$(Me.Troco, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); String(40, "-");
'mensagem de no rodape do cupom
Print #1, Tab(5); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(0); " "
Print #1, Tab(5); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); String(40, "-");
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); String(40, "-");
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
RodapeVendaFracionada:
'Caso a venda seja fracionada e a diferença em cartão ou ticket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); String(40, "-");
Print #1, Tab(16); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(16); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "Dinheiro R$: "; Format$(Format$(Me.Dinheiro1, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "" & StrTipoFrac & " R$: "; Format$(Format$(Me.txtCartao, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); String(40, "-");
'mensagem de no rodape do cupom
Print #1, Tab(10); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(10); " "
Print #1, Tab(10); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); String(40, "-");
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); String(40, "-");
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
RodapeCartãoTicket:
'Caso a venda seja em cartão ou ticket
'Caso venda normal a vista
'valor total do cupon
Print #1, Tab(0); String(40, "-");
Print #1, Tab(16); "Qtd. Itens : "; Format(Format(Me.txtQtdeItens.Caption, "000"), "@@@@@@@@")
Print #1, Tab(16); "Total Cumpom R$: "; Format$(Format$(Me.txtTotal, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "" & StrTipoPgto & " R$: "; Format$(Format$(Me.Dinheiro, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(16); "Troco R$: "; Format$(Format$(Me.Troco, "#,##0.00"), "@@@@@@@@")
Print #1, Tab(0); String(40, "-");
'mensagem de no rodape do cupom
Print #1, Tab(10); " Este Cupon Não Tem Valor Fiscal"
Print #1, Tab(10); " "
Print #1, Tab(10); " OBRIGADO PELA PREFERÊNCIA"
Print #1, Tab(0); String(40, "-");
Print #1, Tab(0); "SysPDV - Versão 1.0.0 - Venda" + " ";
Print #1, Tab(0); String(40, "-");
'comando de corte
'Print #1, Chr(27) + "i"
Close #1#
Exit Sub
End Sub