<?php
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use home\modules\receivable\models\Billing;
use home\modules\receivable\models\BillingCategory;
use home\modules\contract\models\Contract;
use home\models\Attachment;
use common\models\User;

/* @var $this \yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \home\modules\project\models\Project */

$this->title = '开票详情';
?>

<!--container-->
<div class="container manage-project fix">
  <?= $this->render('@home/views/site/_left-menu') ?>

    <!--manage-left -->
    <div class="manage-right">
        <div class="tab-column tab-manage">
            <div class="tab-right">
                <button type="button" title="新增开票记录" data-url='<?= Url::to([$this->context->id . '/create']) ?>' data-height="200" data-title='新增开票记录' data-width="530" class="btn btn-default btn-task open-dialog">
                    <i class="icon-plus"></i>
                </button>
            </div>
            <p class="caption">开票详情</p>
        </div>
        <div class="task-title">
            <p class="lefttitle"><span>发票项目：</span><?= $model['invoice_name'] ?>(<?= $model['invoice_no'] ?>)&nbsp;&nbsp; 
                <span>合同名称：</span><?= isset($model->contract)?$model->contract->name:'' ?> &nbsp;&nbsp;
                <span>开票类别：</span><?= BillingCategory::getNameWithAllParents($model['category_id']) ?>
            </p>
        </div>
        <div class="mgt10">
            <table class="table task-table taskdetail-table">
                <tr>
                    <td width="20%" class="table-blue">合同名称</td>  
                    <td colspan="3">
                        <a target="_blank" href="<?= isset($model->contract) ? Url::to(['/contract/contract/detail', 'id' => $model->contract['contract_id']]): 'javascript:;' ?>">
                            <?= isset($model->contract)?$model->contract['name']:'' ?>
                        </a>
                    </td>
                </tr>
                <tr>
                    <td width="20%" class="table-blue">发票号码</td>  
                    <td width="30%"><?= $model->invoice_no ?></td>
                    <td width="20%" class="table-blue">发票项目</td>
                    <td width="30%"><?= $model->invoice_name ?></td>
                </tr>
                <tr>
                    <td width="20%" class="table-blue">发票金额</td>  
                    <td width="30%"><?= $model->invoice_money ?></td>
                    <td width="20%" class="table-blue">发票日期</td>
                    <td width="30%"><?= date('Y-m-d', $model->invoice_time) ?></td>
                </tr>
                <tr>
                    <td width="20%" class="table-blue">发票抬头</td>  
                    <td width="30%"><?= $model->vbrk ?></td>
                    <td width="20%" class="table-blue">开票人</td>
                    <td width="30%"><?= $model->drawer ?></td>
                </tr>
            </table>
        </div>
    <!--manage-right--> 
</div>
<!--container-->
</div>