Ejemplo n.º 1
0
 public double calcularSaldoFinal()
 {
     double final = 0;
     GestorOperacionCaja gestorOC = new GestorOperacionCaja();
     IList<OperacionCaja> listaOpe = new List<OperacionCaja>();
     OperacionCaja ope = new OperacionCaja();
     Cobro c;
     Gasto g;
     listaOpe = gestorOC.buscarPorCierreY(cierreY);
     if (listaOpe.Count > 0)
     {
         cbCajero.SelectedItem = listaOpe[0].Cajero;
         final = cierreY.SaldoInicial;
         for (int i = 0; i < listaOpe.Count; i++)
         {
             ope = listaOpe[i];
             c = new Cobro();
             c = gestorOC.buscarCobro(ope);
             if (c.Id != 0)
             {
                 final = final + c.Total;
             }
             g = new Gasto();
             g = gestorOC.buscarGasto(ope);
             if (g.Id != 0)
             {
                 final = final - g.Monto;
             }
         }
     }
     return final;
 }