示例#1
0
 public void run() {
   DBUtils.whereWeAre();
   empresa = ServiceLocator2.getConfiguracion().getSucursal().getEmpresa();
   System.out.println(
       "Cancelando pendientes para sucursal: "
           + ServiceLocator2.getConfiguracion().getSucursalLocalId());
   try {
     client = new CfdiClient();
     String sql =
         "SELECT x.uuid FROM sx_cxc_cargos_cancelados c join sx_cfdi x on(x.origen_id=c.cargo_id) where  X.UUID is not null and x.cancelacion is null";
     // Object args[]=new Object[]{};
     List<String> rows =
         ServiceLocator2.getJdbcTemplate()
             .queryForList(
                 sql
                 // , args
                 ,
                 String.class);
     for (String uuid : rows) {
       // System.out.println("Cancelando uuid: "+uuid);
       try {
         cancelar(uuid);
       } catch (Exception e) {
         System.out.println(
             "Error cancelando: " + uuid + " Error: " + ExceptionUtils.getRootCause(e));
       }
     }
   } catch (CfdiException e) {
     e.printStackTrace();
     System.out.println("Error en EDICOM: " + ExceptionUtils.getRootCauseMessage(e));
   }
 }
示例#2
0
 private JComboBox createSucursalControl() {
   final JComboBox box =
       new JComboBox(ServiceLocator2.getLookupManager().getSucursalesOperativas().toArray());
   Sucursal local = ServiceLocator2.getConfiguracion().getSucursal();
   for (int index = 0; index < box.getModel().getSize(); index++) {
     Sucursal s = (Sucursal) box.getModel().getElementAt(index);
     if (s.equals(local)) {
       box.setSelectedIndex(index);
       break;
     }
   }
   return box;
 }
  @Override
  protected List<Embarque> findData() {
    String hql = "from Embarque e where e.regreso is null";
    List<Embarque> data = ServiceLocator2.getHibernateTemplate().find(hql);
    hql = "from Embarque e where date(e.regreso) between ? and ?";
    data.addAll(
        ServiceLocator2.getHibernateTemplate()
            .find(hql, new Object[] {periodo.getFechaInicial(), periodo.getFechaFinal()}));

    UniqueList<Embarque> unidata =
        new UniqueList<Embarque>(
            GlazedLists.eventList(data), GlazedLists.beanPropertyComparator(Embarque.class, "id"));
    return unidata;
  }
示例#4
0
  public void cancelar(String uuid) throws Exception {
    String[] uuidList = new String[] {uuid};
    System.out.println("Mandando canclera CFDIS: " + ArrayUtils.toString(uuidList));

    String dirPath = "Z:\\CFDI\\cancelaciones";
    File dir = new File(dirPath);
    Assert.isTrue(dir.exists(), "No existe el directorio para cancelaciones: " + dirPath);
    Assert.isTrue(
        dir.isDirectory(), "La ruta para las cancelaciones no es un directorio " + dirPath);

    CancelaResponse res =
        client.cancelCfdi(
            "PAP830101CR3",
            "yqjvqfofb",
            empresa.getRfc(),
            uuidList,
            empresa.getCertificadoDigitalPfx(),
            pfxPassword);
    String msg = res.getText();
    String aka = res.getAck();
    // String[] uuids=res.getUuids();
    CFDI cfdi = ServiceLocator2.getCFDIManager().buscarPorUUID(uuid);
    Assert.notNull(cfdi, "No eixste el CFDI con UUID:" + uuid);

    try {
      // byte[] d1=Base64.decode(msg.getBytes());
      String xmlFile = StringUtils.remove(cfdi.getXmlFilePath(), "xml");
      byte[] d1 = msg.getBytes();
      File msgFile = new File(dir, xmlFile + "_MSG.xml");
      FileOutputStream out1 = new FileOutputStream(msgFile);
      out1.write(d1);
      out1.close();

      // byte[] d2=Base64.decode(aka.getBytes());
      byte[] d2 = aka.getBytes();
      File akaFile = new File(dir, xmlFile + "_AKA.xml");
      FileOutputStream out2 = new FileOutputStream(akaFile);
      out2.write(d2);
      out2.close();

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println(
          "Error salvando archivos de cancelacion: " + ExceptionUtils.getRootCauseMessage(e));
    }
    cfdi.setCancelacion(new Date());
    ServiceLocator2.getHibernateTemplate().merge(cfdi);
  }
