public static string GetBalance(this Guest guest) { //var totalRooms = guest.GuestRooms.Summation(); //var accountTotal = decimal.Zero; //foreach (var rm in guest.GuestRooms.Where(x => x.GuestRoomAccounts.Sum(y => y.Amount) > 0)) //{ // accountTotal += rm.GuestRoomAccounts.Where(x => (x.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL) // || (x.PaymentTypeId == (int)RoomPaymentTypeEnum.CashDeposit // || x.PaymentTypeId == (int)RoomPaymentTypeEnum.InitialDeposit // || x.PaymentTypeId == (int)RoomPaymentTypeEnum.ReservationDeposit // || x.PaymentTypeId == (int)RoomPaymentTypeEnum.HalfDay)).Summation(); //} //var total = accountTotal - totalRooms; var total = guest.GetGuestBalanceWithFullTax(); if (total < 0) { return(guest.FullName + " has to pay a balance of NGN " + decimal.Negate(total).ToString(CultureInfo.InvariantCulture)); } else { if (total == 0) { return("Check out " + guest.FullName); } return("Refund NGN " + total.ToString(CultureInfo.InvariantCulture) + " and Check out " + guest.FullName); } }
public static string GetGuestBalanceWithTaxColour(this Guest guest) { var balance = guest.GetGuestBalanceWithFullTax(); if (balance < 0) { return("#ff0000"); } else if (balance == 0) { return("#7aa37a"); } else { return("#99f893"); } }
public static decimal GetGuestBalance(this Guest guest) { return(guest.GetGuestBalanceWithFullTax()); }