private void carregarCaixa(int idcaixa) { CCaixa c = new CCaixa(); dtcaixa = c.pegacaixa(idcaixa); CContaReceber creceber = new CContaReceber(); DataTable dtreceber = creceber.carregarParcelasCaixa(idcaixa); total = c.totalCaixa(idcaixa); totaldinheiro = 0; totalcheque = 0; totalfiado = 0; totalcartao = 0; totaldesconto = 0; CVenda cvenda = new CVenda(); DataTable dtvenda = cvenda.pesquisarIDCaixa(idcaixa); try { for (int i = 0; i < dtvenda.Rows.Count; i++) { totaldesconto += decimal.Parse(dtvenda.Rows[i]["ven_desconto"].ToString()); } for (int i = 0; i < dtreceber.Rows.Count; i++) { if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "DINHEIRO") { totaldinheiro += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString()); } if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "CHEQUE") { totalcheque += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString()); } if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "MARCAR") { totalfiado += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString()); } if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper().Contains("CARTÃO")) { totalcartao += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString()); } } ttbcaixanumero.Text = dtcaixa.Rows[0]["cai_numero"].ToString(); try { ttbcaixavalorinicial.Text = decimal.Parse(dtcaixa.Rows[0]["cai_valorinicial"].ToString()).ToString("00.00"); } catch { ttbcaixavalorinicial.Text = "00,00"; } ttbdinheirototal.Text = totaldinheiro.ToString("00.00"); ttbchequetotal.Text = totalcheque.ToString("00.00"); ttbfiadototal.Text = totalfiado.ToString("00.00"); ttbcartaototal.Text = totalcartao.ToString("00.00"); ttbdescontototal.Text = totaldesconto.ToString("00.00"); // total = totaldinheiro + totalcheque + totalfiado + totalcartao - totaldesconto; total = total - totaldesconto; ttbtotal.Text = total.ToString("00.00"); //ttbcaixavalordinheiro.Text = //ttbvalor.Text = c.totalCaixa(idcaixa).ToString("00.00"); //lblvalor.Text = ttbvalor.Text; } catch { } }