Ejemplo 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;
  }
  public EXInviteFriends(String name) {
    super(name, "div");
    setAttribute(
        "style",
        "margin: auto; width: 600px; padding: 12px; border-radius: 5px 5px 5px 5px; background: -moz-linear-gradient(center top, rgb(36, 36, 39) 0%, rgb(21, 21, 22) 100% ) repeat scroll 0px 0px transparent; box-shadow: 5px 5px 5px black;");
    addChild(
        new EXXHTMLFragment(
            "sd",
            ResourceUtil.getDownloadURL(
                "classpath", "org/castafiore/facebook/ui/InviteInfo.xhtml")));

    EXGrid grid = new EXGrid("", 4, 1);
    String facebooklogin =
        SpringUtil.getBeanOfType(FacebookGraphAPIClient.class)
            .getAuthorizationUrl(
                "180567415418654",
                "ef8be0651a0d0aa94a51ec454b9a9165",
                "http://www.emallofmauritius.com/templates.html?facebook=true");
    Container facebook =
        new EXContainer("", "a")
            .setAttribute("href", facebooklogin)
            .setText(
                "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-facebook-box-blue-icon.png></img>");

    grid.getCell(0, 0).addChild(facebook);
    grid.getCell(1, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-google-box-blue-icon.png></img>");
    grid.getCell(2, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-linkedin-box-blue-icon.png></img>");
    grid.getCell(3, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-twitter-box-blue-icon.png></img>");
    // addChild(grid);

    addChild(
        new EXContainer("div", "div")
            .setAttribute(
                "style",
                "padding: 8px; background: none repeat scroll 0px 0px white; margin-top: 12px;")
            .addChild(grid));

    // facebook
    // linkedin
    // google+
    // twitter
    //
  }
Ejemplo n.º 3
0
 public static void analyseImport() throws Exception {
   Workbook wb = new HSSFWorkbook(new FileInputStream("/usr/local/software/clients.xls"));
   Dao dao = SpringUtil.getBeanOfType(Dao.class);
   Session session = dao.getReadOnlySession();
   Sheet s = wb.getSheetAt(0);
   for (int i = 0; i < s.getLastRowNum(); i++) {
     String code = s.getRow(i).getCell(0).getStringCellValue();
     List res =
         session
             .createSQLQuery(
                 "select code from WFS_FILE where dtype='Order' and code='" + code + "'")
             .list();
     if (res.size() == 0) {
       writeLog(code + " Not created");
     } else if (res.size() > 1) {
       writeLog(code + " Duplicate");
     }
   }
 }
Ejemplo n.º 4
0
  private static void sendMail(String person, String email) {
    String content =
        IOUtil.getStreamContentAsString(
            Thread.currentThread()
                .getContextClassLoader()
                .getResourceAsStream("com/eliensons/reminders/terminate.xhtml"));

    content = content.replace("${person}", person);

    try {
      JavaMailSender sender = SpringUtil.getBeanOfType(JavaMailSender.class);
      MimeMessage message = sender.createMimeMessage();
      MimeMessageHelper helper = new MimeMessageHelper(message, true);
      helper.setSubject("Sincere sympath from Elie and Sons");
      helper.setFrom(MallUtil.getCurrentMerchant().getEmail());
      helper.setTo(email);
      helper.setText(content, true);
      sender.send(message);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 5
0
  public EXRoleWidget(String name) throws Exception {
    super(name, 3, 0);
    addClass("ui-widget");
    addClass("ui-corner-all");
    setStyle("border-collapse", "collapse");
    setStyle("margin-left", "2px");
    setWidth(Dimension.parse("159px"));
    SecurityService service = SpringUtil.getBeanOfType(SecurityService.class);
    List<Group> groups = service.getGroups();
    // int index = 0;
    for (Group g : groups) {
      String gname = g.getName();
      int id = g.getId();
      EXRow row = addRow();
      row.setAttribute("grp-name", g.getName());
      EXCheckBox cb = new EXCheckBox("");
      cb.addEvent(
          new Event() {

            public void ClientAction(ClientProxy container) {
              container.makeServerRequest(this);
            }

            public boolean ServerAction(Container container, Map<String, String> request)
                throws UIException {

              EXIconButton ic =
                  container
                      .getAncestorOfType(PermissionButton.class)
                      .getDescendentOfType(EXIconButton.class);
              ic.setAttribute("isdirty", "true");
              String text = ic.getLabel();
              if (!text.endsWith("*")) {
                ic.setLabel(text + " *");
              }

              List<Container> checkBoxes = new ArrayList<Container>();
              ComponentUtil.getDescendentsOfType(
                  container.getParent().getParent().getDescendentOfType(EXGroupWidget.class),
                  checkBoxes,
                  EXCheckBox.class);

              for (Container c : checkBoxes) {
                ((EXCheckBox) c).setChecked(((EXCheckBox) container).isChecked());
              }
              return true;
            }

            public void Success(ClientProxy container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub

            }
          },
          Event.CHANGE);
      cb.setAttribute("rId", id + "");
      row.addInCell(0, cb);

      Container uiName = ComponentUtil.getContainer("label", "span", gname, null);
      row.addInCell(1, uiName);

      Container span = ComponentUtil.getContainer("", "span", null, "ui-icon ui-icon-circle-plus");
      span.setAttribute("close", "true");
      span.addEvent(
          new Event() {

            public void ClientAction(ClientProxy container) {

              ClientProxy open =
                  container
                      .clone()
                      .setAttribute("close", "false")
                      .removeClass("ui-icon-circle-plus")
                      .addClass("ui-icon-circle-minus")
                      .getParent()
                      .getParent()
                      .getDescendentByName("childWidget")
                      .slideDown(200);
              ClientProxy close =
                  container
                      .clone()
                      .setAttribute("close", "true")
                      .removeClass("ui-icon-circle-minus")
                      .addClass("ui-icon-circle-plus")
                      .getParent()
                      .getParent()
                      .getDescendentByName("childWidget")
                      .slideUp(200);
              container.IF(container.getAttribute("close").equal("true"), open, close);
              // container.getParent().getParent().getDescendentByName("childWidget").slideDown(200);
              // container.makeServerRequest(this);

            }

            public boolean ServerAction(Container container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub
              return false;
            }

            public void Success(ClientProxy container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub

            }
          },
          Event.CLICK);

      row.addInCell(2, span);

      row.addClass("ui-widget-content");
      row.getChildByIndex(0).setAttribute("valign", "top");
      row.getChildByIndex(1).setAttribute("valign", "top");
      row.getChildByIndex(2).setAttribute("valign", "top");
      row.getChildByIndex(1).setAttribute("width", "125px");

      EXContainer gw = new EXContainer("childWidget", "div");
      gw.setStyle("padding-top", "3px");
      gw.setStyle("padding-left", "1px");
      gw.setDisplay(false);
      gw.addClass("roles-class");
      EXGroupWidget gWidget = new EXGroupWidget("");
      gWidget.setWidth(Dimension.parse("100%"));
      gw.addChild(gWidget);
      row.addInCell(1, gw);

      // index++;
    }
  }