public static String agregarGasto(
     Date fecha,
     int tipoDoc,
     String numDoc,
     String descripcion,
     float montoTotal,
     ArrayList<InsumoAlmacen> insumos,
     String ruc) {
   int numDocumento;
   try {
     numDocumento = Integer.parseInt(numDoc);
   } catch (Exception e) {
     return "Error: El numero de documento solo puede contener numeros";
   }
   Gastos g = new Gastos(0, fecha.getDay(), fecha.getMonth(), fecha.getYear(), montoTotal);
   g.setGasDes("Pago por insumos");
   g.setGasNumDoc(numDocumento);
   g.setGasNBol(numDocumento);
   g.setTipDocCod(new TipoDocumento(tipoDoc));
   g.setEmpDni(new Empleado(Integer.parseInt(ManejoSesion.getDNI())));
   g.setProvRuc(new Proveedor(ruc));
   g.setTipGasCod(new TipoGasto(1));
   if (new GestionarGastosImplementacion().agregarGasto(g)) {
     for (InsumoAlmacen ins : insumos) {
       IngresoKardexControlador.agregarIngresoKardex(
           g.getGasCod(), ins.getCodInsumo(), ins.getCantidad(), ins.getPrecio());
     }
     return "CORRECTO";
   } else {
     return "No se pudo agregar el gasto";
   }
 }
 public static String agregarGasto(
     int tipo, Date fecha, int tipoDoc, String numDoc, String descripcion, String monto) {
   float montoTotal;
   int numDocumento;
   try {
     montoTotal = Float.parseFloat(monto);
   } catch (Exception e) {
     return "Ingrese un monto valido";
   }
   try {
     numDocumento = Integer.parseInt(numDoc);
   } catch (Exception e) {
     return "El numero de documento solo puede contener numeros";
   }
   if (ValidacionGeneral.precioValido(montoTotal)) {
     Gastos g = new Gastos(1, fecha.getDay(), fecha.getMonth(), fecha.getYear(), montoTotal);
     g.setGasNumDoc(numDocumento);
     g.setTipDocCod(new TipoDocumento(tipoDoc));
     g.setEmpDni(new Empleado(Integer.parseInt(ManejoSesion.getDNI())));
     g.setProvRuc(new Proveedor("00000000001"));
     g.setTipGasCod(new TipoGasto(tipo));
     new GestionarGastosImplementacion().agregarGasto(g);
     return "CORRECTO";
   } else {
     return "Ingrese un monto valido";
   }
 }
 public AgregarProductosOfrecidos(CategoriaProducto cat) {
   initComponents();
   tUsuario.setText(ManejoSesion.getUsuario());
   ActualizarReloj actualizar = new ActualizarReloj(tHora);
   CargarFecha.cargarFechaActual(tFecha);
   categoria = cat;
 }
 private void bAgregarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_bAgregarActionPerformed
   String tipo = "" + categoria.getCatProdCod();
   ImageResizer.copyImage(
       jTImagen.getText(),
       ManejoSesion.getRuta() + "/Imagenes/",
       "prod" + tNombre.getText(),
       60,
       60);
   try {
     Thread.sleep(1000);
   } catch (InterruptedException ex) {
   }
   String resultado =
       AgregarProductoControlador.insertarProducto(
           tNombre.getText(),
           "prod" + tNombre.getText() + ".png",
           tPrecFijo.getText(),
           tPrecVenta.getText(),
           tipo);
   if (resultado.equals("CORRECTO")) {
     atras();
   } else {
     JOptionPane.showMessageDialog(null, resultado);
   }
 } // GEN-LAST:event_bAgregarActionPerformed
 public ListaCategoriasExtras() {
   listaCategorias();
   initComponents();
   tUsuario.setText(ManejoSesion.getUsuario());
   ActualizarReloj actualizar = new ActualizarReloj(tHora);
   CargarFecha.cargarFechaActual(tFecha);
 }