Good afternoon,
We have a weekly magazine that was at a wholesale price of $0.70 to purchase. The retail price was $1.00. After February 21,2014 the price of this magazine's wholesale price has increased to $1.00 and the retail price increased to $2.00. All wholesale prices before February 20, 2014 was at $0.70. What I am trying to do is tally up the total that each salesman sold say from January 01, 2014 thru today 03/06/2015 reflecting both to totals from the old wholesale and the new wholesale price.
So if I had a member that sold one magazine per week from 01/01/2014 until 02/19/2014 at the $0.70 price, it will total $5.60.
Then from 02/20/2014 until 03/06/2015 sold 1 magazine per week at the $1.00 price I get $3.00. The total from January 01 until March 06,
2015 would be $8.60. The old code using the $0.70 wholesale calculation is below. The new code using "cfif" statement (which it throwing the error) is right below that. Am I doing something wrong?
<!--- Existing Code--->
<cfquery name="volno" >
SELECT CONCAT(name.fname,' ',name.lname)AS member,
name.foiid,
name.city,
fcnsales.salesfoiid,
fcnsales.salesvolno,
round(sum(fcnsales.salesamt/.7)) as TOTAL_MAG_SOLD
FROM name, fcnsales
WHERE fcnsales.salesfoiid = name.foiid
AND fcnsales.salesvolno between '#form.volno1#' and '#form.volno2#'
GROUP BY name.foiid
ORDER BY TOTAL_MAG_SOLD desc;
</cfquery>
<!--- New Code--->
<cfquery name="volno" >
SELECT CONCAT(name.fname,' ',name.lname)AS member,
name.foiid,
name.city,
fcnsales.salesfoiid,
fcnsales.salesvolno,
<cfif #fcnsales.salesdate# GTE '2014-02-20'> round(sum(fcnsales.salesamt/1)) as TOTAL_MAG_SOLD<cfelseif #fcnsales.salesdate# LT '2014-02-20'> round(sum(fcnsales.salesamt/.7)) as TOTAL_MAG_SOLD
FROM name, fcnsales
WHERE fcnsales.salesfoiid = name.foiid
AND fcnsales.salesvolno between '#form.volno1#' and '#form.volno2#'
GROUP BY name.foiid
ORDER BY TOTAL_MAG_SOLD desc;
</cfquery>