<div class="content-wrapper">
    <section class="content-header">
        <?=$this->partial('layout/breadcrumb')?>

        <h1 class="pull-right">
            <a href="<?=$this->url('finance-payable');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?=$this->translate('返回应付账款列表')?></a>
            <?=$this->HelpUrl('financePayableView')?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?=$this->translate('应付账款详情')?></h3>
                    </div>

                    <div class="box-body">
                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('入库单号')?>：</b><?=$this->escapeHtml($this->warehouseOrder->getWarehouseOrderSn());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('仓库')?>：</b><?=$this->escapeHtml($this->warehouseOrder->getOneWarehouse()->getWarehouseName());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('状态')?>：</b><?=$this->PurchaseHelper()->orderState($this->warehouseOrder->getWarehouseOrderState());?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-xs-12 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('入库备注')?>：</b><?=$this->escapeHtml($this->warehouseOrder->getWarehouseOrderInfo());?>
                                </div>
                            </div>
                        </div>

                        <hr />
                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('采购单号')?>：</b><?=$this->escapeHtml($this->orderInfo->getPOrderSn());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商')?>：</b><?=$this->escapeHtml($this->orderInfo->getOneSupplier()->getSupplierName());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('付款方式')?>：</b><?=$this->PurchaseHelper()->orderPayment($this->orderInfo->getPaymentCode());?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商联系人')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierContacts());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商手机')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierPhone());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('供应商座机')?>：</b><?=$this->escapeHtml($this->orderInfo->getSupplierTelephone());?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-xs-12 form-group">
                                <div class="col-sm-12">
                                    <b><?=$this->translate('备注')?>：</b><?=$this->escapeHtml($this->orderInfo->getPOrderInfo());?>
                                </div>
                            </div>
                        </div>

                        <div class="box-header">
                            <h4 class="box-title"><?=$this->translate('采购商品')?></h4>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th width="15%"><?=$this->translate('商品编号')?></th>
                                    <th width="20%"><?=$this->translate('商品名称')?></th>
                                    <th><?=$this->translate('商品规格')?></th>
                                    <th><?=$this->translate('单位')?></th>
                                    <th><?=$this->translate('采购单价')?></th>
                                    <th><?=$this->translate('采购数量')?></th>
                                    <th width="10%"><?=$this->translate('采购总价')?></th>
                                </tr>
                                </thead>

                                <?php if($this->warehouseOrder->getWarehouseOrderState() == 3) { ?>
                                    <?php foreach ($this->orderGoods as $goodsValue) { ?>
                                        <tr>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsNumber())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsName())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsSpec())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsUnit())?></td>
                                            <td><?=$this->erpCurrencyFormat($goodsValue->getWarehouseGoodsPrice())?></td>
                                            <td><?=$goodsValue->getWarehouseGoodsBuyNum()?></td>
                                            <td><?=$this->erpCurrencyFormat($goodsValue->getWarehouseGoodsAmount())?></td>
                                        </tr>
                                    <?php } ?>
                                <?php } else { ?>
                                    <?php foreach ($this->orderGoods as $goodsValue) { ?>
                                        <tr>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsNumber())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsName())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsSpec())?></td>
                                            <td><?=$this->escapeHtml($goodsValue->getGoodsUnit())?></td>
                                            <td><?=$this->erpCurrencyFormat($goodsValue->getPGoodsPrice())?></td>
                                            <td><?=$goodsValue->getPGoodsBuyNum()?></td>
                                            <td><?=$this->erpCurrencyFormat($goodsValue->getPGoodsAmount())?></td>
                                        </tr>
                                    <?php } ?>
                                <?php } ?>
                                <tr>
                                    <td colspan="5"></td>
                                    <td colspan="2" class="text-right"><b><?=$this->translate('采购金额合计')?>：</b><?=$this->erpCurrencyFormat($this->payableInfo->getPaymentAmount())?></td>
                                </tr>
                                <tr>
                                    <td colspan="5"></td>
                                    <td colspan="2" class="text-right"><b class="text-green"><?=$this->translate('已付金额合计')?>：</b><?=$this->erpCurrencyFormat($this->payableInfo->getFinishAmount())?></td>
                                </tr>
                            </table>
                        </div>

                        <div class="box-header">
                            <h4 class="box-title"><?=$this->translate('付款记录')?></h4>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th width="10%"><?=$this->translate('付款时间')?></th>
                                    <th width="10%"><?=$this->translate('付款金额')?></th>
                                    <th width="15%"><?=$this->translate('付款人')?></th>
                                    <th width="10%"><?=$this->translate('付款凭证')?></th>
                                    <th width="30%"><?=$this->translate('付款备注')?></th>
                                    <th width="10%"><?=$this->translate('操作人')?></th>
                                    <th width="15%"><?=$this->translate('操作时间')?></th>
                                </tr>
                                </thead>
                                <?php if($this->payableLogList) foreach ($this->payableLogList as $log) { ?>
                                    <tr>
                                        <td><?=date("Y-m-d", $log->getPayLogPaytime())?></td>
                                        <td><?=$this->erpCurrencyFormat($log->getPayLogAmount())?></td>
                                        <td><?=$this->escapeHtml($log->getPayLogUser())?></td>
                                        <td>
                                            <?php if($log->getPayFile()) { ?>
                                                <a href="<?=$this->basePath($log->getPayFile())?>" title="<?=$this->translate('点击查看')?>" target="_blank"><i class="fa fa-picture-o"></i></a>
                                            <?php } else echo $this->translate('无') ?>
                                        </td>
                                        <td><?=$this->escapeHtml($log->getPayLogInfo())?></td>
                                        <td><?=$this->escapeHtml($log->getOneAdmin()->getAdminName())?></td>
                                        <td><?=date("Y-m-d H:i:s", $log->getPayLogAddtime())?></td>
                                    </tr>
                                <?php } ?>
                            </table>
                        </div>

                    </div>

                </div>


            </div>
        </div>

    </section>

</div>