Nie walcze z tym miesiac, tylko od 2 dni.
Dodalem ta linie, o ktorej pisales. Przy wywolaniu -f 2012/06/01:
SELECT
d.id, d.number, d.cdate, c.email,
d.name, d.customerid, n.template
FROM documents d
LEFT JOIN customers c ON
c.id = d.customerid
LEFT JOIN numberplans n ON
n.id = d.numberplanid
WHERE c.deleted = 0 AND d.type = 1 AND c.email <> '' AND c.invoicenotice = 1 AND d.cdate >= 1338508800 AND d.cdate <= 1338595199 ORDER BY d.number
i rzeczywiscie wynik to te 5 osob, do ktory faktury sie wysylaja.