public ActionResult OutstandingSummary(OutstandingSummaryViewModel data) { CustomerInvoiceSummaryViewModel CustomerInvoiceSummary = Mapper.Map <CustomerInvoiceSummary, CustomerInvoiceSummaryViewModel>(_customerInvoiceBusiness.GetCustomerInvoicesSummaryForSA()); SupplierInvoiceSummaryViewModel SupplierInvoiceSummary = Mapper.Map <SupplierInvoiceSummary, SupplierInvoiceSummaryViewModel>(_supplierInvoicesBusiness.GetSupplierInvoicesSummary(data.IsInternal)); data.OutstandingInv = CustomerInvoiceSummary.OpenAmount + CustomerInvoiceSummary.OverdueAmount; data.OuttandingPay = SupplierInvoiceSummary.OpenAmount + SupplierInvoiceSummary.OverdueAmount; data.OutstandingInvFormatted = _commonBusiness.ConvertCurrency(data.OutstandingInv, 2); data.OuttandingPayFormatted = _commonBusiness.ConvertCurrency(data.OuttandingPay, 2); data.invCount = CustomerInvoiceSummary.OpenInvoices + CustomerInvoiceSummary.OverdueInvoices; data.payCount = SupplierInvoiceSummary.OpenInvoices + SupplierInvoiceSummary.OverdueInvoices; return(PartialView("_OutstandingSummary", data)); }
public string GetInvoicesAndSummary(string filter, string FromDate, string ToDate, string Supplier, string InvoiceType, string Company, string Status, string Search, string AccountCode, string EmpID) { try { AppUA appUA = Session["AppUA"] as AppUA; SupplierInvoiceBundleViewModel Result = new SupplierInvoiceBundleViewModel(); DateTime?FDate = string.IsNullOrEmpty(FromDate) ? (DateTime?)null : DateTime.Parse(FromDate); DateTime?TDate = string.IsNullOrEmpty(ToDate) ? (DateTime?)null : DateTime.Parse(ToDate); Result.SupplierInvoiceSummary = Mapper.Map <SupplierInvoiceSummary, SupplierInvoiceSummaryViewModel>(_supplierInvoicesBusiness.GetSupplierInvoicesSummary(true)); Result.SupplierInvoices = Mapper.Map <List <SupplierInvoices>, List <SupplierInvoicesViewModel> >(_supplierInvoicesBusiness.GetAllSupplierInvoices(FDate, TDate, Supplier, InvoiceType, Company, Status, Search, AccountCode, EmpID)); if (filter != null && filter == "OD") { Result.SupplierInvoices = Result.SupplierInvoices.Where(m => m.PaymentDueDate < common.GetCurrentDateTime() && m.BalanceDue > 0).ToList(); } else if (filter != null && filter == "OI") { Result.SupplierInvoices = Result.SupplierInvoices.Where(m => m.PaymentDueDate >= common.GetCurrentDateTime() && m.BalanceDue > 0).ToList(); } else if (filter != null && filter == "FP") { Result.SupplierInvoices = Result.SupplierInvoices.Where(m => m.BalanceDue <= 0).ToList(); } return(JsonConvert.SerializeObject(new { Result = "OK", Records = Result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }