Пример #1
0
use yii\helpers\Url;
$affiliated = new app\models\Affiliated();
$truck_model = new \app\models\AffiliatedTruck();
$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();
?>
<h3>
    สรุปรายรับ - รายจ่าย รหัสปฏิบัติงาน <?php 
echo $order_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'];
?>
<table class="table table-bordered" style="width: 100%;" cellpadding="1" cellspacing="0">
    <thead>
        <tr>
            <th style="text-align: center; font-weight: bold; width: 50%;">ทะเบียนรถ</th>
            <th style="text-align: center; font-weight: bold;">คนขับ</th>
        </tr>
    </thead>
Пример #2
0
    echo $producttype_model->find()->where(['id' => $assign['product_type']])->one()->product_type;
    ?>
                    ใบสั่งงาน <?php 
    echo $assign['assign_id'];
    ?>
                    <?php 
    echo $changwat_model->find()->where(['changwat_id' => $assign['changwat_start']])->one()->changwat_name;
    ?>
                    -
                    <?php 
    echo $changwat_model->find()->where(['changwat_id' => $assign['changwat_end']])->one()->changwat_name;
    ?>
                    <br/>
                    <b>ต้นทาง : </b>
                    <?php 
    $cus_s = $customer_model->find()->where(['cus_id' => $assign['cus_start']])->one();
    echo $cus_s->company;
    ?>

                    <b>ปลายทาง : </b>
                    <?php 
    $cus_e = $customer_model->find()->where(['cus_id' => $assign['cus_end']])->one();
    echo $cus_e->company;
    ?>
 
                </td>
                <td style="text-align: center;"><?php 
    echo $assign['weigh'];
    ?>
</td>
                <td style="text-align: right;"> <?php 
Пример #3
0
    ?>
                    <a href="<?php 
    echo Url::to(['order-transport/incom_outcome', 'id' => $rs['assign_id']]);
    ?>
" target="_blank"><i class="fa fa-eye"></i></a>
                </td>
                <td><?php 
    echo $config->thaidate($rs['order_date_start']) . ' - ' . $config->thaidate($rs['order_date_end']);
    ?>
</td>
                <td><?php 
    echo get_driver($rs['driver1']) . ' ' . get_driver($rs['driver2']);
    ?>
</td>
                <td><?php 
    echo $customer->find()->where(['cus_id' => $rs['employer']])->one()['company'];
    ?>
</td>
                <td style=" text-align: right;"><?php 
    echo number_format((int) $rs['income'], 2);
    ?>
</td>
            </tr>
        <?php 
}
?>
    </tbody>
</table>

