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);
        }
Beispiel #2
0
        public void CreateJobReceiveAtBranch(int JobReceiveHeaderId)
        {
            JobReceiveHeader JobReceiveHeader = new JobReceiveHeaderService(_unitOfWork).Find(JobReceiveHeaderId);

            int SisteConcernSiteId = (from H in db.JobReceiveHeader
                                      join p in db.Persons on H.JobWorkerId equals p.PersonID into JobWorkerTable
                                      from JobWorkerTab in JobWorkerTable.DefaultIfEmpty()
                                      join s in db.Site on JobWorkerTab.PersonID equals s.PersonId into SiteTable
                                      from SiteTab in SiteTable.DefaultIfEmpty()
                                      where H.JobReceiveHeaderId == JobReceiveHeaderId
                                      select new
            {
                SiteId = SiteTab.SiteId
            }).FirstOrDefault().SiteId;

            if (SisteConcernSiteId != null && SisteConcernSiteId != 0)
            {
                var Temp = (from L in db.JobReceiveLine
                            join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                            from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                            join P in db.ProductUidSiteDetail on L.ProductUidId equals P.ProductUIDId into ProductUidTable
                            from ProductUidTab in ProductUidTable.DefaultIfEmpty()
                            join Joh in db.JobOrderHeader on ProductUidTab.GenDocId equals Joh.JobOrderHeaderId into JobOrderHeaderTable
                            from JobOrderHeaderTab in JobOrderHeaderTable.DefaultIfEmpty()
                            where L.JobReceiveHeaderId == JobReceiveHeaderId
                            group new { JobReceiveHeaderTab, JobOrderHeaderTab } by new { JobOrderHeaderTab.JobWorkerId } into Results
                            select new
                {
                    DocDate = Results.Max(i => i.JobReceiveHeaderTab.DocDate),
                    DivisionId = Results.Max(i => i.JobReceiveHeaderTab.DivisionId),
                    ProcessId = Results.Max(i => i.JobReceiveHeaderTab.ProcessId),
                    JobWorkerId = Results.Key.JobWorkerId,
                    Remark = Results.Max(i => i.JobReceiveHeaderTab.Remark)
                }).ToList();

                foreach (var SisterConcernJobReceiveHeader in Temp)
                {
                    JobReceiveHeader Header = new JobReceiveHeader();
                    Header.DocTypeId      = new DocumentTypeService(_unitOfWork).Find(TransactionDoctypeConstants.WeavingBazar).DocumentTypeId;
                    Header.DocDate        = SisterConcernJobReceiveHeader.DocDate;
                    Header.DocNo          = "1";
                    Header.DivisionId     = SisterConcernJobReceiveHeader.DivisionId;
                    Header.SiteId         = SisteConcernSiteId;
                    Header.ProcessId      = SisterConcernJobReceiveHeader.ProcessId;
                    Header.JobWorkerId    = SisterConcernJobReceiveHeader.JobWorkerId;
                    Header.JobReceiveById = 1;
                    Header.GodownId       = 1;
                    Header.Remark         = SisterConcernJobReceiveHeader.Remark;
                    Header.CreatedBy      = User.Identity.Name;
                    Header.CreatedDate    = DateTime.Now;
                    Header.ModifiedBy     = User.Identity.Name;
                    Header.ModifiedDate   = DateTime.Now;

                    new JobReceiveHeaderService(_unitOfWork).Create(Header);
                }
            }
        }
 public IEnumerable <JobInvoiceReturnLineIndexViewModel> GetLineListForIndex(int HeaderId)
 {
     return(from L in db.JobInvoiceReturnLine
            join Jil in db.JobInvoiceLine on L.JobInvoiceLineId equals Jil.JobInvoiceLineId into JobInvoiceLineTable
            from JobInvoiceLineTab in JobInvoiceLineTable.DefaultIfEmpty()
            join Jrl in db.JobReceiveLine on JobInvoiceLineTab.JobReceiveLineId equals Jrl.JobReceiveLineId into JobReceiveLineTable
            from JobReceiveLineTab in JobReceiveLineTable.DefaultIfEmpty()
            join Jrh in db.JobReceiveHeader on JobReceiveLineTab.JobReceiveHeaderId equals Jrh.JobReceiveHeaderId into JobReceiveHeaderTable
            from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
            join P in db.Product on JobReceiveLineTab.ProductId equals P.ProductId into ProductTable
            from ProductTab in ProductTable.DefaultIfEmpty()
            where L.JobInvoiceReturnHeaderId == HeaderId
            orderby L.Sr
            select new JobInvoiceReturnLineIndexViewModel
     {
         ProductName = ProductTab.ProductName,
         Qty = L.Qty,
         JobInvoiceReturnLineId = L.JobInvoiceReturnLineId,
         UnitId = ProductTab.UnitId,
         Specification = JobReceiveLineTab.Specification,
         Dimension1Name = JobReceiveLineTab.Dimension1.Dimension1Name,
         Dimension2Name = JobReceiveLineTab.Dimension2.Dimension2Name,
         Dimension3Name = JobReceiveLineTab.Dimension3.Dimension3Name,
         Dimension4Name = JobReceiveLineTab.Dimension4.Dimension4Name,
         LotNo = JobReceiveLineTab.LotNo,
         JobGoodsRecieptHeaderDocNo = JobReceiveHeaderTab.DocNo,
         JobInvoiceHeaderDocNo = JobInvoiceLineTab.JobInvoiceHeader.DocNo,
         DealQty = L.DealQty,
         DealUnitId = L.DealUnitId,
         unitDecimalPlaces = ProductTab.Unit.DecimalPlaces,
         DealunitDecimalPlaces = L.DealUnit.DecimalPlaces,
         Rate = L.Rate,
         Amount = L.Amount,
         Remark = L.Remark,
         ProductUidName = JobReceiveLineTab.ProductUid.ProductUidName,
         UnitName = ProductTab.Unit.UnitName,
         DealUnitName = L.DealUnit.UnitName,
         JobInvoiceDocTypeId = L.JobInvoiceLine.JobInvoiceHeader.DocTypeId,
         JobInvoiceHeaderId = L.JobInvoiceLine.JobInvoiceHeaderId,
     });
 }
        public JobInvoiceLineViewModel GetJobInvoiceLineBalance(int id)
        {
            var temp = (from VJIB in db.ViewJobInvoiceBalance
                        join Jil in db.JobInvoiceLine on VJIB.JobInvoiceLineId equals Jil.JobInvoiceLineId into JobInvoiceLineTable
                        from JobInvoiceLineTab in JobInvoiceLineTable.DefaultIfEmpty()
                        join Jrl in db.JobReceiveLine on JobInvoiceLineTab.JobReceiveLineId equals Jrl.JobReceiveLineId into JobReceiveLineTable
                        from JobReceiveLineTab in JobReceiveLineTable.DefaultIfEmpty()
                        join Jih in db.JobInvoiceHeader on JobInvoiceLineTab.JobInvoiceHeaderId equals Jih.JobInvoiceHeaderId into JobInvoiceHeaderTable
                        from JobInvoiceHeaderTab in JobInvoiceHeaderTable.DefaultIfEmpty()
                        join Jrh in db.JobReceiveHeader on JobReceiveLineTab.JobReceiveHeaderId equals Jrh.JobReceiveHeaderId into JobReceiveHeaderTable
                        from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                        where JobInvoiceLineTab.JobInvoiceLineId == id
                        select new JobInvoiceLineViewModel
            {
                JobWorkerId = JobInvoiceHeaderTab.JobWorkerId.Value,
                Amount = JobInvoiceLineTab.Amount,
                ProductId = JobReceiveLineTab.ProductId,
                ProductName = JobReceiveLineTab.Product.ProductName,
                JobReceiveLineId = JobInvoiceLineTab.JobReceiveLineId,
                JobReceiveDocNo = JobReceiveHeaderTab.DocNo,
                JobInvoiceHeaderId = JobInvoiceLineTab.JobInvoiceHeaderId,
                JobInvoiceLineId = JobInvoiceLineTab.JobInvoiceLineId,
                InvoiceDocNo = JobInvoiceLineTab.JobInvoiceHeader.DocNo,
                Qty = VJIB.BalanceQty,
                Rate = JobInvoiceLineTab.Rate,
                Remark = JobInvoiceLineTab.Remark,
                UnitConversionMultiplier = JobInvoiceLineTab.UnitConversionMultiplier,
                DealUnitId = JobInvoiceLineTab.DealUnitId,
                DealQty = JobInvoiceLineTab.DealQty,
                UnitId = JobReceiveLineTab.Product.UnitId,
                Dimension1Id = JobReceiveLineTab.Dimension1Id,
                Dimension1Name = JobReceiveLineTab.Dimension1.Dimension1Name,
                Dimension2Id = JobReceiveLineTab.Dimension2Id,
                Dimension2Name = JobReceiveLineTab.Dimension2.Dimension2Name,
                Dimension3Id = JobReceiveLineTab.Dimension3Id,
                Dimension3Name = JobReceiveLineTab.Dimension3.Dimension3Name,
                Dimension4Id = JobReceiveLineTab.Dimension4Id,
                Dimension4Name = JobReceiveLineTab.Dimension4.Dimension4Name,
                Specification = JobReceiveLineTab.Specification,
                LotNo = JobReceiveLineTab.LotNo,
                SalesTaxGroupPersonId = JobInvoiceLineTab.JobInvoiceHeader.SalesTaxGroupPersonId,
                SalesTaxGroupProductId = JobInvoiceLineTab.SalesTaxGroupProductId,
                CostCenterId = JobInvoiceLineTab.CostCenterId,
                CostCenterName = JobInvoiceLineTab.CostCenter.CostCenterName,
                //DiscountPer = p.DiscountPer
                Weight = JobReceiveLineTab.Qty == 0 ? 0 : (JobReceiveLineTab.Weight / JobReceiveLineTab.Qty) * VJIB.BalanceQty,
            }).FirstOrDefault();

            var JobInvoiceLineId = (from p in db.JobInvoiceLine
                                    where p.JobInvoiceLineId == temp.JobInvoiceLineId
                                    select new { LineId = p.JobInvoiceLineId, HeaderId = p.JobInvoiceHeaderId }).FirstOrDefault();


            var Charges = (from p in db.JobInvoiceLineCharge
                           where p.LineTableId == JobInvoiceLineId.LineId
                           join t in db.Charge on p.ChargeId equals t.ChargeId
                           select new LineCharges
            {
                ChargeCode = t.ChargeCode,
                Rate = p.Rate,
                LedgerAccountCrId = p.LedgerAccountCrId,
                LedgerAccountDrId = p.LedgerAccountDrId,
            }).ToList();

            var HeaderCharges = (from p in db.JobInvoiceHeaderCharges
                                 where p.HeaderTableId == JobInvoiceLineId.HeaderId
                                 join t in db.Charge on p.ChargeId equals t.ChargeId
                                 select new HeaderCharges
            {
                ChargeCode = t.ChargeCode,
                Rate = p.Rate,
            }).ToList();

            temp.RHeaderCharges = HeaderCharges;
            temp.RLineCharges   = Charges;

            return(temp);
        }
