arcticvman
MIS
I am working on a page that includes a sales forecast total.
The sales forecast is broken down by months and customer, so I sum the monthly total and use a quick calculation to get the prorated qty expected sold for the current month. What I need help with is adding the previous forecasted month total to that prorated number.
What I am doing to get the current month is below:
My year runs from Oct to Sep which is why my current method is ok, but once we roll into November I need to be able to add the Oct forecast number into the calculated number. For example, in January I will prorate the forecasted sales based on the current date and then I need to add the forecasted numbers from Oct-Nov-Dec to this number so then I can show quantity ahead or behind of forecast.
I hope this makes sense, if there are any questions for me please let me know and I will answer as quick as I can.
Thanks for all the help.
The sales forecast is broken down by months and customer, so I sum the monthly total and use a quick calculation to get the prorated qty expected sold for the current month. What I need help with is adding the previous forecasted month total to that prorated number.
What I am doing to get the current month is below:
Code:
$partno = '6010';
$month1=date("m");
$day=date("d");
$conn = odbc_connect('database','user','password');
if ($conn)
{
$queryfytd = "select MONTH(due_dt) AS month, FLOOR(SUM(qty)) AS fytd FROM table WHERE MONTH(due_dt) = 10 AND item_no = '$partno' GROUP BY due_dt";
$resultfytd=odbc_exec($conn,$queryfytd);
while($rowfytd = odbc_fetch_array($resultfytd)){
$fytd1 = $rowfytd['fytd'];
}
}
else echo "Hey Goober! Check your connection.";
$fytdtotal = FLOOR((($fytd1 / 30) * $day))
?>
<table border=1 style=" font-family:arial;font-size:85%;color:black;">
<caption><B></B></caption>
<tr>
<th>QTY</th>
</tr>
<?PHP
echo "<td align=center>";
echo $fytdtotal;
?>
My year runs from Oct to Sep which is why my current method is ok, but once we roll into November I need to be able to add the Oct forecast number into the calculated number. For example, in January I will prorate the forecasted sales based on the current date and then I need to add the forecasted numbers from Oct-Nov-Dec to this number so then I can show quantity ahead or behind of forecast.
I hope this makes sense, if there are any questions for me please let me know and I will answer as quick as I can.
Thanks for all the help.