<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right">
            <a href="<?php echo $this->url('sales-order');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回销售订单列表'); ?></a>
            <button type="button" onclick="toPrint();" class="btn btn-primary btn-sm"><i class="fa fa-print" aria-hidden="true"></i> <?php echo $this->translate('点击打印'); ?></button>
            <?php echo $this->HelpUrl('salesOrderList'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12" id="to-print-info">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?php echo $this->translate('销售订单');?></h3>
                    </div>

                    <div class="box-body">
                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('销售单号'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getSalesOrderSn());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('订单状态'); ?>：</b><?php echo $this->salesHelper()->salesOrderState($this->orderInfo->getSalesOrderState(), 2);?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('付款方式'); ?>：</b><?php echo $this->salesHelper()->orderReceivables($this->orderInfo->getReceivablesCode());?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('客户'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getOneCustomer()->getCustomerName());?>
                                </div>
                            </div>
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('客户联系人'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getCustomerContacts());?>
                                </div>
                            </div>

                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('客户手机'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getCustomerPhone());?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('客户座机'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getCustomerTelephone());?>
                                </div>
                            </div>
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('收货地址'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getCustomerAddress());?>
                                </div>
                            </div>
                            <div class="col-xs-4 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('销售时间'); ?>：</b><?php echo date("Y-m-d H:i:s", $this->orderInfo->getCreateTime());?>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-8 form-group">
                                <div class="col-sm-12">
                                    <b><?php echo $this->translate('备注'); ?>：</b><?php echo $this->escapeHtml($this->orderInfo->getSalesOrderInfo());?>
                                </div>
                            </div>
                        </div>

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

                                <?php
                                foreach ($this->orderGoods as $goodsValue) {
                                    ?>
                                    <tr>
                                        <td><?php echo $this->escapeHtml($goodsValue->getGoodsNumber());?></td>
                                        <td><?php echo $this->escapeHtml($goodsValue->getGoodsName());?></td>
                                        <td><?php echo $this->escapeHtml($goodsValue->getGoodsSpec());?></td>
                                        <td><?php echo $this->escapeHtml($goodsValue->getGoodsUnit());?></td>
                                        <td><?php echo $this->erpCurrencyFormat($goodsValue->getSalesGoodsPrice());?></td>
                                        <td><?php echo $this->escapeHtml($goodsValue->getSalesGoodsSellNum());?></td>
                                        <td><?php echo $this->erpCurrencyFormat($goodsValue->getSalesGoodsTax());?></td>
                                        <td><?php echo $this->erpCurrencyFormat($goodsValue->getSalesGoodsAmount());?></td>
                                    </tr>
                                <?php } ?>
                                <tfoot>
                                <tr>
                                    <td colspan="6"></td>
                                    <td colspan="2" class="text-right"><b><?php echo $this->translate('销售金额合计'); ?>：</b><span id="order-amount"><?php echo (isset($orderInfo) ? $this->erpCurrencyFormat($orderInfo->getSalesOrderAmount()) : 0); ?></span></td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>

                        <div class="box-header no-print">
                            <h4 class="box-title"><?php echo $this->translate('操作记录'); ?></h4>
                        </div>
                        <div class="box-body table-responsive no-padding no-print">
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th width="30%"><?php echo $this->translate('状态'); ?></th>
                                    <th width="30%"><?php echo $this->translate('操作人'); ?></th>
                                    <th width="40%"><?php echo $this->translate('操作时间'); ?></th>
                                </tr>
                                </thead>

                                <tbody>
                                <?php
                                foreach ($this->salesOperLog as $logValue) {
                                    ?>
                                    <tr>
                                        <td><?php echo $this->salesHelper()->salesOrderState($logValue->getOrderState(), 2);?></td>
                                        <td><?php echo $this->escapeHtml($logValue->getOperUser());?></td>
                                        <td><?php echo date("Y-m-d H:i:s", $logValue->getOperTime());?></td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>

                    </div>

                </div>


            </div>
        </div>

    </section>

</div>