Exemple #1
0
        public ActionResult _FilterPost(JobOrderAmendmentFilterViewModel vm)
        {
            List <JobOrderRateAmendmentLineViewModel> temp = _JobOrderRateAmendmentLineService.GetJobOrderLineForMultiSelect(vm).ToList();
            JobOrderAmendmentMasterDetailModel        svm  = new JobOrderAmendmentMasterDetailModel();

            svm.JobOrderRateAmendmentLineViewModel = temp;
            return(PartialView("_Results", svm));
        }
Exemple #2
0
        public ActionResult _ForOrder(int id, int?sid)
        {
            JobOrderAmendmentFilterViewModel vm = new JobOrderAmendmentFilterViewModel();

            vm.JobOrderAmendmentHeaderId = id;
            vm.JobWorkerId = sid;
            JobOrderAmendmentHeader Header = new JobOrderAmendmentHeaderService(_unitOfWork).Find(id);

            vm.DocumentTypeSettings = new DocumentTypeSettingsService(_unitOfWork).GetDocumentTypeSettingsForDocument(Header.DocTypeId);
            return(PartialView("_Filters", vm));
        }
        public IEnumerable <JobOrderRateAmendmentLineViewModel> GetJobOrderLineForMultiSelect(JobOrderAmendmentFilterViewModel svm)
        {
            string[] ProductIdArr = null;
            if (!string.IsNullOrEmpty(svm.ProductId))
            {
                ProductIdArr = svm.ProductId.Split(",".ToCharArray());
            }
            else
            {
                ProductIdArr = new string[] { "NA" };
            }

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

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

            string[] Dim1Id = null;
            if (!string.IsNullOrEmpty(svm.Dimension1Id))
            {
                Dim1Id = svm.Dimension1Id.Split(",".ToCharArray());
            }
            else
            {
                Dim1Id = new string[] { "NA" };
            }

            string[] Dim2Id = null;
            if (!string.IsNullOrEmpty(svm.Dimension2Id))
            {
                Dim2Id = svm.Dimension2Id.Split(",".ToCharArray());
            }
            else
            {
                Dim2Id = new string[] { "NA" };
            }

            string[] Dim3Id = null;
            if (!string.IsNullOrEmpty(svm.Dimension3Id))
            {
                Dim3Id = svm.Dimension3Id.Split(",".ToCharArray());
            }
            else
            {
                Dim3Id = new string[] { "NA" };
            }

            string[] Dim4Id = null;
            if (!string.IsNullOrEmpty(svm.Dimension4Id))
            {
                Dim4Id = svm.Dimension4Id.Split(",".ToCharArray());
            }
            else
            {
                Dim4Id = new string[] { "NA" };
            }

            var temp = (from p in db.ViewJobOrderBalanceForInvoice
                        join t3 in db.JobOrderLine on p.JobOrderLineId equals t3.JobOrderLineId into table3
                        from tab3 in table3.DefaultIfEmpty()
                        join t2 in db.JobOrderHeader on p.JobOrderHeaderId equals t2.JobOrderHeaderId
                        join product in db.Product on p.ProductId equals product.ProductId into table2
                        from tab2 in table2.DefaultIfEmpty()
                        join AL in db.JobOrderRateAmendmentLine on p.JobOrderLineId equals AL.JobOrderLineId into ALTable
                        from AlTab in ALTable.DefaultIfEmpty()
                        where (string.IsNullOrEmpty(svm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                        (string.IsNullOrEmpty(svm.JobOrderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.JobOrderHeaderId.ToString())) &&
                        (string.IsNullOrEmpty(svm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                        (string.IsNullOrEmpty(svm.Dimension1Id) ? 1 == 1 : Dim1Id.Contains(p.Dimension1Id.ToString())) &&
                        (string.IsNullOrEmpty(svm.Dimension2Id) ? 1 == 1 : Dim2Id.Contains(p.Dimension2Id.ToString())) &&
                        (string.IsNullOrEmpty(svm.Dimension3Id) ? 1 == 1 : Dim3Id.Contains(p.Dimension3Id.ToString())) &&
                        (string.IsNullOrEmpty(svm.Dimension4Id) ? 1 == 1 : Dim4Id.Contains(p.Dimension4Id.ToString())) &&
                        p.BalanceQty > 0 && ((svm.JobWorkerId.HasValue && svm.JobWorkerId.Value > 0) ? p.JobWorkerId == svm.JobWorkerId : 1 == 1) &&
                        (svm.UpToDate.HasValue ? t2.DocDate <= svm.UpToDate : 1 == 1)
                        orderby t2.DocDate, t2.DocNo, tab3.Sr
                        select new JobOrderRateAmendmentLineViewModel
            {
                Dimension1Name = tab3.Dimension1.Dimension1Name,
                Dimension2Name = tab3.Dimension2.Dimension2Name,
                Dimension3Name = tab3.Dimension3.Dimension3Name,
                Dimension4Name = tab3.Dimension4.Dimension4Name,
                UnitName = tab2.Unit.UnitName,
                DealUnitName = tab3.DealUnit.UnitName,
                DealQty = p.BalanceQty * tab3.UnitConversionMultiplier,
                UnitConversionMultiplier = tab3.UnitConversionMultiplier,
                JobOrderRate = p.Rate,
                AmendedRate = (svm.Rate == 0 ? p.Rate : svm.Rate),
                Qty = p.BalanceQty,
                JobOrderDocNo = p.JobOrderNo,
                ProductName = tab2.ProductName,
                ProductId = p.ProductId,
                JobOrderAmendmentHeaderId = svm.JobOrderAmendmentHeaderId,
                JobOrderLineId = p.JobOrderLineId,
                unitDecimalPlaces = tab2.Unit.DecimalPlaces,
                DealunitDecimalPlaces = tab3.DealUnit.DecimalPlaces,
                JobWorkerId = p.JobWorkerId,
                AAmended = (AlTab == null ? false : true)
            }
                        );

            return(temp);
        }