<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/webpage/inc/inc.jsp"%>
<Meta charset="UTF-8">
账单打印
Box">
收据打印
<tr>
<td rowspan="2" style="text-align: center;"><a href="https://www.jb51.cc/tag/mingcheng/" target="_blank" class="keywords">名称</a></td>
<td rowspan="2" style="text-align: center;width:80px;">单位</td>
<td rowspan="2" style="text-align: center;width:50px;"><a href="https://www.jb51.cc/tag/shuliang/" target="_blank" class="keywords">数量</a></td>
<td rowspan="2" style="text-align: center;width:50px;">单价</td>
<td colspan="9" style="text-align: center;">金额</td>
<td style="text-align: center;">总金额<b>¥</b><b class="total"></b></td>
</tr>
<tr>
<td style="width: 30px;text-align: center;">佰</td>
<td style="width: 30px;text-align: center;">拾</td>
<td style="width: 30px;text-align: center;">万</td>
<td style="width: 30px;text-align: center;">千</td>
<td style="width: 30px;text-align: center;">百</td>
<td style="width: 30px;text-align: center;">十</td>
<td style="width: 30px;text-align: center;">元</td>
<td style="width: 30px;text-align: center;">角</td>
<td style="width: 30px;text-align: center;">分</td>
<td style="text-align: center;">备注</td>
</tr>
</thead>
<tbody id="tbodyList">
<!-- <tr class="t_money_tr_0">
<td class="td_name_0" style="text-align: center;">{{items.name}}</td>
<td style="text-align: center;">&nbsp;</td>
<td style="text-align: center;">&nbsp;</td>
<td style="text-align: center;">&nbsp;</td>
<td class="hunbit_0" style="text-align: center;">&nbsp;</td>
<td class="debit_0" style="text-align: center;">&nbsp;</td>
<td class="myriabit_0" style="text-align: center;">&nbsp;</td>
<td class="kilbit_0" style="text-align: center;">&nbsp;</td>
<td class="hunders_0" style="text-align: center;">&nbsp;</td>
<td class="decade_0" style="text-align: center;">&nbsp;</td>
<td class="unit_0" style="text-align: center;">&nbsp;</td>
<td class="unitone_0" style="text-align: center;">&nbsp;</td>
<td class="unittwo_0" style="text-align: center;">&nbsp;</td>
<td class="td_remark_0" style="text-align: center;">&nbsp;</td>
</tr> -->
</tbody>
<tfoot>
<!-- <tr>
<td>合计人民币(大写)</td>
<td colspan="13">
<span class="money_num_text">
<i class="num_text_hunbit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>佰<i class="num_text_debit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>拾<i class="num_text_myriabit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>万<i class="num_text_kilbit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>仟<i class="num_text_hunders" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>佰<i class="num_text_decade" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>拾<i class="num_text_unit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">X</i>元<i class="num_text_unitone" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">零</i>角<i class="num_text_unittwo" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">零</i>分<b>¥</b><b class="mtotal"></b>
</span>
</td>
</tr> -->
<tr>
<td>主管</td>
<td colspan="6">会计</td>
<td colspan="7">收款人</td>
</tr>
<tr>
<td colspan="13" style="text-align: center;"><span> &nbsp;白1&nbsp;(存根)&nbsp;黄&nbsp;(收据)&nbsp;绿&nbsp;(记账)&nbsp;蓝&nbsp;(提货)&nbsp;红&nbsp;(核对)&nbsp;白2&nbsp;(确认) </span></td>
<td colspan="1">
<span tdata="pageNO" format="#" ><span style="color: #000000">
第</span><font color="#0000FF">#</font>张</span>
<span tdata="pageCount" format="#"><span style="color: #000000">
共</span><font color="#0000FF">##</font>张</span>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</body>
<script src="<%=staticServPath%>/static/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="<%=staticServPath%>/static/js/public.js" type="text/javascript"></script>
<script src="<%=staticServPath%>/static/plug-in/ng/angular.min.js" type="text/javascript"></script>
<script src="<%=staticServPath%>/static/plug-in/lodop/LodopFuncs.js" type="text/javascript"></script>
<script>
<span style="color: #0000ff">var</span> app = angular.module('myApp'<span style="color: #000000">,[]);
app.controller(</span>'myCtrl',<span style="color: #0000ff">function</span><span style="color: #000000">($scope,$http) {
</span><span style="color: #008000">//</span><span style="color: #008000"> var $scope = $scope;</span>
inputId = window.location.href.split('?')[1].split('&')[0].split('=')[1<span style="color: #000000">];
</span><span style="color: #008000">//</span><span style="color: #008000">请求接口</span>
ajaxJson('GET',webroot + '/bill/printList?ids=' + inputId,'',<span style="color: #0000ff">function</span><span style="color: #000000">(err,rsp) {
</span><span style="color: #0000ff">if</span> (rsp.code == 200<span style="color: #000000">) {
$scope.aa </span>=<span style="color: #000000"> rsp.result;
$scope.data </span>= rsp.result[0<span style="color: #000000">];
$scope.paymentDate </span>= $scope.data.paymentDate.split('-'<span style="color: #000000">);
$scope.customer </span>=<span style="color: #000000"> $scope.data.customer;
$scope.code </span>=<span style="color: #000000"> $scope.data.code;
$scope.total </span>=<span style="color: #000000"> $scope.data.total;
</span><span style="color: #008000">//</span><span style="color: #008000"> $scope.total = 10000.99;</span>
<span style="color: #008000">//</span><span style="color: #008000"> $scope.items = $scope.data.items;</span>
$scope.items =<span style="color: #000000"> [{
money: </span>9<span style="color: #000000">,remark: </span>'备注1'<span style="color: #000000">,name: </span>'01'<span style="color: #000000">
},{
money: </span>9<span style="color: #000000">,name: </span>'01'<span style="color: #000000">
}];
</span><span style="color: #008000">//</span><span style="color: #008000">年月日</span>
$('.time_year').text($scope.paymentDate[0<span style="color: #000000">]);
$(</span>'.time_month').text($scope.paymentDate[1<span style="color: #000000">]);
$(</span>'.time_day').text($scope.paymentDate[2<span style="color: #000000">]);
$(</span>'.customer'<span style="color: #000000">).text($scope.customer);
$(</span>'.code'<span style="color: #000000">).text($scope.code);
$(</span>'.total'<span style="color: #000000">).text($scope.total);
</span><span style="color: #008000">//</span><span style="color: #008000">数据总行数</span>
<span style="color: #0000ff">var</span> itemLen =<span style="color: #000000"> $scope.items.length;
</span><span style="color: #008000">//</span><span style="color: #008000">迭代行数</span>
<span style="color: #0000ff">var</span> rowNum = itemLen + (6-itemLen%6<span style="color: #000000">);
</span><span style="color: #008000">//</span><span style="color: #008000">每页累加合计金额(一行)</span>
<span style="color: #0000ff">var</span> sumMoney = 0<span style="color: #000000">;
</span><span style="color: #0000ff">function</span><span style="color: #000000"> moneyTr (sum){
</span><span style="color: #0000ff">var</span> DXhtml =<span style="color: #000000"> moneyDX (sum);
</span><span style="color: #0000ff">var</span> TotalMoneyTr = '<tr>'+
'<td>合计人民币(大写)</td>'+
'<td colspan="13">'+
'<span class="money_num_text">'+
<span style="color: #008000">//</span><span style="color: #008000">--------------</span>
DXhtml+
<span style="color: #008000">//</span><span style="color: #008000">--------------</span>
'<b>'+'¥'+sum+'</b>'+
'</span>'
'</tr>'<span style="color: #000000">;
</span><span style="color: #0000ff">return</span><span style="color: #000000"> TotalMoneyTr;
};
</span><span style="color: #008000">//</span><span style="color: #008000">打印控件行处理</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> rowNumTotal(){
</span><span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i = 1; i <=rowNum; i++<span style="color: #000000">){
</span><span style="color: #0000ff">if</span>(i<=<span style="color: #000000">itemLen){
sumMoney </span>+= $scope.items[i-1<span style="color: #000000">].money;
addmoneyTr($scope.items[i</span>-1<span style="color: #000000">]);
}</span><span style="color: #0000ff">else</span><span style="color: #000000">{
addmoneyTr(</span><span style="color: #0000ff">null</span><span style="color: #000000">);
}
</span><span style="color: #0000ff">if</span>(i%6 == 0<span style="color: #000000">){
</span><span style="color: #008000">//</span><span style="color: #008000"><a href="https://www.jb51.cc/tag/tianjia/" target="_blank" class="keywords">添加</a>合计行</span>
$('#tbodyList'<span style="color: #000000">).append(moneyTr(sumMoney));
moneyDX(sumMoney);
sumMoney </span>= 0<span style="color: #000000">;
}
}
};
rowNumTotal();
</span><span style="color: #008000">//</span><span style="color: #008000"><a href="https://www.jb51.cc/tag/tianjia/" target="_blank" class="keywords">添加</a>每个金额行</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> addmoneyTr(obj){
</span><span style="color: #0000ff">var</span><span style="color: #000000"> innerHtml ;
</span><span style="color: #0000ff">if</span>(<span style="color: #0000ff">null</span>==<span style="color: #000000">obj){
innerHtml </span>= '<tr class="t_money_tr_">'+
'<td class="td_name_0" style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td style="text-align: center;">&nbsp;</td>'+
'<td class="td_remark_0" style="text-align: center;">&nbsp;</td>'+
'</tr>'<span style="color: #000000">;
}</span><span style="color: #0000ff">else</span><span style="color: #000000">{
</span><span style="color: #0000ff">var</span> mhtml =<span style="color: #000000"> getMoneyHtml(obj.money) ;
innerHtml </span>= '<tr class="t_money_tr_">'+
'<td class="td_name_0" style="text-align: center;">'+(obj.name?obj.name:'/')+'</td>'+
'<td style="text-align: center;">'+(obj.unitType?obj.unitType:'/')+'</td>'+
'<td style="text-align: center;">'+(obj.quantity ?obj.quantity:'/')+'</td>'+
'<td style="text-align: center;">'+(obj.price?obj.price:'/')+'</td>'+
<span style="color: #008000">//</span><span style="color: #008000">---------------</span>
mhtml +
<span style="color: #008000">//</span><span style="color: #008000">---------------</span>
'<td class="td_remark_0" style="text-align: center;">&nbsp;</td>'+
'</tr>'<span style="color: #000000">;
}
$(</span>'#tbodyList'<span style="color: #000000">).append(innerHtml);
};
</span><span style="color: #008000">//</span><span style="color: #008000">小写金额填入处理</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> getMoneyHtml(m){
</span><span style="color: #0000ff">var</span> m =<span style="color: #000000"> m.toString();
</span><span style="color: #0000ff">if</span>(m.indexOf(".") == -1){<span style="color: #008000">//</span><span style="color: #008000">整数补齐小数位数为00</span>
m = m + ".00"<span style="color: #000000">;
}
</span><span style="color: #0000ff">var</span> money = m.split('.'<span style="color: #000000">);
</span><span style="color: #0000ff">var</span> money_1 = '¥'+money[0];<span style="color: #008000">//</span><span style="color: #008000">整数部分</span>
<span style="color: #0000ff">if</span>(Number(money[0]) >= 1000000){ <span style="color: #008000">//</span><span style="color: #008000">大于一百万<a href="https://www.jb51.cc/tag/buxianshi/" target="_blank" class="keywords">不显示</a>¥</span>
<span style="color: #0000ff">var</span> money_1 = money[0<span style="color: #000000">];
}
</span><span style="color: #0000ff">var</span> money1_arr = money_1.split('')<span style="color: #008000">//</span><span style="color: #008000">转换成数组</span>
<span style="color: #0000ff">var</span> mhtml = ''<span style="color: #000000"> ;
</span><span style="color: #0000ff">var</span> temp = money1_arr.length,j = 0<span style="color: #000000"> ;
</span><span style="color: #008000">//</span><span style="color: #008000"> 整数部分</span>
<span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i = 7;i>0;i--<span style="color: #000000">){
</span><span style="color: #0000ff">if</span>(temp <<span style="color: #000000"> i){
mhtml </span>= mhtml + '<td class="hunbit_0" style="text-align: center;">&nbsp;</td>'<span style="color: #000000"> ;
}</span><span style="color: #0000ff">else</span><span style="color: #000000">{
mhtml </span>= mhtml + '<td class="hunbit_0" style="text-align: center;">' + money1_arr[j] + '</td>'<span style="color: #000000"> ;
j</span>++<span style="color: #000000">;
}
}
</span><span style="color: #008000">//</span><span style="color: #008000">小数部分</span>
<span style="color: #0000ff">if</span>(m.toString().indexOf(".") != -1<span style="color: #000000">){
</span><span style="color: #0000ff">var</span> money_2 = money[1<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> money2_arr = money_2.split(''<span style="color: #000000">);
</span><span style="color: #0000ff">var</span> temp2 =<span style="color: #000000"> money2_arr.length ;
</span><span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i = 0;i < 2; i++<span style="color: #000000">){
mhtml </span>= mhtml + '<td class="hunbit_0" style="text-align: center;">' + money2_arr[i] + '</td>'<span style="color: #000000"> ;
}
}
</span><span style="color: #0000ff">return</span><span style="color: #000000"> mhtml;
};
</span><span style="color: #008000">//</span><span style="color: #008000">处理大写金额</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> moneyDX (mtotal){
</span><span style="color: #0000ff">var</span> DNum =<span style="color: #000000"> {
</span>'1': '壹'<span style="color: #000000">,</span>'2': '贰'<span style="color: #000000">,</span>'3': '叁'<span style="color: #000000">,</span>'4': '肆'<span style="color: #000000">,</span>'5': '伍'<span style="color: #000000">,</span>'6': '陆'<span style="color: #000000">,</span>'7': '柒'<span style="color: #000000">,</span>'8': '捌'<span style="color: #000000">,</span>'9': '玖'<span style="color: #000000">,</span>'0': '零'<span style="color: #000000">
}
</span><span style="color: #008000">//</span><span style="color: #008000">取出各个位数的值</span>
<span style="color: #0000ff">var</span> total =<span style="color: #000000"> mtotal.toString();
</span><span style="color: #0000ff">if</span>(total.indexOf(".") == -1){<span style="color: #008000">//</span><span style="color: #008000">整数补齐小数位数为00</span>
total = total + ".00"<span style="color: #000000">;
}
</span><span style="color: #0000ff">var</span> totalArr = total.split('.'<span style="color: #000000">);
</span><span style="color: #0000ff">var</span> totalArr1 = totalArr[0<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_unit = totalArr1[totalArr1.length - 1<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_decade = totalArr1[totalArr1.length - 2<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_hunders = totalArr1[totalArr1.length - 3<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_kilbit = totalArr1[totalArr1.length - 4<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_myriabit = totalArr1[totalArr1.length - 5<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_debit = totalArr1[totalArr1.length - 6<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_hunbit = totalArr1[totalArr1.length - 7<span style="color: #000000">];
</span><span style="color: #008000">//</span><span style="color: #008000">小数部分</span>
<span style="color: #0000ff">if</span>(total.indexOf(".") != -1<span style="color: #000000">){
</span><span style="color: #0000ff">var</span> totalArr2 = totalArr[1].split(''<span style="color: #000000">);
</span><span style="color: #0000ff">var</span> text_unitone = totalArr2[0<span style="color: #000000">];
</span><span style="color: #0000ff">var</span> text_unittwo = totalArr2[1<span style="color: #000000">];
}
</span><span style="color: #008000">//</span><span style="color: #008000">赋值拼接</span>
<span style="color: #0000ff">var</span> DXhtml = '<i class="num_text_hunbit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_hunbit]?DNum[text_hunbit]:'X')+
'</i>佰<i class="num_text_debit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_debit]?DNum[text_debit]:'X')+
'</i>拾<i class="num_text_myriabit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_myriabit]?DNum[text_myriabit]:'X')+
'</i>万<i class="num_text_kilbit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_kilbit]?DNum[text_kilbit]:'X')+
'</i>仟<i class="num_text_hunders" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_hunders]?DNum[text_hunders]:'X')+
'</i>佰<i class="num_text_decade" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_decade]?DNum[text_decade]:'X')+
'</i>拾<i class="num_text_unit" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_unit]?DNum[text_unit]:'X')+
'</i>元<i class="num_text_unitone" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_unitone]?DNum[text_unitone]:'X')+
'</i>角<i class="num_text_unittwo" style="font-style: normal;margin: 0 12px;display: inline-block;width: 12px;">'+(DNum[text_unittwo]?DNum[text_unittwo]:'X')+
'</i>分'<span style="color: #000000">;
</span><span style="color: #0000ff">return</span><span style="color: #000000"> DXhtml;
};
} </span><span style="color: #0000ff">else</span><span style="color: #000000"> {
console.log(rsp.message);
}
});
});
</span><span style="color: #008000">//</span><span style="color: #008000">返回账单列表</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> _back() {
</span><span style="color: #0000ff">var</span> url = webroot + '/bill/index'<span style="color: #000000">;
window.location.href </span>=<span style="color: #000000"> url;
}
</span><span style="color: #008000">//</span><span style="color: #008000">打印</span>
<span style="color: #0000ff">function</span><span style="color: #000000"> printData(){
</span><span style="color: #0000ff">var</span> LODOP=<span style="color: #000000">getLodop();
LODOP.PRINT_INIT(</span>"打印账单收据"<span style="color: #000000">);
LODOP.SET_PRINT_PAGESIZE(</span>1,"21cm","13.5cm","LodopCustomPage"<span style="color: #000000">)
</span><span style="color: #0000ff">var</span> strStyle="<style> table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>"<span style="color: #000000">
LODOP.ADD_PRINT_TABLE(</span>128,"1%","96%","4.5cm",strStyle + document.getElementById("div2"<span style="color: #000000">).innerHTML);
LODOP.SET_PRINT_STYLEA(</span>0,"Vorient",1<span style="color: #000000">);
LODOP.ADD_PRINT_HTM(</span>26,"98%","1cm",document.getElementById("div1"<span style="color: #000000">).innerHTML);
LODOP.SET_PRINT_STYLEA(</span>0,"ItemType",1<span style="color: #000000">);
LODOP.SET_PRINT_STYLEA(</span>0,"LinkedItem",1<span style="color: #000000">);
LODOP.PREVIEW();
};
</span></script>
</html></pre>
原文链接:https://www.f2er.com/js/73979.html