hello
<%
&fillHashSet("Select sum(unit_cost) as costtotal from ORDERLINES where order_id in (select order_id from ORDERS where date(date_placed)=curdate())");
while (&fillHashLoop("C")) {
$costtotal=$C{costtotal};
}
&fillHashSet("Select sum(shipping_cost) as shipping,sum(pointdiscount) as ptdisc,sum(grand_total) as grndtotal,sum(coupondiscount) as cpndisc from ORDERS where date(date_placed)=curdate()");
while (&fillHashLoop("C")) {
$pointdisc=$C{ptdisc};
$grandtotal=$C{grndtotal};
$coupondisc=$C{cpndisc};
$pointdisc=$C{ptdisc};
$shipping=$C{shipping};
}
$discounts=$pointdisc+$coupondisc;
$profit=$grandtotal-$costtotal;
print qq~
| Grand Total: | \$$grandtotal |
| Discounts: | \$$discounts |
| Cost Total: | \$$costtotal |
| Shipping: | \$$shipping |
| Profit: | \$$profit |
~;
%>