public void CarregaItensTipoRecebimento(int codigo) { DataTable dt = new DataTable(); ItemContaReceberFormaRecebimentoBO itemFormaRecebimentoBO = new ItemContaReceberFormaRecebimentoBO(); dt = itemFormaRecebimentoBO.CriaDataTableSelecionaItemContasReceberFormaRecebimenoto(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.ToDateTime(row["dataHora"] == DBNull.Value ? Convert.ToDateTime(DateTime.MinValue) : row["dataHora"]).ToString("dd/MM/yyyy")); listItenFormaRecebimento.Items[countRow].SubItems.Add(Convert.ToDecimal(row["vlrPago"]).ToString("C")); countRow++; totalRecebimento += Convert.ToDecimal(row["vlrPago"]); } countRow = 0; txtTotal.Text = totalRecebimento.ToString("C"); txtTotalHaver.Text = txtTotal.Text; } else { listItenFormaRecebimento.Enabled = false; } }
public void EstornaRecebimento() { ItemContaReceberFormaRecebimento itemContaReceberFR = new ItemContaReceberFormaRecebimento(); ItemContaReceberFormaRecebimentoBO itemContaReceberFRBO = new ItemContaReceberFormaRecebimentoBO(); ItemContaReceber itemContaReceber = new ItemContaReceber(); ItemContaReceberBO itemContaReceberBo = new ItemContaReceberBO(); ContasReceber contaReceber = new ContasReceber(); ContasReceberBO contaReceberBO = new ContasReceberBO(); itemContaReceberFR = itemContaReceberFRBO.SelecionarItemFormaRecebimentoId(itemContaReceberID); itemContaReceber = itemContaReceberBo.SelecionarItemContaReceberID(itemContaReceberFR._ItenContaReceber._ItemContaReceberID); decimal vlrPago = itemContaReceberFR._VlrPago; decimal vlrAbert = itemContaReceber.ValorAberto; itemContaReceberBo.EstornarRecebimento(itemContaReceber._ItemContaReceberID, vlrPago, vlrAbert, "Prevista"); itemContaReceberFRBO.ExcluirItemFormaRecebimentoContaReceberId(itemContaReceberFR._ItemContaReceberFRID); MessageBox.Show("Recebimento estornado com sucesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); CarregaItemContasRecebidasFormaRecebimento(); }
public string CarregaContasRecebidas(DateTime dataInicio, DateTime dataFim) { DataSet ds = new DataSet(); ItemContaReceberFormaRecebimentoBO itemContaReceberFormaRecebimentoBO = new ItemContaReceberFormaRecebimentoBO(); sb = new StringBuilder(); ds = itemContaReceberFormaRecebimentoBO.RetornaDataSetContaReceberFormaRecebimento(dataInicio, dataFim); if (ds != null) { string nRecebimento, vlorRecebido; totalRecebido = 0; foreach (DataRow row in ds.Tables[0].Rows) { nRecebimento = row["itemContarReceberID"].ToString(); vlorRecebido = Convert.ToDecimal(row["vlrPago"]).ToString("C"); totalRecebido += Convert.ToDecimal(row["vlrPago"]); sb.AppendLine(" " + nRecebimento + " " + vlorRecebido + " "); } } return(sb.ToString()); }
public void CarregaItemContasRecebidasFormaRecebimento() { if (ckbContasRecebidas.Checked == true) { DataSet dsItemCR = new DataSet(); ItemContaReceberFormaRecebimentoBO itemContaReceberFRBO = new ItemContaReceberFormaRecebimentoBO(); dsItemCR = itemContaReceberFRBO.RetornaDataSetContaReceberFormaRecebimento(DateTime.Parse(txtDateInicial.Text), DateTime.Parse(txtDataFinal.Text)); if (dsItemCR != null) { listViewItensContaReceber.Items.Clear(); countRowItemCR = 0; totalContaRecebidaDinheiro = 0; totalContaRecebidaCartao = 0; foreach (DataRow row in dsItemCR.Tables[0].Rows) { listViewItensContaReceber.Items.Add(row["itemContarReceberID"].ToString()); listViewItensContaReceber.Items[countRowItemCR].SubItems.Add(string.Format("{0:dd/MM/yyyy}", row["dataHora"])); listViewItensContaReceber.Items[countRowItemCR].SubItems.Add(string.Format("{0:C2}", row["vlrPago"])); countRowItemCR++; if (row["formaRecebimento"].ToString().StartsWith("01 - Dinheiro")) { totalContaRecebidaDinheiro += Convert.ToDecimal(row["vlrPago"]); } else { totalContaRecebidaCartao += Convert.ToDecimal(row["vlrPago"]); } } countRowItemCR = 0; txtTotalContasRecebidasEmBanco.Text = Convert.ToDecimal("0.00").ToString("C"); txtTotalContasRecebidasEmCartoes.Text = totalContaRecebidaCartao.ToString("C"); txtTotalContasRecebidasEmCheque.Text = Convert.ToDecimal("0.00").ToString("C"); txtTotalContasRecebidasEmDinheiro.Text = totalContaRecebidaDinheiro.ToString("C"); } } else { listViewItensContaReceber.Items.Clear(); } }
public string IncluirItensFormaRecebimento() { DataTable dt = new DataTable(); ItemContaReceberFormaRecebimentoBO itemContaReceberFormaRecebimentoBO = new ItemContaReceberFormaRecebimentoBO(); dt = itemContaReceberFormaRecebimentoBO.CriaDataTableSelecionaItemContasReceberFormaRecebimenoto(parametroCod); sb = new StringBuilder(); foreach (DataRow row in dt.Rows) { DateTime dataHora = row["dataHora"] == DBNull.Value ? Convert.ToDateTime(DateTime.MinValue.ToString("dd/MM/yyyy")) : Convert.ToDateTime(row["dataHora"]); sb.AppendLine(" " + row.ItemArray[3].ToString() + " " + row.ItemArray[4].ToString() + " " + dataHora.ToString("dd/MM/yyyy") + " " + Convert.ToDecimal(row.ItemArray[5]).ToString("C").Substring(3)); } return(sb.ToString()); }
//Salva informações pertinente ao item conta receber private void GravarItemFormaRecebimento() { ItemContaReceberFormaRecebimento itemContaReceberFR = new ItemContaReceberFormaRecebimento(); ItemContaReceberFormaRecebimentoBO itemContaReceberFRDAO = new ItemContaReceberFormaRecebimentoBO(); for (int i = 0; i < listFormaRecebimento.Items.Count; i++) { itemContaReceberFR._ItenContaReceber._ItemContaReceberID = parametroCod; itemContaReceberFR._Item = int.Parse(listFormaRecebimento.Items[i].SubItems[0].Text); itemContaReceberFR._FormaRecebimento = listFormaRecebimento.Items[i].SubItems[1].Text; itemContaReceberFR._VlrPago = decimal.Parse(listFormaRecebimento.Items[i].SubItems[2].Text.Substring(3)); itemContaReceberFR._DataHora = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy")); itemContaReceberFRDAO.Gravar(itemContaReceberFR); AtualizaSaldoContaCorrenteCaixaEmpresa(itemContaReceberFR._FormaRecebimento, itemContaReceberFR._VlrPago); } }
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"); } }