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
|
<?php $dir = "."; include_once($dir."/_common.php");
if($eid==''){ alert('e천년경영 로그인 후에 이용가능합니다.',"index.php"); exit; }
//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()); }
//$order_key = 'a.dealdate desc, data_created desc ';
if($smode=='comp'){ $where = " and a.writedate >= '{$sdate}' and a.writedate <= '{$edate}' and a.etax_appv_no = '' "; } else { $where = " and a.dealdate >= '{$sdate}' and a.dealdate <= '{$edate}' and b.taxno is null "; }
if($stx!=''){ $where .= " and {$sti} like '%{$stx}%' "; }
if($stc!=''){ $where .= " and a.ccode = '{$stc}' "; }
if($stpc!=''){ $where .= " and prod_cate_code2 = '{$stpc}' "; }
if($smode=='comp'){ $sql = "select a.midx, b.seq, a.ccode, a.writedate, c.code1, c.comp_sn, c.comp_name, b.dealdate, b.pname, b.pnorm, b.unit, b.qty, b.price, b.sup_amt, b.vat, (b.sup_amt+b.vat) as tot_amt, b.remarks, a.tax_type from sale_tax_m a left join sale_tax_d b on a.midx = b.midx left join customers c on a.ccode = c.code where 1=1 $where order by midx, seq, ccode "; } else { $sql = "select a.midx, b.seq, a.ccode, c.code1, c.comp_sn, c.comp_name, a.dealdate, b.tax_type, b.pname, b.pnorm, d.unit, b.qty, b.price, b.sup_amt, b.vat, b.tot_amt, b.remarks from sale_m a left join sale_d b on a.midx = b.midx left join customers c on a.ccode = c.code left join product_m d on b.pcode = d.code where 1=1 $where order by a.ccode, b.tax_type, a.dealdate, a.midx, b.seq; "; } $result = mysql_query($sql,$connect_e1000y);
//_pr($sql); while($cus_info=mysql_fetch_array($result)){ $list_array[] = $cus_info; }
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='sale_list_form' method='post'> <input type='hidden' name='sel_mode' value='detail'> <input type='hidden' name='sdate' value='<?php echo $sdate?>'> <input type='hidden' name='edate' value='<?php echo $edate?>'> <input type='hidden' name='sendmode' value=''> <input type='hidden' name='smode' size='' value='<?php echo $smode;?>'> <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:70px;"><col style="width:90px;"><col style="width:110px;"> <?php if($smode=='comp'){?><col style="width:70px;"><?php }?> <col style="width:70px;"><col style="width:50px;"><col style="width:120px;"> <col style="width:80px;"><col style="width:50px;"><col style="width:70px;"> <col style="width:80px;"> <col style="width:90px;"><col style="width:80px;"><col style="width:90px;"> <?php if($smode!='comp'){?><col style="width:100px;"><?php }?> </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> <?php if($smode=='comp'){?><th scope="col">작성일</th><?php }?> <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> <?php if($smode!='comp'){?><th scope="col">전표비고</th><?php }?> </tr> </thead> <tbody> <?php $tmp_ccode = "0"; $s_qty = 0;$s_amt = 0; $s_vat = 0; $s_tot = 0; $cnt = 0; for($i=0;$i<count($list_array);$i++){ $info = $list_array[$i]; if($smode=='comp'){ $g_marker = $info['midx']; } else { $g_marker = $info['ccode']; } //echo $tmp_ccode." = ".$info['ccode']." - {$i}<br>"; if($tmp_ccode!=$g_marker){ // 거래처 or taxno가 바꼈을때 if($i>0){ ?> <tr> <td class="tcenter " colspan=<?php if($smode=='comp'){?>10<?php } else {?>9<?php }?>></td> <td class="cost cost_color_db"><?php echo number_format($s_qty);?></td> <td class="cost cost_color_db"></td> <td class="cost cost_color_db"><?php echo number_format($s_amt);?></td> <td class="cost cost_color_db"><?php echo number_format($s_vat);?></td> <td class="cost cost_color_db"><?php echo number_format($s_tot);?></td> <?php if($smode!='comp'){?> <td class="cost cost_color_db" ></td> <?php }?> </tr> <?php $s_qty = 0;$s_amt = 0; $s_vat = 0; $s_tot = 0; } ?> <tr> <td class="tcenter "> <input type='checkbox' name='code_idx[]' value='<?php echo $cnt;?>' class='sub_checkbox'> <input type='hidden' name='codes[]' value='c^<?php echo $info['ccode'];?>'> </td> <?php if($smode=='comp'){?> <td class="linetxt cust_sum_class" colspan=14>일련번호 : <?php echo $info['midx'];?></td> <?php } else {?> <td class="linetxt cust_sum_class" colspan=14>거래처명 : [<?php echo $info['code1'];?>]<?php echo $info['comp_name'];?></td> <?php }?> </tr> <?php $tmp_ccode = $g_marker; $cnt++; } ?> <tr> <td class="tcenter "> <input type='checkbox' name='code_idx[]' value='<?php echo $cnt;?>'> <input type='hidden' name='codes[]' value='g^<?php echo $info['ccode'];?>^<?php echo $info['midx'];?>^<?php echo $info['seq'];?>'> </td> <td class="tcenter "><?php echo $info['code1'];?></td> <td class="tcenter "><?php echo $info['comp_sn']?></td> <td class="linetxt click_edit"><?php echo $info['comp_name'];?></td> <?php if($smode=='comp'){?> <td class="tcenter"><?php echo $info['writedate'];?></td> <?php }?> <td class="tcenter"><?php echo $info['dealdate'];?></td> <td class="tcenter"><?php echo $tax_yn[$info['tax_type']];?></td> <td class="linetxt "><?php echo $info['pname'];?></td> <td class="linetxt "><?php echo $info['pnorm'];?></td> <td class="linetxt "><?php echo $info['unit'];?></td> <td class="cost "><?php echo number_format($info['qty']);?></td> <td class="cost "><?php echo number_format($info['price']);?></td> <td class="cost "><?php echo number_format($info['sup_amt']);?></td> <td class="cost "><?php echo number_format($info['vat']);?></td> <td class="cost "><?php echo number_format($info['tot_amt']);?></td> <?php if($smode!='comp'){?><td class="linetxt "> <?php echo $info['remarks'];?></td> <?php }?> </tr> <?php $cnt++; $s_qty += $info['qty']; $s_amt += $info['sup_amt']; $s_vat += $info['vat']; $s_tot += $info['tot_amt']; } if(count($list_array)>0){ ?> <tr> <td class="tcenter " colspan=<?php if($smode=='comp'){?>10<?php } else {?>9<?php }?>></td> <td class="cost cost_color_db"><?php echo number_format($s_qty);?></td> <td class="cost cost_color_db"></td> <td class="cost cost_color_db"><?php echo number_format($s_amt);?></td> <td class="cost cost_color_db"><?php echo number_format($s_vat);?></td> <td class="cost cost_color_db"><?php echo number_format($s_tot);?></td> <?php if($smode!='comp'){?> <td class="cost cost_color_db" ></td> <?php }?> </tr> <?php } ?> </tbody> </table> </div> </div> </form>
|