コード例 #1
0
        public IEnumerable <ComboBoxResult> GetJobInvoiceHelpListForProduct(int Id, string term)
        {
            var JobInvoiceHeader = new JobInvoiceReturnHeaderService(db).Find(Id);

            var settings = db.JobInvoiceSettings
                           .Where(m => m.DocTypeId == JobInvoiceHeader.DocTypeId && m.DivisionId == JobInvoiceHeader.DivisionId && m.SiteId == JobInvoiceHeader.SiteId).FirstOrDefault();


            string[] contraSites = null;
            if (!string.IsNullOrEmpty(settings.filterContraSites))
            {
                contraSites = settings.filterContraSites.Split(",".ToCharArray());
            }
            else
            {
                contraSites = new string[] { "NA" };
            }

            string[] contraDivisions = null;
            if (!string.IsNullOrEmpty(settings.filterContraDivisions))
            {
                contraDivisions = settings.filterContraDivisions.Split(",".ToCharArray());
            }
            else
            {
                contraDivisions = new string[] { "NA" };
            }

            int CurrentSiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];


            return(from VB in db.ViewJobInvoiceBalance
                   join L in db.JobInvoiceLine on VB.JobInvoiceLineId equals L.JobInvoiceLineId into JobInvoiceLineTable
                   from JobInvoiceLineTab in JobInvoiceLineTable.DefaultIfEmpty()
                   where JobInvoiceLineTab.JobInvoiceHeader.JobWorkerId == JobInvoiceHeader.JobWorkerId &&
                   (string.IsNullOrEmpty(settings.filterContraSites) ? VB.SiteId == CurrentSiteId : contraSites.Contains(VB.SiteId.ToString())) &&
                   (string.IsNullOrEmpty(settings.filterContraDivisions) ? VB.DivisionId == CurrentDivisionId : contraDivisions.Contains(VB.DivisionId.ToString())) &&
                   (string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobInvoiceHeader.DocNo.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobInvoiceHeader.DocType.DocumentTypeShortName.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.ProductUid.ProductUidName.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.Product.ProductName.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.Dimension1.Dimension1Name.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.Dimension2.Dimension2Name.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.Dimension3.Dimension3Name.ToLower().Contains(term.ToLower()) ||
                    string.IsNullOrEmpty(term) ? 1 == 1 : JobInvoiceLineTab.JobReceiveLine.Dimension4.Dimension4Name.ToLower().Contains(term.ToLower())
                   )
                   select new ComboBoxResult
            {
                id = VB.JobInvoiceLineId.ToString(),
                text = JobInvoiceLineTab.JobReceiveLine.ProductUid != null ? (JobInvoiceLineTab.JobReceiveLine.ProductUid.ProductUidName + " : " + JobInvoiceLineTab.JobReceiveLine.Product.ProductName) : JobInvoiceLineTab.JobReceiveLine.Product.ProductName,
                TextProp1 = "Balance :" + VB.BalanceQty,
                TextProp2 = "Date :" + JobInvoiceLineTab.JobInvoiceHeader.DocDate,
                AProp1 = JobInvoiceLineTab.JobInvoiceHeader.DocType.DocumentTypeShortName + "-" + JobInvoiceLineTab.JobInvoiceHeader.DocNo,
                AProp2 = ((JobInvoiceLineTab.JobReceiveLine.Dimension1.Dimension1Name == null) ? "" : JobInvoiceLineTab.JobReceiveLine.Dimension1.Dimension1Name) +
                         ((JobInvoiceLineTab.JobReceiveLine.Dimension2.Dimension2Name == null) ? "" : "," + JobInvoiceLineTab.JobReceiveLine.Dimension2.Dimension2Name) +
                         ((JobInvoiceLineTab.JobReceiveLine.Dimension3.Dimension3Name == null) ? "" : "," + JobInvoiceLineTab.JobReceiveLine.Dimension3.Dimension3Name) +
                         ((JobInvoiceLineTab.JobReceiveLine.Dimension4.Dimension4Name == null) ? "" : "," + JobInvoiceLineTab.JobReceiveLine.Dimension4.Dimension4Name)
            });
        }
コード例 #2
0
        public object GetProductUidDetail(string ProductUidName, int filter)
        {
            var Header = new JobInvoiceReturnHeaderService(db).Find(filter);

            var temp = (from i in db.JobInvoiceLine
                        join L in db.JobReceiveLine on i.JobReceiveLineId equals L.JobReceiveLineId
                        join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                        from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                        join Jol in db.JobOrderLine on L.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                        from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                        join Pu in db.ProductUid on(JobOrderLineTab.ProductUidHeaderId == null ? JobOrderLineTab.ProductUidId : L.ProductUidId) equals Pu.ProductUIDId into ProductUidTable
                        from ProductUidTab in ProductUidTable.DefaultIfEmpty()
                        where ProductUidTab.ProductUidName == ProductUidName && JobReceiveHeaderTab.ProcessId == Header.ProcessId && JobReceiveHeaderTab.SiteId == Header.SiteId &&
                        JobReceiveHeaderTab.DivisionId == Header.DivisionId && JobReceiveHeaderTab.JobWorkerId == Header.JobWorkerId
                        orderby JobReceiveHeaderTab.DocDate
                        select new
            {
                ProductUidId = ProductUidTab.ProductUIDId,
                JobInvoiceLineId = i.JobInvoiceLineId,
                JobInvoiceDocNo = i.JobInvoiceHeader.DocNo,
                Success = (i.JobInvoiceHeader.JobWorkerId == Header.JobWorkerId ? true : false),
                ProdUidHeaderId = JobOrderLineTab.ProductUidHeaderId,
            }).ToList().Last();

            return(temp);
        }
