public void checkout(TicketInfo ticket, String place) throws BasicException { appView = AppViewImpl.getInstance(); DataLogicSales dlSales = appView.getBean(DataLogicSales.class); try { // reset the payment info TaxesLogic taxesLogic = new TaxesLogic(dlSales.getTaxList().list()); taxesLogic.calculateTaxes(ticket); if (ticket.getTotal() >= 0.0) { ticket.resetPayments(); // Only reset if is sale } // assign the payments selected and calculate taxes. List<PaymentInfo> payments = new ArrayList<PaymentInfo>(); payments.add(new PaymentInfoCash(ticket.getTotal(), ticket.getTotalPaid())); ticket.setPayments(payments); // Asigno los valores definitivos del ticket... ticket.setUser(appView.getAppUserView().getUser().getUserInfo()); // El usuario que lo cobra ticket.setActiveCash(appView.getActiveCashIndex()); ticket.setDate(new Date()); // Le pongo la fecha de cobro // Save the receipt and assign a receipt number try { dlSales.saveTicket(ticket, appView.getInventoryLocation()); } catch (BasicException eData) { eData.printStackTrace(); } } catch (TaxesException e) { e.printStackTrace(); } }
private String getProductLabel(ProductInfoExt product) { if (pricevisible) { if (taxesincluded) { TaxInfo tax = taxeslogic.getTaxInfo(product.getTaxCategoryID()); return "<html><center>" + product.getName() + "<br>" + product.printPriceSellTax(tax); } else { return "<html><center>" + product.getDisplay() + "<br>" + product.printPriceSell(); } } else { return product.getDisplay(); } }