- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
function getGeneralOfficesStats(&$stats_year, &$stats_office_logo, &$stats_quant_client, &$stats_summ_client, &$stats_summ_supplier, &$stats_summ_delivery, &$stats_without_complex_price, &$quant_position, &$top_quant_client, &$top_summ_client, &$top_summ_supplier, &$top_summ_delivery, &$top_stats_without_complex_price, &$top_quant_position, $date_start_time=0, $date_end_time=0, $office_logo="")
{
$sql="SELECT t1.month, t1.year, t1.office_logo, t1.quant_client, t1.summ_client, t1.summ_supplier,
t1.summ_delivery, t1.stats_without_complex_price,
t1.quant_position, t1.top_quant_client, t1.top_summ_client,
t1.top_summ_supplier, t1.top_summ_delivery, t1.top_stats_without_complex_price, t1.top_quant_position
FROM stats_offices AS t1
INNER JOIN offices AS t2 ON t1.office_logo=t2.name AND t1.currency_logo=t2.currency
WHERE 1=1
".(($date_start_time>0 && $date_end_time>0)?" AND STR_TO_DATE(CONCAT(t1.year,'-',IF(LENGTH(t1.month)=1,'0',''),t1.month,'-01 01:01:01'), '%Y-%m-%d %H:%i:%s') BETWEEN STR_TO_DATE('".date("Y-m-01 00:00:00",$date_start_time)."', '%Y-%m-%d %H:%i:%s') AND STR_TO_DATE('".date("Y-m-d 23:59:59",$date_end_time)."', '%Y-%m-%d %H:%i:%s') ":"")."
".((!empty($office_logo))?" AND t1.office_logo='".mysql_escape_string($office_logo)."' ":"")."
ORDER BY t1.office_logo, t1.year DESC, t1.month DESC";
list($stats_month, $stats_year, $stats_office_logo, $stats_quant_client, $stats_summ_client, $stats_summ_supplier, $stats_summ_delivery, $stats_without_complex_price, $quant_position, $top_quant_client, $top_summ_client, $top_summ_supplier, $top_summ_delivery, $top_stats_without_complex_price, $top_quant_position)=$this->query($sql);
return $stats_month;
}
Сменил работу. Стал знакомится с кодом. Тихо охуеваю.