public ActionResult PrintHBCostV(HouseBillListVm hbObj)
        {
            ViewBag.HbObj = hbObj;
            OperationCostMainVm hbCostView = HouseBillHelper.GetHBCost(hbObj.HouseBillId, 0);

            return(View(hbCostView));
        }
Example #2
0
        //kamal
        internal static HouseBillListVm GetHbContent(int hbId)
        {
            OperationsEntities db = new OperationsEntities();



            HouseBillListVm hbList = db.HouseBills
                                     .Where(x => x.HouseBillId == hbId)
                                     .Select(x => new HouseBillListVm
            {
                HouseBillId        = x.HouseBillId,
                OperationCode      = x.OperationCode,
                OperationDate      = x.OperationDate,
                ShipperId          = x.ShipperId,
                ConsigneeId        = x.ConsigneeId,
                HouseBL            = x.HouseBL,
                ClientName         = "",
                NumberOfPackages   = x.NumberOfPackages,
                OperationId        = x.OperationId,
                CarrierType        = x.Operation.CarrierType,
                StatusId           = x.StatusId,
                FreightCostAmount  = x.CollectedFreightCost,
                ThcCostAmount      = x.CollectedThcCost,
                FreighCurrencySign = x.Currency1.CurrencySign,
                ThcCurrencySign    = x.Currency.CurrencySign,
                AgentId            = x.AgentId
            })
                                     .FirstOrDefault();


            Operation operationDb = db.Operations.Where(x => x.OperationId == hbList.OperationId).FirstOrDefault();

            EasyFreightEntities db1 = new EasyFreightEntities();

            if (operationDb.OrderFrom == 1) //Export .. client will be the shipper
            {
                var shipperList = db1.Shippers
                                  .Where(x => x.ShipperId == hbList.ShipperId)
                                  .Select(x => new { x.ShipperId, x.ShipperNameEn, x.ShipperNameAr }).ToList();

                hbList.ClientName = shipperList.Where(x => x.ShipperId == hbList.ShipperId).FirstOrDefault().ShipperNameEn;
            }
            else //Export .. client will be consignee
            {
                //List<int> consigneeIds = hbList.Select(x => x.ConsigneeId).ToList();
                var consigneeList = db1.Consignees
                                    .Where(x => x.ConsigneeId == hbList.ConsigneeId)
                                    .Select(x => new { x.ConsigneeId, x.ConsigneeNameEn, x.ConsigneeNameAr }).ToList();

                hbList.ClientName = consigneeList.Where(x => x.ConsigneeId == hbList.ConsigneeId).FirstOrDefault().ConsigneeNameEn;
            }
            return(hbList);
        }