private String getHTML(String templatename, String templatelocation) { Hashtable mergefields = new Hashtable(); mergefields.Add("customer_name", this.customer.Name); mergefields.Add("customer_street", this.customer.Street); mergefields.Add("customer_city", this.customer.City); mergefields.Add("customer_zip", this.customer.Zipcode); mergefields.Add("customer_vat", this.customer.VatNumber); mergefields.Add("customer_phone", this.customer.Phone); mergefields.Add("customer_fax", this.customer.Fax); mergefields.Add("customer_email", this.customer.EmailAddress); mergefields.Add("customer_contact", this.customer.Contact); mergefields.Add("customer_rep", this.customer.Rep.FriendlyName); DateTime statementdate = DateTime.Now; mergefields.Add("statement_date", statementdate.ToShortDateString()); mergefields.Add("statement_openingbalance", Utilities.MakeMoneyValue(this.openingbalance)); mergefields.Add("statement_closingbalance", Utilities.MakeMoneyValue(this.closingbalance)); if (this.filtered) { mergefields.Add("statement_period", this.startdate.ToShortDateString() + " - " + this.enddate.ToShortDateString()); } else { mergefields.Add("statement_period", this.firstentrydate.ToShortDateString() + " - " + statementdate.ToShortDateString()); } if (!templatelocation.Equals("")) { mergefields.Add("templatelocation", templatelocation); } HTML html = new HTML(templatename, "Statement " + this.customer.Name, mergefields); html.AddHTML("entries", html.CreateHTMLTableRows(this.listEntries(), false)); return(html.ToString()); }
private String getHTML(Boolean preview, Boolean email) { Hashtable mergefields = new Hashtable(); //Note that we use the customer property, as the customer is only loaded from the property mergefields.Add("customer_name", this.Customer.Name); mergefields.Add("customer_street", this.Customer.Street); mergefields.Add("customer_city", this.Customer.City); mergefields.Add("customer_zip", this.Customer.Zipcode); mergefields.Add("customer_vat", this.Customer.VatNumber); mergefields.Add("customer_phone", this.Customer.Phone); mergefields.Add("customer_fax", this.Customer.Fax); mergefields.Add("customer_email", this.Customer.EmailAddress); mergefields.Add("customer_contact", this.Customer.Contact); mergefields.Add("customer_rep", this.Customer.Rep.FriendlyName); mergefields.Add("invoice_number", this.id); mergefields.Add("invoice_instructions", this.instructions); mergefields.Add("invoice_date", this.datetime.ToShortDateString()); mergefields.Add("invoice_finalized", this.finalized.ToString()); calculateInvoiceTotals(); mergefields.Add("subtotal", Utilities.MakeMoneyValue(subtotal)); mergefields.Add("vat", Utilities.MakeMoneyValue(vat)); mergefields.Add("total", Utilities.MakeMoneyValue(subtotal + vat)); //Create invoice entries HashSet<String[]> tablerows = calculateInvoiceTotals(); if (email) { mergefields.Add("templatelocation", "http://www.meulenfoods.co.za/email_design/"); } String template = "invoice"; if (preview) template = "invoice_preview"; HTML html = new HTML(template, "Invoice " + this.id, mergefields); html.AddHTML("entries", html.CreateHTMLTableRows(tablerows, false)); return html.ToString(); }
private String getHTML(String templatename, String templatelocation) { Hashtable mergefields = new Hashtable(); mergefields.Add("customer_name", this.customer.Name); mergefields.Add("customer_street", this.customer.Street); mergefields.Add("customer_city", this.customer.City); mergefields.Add("customer_zip", this.customer.Zipcode); mergefields.Add("customer_vat", this.customer.VatNumber); mergefields.Add("customer_phone", this.customer.Phone); mergefields.Add("customer_fax", this.customer.Fax); mergefields.Add("customer_email", this.customer.EmailAddress); mergefields.Add("customer_contact", this.customer.Contact); mergefields.Add("customer_rep", this.customer.Rep.FriendlyName); DateTime statementdate = DateTime.Now; mergefields.Add("statement_date", statementdate.ToShortDateString()); mergefields.Add("statement_openingbalance", Utilities.MakeMoneyValue(this.openingbalance)); mergefields.Add("statement_closingbalance", Utilities.MakeMoneyValue(this.closingbalance)); if (this.filtered) { mergefields.Add("statement_period", this.startdate.ToShortDateString() + " - " + this.enddate.ToShortDateString()); } else { mergefields.Add("statement_period", this.firstentrydate.ToShortDateString() + " - " + statementdate.ToShortDateString()); } if (!templatelocation.Equals("")) { mergefields.Add("templatelocation", templatelocation); } HTML html = new HTML(templatename, "Statement " + this.customer.Name, mergefields); html.AddHTML("entries", html.CreateHTMLTableRows(this.listEntries(), false)); return html.ToString(); }