Created
February 4, 2013 19:18
-
-
Save jblac/4708858 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dql = "SELECT p.postDate, co.company_name, | |
COUNT(*) AS `postDatesScheduled`, | |
COUNT(IF(c.postDateChargedStatus_id > 1, 1, NULL)) AS `postDateReady`, | |
SUM( IF(c.postDateChargedStatus_id = 6, 1, NULL)) AS `postDatesCharged`, | |
SUM( IF(c.`fwCompletionDate`, 1, NULL)) AS `postDatesComplete`, | |
SUM( authOnlyAmount ) AS `fwPotential`, | |
SUM( IF(p.`fwfAuthed`, p.`authOnlyAmount`, NULL)) AS `fwCharged`, | |
SUM( IF(c.`fwCompletionDate`, p.`authOnlyAmount`, NULL)) AS `fwCapt` | |
FROM customer c | |
JOIN Purchase p ON p.customer_Id = c.Id | |
JOIN User u on c.salesRep_Id = u.Id | |
JOIN Company co on c.salesCompany_Id = co.Id | |
WHERE c.`saleType_Id` = 2".$comp." | |
AND p.postDate BETWEEN :beg AND :fin | |
GROUP BY p.postDate, c.salesCompany_Id | |
ORDER BY p.postDate ASC"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment