<?php use yii\helpers\Html; //use yii\widgets\DetailView; use kartik\detail\DetailView; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model app\models\Driver */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'พนักงานขับรถ', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $config = new app\models\Config_system(); $SalaryMasterModel = new \app\models\SalaryMaster(); $MapDrive = new \app\models\MapDriver(); $MapTruck = new app\models\MapTruck(); $car = $MapDrive->find()->where(['driver' => $model->driver_id, 'active' => '1'])->one(); $car_map = $MapTruck->find()->where(['car_id' => $car['car_id']])->one(); ?> <script type="text/javascript"> function chkNumber(ele) { var vchar = String.fromCharCode(event.keyCode); if ((vchar < '0' || vchar > '9') && (vchar != '.')) return false; //ele.onKeyPress = vchar; } </script> <div class="panel panel-primary"> <div class="panel-heading" style=" padding-bottom:20px;"> <i class="fa fa-windows"></i> <div class="pull-right"> <a href="<?php
?> <?php $columns = [['class' => 'yii\\grid\\SerialColumn'], 'assign_id', ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'employer', 'label' => 'ผู้ว่าจ้าง', 'format' => 'raw', 'value' => function ($model) { $customer = new \app\models\Customer(); $cus = $customer->find()->where(['cus_id' => $model->employer])->one(); return $cus['company']; }, 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(\app\models\Customer::find()->asArray()->all(), 'cus_id', 'company'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'ผู้ว่าจ้าง']], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'order_date_start', 'label' => 'วันที่ไป', 'hAlign' => 'center', 'width' => '10%', 'format' => 'raw', 'mergeHeader' => true, 'value' => function ($model) { $config = new \app\models\Config_system(); return $config->thaidate($model->order_date_start); }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'order_date_end', 'label' => 'วันที่กลับ', 'hAlign' => 'center', 'width' => '10%', 'format' => 'raw', 'mergeHeader' => true, 'value' => function ($model) { $config = new \app\models\Config_system(); return $config->thaidate($model->order_date_end); }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'car_id', 'label' => 'รถคันที่', 'mergeHeader' => true, 'value' => function ($model) { $truck = new app\models\MapTruck(); $tr = $truck->find()->where(['car_id' => $model->car_id])->one(); return $model->car_id . " (" . $tr['truck_1'] . ') - (' . $tr['truck_2'] . ")"; }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'driver1', 'label' => 'คนขับ1', 'mergeHeader' => true, 'format' => 'raw', 'value' => function ($model) { $driver = new app\models\Driver(); $dr = $driver->find()->where(['driver_id' => $model->driver1])->one(); return $dr['name'] . ' ' . $dr['lname']; }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'driver2', 'label' => 'คนขับ2', 'mergeHeader' => true, 'format' => 'raw', 'value' => function ($model) { $driver2 = new app\models\Driver(); $dr2 = $driver2->find()->where(['driver_id' => $model->driver2])->one(); return $dr2['name'] . ' ' . $dr2['lname']; }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'imcome', 'label' => 'รายได้', 'mergeHeader' => true, 'hAlign' => 'right', 'format' => 'raw', 'value' => function ($model) { return "<font style='color:blue;'>" . number_format($model->income, 2) . "</font>"; }], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'flag', 'label' => 'สถานะ', 'mergeHeader' => true, 'format' => 'raw', 'value' => function ($model) { if ($model->flag == 1) { $status = "<font style='color:green;'><i class='fa fa-check'></i> ชำระเงินแล้ว</font>"; } else {
public function actionLoad_report_month_select_car_round() { $year = \Yii::$app->request->post('year'); $month = \Yii::$app->request->post('month'); $car_id = \Yii::$app->request->post('car_id'); $Assign = new \app\models\Assign(); $result = $Assign->find()->where(['car_id' => $car_id, 'LEFT(order_date_start,4)' => $year, 'SUBSTR(order_date_start,6,2)' => $month])->orderBy('id')->all(); $report = new \app\models\MapTruck(); //$result = $report->get_price($car_id, $year, $month); $MapDriver = new \app\models\MapDriver(); $DriverModel = new \app\models\Driver(); $car = $report->find()->where(['car_id' => $car_id])->one(); //ข้อมูลรถ(มีทะเบียนไรบ้าง) $driv = $MapDriver->find()->where(['car_id' => $car_id])->one(); //คันนี้ใครขับ $driver = $DriverModel->find()->where(['driver_id' => $driv['driver']])->one(); //ดึงชื่อคนขับ return $this->renderPartial('load_report_month_select_car_round', ['result' => $result, 'car' => $car, 'driver' => $driver, 'year' => $year, 'month' => $month]); }
table tr td{ border-left: #000000 solid 1px; border-bottom: #000000 solid 1px; padding: 5px;} table tr th{ border-left: #000000 solid 1px; border-bottom: #000000 solid 1px; border-top: #000000 solid 1px; padding: 5px; text-align: left; font-weight: bold;} table{ border-right: #000000 solid 1px;} table tr th p{ margin-bottom: 10px;} #line{ color: #FFF; font-size: 5px;} </style> <?php use yii\helpers\Url; $truck_model = new \app\models\Truck(); $config = new \app\models\Config_system(); $driver = new app\models\Driver(); $customer_model = new \app\models\Customer(); $changwat_model = new app\models\Changwat(); $producttype_model = new app\models\ProductType(); $car_model = new \app\models\MapTruck(); $car = $car_model->find()->where(['car_id' => $model->car_id])->one(); ?> <h3> สรุปรายรับ - รายจ่าย รหัสสั่งงาน <?php echo $model->assign_id; ?> </h3> <?php $employer = $customer_model->find()->where(['cus_id' => $model->employer])->one(); ?> <b>ผู้ว่าจ้าง :</b> <?php echo $employer['company']; ?> <br/> <b>ที่อยู่ : </b> <?php echo $employer['address'];