// GET: CODReceipt
        public ActionResult Index()
        {
            DatePicker datePicker = SessionDataModel.GetTableVariable();
            DatePicker model      = new DatePicker();

            //string tz = "Arabian Standard Time";
            //DateTime now = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tz);
            if (datePicker == null)
            {
                model = new DatePicker
                {
                    FromDate = CommanFunctions.GetFirstDayofMonth().Date,
                    ToDate   = CommanFunctions.GetLastDayofMonth().Date //DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59).AddHours(8)

                                                                        //      Delete = (bool)Token.Permissions.Deletion,
                                                                        //    Update = (bool)Token.Permissions.Updation,
                                                                        //  Create = (bool)Token.Permissions.Creation
                };
            }
            else
            {
                model.FromDate = datePicker.FromDate;
                model.ToDate   = datePicker.ToDate;
            }
            ViewBag.Token = model;
            SessionDataModel.SetTableVariable(model);
            return(View(model));
        }
      // GET: SupplierInvoice
      public ActionResult Index(int?id, string FromDate, string ToDate)
      {
          int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
          int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

          DateTime pFromDate;
          DateTime pToDate;
          int      suppliertypeid = 0;

          if (id == null | id == 0)
          {
              suppliertypeid = 4;
          }
          else
          {
              suppliertypeid = Convert.ToInt32(id);
          }

          if (FromDate == null || ToDate == null)
          {
              pFromDate = CommanFunctions.GetFirstDayofMonth().Date;           //.AddDays(-1); // FromDate = DateTime.Now;
              pToDate   = CommanFunctions.GetLastDayofMonth().Date.AddDays(1); // // ToDate = DateTime.Now;
          }
          else
          {
              pFromDate = Convert.ToDateTime(FromDate);  //.AddDays(-1);
              pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
          }

          var lst = (from c in db.SupplierInvoices
                     join s in db.SupplierMasters on c.SupplierID equals s.SupplierID orderby c.InvoiceDate descending
                     where s.SupplierTypeID == suppliertypeid
                     where c.InvoiceDate >= pFromDate && c.InvoiceDate < pToDate
                     select new SupplierInvoiceVM {
                SupplierInvoiceID = c.SupplierInvoiceID, InvoiceNo = c.InvoiceNo, InvoiceDate = c.InvoiceDate, SupplierName = s.SupplierName, Amount = 0, SupplierType = s.SupplierType.SupplierType1, Remarks = s.Remarks
            }).ToList();

          lst.ForEach(d => d.Amount = (from s in db.SupplierInvoiceDetails where s.SupplierInvoiceID == d.SupplierInvoiceID select s).ToList().Sum(a => a.Value));

          ViewBag.FromDate       = pFromDate.Date.ToString("dd-MM-yyyy");
          ViewBag.ToDate         = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
          ViewBag.SupplierType   = db.SupplierTypes.ToList();
          ViewBag.SupplierTypeId = suppliertypeid;
          return(View(lst));
      }
Exemple #3
0
        public ActionResult InvoiceSearch()
        {
            DatePicker datePicker = SessionDataModel.GetTableVariable();

            if (datePicker == null)
            {
                datePicker            = new DatePicker();
                datePicker.FromDate   = CommanFunctions.GetFirstDayofMonth().Date; // DateTime.Now.Date;
                datePicker.ToDate     = DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
                datePicker.MovementId = "1,2,3,4";
            }
            if (datePicker != null)
            {
                //ViewBag.Customer = (from c in db.InScanMasters
                //                    join cust in db.CustomerMasters on c.CustomerID equals cust.CustomerID
                //                    where (c.TransactionDate >= datePicker.FromDate && c.TransactionDate < datePicker.ToDate)
                //                    select new CustmorVM { CustomerID = cust.CustomerID, CustomerName = cust.CustomerName }).Distinct();

                ViewBag.Customer = (from c in db.CustomerMasters where c.StatusActive == true select new CustmorVM {
                    CustomerID = c.CustomerID, CustomerName = c.CustomerName
                }).ToList();
                if (datePicker.MovementId == null)
                {
                    datePicker.MovementId = "1,2,3,4";
                }
            }
            else
            {
                ViewBag.Customer = new CustmorVM {
                    CustomerID = 0, CustomerName = ""
                };
            }


            //ViewBag.Movement = new MultiSelectList(db.CourierMovements.ToList(),"MovementID","MovementType");
            ViewBag.Movement = db.CourierMovements.ToList();

            ViewBag.Token = datePicker;
            SessionDataModel.SetTableVariable(datePicker);
            return(View(datePicker));
        }
