public static List <Nj_Detail> PrintClients(string Search = "", string id = "", string sDate = "", string eDate = "") { Nj_Detail obj = new Nj_Detail(); var nj = obj.ClientList(Search, id, sDate, eDate); return(nj); }
public static List <Nj_Detail> UserDetailsbyEmployeeAdded(string Search = "", string id = "", int PageIndex = 0, string sDate = "", string eDate = "") { Nj_Detail obj = new Nj_Detail(); var nj = obj.ClientList(Search, id, sDate, eDate); int PageSize = 15; int skip = PageIndex * PageSize; double PageCount = Convert.ToDouble(Math.Ceiling((double)((double)nj.Count() / (double)PageSize))); List <Nj_Detail> query = nj.Skip(skip).Take(PageSize).ToList(); return(query); }
public static List <Nj_Detail> DropdownList(string Search = "", string id = "", string sDate = "", string eDate = "") { Nj_Detail obj = new Nj_Detail(); var nj = obj.ClientList(Search, id, sDate, eDate); // List<Nj_Detail> distinct = nj.GroupBy(n => n.IsAddedBy).Select(g => g.First()).ToList(); List <Nj_Detail> result = nj.GroupBy(l => l.IsAddedBy).Select(cl => new Nj_Detail { IsAddedBy = cl.First().IsAddedBy, IsaddedbyFirstName = cl.First().IsaddedbyFirstName, Payment_Balance = cl.Sum(c => c.Payment_Balance), Payment_Paid = cl.Sum(c => c.Payment_Paid), Payment_Total = cl.Sum(c => c.Payment_Total), }).ToList(); return(result); }
public static string ClientTodayReport(string Search = "") { Nj_Detail obj = new Nj_Detail(); var nj = obj.ClientList(Search); DataSet p_dsSrc = new DataSet(); DataTable dt = new DataTable("MyTable"); //dt.Columns.Add(new DataColumn("id", typeof(int))); dt.Columns.Add(new DataColumn("FirstName", typeof(string))); dt.Columns.Add(new DataColumn("LastName", typeof(string))); //dt.Columns.Add(new DataColumn("State", typeof(string))); dt.Columns.Add(new DataColumn("City", typeof(string))); dt.Columns.Add(new DataColumn("TotalPayment", typeof(float))); dt.Columns.Add(new DataColumn("Paid", typeof(float))); dt.Columns.Add(new DataColumn("Balance", typeof(float))); dt.Columns.Add(new DataColumn("AddedBy", typeof(string))); //dt.Columns.Add(new DataColumn("Source of communication", typeof(string))); DataRow dr = dt.NewRow(); double PaymentTotal = 0; double PaymentPaid = 0; double PaymentBalance = 0; foreach (var item in nj) { dr = dt.NewRow(); dr["FirstName"] = item.F_Name; dr["LastName"] = item.L_Name; //dr["State"] = item.ST; dr["City"] = item.Muncipality; dr["AddedBy"] = item.IsaddedbyFirstName; //dr["Source of communication"] = item.SourceComm; if (item.Payment_Total != null) { dr["TotalPayment"] = item.Payment_Total; PaymentTotal = PaymentTotal + Convert.ToDouble(item.Payment_Total); } else { dr["TotalPayment"] = 0; } if (item.Payment_Paid != null) { PaymentPaid = PaymentPaid + Convert.ToDouble(item.Payment_Paid); dr["Paid"] = item.Payment_Paid; } else { dr["Paid"] = 0; } if (item.Payment_Balance != null) { PaymentBalance = PaymentBalance + Convert.ToDouble(item.Payment_Balance); dr["Balance"] = item.Payment_Balance; } else { dr["Balance"] = 0; } dt.Rows.Add(dr); } for (int i = 0; i <= 4; i++) { if (i < 4) { dt.Rows.Add(); } else { dr = dt.NewRow(); dr["City"] = "Total"; dr["TotalPayment"] = PaymentTotal; dr["Paid"] = PaymentPaid; dr["Balance"] = PaymentBalance; dt.Rows.Add(dr); } } p_dsSrc.Tables.Add(dt); Clients objClients = new Clients(); int GetTotalRow = nj.Count(); GetTotalRow = GetTotalRow + 6; string Filepath = objClients.GenrateEcelTodayReport(p_dsSrc, GetTotalRow); string Result = objClients.SendClientsEmail(Filepath); return(Result); }