public override object Clone() { var result = base.Clone() as Shipment; result.Price = Price?.Clone() as Money; result.PriceWithTax = PriceWithTax?.Clone() as Money; result.DiscountAmount = DiscountAmount?.Clone() as Money; result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money; result.Total = Total?.Clone() as Money; result.TotalWithTax = TotalWithTax?.Clone() as Money; result.TaxTotal = TaxTotal?.Clone() as Money; if (Discounts != null) { result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount)); } if (TaxDetails != null) { result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail)); } if (Items != null) { result.Items = new List <CartShipmentItem>(Items.Select(x => x.Clone() as CartShipmentItem)); } if (ValidationErrors != null) { result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError)); } return(result); }
public void GenerateRecipt() { output.Append($"Date: {DateTime.Now:MMMM dd, yyyy HH:mm}{Environment.NewLine}"); output.Append($"Stay Charge: ${DaysCharge.ToString()}{Environment.NewLine}"); output.Append($"Miscellaneous Charge: ${MiscCharge.ToString()}{Environment.NewLine}"); output.Append($"Tax: ${TotalTax.ToString()}{Environment.NewLine}"); output.Append($"Total: ${TotalWithTax.ToString()}{Environment.NewLine}"); output.AppendLine(); File.AppendAllText(fullName, output.ToString()); }
/// <summary> /// Creates the reciept to be sent to the printer /// </summary> /// <param name="cardOrCash">0 if card 1 if cash</param> private void PrintReceipt(int cardOrCash) { ReceiptPrinter rp = new ReceiptPrinter(); StringBuilder sb = new StringBuilder(); sb.Append("---------- COWBOY CAFE ----------\n"); sb.Append(DateTime.Now + "\n"); sb.Append("Order #: " + PrevOrderNumber + "\n"); /* Iterate over all items */ foreach (IOrderItem i in Items) { sb.Append(i.ToString() + "\t\t" + i.Price.ToString("C2") + "\n"); /* Iterate through the special instruction for the item i */ foreach (string s in i.SpecialInstructions) { sb.Append(s + "\n"); } sb.Append("\n"); } sb.Append("Subtotal: " + Subtotal.ToString("C2") + "\n"); sb.Append("Tax: " + Tax.ToString("C2") + "\n"); sb.Append("Total: " + TotalWithTax.ToString("C2") + "\n\n"); if (cardOrCash == 1) { sb.Append("Paid: " + Paid.ToString("C2") + "\n"); sb.Append("Change: " + Change.ToString("C2") + "\n"); } else { sb.Append("Credit Card was used!\n"); } string sr = sb.ToString(); MessageBox.Show(sr); rp.Print(sr); ShowDrawerContents(); SetNewOrder(); }