예제 #1
0
 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();
 }
예제 #2
0
 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()));
 }