public SmartInvoiceDTO findSmartInvoiceByKey(Integer idKey) {
    SmartInvoice p1 = new SmartInvoice();
    p1.setId(idKey);
    SmartInvoiceDTO foundDto = (new SmartInvoiceDTO()).convertToDto(smartInvoiceDAO.findByKey(p1));
    if (foundDto != null) {
      return foundDto;
    }

    return null;
  }
 public boolean deleteSmartInvoiceByKey(Integer idKey) {
   SmartInvoice p1 = new SmartInvoice();
   p1.setId(idKey);
   return smartInvoiceDAO.delete(p1);
 }
  public SmartInvoiceDTO convertToDto(SmartInvoice entity) {
    SmartInvoiceDTO p = null;
    if (entity != null) {
      List<SmartInvItemDTO> items = new SmartInvItemDTO().convertToDtoList(entity.getItems());
      PaymentEftDTO eftPay = new PaymentEftDTO().convertToDto(entity.getEftPay());
      PaymentChequeDTO chequePay = new PaymentChequeDTO().convertToDto(entity.getChequePay());

      p =
          new SmartInvoiceDTO(
              entity.getId(),
              entity.getInvoiceNumber(),
              entity.getIssueDate(),
              entity.getTerms(),
              entity.getDueDate(),
              entity.getAppCodeUnique(),
              entity.getUserId(),
              items,
              entity.getComments(),
              entity.getSubTotal(),
              entity.getTotalDueAmount(),
              entity.getTotalTaxableAmount(),
              entity.getTotalDiscountedAmount(),
              eftPay,
              chequePay,
              entity.getStatus());

      // Set these within the BoImpl (or) Autowired in this DTO
      p.setFromOrg(getSmartOrgObj(entity.getFromOrgId()));
      p.setToOrg(getSmartOrgObj(entity.getToOrgId()));
    }
    return p;
  }