{"name":"Analisi Mese corrente","sql":"Select\r\n  date_add(DATE_SUB(last_day(now()), INTERVAL 1 MONTH),INTERVAL 1 DAY) as dal,\r\n  last_day(now()) as al,\r\nsum(corrispettivo) as corrispettivi,\r\nsum(fatture) as fatture,\r\nsum(pos) as pos,\r\nsum(totale) as totale,\r\nsum(totale) - sum(corrispettivo)-sum(fatture) as delta,\r\nround((sum(totale) - sum(corrispettivo)-sum(fatture)) \/ (sum(corrispettivo)+sum(fatture)) * 100,2) as percDelta,\r\n  (select sum(importo) from ub_versamenti where data BETWEEN DATE_ADD(DATE_SUB(last_day(now()), INTERVAL 1 MONTH),INTERVAL 1 DAY) and last_day(now())) as versamenti,\r\nsum(corrispettivo)+sum(fatture)-sum(pos)-(select sum(importo) from ub_versamenti where data BETWEEN DATE_ADD(DATE_SUB(last_day(now()), INTERVAL 1 MONTH),INTERVAL 1 DAY) and last_day(now()))\r\n-(\r\nselect sum(importo) from movimenti contabili where data BETWEEN DATE_ADD(DATE_SUB(last_day(now()), INTERVAL 1 MONTH),INTERVAL 1 DAY) and last_day(now() and cassa = 'Cassa 2' ) as spazio\r\nfrom ub_corrispettivi\r\nwhere data BETWEEN DATE_ADD(DATE_SUB(last_day(now()), INTERVAL 1 MONTH),INTERVAL 1 DAY) and last_day(now())"}