Beispiel #5
0
        public JobReceiveQAAttributeViewModel GetJobReceiveLineDetail(int JobReceiveLineid)
        {
            JobReceiveQAAttributeViewModel JobReceiveLineDetail = (from L in db.JobReceiveLine
                                                                   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()
                                                                   where L.JobReceiveLineId == JobReceiveLineid
                                                                   select new JobReceiveQAAttributeViewModel
            {
                JobReceiveLineId = L.JobReceiveLineId,
                JobWorkerId = JobReceiveHeaderTab.JobWorkerId,
                ProductUidId = L.ProductUidId,
                ProductUidName = L.ProductUid.ProductUidName,
                ProductId = JobOrderLineTab.ProductId,
                ProductName = JobOrderLineTab.Product.ProductName,
                QAQty = L.Qty,
                InspectedQty = L.Qty,
                Qty = L.Qty,
                UnitId = JobOrderLineTab.Product.UnitId,
                DealUnitId = L.DealUnitId,
                UnitConversionMultiplier = L.UnitConversionMultiplier,
                DealQty = L.DealQty,
                Weight = L.Weight,
                UnitDecimalPlaces = JobOrderLineTab.Product.Unit.DecimalPlaces,
                DealUnitDecimalPlaces = JobOrderLineTab.DealUnit.DecimalPlaces,
                DocTypeId = JobReceiveHeaderTab.DocTypeId
            }).FirstOrDefault();


            if (JobReceiveLineDetail != null)
            {
                ProductDimensions ProductDimensions = new ProductService(_unitOfWork).GetProductDimensions(JobReceiveLineDetail.ProductId, JobReceiveLineDetail.DealUnitId, JobReceiveLineDetail.DocTypeId);
                if (ProductDimensions != null)
                {
                    JobReceiveLineDetail.Length = ProductDimensions.Length;
                    JobReceiveLineDetail.Width  = ProductDimensions.Width;
                    JobReceiveLineDetail.Height = ProductDimensions.Height;
                    JobReceiveLineDetail.DimensionUnitDecimalPlaces = ProductDimensions.DimensionUnitDecimalPlaces;
                }
            }

            return(JobReceiveLineDetail);
        }
