private String buildInvoice() { double taxRate = 6; String message; this.grandTotal = ((taxRate / 100) * this.subtotal) + this.subtotal; DateFormat dateFormat = new SimpleDateFormat("dd/MM/YY HH:mm:ss z"); this.transDate = new Date(); message = "Date: " + dateFormat.format(this.transDate) + "\n\n"; message += "Number of line items: " + this.totalItems + "\n\n"; message += "Item# / ID / Title / Price / Qty / Disc % / Subtotal:\n\n"; int counter = 0; for (Item i : order.getOrder()) { counter++; message += counter + ". " + i.toString() + "\n"; } message += "\n"; message += "Order subtotal: " + formatter.format(this.subtotal) + "\n\n"; message += "Tax rate: " + taxRate + "%\n\n"; message += "Tax amount: " + formatter.format(((taxRate / 100) * this.subtotal)) + "\n\n"; message += "Order total: " + formatter.format(this.grandTotal) + "\n\n"; message += "Thanks for shopping at Funky Town Books\n\n"; return message; }
public void processItem() { createItem(); if (item != null) { text_info.setText(item.toString()); btn_confirm.setDisable(false); } }
public void viewOrder() { String currentOrder = ""; int counter = 0; for (Item i : order.getOrder()) { counter++; currentOrder += counter + ". " + i.toString() + "\n"; } Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Current Order"); alert.setHeaderText("Your current order is as follows:"); alert.setContentText(currentOrder); alert.getDialogPane().setStyle(" -fx-max-width:500px; -fx-pref-width: 500px;"); alert.showAndWait(); }