示例#1
0
        public ActionResult Accounting()
        {
            var model           = new DashboardViewModel();
            var foundryInvoices = _foundryInvoiceRepository.GetFoundryInvoices().Where(x => x.ScheduledPaymentDate.HasValue == false && x.ActualPaymentDate.HasValue == false).ToList();

            if (foundryInvoices != null && foundryInvoices.Count > 0)
            {
                model.NeedScheduledFoundryInvoices = new List <FoundryInvoiceViewModel>();
                foreach (var invoice in foundryInvoices)
                {
                    var convertedInvoice = new FoundryInvoiceConverter().ConvertToView(invoice);
                    model.NeedScheduledFoundryInvoices.Add(convertedInvoice);
                }
            }
            return(View(model));
        }
示例#2
0
        public JsonResult SearchFoundryInvoices(FoundryInvoiceViewModel model)
        {
            var foundryInvoices = new List <FoundryInvoiceViewModel>();

            var tempInvoices = _foundryInvoiceRepository.GetFoundryInvoices();

            if (tempInvoices != null && tempInvoices.Count > 0)
            {
                foreach (var tempInvoice in tempInvoices)
                {
                    FoundryInvoiceViewModel convertedModel = new FoundryInvoiceConverter().ConvertToView(tempInvoice);
                    foundryInvoices.Add(convertedModel);
                }
            }

            if (model.InvoiceNumber != null && model.InvoiceNumber != string.Empty)
            {
                foundryInvoices = foundryInvoices.Where(x => x.InvoiceNumber.ToLower() == model.InvoiceNumber.ToLower()).ToList();
            }

            if (model.FoundryId != null && model.FoundryId != string.Empty && model.FoundryId != "--Select Foundry--")
            {
                foundryInvoices = foundryInvoices.Where(x => x.FoundryId.Replace(" ", string.Empty).ToLower() == model.FoundryId.Replace(" ", string.Empty).ToLower()).ToList();
            }

            if (model.Unscheduled)
            {
                foundryInvoices = foundryInvoices.Where(x => x.ScheduledPaymentDate == null).ToList();
            }
            else
            {
                if (model.FromDate != null && model.ToDate != null)
                {
                    var fromDate = model.FromDate;
                    var toDate   = model.ToDate.AddDays(1);

                    foundryInvoices = foundryInvoices.Where(x => x.ScheduledPaymentDate >= fromDate && x.ScheduledPaymentDate <= toDate).ToList();
                }
            }

            model.FoundryInvoices = foundryInvoices.OrderBy(x => x.InvoiceNumber).ToList();

            return(Json(model, JsonRequestBehavior.AllowGet));
        }