Exemple #1
0
        public ActionResult _FilterPost(PurchaseOrderCancelFilterViewModel vm)
        {
            List <PurchaseOrderCancelLineViewModel> temp = _PurchaseOrderCancelLineService.GetPurchaseOrderLineForMultiSelect(vm).ToList();
            PurchaseOrderCancelMasterDetailModel    svm  = new PurchaseOrderCancelMasterDetailModel();

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

            vm.PurchaseOrderCancelHeaderId = id;
            vm.SupplierId = sid;
            return(PartialView("_Filters", vm));
        }
Exemple #3
0
        public IEnumerable <PurchaseOrderCancelLineViewModel> GetPurchaseOrderLineForMultiSelect(PurchaseOrderCancelFilterViewModel 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.PurchaseOrderId))
            {
                SaleOrderIdArr = svm.PurchaseOrderId.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" };
            }

            var temp = (from p in db.ViewPurchaseOrderBalance
                        join product in db.Product on p.ProductId equals product.ProductId into table2
                        from tab2 in table2.DefaultIfEmpty()
                        join t in db.PurchaseOrderLine on p.PurchaseOrderLineId equals t.PurchaseOrderLineId into table1 from tab1 in table1.DefaultIfEmpty()
                        join t2 in db.PurchaseOrderHeader on tab1.PurchaseOrderHeaderId equals t2.PurchaseOrderHeaderId
                        where (string.IsNullOrEmpty(svm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                        (svm.SupplierId == 0 ? 1 == 1 : p.SupplierId == svm.SupplierId) &&
                        (string.IsNullOrEmpty(svm.PurchaseOrderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.PurchaseOrderHeaderId.ToString())) &&
                        (string.IsNullOrEmpty(svm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                        p.BalanceQty > 0 && p.SupplierId == svm.SupplierId
                        orderby t2.DocDate, t2.DocNo, tab1.Sr
                        select new PurchaseOrderCancelLineViewModel
            {
                BalanceQty = p.BalanceQty,
                Qty = 0,
                PurchaseOrderDocNo = p.PurchaseOrderNo,
                ProductName = tab2.ProductName,
                ProductId = p.ProductId,
                PurchaseOrderCancelHeaderId = svm.PurchaseOrderCancelHeaderId,
                PurchaseOrderLineId = p.PurchaseOrderLineId,
                unitDecimalPlaces = tab2.Unit.DecimalPlaces,
                DealunitDecimalPlaces = tab1.DealUnit.DecimalPlaces,
            }
                        );

            return(temp);
        }