Example #1
0
        private void btnVenda_Click(object sender, System.EventArgs e)
        {
            if (!clisitef.Configurado)
            {
                btnConfigura_Click(null, null);
            }

            string valor       = "100,00";
            string cupomFiscal = "12345";
            string dataFiscal  = "20001231";
            string horario     = "120000";
            string operador    = "OPERADOR";
            string restricoes  = "";

            int retorno = clisitef.Venda(0, valor, cupomFiscal, dataFiscal, horario, operador, restricoes);

            System.Windows.Forms.MessageBox.Show("retorno: [" + retorno.ToString() + "]", "Venda CliSiTef");
        }
Example #2
0
        private void btnVenda_Click(object sender, System.EventArgs e)
        {
            if (!clisitef.Configurado)
            {
                btnConfigura_Click(null, null);
            }



            string valor       = txtValor.Text;       //"100,00";
            string cupomFiscal = txtCupomFiscal.Text; //"12345";
            string dataFiscal  = "20171203";
            string horario     = "165400";
            string operador    = "operador";//pdvapi.GetMacAddress(); // txtOperador.Text; //"OPERADOR";
            string restricoes  = "";

            //caue = 22/11/2017
            int    funcao               = 0;
            string qtdeParcelas         = "0";
            string valorPrimeiraParcela = "0";
            string valorDemaisParcelas  = "0";

            string codigoSeguranca = txtCodigoSeguranca.Text;

            pdvapi = new PDVTEF.PagAPI();
            //System.Windows.Forms.MessageBox.Show("MACADRRES: " + operador);
            insereLog("MACADRRES: " + operador);

            //Caue - 22/11/2017
            // Verifica o tipo de venda a ser realizado
            if (cmbTipoVenda.SelectedItem.ToString() == "Debito")
            {
                funcao = 2; //Debito
            }
            else
            {
                funcao               = 3;      //Credito
                qtdeParcelas         = trkQtdParcelas.Value.ToString();
                valorPrimeiraParcela = "5.00"; //txtValorPrimeiraParcela.Text;
                valorDemaisParcelas  = "5,00"; //txtValorDemaisParcelas.Text;
            }

            //int retorno = clisitef.Venda(0, valor, cupomFiscal, dataFiscal, horario, operador, restricoes);
            int retorno = clisitef.Venda(funcao, valor, cupomFiscal, dataFiscal, horario, operador, restricoes, qtdeParcelas, valorPrimeiraParcela, valorDemaisParcelas, codigoSeguranca);

            //System.Windows.Forms.MessageBox.Show("retorno: [" + retorno.ToString() + "]", "Venda CliSiTef");

            insereLog("retorno: [" + retorno.ToString() + "]");

            if (retorno == 0)
            {
                //Imprime cupom
                string meuCupom = "           RAZAO SOCIAL DA EMPESA                " + Environment.NewLine;
                meuCupom += "                  ENDERECO                      " + Environment.NewLine;
                meuCupom += "              CIDADE - ESTADO                   " + Environment.NewLine;
                meuCupom += "          CNPJ: 00.000.000/0000-00              " + Environment.NewLine;
                meuCupom += "            IE: 000.0000000.0000                " + Environment.NewLine;
                meuCupom += "------------------------------------------------" + Environment.NewLine;
                meuCupom += "      DATA " + DateTime.Now.ToShortDateString() + "  HORA " + DateTime.Now.ToShortTimeString() + "  004-001      " + Environment.NewLine;
                meuCupom += "------------------------------------------------" + Environment.NewLine;

                if (funcao == 2)
                {
                    meuCupom += "               DEBITO A VISTA                   " + Environment.NewLine;
                }
                else
                {
                    meuCupom += "               CREDITO A VISTA                  " + Environment.NewLine;
                }

                int novoValor = int.Parse(txtValor.Text) / 100;

                meuCupom += "VALOR                                " + novoValor.ToString("C2") + Environment.NewLine;

                txtCuponsFiscal.Text = txtCupomFiscal.Text + Environment.NewLine + meuCupom;
//RAZAO SOCIAL DA EMPESA
//ENDERECO
//CIDADE - B.H MINAS GERAIS
//CNPJ: 00.000.000/0000-00
//IE: 000.0000000.0000
//------------------------------------------------
//11/10/2014  13:35:49  CNF:350714      COD:503297
//------------------------------------------------
//                 CUPOM não FISCAL

//ITEM CODIGO        DESCRIÇÃO
//   QTD.   UN.    VL.UNIT(R$)    ST   VL ITEM(R$)
//------------------------------------------------
//01   7898939332407 CASTANHA DE CAJU
//      2     UN           8,98      A       17,96
//02   7891700019880 MAIONESE
//     250Kg  UN           3,29      A        3,29
//03   2000000023455 MACA NAC. VERMELHA
//     1.430  KG  x        2,98      A        4,26
//02   7891700019880 MAIONESE
//     250Kg  UN           3,29      A        3,29
//03   2000000023455 MACA NAC. VERMELHA
//     1.430  KG  x        2,98      A        4,26
//02   7891700019880 MAIONESE
//     250Kg  UN           3,29      A        3,29
//03   2000000023455 MACA NAC. VERMELHA
//     1.430  KG  x        2,98      A        4,26
//------------------------------------------------
//TOTAL R$                                   25,51
//DINHEIRO                                   30,00
//TROCO R$                                    4,49
//------------------------------------------------
//OP: 25414  MARIA DA SILVA
//PARA TROCA/DEVOLUCAO DE MERCADORIAS E
//OBRIGATORIO APRESENTACAO DESTE CUPOM.
//-------------------------------------------------
//DADOS DE ENTREGA: HORARIO: DE 17:00 AS 21:00
//NOME: MARIA  SILVA
//RUA TESTE, 150 - MARIAS
//FONE:(31)0000-0000 - BELO HORIZONTE - MG
//-------------------------------------------------
            }



            Output.WriteLine(clisitef.sCupomFiscal);
            Output.WriteLine("%VENDA% - Retorno: " + retorno.ToString());
        }
