<?php 
require "connectionDb.php";

$date = $_GET['selectDateToFind'];
$date = str_replace('-', '_', $date);
$shiftnum = 1;
$shiftPumpReport1 = $db->query("SELECT * FROM shift_pump_vw WHERE date='$date'");

print_r("<thead><tr>
        <th>Pump Number</th>
        <th>Fuel Grade</th>
        <th>Pump Opening Volume</th>
        <th>Pump Closing Volume</th>
        <th>Sale Volume 
(Closing Volume - Opening Volume)</th>
        <th>Unit Price</th>
        <th>Money 
(Sale Volume x Unit Price)</th>
        </tr></thead>");

while ($row = $shiftPumpReport1->fetchArray()) {
  //print_r($row);
if ($row['number']==$shiftnum) {
  $openVolume = $row['open_volume'];
  $closeVolume = $row['close_volume'];
  $saleTotal =$closeVolume-$openVolume;
  $price= $row['price'];
  $moneyTotal = $saleTotal*$price;
  print_r(
  "<tr>"
  ."<td>".$row['fp_id']."</td>"
  ."<td>".$row['grade_name']."</td>"
  ."<td>".decimalAndNumberFormat1($row['open_volume'])."</td>"
  ."<td>".decimalAndNumberFormat1($row['close_volume'])."</td>"
  ."<td>".decimalAndNumberFormat1($saleTotal)."</td>"
  ."<td>".decimalAndNumberFormat1($row['price'])."</td>"
  ."<td>".decimalAndNumberFormat1($moneyTotal)."</td>"
  ."</tr>"
);
}
}

 ?>