|
- <?php
-
- use backend\modules\motorcade\assets\motorcadeUIAsset;
- use backend\modules\motorcade\models\BusOrder;
- use yii\helpers\Html;
- use backend\modules\motorcade\models\BusOrderStatusLog;
- use backend\modules\motorcade\models\RunBusExpenses;
- use backend\modules\motorcade\models\BusItinerary;
- use common\models\BaseSupplier;
- use kartik\grid\GridView;
- use yii\widgets\Pjax;
- use common\components\zActiveForm;
- use yii\helpers\ArrayHelper;
-
- /* @var $this yii\web\View */
- /* @var $model BusOrder */
- /* @var $data array */
- #endregion
- motorcadeUIAsset::addScript($this, '/js/motorcade.js');
- motorcadeUIAsset::addScript($this, '/js/add_car.js?v=0.0.1');
- motorcadeUIAsset::addScript($this, '/js/detail.js?v=' . time());
- $this->title = $model->id;
- $this->params['breadcrumbs'][] = ['label' => 'Bus Orders', 'url' => ['index']];
- $this->params['breadcrumbs'][] = $this->title;
- $this->registerJs('var initFlag = false;', $this::POS_BEGIN);
- $this->registerJs('$(".dynamicform_wrapper").on("afterInsert", function(e, item) {
- $(item).find(\'.timepicker_box input\').val(\'00:00\').prop(\'disabled\', false);
- z.timePicker();
- });');
- $cancel = $model->run_status != '439';
-
- $single_arr = $data['bus_depart']['single'];
- $str = implode(',', $single_arr);
- $this->registerJs('var depart_single=[' . $str . '];', $this::POS_BEGIN);
- ?>
- <style>
- .col_5 {
- width: 520px;
- }
-
- .th_center {
- text-align: center;
- }
-
- .my_label {
- width: 100px !important;
- }
- </style>
- <input type="hidden" id="id" value="<?= $model->id ?>"/>
- <input type="hidden" id="isDetail" value="<?= $model->id ?>"/>
- <div class="iframe_box portlet light bordered">
-
- <ul class="nav nav-tabs choose_op nav_title">
- <li role="presentation" data-toggle="tab" class="active" id=""
- onclick="tab(<?= $model->id ?>, 1)">
- <a data-toggle="tab" href="#order_info" onclick="">出车详情</a>
- </li>
- <li role="presentation" data-toggle="tab" class="" id=""
- onclick="tab(<?= $model->id ?>,2)">
- <a data-toggle="tab" href="#order_log" onclick="">操作日志</a>
- </li>
- </ul>
-
-
- <div class="iframe_box portlet light bordered">
- <div role="tabpanel" class="tab-pane active" id="order_info">
- <?php
- Pjax::begin(['id' => 'bus_order_detail', 'timeout' => false]);
- ?>
- <div style="display: inline-flex;border: 1px solid lightgray;width: 100%">
- <div style="padding-top: 20px;padding-left: 20px;display: inline-block;width: 25%;height: 158px;border-right: 1px solid #ddd;vertical-align: top">
- <div class="">
- <span id="top-order-id" style="color: gray;">出车单号:<?= $model->bus_number ?></span>
- <span id="ludan" class="label label-primary hide_f" style="margin-left: 10px;"></span>
- </div>
- <div style="margin-top: 25px;" id="top-order-status-main">
- <span id="top-order-status"
- style="font-size: 16px;"><?= BusOrder::bus_order_status_array[$model->run_status] ?></span>
- <span style="margin-left: 15px;margin-right: 15px;">
- <?= $model->run_status == 434 ? '<label class="separator"> </label>' . $model::bus_order_status_array[$model->send_status] : '' ?>
- <?= $model->run_status == 438 ? '<label class="separator"> </label>' . $model::bus_order_status_array[$model->finance_status] : '' ?></span>
- <span></span>
- </div>
- <div style="margin-top: 25px;">
- <span id="use_bus_org">用车单位:<?= $model->department == true ? $model->department->depart_name : '' ?></span>
- <span></span>
- </div>
- <div style="margin-top: 10px;">
- <span style="opacity: 0;">空空空空:</span>
- <span id=""></span>
- </div>
- </div>
-
- <div style="display: inline-block;width: 73%;vertical-align: top;">
- <!--中间五个环-->
- <div style="padding-top: 20px;">
- <div id="fuelux-wizard" class="row-fluid" data-target="#step-container">
- <ul class="wizard-steps">
- <li data-target="#step1" class="<?= $cancel ? 'active' : '' ?>">
- <span class="step">1</span>
- <span class="title">添加出车</span>
- <span class="title order_sub_date" id="create_date"></span>
- <span class="title order_sub_time" id="create_time"></span>
- </li>
- <li data-target="#step2"
- class="<?= ($model->send_status == 442 && $cancel) ? "active" : "" ?>">
- <span class="step">2</span>
- <span class="title">调度确认</span>
- <span class="title order_sub_date" id="pay_date"></span>
- <span class="title order_sub_time" id="pay_time"></span>
- </li>
- <li data-target="#step3"
- class="<?= (in_array($model->run_status, [434, 435, 436]) || !$cancel) ? "" : "active" ?>">
- <span class="step">3</span>
- <span class="title">出车准备</span>
- <span class="title order_sub_date" id="send_date"></span>
- <span class="title order_sub_time" id="send_time"></span>
- </li>
- <li data-target="#step4"
- class="<?= (in_array($model->run_status, [434, 435, 436, 437]) || !$cancel) ? "" : "active" ?>">
- <span class="step">4</span>
- <span class="title">出车</span>
- <span class="title order_sub_date" id="arr_date"></span>
- <span class="title order_sub_time" id="arr_time"></span>
- </li>
- <li data-target="#step5"
- class="<?= ($model->finance_status == 444 || !$cancel) ? "" : "active" ?>">
- <span class="step">5</span>
- <span class="title">出车完报账</span>
- <span class="title order_sub_date" id="finish_date"></span>
- <span class="title order_sub_time" id="finish_time"></span>
- </li>
- <li data-target="#step6"
- class="<?= ($model->finance_status == 446 && $cancel) ? "active" : "" ?>">
- <span class="step">6</span>
- <span class="title">报账审核</span>
- <span class="title order_sub_date" id="pay_date"></span>
- <span class="title order_sub_time" id="pay_time"></span>
- </li>
- <li data-target="#step7"
- class="<?= ($model->end_status == 449 && $cancel) ? "active" : "" ?>">
- <span class="step">7</span>
- <span class="title">收支结算</span>
- <span class="title order_sub_date" id="pay_date"></span>
- <span class="title order_sub_time" id="pay_time"></span>
- </li>
- </ul>
- </div>
- </div>
- <hr style="width: 90%"/>
- <div style="padding-left: 30px;">
- <?php
- if (!in_array($model->run_status, [437, 438, 439])) {
- ?>
- <button id="cancel" type="button" class="btn btn-secondary">
- <!--<span class="glyphicon glyphicon-remove-circle"></span> -->取消
- </button>
- <?php
- }
- ?>
- </div>
- </div>
-
- </div>
- <?php
- Pjax::end();
- ?>
- <div id="add-bus" class="panel panel-default" style="margin-top: 20px;">
- <div class="panel-heading">出车需求<span class="label label-sm label-status"></span></div>
- <div class="panel-body">
- <?php
- $form = zActiveForm::begin(['action' => '/motorcade/bus/save-bus', 'id' => 'run-form', 'options' => ['class' => 'form-horizontal']]);
- ?>
- <div class="form-body">
- <div class="" style="padding-left: 50px;padding-top: 10px;">
- <!--第一行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group" id="use_bus_org_id">
- <?= $form->field($model, 'use_bus_org_id', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->dropDownList($data['bus_depart']['data'], ['class' => 'form-control go_select_screen ' . ($model->run_id != 0 ? 'select_screen_run_id run_id' : ''), 'style' => 'width: 172px;']) ?>
- </div>
- <!--出车时间-->
- <div class="form-group">
- <?= $form->field($model, 'run_date', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex;width: auto;padding-right: 0 !important;"><div class="input-group date form_date">' .
- '{input}<span class="input-group-addon ' . ($model->run_id != 0 ? 'run_date_sync"' : '"') . '><span class="glyphicon glyphicon-calendar"></span></span>' .
- '</div>{hint}{error}</div>',
- 'options' => ['class' => 'col_5']])->textInput(['maxlength' => true, 'disabled' => true, 'class' => 'form-control ' . ($model->run_id != 0 ? 'run_id' : '')]) ?>
- </div>
- </div>
- </div>
-
- <!--第二行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'itinerary_name', ['template' => '{label}<div class="col-sm-9 " style="display: inline-flex;">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->textInput(['placeholder' => '输入线路名称', ['class' => 'form-control']]) ?>
- </div>
- <div class="form-group">
- <?= $form->field($model, 'bus_type_res_id', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->dropDownList(ArrayHelper::map($data['bus_type']['data'], 'res_id', 'res_name'), ['class' => 'form-control', 'style' => 'width:172px;']) ?>
- </div>
-
- </div>
- </div>
-
- <!--第三行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'saled_count', ['template' => '{label}<div class="col-sm-9 " style="display: inline-flex;"><div class="">{input}' .
- '</div>{hint}{error}</div>', 'options' => ['class' => 'col_5']])->textInput(['placeholder' => '输入乘客人数', ['class' => 'form-control']]) ?>
- </div>
- <div class="form-group">
- <?= $form->field($model, 'line_type', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->dropDownList(['1' => '省际', '2' => '市内'], ['class' => 'form-control', 'style' => 'width:172px;']) ?>
- </div>
- </div>
- </div>
- <!--第四行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'day_num', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->dropDownList(\backend\modules\motorcade\models\BusOrder::getDayNum(), ['id' => 'stroke_select', 'class' => 'form-control', 'style' => 'width:172px;']) ?>
- </div>
- </div>
- </div>
-
- <!--第五行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="col_5">
- <?php
- $dyModel = $model->itinerary;
- if ($dyModel == null || empty($dyModel)) {
- $dyModel[0] = new BusItinerary();
- }
- \wbraganca\dynamicform\DynamicFormWidget::begin([
- 'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
- 'widgetBody' => '.stroke_tbody', // required: css class selector
- 'widgetItem' => '.line-item', // required: css class
- // 'limit' => 4, // the maximum times, an element can be added (default 999)
- 'min' => 1, // 0 or 1 (default 1)
- 'insertButton' => '.add-item', // css class
- 'deleteButton' => '.remove-item', // css class
- 'model' => $dyModel[0],
- 'formId' => 'run-form',
- 'formFields' => [
- 'station_name'
- ],
- ]); ?>
- <label id="" class="control-label required" aria-required="true"
- style="width: 12%">详细行程</label>
-
- <button type="button" class="btn btn-primary add-item"
- style="margin-left: 15px;"
- onclick="">
- <span class="glyphicon glyphicon-plus"></span> 添加
- </button>
- <div class="form-group" style="margin-left: 76px;margin-top: 16px;">
- <div class="form-inline" style="width:700px;">
-
- <table id="stroke_tbody" class="table table-bordered table-hover"
- style="text-align: center">
- <thead>
- <tr>
- <th class="th_center"> 站点 / 区域</th>
- <th class="th_center"> 上下客</th>
- <th class="th_center"> 出发 / 到达时间</th>
- <th class="th_center"> 操作</th>
- </tr>
- </thead>
- <tbody id="stroke_tbody" class="stroke_tbody">
- <?php
- foreach ((count($model->itinerary_list) > 0 ? $model->itinerary_list : $dyModel) as $key => $itinerary) {
- ?>
- <tr class="stroke_tr line-item">
- <td>
- <?= $form->field($itinerary, "[$key]id")->textInput()->hiddenInput()->label(false);
- echo Html::hiddenInput("tr_no", $key);
- ?>
- <div class="form-group" style="margin-left: 12px;">
- <div class="form-inline">
- <?= $form->field($itinerary, "[$key]station_name")->textInput(['placeholder' => '输入站点 / 区域名称', ['class' => 'form-control go_select_screen']])->label(false)->error(false); ?>
- </div>
- </div>
- </td>
- <td>
- <div class="form-group">
- <div class="form-inline">
- <?= $form->field($itinerary, "[$key]inout_type", ['template' => '<div class="col-sm-8" ><div class="form-group">{input}' .
- '</div>{hint}{error}</div>'])->dropDownList(['108' => '上', '109' => '上下', '110' => '下'], ['class' => 'form-control'])->error(false); ?>
- </div>
- </div>
- </td>
- <td>
- <div class="form-group">
- <div class="form-inline">
- <?= $form->field($itinerary, "[$key]day_seq_id", ['template' => '<div class="col-sm-8" ><div class="form-group">{input}' .
- '</div>{hint}{error}</div>'])->dropDownList(\backend\modules\motorcade\models\BusOrder::getDayNum(), ['class' => 'form-control'])->error(false) ?>
-
- <?= $form->field($itinerary, "[$key]start_time", ['template' => '<div id="time_id' . $key . '" style="margin-left: 40px;" class="timepicker_box">
- <span class="form-inline timepicker">
- <input type="text" class="form-control" value="' . $itinerary['start_time'] . '" name="BusItinerary[' . $key . '][start_time]" disabled>
- <span class="glyphicon glyphicon-time"></span>
- </span>
- <div class="timepicker_select" style="z-index: 10">
- <div class="select_hour_box"></div>
- <div class="select_minute_box"></div>
- </div>
- </div>'])->label(false)->error(false); ?>
- </div>
- </div>
- </td>
- <td style="vertical-align: middle !important;">
- <button type="button"
- class="btn btn-danger remove-item">删除
- </button>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
- <?php \wbraganca\dynamicform\DynamicFormWidget::end(); ?>
- </div>
- </div>
- </div>
- <!--第六行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'remark', ['template' => '{label}<div class="col-sm-9 " style="display: inline-flex;"><div class="">{input}' .
- '</div>{hint}{error}</div>', 'options' => ['class' => 'col_5']])->textInput(['placeholder' => '请输入用车备注', ['class' => 'form-control', 'style' => 'width:90px;']]) ?>
- </div>
- <div class="form-group">
- <?= $form->field($model, 'bus_cost_type', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex;width:140px;">{input}' .
- '{hint}{error}</div>', 'options' => ['class' => 'col_5']])->dropDownList(['477' => '包车计价', '478' => '车座计价'], ['class' => 'form-control ' . ($model->run_id != 0 ? 'select_screen_run_id run_id' : ''), 'style' => 'width:110px;']) ?>
-
- <?= $form->field($model, 'bus_cost', ['template' => '{label}<div class="col-sm-9 " style="display: inline-flex;width:250px;"><div class="input-group form-inline input-group-with-addon" style="width: 120px;margin-left: 15px;">{input}' .
- '<div class="input-group-addon " style="width: auto">元</div></div>{hint}{error}</div>'])->textInput(['class' => 'form-control ' . ($model->run_id != 0 ? 'run_id' : ''), 'placeholder' => '金额', 'style' => ''])->label(false) ?>
- </div>
- </div>
- </div>
- <!--第七行-->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'contacts', ['template' => '{label}<div class="col-sm-9" style="display: inline-flex;width:100px;"><div class="">{input}' .
- '</div>{hint}{error}</div>', 'options' => ['class' => 'col_5']])->textInput(['class' => 'form-control', 'placeholder' => '联系人', 'style' => 'width:100px;']) ?>
- <?= $form->field($model, 'tels', ['template' => '{label}<div class="col-sm-9 " style="display: inline-flex;width:100px;margin-left: 25px;"><div class="">{input}' .
- '</div>{hint}{error}</div>'])->textInput(['class' => 'form-control', 'placeholder' => '联系电话', 'style' => 'width:120px;margin-left:5px;'])->label(false) ?>
- </div>
- </div>
- </div>
- <!-- 第八行 -->
- <div id="single" class="form-group hidden">
- <div class="form-inline">
- <div class="form-group">
- <?= $form->field($model, 'single_contact', ['template' => '{label}<div class="col-sm-9" style="display: inline-flex;"><div class="">{input}' .
- '</div>{hint}{error}</div>', 'options' => ['class' => 'col_5']])->textInput(['class' => 'form-control', 'placeholder' => '收款人', 'style' => 'width:100px;']) ?>
- </div>
- </div>
- </div>
- <!-- 修改按钮 -->
- <div class="form-group">
- <div class="form-inline">
- <div class="form-group">
- <div class="col_5 field-busorder-contacts">
- <label class="control-label" for="busorder-contacts"> </label>
- </div>
- <div class="col-sm-9">
- <?php
- if ($model->finance_lock == 0 && $model->finance_status != 446) {
- echo Html::button('变更', ['class' => 'btn btn-default control', 'onclick' => 'runEditable(this)']);
- }
- ?>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php
- zActiveForm::end();
- ?>
- </div>
- </div>
- </div>
-
- <div id="dispatch-bus" class="panel panel-default" style="margin-top: 20px;">
- <div class="panel-heading">
- <div class="caption">
- 调度安排<span id="send_status"
- class="label label-info"><?= $model::bus_order_status_array[$model->send_status] ?></span>
- </div>
- </div>
- <div class="panel-body">
- <div class="" id="send_detail" style="padding-top: 5px;">
- <?php
- //显示状态,并显示调度的详情,如果没有就显示“等待安排调度”
- $busInfo = $model->bus;
- $driverInfo = $model->driver;
- if ($driverInfo || $busInfo) {
- if ($model->send_type == 1)
- echo '<span class="label label-sm label-outside">外部派车</span>';
- $busOrg = $busInfo->org;
-
- //历史数据原因,有可能没有品牌信息等
- if (!$busOrg)
- $busOrg = new \common\models\BaseSupplier();
- $busBrand = $busInfo->brand;
- if (!$busBrand)
- $busBrand = new \common\models\BaseResource();
- if (!$driverInfo)
- $driverInfo = new \backend\modules\motorcade\models\BaseDriver();
- ?>
-
- <div class="block-group"><label class="detail-title">车价:</label>
- <label class="detail-content"><?= $model->send_cost ?>元 </label>
- <label class="separator">|</label>
- <label class="detail-content"><?= $busOrg ? $busOrg->SUPPLIER_NAME : '' ?></label>
- </div>
- <div class="block-group">
- <label class="detail-title">车辆:</label>
- <label class="detail-content"><?= $busInfo->BUS_NO ?></label>
- <label class="separator">|</label>
- <label class="detail-content"> <?= $busBrand->RES_NAME ?> </label>
- <label class="separator">|</label>
- <label class="detail-content"> <?= $busInfo->SEAT_DESC ?> </label>
- </div>
- <div class="block-group">
- <label class="detail-title">司机:</label>
- <label class="detail-content"><?= $driverInfo->DRIVER_NAME ?> </label>
- <label class="separator">|</label>
- <label class="detail-content"><?= $driverInfo->PHONE_NO ?> </label>
- </div>
- <?php
- } else {
- $driverInfo = $driverInfo == null ? (new \backend\modules\motorcade\models\BaseDriver()) : $driverInfo;
- $busInfo = $busInfo == null ? (new \backend\modules\motorcade\models\BaseBus()) : $busInfo;
- echo '等待安排调度';
- }
- ?>
- </div>
- <div class="act-group row" id="send_action">
- <?php
- if (in_array($model->run_status, [434, 435, 436]) && in_array($model->send_status, [441, 442])) {
- ?>
- <button class="btn-right btn btn-default" id="resend" onclick="resend(<?= $model->id ?>)">
- 重新调度
- </button>
- <?php
- }
- ?>
- </div>
-
- </div>
- </div>
-
- <?php
- Pjax::begin(['id' => '_status-pjax', 'timeout' => false]);
- ?>
- <div id="apply-fee1"></div>
- <div id="apply-fee" class="panel panel-default" style="margin-top: 20px;">
- <div class="panel-heading">
- <div class="caption">
- 收车报账<span
- class="label label-info"><?= BusOrder::bus_order_status_array[$model->finance_status] ?></span>
- </div>
- <div class="tools">
- <a href="javascript:;" class="collapse" data-original-title="" title=""> </a>
- </div>
- </div>
- <div class="panel-body">
- <?php
- $form = zActiveForm::begin(['action' => '/motorcade/bus/save-finance', 'id' => 'finance-form', 'options' => ['class' => 'form-horizontal']]);
- ?>
- <div class="table-title">出车支出</div>
- <?php
- //内部派车和外部派车显示内容不同
- if ($model->send_type == 0) {
- $expense = $model->expense;
- $tmp = [];
- //因里程数需要拆分故处理数组
- if (isset($expense[0])) {
- if ($expense[0]['expense_subject_id'] == 462) {
- $temp = new RunBusExpenses();
- $temp->setAttributes($expense[0]->getAttributes());
- $tmp[0] = $temp;
- $tmp[0]['expense_subject_id'] = 526;
- for ($i = 0; $i < count($expense); $i++) {
- $tmp[$i + 1] = $expense[$i];
- }
- }
- }
- $dataProvider = new \yii\data\ArrayDataProvider([
- 'allModels' => isset($tmp) ? $tmp : $expense,
- ]);
- echo GridView::widget([
- 'dataProvider' => $dataProvider,
- 'summary' => '',
- 'emptyText' => '尚未报账,等待司机报账',
- 'resizableColumns' => false,
- 'responsive' => false,
- 'options' => ['class' => 'apply-table'],
- 'columns' => [
- [
- 'header' => '支出科目',
- 'attribute' => 'subject.TYPE_NAME',
- 'width' => '90px',
- 'hAlign' => 'center'
- ],
- [
- 'header' => '支出方式',
- 'attribute' => 'payType.TYPE_NAME',
- 'width' => '90px',
- 'hAlign' => 'center'
- ],
- [
- 'width' => '130px',
- 'hAlign' => 'center',
- 'header' => '金额',
- 'attribute' => 'expense_value',
- 'value' => function ($model) {
- $str = Html::activeHiddenInput($model, "[{$model->ID}]ID");
- if (in_array($model->expense_subject_id, [462, 463])) {
- $str .= '<div class="input-group">' . Html::activeTextInput($model, "[{$model->ID}]expense_value", ['readonly' => true, 'class' => 'unEditable input-sm form-control', 'id' => 'value' . $model->expense_subject_id, 'style' => 'border: 1px lightgray solid;']) . '<span class="input-group-addon" style="line-height: normal;padding: 0px 10px;">元</span></div>';
- } else if (in_array($model->expense_subject_id, [526])) {
- $model->end_value = intval($model->end_value);
- $model->start_value = intval($model->start_value);
- $str .= '<div class="input-group">' . Html::TextInput('miles', $model->end_value > 0 ? $model->end_value - $model->start_value : '', ['readonly' => true, 'class' => 'unEditable input-sm form-control', 'style' => 'border: 1px lightgray solid;']) . '<span class="input-group-addon" style="line-height: normal;padding: 0px 10px;">公里</span></div>';
- } else {
- $str .= '<div class="input-group">' . Html::activeTextInput($model, "[{$model->ID}]expense_value", ['readonly' => true, 'class' => 'editable input-sm form-control', 'style' => 'border: 1px lightgray solid;']) . '<span class="input-group-addon" style="line-height: normal;padding: 0px 10px;">元</span></div>';
- }
- return $str;
- },
- 'format' => 'raw',
- 'pageSummary' => true
- ],
- [
- 'header' => '明细',
- 'headerOptions' => ['class' => 'col-md-6'],
- 'contentOptions' => ['class' => 'form-inline'],
- 'value' => function ($model) use ($expense) {
- //油电费
- if ($model->expense_subject_id == 526) {
- return "<label class='col-wd-2 text-right label-margin' >开始</label>" . '<div class="input-group" style="display: inline-table;">' .
- Html::activeTextInput($model, "[{$expense[0]->ID}]start_value", ['readonly' => true, 'class' => 'editable input-sm', 'id' => 'mile_start', 'style' => 'border: 1px lightgray solid;width:90px']) . '<span class="input-group-addon" style="line-height: normal;padding:0px 10px">公里</span></div>' .
- "<label class='col-wd-2 text-right label-margin' >结束</label>" . '<div class="input-group" style="display:inline-table">' .
- Html::activeTextInput($model, "[{$expense[0]->ID}]end_value", ['readonly' => true, 'class' => 'editable input-sm', 'id' => 'mile_end', 'style' => 'border: 1px lightgray solid;width:90px']) . '<span class="input-group-addon" style="line-height: normal;padding:0px 10px">公里</span></div>';
- } elseif ($model->expense_subject_id == 463) {
- return "<label class='col-wd-2 text-right label-margin' >开始</label>" . '<div class="input-group" style="display: inline-table;">' .
- Html::activeTextInput($model, "[{$model->ID}]start_value", ['readonly' => true, 'class' => 'editable input-sm', 'id' => 'etc_start', 'style' => 'border: 1px lightgray solid;width:90px']) . '<span class="input-group-addon" style="line-height: normal;padding:0px 10px">元</span></div>' .
- "<label class='col-wd-2 text-right label-margin' >结束</label>" . '<div class="input-group" style="display: inline-table;">' .
- Html::activeTextInput($model, "[{$model->ID}]end_value", ['readonly' => true, 'class' => 'editable input-sm', 'id' => 'etc_end', 'style' => 'border: 1px lightgray solid;width:90px']) . '<span class="input-group-addon" style="line-height: normal;padding:0px 10px">元</span></div>';
- } else {
- return '';
- }
- },
- 'format' => 'raw',
- 'hAlign' => 'left',
- ],
- [
- 'header' => '报账人',
- 'attribute' => 'user.TRUE_NAME',
- 'width' => '100px',
- 'hAlign' => 'center'
- ],
- [
- 'width' => '100px',
- 'hAlign' => 'center',
- 'header' => '报账时间',
- // 'attribute' => 'create_time',
- 'attribute' => function ($model) {
- return substr($model['create_time'], 0, 10);
- }
- ]
- ]
- ]);
- } elseif ($busInfo->ORG_ID) {
- $outsideSupplier = BaseSupplier::find()->joinWith('settleType')->where(['cancel_flag' => 0, BaseSupplier::tableName() . '.ID' => $busInfo->ORG_ID])->one();
- if ($outsideSupplier !== null) {
- $tmpData = ['subject' => '外部用车价', 'settle_type' => $outsideSupplier->settleType->TYPE_NAME,
- 'company' => $outsideSupplier->COMPANY_NAME,
- 'price' => $model->send_cost, 'count' => 1, 'total' => $model->send_cost];
-
- $tmpDataProvider = new \yii\data\ArrayDataProvider([
- 'allModels' => [$tmpData],
- ]);
- echo GridView::widget([
- 'summary' => '',
- 'resizableColumns' => false,
- 'responsive' => false,
- 'options' => ['class' => 'apply-table'],
- 'dataProvider' => $tmpDataProvider,
- 'columns' => [
- [
- 'width' => '13%',
- 'attribute' => 'subject',
- 'header' => '支出科目',
- ],
- [
- 'width' => '13%',
- 'attribute' => 'settle_type',
- 'header' => '结算方式',
- ],
- [
- 'attribute' => 'company',
- 'header' => '结算单位',
- ],
- [
- 'width' => '13%',
- 'attribute' => 'price',
- 'header' => '车价',
- 'value' => function ($item) use ($model) {
- return '<span class="income-span">' . $item['price'] . '</span>'
- . Html::activeTextInput($model, 'send_cost', ['class' => 'hidden form-control income-input'])
- . Html::activeHiddenInput($model, 'id');
- },
- 'format' => 'raw'
- ],
- [
- 'width' => '13%',
- 'attribute' => 'count',
- 'header' => '数量',
- ],
- [
- 'width' => '13%',
- 'attribute' => 'total',
- 'header' => '总计',
- ],
- ]
- ]);
- }
- }
- ?>
- <br/>
- <div class="table-title">出车收入</div>
- <table class="kv-grid-table table table-bordered table-striped kv-table-wrap">
- <thead>
- <tr>
- <th style="width: 13%">收入科目</th>
- <th style="width: 13%">结算方式</th>
- <th style="">结算单位</th>
- <th style="width: 13%">车价</th>
- <th style="width: 13%">数量</th>
- <th style="width: 13%">总计</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $depart = $model->department;
- ?>
- <tr>
- <td>
- 车价<?= $form->field($model, 'id', ['options' => ['class' => '']])->hiddenInput()->label(false)->error(false) ?></td>
- <td><?= $depart ? $depart->settleType->TYPE_NAME : '' ?></td>
- <td><?= $depart ? $depart->depart_name : '' ?></td>
- <td>
- <span class="income-span"><?= $model->busCostType ? ($model->bus_cost_type == 477 ? $model->bus_cost . '元' : $model->bus_cost . '元/次') : '' ?></span>
- <div class="inline-flex income-input hidden">
- <?= $form->field($model, 'bus_cost_type', ['options' => ['class' => 'inline-input']])->dropDownList(['477' => '包车计价', '478' => '车座计价'], ['class' => 'form-control', 'style' => 'width:110px;'])->label(false)->error(false) ?>
- <?= $form->field($model, 'bus_cost', ['options' => ['class' => 'inline-input']])->textInput(['style' => 'width:110px;', 'placeHolder' => '金额'])->label(false)->error(false) ?>
- </div>
- </td>
- <td>
- <span class="income-span"><?= $model->busCostType ? ($model->bus_cost_type == 477 ? 1 : $model->saled_count . '人') : '' ?></span>
- <div class="inline-flex income-input hidden"><?= $form->field($model, 'saled_count', ['options' => ['class' => 'inline-input']])->textInput(['style' => 'width:110px;'])->label(false)->error(false) ?>
- <span style="padding: 7px">人</span></div>
- </td>
- <td><?= $model->busCostType ? $model->bus_cost_type == 477 ? $model->bus_cost : ($model->bus_cost * $model->saled_count) : '' ?></td>
- </tr>
- </tbody>
- </table>
- <?php
-
- zActiveForm::end();
- ?>
- <div class="act-group row">
- <?php
- //变更按钮 未报账 待审核
- if ($model->finance_lock == 0 && in_array($model->finance_status, [BusOrder::STATUS_FINANCE_WAITING, BusOrder::STATUS_FINANCE_SURE, BusOrder::STATUS_FINANCE_REJECT])) {
- ?>
- <button id="finance_change" class="btn btn-default btn-right" style="margin-right: 40px;"
- onclick="financeEditable(this)">
- 变更
- </button>
- <?php if ($model->finance_status == BusOrder::STATUS_FINANCE_WAITING) { ?>
- <button class="btn-right btn btn-default"
- onclick="Reject(<?= $model->id ?>, 'finance_status', '#_status-pjax')"
- data-pjax>驳回
- </button>
- <button class="btn-right btn btn-default"
- onclick="Sure(<?= $model->id ?>, 'finance_status', '#_status-pjax')"
- data-pjax>审核通过
- </button>
- <?php
- }
- }
- if ($model->finance_status == 447) { //被驳回,显示驳回原因
- $statusLog = BusOrderStatusLog::find()->where(['TYPE' => BusOrderStatusLog::$_type_array['FINANCE_STATUS']])->orderBy('CREATE_TIME DESC')->one();
- if ($statusLog) {
- $str = $statusLog->user->TRUE_NAME . ' 于 ' . $statusLog->CREATE_TIME . ' 驳回,原因:' . $statusLog->MSG;
- echo Html::label($str, null, ['class' => 'right label-footer']);
- }
- }
- // if ($model->finance_status == 445) {
- // ?>
- <!---->
- <!-- --><?php
- // }
- ?>
- </div>
- </div>
- </div>
- <div id="settlement1"></div>
- <div id="settlement" class="panel panel-default" style="margin-top: 20px;">
- <div class="panel-heading">
- <div class="caption">
- 收支结算<span class="label label-sm label-status"></span>
- </div>
- </div>
- <div class="panel-body">
- <div class="table-title">收入结算</div>
- <table class="kv-grid-table table table-bordered table-striped kv-table-wrap">
- <thead>
- <tr>
- <th>用车单位</th>
- <th>结算方式</th>
- <th>结算周期</th>
- <th>车价</th>
- <th>结算状态</th>
- <th>结算时间</th>
- <th>操作人</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><?= $depart ? $depart->depart_name : '' ?></td>
- <td><?= $depart ? $depart->settleType->TYPE_NAME : '' ?></td>
- <td><?= $depart ? $depart->settleCycle->TYPE_NAME : '' ?></td>
- <td><?= $model->busCostType ? (strpos($model->busCostType->TYPE_NAME, '人数') === false ? $model->bus_cost : ($model->bus_cost * $model->saled_count)) : '' ?>
- 元
- </td>
- <td><?= $model->getEndStatusLabel() ?></td>
- <?php
- if ($model->end_status == 448) {
- echo '<td>-</td><td>-</td>';
- } else {
- $endStatus = BusOrderStatusLog::find()->where(['BUS_NUMBER' => $model->bus_number, 'TYPE' => BusOrderStatusLog::$_type_array['END_STATUS']])->orderBy('CREATE_TIME DESC')->one();
- if ($endStatus != null) {
- echo "<td>{$endStatus->CREATE_TIME}</td><td>{$endStatus->user->TRUE_NAME}</td>";
- } else {
- echo '<td>-</td><td>-</td>';
- }
- }
- ?>
- </tr>
- </tbody>
- </table>
- <br/>
- <div class="table-title">支出结算</div>
- <table class="kv-grid-table table table-bordered table-striped kv-table-wrap">
- <?php
- //支出结算取决于内部用车还是外部用车
- if ($model->send_type == 0) { //内部
- $fees = RunBusExpenses::find()->where(['bus_number' => $model->bus_number, 'cancel_flag' => 0])->all();
-
- //把费用科目对应的dict_type作为键值,方便读取;
- $tmp = [];
- foreach ($fees as $fee) {
- $tmp[$fee->expense_subject_id] = $fee;
- }
-
- $fees = $tmp;
- ?>
- <thead>
- <tr>
- <th>司机</th>
- <th>车辆</th>
- <th>公里数</th>
- <th>油费</th>
- <th>路桥费</th>
- <th>司贴</th>
- <th>停车费</th>
- <th>餐饮费</th>
- <th>住宿费</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><?= $driverInfo->DRIVER_NAME ?></td>
- <td><?= $busInfo->BUS_NO ?></td>
- <td><?php
- if (isset($fees[$model::$bus_order_fee_array['FEE_OIL']])) {
- $tmp = $fees[$model::$bus_order_fee_array['FEE_OIL']];
- echo $tmp->end_value - $tmp->start_value;
- }
- ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_OIL']]) ? $fees[$model::$bus_order_fee_array['FEE_OIL']]->expense_value : '-' ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_BRIDGE']]) ? $fees[$model::$bus_order_fee_array['FEE_BRIDGE']]->expense_value : '-' ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_DRIVER']]) ? $fees[$model::$bus_order_fee_array['FEE_DRIVER']]->expense_value : '-' ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_PARK']]) ? $fees[$model::$bus_order_fee_array['FEE_PARK']]->expense_value : '-' ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_FOOD']]) ? $fees[$model::$bus_order_fee_array['FEE_FOOD']]->expense_value : '-' ?></td>
- <td><?= isset($fees[$model::$bus_order_fee_array['FEE_HOTEL']]) ? $fees[$model::$bus_order_fee_array['FEE_HOTEL']]->expense_value : '-' ?></td>
- </tr>
- </tbody>
- <?php
- } else if ($model->send_type == 1) {
- $outsideSupplier = BaseSupplier::find()->where(['cancel_flag' => 0, 'ID' => $busInfo->ORG_ID])->one();
- if ($outsideSupplier == null) {
- $outsideSupplier = new BaseSupplier();
- }
- ?>
- <thead>
- <tr>
- <th>外部用车</th>
- <th>结算方式</th>
- <th>结算周期</th>
- <th>车价</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><?= $outsideSupplier->SUPPLIER_NAME ?></td>
- <td><?= $outsideSupplier->settleType ? $outsideSupplier->settleType->TYPE_NAME : '' ?></td>
- <td><?= $outsideSupplier->settleType ? $outsideSupplier->settleCycle->TYPE_NAME : '' ?></td>
- <td><?= $model->send_cost ?></td>
- </tr>
- </tbody>
- <?php
- }
- ?>
- </table>
- <div class="act-group row">
- <!--
- <?php
- //报账审核通过 且 未结算 显示确定驳回按钮
- if ($model->finance_status == 446 && $model->end_status == 448) {
- ?>
- <button class="right btn btn-default" onclick="Reject(<?= $model->id ?>, 'end_status')"
- data-pjax>驳回
- </button>
- <button class="right btn btn-default" onclick="Sure(<?= $model->id ?>, 'end_status')" data-pjax>
- 通过
- </button>
- <?php
- } else if ($model->end_status == 482) { //被驳回,显示驳回原因
- $statusLog = BusOrderStatusLog::find()->where(['TYPE' => BusOrderStatusLog::$_type_array['END_STATUS']])->orderBy('CREATE_TIME DESC')->one();
- if ($statusLog) {
- $str = $statusLog->user->TRUE_NAME . ' 于 ' . $statusLog->CREATE_TIME . ' 驳回,原因:' . $statusLog->MSG;
- echo Html::label($str, null, ['class' => 'right label-footer']);
- }
- }
- ?>
- -->
- </div>
- </div>
- </div>
- </div>
- </div>
- <!--操作日志-->
- <div role="tabpanel" class="tab-pane" id="order_log">
- <div class="table-responsive" style="width: 1000px">
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th>操作人</th>
- <th>操作时间</th>
- <th>操作内容</th>
- </tr>
- </thead>
- <tbody>
- <?php
- if (empty($data['bus_log'])) {
- echo '<tr><td colspan="3" style="text-align: center">无操作日志</td></tr>';
- } else {
- foreach ($data['bus_log'] as $val) {
- echo '<tr>';
- echo "<td>{$val['true_name']}</td>";
- echo "<td>{$val['created_at']}</td>";
- echo "<td>{$val['msg']}</td>";
- echo '</tr>';
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
- </div>
-
- <?php
- Pjax::end();
- ?>
|