private void btEncerrar_Click(object sender, EventArgs e)
        {
            if (troco >= 0)
            {
                int pag;
                if (rbDinheiro.Checked)
                    pag = 1;
                else if (rbCredito.Checked)
                    pag = 2;
                else if (rbDebito.Checked)
                    pag = 3;
                else if (rbCheque.Checked)
                    pag = 4;
                else pag = 5;

                new BancoVenda().receber(pag, cod_venda);
                new BancoVenda().encerrarVenda( subValor,comissao, (valor - desconto), cod_venda, mesas, isBalcao);
                new BancoVenda().atualizaSuper(new BancoVenda().consultaSuper(cod_venda), (valor - desconto));
                VendaFull temp = new BancoVenda().carregaVenda(cod_venda);
                if (rbSim.Checked)
                {
                    Impressao p = new Impressao(temp);
                    p.gerarComandaNaoFiscal(new BancoVenda().formaPagamento(pag), recebimento, troco);
                }

                encerrou = true;
                this.Close();
            }
        }
        // olhar os 3 metodos depois de criar as aberturas das telas usadas pelos metodos !!!!!!!!!!!!!!!!!!!!!!!!!!
        private void MSImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Confirma Impressão?", "Confirme sua Opcao", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    int cod_venda = new Banco().codigoDaVendaPelaMesa(listVenda.FocusedItem.Text);
                    VendaFull vd = new BancoVenda().carregaVenda(cod_venda);
                    Impressao p = new Impressao();
                    new BancoVenda().imprimiu(cod_venda);
                    p.imprimirComanda(1, vd);
                    new BancoVenda().imprimiu(cod_venda);
                    carregarMesa(true);

                }
            }
            catch { }
        }
        private void btBack_Click(object sender, EventArgs e)
        {
            if (new Banco().isVendaBalcao(cod_venda))
                new BancoVenda().anularVenda(cod_venda, true);
            else
            {
                for (int j = 0; j < listaProd.Length; j++)
                {
                    if (listaProd[j].Count > 0)
                    {
                        Impressao p = new Impressao(new BancoVenda().carregaVenda(cod_venda));
                        p.gerarComandaCozinha(listaProd[j].ToArray(), mesas, false);
                    }
                }
            }

            this.Close();
        }
        private void MSProduto_Click(object sender, EventArgs e)
        {
            ListViewItem t = lvInfo.FocusedItem;
            try
            {
                if (t.Equals(null))
                {
                    return;
                }
            }
            catch
            {
                return;
            }
            int asd =
            venda.Completos[Convert.ToInt16(lvInfo.FocusedItem.SubItems[0].Text) - 1].cod_completo;
            try
            {
                DataTable dttGarcon = new Banco().GarconDaVenda(venda.cod_venda);

                if (dttGarcon.Rows.Count > 1)
                {
                    Garcon g = new Garcon(venda.cod_venda);
                    g.ShowDialog();

                    Completa cc = new BancoVenda().getCompleta(asd, false);
                    new BancoInformacao().addqtdGarconCompleto(g.getRetorno(), asd, 1);// cod_garcon cod_completo quantidade
                    if (cc.needImpress)
                    {
                        cc.garconImprimir = new BancoVenda().nomeGarcon(g.getRetorno());
                        cc.quantidade = 1;
                        cc.segmentoImprimir = new Banco().segmentoDoProduto(cc.produto[0].cod_produto);
                        Impressao p = new Impressao(venda);
                        p.gerarComandaCozinha(new Completa[] { cc }, venda.mesa,false );
                    }
                }
                else
                    {

                        Completa cc = new BancoVenda().getCompleta(asd, false);
                        new BancoInformacao().addqtdGarconCompleto(Convert.ToInt16(dttGarcon.Rows[0].ItemArray.GetValue(0)),
                       asd, 1);
                        if (cc.needImpress)
                        {
                            cc.garconImprimir = cc.garcons[0].nome;
                            cc.quantidade = 1;
                            cc.segmentoImprimir = new Banco().segmentoDoProduto(cc.produto[0].cod_produto);
                            Impressao p = new Impressao(venda);
                            p.gerarComandaCozinha(new Completa[] { cc }, venda.mesa, false);
                        }
                    }

                venda = new BancoVenda().carregaVenda(venda.cod_venda);
                tamanhoMTVALOR(venda);
                carregarListView(venda);
                regularTamanho(lvInfo.Width);
            }
            catch { }
        }
        private void lvInfo_ItemActivate(object sender, EventArgs e)
        {
            try
            {
                ListViewItem t = lvInfo.FocusedItem;
                int asd =
                venda.Completos[Convert.ToInt16(lvInfo.FocusedItem.SubItems[0].Text) - 1].cod_completo;
                DataTable dttGarcon = new Banco().GarconDaVenda(venda.cod_venda);

                if (dttGarcon.Rows.Count > 1)
                {
                    Garcon g = new Garcon(venda.cod_venda);
                    g.ShowDialog();

                    Completa cc = new BancoVenda().getCompleta(asd, false);
                    new BancoInformacao().addqtdGarconCompleto(g.getRetorno(), asd, 1);// cod_garcon cod_completo quantidade
                    if (cc.needImpress)
                    {
                        cc.garconImprimir = new BancoVenda().nomeGarcon(g.getRetorno());
                        cc.quantidade = 1;
                        cc.segmentoImprimir = new Banco().segmentoDoProduto(cc.produto[0].cod_produto);
                        Impressao p = new Impressao(venda);
                        p.gerarComandaCozinha(new Completa[] { cc }, venda.mesa, false);
                    }
                }
                else
                    if (MessageBox.Show("Acrescentar Mais Um ?", "Confirme sua Opcao", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification) == DialogResult.Yes)
                    {
                        Completa cc = new BancoVenda().getCompleta(asd, false);
                        new BancoInformacao().addqtdGarconCompleto(Convert.ToInt16(dttGarcon.Rows[0].ItemArray.GetValue(0)),
                       asd, 1);
                        if (cc.needImpress)
                        {
                            cc.garconImprimir = cc.garcons[0].nome;
                            cc.quantidade = 1;
                            cc.segmentoImprimir = new Banco().segmentoDoProduto(cc.produto[0].cod_produto);
                            Impressao p = new Impressao(venda);
                            p.gerarComandaCozinha(new Completa[] { cc }, venda.mesa, false);
                        }
                    }

                venda = new BancoVenda().carregaVenda(venda.cod_venda);
                tamanhoMTVALOR(venda);
                carregarListView(venda);
                regularTamanho(lvInfo.Width);
            }
            catch { return; }
        }
 private void btImprimir_Click(object sender, EventArgs e)
 {
     Impressao p;
     try
     {
         p = new Impressao();
         new BancoVenda().imprimiu(venda.cod_venda);
         p.imprimirComanda(1,venda);
     }
     catch
     {
         MessageBox.Show(" Erro 011 - informe a fabricio do ocorrido - Abertura de Classe ");
         return;
     }
 }