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
|
<?php $dir = "."; include_once($dir."/_common.php");
$connect_tax = @mysql_connect($DB_HOSTtax,$DB_USERtax,$DB_PWDtax); @mysql_select_db( $DB_NAMEtax,$connect_tax);
if($eid==''){ alert('e천년경영 로그인 후에 이용가능합니다.',"index.php"); exit; }
$office_info = get_office_info(); // 공급처정보 가져옴
//ck_category_init(); // 첫 사용자 카테고리 초기화
/*$sql = "select * from sale_m "; $res = mysql_query($sql,$connect_e1000y); while($info=mysql_fetch_array($res)){ $sql = "insert into sale_u set pcode = '{$info['code']}', Mid = '{$eid}' "; //_pr($sql); mysql_query($sql,$connect_e1000y); }*/
if($sdate==''){ $sdate = date("Y-m-",time())."01"; } if($edate==''){ $edate = date("Y-m-d",time()); }
$sdate2 = str_replace("-","",$sdate)."000000"; $edate2 = str_replace("-","",$edate)."235959";
$where = "";
if($stx!=''){ if($sti=='a.DMDER_BUSNID_ID'){ $stx = str_replace("-","",$stx); $where .= " and {$sti} = FN_GET_BIZNO('$stx') "; } else { $where .= " and {$sti} = '$stx' "; } }
if($st_mail!=''){ $where .= " and a.EMAIL_CHECK = '{$st_mail}' "; }
if($st_nts!=''){ if(substr($st_nts,0,1) == 'E'){ $v = explode("^",$st_nts); if($v[1]=='SUC001'){ $where .= " and a.SND_STATUS_CD = '{$v[0]}' and s.RESULT_CD = 'SUC001' "; } else if($v[1]=='NULL'){ $where .= " and a.SND_STATUS_CD = '{$v[0]}' and (s.RESULT_CD is NULL or s.RESULT_CD = '') "; } else { $where .= " and a.SND_STATUS_CD = '{$v[0]}' and not (s.RESULT_CD = 'SUC001' or s.RESULT_CD is NULL or s.RESULT_CD = '') "; } } else { $where .= " and a.SND_STATUS_CD = '{$st_nts}' "; } }
if($st_kind!=''){ if(strlen($st_kind)==2){ $where .= " and a.ETAXBIL_CL_CD = '{$st_kind}' "; } else { $where .= " and a.ETAXBIL_CL_CD = '".substr($st_kind,0,2)."' and ETAXBIL_KND_CD = '".substr($st_kind,2,2)."' "; } }
$comp_sn = str_replace("-","",$office_info['comp_sn']);
$sql = "SELECT count(*) as cnt FROM tn_eaaa AS a INNER JOIN tn_aaaa AS t1 ON a.SUPLER_BUSNID_ID = t1.BUSNID_ID INNER JOIN tn_eaab AS b ON a.ETAXBIL_APPV_NO = b.ETAXBIL_APPV_NO and BUSN_KND_CD = '02' LEFT JOIN tn_baab as s ON a.ETAXBIL_APPV_NO = s.ETAXBIL_APPV_NO AND a.SUBMIT_ID = s.SUBMIT_ID WHERE a.ISU_DATE BETWEEN '{$sdate2}' AND '{$edate2}' and t1.BUSNID = '{$comp_sn}' $where "; $result = mysql_query($sql,$connect_tax); $row = mysql_fetch_array($result); $total_count = $row['cnt'];
$list_num = 15; if($_COOKIE['page_line']!=''){ $list_num = $_COOKIE['page_line']; } $total_page = ceil($total_count / $list_num); // 전체 페이지 계산 if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $list_num; // 시작 열을 구함
$sql = "SELECT a.ETAXBIL_CL_CD, a.ETAXBIL_KND_CD, a.ETAXBIL_APPV_NO, a.WRITE_DT, a.ISU_DATE, a.SND_DT, DECODE(b.BUSNID,'12345678') AS BUSNID, b.SUB_BD_NO , DECODE(b.TRADE_NM,'12345678') AS TRADE_NM, DECODE(b.CHIEF_NM,'12345678') AS CHIEF_NM, DECODE(a.SUP_AMT_SM,'12345678') AS SUP_AMT_SM, DECODE(a.TX_SM,'12345678') AS TX_SM, DECODE(a.TOT_AMT,'12345678') AS TOT_AMT , a.SND_STATUS_CD, a.EMAIL_SND_YN, a.EMAIL_CHECK, a.ETAXBIL_CL_CD , b.MAIN_TX_OFFCR_EMAIL_ADDR, b.BUSN_KND_CD, s.RESULT_CD, p.THNG_NM, a.ETAXBIL_NOTE, a.ETAXBIL_RVS_CS_CD, a.SRVC_BUSN_MGMT_NO
FROM tn_eaaa AS a INNER JOIN tn_aaaa AS t1 ON a.SUPLER_BUSNID_ID = t1.BUSNID_ID INNER JOIN tn_eaab AS b ON a.ETAXBIL_APPV_NO = b.ETAXBIL_APPV_NO and BUSN_KND_CD = '02' LEFT JOIN tn_baab as s ON a.ETAXBIL_APPV_NO = s.ETAXBIL_APPV_NO AND a.SUBMIT_ID = s.SUBMIT_ID left join tn_eaac as p on a.ETAXBIL_APPV_NO = p.ETAXBIL_APPV_NO and p.THNG_SEQNO = '1' WHERE a.ISU_DATE BETWEEN '{$sdate2}' AND '{$edate2}' and t1.BUSNID = '{$comp_sn}' $where
order by a.ETAXBIL_APPV_NO DESC limit $from_record, $list_num "; $result = mysql_query($sql,$connect_tax);
//_pr($sql); while($cus_info=mysql_fetch_array($result)){ $list_array[] = $cus_info; }
@mysql_close($connect_tax);
//_pr($list_array);
$qstr = $_SERVER['QUERY_STRING'];
header( "Content-type: application/vnd.ms-excel" ); header( "Content-Disposition: attachment; filename=taxbill_".date("YmdHis",time()).".xls" ); header( "Content-Description: PHP4 Generated Data" ); ?>
<form name='tax_list_form' method='post'> <input type='hidden' name='sel_mode' value='sum'> <input type='hidden' name='sdate' value='<?php echo $sdate?>'> <input type='hidden' name='edate' value='<?php echo $edate?>'> <input type='hidden' name='RequestCode' value=''> <input type='hidden' name='new_email' value=''> <input type="hidden" name="edit_type" id="edit_type" value=""> <div class="div-list-area"> <div class="cust-list-area"> <table class="order-sheet2" border=1> <caption class="screen_out">매출처 원장 조회<caption> <colgroup> <!--<col style="width:30px;">--> <col style="width:80px;"><col style="width:80px;"><col style="width:80px;"> <col style="width:90px;"><col style="width:90px;"><col style="width:90px;"> <col style="width:120px;"><col style="width:80px;"> <col style="width:90px;"><col style="width:50px;"><col style="width:140px;"> <col style="width:90px;"><col style="width:80px;"><col style="width:100px;"> <col style="width:80px;"><col style="width:400px;"> <col style="width:150px;"><col style="width:180px;"><col style="width:180px;"> </colgroup>
<thead> <tr> <!--<th scope="col"><input type='checkbox' name='ck_all' class='check_all_class'></th>--> <th scope="col">작성일자</th><th scope="col">발행일자</th><th scope="col">전송일자</th> <th scope="col">처리결과</th><th scope="col">계산서구분</th><th scope="col">메일수신</th> <th scope="col">회사명</th><th scope="col">대표자</th> <th scope="col">사업자번호</th><th scope="col">종사업장</th><th scope="col">거래내용</th> <th scope="col">공급가액</th><th scope="col">부가세</th><th scope="col">합계금액</th> <th scope="col">수정사유</th><th scope="col">비고</th> <th scope="col">e메일</th><th scope="col">승인번호</th><th scope="col">관리번호</th> </tr> </thead> <tbody> <?php for($i=0;$i<count($list_array);$i++){ $info = $list_array[$i]; $info = array_utf8($info); $s_posi = ""; $c_posi = ""; $e_posi = ""; $m_posi = "";
$WRITE_DT = substr($info['WRITE_DT'],0,4)."-".substr($info['WRITE_DT'],4,2)."-".substr($info['WRITE_DT'],6,2); $ISU_DATE = substr($info['ISU_DATE'],0,4)."-".substr($info['ISU_DATE'],4,2)."-".substr($info['ISU_DATE'],6,2); $SND_DT = substr($info['SND_DT'],0,4)."-".substr($info['SND_DT'],4,2)."-".substr($info['SND_DT'],6,2); if($info[ETAXBIL_CL_CD] == "01" && $info[ETAXBIL_KND_CD] == "01"){ // 계산서구분 처리 $tax_type_btn = "<input type='button' name='statebt' class='blue1' value='일반'>"; } else if($info[ETAXBIL_CL_CD] == "03"){ $tax_type_btn = "<input type='button' name='statebt' class='orange1' value='면세'>"; } else if($info[ETAXBIL_CL_CD] == "01" && $info[ETAXBIL_KND_CD] == "02"){ $tax_type_btn = "<input type='button' name='statebt' class='green1' value='영세'>"; } else if($info[ETAXBIL_CL_CD] == "02" && $info[ETAXBIL_KND_CD] == "01"){ $tax_type_btn = "<input type='button' name='statebt' class='blue1' value='일반수정'>"; } else if($info[ETAXBIL_CL_CD] == "04"){ $tax_type_btn = "<input type='button' name='statebt' class='orange1' value='면세수정'>"; } else if($info[ETAXBIL_CL_CD] == "02" && $info[ETAXBIL_KND_CD] == "02"){ $tax_type_btn = "<input type='button' name='statebt' class='green1' value='영세수정'>"; } if($info[SND_STATUS_CD]=='E'){ // 처리결과처리 if($info[RESULT_CD]==NULL || $info[RESULT_CD]==''){ $taxstate = "<input type='button' name='statebt' class='green1' value='접수중'>"; $e_posi = "Y"; $m_posi = "Y"; // 이메일,수정 가능 } else if($info[RESULT_CD]=='SUC001'){ $taxstate = "<input type='button' name='statebt' class='blue1' value='전송성공'>"; $e_posi = "Y"; $m_posi = "Y"; // 이메일, 수정 가능 } else { $taxstate = "<input type='button' name='statebt' class='red1 show_errorview' value='전송실패 {$info[RESULT_CD]}'>"; $c_posi = "Y"; // 취소가능 } } else if($info[SND_STATUS_CD]=='S'){ $taxstate = "<input type='button' name='statebt' class='green1' value='전송요청'>"; $e_posi = "Y"; $m_posi = "Y"; // 이메일,수정 가능 } else if($info[SND_STATUS_CD]=='I'){ $taxstate = "<input type='button' name='statebt' class='green1' value='미전송'>"; $s_posi = "Y"; $c_posi = "Y"; $e_posi = "Y"; // 전송가능, 취소가능, 이메일가능 } else if($info[SND_STATUS_CD]=='D'){ $taxstate = "<input type='button' name='statebt' class='black1' value='전송취소'>"; } if($info[EMAIL_CHECK] == "0"){ $emailstate ="<input type='button' name='statebt' class='blue1' value='미확인'>"; } else if($info[EMAIL_CHECK] == "1"){ $emailstate ="<input type='button' name='statebt' class='green1' value='미개봉'>"; } else if($info[EMAIL_CHECK] == "2"){ $emailstate ="<input type='button' name='statebt' class='orange1' value='개봉'>"; } else if($info[EMAIL_CHECK] == "3"){ $emailstate ="<input type='button' name='statebt' class='red1' value='수신확인'>"; } else if($info[EMAIL_CHECK] == "4"){ $emailstate ="<input type='button' name='statebt' class='blue1' value='반송요청'>"; } else if($info[EMAIL_CHECK] == "5"){ $emailstate ="<input type='button' name='statebt' class='green1' value='반송확인'>"; }
if($info['ETAXBIL_RVS_CS_CD']=='01'){ $ch_reason = "기재사항 착오"; } else if($info['ETAXBIL_RVS_CS_CD']=='06'){ $ch_reason = "이중발행 정정"; } else if($info['ETAXBIL_RVS_CS_CD']=='02'){ $ch_reason = "공급가액 차감"; } else if($info['ETAXBIL_RVS_CS_CD']=='03'){ $ch_reason = "재화환입"; } else if($info['ETAXBIL_RVS_CS_CD']=='04'){ $ch_reason = "계약의 해제"; } else if($info['ETAXBIL_RVS_CS_CD']=='05'){ $ch_reason = "내국신용장"; } ?> <tr style='height:40px;' id='xxx_<?php echo $i?>'> <!--<td class="tcenter "> <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>'> <input type='hidden' name='appv_no_list[]' value='<?php echo $info['ETAXBIL_APPV_NO'];?>'> <input type='hidden' name='mgmt_no_list[]' value='<?php echo $info['SRVC_BUSN_MGMT_NO'];?>'> <input type='hidden' name='comp_sn_list[]' value='<?php echo $info['BUSNID'];?>'> <input type='hidden' name='isu_date_list[]' value='<?php echo $info['ISU_DATE'];?>'> <input type='hidden' name='send_do_posi[]' value='<?php echo $s_posi;?>'> <input type='hidden' name='cancel_do_posi[]' value='<?php echo $c_posi;?>'> <input type='hidden' name='email_do_posi[]' value='<?php echo $e_posi;?>'> <input type='hidden' name='edit_do_posi[]' value='<?php echo $m_posi;?>'> <input type='hidden' name='email[]' value='<?php echo $info['MAIN_TX_OFFCR_EMAIL_ADDR'];?>'> </td>--> <td class="tcenter "><?php echo $WRITE_DT;?></td> <td class="tcenter "><?php echo $ISU_DATE;?></td> <td class="tcenter "><?php echo $SND_DT;?></td> <td class="tcenter"><?php echo $taxstate;?></td> <td class="tcenter"><?php echo $tax_type_btn;?></td> <td class="tcenter"><?php echo $emailstate;?></td> <td class="linetxt click_edit"><?php echo $info['TRADE_NM'];?></td> <td class="tcenter "><?php echo $info['CHIEF_NM'];?></td> <td class="tcenter "><?php echo $info['BUSNID'];?></td> <td class="tcenter "><?php echo $info['SUB_BD_NO'];?></td> <td class="linetxt "><?php echo $info['THNG_NM'];?></td> <td class="cost "><?php echo number_format($info['SUP_AMT_SM']);?></td> <td class="cost "><?php echo number_format($info['TX_SM']);?></td> <td class="cost "><?php echo number_format($info['TOT_AMT']);?></td> <td class="tcenter "><?php echo $ch_reason;?></td> <td class="tcenter bigo_class"><?php echo $info['ETAXBIL_NOTE'];?></td> <td class="linetxt "><?php echo $info['MAIN_TX_OFFCR_EMAIL_ADDR'];?></td> <td class="tcenter "><?php echo $info['ETAXBIL_APPV_NO'];?></td> <td class="tcenter "><?php echo $info['SRVC_BUSN_MGMT_NO'];?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </form>
|