public String receiptToHtml(Receipt receipt) { StringBuffer receiptBuffer = new StringBuffer(); for (TaxedItem taxedItem : receipt.getTaxedItems()) { receiptBuffer.append(taxService.taxedItemToString(taxedItem)).append("<br>"); } receiptBuffer .append("Sales Taxes: ") .append(receipt.getTaxesTotal()) .append("<br>Total: " + receipt.getReceiptTotal() + "<br>"); return receiptBuffer.toString(); }
public void addTaxedItemToReceipt(Receipt receipt, TaxedItem taxedItem) { receipt.getTaxedItems().add(taxedItem); receipt.setTaxesTotal(receipt.getTaxesTotal().add(taxedItem.getTaxApplyed())); receipt.setReceiptTotal(receipt.getReceiptTotal().add(taxedItem.getFinalPrice())); }