Example #3
0
        private void btnVenda_Click(object sender, System.EventArgs e)
        {
            if (!clisitef.Configurado)
            {
                btnConfigura_Click(null, null);
            }

            btnVenda.Enabled = false;

            string valor       = "100,00";
            string cupomFiscal = "12345";
            string dataFiscal  = "20001231";
            string horario     = "120000";
            string operador    = "OPERADOR";
            string restricoes  = "";

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // CONFIGURA A CLASSE CLISITEF PARA REALIAZR A VENDA
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            //Define o tipo de venda
            if (clisitef.tipoVenda <= 0)
            {
                //Debito
                clisitef.tipoVenda = 1;

                //Envia a data de PreDatado, mesmo que seja venda a vista
                clisitef.dataPreDatado = dtPickerPreDatado.Value.ToString("dMMyyyy");
            }

            if (clisitef.tipoVenda == 2)
            {
                if (txtCodigoSeguranca.Text == "")
                {
                    MessageBox.Show("Insira o Codigo de Seguranca !");
                    passoFluxoVenda(3);
                    btnVenda.Enabled = true;
                    return;
                }
                else
                {
                    // Envia o codigo de seguranca
                    clisitef.CodigoSeguranca = Convert.ToInt16(txtCodigoSeguranca.Text);
                }

                //Verifica o tipo de credito
                if (cboTipoCredito.SelectedIndex <= 0)
                {
                    clisitef.tipoFormaPagamento = 1;
                }
                else
                {
                    clisitef.tipoFormaPagamento = 2;
                }

                //Verifica o tipo do cartao
                if (cboTipoCartao.SelectedIndex <= 0)
                {
                    clisitef.tipoCartaoCredito = 1;
                }
                else
                {
                    clisitef.tipoCartaoCredito = 2;
                }

                //Quantidade de Parcelas
                clisitef.qtdeParcelas = trackBarParcelas.Value;
            }


            int retorno = clisitef.Venda(0, valor, cupomFiscal, dataFiscal, horario, operador, restricoes, ref txtLog);

            //System.Windows.Forms.MessageBox.Show("retorno: [" + retorno.ToString() + "]", "Venda CliSiTef");
            txtLog.Text += "retorno clisitef.Venda: [" + retorno.ToString() + "]" + Environment.NewLine;

            //trata o retorno
            if (retorno == 0)
            {
                passoFluxoVenda(3);
            }
            else
            {
                InicializaFluxoVenda();
            }

            btnVenda.Enabled = true;
        }