$startday = date("d"); $startmonth = date("m"); $startyear = date("Y"); $startstring = $startyear . "-" . $startmonth . "-" . $startday; $stopdate = mktime(0, 0, 0, $startmonth, date("d") + 1, $startyear); $stopday = date("d", $stopdate); $stopmonth = date("m", $stopdate); $stopyear = date("Y", $stopdate); $stopstring = $stopyear . "-" . $stopmonth . "-" . $stopday; $count = 0; $rowcount = 0; // } $fleetlist = $fleetdayobj->getIncomeFleets(); // Pull the details for each fleet { foreach ($fleetlist as $fleetkey => $fleetval) { $fleetdetails = $fleetdayobj->getFleetScoreDay($fleetval["id"]); $fleetid = $fleetval["id"]; $fleetscore[$fleetid]["name"] = $fleetval["name"]; foreach ($fleetdetails as $daykey => $dayval) { $fleetscore[$fleetid]["income"] += $dayval["income"]; $fleetscore[$fleetid]["kms"] += $dayval["kms"]; $fleetscore[$fleetid]["budget"] += $dayval["budget"]; } if ($fleetscore[$fleetid]["budget"] > 0) { $fleetscore[$fleetid]["score"] = round($fleetscore[$fleetid]["income"] / $fleetscore[$fleetid]["budget"] * 100, 0); } else { $fleetscore[$fleetid]["score"] = 0; } $fleetscore[$fleetid]["income"] = round($fleetscore[$fleetid]["income"], 0); $fleetscore[$fleetid]["budget"] = round($fleetscore[$fleetid]["budget"], 0); $rowcount++;