Beispiel #6
0
        public List <QAGroupLineLineViewModel> GetJobReceiveQAAttribute(int JobReceiveLineid)
        {
            List <QAGroupLineLineViewModel> JobReceiveQAAttribute = (from L in db.JobReceiveLine
                                                                     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 Pp in db.ProductProcess on new { X1 = JobOrderLineTab.ProductId, X2 = JobReceiveHeaderTab.ProcessId } equals new { X1 = Pp.ProductId, X2 = (Pp.ProcessId ?? 0) } into ProductProcessTable
                                                                     from ProductProcessTab in ProductProcessTable.DefaultIfEmpty()
                                                                     join QAGl in db.QAGroupLine on ProductProcessTab.QAGroupId equals QAGl.QAGroupId into QAGroupLineTable
                                                                     from QAGroupLineTab in QAGroupLineTable.DefaultIfEmpty()
                                                                     where L.JobReceiveLineId == JobReceiveLineid && ((int?)QAGroupLineTab.QAGroupLineId ?? 0) != 0
                                                                     select new QAGroupLineLineViewModel
            {
                QAGroupLineId = QAGroupLineTab.QAGroupLineId,
                DefaultValue = QAGroupLineTab.DefaultValue,
                Value = QAGroupLineTab.DefaultValue,
                Name = QAGroupLineTab.Name,
                DataType = QAGroupLineTab.DataType,
                ListItem = QAGroupLineTab.ListItem
            }).ToList();


            return(JobReceiveQAAttribute);
        }
