Example #1
0
 @SuppressWarnings("unchecked")
 private void registrarAsientos(final GCompra compra) {
   final EventList<GCompraDet> eventList = GlazedLists.eventList(compra.getPartidas());
   final GroupingList groupList =
       new GroupingList(
           eventList, GlazedLists.beanPropertyComparator(GCompraDet.class, "sucursal.clave"));
   for (int index = 0; index < groupList.size(); index++) {
     List<GCompraDet> row = groupList.get(index);
     registrarAsientos(row);
   }
 }
Example #2
0
 private void cargoAIva(final GCompra compra) {
   CantidadMonetaria importe = CantidadMonetaria.pesos(0);
   for (GCompraDet det : compra.getPartidas()) {
     importe = importe.add(det.getImpuestoMN().abs());
   }
   AsientoDeGasto a1 = new AsientoDeGasto();
   a1.setConcepto("IVA EN GASTOS");
   a1.setCuenta("117-0001-003");
   a1.setDescripcion(StringUtils.substring(getConcepto(), 0, 28));
   a1.setDebe(importe);
   registros.add(a1);
 }
 /**
  * Registra los gastos agrupandolos por rubro y sucursal
  *
  * @param compra
  * @param registros
  */
 @SuppressWarnings("unchecked")
 public void registrarGastosAgrupados(
     final GCompra compra, final Poliza poliza, final String factura) {
   final EventList<GCompraDet> eventList = GlazedLists.eventList(compra.getPartidas());
   final Comparator<GCompraDet> c1 =
       GlazedLists.beanPropertyComparator(GCompraDet.class, "rubro.id");
   final Comparator<GCompraDet> c2 =
       GlazedLists.beanPropertyComparator(GCompraDet.class, "sucursal.clave");
   Comparator<GCompraDet>[] comps = new Comparator[] {c1, c2};
   final GroupingList groupList =
       new GroupingList(eventList, GlazedLists.chainComparators(Arrays.asList(comps)));
   for (int index = 0; index < groupList.size(); index++) {
     List<GCompraDet> row = groupList.get(index);
     registrarGasto(row, poliza, factura);
   }
 }