public function sumByDate() { $date = filter_input(INPUT_POST, 'date'); $resp = prihod_total($date); $ret = array(); $vals = array(); $res = prihod_by('sum', 'grupa', $date); foreach ($res as $key => $value) { array_push($vals, array($key, $value)); } array_push($ret, array('title' => 'Prihod po grupama', 'tip' => 'Grupe', 'mesto' => 'chart-grupe', 'podaci' => $vals)); $vals = array(); $res = prihod_by('sum', 'marka', $date); foreach ($res as $key => $value) { array_push($vals, array($key, $value)); } array_push($ret, array('title' => 'Prihod po markama', 'tip' => 'Marke', 'mesto' => 'chart-marke', 'podaci' => $vals)); echo json_encode(array($resp, $ret[0], $ret[1])); }
<?php adm_header(); $up = prihod_total(); ?> <div class="col-lg-10"> <div class="row"> <div class="col-lg-12"> <h2 class="adm-title">STATISTIKA</h2> <div class="col-lg-12 adm-stat"> <h3>PREGLED OSTVARENOG PRIHODA<span class="pull-right"><i class="fa fa-chevron-down show-data"></i></span></h3> <div hidden=""><div class="col-lg-12"> <div class="col-lg-8"> <table class="table table-bordered table-stripped"> <tr> <th>UKUPAN PRIHOD</th> <td id="sum-tot"><?php echo $up['ukupno']; ?> </td> <th>PRIHOD BEZ POSTARINE</th> <td id="sum-net"><?php echo $up['neto']; ?> </td> </tr> </table> </div> <div class="col-lg-4"> <form action="" id="sum-date" class="form-inline"> <select id="sum-month" class="form-control" required="">