
Error executing template "/Designs/Bhg/Paragraph/OrderReceipt.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_515782c5eb8448f08c6b967242db403a.Execute() in C:\Websites\DW_Dev\Custom\BHGSource\Files\Templates\Designs\Bhg\Paragraph\OrderReceipt.cshtml:line 11 at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Text.RegularExpressions 3 @using System.Linq 4 @using System.Web; 5 @using Dynamicweb.Core 6 @using Dynamicweb.Ecommerce.Orders 7 @using BHGSource.Service; 8 @{ 9 string orderReceiptSubText = Pageview.AreaSettings.GetString("Order_Receipt_Page_Sub_Text") != null ? Pageview.AreaSettings.GetString("Order_Receipt_Page_Sub_Text") : ""; 10 string orderReceiptAssistanceText = Pageview.AreaSettings.GetString("Order_Receipt_Page_Assistance_Text") != null ? Pageview.AreaSettings.GetString("Order_Receipt_Page_Assistance_Text") : ""; 11 string orderId = System.Web.HttpContext.Current.Request.QueryString["orderId"].ToString(); 12 OrderService orderService = new OrderService(); 13 Order dwOrder = orderService.GetById(orderId); 14 double totalquantity = 0.0; 15 string ClickCollectStockText = Pageview.AreaSettings.GetString("ClickCollectStockText") != null ? Pageview.AreaSettings.GetString("ClickCollectStockText") : ""; 16 bool haveClickCollect = false; 17 } 18 @functions{ 19 public OrderLine copyObject(OrderLine cartOrderLine) 20 { 21 22 return new OrderLine 23 { 24 productid = cartOrderLine.productid, 25 brand = cartOrderLine.brand, 26 productnumber = cartOrderLine.productnumber, 27 name = cartOrderLine.name, 28 variantname = cartOrderLine.variantname, 29 variantId = cartOrderLine.variantId, 30 quantity = cartOrderLine.quantity, 31 totalprice = cartOrderLine.totalprice, 32 earlyprice = cartOrderLine.earlyprice, 33 unitprice = cartOrderLine.unitprice, 34 image = cartOrderLine.image, 35 isEmpty = cartOrderLine.isEmpty, 36 orderLineId = cartOrderLine.orderLineId, 37 currencyCode = cartOrderLine.currencyCode, 38 price = cartOrderLine.price, 39 size = cartOrderLine.size, 40 color = cartOrderLine.color, 41 isPromo = cartOrderLine.isPromo, 42 isGift = cartOrderLine.isGift, 43 url = cartOrderLine.url, 44 }; 45 46 } 47 48 public class OrderLine 49 { 50 public string orderLineId { get; set; } 51 public string productid { get; set; } 52 public string productnumber { get; set; } 53 public string name { get; set; } 54 public string variantname { get; set; } 55 public string variantId { get; set; } 56 public string quantity { get; set; } 57 public string totalprice { get; set; } 58 public string earlyprice { get; set; } 59 public double unitprice { get; set; } 60 public string image { get; set; } 61 public bool isEmpty { get; set; } 62 public string brand { get; set; } 63 public string currencyCode { get; set; } 64 public string price { get; set; } 65 public string size { get; set; } 66 public string color { get; set; } 67 public bool isPromo { get; set; } 68 public string url { get; set; } 69 public bool isGift { get; set; } 70 public string storeId { get; set; } 71 } 72 73 public class RootStore 74 { 75 public int storeId { get; set; } 76 public string storeName { get; set; } 77 public string StoreAddress { get; set; } 78 public string OpenHours { get; set; } 79 public string TotalItems { get; set; } 80 public List<OrderLine> OrderLines { get; set; } 81 } 82 83 } 84 85 @{ 86 double extrapwp = 0; 87 double extrapwpdiscount = 0; 88 89 List<OrderLine> GFOrderLines = new List<OrderLine>(); 90 string currency = dwOrder.Currency.Code; 91 string orderid = dwOrder.Id; 92 double revenue = dwOrder.Price.Price-dwOrder.ShippingFee.Price-dwOrder.TotalDiscount.Price; 93 double tax = dwOrder.TotalPriceWithoutTaxes.VAT + dwOrder.TotalTax.Price - dwOrder.ShippingFee.Price; 94 double shippingfee = dwOrder.ShippingFee.Price; 95 96 foreach (var orderLine in dwOrder.OrderLines.Where(x => Convert.ToInt32(x.OrderLineType) == (int)OrderLineType.ProductDiscount).ToList()) 97 { 98 if(Convert.ToInt32(orderLine.OrderLineType)== (int)OrderLineType.ProductDiscount) 99 { 100 Dynamicweb.Ecommerce.Products.Product product = Dynamicweb.Ecommerce.Products.Product.GetProductById(orderLine.ProductId); 101 var price = product.GetPrice(dwOrder.Price.Currency.Code, dwOrder.CustomerCountryCode); 102 extrapwp = extrapwp + orderLine.Quantity* price.Price; 103 extrapwpdiscount = extrapwpdiscount + orderLine.Price.Price; 104 } 105 } 106 107 RootStore delivery = new RootStore(); 108 delivery.storeId = 0; 109 delivery.storeName = Translate("DELIVERY"); 110 delivery.OrderLines = new List<OrderLine>(); 111 var iso = ""; 112 foreach (OrderFieldValue orderFieldValue in dwOrder.OrderFieldValues) 113 { 114 switch (orderFieldValue.OrderField.SystemName) 115 { 116 case "ClickandCollect": 117 if (orderFieldValue.Value != null) 118 { 119 iso = orderFieldValue.Value.ToString(); 120 } 121 break; 122 } 123 } 124 bool isShipping = true; 125 if (iso == "True") 126 { 127 isShipping = false; 128 } 129 List<RootStore> SList = new List<RootStore>(); 130 131 var RootStores = new List<RootStore>(); 132 foreach (var orderLine in dwOrder.OrderLines.Where(x=>Convert.ToInt32(x.OrderLineType)==(int)OrderLineType.Product || Convert.ToInt32(x.OrderLineType) == (int)OrderLineType.GiftCard || Convert.ToInt32(x.OrderLineType) == (int)OrderLineType.ProductDiscount).ToList()) 133 { 134 totalquantity = totalquantity + orderLine.Quantity; 135 Dynamicweb.Ecommerce.Products.Product product = Dynamicweb.Ecommerce.Products.Product.GetProductById(orderLine.ProductId); 136 BHGSource.Service.OrderInfoService orderInfoService = new BHGSource.Service.OrderInfoService(); 137 string imagepath = orderInfoService.GetImagePath(product.Id, orderLine.ProductVariantId); 138 139 OrderLine cartOrderLine = new OrderLine(); 140 141 cartOrderLine.productid = orderLine.ProductId; 142 string brand = ""; 143 if (orderLine.Product.ProductFieldValues.GetProductFieldValue("Brand").Value != null) 144 { 145 brand = orderLine.Product.ProductFieldValues.GetProductFieldValue("Brand").Value.ToString(); 146 } 147 double baseprice = 0; 148 if (orderLine.Product.ProductFieldValues.GetProductFieldValue("BasePrice").Value != null) 149 { 150 baseprice = Convert.ToDouble(orderLine.Product.ProductFieldValues.GetProductFieldValue("BasePrice").Value); 151 } 152 cartOrderLine.brand = brand; 153 cartOrderLine.productnumber = orderLine.ProductNumber; 154 cartOrderLine.name = orderLine.ProductName + orderLine.ProductVariantText; 155 cartOrderLine.variantname = orderLine.ProductVariantText; 156 cartOrderLine.variantId = orderLine.ProductVariantId; 157 cartOrderLine.quantity = orderLine.Quantity.ToString(); 158 cartOrderLine.totalprice = orderLine.Price.PriceFormatted; 159 cartOrderLine.unitprice = orderLine.UnitPrice.Price; 160 var price = product.GetPrice(dwOrder.Price.Currency.Code, dwOrder.CustomerCountryCode); 161 cartOrderLine.earlyprice = "$" + String.Format("{0:n}", Convert.ToInt32(cartOrderLine.quantity) * price.Price); 162 if (baseprice > 0 && price.Price < baseprice) 163 { 164 cartOrderLine.earlyprice = "$" + String.Format("{0:n}", Convert.ToInt32(cartOrderLine.quantity) * baseprice); 165 } 166 cartOrderLine.image = imagepath; 167 cartOrderLine.isEmpty = GetBoolean("Ecom:Order.IsEmpty"); 168 cartOrderLine.orderLineId = orderLine.Id; 169 cartOrderLine.currencyCode = GetString("Ecom:Order.Currency"); 170 cartOrderLine.price = orderLine.Price.PriceFormatted; 171 cartOrderLine.size = ""; 172 cartOrderLine.color = ""; 173 cartOrderLine.isPromo = false; 174 175 cartOrderLine.isGift = false; 176 string clickCollect = ""; 177 foreach (OrderLineFieldValue orderlineFieldValue in orderLine.OrderLineFieldValues) 178 { 179 switch (orderlineFieldValue.OrderLineFieldSystemName) 180 { 181 case "GiftaGift": 182 var onv = Convert.ToBoolean(orderlineFieldValue.Value.ToString()); 183 if (onv) 184 { 185 cartOrderLine.isGift = true; 186 } 187 break; 188 case "ClickandCollectStoreData": 189 clickCollect = orderlineFieldValue.Value.ToString(); 190 break; 191 } 192 } 193 string BHGExclusive = ""; 194 if (orderLine.Product.ProductFieldValues.GetProductFieldValue("BHGExclusive").Value != null) 195 { 196 BHGExclusive = orderLine.Product.ProductFieldValues.GetProductFieldValue("BHGExclusive").Value.ToString(); 197 } 198 string Promotion = ""; 199 if (orderLine.Product.ProductFieldValues.GetProductFieldValue("Promotion").Value != null) 200 { 201 Promotion = orderLine.Product.ProductFieldValues.GetProductFieldValue("Promotion").Value.ToString(); 202 } 203 if ((!string.IsNullOrEmpty(Promotion) && Promotion.ToLower() == "yes") || (!string.IsNullOrEmpty(BHGExclusive) && BHGExclusive.ToLower() == "yes")) 204 { 205 cartOrderLine.isPromo = true; 206 } 207 208 var isvarient = orderLine.ProductVariantId; 209 if (!string.IsNullOrEmpty(isvarient)) 210 { 211 if (isvarient.IndexOf(".") > 0) 212 { 213 if (!string.IsNullOrEmpty(cartOrderLine.variantname) && cartOrderLine.variantname.IndexOf("-") > 0) 214 { 215 cartOrderLine.size = cartOrderLine.variantname.Substring(cartOrderLine.variantname.IndexOf("-") + 1).Trim(); 216 cartOrderLine.color = cartOrderLine.variantname.Substring(0, cartOrderLine.variantname.IndexOf("-")).Trim(); 217 } 218 } 219 else 220 { 221 string sizeIds = ""; string colorIds = ""; 222 223 foreach (Dynamicweb.Ecommerce.Variants.VariantGroup variantGroup in orderLine.Product.VariantGroups) 224 { 225 foreach (Dynamicweb.Ecommerce.Variants.VariantOption variantOptions in variantGroup.VariantOptions) 226 { 227 if (variantGroup.Id == "SIZE") 228 { 229 sizeIds = sizeIds + "," + variantOptions.Id; 230 } 231 if (variantGroup.Id == "COLOR") 232 { 233 colorIds = colorIds + "," + variantOptions.Id; 234 } 235 } 236 } 237 if (sizeIds.Contains(isvarient)) 238 { 239 cartOrderLine.size = cartOrderLine.variantname.Trim(); 240 } 241 if (colorIds.Contains(isvarient)) 242 { 243 cartOrderLine.color = cartOrderLine.variantname.Trim(); 244 } 245 } 246 } 247 248 249 if (!string.IsNullOrEmpty(clickCollect)) 250 { 251 int ccQuanityt = 0; 252 int delQuanityt = Convert.ToInt32(cartOrderLine.quantity); 253 foreach (var st in clickCollect.ToString().Split(',')) 254 { 255 if (st != null && st.Split(':').Count() > 1) 256 { 257 int stid = Convert.ToInt32(st.Split(':')[0]); 258 int qty = Convert.ToInt32(st.Split(':')[1]); 259 260 OrderLine newLine = copyObject(cartOrderLine); 261 262 ccQuanityt = ccQuanityt + qty; 263 newLine.quantity = qty.ToString(); 264 string totalprice = String.Format("{0:n}", (orderLine.Price.Price / orderLine.Quantity * qty)); 265 newLine.totalprice = dwOrder.Currency.Symbol + totalprice; 266 newLine.storeId = stid.ToString(); 267 newLine.earlyprice = dwOrder.Currency.Symbol + String.Format("{0:n}", qty * price.Price); 268 if (baseprice > 0 && price.Price < baseprice) 269 { 270 newLine.earlyprice = dwOrder.Currency.Symbol + String.Format("{0:n}", qty * baseprice); 271 } 272 var sava = SList.FirstOrDefault(x => x.storeId == stid); 273 if (sava == null) 274 { 275 RootStore storeObj = new RootStore(); 276 storeObj.storeId = stid; 277 storeObj.storeName = ""; 278 storeObj.StoreAddress = ""; 279 storeObj.OpenHours = ""; 280 storeObj.OrderLines = new List<OrderLine>(); 281 storeObj.OrderLines.Add(newLine); 282 SList.Add(storeObj); 283 } 284 else 285 { 286 sava.OrderLines.Add(newLine); 287 } 288 289 } 290 } 291 if (delQuanityt - ccQuanityt > 0) 292 { 293 OrderLine newLine = copyObject(cartOrderLine); 294 newLine.storeId = "0"; 295 newLine.quantity = (delQuanityt - ccQuanityt).ToString(); 296 297 string totalprice = String.Format("{0:n}", (orderLine.Price.Price / orderLine.Quantity * (delQuanityt - ccQuanityt))); 298 newLine.totalprice = dwOrder.Currency.Symbol + totalprice; 299 newLine.earlyprice = dwOrder.Currency.Symbol + String.Format("{0:n}", (delQuanityt - ccQuanityt) * price.Price); 300 if (baseprice > 0 && price.Price < baseprice) 301 { 302 newLine.earlyprice = dwOrder.Currency.Symbol + String.Format("{0:n}", (delQuanityt - ccQuanityt) * baseprice); 303 } 304 delivery.OrderLines.Add(newLine); 305 } 306 } 307 else 308 { 309 cartOrderLine.storeId = "0"; 310 delivery.OrderLines.Add(cartOrderLine); 311 } 312 313 314 315 } 316 317 SList.Add(delivery); 318 319 StockService stockService = new StockService(); 320 foreach (var st in SList) 321 { 322 if (st.OrderLines.Count > 0) 323 { 324 if (st.storeId != 0) 325 { 326 var stData = stockService.GetStoreData(st.storeId.ToString()); 327 st.StoreAddress = stData.Address; 328 st.storeName = stData.StoreName; 329 st.OpenHours = stData.OpenHours; 330 st.TotalItems = st.OrderLines.Sum(x => Convert.ToInt32(x.quantity)).ToString(); 331 } 332 RootStores.Add(st); 333 } 334 } 335 if (RootStores.Count > 0) 336 { 337 foreach (var store in RootStores) 338 { 339 foreach (var product in store.OrderLines) 340 { 341 GFOrderLines.Add(product); 342 } 343 } 344 } 345 } 346 <style> 347 table { 348 page-break-inside: auto; 349 } 350 351 tr { 352 page-break-inside: avoid; 353 page-break-after: auto; 354 } 355 356 </style> 357 <div id="receipt-page" class="main-container type-c" style="margin-top:0px;width: 95%;"> 358 <div class="receipt-page-top wrapper-1364"> 359 <div class="col-1"> 360 </div> 361 362 363 <div class="col-2-full"> 364 <h2 class="page-title">Thank You for your order</h2> 365 <p class="receipt-text">@orderReceiptSubText</p> 366 <div class="receipt-details"> 367 <div class="receipt-pdf-table"> 368 <table class="receipt-summary-table"> 369 <tr> 370 <td style="vertical-align: top;"> 371 <div> 372 <strong>Order No</strong> 373 <p>@dwOrder.Id</p> 374 </div> 375 </td> 376 <td style="padding: 0px 10px; vertical-align: top;"> 377 <div> 378 <strong>@Translate("Reference No")</strong> 379 <p>@dwOrder.IntegrationOrderId</p> 380 </div> 381 </td> 382 <td style="padding: 0px 10px;vertical-align: top;"> 383 <div> 384 <strong>Billing address</strong> 385 <p> 386 @{ 387 if (!string.IsNullOrWhiteSpace(dwOrder.CustomerAddress)) 388 { 389 <span>@dwOrder.CustomerAddress</span> 390 } 391 if (!string.IsNullOrWhiteSpace(dwOrder.CustomerAddress2)) 392 { 393 <span>, @dwOrder.CustomerAddress2</span> 394 } 395 if (!string.IsNullOrWhiteSpace(dwOrder.CustomerCountry)) 396 { 397 <span>, @dwOrder.CustomerCountry</span> 398 } 399 if (!string.IsNullOrWhiteSpace(dwOrder.CustomerZip)) 400 { 401 <span>, @dwOrder.CustomerZip</span> 402 } 403 } 404 </p> 405 </div> 406 </td> 407 <td style="padding: 0px 10px;vertical-align: top;"> 408 <div> 409 <strong>Shipping address</strong> 410 @if (isShipping) 411 { 412 <p> 413 @{ 414 if (!string.IsNullOrWhiteSpace(dwOrder.DeliveryAddress)) 415 { 416 <span>@dwOrder.DeliveryAddress</span> 417 } 418 if (!string.IsNullOrWhiteSpace(dwOrder.DeliveryAddress2)) 419 { 420 <span>, @dwOrder.DeliveryAddress2</span> 421 } 422 if (!string.IsNullOrWhiteSpace(dwOrder.DeliveryCountry)) 423 { 424 <span>, @dwOrder.DeliveryCountry</span> 425 } 426 if (!string.IsNullOrWhiteSpace(dwOrder.DeliveryZip)) 427 { 428 <span>, @dwOrder.DeliveryZip</span> 429 } 430 } 431 </p> 432 } 433 </div> 434 </td> 435 </tr> 436 </table> 437 </div> 438 <div class="receipt-table"> 439 <table style="width:100%;margin-top:10px;border-collapse: collapse;margin: 10px auto;border:1px solid #CBCBCB"> 440 @foreach (var store in RootStores) 441 { 442 <tr> 443 <td style="border-top:1px solid #CBCBCB;border-bottom:1px solid #CBCBCB;" colspan="3"> 444 <table> 445 <tr> 446 @if (store.storeName != "DELIVERY") 447 { 448 haveClickCollect = true; 449 } 450 <td style="padding:5px;border:none;"> 451 <span class="receipt-store-title">@store.storeName</span> 452 </td> 453 <td style="padding:5px;border:none;">@store.StoreAddress</td> 454 <td style="padding:5px;border:none;">@store.OpenHours</td> 455 </tr> 456 </table> 457 </td> 458 </tr> 459 foreach (var product in store.OrderLines) 460 { 461 <tr> 462 <td style="border-top:1px solid #CBCBCB;border-bottom:1px solid #CBCBCB;padding: 5px;text-align:left;"><img src="/Admin/Public/Getimage.ashx?width=70&compression=100&Crop=5&image=@product.image" style="width:70px;height:auto;"></td> 463 <td style="border-top:1px solid #CBCBCB;border-bottom:1px solid #CBCBCB;padding:5px;text-align:left;"> 464 <div style="font-size:12px;">@product.brand</div> 465 <div>@product.name</div> 466 <div>SKU : @product.productnumber</div> 467 @if (product.isPromo) 468 { 469 <div> 470 <div class="download-receipt-promo">PROMO</div> 471 <div>Original Price : @product.earlyprice</div> 472 </div> 473 } 474 475 @if (!string.IsNullOrEmpty(product.color)) 476 { 477 <div>Color : @product.color</div> 478 } 479 480 @if (!string.IsNullOrEmpty(product.size)) 481 { 482 <div>Size : @product.size</div> 483 } 484 </td> 485 <td style="border-top:1px solid #CBCBCB;border-bottom:1px solid #CBCBCB;padding:5px;vertical-align:middle;text-align:left;"> 486 <div>Total Price: @product.totalprice</div> 487 <div>Quantity: @product.quantity</div> 488 </td> 489 </tr> 490 } 491 } 492 </table> 493 </div> 494 @if (dwOrder.BoughtGiftCards.Count() > 0) 495 { 496 <div class="receipt-giftcard__div">@Translate("Giftcards bought on this order")</div> 497 <div class="receipt-giftcard-table"> 498 <table class="table u-no-margin"> 499 <tr> 500 <td>@Translate("Gift card name")</td> 501 <td>@Translate("Gift card code")</td> 502 <td>@Translate("Expiry date")</td> 503 <td class="u-ta-right">@Translate("Gift card amount")</td> 504 </tr> 505 506 @foreach (var giftcards in dwOrder.BoughtGiftCards) 507 { 508 <tr> 509 <td>@giftcards.Name</td> 510 <td>@giftcards.Code</td> 511 <td>@giftcards.ExpiryDate.ToString(Pageview.Area.Dateformat + " HH:mm")</td> 512 <td class="u-ta-right" title="@giftcards.InitialAmount">@dwOrder.Currency.Symbol@giftcards.InitialAmount.ToString("0.00")</td> 513 </tr> 514 } 515 </table> 516 </div> 517 } 518 519 <div> 520 <table class="receipt-summary-table"> 521 <tr> 522 <td> 523 <div class="notice"> 524 @{ 525 string giftagift = ""; 526 string giftmessage = ""; 527 string giftcard = ""; 528 string pointsRedeem = ""; 529 foreach (OrderFieldValue orderFieldValue in dwOrder.OrderFieldValues) 530 { 531 switch (orderFieldValue.OrderField.SystemName) 532 { 533 case "giftagift": 534 if (orderFieldValue.Value != null) 535 { 536 giftagift = orderFieldValue.Value.ToString(); 537 } 538 break; 539 case "giftmessage": 540 if (orderFieldValue.Value != null) 541 { 542 giftmessage = orderFieldValue.Value.ToString(); 543 } 544 break; 545 case "GiftCard": 546 if (orderFieldValue.Value != null) 547 { 548 giftcard = orderFieldValue.Value.ToString(); 549 } 550 break; 551 case "RedeemedPoints": 552 if (orderFieldValue.Value != null) 553 { 554 pointsRedeem = orderFieldValue.Value.ToString(); 555 } 556 break; 557 } 558 } 559 } 560 @if (giftagift.ToLower() == "true" && !string.IsNullOrEmpty(giftmessage)) 561 { 562 <div class="gift-a-gift-messageform--group"> 563 <div class="gift-a-gift-orderdetailPdf-message"><label for="gift-message"><strong>@Translate("Gift Message")</strong></label></div> 564 <div class="giftaGiftlayout"> 565 <strong><p>@giftmessage</p></strong> 566 </div> 567 </div> 568 } 569 <div class="note receipt-left-note"> 570 @orderReceiptAssistanceText 571 </div> 572 </div> 573 </td> 574 <td> 575 <div class="cost-wrap"> 576 <div class="sidebar-wrap"> 577 @{ 578 string subTotal = ""; 579 if ((dwOrder.TotalPrice - dwOrder.ShippingFee.Price) > 0) 580 { 581 subTotal = dwOrder.Currency.Symbol + String.Format("{0:n}", (dwOrder.TotalPrice - dwOrder.ShippingFee.Price)); 582 } 583 else 584 { 585 subTotal = "$0.00"; 586 } 587 string totalamount = dwOrder.Currency.Symbol + String.Format("{0:n}", (dwOrder.TotalPrice + extrapwp - dwOrder.ShippingFee.Price - dwOrder.TotalDiscount.Price)); 588 string totalDiscount = dwOrder.Currency.Symbol + String.Format("{0:n}", (dwOrder.Price.Price + extrapwp - dwOrder.ShippingFee.Price - dwOrder.TotalDiscount.Price) - (dwOrder.Price.Price - dwOrder.ShippingFee.Price)); 589 string totalPriceWithVat = dwOrder.TotalPriceFormatted; 590 } 591 <div class="sub-total-details"> 592 <table class="receipt-summary-downloadtable receipt-summary-table"> 593 <tr> 594 <td><div class="label strong">Total Amount</div></td> 595 <td><div class="cost strong">@totalamount</div></td> 596 </tr> 597 <tr class="summary-discount"> 598 <td> 599 <div class="label">Savings</div> 600 </td> 601 <td> 602 <div class="cost">@totalDiscount</div> 603 </td> 604 </tr> 605 </table> 606 </div> 607 <div class="sub-total-details"> 608 <table class="receipt-summary-downloadtable receipt-summary-table"> 609 <tr> 610 <td><div class="label">Subtotal</div></td> 611 <td><div class="cost">@subTotal</div></td> 612 </tr> 613 @{ 614 string voucherAmount = ""; 615 string voucher = dwOrder.VoucherCode; 616 string giftcardAmount = ""; 617 string pointsRedeemAmount = ""; 618 foreach (var orderLine in dwOrder.OrderLines.Where(x => (Convert.ToInt32(x.OrderLineType) == (int)OrderLineType.Discount) || (Convert.ToInt32(x.OrderLineType) == (int)OrderLineType.ProductDiscount)).ToList()) 619 { 620 if (orderLine.ProductName == dwOrder.VoucherCode) 621 { 622 voucherAmount = orderLine.Price.PriceFormatted.Replace("-", ""); 623 } 624 if (orderLine.ProductVariantText == "GIFT") 625 { 626 giftcardAmount = orderLine.Price.PriceFormatted.Replace("-", ""); 627 } 628 if (orderLine.ProductVariantText == "RedeemedPoints") 629 { 630 pointsRedeemAmount = orderLine.Price.PriceFormatted.Replace("-", ""); 631 } 632 } 633 if (string.IsNullOrEmpty(voucherAmount)) 634 { 635 voucher = ""; 636 } 637 if (string.IsNullOrEmpty(giftcardAmount)) 638 { 639 giftcard = ""; 640 } 641 if (string.IsNullOrEmpty(pointsRedeemAmount)) 642 { 643 pointsRedeem = ""; 644 } 645 } 646 @if (!String.IsNullOrEmpty(voucher)) 647 { 648 649 <tr class="summary-discount-code"> 650 <td> 651 <div class="label"><span>- </span>Code (@voucher)</div> 652 </td> 653 <td> 654 <div class="cost">@voucherAmount</div> 655 </td> 656 </tr> 657 } 658 @if (!String.IsNullOrEmpty(giftcard)) 659 { 660 661 <tr class="summary-discount-code"> 662 <td> 663 <div class="label"><span>- </span>Gift Card (@giftcard)</div> 664 </td> 665 <td> 666 <div class="cost">@giftcardAmount</div> 667 </td> 668 </tr> 669 } 670 @if (!String.IsNullOrEmpty(pointsRedeem)) 671 { 672 673 <tr class="summary-discount-code"> 674 <td> 675 <div class="label"><span>- </span>Redeemed Points BHG $</div> 676 </td> 677 <td> 678 <div class="cost">@pointsRedeemAmount</div> 679 </td> 680 </tr> 681 } 682 683 <tr class="summary-discount"> 684 @{ 685 double totaltax = dwOrder.TotalPriceWithoutTaxes.VAT + (dwOrder.TotalPrice - dwOrder.TotalPriceWithoutTaxes.Price) - dwOrder.ShippingFee.Price; 686 string TotalTaxformatted = dwOrder.Currency.Symbol + totaltax.ToString("0.00"); 687 } 688 <td> 689 <div class="promo-warning">GST</div> 690 </td> 691 <td class="receipt-subtotal__right"> 692 <div class="cost">@dwOrder.Price.VATFormatted</div> 693 </td> 694 695 </tr> 696 </table> 697 </div> 698 699 <div class="sub-total"> 700 <table class="receipt-summary-downloadtable receipt-summary-table"> 701 <tr class="sub-total-item"> 702 <td> 703 <h4>Subtotal</h4> 704 </td> 705 <td class="receipt-subtotal__right"> 706 <h4 class="cost">@subTotal</h4> 707 </td> 708 </tr> 709 <tr> 710 <td> 711 <div class="promo-warning">Delivery Charge</div> 712 </td> 713 <td class="receipt-subtotal__right"> 714 <div class="cost">@dwOrder.ShippingFee.PriceFormatted</div> 715 </td> 716 </tr> 717 </table> 718 </div> 719 <div class="total"> 720 <table class="receipt-summary-downloadtable receipt-summary-table"> 721 <tr class="total-item"> 722 <td> 723 @if (totalquantity == 1) 724 { 725 <h4>Order Total <span>(@totalquantity Item)</span></h4> 726 } 727 else 728 { 729 <h4>Order Total <span>(@totalquantity Items)</span></h4> 730 } 731 </td> 732 <td class="receipt-subtotal__right"> 733 <h4 class="cost">@totalPriceWithVat</h4> 734 </td> 735 </tr> 736 </table> 737 </div> 738 </div> 739 </div> 740 </td> 741 </tr> 742 </table> 743 </div> 744 </div> 745 <div style="padding: 20px; font-size: 14px; text-align: left;"> 746 @if (haveClickCollect) 747 { 748 <div>@ClickCollectStockText</div> 749 } 750 </div> 751 </div> 752 </div> 753 </div> 754 755
