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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
<?php $dir = "."; include_once($dir."/_common.php"); include("include/header.sub.php");
if($sendmode=='email'){ $sql = "select count(*) as cnt from (select a.ccode from sale_m a where a.midx in ({$midx_list}) group by a.ccode) aa "; $res = mysql_query($sql,$connect_e1000y); $cc_info = mysql_fetch_array($res); if($cc_info['cnt']>1){ echo "<script> alert('이메일 전송은 동시에 한거래처만 발행 가능합니다.{$cc_info['cnt']}'); window.close(); </script>"; } } $seq_where = ""; if($seq_list!=''){ $seq_where = " and b.seq in ($seq_list) "; }
$sql = "select a.midx, a.dealdate, a.dealnum, a.remarks, o.comp_sn as s_comp_sn, o.comp_name as s_comp_name, o.ceo_name as s_ceo_name, concat(o.addr_m, o.addr_d) as s_addr, o.biz_status as s_biz_status, o.biz_item as s_biz_item, o.telno1 as s_telno, o.hpno as s_hpno, b.comp_sn as r_comp_sn,b.comp_name as r_comp_name, b.ceo_name as r_ceo_name, concat(b.addr_m, b.addr_d) as r_addr, b.biz_status as r_biz_status, b.biz_item as r_biz_item, b.cur_recvbl, b.telno as r_telno, b.faxno as r_faxno, b.hpno as r_hpno from sale_m a left join customers b on a.ccode = b.code , offices o where a.midx in ({$midx_list}) and o.code = 1 "; //_pr($sql); $res = mysql_query($sql,$connect_e1000y); while($m_info = mysql_fetch_array($res)){ $sql = "select b.*, c.unit from sale_m a left join sale_d b on a.midx = b.midx left join product_m c on b.pcode = c.code where a.midx = '{$m_info['midx']}' $seq_where order by seq ;"; $res2 = mysql_query($sql,$connect_e1000y); $p_array = null; $tmp_info = null; $sum_qty = 0; $sum_amt = 0; $sum_vat = 0; $sum_tot = 0; while($d_info = mysql_fetch_array($res2)){ $sum_qty += $d_info['qty']; $sum_amt += $d_info['sup_amt']; $sum_vat += $d_info['vat']; $sum_tot += $d_info['tot_amt']; $p_array[] = $d_info; }
$tmp_info['pname'] = "[수량합계]"; $tmp_info['qty'] = $sum_qty; $tmp_info['sup_amt'] = 0; // 수량합계 $p_array[] = $tmp_info; $sql = "select * from receive where dealidx = '{$m_info['midx']}';"; // 입금 부분 확인 $res2 = mysql_query($sql,$connect_e1000y); if($rcv_info = mysql_fetch_array($res2)){ $tmp_info['pname'] = "[입 금]"; $tmp_info['qty'] = ""; $tmp_info['sup_amt'] = $rcv_info['total']; $p_array[] = $tmp_info; } $tmp_info['pname'] = "==== 이 하 여 백 ===="; $tmp_info['qty'] = ""; $tmp_info['sup_amt'] = 0; // 이하여백 $p_array[] = $tmp_info; $m_info['product'] = $p_array; $m_info['sum_amt'] = $sum_amt; $m_info['sum_vat'] = $sum_vat; $m_info['sum_tot'] = $sum_tot; $m_array[] = $m_info; }
$sql = "select code,name from bank where hidden = 0 order by code"; $res = mysql_query($sql,$connect_e1000y); while($info = mysql_fetch_array($res)){ $bank[$info['code']] = $info['name']; }
$sql = "select * from bankbook where 1=1 order by nidx limit 1"; $res = mysql_query($sql,$connect_e1000y); $bankinfo = mysql_fetch_array($res);
//_pr($m_array);
//$view_bigo = "Y";
?> <style> .sup_wrap { /*height:560px;*//* background:pink;*/} .rec_wrap {} .st_hd td, .st_hd th{ height:30px;} <?php if($print_type==0 || $print_type==1){?> .state_wrap { margin-left:35px;margin-top:0px; } .st_bd td, .st_bd th{ height:16px; line-height:15px;top:0px;} <?php } else if($print_type==2 || $print_type==3){?> .rec_wrap {padding-top:40px;} .state_wrap { margin-left:10px;margin-top:0px; padding-top:28px;} .st_bd td, .st_bd th{ height:31px; line-height:31px;top:0px;} <?php }?> .st_bd thead th { height:29px; } <?php if($print_type==0 || $print_type==1){?> .st_bd tbody { font-size:0.8em; } <?php } else if($print_type==2 || $print_type==3){?> .st_bd tbody { font-size:0.9em; } <?php }?> .st_bt th {font-size:0.8em;} .pos_real { position:relative;} #seal_img { position:absolute; right:0px; top:0px;}
<?php if($print_type==0){?> .cus_title span{color:white;} .statement_table { width:700px; table-layout:fixed;} .statement_table tr { border-left:1px solid white; border-top:1px solid white; } .statement_table td, .statement_table th{ border-right:1px solid white; border-bottom:1px solid white;} .statement_table th { color:white; } .statement_table .cost {padding-right:5px; text-align:right} .statement_table .linetxt {padding-left:3px; text-align:left} .statement_table .tcenter {padding-right:3px; text-align:center} .statement_table .border-2l { border-left:2px solid white;} .statement_table .border-2r { border-right:2px solid white;} .statement_table .border-2t { border-top:2px solid white;} .statement_table .border-2b { border-bottom:2px solid white;} .statement_table .top_title { position:relative;border-top:5px; text-align:center; } .statement_table .top_title div { position:absolute;top:0px;width:320px;font-size:30px; font-weight:bold; } .statement_table .border-ntop { border-top:0px; } .statement_table .border-nbottom { border-bottom:0px; }
.statement_table2 { width:700px;table-layout:fixed;} .statement_table2 tr { border-left:1px solid white; border-top:1px solid white; } .statement_table2 td, .statement_table2 th{ border-right:1px solid white; border-bottom:1px solid white;} .statement_table2 th { color:white; } .statement_table2 .cost {padding-right:5px; text-align:right} .statement_table2 .linetxt {padding-left:3px; text-align:left} .statement_table2 .tcenter {padding-right:3px; text-align:center} .statement_table2 .border-2l { border-left:2px solid white;} .statement_table2 .border-2r { border-right:2px solid white;} .statement_table2 .border-2t { border-top:2px solid white;} .statement_table2 .border-2b { border-bottom:2px solid white;} .statement_table2 .top_title { position:relative;border-top:0px; text-align:center; } .statement_table2 .top_title div { position:absolute;top:5px;width:320px;font-size:30px; font-weight:bold; } .statement_table2 .border-ntop { border-top:0px; } .statement_table2 .border-nbottom { border-bottom:0px; } <?php } else if($print_type==1){?> .cus_title span{/*display:none;*/} .statement_table { width:700px; table-layout:fixed;} .statement_table tr { border-left:1px solid red; border-top:1px solid red; } .statement_table td, .statement_table th{ border-right:1px solid red; border-bottom:1px solid red;} .statement_table th { color:red; } .statement_table .cost {padding-right:5px; text-align:right} .statement_table .linetxt {padding-left:3px; text-align:left} .statement_table .tcenter {padding-right:3px; text-align:center} .statement_table .border-2l { border-left:2px solid red;} .statement_table .border-2r { border-right:2px solid red;} .statement_table .border-2t { border-top:2px solid red;} .statement_table .border-2b { border-bottom:2px solid red;} .statement_table .top_title { position:relative;border-top:0px; text-align:center; } .statement_table .top_title div { position:absolute;top:0px;width:320px;font-size:30px; font-weight:bold; } .statement_table .border-ntop { border-top:0px; } .statement_table .border-nbottom { border-bottom:0px; }
.statement_table2 { width:700px;table-layout:fixed;} .statement_table2 tr { border-left:1px solid blue; border-top:1px solid blue; } .statement_table2 td, .statement_table2 th{ border-right:1px solid blue; border-bottom:1px solid blue;} .statement_table2 th { color:blue; } .statement_table2 .cost {padding-right:5px; text-align:right} .statement_table2 .linetxt {padding-left:3px; text-align:left} .statement_table2 .tcenter {padding-right:3px; text-align:center} .statement_table2 .border-2l { border-left:2px solid blue;} .statement_table2 .border-2r { border-right:2px solid blue;} .statement_table2 .border-2t { border-top:2px solid blue;} .statement_table2 .border-2b { border-bottom:2px solid blue;} .statement_table2 .top_title { position:relative;border-top:0px; text-align:center; } .statement_table2 .top_title div { position:absolute;top:0px;width:320px;font-size:30px; font-weight:bold; } .statement_table2 .border-ntop { border-top:0px; } .statement_table2 .border-nbottom { border-bottom:0px; } <?php } else if($print_type==2){?> .cus_title span{/*display:none;*/}
.statement_table2 { width:700px;table-layout:fixed;} .statement_table2 tr { border-left:1px solid white; border-top:1px solid white; } .statement_table2 td, .statement_table2 th{ border-right:1px solid white; border-bottom:1px solid white;} .statement_table2 th { color:white; } .statement_table2 .cost {padding-right:5px; text-align:right} .statement_table2 .linetxt {padding-left:3px; text-align:left} .statement_table2 .tcenter {padding-right:3px; text-align:center} .statement_table2 .border-2l { border-left:2px solid white;} .statement_table2 .border-2r { border-right:2px solid white;} .statement_table2 .border-2t { border-top:2px solid white;} .statement_table2 .border-2b { border-bottom:2px solid white;} .statement_table2 .top_title { position:relative;border-top:0px; text-align:center; } .statement_table2 .top_title div { position:absolute;top:0px;width:280px;font-size:30px; font-weight:bold; } .statement_table2 .border-ntop { border-top:0px; } .statement_table2 .border-nbottom { border-bottom:0px; } <?php } else if($print_type==3){?> .cus_title span{/*display:none;*/}
.statement_table2 { width:700px;table-layout:fixed;} .statement_table2 tr { border-left:1px solid blue; border-top:1px solid blue; } .statement_table2 td, .statement_table2 th{ border-right:1px solid blue; border-bottom:1px solid blue;} .statement_table2 th { color:blue; } .statement_table2 .cost {padding-right:5px; text-align:right} .statement_table2 .linetxt {padding-left:3px; text-align:left} .statement_table2 .tcenter {padding-right:3px; text-align:center} .statement_table2 .border-2l { border-left:2px solid blue;} .statement_table2 .border-2r { border-right:2px solid blue;} .statement_table2 .border-2t { border-top:2px solid blue;} .statement_table2 .border-2b { border-bottom:2px solid blue;} .statement_table2 .top_title { position:relative;border-top:0px; text-align:center; } .statement_table2 .top_title div { position:absolute;top:0px;width:280px;font-size:30px; font-weight:bold; } .statement_table2 .border-ntop { border-top:0px; } .statement_table2 .border-nbottom { border-bottom:0px; } <?php }?> .head_table { width:700px; height:15px; } .head_table .page_cnt, .head_table .page_who {text-align:right;} .head_table .page_bigo {text-align:center;}
.f21head { position:absolute;border:0px; left:240px;top:-25px;} .f21head tr {border:0px;} .f21head td {border:0px; font-size:0.9em;padding-left:3px;}
.f21foot {border:0px;} .f21foot tr {border:0px;} .f21foot td {border:0px; font-size:0.9em;padding-left:3px;} </style> <?php if($btnmode!='hidden'){?> <div id="sub-contents-area"> <div class="sub-btn-area"> <div class="sub-btn pop-btn" style='margin-left:250px;'> <?php if($sendmode=='print'){?><a class="blue-btn" id='btn_state_printer3'>인쇄</a><?php }?> <?php if($sendmode=='email'){?><a class="gray-btn" id='btn_state_email3'>메일전송</a><?php }?> <a class="black-btn" id='sel_close'>닫기</a> </div> </div> <form name='state_print_form'> <input type='hidden' name='midx_list' value='<?php echo $midx_list;?>'> </form> </div> <?php }?> <?php $mcnt = 0; foreach($m_array as $key=>$val){ $val['r_comp_sn'] = comp_sn_conv($val['r_comp_sn']); $minfo = $val; $v = explode("-",$minfo['dealdate']); $minfo['date'] = $v[0]."년 ".$v[1]."월 ".$v[2]."일"; $minfo['dealnum2'] = substr($minfo['dealnum'],6,4)."-".substr($minfo['dealnum'],10,2);
$prod_cnt = count($minfo['product']); if($mcnt>0){ echo "<div style='height:1px;'></div>"; } $pagecnt = 1; $maxpage = 1; if(count($minfo['product'])>15 && ($print_type==0 || $print_type==1)){ $maxpage = floor(count($minfo['product'])/15)+1; $prod_start = 0; while($prod_cnt>0){ if($print_type==0){ include("statement_print.inc1.php"); } else if($print_type==1){ include("statement_print.inc2.php"); } $prod_cnt -= 15; $prod_start += 15; $pagecnt++; } } else if(count($minfo['product'])>21 && ($print_type==2 || $print_type==3)){ $prod_start = 0; while($prod_cnt>0){ if($print_type==2){ include("statement_print.inc3.php"); } else if($print_type==3){ include("statement_print.inc4.php"); } $prod_cnt -= 21; $prod_start += 21; } } else { if($print_type==0){ include("statement_print.inc1.php"); } else if($print_type==1){ include("statement_print.inc2.php"); } else if($print_type==2){ include("statement_print.inc3.php"); } else if($print_type==3){ include("statement_print.inc4.php"); } } $mcnt++; } ?> <script> $(function(){ $("#sel_close").click(function(){ window.close(); });
$("#btn_state_printer3").click(function(){ // 인쇄 설정 $modal3_box = $("#modal_member_box3"); $.get("statement_print_info.php",function(rtn){ $("#modal_member_box3").html(rtn).dialog({ resizable: true, height:540, width:740, modal: true, title: "거래명세표 인쇄설정 안내", buttons: { "예": function() { var form_data = $("form[name='state_print_form']").serialize();
$.ajax({type:"post", url:"ajax.state_print_process.php", data:form_data, async:false, dataType : "xml", success:function(xml){ var v_mode = $(xml).find("mode").text(); var v_mode_ok = $(xml).find("mode_ok").text(); var v_msg = $(xml).find("msg").text(); if(v_mode_ok!='Y'){ alert(v_msg); } else { $modal3_box.dialog("close"); $("#sub-contents-area").hide(); window.print(); parent.window.opener.location.reload(); } }, error:function(rtn,status,error){ alert(error); } }); }, "아니요": function() { $modal3_box.dialog("close"); } } }); }); /*if(confirm('인쇄전에 크기에 맞게 축소 사용 체크 해제, \n인쇄크기 변경%는 100%로 설정, \n브라우저 인쇄설정의의 여백을 왼쪽 10밀리, 오른쪽 5밀리, \n위쪽 3미리, 아래쪽 10미리로 세팅, \n머릿글에 -비어있음- 으로 모두 설정하시기 바랍니다.\n\n인쇄하시겠습니까?')){ var form_data = $("form[name='state_print_form']").serialize();
$.ajax({type:"post", url:"ajax.state_print_process.php", data:form_data, async:false, dataType : "xml", success:function(xml){ var v_mode = $(xml).find("mode").text(); var v_mode_ok = $(xml).find("mode_ok").text(); var v_msg = $(xml).find("msg").text(); if(v_mode_ok!='Y'){ alert(v_msg); } else { $("#sub-contents-area").hide(); window.print(); parent.window.opener.location.reload(); } }, error:function(rtn,status,error){ alert(error); } }); } */ });
$("#btn_state_email3").click(function(){
$("#modal_member_box3").html("PDF파일로 변환 중입니다. 시간이 걸릴수 있습니다. <br><br>최대 60초...<br><br>변환이 완료되면 자동으로 메일폼으로 이동합니다.").dialog({ resizable: true, height:150, width:450, modal: true, title: "메일용 PDF 전환", });
setTimeout(function(){ mail_pdf_process(); },1000); }); <?php if($print_type==0){?> //$("#sub-contents-area").hide(); $(".page_who").css("color","white"); $(".top_title div").hide(); <?php }?> <?php if($print_type==2){?> $(".top_title div").hide(); <?php }?> <?php if($print_type==2 || $print_type==3){?> //$("#sub-contents-area").hide(); $(".cus_title span").css("color","white"); <?php }?>
// 설정옵션 처리전에는 비고, 전화번호, 은행등을 숨긴다. //$(".page_bigo, .page_tel, .page_bank").html(" "); // 전표비고는 나왔으면 한다고 해서 표시하게 수정 $(".page_tel, .page_bank").html(" "); //alert('브라우저 인쇄설정의의 여백을 왼쪽 10밀리, 오른쪽 5밀리, 위쪽 7미리, 아래쪽 10미리로 세팅하시기 바랍니다.'); //window.print(); });
function mail_pdf_process(){
var form_data = "midx_list=<?php echo $midx_list;?>&print_type=3&sendmode=email&btnmode=hidden&seal_print=<?php echo $seal_print;?>"; $.ajax({type:"post", url:"ajax.state_email_process.php", data:form_data, async:false, dataType : "xml", success:function(xml){ var v_mode = $(xml).find("mode").text(); var v_mode_ok = $(xml).find("mode_ok").text(); var v_msg = $(xml).find("msg").text(); var v_file_name = $(xml).find("file_name").text(); if(v_mode_ok!='Y'){ alert(v_msg); } else { var v_url = "statement.email.php?midx_list=<?php echo $midx_list;?>&file_name="+v_file_name; document.location.href=v_url; } }, error:function(rtn,status,error){ alert(error); } }); } </script>
<div id="modal_member_box3" title="3차모달" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"></div>
|