Beispiel #7
0
        public IQueryable <JobReceivePendingToQAIndex> GetJobReceiveQAAttributeList(int DocTypeId, string Uname)
        {
            var DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];
            var SiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];

            var settings = new JobReceiveQASettingsService(db).GetJobReceiveQASettingsForDocument(DocTypeId, DivisionId, SiteId);

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

            return(from L in db.ViewJobReceiveBalanceForQA
                   join Jrl in db.JobReceiveLine on L.JobReceiveLineId equals Jrl.JobReceiveLineId into JobReceiveLineTable
                   from JobReceiveLineTab in JobReceiveLineTable.DefaultIfEmpty()
                   join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                   orderby JobReceiveHeaderTab.DocDate, JobReceiveHeaderTab.DocNo
                   where JobReceiveHeaderTab.SiteId == SiteId && JobReceiveHeaderTab.DivisionId == DivisionId &&
                   (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(JobReceiveHeaderTab.DocTypeId.ToString()))
                   select new JobReceivePendingToQAIndex
            {
                JobReceiveHeaderId = JobReceiveHeaderTab.JobReceiveHeaderId,
                JobReceiveLineId = L.JobReceiveLineId,
                DocTypeName = JobReceiveHeaderTab.DocType.DocumentTypeName,
                DocDate = JobReceiveHeaderTab.DocDate,
                DocNo = JobReceiveHeaderTab.DocNo,
                JobWorkerName = JobReceiveHeaderTab.JobWorker.Name,
                ProductName = JobReceiveLineTab.JobOrderLine.Product.ProductName,
                ProductUidName = JobReceiveLineTab.ProductUid.ProductUidName,
                DocTypeId = DocTypeId
            }
                   );
        }