private string CreateTotalsSummaryEmail(int ShowID, int UserID, ref Decimal totals) { var classes = new ShowClasses(); var totalsList = classes.getShowTotalsForUser(ShowID, UserID); var transSummary = new TransactionSummary(ShowID, UserID); var totalsBox = "<table>"; totalsBox += "<tr >"; foreach (var total in totalsList) { const string tmp = "<span class='infoSpacer'></span>"; totalsBox += "<tr class='clsTypeRow group' entryType='" + total.EntryType + "' >"; totalsBox += "<td class='clsTypeName themeBorder-r themeContentHilite' chargename='" + total.ChargeName + "'>" + tmp + total.ChargeName + "</td>"; totalsBox += "<td class='clsTypeRate themeBorder-r'>" + total.ChargeRate.ToString("0.00") + "</td>"; totalsBox += "<td class='clsTypeEntry themeBorder-r'>" + total.Count + "</td>"; totalsBox += "<td class='clsTypeSubTotal'>" + total.Total.ToString("0.00") + "</td>"; totalsBox += "</tr>"; totals += total.Total; } if (transSummary.ID != -1) { totalsBox += "<tr class='clsTypeRow group prepaid'>"; totalsBox += "<td class='clsTypePaymentInfo themeBorder-t themeContentHilite'>Payment Received</td>"; totalsBox += "<td class='clsTypeTotal themeBorder-t themeBorder-l'>" + transSummary.Total.ToString("0.00") + "</td>"; totalsBox += "</tr >"; totals -= transSummary.Total; } totalsBox += "<tr class='clsTypeRow group fulltotal'>"; if (totals > 0) { totalsBox += "<td class='clsTypePaymentInfo themeBorder-t themeContentHilite'>Payment Due</td>"; } else if (totals < 0) { totalsBox += "<td class='clsTypePaymentInfo themeBorder-t themeContentHilite'>Payment Due</td>"; } else { totalsBox += "<td class='clsTypePaymentInfo themeBorder-t themeContentHilite'>No Payment Due</td>"; } totalsBox += "<td class='clsTypeTotal themeBorder-t themeBorder-l'>" + totals.ToString("0.00") + "</td>"; totalsBox += "</tr >"; totalsBox += "</table>"; return totalsBox; }
public PaymentSummary CreateTotalsSummary(int ShowID, int UserID, ref Decimal totals) { ShowClasses classes = new ShowClasses(); List<ShowClasses.Totals> totalsList = classes.getShowTotalsForUser(ShowID, UserID); PaymentSummary paymentSummary = new PaymentSummary(); decimal standardClassAmount = 0; foreach (ShowClasses.Totals total in totalsList) { if (total.ChargeType == 1) { standardClassAmount = total.ChargeRate; } paymentSummary.add(new ChargableItem(total.ChargeName, total.ChargeRate, total.Count, ChargableTypes.STANDARD, total.ChargeType)); } UserShows us = new UserShows(UserID, ShowID); // // check if alt handlers are judging // if (us.HandlerType == 0) { List<AltHandler> altHList = AltHandler.GetAllAltHandlersList(us.Userid); foreach (AltHandler alt in altHList) { if (Judge.isJudgeAtShow(alt.AltHandlerID, ShowID)) { us.HandlerType = 2; } } } Decimal val = 0; List<ShowDiscounts> list = ShowDiscounts.getDiscountsByType(ShowID, us.HandlerType); foreach (ShowDiscounts sd in list) { String tmp = ""; if (sd.DiscountType == (int)DiscountTypes.Fixed) { val = sd.Amount; tmp = sd.DiscountName + " " + sd.SubTypeName; } else if (sd.DiscountType == (int)DiscountTypes.Member) { tmp = sd.DiscountName + " discount " + sd.SubTypeName; tmp = tmp.Replace("'n'", sd.Amount.ToString()); val = -(sd.Amount * standardClassAmount); } paymentSummary.add(tmp, val, 1, ChargableTypes.DISCOUNT); totals += val; } if (us.ID > -1) { Camping showCamping = new Camping(us.ShowID); UserCamping userCamping = new UserCamping(us.ID); int Nights = 0; if (userCamping.ID > -1) { //ShowCharges chg = new ShowCharges(us.ShowID, 6); // Get Camping Charge for This Show Nights = userCamping.PitchDetails[0].CampingDays.Split(',').Length; } paymentSummary.add("Camping", showCamping.Costpernight, Nights, ChargableTypes.CAMPING); } if (totals > 0) { paymentSummary.add("Outstanding Payments", totals, 0, ChargableTypes.TRANSACTION); } else if (totals < 0) { paymentSummary.add("Over Payments", totals, 0, ChargableTypes.TRANSACTION); } return paymentSummary; }