Example #1
0
  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;
  }
Example #2
0
 public void processItem() {
   createItem();
   if (item != null) {
     text_info.setText(item.toString());
     btn_confirm.setDisable(false);
   }
 }
Example #3
0
  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();
  }
  /**
   * Returns the room description and a list with the ids of the items and their description that
   * belongs to this room. <> <>
   *
   * @return The room description
   */
  public String getDescription() {
    String aux = "";
    String infoItems = "";
    Iterator<Item> it = this.items.iterator();
    if (it.hasNext()) {
      aux = this.description + Msg.room_items;
      ;
      while (it.hasNext()) {
        Item auxItem = it.next();
        infoItems = infoItems + auxItem.toString() + "\n";
      }
    } else aux = this.description + Msg.room_empty;

    return aux + infoItems;
  }
Example #5
0
 public Rect4f getItemRect(Item item) {
   Rect4f rect = itemRects.get(item);
   if (rect != null) return rect;
   else throw new NoSuchElementException(item.toString());
 }