public ActionResult WorkDonePrint(DateTime startDate, DateTime endDate, int vehicleNo)
        {
            if (startDate.Equals(DateTime.MinValue))
                throw new ArgumentNullException("startDate");
            if (endDate.Equals(DateTime.MinValue))
                throw new ArgumentNullException("endDate");
            if (vehicleNo == 0)
                throw new InvalidArgumentException("Vehicle No can not be 0", EngineExceptionErrorID.InvalidArgument);

            IVehicleService vehicleService = new VehicleService();
            var vehicle = vehicleService.GetVehicle(vehicleNo);
            var compCode = string.IsNullOrWhiteSpace(vehicle.CompanyCode) || string.Equals(vehicle.CompanyCode.ToLower(), "no") ? "N/A" : vehicle.CompanyCode;
            var measure = vehicle.IsVehicle ? " Km" : " Hrs";
            var totalWorkDone = decimal.Zero;
            var totalFuelUsed = decimal.Zero;

            DataTable dataTable = GetWorkDoneReportTable(startDate, endDate, vehicleNo, measure, out totalWorkDone, out totalFuelUsed);
            ReportClass reportClass = new ReportClass();
            reportClass.FileName = Server.MapPath("~/Reports/WorkDoneReport.rpt");
            reportClass.Load();
            reportClass.SummaryInfo.ReportTitle = "Work Done Report – Vehicle/Machine";
            reportClass.Database.Tables["WorkDoneReport"].SetDataSource(dataTable);
            reportClass.SetParameterValue("StartDate", startDate.ToString("d"));
            reportClass.SetParameterValue("EndDate", endDate.ToString("d"));
            reportClass.SetParameterValue("VehicleNo", vehicle.VehicleNumber);
            reportClass.SetParameterValue("CompanyCode", compCode);
            reportClass.SetParameterValue("TotalWorkDone", totalWorkDone.ToString("C").Replace("$", string.Empty) + " " + measure);
            reportClass.SetParameterValue("TotalFuelUsed", totalFuelUsed.ToString("C").Replace("$", string.Empty) + " L");
            reportClass.SetParameterValue("WorkDoneHeading", "Work Done (" + measure.Trim() + ")");

            Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            return File(compStream, "application/pdf");
        }
        public ActionResult HireBillPrivatePrint(DateTime startDate, DateTime endDate, int vehicleNo)
        {
            if (startDate.Equals(DateTime.MinValue))
                throw new ArgumentNullException("startDate");
            if (endDate.Equals(DateTime.MinValue))
                throw new ArgumentNullException("endDate");
            if (vehicleNo == 0)
                throw new InvalidArgumentException("Vehicle No can not be 0", EngineExceptionErrorID.InvalidArgument);

            IVehicleService vehicleService = new VehicleService();
            var vehicle = vehicleService.GetVehicle(vehicleNo);
            DataTable dataTable = GetHireBillPrivateReportTable(startDate, endDate, vehicleNo, vehicle.IsVehicle);
            ReportClass reportClass = new ReportClass();
            reportClass.FileName = Server.MapPath("~/Reports/HireBillPrivateReport.rpt");
            reportClass.Load();
            reportClass.SummaryInfo.ReportTitle = "Hire Bill (Private) Report";
            reportClass.Database.Tables["HireBillPrivateReport"].SetDataSource(dataTable);
            reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d"));
            reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d"));
            reportClass.SetParameterValue("VehicleNumberParameter", vehicle.VehicleNumber);
            reportClass.SetParameterValue("OwnerNameParameter", vehicle.OwnerName);
            string measure = vehicle.IsVehicle ? " Rs/Km" : " Rs/Hr";
            reportClass.SetParameterValue("HireRateParameter", vehicle.HireRate.ConvertToDecimalString() + measure);

            Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            return File(compStream, "application/pdf");
        }
        public ActionResult WorkDone(DateTime startDate, DateTime endDate, int vehicleNo, int companyCode)
        {
            IVehicleService vehicleService = new VehicleService();
            var vehicle = vehicleService.GetVehicle(vehicleNo);
            var compCode = string.IsNullOrWhiteSpace(vehicle.CompanyCode) || string.Equals(vehicle.CompanyCode.ToLower(), "no") ? "N/A" : vehicle.CompanyCode;
            var report = reportService.GetWorkDoneReport(startDate, endDate, vehicleNo);
            var model = ModelMapper.GetWorkDoneReportModelList(report);

            ViewBag.StartDate = startDate;
            ViewBag.EndDate = endDate;
            ViewBag.VehicleNumber = vehicle.VehicleNumber;
            ViewBag.CompanyCode = compCode;
            ViewBag.IsVehicle = vehicle.IsVehicle;
            ViewBag.VehicleNo = vehicle.Id;

            return View(model);
        }
        public ActionResult HireBillPrivate(DateTime startDate, DateTime endDate, int vehicleNo)
        {
            IVehicleService vehicleService = new VehicleService();
            var vehicle = vehicleService.GetVehicle(vehicleNo);
            var reporthp = reportService.GetHireBillPrivateReport(startDate, endDate, vehicleNo);
            var modelhp = ModelMapper.GetHireBillPrivateReportModelList(reporthp);

            ViewBag.VehicleNo = vehicle.Id;
            ViewBag.IsVehicle = vehicle.IsVehicle;
            ViewBag.OwnerName = vehicle.OwnerName;
            ViewBag.HireRate = vehicle.HireRate.ConvertToDecimalString(); //.ToString("N");
            ViewBag.StartDate = startDate;
            ViewBag.EndDate = endDate;
            ViewBag.VehicleNumber = vehicle.VehicleNumber;

            return View(modelhp);
        }