<!DOCTYPE html>
<html style="height: 100%;min-height: 100%;">
<head>
    <meta charset="utf-8">
    <title>打印出库管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <style>
        h3, td, th{color: #000000}
        .layui-table tr td, .layui-table th {border-color: #000000;height: 1px}
    </style>
</head>
<body style="background-color: #fff;height: 100%;min-height: 100%;">

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" pad15>
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">

                    <div id="print_div">
                        <h3 align="center" style="font-weight: bold;letter-spacing:8px;"><span id="company_name"></span></br>原 料 出 库 明 细</h3>
                        <table class="layui-table">



                            <tr id="tr_item_total"></tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="../../layuiadmin/layui/layui.js?t=1"></script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'utils'], function() {
        var $ = layui.$;
        var utils = layui.utils;
        var admin = layui.admin;

        admin.req({
            url: '/order/deliver_query/detail/'
            , done: function (data) {
                var items_data = data.data;
                var cols = '';
                cols += '<tr>\n' +
                    '                        <td align="left" width="60">单号</td>\n' +
                    '                        <td align="left" width="60">名称</td>\n' +
                    '                        <td align="left" width="60">代码</td>\n' +
                    '                        <td align="left" width="100">入库单号</td>\n' +
                    '                        <td align="right" width="60">数量</td>\n' +
                    '                        <td align="right" width="60">单价</td>';
                if (utils.isHasPermissions('goods.view_goods_cost')) {
                    cols += '<td align="right" width="70">合计成本</td>';
                }
                cols += '<td align="right" width="70">合计销售价</td>\n' +
                    '                        <td align="left" width="60">仓别</td>\n' +
                    '                        <td align="left" width="70">创建时间</td>\n' +
                    '                        <td align="left" width="60">审核人</td>\n' +
                    '                        <td align="left" width="60">备注</td>\n' +
                    '                    </tr>';
                $('#tr_item_total').before(cols);
                for (var n in items_data) {
                    var cols_data = '';
                    if (items_data[n].entry_no == null){
                        items_data[n].entry_no =''
                    }
                    if (items_data[n].notes == null){
                        items_data[n].notes = '';
                    }
                    cols_data += "<tr>\n" +
                        "                        <td>" + items_data[n].no + "</td>\n" +
                        "                        <td>" + items_data[n].name + "</td>\n" +
                        "                        <td>" + items_data[n].model + "</td>\n" +
                        "                        <td>" + items_data[n].entry_no + "</td>\n" +
                        "                        <td align=\"right\">" + items_data[n].count + "</td>\n" +
                        "                        <td align=\"right\">" + items_data[n].price + "</td>\n";
                    if (utils.isHasPermissions('goods.view_goods_cost')) {
                        cols_data += "                        <td align=\"right\">" + items_data[n].total_cost + "</td>\n";
                    }
                    cols_data += "                        <td align=\"right\">" + items_data[n].total_amount + "</td>\n" +
                        "                        <td>" + items_data[n].warehouse + "</td>\n" +
                        "                        <td>" + items_data[n].happen_time + "</td>\n" +
                        "                        <td>" + items_data[n].create_user + "</td>\n" +
                        "                        <td>" + items_data[n].notes + "</td>\n" +
                        "                    </tr>";
                    $('#tr_item_total').before(cols_data);
                }
            }
        });
    });
    parent.layui.submitChild = function () {
        window.scrollTo(0,0);
        doPrint();
        parent.layui.onSubmitChild();
    };

    function doPrint() {
        var $ = layui.$;
        document.body.innerHTML=$('#print_div').html();
        window.print();
    }
</script>
</body>
</html>

