payment_log.html 7.78 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>单据打印</title>
    <style>
        body {
            font-size: 14px;
            color: #000;
        }

        ul, li, table, td, th, tr, a{
            margin: 0;
            padding: 0;
        }

        .main {
            width: 790px;
            margin: auto;
        }

        .title {
            font-size: 16px;
            text-align: center;
        }
        .company{
            font-size: 16px;
            text-align: center;
            font-weight: bold;
        }

        .type {
            padding: 5px 10px;
        }

        .type0 {
            float: left;
            width: 25%;
            text-align: left;
        }
        .type5 {
            float: left;
            width: 25%;
            text-align: left;
        }

        .type1 {
            float: left;
            width: 20%;
            text-align: left;
        }
        .type11 {
            float: left;
            width: 30%;
            text-align: left;
        }

        .type2 {
            float: left;
            width: 12%;
            text-align: right;
        }
        .type4 {
            float: left;
            width: 13%;
            text-align: right;
        }

        .clear {
            clear: both;
        }

        table {
            border: 1px solid #000;
            width: 100%;
            border-collapse: collapse
        }

        td {
            border: 1px solid #000;
            padding: 1px 5px;
        }

        .t1 {
            font-weight: bold;
            text-align: center;
        }

        .text-center {
            text-align: center;
        }

        .text-right {
            text-align: right;
        }
        .type3{
            float: left;
            width: 25%;
            text-align: left;
        }
        .infos{
            padding: 5px 10px;
        }
        .border1{
            position: relative;
        }
        .border1 span{
            position: absolute;
            bottom: 0;
            left: 80px;
            width: 100px;

            border-bottom: 1px solid #000;
        }
    </style>
    <style>
        /*纯CSS写法*/
        .checkbox-group input{display:none;opacity:0;}
        .checkbox-group input[type=checkbox]+label, .checkbox-group input[type=radio]+label {
            line-height: 1;
            position: relative;
            margin:2px;
        }
        .checkbox-group input[type=checkbox]+label:before, .checkbox-group input[type=radio]+label:before {
            line-height: 20px;
            display: inline-block;
            width: 18px;
            height: 18px;
            margin-right: 8px;
            content: '';
            color: #fff;
            border: 1px solid #dce4e6;
            background-color: #f3f6f8;
            border-radius: 3px;
        }
        .checkbox-group input[type=checkbox]:checked+label:before,.checkbox-group input[type=radio]:checked+label:before{
            content:'\2713';
            color:#fff;
            background-color: #31b968;
            border-radius: 3px;
            font-size:23px;
            text-align: center;
            border-color: #000000;
        }
        .noprint { display:none;}
        .print_btn,#close_btn{ display:none; }
        @page {
            margin-bottom: 0mm;
            margin-top: 0mm
        }
    </style>
</head>
<body>
<div>
    <input type="button" class="print_btn" onclick="preview(1)" value="打印">
    <a id="close_btn" href="javascript:window.opener=null;window.open('','_self');window.close();">关闭</a>
</div>
<!--startprint-->
<div>
    <div class="main">
        <div class="company">{$company_name|default=''}</div>
        <div class="title">采购付款一览表</div>
        <div>
            <table>
                <tr class="t1">
                    <td>供应商编号</td>
                    <td>供应商名称</td>
                    <td>业务类型</td>
                    <td>单据日期</td>
                    <td>单据编号</td>
                    <td>采购金额</td>
                    <td>优惠金额</td>
                    <td>优惠后金额</td>
                    <td>本次付款</td>
                    <td>应付款余额</td>
                    <td>付款率</td>
                    <td>备注</td>
                </tr>
                {foreach name="list" item="info" key="k"}
                <tr>
                    <td>{$info.suppliers_code|default=''}</td>
                    <td>{$info.supplyer_name|default=''}</td>
                    <td>{$info.business_type|default=''}</td>
                    <td>{if condition="!empty($info.bill_time)"}{$info.bill_time|date='Y-m-d',###}{/if}</td>
                    <td>{$info.bill_codes|default=''}</td>
                    <td>{$info.purchase_money|default=''}</td>
                    <td>{$info.discount_money|default=''}</td>
                    <td>{$info.real_money|default=''}</td>
                    <td>{$info.pay_money|default=''}</td>
                    <td>{$info.give_money|default=''}</td>
                    <td>{$info.payment_rate|default=''}</td>
                    <td>{$info.reamrk|default=''}</td>
                </tr>
                {/foreach}
            </table>
        </div>
    </div>
</div>
<!--endprint-->
<script>
    bdhtml=window.document.body.innerHTML;
    // 打印开始的标志
    sprnstr="<!--startprint-->";
    // 打印结束的标志
    eprnstr="<!--endprint-->";
    // 从打印开始的位置截取到末尾
    prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
    // 从开始截取到打印结束的位置
    prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
    // 替换html
    window.document.body.innerHTML=prnhtml;
    // 打印
    HKEY_Root="HKEY_CURRENT_USER";
    HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
    try{
        var Wsh=new ActiveXObject("WScript.Shell");
        HKEY_Key="header";
        //设置页眉(为空) 根据你自己要设置的填入
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
        HKEY_Key="footer";
        //设置页脚(为空) 根据你自己要设置的填入
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
        HKEY_Key="margin_bottom";
        //设置下页边距(0) 根据你自己要设置的填入
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0");
        HKEY_Key="margin_left";
        //设置左页边距(0) 根据你自己要设置的填入
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"1");
        HKEY_Key="margin_right";
        //设置右页边距(0)
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0");
        HKEY_Key="margin_top";
        //设置上页边距(8)
        Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"1");
    }catch(e){}
    window.print();
    window.document.body.innerHTML = bdhtml;
    var beforePrint = function() {
        //window.print监听打印确认取消
        console.log('Functionality to run before printing.');
    };
    var afterPrint = function() {
        console.log('Functionality to run after printing');
        document.getElementById('close_btn').click();
    };
    if (window.matchMedia) {
        var mediaQueryList = window.matchMedia('print');
        mediaQueryList.addListener(function(mql) {
            if (mql.matches) {
                beforePrint();
            } else {
                afterPrint();
            }
        });
    }
    window.onbeforeprint = beforePrint;
    window.onafterprint = afterPrint;
</script>
</body>
</html>