Exemplo n.º 1
0
        public ActionResult _FilterPost(PurchaseIndentLineFilterViewModel vm)
        {
            List <PurchaseIndentLineViewModel> temp = _PurchaseIndentLineService.GetPurchaseIndentForFilters(vm).ToList();

            PurchaseIndentMasterDetailModel svm = new PurchaseIndentMasterDetailModel();

            svm.PurchaseIndentLineViewModel = temp;
            return(PartialView("_Results", svm));
        }
Exemplo n.º 2
0
        public ActionResult _ForMaterialPlan(int id)
        {
            PurchaseIndentLineFilterViewModel vm = new PurchaseIndentLineFilterViewModel();

            vm.PurchaseIndentHeaderId = id;
            PurchaseIndentHeader Header = new PurchaseIndentHeaderService(_unitOfWork).Find(id);

            vm.DocumentTypeSettings = new DocumentTypeSettingsService(_unitOfWork).GetDocumentTypeSettingsForDocument(Header.DocTypeId);
            return(PartialView("_Filters", vm));
        }
Exemplo n.º 3
0
        public IEnumerable <PurchaseIndentLineViewModel> GetPurchaseIndentForFilters(PurchaseIndentLineFilterViewModel vm)
        {
            string[] ProductIdArr = null;
            if (!string.IsNullOrEmpty(vm.ProductId))
            {
                ProductIdArr = vm.ProductId.Split(",".ToCharArray());
            }
            else
            {
                ProductIdArr = new string[] { "NA" };
            }

            string[] SaleOrderIdArr = null;
            if (!string.IsNullOrEmpty(vm.MaterialPlanHeaderId))
            {
                SaleOrderIdArr = vm.MaterialPlanHeaderId.Split(",".ToCharArray());
            }
            else
            {
                SaleOrderIdArr = new string[] { "NA" };
            }

            string[] ProductGroupIdArr = null;
            if (!string.IsNullOrEmpty(vm.ProductGroupId))
            {
                ProductGroupIdArr = vm.ProductGroupId.Split(",".ToCharArray());
            }
            else
            {
                ProductGroupIdArr = new string[] { "NA" };
            }

            var temp = (from p in db.ViewMaterialPlanBalance
                        join t in db.MaterialPlanHeader on p.MaterialPlanHeaderId equals t.MaterialPlanHeaderId into table
                        from tab in table.DefaultIfEmpty()
                        join product in db.Product on p.ProductId equals product.ProductId into table2
                        join t1 in db.MaterialPlanLine on p.MaterialPlanLineId equals t1.MaterialPlanLineId into table1
                        from tab1 in table1.DefaultIfEmpty()
                        from tab2 in table2.DefaultIfEmpty()
                        where (string.IsNullOrEmpty(vm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                        (string.IsNullOrEmpty(vm.MaterialPlanHeaderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.MaterialPlanHeaderId.ToString())) &&
                        (string.IsNullOrEmpty(vm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                        p.BalanceQty > 0
                        orderby tab.DocDate, tab.DocNo, tab1.Sr
                        select new PurchaseIndentLineViewModel
            {
                Dimension1Name = tab1.Dimension1.Dimension1Name,
                Dimension2Name = tab1.Dimension2.Dimension2Name,
                Specification = tab1.Specification,
                Dimension1Id = tab1.Dimension1Id,
                Dimension2Id = tab1.Dimension2Id,
                PlanBalanceQty = p.BalanceQty,
                Qty = p.BalanceQty,
                MaterialPlanHeaderDocNo = tab.DocNo,
                ProductName = tab2.ProductName,
                ProductId = p.ProductId,
                PurchaseIndentHeaderId = vm.PurchaseIndentHeaderId,
                MaterialPlanLineId = p.MaterialPlanLineId,
                UnitId = tab2.UnitId,
                unitDecimalPlaces = tab2.Unit.DecimalPlaces,
            }

                        );

            return(temp);
        }