コード例 #3
0
        public IEnumerable <ComboBoxList> GetProductHelpList(int Id, string term)
        {
            var JobInvoiceReturn = new JobInvoiceReturnHeaderService(db).Find(Id);

            var settings = db.JobInvoiceSettings
                           .Where(m => m.DocTypeId == JobInvoiceReturn.DocTypeId && m.DivisionId == JobInvoiceReturn.DivisionId && m.SiteId == JobInvoiceReturn.SiteId).FirstOrDefault();

            string[] ProductTypes = null;
            if (!string.IsNullOrEmpty(settings.filterProductTypes))
            {
                ProductTypes = settings.filterProductTypes.Split(",".ToCharArray());
            }
            else
            {
                ProductTypes = new string[] { "NA" };
            }

            var list = (from p in db.Product
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : p.ProductName.ToLower().Contains(term.ToLower())) &&
                        (string.IsNullOrEmpty(settings.filterProductTypes) ? 1 == 1 : ProductTypes.Contains(p.ProductGroup.ProductTypeId.ToString()))
                        group new { p } by p.ProductId into g
                        select new ComboBoxList
            {
                PropFirst = g.Max(m => m.p.ProductName),
                Id = g.Key,

                //    DocumentTypeName=g.Max(p=>p.p.DocumentTypeShortName)
            }
                        ).Take(20);

            return(list.ToList());
        }
コード例 #4
0
        public IEnumerable <JobReceiveListViewModel> GetPendingJobReceiveHelpList(int Id, string term)
        {
            var InvoiceReturnHeader = new JobInvoiceReturnHeaderService(db).Find(Id);

            var settings = db.JobInvoiceSettings
                           .Where(m => m.DocTypeId == InvoiceReturnHeader.DocTypeId && m.DivisionId == InvoiceReturnHeader.DivisionId && m.SiteId == InvoiceReturnHeader.SiteId).FirstOrDefault();

            string[] contraDocTypes = null;
            if (!string.IsNullOrEmpty(settings.filterContraDocTypes))
            {
                contraDocTypes = settings.filterContraDocTypes.Split(",".ToCharArray());
            }
            else
            {
                contraDocTypes = new string[] { "NA" };
            }

            string[] contraSites = null;
            if (!string.IsNullOrEmpty(settings.filterContraSites))
            {
                contraSites = settings.filterContraSites.Split(",".ToCharArray());
            }
            else
            {
                contraSites = new string[] { "NA" };
            }

            string[] contraDivisions = null;
            if (!string.IsNullOrEmpty(settings.filterContraDivisions))
            {
                contraDivisions = settings.filterContraDivisions.Split(",".ToCharArray());
            }
            else
            {
                contraDivisions = new string[] { "NA" };
            }

            int CurrentSiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];

            var list = (from p in db.ViewJobInvoiceBalance
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : p.JobReceiveNo.ToLower().Contains(term.ToLower())) && p.JobWorkerId == InvoiceReturnHeader.JobWorkerId && p.BalanceQty > 0 &&
                        (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(p.JobInvoiceDocTypeId.ToString())) &&
                        (string.IsNullOrEmpty(settings.filterContraSites) ? p.SiteId == CurrentSiteId : contraSites.Contains(p.SiteId.ToString())) &&
                        (string.IsNullOrEmpty(settings.filterContraDivisions) ? p.DivisionId == CurrentDivisionId : contraDivisions.Contains(p.DivisionId.ToString()))
                        group new { p } by p.JobReceiveHeaderId into g
                        select new JobReceiveListViewModel
            {
                DocNo = g.Max(m => m.p.JobReceiveNo),
                JobReceiveHeaderId = g.Key,
            }
                        ).Take(20);

            return(list.ToList());
        }
