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
|
<?php $charSetEncoding = "set names utf8"; mysql_query($charSetEncoding);
function _pr($v){ echo "<pre>"; print_r($v); echo "</pre>"; }
// Notice Error 방지 if(!isset($category_code)) $category_code = ""; if(!isset($orderdate)) $orderdate = ""; if(!isset($orderstate)) $orderstate = ""; if(!isset($ordertype)) $ordertype = ""; if(!isset($ocopy)) $ocopy = ""; if(!isset($limitbaln)) $limitbaln = ""; if(!isset($trnum)) $trnum = "0"; //줄번호. 코드순서가 이상함. if(!isset($today)) $today = ""; if(!isset($hidden)) $hidden = ""; if(!isset($id)) $id = ""; if(!isset($sid)) $sid = ""; if(!isset($cuscode)) $cuscode = ""; if(!isset($sacode)) $sacode = ""; if(!isset($optsmoney)) $optsmoney = ""; if(!isset($optlimit)) $optlimit = ""; if(!isset($optregdate)) $optregdate = ""; if(!isset($optbox)) $optbox = "";
if(( $id == "" ) && ( $sid == "" )){ echo "<script>alert('천년스마트발주 로그인 후에 이용가능합니다.');location.href = './login.php';</script>"; }
// 접속권한 체크 include("./checkLicenses.php");
// part : # 거래분야(0:매입,1:매출,2: 매입,매출) if(isset($row) && $row['part'] == "0"){ echo "<script>alert('발주처만 이용 가능합니다.');location.href = './index.php';</script>"; } isset($_GET['uid']) ? $uid = $_GET['uid'] : $uid = ""; isset($_GET['detail']) ? $detail = $_GET['detail'] : $detail = ""; isset($_GET['new']) ? $new = $_GET['new'] : $new = ""; isset($_GET['txtdate']) ? $txtdate = $_GET['txtdate'] : $txtdate = ""; isset($_GET['txtdate2']) ? $txtdate2 = $_GET['txtdate2'] : $txtdate2 = ""; isset($_GET['addressValue']) ? $addressValue = $_GET['addressValue'] : $addressValue = "*"; $addr = explode("*", $addressValue);
$optionqry = "SELECT optname, optvalue FROM options"; $optresult = mysql_query($optionqry); while( $optrow = mysql_fetch_array($optresult)){
if($optrow['optname'] == "ON라인신규고객등록") $optnew = $optrow['optvalue']; if($optrow['optname'] == "ON주문시금액숨김") $optmhide = $optrow['optvalue']; if($optrow['optname'] == "주문한도숨김") $optlimit = $optrow['optvalue']; if($optrow['optname'] == "선수금주문방식") $optsmoney = $optrow['optvalue']; if($optrow['optname'] == "ON주문시박스관리") $optbox = $optrow['optvalue']; if($optrow['optname'] == "ON지정상품분류") $optcate = $optrow['optvalue']; if($optrow['optname'] == "ON지정상품") $optpro = $optrow['optvalue']; if($optrow['optname'] == "ON특별단가적용") $optspe = $optrow['optvalue']; if($optrow['optname'] == "다중단가계산기준") $optdac = $optrow['optvalue']; //0 매입단가 1매출단가 2기준단가 if($optrow['optname'] == "상품매출가숨김") $optpophide = $optrow['optvalue']; if($optrow['optname'] == "온주현재고표시") $optinvnqnt = $optrow['optvalue']; if($optrow['optname'] == "온주상품비고숨김") $optproductbigo = $optrow['optvalue']; if($optrow['optname'] == "금액소수점수") $pricepoint = $optrow['optvalue']; if($optrow['optname'] == "단가소수점수") $unitpoint = $optrow['optvalue']; if($optrow['optname'] == "수량소수점수") $amountpoint = $optrow['optvalue'];
if($optrow['optname'] == "특별단가사용") $optspe = $optrow['optvalue']; if($optrow['optname'] == ("특별단가적용방식". $sacode)) $optspemode = $optrow['optvalue']; if($optrow['optname'] == "원단위자리수") $optwon = $optrow['optvalue']; if($optrow['optname'] == "원단위처리") $optwoncut = $optrow['optvalue'];
if($optrow['optname'] == "온주세트상품조회") $sp_set_view = $optrow['optvalue']; } //prt($optbox);
$sql = "SELECT * FROM customer WHERE code = '{$cuscode}'"; $result = mysql_query($sql); $cuso = mysql_fetch_array($result);
// 담당자 정보 가져옴 $sql = "select code, name from local_user where code = '{$cuso['charge']}'"; $res = mysql_query($sql); $lu_info = mysql_fetch_array($res);
if($sid == "mjtest"){ if($txtdate == ""){ $txtdate = ($txtdate == "") ? date("2010-11-01") : $txtdate; } if($txtdate2 == ""){ $txtdate2 = ($txtdate2 == "") ? date("2010-11-30") : $txtdate2; } }else{ if($txtdate == ""){ $txtdate = ($txtdate == "") ? date("Y-m-d", strtotime("-7 Day")) : $txtdate; } if($txtdate2 == ""){ $txtdate2 = ($txtdate2 == "") ? date("Y-m-d", time()) : $txtdate2; } }
//--------주문처 정보 -----------// $Ctopsql = " SELECT code, compname, telno1, fax FROM office WHERE code = '{$sacode}'"; $Cresult = mysql_query($Ctopsql); if( mysql_num_rows($Cresult) > 0){ $crow = mysql_fetch_array($Cresult);
$Cname = $crow['compname']; $Ctel = $crow['telno1']; $Cfax = $crow['fax']; }
if($cuso['taxmode']=='2'){ // 거래처가 부가세별도인 업체일경우 $add_sql = "*110/100"; } else { $add_sql = ""; }
//한도잔액 $today = date("Y-m-d"); //오늘날짜
# part # 0 -매입(발주), 1-매출(수주) # route # 주문경로: 0 - 자체처리(off line), 1 - 웹처리(on line), 2 - 쇼핑몰 $Lqry = "SELECT limitbaln - curn_baln_sale -
( SELECT IF(ISNULL(SUM(d.ordqnt*d.price)), 0, SUM(d.ordqnt*d.price)) AS sumtot FROM ordbook_m AS m, ordbook_d AS d WHERE m.ordno = d.ordno AND m.route = 1 AND m.ccode = '{$cuscode}' AND m.part = 1 AND d.delqnt = 0 AND m.orddate BETWEEN '{$today}' AND '{$today}' AND m.ordno != '{$uid}' ) AS sum1, (curn_baln_sale*-1) - ( SELECT IF(ISNULL(SUM(d.ordqnt*d.price)), 0, SUM(d.ordqnt*d.price){$add_sql}) AS sumtot FROM ordbook_m AS m, ordbook_d AS d WHERE m.ordno = d.ordno AND m.route = 1 AND m.ccode = '$cuscode' AND m.part = 1 AND d.delqnt = 0 AND m.orddate BETWEEN '$today' AND '$today' AND m.ordno !='$uid' ) AS sum2, limitbaln, curn_baln_sale - curn_baln_buy AS misu, curn_baln_sale FROM customer WHERE CODE = '{$cuscode}' ";
$Lresult = mysql_query($Lqry) or die (mysql_error()); if(mysql_num_rows($Lresult) > 0){ $Lrow = mysql_fetch_array($Lresult);
$limitbaln = $Lrow['limitbaln']; // jyh $limitbaln = $Lrow['limitbaln']; // jyh //if($optsmoney=='1' && $Lrow['misu']<0){ // 선수금일경우 마이너스 금액을 곱해서 양수만들어서 한도 처리 if($optsmoney=='1'){ // 선수금일경우 마이너스 금액을 곱해서 양수만들어서 한도 처리 (원래 선수금일때 미수가 -인경우만 양수만드는 루틴 처리되었는데...+미수인사람이 주문이 되어서 -미수인 조건없이 선수금일때 무조건 -미수를양수만드는 작업함) $limitbaln = $Lrow['misu']*$Lrow['misu']; $Lrow['limitbaln'] = $limitbaln; } if($cuso['salestop'] == 2){ // 해당 if 문 jyh 추가(한도일시 해제 일 경우 무제한 구매와 동일하게 처리하기 위해 넣음.) $limitbaln = 0; $Lrow['limitbaln'] = 0; } if($limitbaln == 0){ //if($limitbaln == "0"){ //$limit_m = "0"; $limit_m = 0; } else { if ($optsmoney == "1"){ // <선수금> 주문만 허용일 경우 한도잔액은 무시되고 -선수금에서 완납안된 발주금액을 빼에서 해당금액을 정수만들어 한도금액으로 책정함으로 했다가 원복됨 $limit_m = $Lrow['sum2']; } else { //$limit_m = str_replace("-","",$Lrow['curn_baln_sale']); jyh 잠시 고침. $limit_m = $Lrow['sum1']; } } //--------주문 정보 -----------//
//주문 정보 $today = ($today == "") ? date("Y-m-d", time()) : $today; $Orderqry = "SELECT SUM(d.ordqnt * d.price) AS totalmoney, m.ordno, m.orddate, m.deldate, m.bigo, m.ordstate, m.ordtime, m.ccode, m.shop_phone02, m.shop_memo, m.shop_receiver_uname, m.shop_receiver_zipcode, m.shop_receiver_address, m.shop_receiver_phone01, m.shop_receiver_phone02 FROM ordbook_d AS d LEFT JOIN ordbook_m AS m ON d.ordno = m.ordno WHERE m.ordno = '{$uid}' AND m.ccode = '{$cuscode}' ";
$Ordresult = mysql_query($Orderqry) or die (mysql_error()); $Orow = mysql_fetch_array($Ordresult); $ordtime = $Orow['ordtime']; $orddate = $Orow['orddate']; $deldate = $Orow['deldate']; if($ordtime == ""){ $Rtime = ""; } else { $Rtime = "20".substr($ordtime,0,2)."-".substr($ordtime,2,2)."-".substr($ordtime,4,2)." ".substr($ordtime,6,2).":".substr($ordtime,8,2) ; }
if($Orow['ordstate'] > 1) { $defaultlimitmoney = $limit_m; }else if($Orow['orddate'] != $today){ // jyh 추가 $defaultlimitmoney = $limit_m; } else { if($cuso['taxmode']=='2'){ // 거래처가 부가세별도인 업체일경우 $defaultlimitmoney = $limit_m - $Orow['totalmoney']*1.1; } else { $defaultlimitmoney = $limit_m - $Orow['totalmoney']; } //$defaultlimitmoney = $limit_m; // jyh 잠시 고침 } //jyh 추가 if($limit_m == 0){ $defaultlimitmoney = $limit_m; } $addr = explode("*", $addressValue); $Orow['shop_receiver_zipcode'] = $addr[0] != "" ? $addr[0] : $Orow['shop_receiver_zipcode']; $Orow['shop_receiver_address'] = $addr[1] != "" ? $addr[1] : $Orow['shop_receiver_address'];
}
if($Orow['orddate']!=''){
} else { if($new_start['orddate']!=''){ $orddate = $new_start['orddate']; } if($new_start['deldate']!=''){ $deldate = $new_start['deldate']; }
if($orddate=='') { $orddate = date("Y-m-d",time()); } if($deldate=='') { $deldate = date("Y-m-d",time()); } }
?> <script> $(function(){ $(".readonly_class").attr("readonly","enabled"); }); </script> <style> .tab_container .tab_content {display:block;} .btn_total span.b2 {height:50px;} .btn_total a {line-height:50px !important;}
.search .order {display:block;float:left;width:48.7%;margin-top:3px;}/*4열*/ .search .odd {margin-right:2%;} .search .order_w {display:inline-block;width:100%;margin-top:3px;}/*2열*/ .search .order h3, .search .order_w h3 {display:inline-block;float:left;line-height:27px;font-weight:600;letter-spacing:-1px;} .search .order h3 {width:40%;} .search .order_w h3 {width:19%;} .search .order p {width:58%;padding-left:2%;letter-spacing:-1px;line-height:27px;overflow:hidden} .search .order p span {line-height:1.25em;} .search .order_w p {width:78.9%;padding-left:1.6%;line-height:27px;overflow:hidden;} .search .order input[type=text] {width:90%;}
.readonly_class { background:#e9e9e9; }
.button_size_class {font-size:20px !important;}
.search .order {display:block;float:left;width:48.7%;margin-top:3px;}/*4열*/ .search .odd {margin-right:2%;} .search .order_w {display:inline-block;width:100%;margin-top:3px;}/*2열*/ .search .order h3, .search .order_w h3 {display:inline-block;float:left;line-height:27px;font-weight:600;letter-spacing:-1px;} .search .order h3 {width:40%;} .search .order_w h3 {width:19%;} .search .order p {width:58%;padding-left:2%;letter-spacing:-1px;line-height:27px;overflow:hidden} .search .order p span {line-height:1.25em;} .search .order_w p {width:78.9%;padding-left:1.6%;line-height:27px;overflow:hidden;} .search .order input[type=text] {width:90%;}
/*buyWrite 저장하기*/ .btnArea {position:relative;margin:10px 0 0;padding:5px 10px 7px;text-align:right;height:25px;border-top:1px solid #c8c8c8;border-bottom:1px solid #c8c8c8;} .btn_total{position:relative;margin:20px 0;height:32px;} .btn_total span.b4 {display:block;float:left;margin-right:2%;width:22.8%;height:32px;} .btn_total span.b3 {display:block;float:left;margin-right:2%;width:31.3%;height:32px;} .btn_total span.b2 {display:block;float:left;margin-right:2%;width:48.2%;height:32px;} .btn_total span:last-child {margin-right:0%;} .btn_total a, .btn_total input[type=button] {line-height:32px !important;border:0;background:none;}
.p_line {border-top:2px solid #6288bf;} .product {width:100%;border-left:1px solid #c3cedc;border-right:1px solid #c3cedc;background:#FFF;} .product .odd, .product .daily {background:#f3f9fb;} .product .deposit{background:#fefee9;} .product .deposit_b {border-top:2px solid #6288bf;} .product thead td {font-weight:600;} .product th{padding:2px 0;font-size:0.95em;font-weight:600;letter-spacing:-1px;border-bottom:1px solid #c3cedc;background:#accaf2;} .product th a {font-size:1em;font-weight:600;} .product td{padding:2px;height:27px;font-size:0.85em;text-align:center;white-space:normal;border-bottom:1px solid #c3cedc;} .product input[type=checkbox] {width:21px;height:21px;} .product td p{display:block;margin:0 auto;width:15px;height:15px;border:1px solid #afafaf;} .product td strong {font-size:1em;} .product .lineR {border-right:1px solid #c3cedc;} .product td .b_blue, .product td .b_defn {float:right;width:25%;}
#order_tr_idx { display:none; } .button_size_class { font-size:20px; height:35px; width:90%; padding-top:10px; margin:0 auto; } .readonly_class { background:#e9e9e9; } input.it { font-size:1.1em; } </style>
|