Exemple #4
0
        public ActionResult Index()
        {
            CustomerInvoiceSearch obj   = (CustomerInvoiceSearch)Session["CustomerInvoiceSearch"];
            CustomerInvoiceSearch model = new CustomerInvoiceSearch();
            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());
            int yearid   = Convert.ToInt32(Session["fyearid"].ToString());

            if (obj == null)
            {
                DateTime pFromDate;
                DateTime pToDate;
                //int pStatusId = 0;
                pFromDate     = CommanFunctions.GetFirstDayofMonth().Date;
                pToDate       = CommanFunctions.GetLastDayofMonth().Date;
                obj           = new CustomerInvoiceSearch();
                obj.FromDate  = pFromDate;
                obj.ToDate    = pToDate;
                obj.InvoiceNo = "";
                Session["CustomerInvoiceSearch"] = obj;
                model.FromDate  = pFromDate;
                model.ToDate    = pToDate;
                model.InvoiceNo = "";
            }
            else
            {
                model = obj;
            }
            List <CustomerInvoiceVM> lst = PickupRequestDAO.GetInvoiceList(obj.FromDate, obj.ToDate, model.InvoiceNo, yearid);

            if (lst != null)
            {
                model.InvoiceTotal = Convert.ToDecimal(lst.Sum(cc => cc.InvoiceTotal).ToString()); // ReceiptDAO.GetCustomerInvoiceTotal(obj.FromDate, obj.ToDate);
            }
            model.Details = lst;

            return(View(model));
        }