コード例 #5
0
        public IEnumerable <ComboBoxResult> GetCostCenterForPerson(int Id, string term)
        {
            var JobInvoiceReturnHeader = new JobInvoiceReturnHeaderService(db).Find(Id);

            var settings = db.JobInvoiceSettings
                           .Where(m => m.DocTypeId == JobInvoiceReturnHeader.DocTypeId && m.DivisionId == JobInvoiceReturnHeader.DivisionId && m.SiteId == JobInvoiceReturnHeader.SiteId).FirstOrDefault();

            int LedgerAccountId    = 0;
            var LedgerAccount_Temp = (from L in db.LedgerAccount where L.PersonId == JobInvoiceReturnHeader.JobWorkerId select L).FirstOrDefault();

            if (LedgerAccount_Temp != null)
            {
                LedgerAccountId = LedgerAccount_Temp.LedgerAccountId;
            }

            string[] contraSites = null;
            if (!string.IsNullOrEmpty(settings.filterContraSites))
            {
                contraSites = settings.filterContraSites.Split(",".ToCharArray());
            }
            else
            {
                contraSites = new string[] { "NA" };
            }

            string[] contraDivisions = null;
            if (!string.IsNullOrEmpty(settings.filterContraDivisions))
            {
                contraDivisions = settings.filterContraDivisions.Split(",".ToCharArray());
            }
            else
            {
                contraDivisions = new string[] { "NA" };
            }

            int CurrentSiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];

            var CostCenterList = (from C in db.CostCenter
                                  where C.LedgerAccountId == LedgerAccountId &&
                                  (string.IsNullOrEmpty(settings.filterContraSites) ? C.SiteId == CurrentSiteId : contraSites.Contains(C.SiteId.ToString())) &&
                                  (string.IsNullOrEmpty(settings.filterContraDivisions) ? C.DivisionId == CurrentDivisionId : contraDivisions.Contains(C.DivisionId.ToString())) &&
                                  (string.IsNullOrEmpty(term) ? 1 == 1 : C.CostCenterName.ToLower().Contains(term.ToLower())) &&
                                  C.IsActive == true && C.Status != (int)StatusConstants.Closed
                                  orderby C.CostCenterName
                                  select new ComboBoxResult
            {
                text = C.CostCenterName + " | " + C.DocType.DocumentTypeShortName,
                id = C.CostCenterId.ToString(),
            });

            return(CostCenterList);
        }
コード例 #6
0
        public IEnumerable <JobInvoiceReturnLineViewModel> GetJobInvoiceForFilters(JobInvoiceReturnLineFilterViewModel vm)
        {
            var InvoiceReturnHeader = new JobInvoiceReturnHeaderService(db).Find(vm.JobInvoiceReturnHeaderId);

            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.JobInvoiceHeaderId))
            {
                SaleOrderIdArr = vm.JobInvoiceHeaderId.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" };
            }
            //ToChange View to get Joborders instead of goodsreceipts
            var temp = (from p in db.ViewJobInvoiceBalance
                        join l in db.JobInvoiceLine on p.JobInvoiceLineId equals l.JobInvoiceLineId into linetable
                        from linetab in linetable.DefaultIfEmpty()
                        join h in db.JobInvoiceHeader on linetab.JobInvoiceHeaderId equals h.JobInvoiceHeaderId
                        join product in db.Product on p.ProductId equals product.ProductId into table2
                        from tab2 in table2.DefaultIfEmpty()
                        join t1 in db.JobReceiveLine on p.JobReceiveLineId equals t1.JobReceiveLineId into table1
                        from tab1 in table1.DefaultIfEmpty()
                        where (string.IsNullOrEmpty(vm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                        (string.IsNullOrEmpty(vm.JobInvoiceHeaderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.JobInvoiceHeaderId.ToString())) &&
                        (string.IsNullOrEmpty(vm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                        p.BalanceQty > 0
                        orderby h.DocDate, h.DocNo, linetab.Sr
                        select new JobInvoiceReturnLineViewModel
            {
                Dimension1Name = tab1.Dimension1.Dimension1Name,
                Dimension2Name = tab1.Dimension2.Dimension2Name,
                Dimension3Name = tab1.Dimension3.Dimension3Name,
                Dimension4Name = tab1.Dimension4.Dimension4Name,
                Specification = tab1.Specification,
                InvoiceBalQty = p.BalanceQty,
                Qty = p.BalanceQty,
                JobInvoiceHeaderDocNo = p.JobInvoiceNo,
                ProductName = tab2.ProductName,
                ProductId = p.ProductId,
                JobInvoiceReturnHeaderId = vm.JobInvoiceReturnHeaderId,
                JobInvoiceLineId = p.JobInvoiceLineId,
                UnitId = tab2.UnitId,
                UnitConversionMultiplier = linetab.UnitConversionMultiplier,
                DealUnitId = linetab.DealUnitId,
                Rate = linetab.Rate,
                //RateAfterDiscount = (linetab.Amount / linetab.DealQty),
                unitDecimalPlaces = tab2.Unit.DecimalPlaces,
                DealunitDecimalPlaces = linetab.DealUnit.DecimalPlaces,
                ProductUidName = tab1.ProductUid.ProductUidName,
                ProductUidId = tab1.ProductUidId,
                SalesTaxGroupProductId = linetab.SalesTaxGroupProductId,
                SalesTaxGroupPersonId = InvoiceReturnHeader.SalesTaxGroupPersonId
            });

            return(temp);
        }