<script>
    $(function () {
Пример #4
0
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="fa fa-book"></i> ใบสั่งงาน</div>
                                        <input type="text" class="form-control" value="<?php 
echo $model->order_id;
?>
" readonly="readonly"/>
                                    </div>
                                </div>
                            </div>

                            <div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="fa fa-building-o"></i> ผู้ว่าจ้าง</div>
                                        <input type="text" class="form-control" value="<?php 
echo $customer_model->find()->where(['cus_id' => $model->employer])->one()['company'];
?>
" readonly="readonly"/>
                                    </div>
                                </div>
                            </div>

                            <div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="fa fa-calendar"></i> วันที่ไป</div>
                                        <input type="text" class="form-control" value="<?php 
echo $config->thaidate($model->order_date_start);
?>
" readonly="readonly"/>
                                    </div>
Пример #5
0
        <b>วันที่ขน :</b>  <?php 
    echo $config->thaidate($assign->transport_date);
    ?>
 <br/>
        <b>เส้นทาง : </b>
        <?php 
    echo $changwat_model->find()->where(['changwat_id' => $assign->changwat_start])->one()->changwat_name;
    ?>
        -
        <?php 
    echo $changwat_model->find()->where(['changwat_id' => $assign->changwat_end])->one()->changwat_name;
    ?>
<br/>
        <b>ลูกค้าต้นทาง : </b>
        <?php 
    $cus_s = $customer_model->find()->where(['cus_id' => $assign->cus_start])->one();
    echo $cus_s->company;
    ?>
        <b>ที่อยู่ :</b> <?php 
    echo $cus_s->address;
    ?>
<br/>
        <b>ลูกค้าปลายทาง : </b>
        <?php 
    $cus_e = $customer_model->find()->where(['cus_id' => $assign->cus_end])->one();
    echo $cus_e->company;
    ?>
 
        <b>ที่อยู่ : </b><?php 
    echo $cus_e->address;
    ?>
 public function actionPrint_bill_customer($Id = null, $Id2 = null, $cus_id = null)
 {
     //$cus_id = Yii::$app->request->post('cus_id');
     //$assign_id = Yii::$app->request->post('assign_id'); //รูปแบบ 2,3,4
     //$keys = json_encode($assign_id);
     //foreach($keys as $key){
     //$Id = str_replace("]","",str_replace("[", "", $keys));
     //}
     //$Id = implode(",", $IdVal);
     $customer_model = new \app\models\Customer();
     $employer = $customer_model->find()->where(['cus_id' => $cus_id])->one();
     if ($Id == '') {
         $cus = "0";
     } else {
         $cus = $Id;
     }
     $sql = "SELECT * FROM assign WHERE id IN ({$cus})";
     $assign = Yii::$app->db->createCommand($sql)->queryAll();
     if ($Id2 == '') {
         $cus2 = "0";
     } else {
         $cus2 = $Id2;
     }
     $sql2 = "SELECT o.*,a.income,a.transport_date,a.changwat_start,a.changwat_end,a.cus_start,a.cus_end,a.product_type,a.weigh " . "FROM orders_transport_affiliated o INNER JOIN assign_affiliated a ON o.order_id = a.order_id WHERE o.id IN ({$cus2})";
     $assign2 = Yii::$app->db->createCommand($sql2)->queryAll();
     $content = $this->renderPartial('print_bill_customer', ['employer' => $employer, 'assigns' => $assign, 'assigns2' => $assign2]);
     $mpdf = new \mPDF('th', 'A4-P', '0', 'THSaraban');
     $mpdf->WriteHTML($content);
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->Output($employer['company'] . ".pdf", "I");
 }
Пример #7
0
function get_customer($cus_id = null)
{
    $customer = new app\models\Customer();
    $cs = $customer->find()->where(['cus_id' => $cus_id])->one();
    return $cs['company'];
}
Пример #8
0
    echo $config->thaidate($rs['transport_date']);
    ?>
</td>
                    <td>
                        <a href="<?php 
    echo Url::to(['order-transport/view', 'id' => $rs['id']]);
    ?>
">
                            <?php 
    echo $rs['assign_id'];
    ?>
</a>
                    </td>
                    <td>
                        <?php 
    echo $customer->find()->where(['cus_id' => $rs['cus_start']])->one()->company . ' - ';
    echo $customer->find()->where(['cus_id' => $rs['cus_end']])->one()->company;
    ?>
                    </td>
                    <td>
                        <?php 
    echo $changwat->find()->where(['changwat_id' => $rs['changwat_start']])->one()->changwat_name . ' - ';
    echo $changwat->find()->where(['changwat_id' => $rs['changwat_end']])->one()->changwat_name;
    ?>
                    </td>
                    <td style=" text-align: right;"><?php 
    echo $rs['allowance_driver'];
    ?>
</td>
                </tr>
            <?php 
Пример #9
0
        <div class="alert alert-danger">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <?php 
    echo $error;
    ?>
        </div>
    <?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'];
Пример #10
0
<?php

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
//use yii\grid\GridView;
use kartik\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\OrderTransportSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$model_customer = new app\models\Customer();
$result_cus = $model_customer->find()->where(['cus_id' => $cus_id])->one();
$this->title = 'ออกบิลแจ้งหนี้บริษัท ' . $result_cus['company'];
$this->params['breadcrumbs'][] = $this->title;
?>

<button type="button" id="print_bill" class="btn btn-default"><i class="fa fa-print"></i> พิมพ์บิลที่เลือก</button>
<br/><br/>
<div class="orders-transport-index">

    <?php 
$columns = [['class' => 'yii\\grid\\SerialColumn'], 'id', ['class' => 'kartik\\grid\\CheckboxColumn', 'headerOptions' => ['class' => 'kartik-sheet-style']], 'assign_id', ['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'] . ")";