public string toString() { string result = "ORDER #" + this.id.ToString().PadLeft(8, '0') + "\nDATE " + this.createDate.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; result += "Cashier: " + this.emp.getName() + "\n\n"; for (int i = 0; i < lineItemList.Count; i++) { result += lineItemList.ElementAt(i).ToString() + "\n"; } result += "--------------------------\n"; result += "Subtotal\t" + this.total.getSubtotal() + "\nTax\t" + this.total.getTax() + "\nTotal\t" + this.total.getTotal() + "\n"; result += "\n"; for (int i = 0; i < total.getLinePaymentList().Count; i++) { result += "Paid\t" + total.getLinePaymentList().ElementAt(i).ToString(); } result += "\n\n"; if (this.isVoid.Equals("True")) { result += " ********************\n"; result += " *** VOID ***\n"; result += " ********************\n"; } return(result); }
/** * @desc function that encapsulates several function calls needed to print an order receipt * @param IInvoice invoice object that holds all the required information needed to print * @return void */ public void printBody(IInvoice invoice) { // get total object reference that invoice object holds ITotal total = invoice.getTotal(); List <ILineItem> lineItemList = invoice.getLineItemList(); List <ILinePayment> paymentsList = total.getLinePaymentList(); initializePrinter(); if (invoice.getIsVoid().Equals("True")) { printReturnHeader("Nail Salon", invoice.getEmployee().getFirstName(), invoice.ToString()); } else { printHeader("Nail Salon", invoice.getEmployee().getFirstName(), invoice.ToString()); } printLineItems(lineItemList); printSeparator(); printTotals(total); printPayments(paymentsList); printChangeDue(); openCashDrawer(); }