示例#5
0
 @Override
 protected List<Poliza> findData() {
   System.out.println("Buscando polizas periodo: " + periodo);
   String hql = "from Poliza p " + " where p.clase=? " + "   and date(p.fecha) between ? and ?";
   Object[] params = {getClase(), periodo.getFechaInicial(), periodo.getFechaFinal()};
   return ServiceLocator2.getHibernateTemplate().find(hql, params);
 }
示例#6
0
 public List<Poliza> findData() {
   Periodo p = new Periodo(datePicker.getDate(), datePicker2.getDate());
   Poliza res = ServiceLocator2.getComprasDeGastosManager().generarPolizaDeProvision(p);
   res.setFecha(p.getFechaFinal());
   List<Poliza> list = new ArrayList<Poliza>();
   list.add(res);
   return list;
 }
示例#7
0
    private void initComponents() {
      fechaInicial = new JXDatePicker();
      fechaInicial.setFormats("dd/MM/yyyy");

      fechaFinal = new JXDatePicker();
      fechaFinal.setFormats("dd/MM/yyyy");

      List<ChoferFacturista> data =
          ServiceLocator2.getUniversalDao().getAll(ChoferFacturista.class);
      choferes = new JComboBox(data.toArray());
    }
示例#8
0
 private JComboBox buildLineaControl() {
   final JComboBox box = new JComboBox();
   final EventList source =
       GlazedLists.eventList(
           ServiceLocator2.getHibernateTemplate().find("from Linea l order by l.nombre"));
   final TextFilterator filterator = GlazedLists.textFilterator(new String[] {"nombre"});
   AutoCompleteSupport support = AutoCompleteSupport.install(box, source, filterator);
   support.setFilterMode(TextMatcherEditor.STARTS_WITH);
   support.setCorrectsCase(true);
   return box;
 }
示例#9
0
 private JComponent buildProveedorControl(final ValueModel vm) {
   if (model.getValue("proveedor") == null) {
     final JComboBox box = new JComboBox();
     final EventList source =
         GlazedLists.eventList(ServiceLocator2.getProveedorManager().getAll());
     final TextFilterator filterator =
         GlazedLists.textFilterator(new String[] {"clave", "nombre", "rfc"});
     AutoCompleteSupport support = AutoCompleteSupport.install(box, source, filterator);
     support.setFilterMode(TextMatcherEditor.CONTAINS);
     support.setStrict(false);
     final EventComboBoxModel model = (EventComboBoxModel) box.getModel();
     model.addListDataListener(new Bindings.WeakListDataListener(vm));
     box.setSelectedItem(vm.getValue());
     return box;
   } else {
     String prov = ((Proveedor) vm.getValue()).getNombreRazon();
     JLabel label = new JLabel(prov);
     return label;
   }
 }
示例#10
0
 public List<Poliza> findData() {
   return ServiceLocator2.getComprasDeGastosManager()
       .generarPolizaDePagos2(datePicker.getDate());
 }
示例#11
0
 private PolizasManager getPolizasManager() {
   return ServiceLocator2.getPolizasManager();
 }
示例#12
0
 @Override
 public boolean doDelete(Poliza bean) {
   ServiceLocator2.getPolizasManager().getPolizaDao().remove(bean.getId());
   return true;
 }
示例#13
0
 protected List<Cargo> getData() {
   if (cliente != null)
     return ServiceLocator2.getCXCManager().buscarCuentasPorCobrar(cliente, origen);
   else return new ArrayList<Cargo>();
 }