public static Commons.Entities.General Get(string month) { var res = new Commons.Entities.General(); res.initial_balance = GetInitialBalance(); res.expenses_month = Expenses.SumExpensesByMonth(month); res.payment_pending = ClientsPayments.SumAllPendingPayments(); res.utilities_month = ClientsPayments.SumUtilitiesByMonth(month); return(res); }
public static ResponseItem <List <DayCollection> > Get() { var res = new ResponseItem <List <DayCollection> >(); res.data = new List <DayCollection>(); var id_clients = ClientsPayments.GetClientsWithOutPayments(); var clients_payment_today = GetClientsTochargeToday(id_clients.data.Keys.ToList()); foreach (var item in clients_payment_today.data) { var payment_days = 1; if (item.payment_type == 2) { payment_days = 7; } else if (item.payment_type == 3) { payment_days = 14; } else if (item.payment_type == 4) { payment_days = 30; } var day_collection = new DayCollection(); day_collection.id_client = item.id_client; day_collection.name_client = item.name; day_collection.phone_client = item.phone; day_collection.payments = id_clients.data.Where(x => x.Key == item.id_client).FirstOrDefault().Value.ToString(); day_collection.payments_scheduled = Math.Round((decimal)item.time_limit / (decimal)payment_days).ToString(); var interest_rate = item.loan * (item.interest_rate / 100); day_collection.payments_value = (item.loan / (item.time_limit / payment_days)).ToString(); res.data.Add(day_collection); } res.data.RemoveAll(x => x.payments == x.payments_scheduled); return(res); }