예제 #1
0
        public void CalcularComposicaoVenda(int numeroVenda)
        {
            DataTable dt = new DataTable();
            ItemTipoRecebimentoVendaBO itemTipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();

            dt = itemTipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(numeroVenda);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (row["formaRecebimento"].ToString().StartsWith("01 - Dinheiro"))
                    {
                        totalVendasRealizadasDinheiro += Convert.ToDecimal(row["vlrPago"]);
                    }
                    else
                    {
                        totalVendasRealizadasCartao += Convert.ToDecimal(row["vlrPago"]);
                    }
                }

                txtTotalVendasRealizadasEmDinheiro.Text = string.Format("{0:C2}", totalVendasRealizadasDinheiro);
                txtTotalVendasRealizadasEmCartoes.Text  = string.Format("{0:C2}", totalVendasRealizadasCartao);
                txtTotalVendasRealizadasEmCheque.Text   = Convert.ToDecimal("0.00").ToString("C");
                txtTotalVendasRealizadasEmBancos.Text   = Convert.ToDecimal("0.00").ToString("C");
            }
        }
예제 #2
0
        public string IncluirTipoRecebimento()
        {
            DataTable dt = new DataTable();
            ItemTipoRecebimentoVendaBO itemTipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();

            dt  = itemTipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(numeroVenda);
            sb2 = new StringBuilder();

            foreach (DataRow row in dt.Rows)
            {
                if (row["formaRecebimento"].ToString().StartsWith("01"))
                {
                    frmPgtoDinheiro = true;
                    sb2.AppendLine(row["formaRecebimento"].ToString() + "                                                                     " + Convert.ToDecimal(row["vlrPago"]).ToString("C").Substring(3));
                }
                if (row["formaRecebimento"].ToString().StartsWith("02"))
                {
                    frmPgtoCD = true;
                    sb2.AppendLine(row["formaRecebimento"].ToString() + "                                                         " + Convert.ToDecimal(row["vlrPago"]).ToString("C").Substring(3));
                }
                if (row["formaRecebimento"].ToString().StartsWith("03"))
                {
                    frmPgtoCC = true;
                    sb2.AppendLine(row["formaRecebimento"].ToString() + "                                                         " + Convert.ToDecimal(row["vlrPago"]).ToString("C").Substring(3));
                }
            }

            return(sb2.ToString());
        }
예제 #3
0
        private void GravarItemTipoRecebimentoVenda()
        {
            if (MessageBox.Show("Confirma finalizar pagamento", "Pagamento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ItemTipoRecebimentoVenda   itemTRV;
                ItemTipoRecebimentoVendaBO itemTipoRecebimentoBO = new ItemTipoRecebimentoVendaBO();

                for (int i = 0; i < listFormaRecebimento.Items.Count; i++)
                {
                    itemTRV = new ItemTipoRecebimentoVenda();

                    itemTRV._VendaID          = numeroVenda;
                    itemTRV._Item             = int.Parse(listFormaRecebimento.Items[i].SubItems[0].Text);
                    itemTRV._FormaRecebimento = listFormaRecebimento.Items[i].SubItems[1].Text;
                    itemTRV._VlrPago          = decimal.Parse(listFormaRecebimento.Items[i].SubItems[2].Text.Substring(3));
                    itemTRV.DataHora          = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy"));
                    itemTipoRecebimentoBO.Gravar(itemTRV);
                    AtualizaSaldoContaCorrenteCaixaEmpresa(itemTRV._FormaRecebimento, itemTRV._VlrPago);
                }

                statusVenda = true;
                VerificaTipoPagamento();

                MessageBox.Show("Recebido com sucesso", "Pagamento realizado", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }
        }
예제 #4
0
        private string IncluirPagandoDinheiro()
        {
            DataTable dt = new DataTable();
            ItemTipoRecebimentoVendaBO itemTipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();

            dt = itemTipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(numeroVenda);

            foreach (DataRow row in dt.Rows)
            {
                if (row["formaRecebimento"].ToString().StartsWith("02"))
                {
                    frmPgtoCD = true;
                }
                else if (row["formaRecebimento"].ToString().StartsWith("03"))
                {
                    frmPgtoCC = true;
                }
                else
                {
                    frmPgtoDinheiro = true;
                }
            }

            if ((frmPgtoDinheiro == true) && (frmPgtoCC == false) && (frmPgtoCD == false))
            {
                return("PAGANDO........:R$" + "                                                          - " + pagando.ToString("N2"));
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #5
0
        public void CalculaSaldoEmDinheiro(DateTime dataInicio, DateTime dataFim)
        {
            //Pega vendas em dinheiro
            DataSet          ds = new DataSet();
            RealizarVendasBO realizaVendasBO = new RealizarVendasBO();
            int vendaID;

            ds = realizaVendasBO.Vendas(dataInicio, dataFim);

            if (ds != null)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    vendaID = Convert.ToInt32(row["NumeroVenda"].ToString());

                    ItemTipoRecebimentoVendaBO tipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();
                    DataTable dt = new DataTable();
                    dt = tipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(vendaID);

                    if (dt != null)
                    {
                        foreach (DataRow rowDt in dt.Rows)
                        {
                            if (rowDt["formaRecebimento"].ToString().StartsWith("01 - Dinheiro"))
                            {
                                saldoCaixa += Convert.ToDecimal(rowDt["vlrPago"].ToString());
                            }
                        }
                    }
                }
            }
            //Pega recebimento em dinheiro
        }
예제 #6
0
        public void CarregaItensTipoRecebimento(int codigo)
        {
            int countRow = 0;

            DataTable dt = new DataTable();
            ItemTipoRecebimentoVendaBO itemTipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();

            dt = itemTipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(codigo);
            listItenFormaRecebimento.Items.Clear();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    //Adiciona os itens do list view
                    listItenFormaRecebimento.Items.Add(row["formaRecebimento"].ToString());
                    listItenFormaRecebimento.Items[countRow].SubItems.Add(Convert.ToDecimal(row["vlrPago"]).ToString("C"));

                    countRow++;
                }
                countRow = 0;
            }
        }
