2db47680
hexiaodong
chore: 初始提交 php 遗...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
<!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;
}
.type1 {
float: left;
width: 25%;
text-align: left;
}
.type11 {
float: left;
width: 25%;
text-align: left;
}
.type2 {
float: right;
width: 25%;
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>
{volist name="list" id="vo"}
<div class="main" {if condition='$i<sizeof($list)'}style="page-break-after: always"{/if}>
<div class="company">{$company_name|default=''}</div>
<div class="title">核销单</div>
<div class="type">
<div class="type0">单据类型:{$vo.business_type_text|default=''}</div>
<div class="type1">单据日期:{$vo.purchase_time|date='Y-m-d',###}</div>
<div class="type11">单据编号:{$vo.purchase_code|default=''}</div>
{if condition="$vo.business_type==1"}
<div class="type2">客户:{$vo.customers_id|default=''}</div>
{elseif condition="$vo.business_type==2"}
<div class="type2">供应商:{$vo.suppliers_id|default=''}</div>
{/if}
<div class="clear"></div>
</div>
{if condition="$vo.business_type==3"}
<div class="type">
<div class="type1">客户:{$vo.customers_id|default=''}</div>
<div class="type11">供应商:{$vo.suppliers_id|default=''}</div>
<div class="clear"></div>
</div>
{/if}
{if condition="$vo.business_type==4"}
<div class="type">
<div class="type1">转出客户:{$vo.customers_out_id|default=''}</div>
<div class="type11">转入客户:{$vo.customers_enter_id|default=''}</div>
<div class="clear"></div>
</div>
{/if}
{if condition="$vo.business_type==5"}
<div class="type">
<div class="type1">转出供应商:{$vo.suppliers_out_id|default=''}</div>
<div class="type11">转入供应商:{$vo.suppliers_enter_id|default=''}</div>
<div class="clear"></div>
</div>
{/if}
<div>
<table>
<tr class="t1">
<td width="50px">序号</td>
<td width="150px">源单编号</td>
<td width="100px">业务类别</td>
<td width="100px">单据日期</td>
<td width="100px">单据金额</td>
<td width="100px">已核销金额</td>
<td width="100px">未核销金额</td>
<td width="120px">本次核销金额</td>
</tr>
{php}$k=0;{/php}
{foreach name="vo.purchase_info" item="info"}
{if condition="$info.top==1"}
{php}$k++;{/php}
<tr>
<td width="50px" class="text-center">{$k}</td>
<td width="150px">{if condition='$info.purchase_type>4'}{$info.business_name|default=''}{else/}{$info.purchase_number}{/if}</td>
<td width="100px">{$info.business_name|default=''}</td>
<td width="100px">{$info.times|date='Y-m-d',###}</td>
<td width="100px">{$info.money}</td>
<td width="100px">{$info.write_off}</td>
<td width="100px">{$info.write_off_money}</td>
<td width="100px">{$info.write_off_price}</td>
</tr>
{/if}
{/foreach}
{php}for($a=$k+1;$a<5;$a++){ {/php}
<tr>
<td width="50px" class="text-center">{$a}</td>
<td width="150px"></td>
<td width="100px"></td>
<td width="100px" class="text-right"></td>
<td width="100px" class="text-right"></td>
<td width="100px" class="text-right"></td>
<td width="100px"></td>
<td width="100px"></td>
</tr>
{php}}{/php}
</table>
{if condition="$vo.business_type<4"}
<div style="margin: 15px 0 5px 0;"></div>
<table>
<tr class="t1">
<td width="50px">序号</td>
<td width="150px">源单编号</td>
<td width="100px">业务类别</td>
<td width="100px">单据日期</td>
<td width="100px">单据金额</td>
<td width="100px">已核销金额</td>
<td width="100px">未核销金额</td>
<td width="120px">本次核销金额</td>
</tr>
{php}$k=0;{/php}
{foreach name="vo.purchase_info" item="info"}
{if condition="$info.top==2"}
{php}$k++;{/php}
<tr>
<td width="50px" class="text-center">{$k}</td>
<td width="150px">{if condition='$info.purchase_type>4'}{$info.business_name|default=''}{else/}{$info.purchase_number}{/if}</td>
<td width="100px">{$info.business_name|default=''}</td>
<td width="100px">{$info.times|date='Y-m-d',###}</td>
<td width="100px">{$info.money}</td>
<td width="100px">{$info.write_off}</td>
<td width="100px">{$info.write_off_money}</td>
<td width="100px">{$info.write_off_price}</td>
</tr>
{/if}
{/foreach}
{php}for($a=$k+1;$a<5;$a++){ {/php}
<tr>
<td width="50px" class="text-center">{$a}</td>
<td width="150px"></td>
<td width="100px"></td>
<td width="100px" class="text-right"></td>
<td width="100px" class="text-right"></td>
<td width="100px" class="text-right"></td>
<td width="100px"></td>
<td width="100px"></td>
</tr>
{php}}{/php}
</table>
{/if}
</div>
<div class="type">
<div class="type3">制单人:{$vo.preparation.username|default=''}</div>
<div class="clear"></div>
</div>
</div>
{/volist}
</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>
|