Exemple #5
0
        public ActionResult Index(int?StatusId, string FromDate, string ToDate)
        {
            DateTime pFromDate;
            DateTime pToDate;
            int      pStatusId = 0;

            if (StatusId == null)
            {
                pStatusId = 0;
            }
            else
            {
                pStatusId = Convert.ToInt32(StatusId);
            }
            if (FromDate == null || ToDate == null)
            {
                pFromDate = CommanFunctions.GetFirstDayofMonth().Date; //.AddDays(-1); // FromDate = DateTime.Now;
                pToDate   = DateTime.Now.Date.AddDays(1);              // // ToDate = DateTime.Now;
            }
            else
            {
                pFromDate = Convert.ToDateTime(FromDate);//.AddDays(-1);
                pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
            }
            List <HoldVM> lst = new List <HoldVM>();

            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

            //List<HoldVM> ls = (from c in db.InScans join e in db.CountryMasters on c.ConsignorCityID equals e.CountryID join t in db.CityMasters on c.ConsigneeCityID equals t.CityID join x in db.CountryMasters on c.ConsigneeCountryID equals x.CountryID where c.HeldBy == null select new HoldVM { AWBNo = c.AWBNo, InScanID = c.InScanID, date = c.InScanDate, CollectedBy = c.CollectedBy, OriginName = e.CountryName, Consignor = c.Consignor, Consignee = c.Consignee, ConsigneeCountry = t.City, DestinationName = x.CountryName}).ToList();

            int statustypeid    = db.tblStatusTypes.Where(cc => cc.Name == "HOLD").FirstOrDefault().ID;
            int holdsatusid     = db.CourierStatus.Where(cc => cc.StatusTypeID == statustypeid && cc.CourierStatus == "OnHold").FirstOrDefault().CourierStatusID;
            int releasestatusid = db.CourierStatus.Where(cc => cc.StatusTypeID == statustypeid && cc.CourierStatus == "Released").FirstOrDefault().CourierStatusID;

            lst = (from c in db.InScanMasters join p in db.tblPaymentModes on c.PaymentModeId equals p.ID
                   join cs in db.CourierStatus on c.CourierStatusID equals cs.CourierStatusID
                   join hr in db.HoldReleases on c.InScanID equals hr.InScanId
                   join em in db.EmployeeMasters on c.PickedUpEmpID equals em.EmployeeID
                   where c.BranchID == branchid && c.StatusTypeId == statustypeid && //&& c.CourierStatusID == courisestatusid
                   (hr.EntryDate >= pFromDate && hr.EntryDate < pToDate) && (c.CourierStatusID == pStatusId || pStatusId == 0) &&
                   ((hr.ActionType == "Hold" && c.CourierStatusID == holdsatusid) || (hr.ActionType == "Release" && c.CourierStatusID == releasestatusid))
                   orderby hr.EntryDate descending
                   select new HoldVM {
                InScanID = c.InScanID, AWBNo = c.ConsignmentNo, date = hr.EntryDate,
                TransactionnDate = c.TransactionDate, CollectedByName = em.EmployeeName, Consignor = c.Consignor, OriginCountry = c.ConsignorCountryName, CourierStatus = cs.CourierStatus,
                Weight = c.Weight, Pieces = c.Pieces, CourierCharges = 100, Consignee = c.Consignee, ConsigneeCountry = c.ConsigneeCountryName, StatusPaymentMOde = p.PaymentModeText
            }).ToList();

            ViewBag.FromDate = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate   = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
            //foreach (var item in data)
            //{
            //    HoldVM obj = new HoldVM();
            //    if (item.HeldBy == null)
            //    {
            //        obj.InScanID = item.InScanID;
            //        obj.AWBNo = item.AWBNo;
            //        obj.date = item.TransactionDate;
            //        obj.CollectedBy = item.PickedUpEmpID;
            //        obj.StatedWeight = item.StatedWeight;
            //        obj.Pieces = item.Pieces;
            //        obj.CourierCharges = Convert.ToDecimal(item.CourierCharge);
            //        //obj.OriginID = item.ConsignorCountryID.Value;
            //        obj.Consignee = item.Consignee;
            //        obj.DestinationID = item.ConsigneeCountryName;
            //        obj.StatusPaymentMOde = db.tblStatusTypes
            //        obj.Consignor = item.Consignor;

            //        obj.HeldBy = item.HeldBy;
            //        obj.HeldOn = item.HeldOn;
            //        obj.HeldResoan = item.HeldReason;
            //    }
            //    lst.Add(obj);
            //}

            ViewBag.CourierStatusList = db.CourierStatus.Where(cc => cc.StatusType == "HOLD").ToList();
            ViewBag.ReleaseBy         = db.EmployeeMasters.ToList();
            return(View(lst));
        }
        public ActionResult Index(int?StatusId, string FromDate, string ToDate)
        {
            ViewBag.Employee            = db.EmployeeMasters.ToList();
            ViewBag.PickupRequestStatus = db.PickUpRequestStatus.ToList();

            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

            DateTime pFromDate;
            DateTime pToDate;
            int      pStatusId = 0;

            if (StatusId == null)
            {
                pStatusId = 0;
            }
            else
            {
                pStatusId = Convert.ToInt32(StatusId);
            }
            if (FromDate == null || ToDate == null)
            {
                pFromDate = CommanFunctions.GetFirstDayofMonth().Date;           //.AddDays(-1); // FromDate = DateTime.Now;
                pToDate   = CommanFunctions.GetLastDayofMonth().Date.AddDays(1); // // ToDate = DateTime.Now;
            }
            else
            {
                pFromDate = Convert.ToDateTime(FromDate);//.AddDays(-1);
                pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
            }

            // List<PickupRequestVM> lst = (from c in db.CustomerEnquiries join t1 in db.EmployeeMasters on c.CollectedEmpID equals t1.EmployeeID join t2 in db.EmployeeMasters on c.EmployeeID equals t2.EmployeeID select new PickupRequestVM { EnquiryID = c.EnquiryID, EnquiryDate = c.EnquiryDate, Consignor = c.Consignor, Consignee = c.Consignee, eCollectedBy = t1.EmployeeName, eAssignedTo = t2.EmployeeName,AWBNo=c.AWBNo }).ToList();

            //List<PickupRequestVM> lst = (from c in db.CustomerEnquiries
            //            join status in db.PickUpRequestStatus on c.PickupRequestStatusId equals status.Id
            //            join pet in db.EmployeeMasters on c.CollectedEmpID equals pet.EmployeeID into gj
            //            from subpet in gj.DefaultIfEmpty()
            //            join pet1 in db.EmployeeMasters on c.EmployeeID equals  pet1.EmployeeID into gj1
            //            from subpet1 in gj1.DefaultIfEmpty()
            //            where  c.EnquiryDate >=pFromDate &&  c.EnquiryDate <=pToDate
            //            select new PickupRequestVM { EnquiryID = c.EnquiryID, EnquiryNo=c.EnquiryNo, EnquiryDate = c.EnquiryDate, Consignor = c.Consignor, Consignee = c.Consignee, eCollectedBy =subpet.EmployeeName ?? string.Empty, eAssignedTo = subpet1.EmployeeName ?? string.Empty , AWBNo = c.AWBNo ,PickupRequestStatus=status.PickRequestStatus }).ToList();

            int Customerid = 0;

            if (Session["UserType"].ToString() == "Customer")
            {
                Customerid = Convert.ToInt32(Session["CustomerId"].ToString());
            }
            List <PickupRequestVM> lst = (from c in db.InScanMasters
                                          join statustype in db.tblStatusTypes on c.StatusTypeId equals statustype.ID
                                          join status in db.CourierStatus on c.CourierStatusID equals status.CourierStatusID
                                          join pet in db.EmployeeMasters on c.PickedUpEmpID equals pet.EmployeeID into gj
                                          from subpet in gj.DefaultIfEmpty()
                                          join pet1 in db.EmployeeMasters on c.AssignedEmployeeID equals pet1.EmployeeID into gj1
                                          from subpet1 in gj1.DefaultIfEmpty()
                                          where c.BranchID == branchid && c.IsEnquiry == true && (c.PickupRequestDate >= pFromDate && c.PickupRequestDate < pToDate) && (c.CourierStatusID == pStatusId || pStatusId == 0) &&
                                          c.IsDeleted == false &&
                                          (c.CustomerID == Customerid || Customerid == 0)
                                          orderby c.PickupRequestDate descending
                                          select new PickupRequestVM {
                PickupRequestStatusId = c.CourierStatusID, EnquiryID = c.InScanID, EnquiryNo = c.EnquiryNo, EnquiryDate = c.PickupRequestDate, Consignor = c.Consignor, Consignee = c.Consignee, eCollectedBy = subpet.EmployeeName ?? string.Empty, eAssignedTo = subpet1.EmployeeName ?? string.Empty, AWBNo = c.ConsignmentNo, PickupRequestStatus = status.CourierStatus, ShipmentType = statustype.Name
            }).ToList();

            //ViewBag.FromDate = pFromDate.Date.AddDays(1).ToString("dd-MM-yyyy");
            ViewBag.FromDate            = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate              = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
            ViewBag.PickupRequestStatus = db.CourierStatus.Where(cc => cc.StatusTypeID == 1).ToList();
            ViewBag.StatusId            = StatusId;
            return(View(lst));
        }
