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());
        }
Exemple #2
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);
            }
        }