public function actionDetail() { $id = Yii::$app->request->get('id', 0); $customer = new \app\models\Customer(); $user = $customer->getCustomerById($id); return $this->render('detail', ['user' => $user]); }
<style type="text/css"> body{color: #666666; font-size: 12px;} 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; $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
<style type="text/css"> table tr th{ white-space: nowrap;} table tr td{ white-space: nowrap;} </style> <?php use yii\helpers\Url; use app\models\Driver; $customer = new app\models\Customer(); $config = new app\models\Config_system(); $order = new app\models\OrdersTransport(); function get_driver($driver_id = null) { $rs = Driver::find()->where(['id' => $driver_id])->one(); return $rs['name'] . '-' . $rs['lname']; } ?> <table class="table table-bordered table-striped" id="history_truck"> <thead> <tr> <th>#</th> <th>รถคันที่</th> <th>รหัสปฏิบัติงาน</th> <th>วันที่(ไป - กลับ)</th> <th>คนขับ</th> <th>ผู้ว่าจ้าง</th> <th style=" text-align: center;">รายได้</th> </tr> </thead> <tbody> <?php
<style type="text/css"> body{color: #666666; font-size: 12px;} table tr td{ border-left: #000 solid 1px; border-bottom: #000 solid 1px; padding: 5px;} table tr th{ border-left: #000 solid 1px; border-bottom: #000 solid 1px; border-top: #000 solid 1px; padding: 5px; text-align: left; font-weight: normal;} table{ border-right: #000 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(); $thaibaht = new app\models\Thaibaht(); $company_model = new \app\models\Company(); $company = $company_model->find()->one(); $account_model = new \app\models\Account(); $account = $account_model->find()->where(['status' => 1])->one(); ?> <!-- #ข้อมูลใบปฏิบัติงาน Comment By Kimniyom --> <div style=" position: absolute; left: 50px; top: 30px;"> <div style="width: 80px;"> <img src="<?php echo Url::to('@web/web/uploads/logo/' . $company['logo'], true); ?>
<style type="text/css"> body{color: #666666; font-size: 12px;} 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: normal;} table{ border-right: #000000 solid 1px;} table tr th p{ margin-bottom: 10px;} </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(); ?> <!-- #ข้อมูลใบปฏิบัติงาน Comment By Kimniyom --> <div style=" width: 100%; position: relative;"> <div style="width: 80px; float: left;"> <img src="<?php echo Url::to('@web/web/images/logo.jpg'); ?> "/> </div> <div style="float: left; padding-top: 5px;"> </div> </div>
</style> <?php use yii\helpers\Html; //use yii\widgets\DetailView; use kartik\date\DatePicker; use yii\helpers\ArrayHelper; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model app\models\OrdersTransport */ $this->title = $model->order_id; $this->params['breadcrumbs'][] = ['label' => 'ใบสั่งงาน(จ้างบริษัทรถร่วม)', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $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(); $order_model = new \app\models\OrdersTransportAffiliated(); ?> <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> <p> <?php echo Html::a('<i class="fa fa-pencil"></i> แก้ไขใบสั่งงาน', ['update', 'id' => $model->id], ['class' => 'btn btn-default btn-xs']);
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"); }
function get_customer($cus_id = null) { $customer = new app\models\Customer(); $cs = $customer->find()->where(['cus_id' => $cus_id])->one(); return $cs['company']; }
<?php use yii\helpers\Url; $changwat = new app\models\Changwat(); $customer = new \app\models\Customer(); $config = new \app\models\Config_system(); ?> <div class="box box-info table-responsive"> <table class="table table-striped table-bordered"> <thead> <tr> <th>#</th> <th>วันที่</th> <th>ใบสั่งงาน</th> <th>ลูกค้า</th> <th>ระยะทาง</th> <th style=" text-align: center;">เบี้ยเลี้ยง</th> </tr> </thead> <tbody> <?php $i = 0; foreach ($result as $rs) { $i++; ?> <tr> <td><?php echo $i; ?> </td> <td><?php
?> <div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</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();
<?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'] . ")";