public IEnumerable <SaleDispatchLineViewModel> GetSaleDispatchLineListForIndex(int SaleDispatchHeaderId)
        {
            IEnumerable <SaleDispatchLineViewModel> SaleDispatchLineViewModel = (from l in db.SaleDispatchLine
                                                                                 join Pl in db.PackingLine on l.PackingLineId equals Pl.PackingLineId into PackingLineTable
                                                                                 from PackingLineTab in PackingLineTable.DefaultIfEmpty()
                                                                                 join t in db.Product on PackingLineTab.ProductId equals t.ProductId into table
                                                                                 from tab in table.DefaultIfEmpty()
                                                                                 join t1 in db.SaleOrderLine on PackingLineTab.SaleOrderLineId equals t1.SaleOrderLineId into table1
                                                                                 from tab1 in table1.DefaultIfEmpty()
                                                                                 join t2 in db.SaleOrderHeader on tab1.SaleOrderHeaderId equals t2.SaleOrderHeaderId into table2
                                                                                 from tab2 in table2.DefaultIfEmpty()
                                                                                 join t3 in db.ProductUid on PackingLineTab.ProductUidId equals t3.ProductUIDId into table3
                                                                                 from tab3 in table3.DefaultIfEmpty()
                                                                                 join u in db.Units on PackingLineTab.DealUnitId equals u.UnitId into DealUnitTable
                                                                                 from DealUnitTab in DealUnitTable.DefaultIfEmpty()
                                                                                 join Si in db.Stock on l.StockId equals Si.StockId into StockInTable
                                                                                 from StockInTab in StockInTable.DefaultIfEmpty()
                                                                                 join Sih in db.StockHeader on StockInTab.StockHeaderId equals Sih.StockHeaderId into StockHeaderTable
                                                                                 from StockHeaderTab in StockHeaderTable.DefaultIfEmpty()
                                                                                 where l.SaleDispatchHeaderId == SaleDispatchHeaderId
                                                                                 orderby l.SaleDispatchLineId
                                                                                 select new SaleDispatchLineViewModel
            {
                SaleDispatchLineId = l.SaleDispatchLineId,
                ProductName = tab.ProductName,
                Dimension1Name = PackingLineTab.Dimension1.Dimension1Name,
                Dimension2Name = PackingLineTab.Dimension2.Dimension2Name,
                Specification = PackingLineTab.Specification,
                SaleOrderHeaderDocNo = tab2.DocNo,
                ProductUidName = tab3.ProductUidName,
                BaleNo = PackingLineTab.BaleNo,
                Qty = PackingLineTab.Qty,
                UnitId = tab.UnitId,
                DealQty = PackingLineTab.DealQty,
                DealUnitId = DealUnitTab.UnitName,
                DealUnitDecimalPlaces = DealUnitTab.DecimalPlaces,
                unitDecimalPlaces = PackingLineTab.Product.Unit.DecimalPlaces,
                StockInId = StockInTab.StockId,
                StockInNo = StockHeaderTab.DocNo,
                Remark = l.Remark,
                LossQty = PackingLineTab.LossQty,
                SaleDispatchHeaderId = l.SaleDispatchHeaderId
            }).Take(2000).ToList();

            return(SaleDispatchLineViewModel);
        }
        public SaleDispatchLineViewModel GetSaleDispatchDetailForInvoice(int id)
        {
            return((from t in db.ViewSaleDispatchBalance
                    join p in db.SaleDispatchLine on t.SaleDispatchLineId equals p.SaleDispatchLineId into SaleDispatchLineTable from SaleDispatchLineTab in SaleDispatchLineTable.DefaultIfEmpty()
                    join pl in db.PackingLine on SaleDispatchLineTab.PackingLineId equals pl.PackingLineId into PackingLineTable from PackingLineTab in PackingLineTable.DefaultIfEmpty()
                    join sol in db.SaleOrderLine on t.SaleOrderLineId equals sol.SaleOrderLineId into SaleOrderLineTable from SaleOrderLineTab in SaleOrderLineTable.DefaultIfEmpty()
                    where t.SaleDispatchLineId == id
                    select new SaleDispatchLineViewModel
            {
                DealQty = PackingLineTab.DealQty,
                DealUnitId = PackingLineTab.DealUnitId,
                ProductId = PackingLineTab.ProductId,
                Qty = t.BalanceQty,
                Rate = SaleOrderLineTab.Rate,
                Remark = PackingLineTab.Remark,
                Dimension1Id = PackingLineTab.Dimension1Id,
                Dimension2Id = PackingLineTab.Dimension2Id,
                Dimension1Name = PackingLineTab.Dimension1.Dimension1Name,
                Dimension2Name = PackingLineTab.Dimension2.Dimension2Name,
                SaleOrderLineId = PackingLineTab.SaleOrderLineId,
                Specification = PackingLineTab.Specification,
                UnitConversionMultiplier = PackingLineTab.UnitConversionMultiplier,
                UnitId = PackingLineTab.Product.UnitId,
                UnitName = PackingLineTab.Product.Unit.UnitName,
            }

                    ).FirstOrDefault());
        }
예제 #3
0
        public JsonResult GetSaleDispatchDetailJson(int SaleDispatchLineId)
        {
            var temp = (from L in db.ViewSaleDispatchBalance
                        join Dl in db.SaleDispatchLine on L.SaleDispatchLineId equals Dl.SaleDispatchLineId into SaleDispatchLineTable from SaleDispatchLineTab in SaleDispatchLineTable.DefaultIfEmpty()
                        join Pl in db.PackingLine on SaleDispatchLineTab.PackingLineId equals Pl.PackingLineId into PackingLineTable from PackingLineTab in PackingLineTable.DefaultIfEmpty()
                        join P in db.Product on L.ProductId equals P.ProductId into ProductTable from ProductTab in ProductTable.DefaultIfEmpty()
                        join U in db.Units on ProductTab.UnitId equals U.UnitId into UnitTable from UnitTab in UnitTable.DefaultIfEmpty()
                        join D1 in db.Dimension1 on PackingLineTab.Dimension1Id equals D1.Dimension1Id into Dimension1Table
                        from Dimension1Tab in Dimension1Table.DefaultIfEmpty()
                        join D2 in db.Dimension2 on PackingLineTab.Dimension2Id equals D2.Dimension2Id into Dimension2Table
                        from Dimension2Tab in Dimension2Table.DefaultIfEmpty()
                        where L.SaleDispatchLineId == SaleDispatchLineId
                        select new
            {
                SaleDispatchHeaderDocNo = L.SaleDispatchNo,
                UnitId = UnitTab.UnitId,
                UnitName = UnitTab.UnitName,
                DealUnitId = PackingLineTab.DealUnitId,
                Specification = PackingLineTab.Specification,
                UnitConversionMultiplier = PackingLineTab.UnitConversionMultiplier,
                ProductId = L.ProductId,
                Dimension1Id = L.Dimension1Id,
                Dimension1Name = Dimension1Tab.Dimension1Name,
                Dimension2Id = L.Dimension2Id,
                Dimension2Name = Dimension2Tab.Dimension2Name,
                SaleOrderLineId = L.SaleOrderLineId,
                Rate = L.Rate,
                BalanceQty = L.BalanceQty
            }).FirstOrDefault();

            if (temp != null)
            {
                return(Json(temp));
            }
            else
            {
                return(null);
            }
        }