Forum Moderators: coopster
$usa_query = tep_db_query("SELECT count(o.orders_id) as totalrecs, sum(round(ot.value,2)) as usatotal FROM ".TABLE_CANCELLED_ORDERS_TOTAL." as ot LEFT JOIN ".TABLE_CANCELLED_ORDERS." as o on(ot.orders_id=o.orders_id) where o.date_purchased LIKE '".$year."-".$month."%' && (o.orders_status='3' || o.orders_status='2099') && (o.delivery_country='United States' || o.delivery_country='Canada') && o.payment_method LIKE '%Credit%' && ot.class='ot_total'");
$usapp = tep_db_fetch_array($usa_query);
$usaamt = $usapp['usatotal']*.025;
$usatotal = $usapp['totalrecs']*0.30;
$usa = $usaamt+$usatotal; numbers generated off the site are always off by a few cents