예제 #7
0
        public void CarregaItensTipoRecebimento(string tipo, int codigo)
        {
            DataTable dt = new DataTable();
            ItemContaReceberFormaRecebimentoBO itemFormaRecebimentoBO     = new ItemContaReceberFormaRecebimentoBO();
            ItemTipoRecebimentoVendaBO         itemTipoRecebimentoVendaBO = new ItemTipoRecebimentoVendaBO();

            if (tipo.StartsWith("contaRecebida"))
            {
                dt = itemFormaRecebimentoBO.CriaDataTableSelecionaItemContasReceberFormaRecebimenoto(codigo);
            }
            else
            {
                dt = itemTipoRecebimentoVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(codigo);
            }

            if (dt.Rows.Count > 0)
            {
                listItenFormaRecebimento.Items.Clear();

                foreach (DataRow row in dt.Rows)
                {
                    //Adiciona os itens do list view
                    listItenFormaRecebimento.Items.Add(row["formaRecebimento"].ToString());
                    listItenFormaRecebimento.Items[countRow].SubItems.Add(Convert.ToDecimal(row["vlrPago"]).ToString("C"));

                    countRow++;

                    totalRecebimento += Convert.ToDecimal(row["vlrPago"]);
                }
                countRow      = 0;
                txtTotal.Text = totalRecebimento.ToString("C");
            }
            else
            {
                listItenFormaRecebimento.Items.Add("Crédiario Loja");
            }
        }
예제 #8
0
        private void EstornarSaldoCaixaEmpresa()
        {
            //Atualiza saldo conta corrente caixa empresa
            //Altera a saldo conta corrente

            ItemTipoRecebimentoVenda   itemTipoRecVenda   = new ItemTipoRecebimentoVenda();
            ItemTipoRecebimentoVendaBO itemTipoRecVendaBO = new ItemTipoRecebimentoVendaBO();

            DataTable dtItensTipoRecVenda = itemTipoRecVendaBO.CriaDataTableSelecionaItemVendaFormaRecebimenoto(vendaID);

            foreach (DataRow itemTipRV in dtItensTipoRecVenda.Rows)
            {
                Banco           banco           = new Banco();
                BancoBO         bancoBO         = new BancoBO();
                ContaCorrente   contaCorrente   = new ContaCorrente();
                ContaCorrenteBO contaCorrenteBO = new ContaCorrenteBO();

                if (itemTipRV["formaRecebimento"].ToString().Equals("01 - Dinheiro"))
                {
                    //VERIFICA SE EXISTE BANCO CAIXA EMPRESA
                    banco = bancoBO.SelecionaBancoCaixaEmpresa();

                    if (banco != null)
                    {
                        //VERIFICA SE EXISTE CONTA CORRENTE RELACIONADA AO BANCO
                        contaCorrente = contaCorrenteBO.SelecionarContaCorrenteBancoID(banco.BancoID);

                        if (contaCorrente != null)
                        {
                            //ATUALIZA O SALDO PERTINENTE A CONTA CORRENTE DE ACORDO COM O BANCO CAIXA EMPRESA
                            contaCorrenteBO.AtualizarSaldoDespesa(contaCorrente.ContaID, itemTipRV["vlrPago"].ToString());
                        }
                    }
                }
            }
        }