Exemple #7
0
        public ActionResult Index(string VehicleType, string FromDate, string ToDate)
        {
            ViewBag.Employee            = db.EmployeeMasters.ToList();
            ViewBag.PickupRequestStatus = db.PickUpRequestStatus.ToList();

            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

            DateTime pFromDate;
            DateTime pToDate;
            int      pStatusId = 0;

            if (FromDate == null || ToDate == null)
            {
                pFromDate = CommanFunctions.GetFirstDayofMonth().Date;           //.AddDays(-1); // FromDate = DateTime.Now;
                pToDate   = CommanFunctions.GetLastDayofMonth().Date.AddDays(1); // // ToDate = DateTime.Now;
            }
            else
            {
                pFromDate = Convert.ToDateTime(FromDate);//.AddDays(-1);
                pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
            }

            // List<PickupRequestVM> lst = (from c in db.CustomerEnquiries join t1 in db.EmployeeMasters on c.CollectedEmpID equals t1.EmployeeID join t2 in db.EmployeeMasters on c.EmployeeID equals t2.EmployeeID select new PickupRequestVM { EnquiryID = c.EnquiryID, EnquiryDate = c.EnquiryDate, Consignor = c.Consignor, Consignee = c.Consignee, eCollectedBy = t1.EmployeeName, eAssignedTo = t2.EmployeeName,AWBNo=c.AWBNo }).ToList();

            //List<PickupRequestVM> lst = (from c in db.CustomerEnquiries
            //            join status in db.PickUpRequestStatus on c.PickupRequestStatusId equals status.Id
            //            join pet in db.EmployeeMasters on c.CollectedEmpID equals pet.EmployeeID into gj
            //            from subpet in gj.DefaultIfEmpty()
            //            join pet1 in db.EmployeeMasters on c.EmployeeID equals  pet1.EmployeeID into gj1
            //            from subpet1 in gj1.DefaultIfEmpty()
            //            where  c.EnquiryDate >=pFromDate &&  c.EnquiryDate <=pToDate
            //            select new PickupRequestVM { EnquiryID = c.EnquiryID, EnquiryNo=c.EnquiryNo, EnquiryDate = c.EnquiryDate, Consignor = c.Consignor, Consignee = c.Consignee, eCollectedBy =subpet.EmployeeName ?? string.Empty, eAssignedTo = subpet1.EmployeeName ?? string.Empty , AWBNo = c.AWBNo ,PickupRequestStatus=status.PickRequestStatus }).ToList();

            int Customerid = 0;

            if (Session["UserType"].ToString() == "Customer")
            {
                Customerid = Convert.ToInt32(Session["CustomerId"].ToString());
            }
            List <TruckDetailVM> lst = (from c in db.TruckDetails
                                        //join d in db.DriverMasters on c.DriverID equals d.DriverID
                                        //join o in db.LocationMasters on c.OriginName equals o.LocationID
                                        //join de in db.LocationMasters on c.DestinationName equals de.LocationID
                                        where c.BranchID == branchid && (c.TDDate >= pFromDate && c.TDDate < pToDate) && (c.IsDeleted == false || c.IsDeleted == null)
                                        orderby c.TDDate descending
                                        select new TruckDetailVM {
                TruckDetailID = c.TruckDetailID,
                ReceiptNo = c.ReceiptNo,
                //DriverName=d.DriverName,
                Origin = c.OriginName,
                Destination = c.DestinationName,
                VehicleType = c.VehicleType,
                TDDate = c.TDDate,
                RegNo = c.RegNo,
                DriverID = c.DriverID,
                Rent = c.Rent,
                OtherCharges = c.OtherCharges,
                TotalCharge = c.Rent + c.OtherCharges
            }).ToList();


            if (!String.IsNullOrEmpty(VehicleType))
            {
                lst = lst.Where(d => d.VehicleType == VehicleType).ToList();
            }
            lst.ForEach(d => d.DriverName = (from s in db.DriverMasters where s.DriverID == d.DriverID select s).FirstOrDefault() == null ? "" : (from s in db.DriverMasters where s.DriverID == d.DriverID select s).FirstOrDefault().DriverName);

            ViewBag.FromDate = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate   = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
            ViewBag.StatusId = VehicleType;


            return(View(lst));
        }
        // GET: RevenueUpdate
        public ActionResult Index(string pTDNo, string FromDate, string ToDate)
        {
            ViewBag.Employee            = db.EmployeeMasters.ToList();
            ViewBag.PickupRequestStatus = db.PickUpRequestStatus.ToList();

            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

            DateTime pFromDate;
            DateTime pToDate;
            string   TDNo = "";

            if (TDNo == null)
            {
                TDNo = "";
            }
            else
            {
                TDNo = pTDNo;
            }
            if (FromDate == null || ToDate == null)
            {
                pFromDate = CommanFunctions.GetFirstDayofMonth().Date;           //.AddDays(-1); // FromDate = DateTime.Now;
                pToDate   = CommanFunctions.GetLastDayofMonth().Date.AddDays(1); // // ToDate = DateTime.Now;
            }
            else
            {
                pFromDate = Convert.ToDateTime(FromDate);//.AddDays(-1);
                pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
            }


            List <CostUpdateMasterVM> lst = new List <CostUpdateMasterVM>();

            if (TDNo == "" || TDNo == null)
            {
                lst = (from d in db.CostUpdateMasters
                       join c in db.TruckDetails on d.TruckDetailID equals c.TruckDetailID
                       where (d.EntryDate >= pFromDate && d.EntryDate < pToDate)
                       select new CostUpdateMasterVM
                {
                    ID = d.ID,
                    EntryDate = d.EntryDate,
                    TDDate = c.TDDate,
                    TDNo = c.ReceiptNo,
                    DriverName = c.DriverName,
                    RegNo = c.RegNo
                }).ToList();
            }
            else
            {
                lst = (from d in db.CostUpdateMasters
                       join c in db.TruckDetails on d.TruckDetailID equals c.TruckDetailID
                       where (c.ReceiptNo == TDNo)
                       select new CostUpdateMasterVM
                {
                    ID = d.ID,
                    EntryDate = d.EntryDate,
                    TDDate = c.TDDate,
                    TDNo = c.ReceiptNo,
                    DriverName = c.DriverName,
                    RegNo = c.RegNo
                }).ToList();
            }

            lst.ForEach(d => d.Amount = (from s in db.CostUpdateDetails where s.MasterID == d.ID select s).ToList().Sum(a => a.Amount));
            lst = lst.OrderByDescending(cc => cc.TDDate).ToList();

            ViewBag.FromDate = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate   = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
            ViewBag.TDNo     = TDNo;

            ViewBag.FromDate = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate   = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");

            return(View(lst));
        }
        // GET: RevenueUpdate
        public ActionResult Index(string pConsignmentNo, string FromDate, string ToDate)
        {
            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int depotId  = Convert.ToInt32(Session["CurrentDepotID"].ToString());

            DateTime pFromDate;
            DateTime pToDate;
            string   ConsignmentNo = "";

            if (ConsignmentNo == null)
            {
                ConsignmentNo = "";
            }
            else
            {
                ConsignmentNo = pConsignmentNo;
            }
            if (FromDate == null || ToDate == null)
            {
                pFromDate = CommanFunctions.GetFirstDayofMonth().Date;           //.AddDays(-1); // FromDate = DateTime.Now;
                pToDate   = CommanFunctions.GetLastDayofMonth().Date.AddDays(1); // // ToDate = DateTime.Now;
            }
            else
            {
                pFromDate = Convert.ToDateTime(FromDate);//.AddDays(-1);
                pToDate   = Convert.ToDateTime(ToDate).AddDays(1);
            }


            int Customerid = 0;

            if (Session["UserType"].ToString() == "Customer")
            {
                Customerid = Convert.ToInt32(Session["CustomerId"].ToString());
            }
            List <RevenueUpdateMasterVM> lst = new List <RevenueUpdateMasterVM>();

            //List<RevenueUpdateMasterVM> lst = RevenueDAO.GetRevenueUpdateList(ConsignmentNo, pFromDate, pToDate);

            if (ConsignmentNo == "" || ConsignmentNo == null)
            {
                lst = (from d in db.RevenueUpdateMasters
                       join c in db.InScanMasters on d.InScanID equals c.InScanID
                       where (d.EntryDate >= pFromDate && d.EntryDate < pToDate)
                       select new RevenueUpdateMasterVM
                {
                    ID = d.ID,
                    ConsignmentDate = d.EntryDate,
                    ConsignmentNo = c.ConsignmentNo,
                    ConsignorName = c.Consignor,
                    ConsigneeName = c.Consignee
                }).ToList();
            }
            else
            {
                lst = (from d in db.RevenueUpdateMasters
                       join c in db.InScanMasters on d.InScanID equals c.InScanID
                       where (c.ConsignmentNo == ConsignmentNo)
                       select new RevenueUpdateMasterVM
                {
                    ID = d.ID,
                    ConsignmentDate = d.EntryDate,
                    ConsignmentNo = c.ConsignmentNo,
                    ConsignorName = c.Consignor,
                    ConsigneeName = c.Consignee
                }).ToList();
            }

            lst.ForEach(d => d.Amount = (from s in db.RevenueUpdateDetails where s.MasterID == d.ID select s).ToList().Sum(a => a.Amount));
            lst = lst.OrderByDescending(cc => cc.ConsignmentDate).ToList();

            ViewBag.FromDate      = pFromDate.Date.ToString("dd-MM-yyyy");
            ViewBag.ToDate        = pToDate.Date.AddDays(-1).ToString("dd-MM-yyyy");
            ViewBag.ConsignmentNo = ConsignmentNo;
            return(View(lst));
        }