@Observer("promissoryFromContactPayrollHome:popupNotice:client.promissory")
  public void selectClientPromissory(PromissoryNote promissory) {
    manualFlush();

    if (entity == null) {
      return;
    }

    PromissoryFromContactPayrollDetail cpd = new PromissoryFromContactPayrollDetail();
    cpd.setOwner(entity);
    cpd.setPromissory(promissory);
    cpd.getPromissory().setMoney(promissory.getMoney());
    cpd.getPromissory().getMoney().setCurrency(promissory.getMoney().getCurrency());
    cpd.getPromissory().getMoney().setValue(promissory.getMoney().getValue());
    cpd.getPromissory().setInfo(promissory.getInfo());
    cpd.getPromissory().setReferenceNo(promissory.getReferenceNo());

    if (cpd.getPromissory().getId() != null && entity.getDetails().contains(cpd)) {
      facesMessages.add("Senet zaten mevcut");
      return;
    }

    entity.getDetails().add(cpd);

    log.debug("yeni item eklendi");
  }
  public void senetSatirininDetaylariniAta(
      PaymentItemPromissoryNote promissoryNote, PromissoryNote promissory) {

    promissoryNote.setOwner(entity);
    promissoryNote.getAmount().setCurrency(promissory.getMoney().getCurrency());
    promissoryNote.setPromissoryNote(promissory);
    promissoryNote.setAmount(new MoneySet(promissory.getMoney()));
    promissoryNote.getAmount().setValue(promissory.getMoney().getValue());

    String date = DateFormat.getDateInstance().format(promissory.getMaturityDate());

    String info =
        "Senet No: "
            + promissory.getReferenceNo()
            + " ,Keşide Yeri: "
            + promissory.getPaymentPlace()
            + " ,Sahibi: "
            + promissory.getPromissorynoteOwner()
            + " ,Vade: "
            + date;

    if (promissory.getInfo().length() > 0) {
      info = info + ", " + promissory.getInfo();
    }

    if (info.length() > 255) {
      info.substring(0, 255);
    }

    promissoryNote.setInfo(info);
  }