0

I have two values in my code one is from a SQL Server query echo to the screen as formattedNum10d my second value is stored in a MySQL database and echo to the screen as formattedNum10f. In a seperate column i would like to subtract foramattedNum10f from formattedNum10d and echo the result but everything i have tried does not work any help would be greatly appreciated.

$sql10d="SELECT SUM (CASE WHEN FFP.SINVOICE.NUM_0 Like '%SCR%' THEN (0 - (FFP.SINVOICE.AMTATIL_0 - FFP.SINVOICE.AMTTAX_0)) ELSE (FFP.SINVOICE.AMTATIL_0-FFP.SINVOICE.AMTTAX_0) END) FROM FFP.BPCUSTOMER, FFP.SINVOICE INNER JOIN FFP.SINVOICEV ON FFP.SINVOICE.NUM_0 = FFP.SINVOICEV.NUM_0 WHERE FFP.SINVOICEV.PJT_0='' AND FFP.SINVOICE.BPR_0 = FFP.BPCUSTOMER.BPCNUM_0 AND ((FFP.SINVOICE.ACCDAT_0>='$day01')) AND ((FFP.SINVOICE.ACCDAT_0<='$day10'))";
$stmt10d=sqlsrv_query($conn, $sql10d);
if($stmt10d==false){
     echo 'Error to retrieve info ';
     die( print_r( sqlsrv_errors(), true));
}
      $row10d=sqlsrv_fetch_array($stmt10d);
      $formattedNum10d = number_format($row10d[0], 0, ".", ",");
      echo '£' .$formattedNum10d;
?>
    </td>
    <td width="10%" height="25" align="center" valign="middle" bgcolor="#D1E7C5">
      <?php
        $formattedNum10e = number_format("{$DailySalesBudget}", 2);
        echo '£' .$formattedNum10e;
      ?>
    </td>
    </td>
    <td width="10%" height="25" align="center" valign="middle" bgcolor="#D1E7C5">
      <?php
        $formattedNum10f = number_format("{$DailySalesBudget}"*10, 2);
        echo '£' .$formattedNum10f;
      ?>
    </td>
    <td width="10%" height="25" align="center" valign="middle">
      <?php
        $Num10g = $row10d;
        $formattedNum10g = number_format("$Num10g", 2);
        echo '£' .$formattedNum10g;
      ?>
    </td>
1
Contributor
0
Replies
11
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.