コード例 #1
0
    table tfoot tr td{ text-align: right; font-weight: bold; background: #999999; color: #FFF;}
    #income{ background: #006633; color: yellow; font-weight: bold;}
    #outcome{ background: #cc0033; color: #ffffff; font-weight: bold;}
    #total{ background: #0000cc; font-weight: bold; color: #FFF;}
</style>

<?php 
use yii\helpers\Html;
use yii\helpers\Url;
use kartik\date\DatePicker;
//use miloschuman\highcharts\Highcharts;
/* @var $this yii\web\View */
/* @var $model app\models\Truck */
$config = new app\models\Config_system();
$report = new \app\models\Report();
$monthfull = $config->MonthFullKey();
?>
<b>รายรับ รายจ่าย รายการขนส่งประจำปี <?php 
echo $year + 543;
?>
</b>
<?//php echo $chart; ?>
<div class="table table-responsive">
    <table class="table table-striped table-hover table-bordered" id="report_year">
        <thead>
            <tr>
                <th rowspan="2" valign="middle"><i class="fa fa-calendar"></i><br/>เดือน</th>
                <th rowspan="2" valign="middle"><i class="fa fa-truck"></i><br/>จำนวนรอบ</th>
                <th rowspan="2" valign="middle">ระยะทาง<br/>(ก.ม)</th>
                <th rowspan="2" valign="middle">น้ำมัน<br/>(ลิตร)</th>
                <th rowspan="2" valign="middle">แก๊ส<br/>(ก.ก.)</th>
コード例 #2
0
 public function actionChart_month($year = null, $month = null)
 {
     $config = new \app\models\Config_system();
     $months = $config->MonthFullKey();
     $title = "ยอดกำไร - ขาดทุน ปี พ.ศ. ";
     $title .= $year + 543;
     $title .= " เดือน " . $months[$month];
     $labels = "รวมทั้งเดือน";
     $report = new Report();
     $result = $report->Report_month($year, $month);
     $sum_expenses_row = 0;
     $sum_total_row = 0;
     $sum_income = 0;
     $sum_outcome = 0;
     $income_month = 0;
     foreach ($result as $rs) {
         $day[] = $rs['DAY'];
         $sum_expenses_row = $rs['oil_price'] + $rs['gas_price'] + $rs['expenses_around'] + $rs['fix_truck'] + $rs['income_driver'] + $rs['truck_period'] + $rs['truck_act'];
         $sum_total_row = $rs['income'] - $sum_expenses_row;
         $income_month = $rs['income'];
         if (empty($income_month)) {
             $income = 0;
         } else {
             $income = $income_month;
         }
         if (empty($sum_expenses_row)) {
             $outcome = 0;
         } else {
             $outcome = $sum_expenses_row;
         }
         $value_income[] = (int) $income;
         $value_outcome[] = (int) $outcome;
         $sum_income = $sum_income + $rs['income'];
         //รายได้รวมทุกเดือน
         $sum_outcome = $sum_outcome + $sum_expenses_row;
         //รายจ่ายรวมทุกเดือน
     }
     //$val_income = implode('', $value_income);
     //$val_outcome = implode('', $value_outcome);
     return $this->renderAjax('chart', ['category' => $day, 'title' => $title, 'labels' => $labels, 'val_income' => $value_income, 'val_outcome' => $value_outcome, 'sumIncome' => (int) $sum_income, 'sumOutcome' => (int) $sum_outcome]);
 }