Exemplo n.º 1
0
  public static boolean createItem(ReconcilationDTO tr, CashBook cb) {

    String ref = tr.getRefNumber();
    String amount = tr.getAmount();
    try {
      if (StringUtil.isNotEmpty(ref) && StringUtil.isNotEmpty(amount)) {
        //			BigDecimal bAmount = new BigDecimal(amount);
        //			CashBookEntry entry = cb.createEntry(System.currentTimeMillis() + "" +
        // StringUtil.nextString(10));
        //			entry.setAccountCode( ref);
        //			entry.setSummary("Installment " + ref + " "+ tr.getDate());
        //			entry.setTitle(entry.getSummary());
        //			entry.setTotal(bAmount);
        //			entry.setDateOfTransaction(new SimpleDateFormat("dd MMM yyyy").parse(tr.getDate()));
        //			entry.save();
        String nm = new Date().getTime() + StringUtil.nextString(10);
        String code = StringUtil.nextString(10);
        String sql =
            "insert into WFS_FILE (clazz, dateCreated, lastModified, name, parent_id, summary, title, code, paymentMethod,total, accountCode, dateOfTransaction, DTYPE, absolutePath, size, status, commentable, dislikeit, likeit,ratable) values "
                + "('org.castafiore.accounting.CashBookEntry',now(),now(),'"
                + nm
                + "', "
                + "'/root/users/elieandsons/Applications/e-Shop/elieandsons/DefaultCashBook', "
                + "'Installment "
                + tr.getName()
                + "  "
                + tr.getDate()
                + "', 'Installment "
                + tr.getName()
                + "  "
                + tr.getDate()
                + "', '"
                + code
                + "', 'Standing Order', '"
                + tr.getAmount()
                + "', '"
                + tr.getName()
                + "',now() ,'CashBookEntry','/root/users/elieandsons/Applications/e-Shop/elieandsons/DefaultCashBook/"
                + nm
                + "',1,1,true,1,1, true);";

        SpringUtil.getBeanOfType(Dao.class).getSession().createSQLQuery(sql).executeUpdate();
        return true;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return false;
  }