Examples of Invoice


Examples of org.bigk.invoices.model.Invoice

  public Invoice getInvoice(Long id) throws ServiceException {
    if (logger.isDebugEnabled()) {
      logger.debug("getInvoice(Long id=" + id + ") - start");
    }

    Invoice object = null;
    Session session = null;
    try {
      session = HibernateUtils.getCurrentSession();
      object = (Invoice) session.get(Invoice.class, id);
     
View Full Code Here

Examples of org.bigk.invoices.model.Invoice

  public Invoice prepareNewInvoice() throws ServiceException {
    if (logger.isDebugEnabled()) {
      logger.debug("prepareNewInvoice() - start");
    }
   
    Invoice invoice = null;
    if (this.invoiceTemplate != null) {
      try {
        invoice = invoiceTemplate.clone();
      } catch (CloneNotSupportedException e) {
        logger.warn("prepareNewInvoice()", e);
      }
    }
   
    if (invoice == null) {
      invoice = new Invoice();
    }
   
    Calendar nowDay = Calendar.getInstance();
    nowDay.set(Calendar.HOUR, 0);
    nowDay.set(Calendar.MINUTE, 0);
    nowDay.set(Calendar.SECOND, 0);
    nowDay.set(Calendar.MILLISECOND, 0);
   
    Long curYear = new Long(nowDay.get(Calendar.YEAR));
    invoice.setYear(curYear.toString());
   
    int maxInvoiceNumber = this.getMaxInvoiceNumber(curYear.toString());
    maxInvoiceNumber++;
   
    Long number = new Long(maxInvoiceNumber);
    invoice.setNumber(number);
    invoice.setDocumentDate(nowDay.getTime());
    invoice.setSoldDate(nowDay.getTime());
   
    PaymentKind pk = null;
    if (invoice.getPaymentKindId() != null) {
      pk = paymentKindsService.getPaymentKind(invoice.getPaymentKindId());
    }
   
    Date paymentDate = null;
    if (pk != null) {
      invoice.setPaymentKind(pk);
      paymentDate = paymentKindsService.calculatePaymentDate(nowDay.getTime(), pk.getId());
      invoice.setPaymentDate(paymentDate);
    }
   
    recalculateInvoice(invoice);
    hrInvoiceNumberService.updateHRInvoiceNumber(invoice);
   
View Full Code Here

Examples of org.bigk.invoices.model.Invoice

  @Override
  public Invoice getInvoice(Long id) throws ServiceException {
    logger.debug("getInvoice(id=[{}]) - start", + id);

    Invoice invoice = em.find(Invoice.class, id);
    recalculateInvoice(invoice);
    hrInvoiceNumberService.updateHRInvoiceNumber(invoice);

    logger.debug("getInvoice(Long) - end - return value=[{}]", invoice);
    return invoice;
View Full Code Here

Examples of org.bigk.invoices.model.Invoice

  }

  public Invoice prepareNewInvoice() throws ServiceException {
    logger.debug("prepareNewInvoice() - start");
   
    Invoice invoice = null;
    if (this.invoiceTemplate != null) {
      try {
        invoice = invoiceTemplate.clone();
      } catch (CloneNotSupportedException e) {
        logger.warn("prepareNewInvoice()", e);
      }
    }
   
    if (invoice == null) {
      invoice = new Invoice();
    }
   
    invoice.setInvoicePositions(new ArrayList<InvoicePosition>());
    invoice.setInvoicePurchasers(new ArrayList<InvoicePurchaser>());
   
    Calendar nowDay = Calendar.getInstance();
    nowDay.set(Calendar.HOUR, 0);
    nowDay.set(Calendar.MINUTE, 0);
    nowDay.set(Calendar.SECOND, 0);
    nowDay.set(Calendar.MILLISECOND, 0);
   
    Long curYear = new Long(nowDay.get(Calendar.YEAR));
    invoice.setYear(curYear.toString());
   
    int maxInvoiceNumber = this.getMaxInvoiceNumber(curYear.toString());
    maxInvoiceNumber++;
   
    Long number = new Long(maxInvoiceNumber);
    invoice.setNumber(number);
    invoice.setDocumentDate(nowDay.getTime());
    invoice.setSoldDate(nowDay.getTime());
   
    PaymentKind pk = null;
    if (invoice.getPaymentKindId() != null) {
      pk = paymentKindsService.getPaymentKind(invoice.getPaymentKindId());
    }
   
    Date paymentDate = null;
    if (pk != null) {
      invoice.setPaymentKind(pk);
      paymentDate = paymentKindsService.calculatePaymentDate(nowDay.getTime(), pk.getId());
      invoice.setPaymentDate(paymentDate);
    }
   
    recalculateInvoice(invoice);
    hrInvoiceNumberService.updateHRInvoiceNumber(invoice);
   
View Full Code Here

Examples of org.bigk.invoices.model.Invoice

        .where(critBuilder.equal(root.get(Invoice_.year), year))
        .orderBy(critBuilder.desc(root.get(Invoice_.number)));
   
    TypedQuery<Invoice> query = em.createQuery(critQuery).setMaxResults(1);
   
    Invoice invoice = null;
    try {
      invoice = query.getSingleResult();
    } catch (NoResultException ex) {
      logger.info("getMaxInvoiceNumber() - no result found - no invoices in this year?");
    }
   
    int maxNumber = 0;
    if (invoice != null) {
      maxNumber = invoice.getNumber().intValue();
    }
   
    logger.debug("getMaxInvoiceNumber() - end - return value=[{}]", maxNumber);
    return maxNumber;
  }
View Full Code Here

Examples of org.bigk.invoices.model.Invoice

  }
 
  public void prepareBackToList() throws ServiceException {
    logger.debug("prepareBackToList() - start");

    this.model = new Invoice();

    logger.debug("prepareBackToList() - end");
  }
View Full Code Here

Examples of org.elevenbits.westvleteren.model.Invoice

        }
    }

    public void testCreateAndGetAndRemoveInvoice() throws Exception {
      log.warn("Creating a invoice");
      Invoice invoice = new Invoice("invoice", "description");
      dao.saveInvoice(invoice);
      Integer id = invoice.getId();
      invoice = dao.getInvoice(id);
      assertEquals(invoice.getName(), "invoice");
      assertEquals(invoice.getDescription(), "description");
      log.warn("Invoice created: " + invoice);
      dao.removeInvoice(invoice);
      log.warn("Invoice removed");
      try {
        invoice = dao.getInvoice(id);
View Full Code Here

Examples of org.jabusuite.transaction.Invoice

        logger.debug("Creating dunnings");

        ArrayList<Dunning> createdDunnings = new ArrayList<Dunning>();
        Iterator<Invoice> it = invoices.iterator();
        while (it.hasNext()) {
            Invoice invoice = it.next();

            //Try to get the dunning-group from the customer of the invoice:
            DunningGroup dunningGroup = null;
            if ((invoice.getAddress() != null) && (invoice.getAddress() instanceof Customer)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Looking for dunning group of customer " + invoice.getAddress().getId());
                }
                dunningGroup = ((Customer) invoice.getAddress()).getDunningGroup();
            }

            //If no customer-dunning-group was found use the default dunning-group
            if (dunningGroup == null) {
                if (logger.isDebugEnabled()) {
View Full Code Here

Examples of org.jabusuite.transaction.Invoice

        }
        return false;
    }
   
    protected void updateInvoice(CreditNote creditNote, JbsUser user) throws EJbsObject {
        Invoice invoice = creditNote.getInvoice();
        if (invoice!=null) {
            if (!this.invoiceHasCreditNote(invoice, creditNote))
                invoice.addCreditNote(creditNote);
            invoice.calcCreditNoteSum();
            invoiceManager.updateDataset(invoice, user);
        }
    }
View Full Code Here

Examples of org.jabusuite.transaction.Invoice

        logger.debug("Looking for invoice " + id);
        return this.findDataset(id, false);
    }

    public Invoice findDataset(long id, boolean withAdditionalData) {
        Invoice invoice = (Invoice) super.findDataset(manager, Invoice.class, id, withAdditionalData);
        if ((withAdditionalData) && (invoice != null)) {
            //retrieve the amount of payments just to make sure that they are fetched now:
            int paymentCount = invoice.getPayments().size();
            logger.debug("Positions: " + paymentCount);
        }
        return invoice;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.