/home/mjc1/public_html/onlinecs/selldetailexcel.inc.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
<? session_start(); ?>
<?php 
include_once("_common.php");?>

<? 
header
"Content-type: application/vnd.ms-excel" ); 
header"Content-Disposition: attachment; filename=¼öÁÖ»ó¼¼³»¿ª(ÁÖ¹®¹øÈ£-$uid).xls" ); 
header"Content-Description: PHP4 Generated Data" ); 
?>
<link href="../onlinecs/css/style.css" media="print" rel="stylesheet" type="text/css">

<?
    
if(( $id == "" ) && ( $sid == "" )) { 
?>

<script>
    alert("e¼ö¹ßÁÖ ·Î±×ÀΠÈÄ¿¡ À̿밡´ÉÇÕ´Ï´Ù.");
    location.href = "../onlinecs/intro.php";
</script>

<?     
     
}

  include(
"../onlinecs/commonST.php");
                
// ¿É¼Ç °ª 


    
$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±âÁشܰ¡
    
    
}


        
?>
<script>
var boxnum = document.getElementsByName("c_ordbox[]");    //¹Ú½º¼ö·®
var nat = document.getElementsByName("c_ordunit[]");    //³¹°³¼ö·®
var ordqnt = document.getElementsByName("c_ordqnt[]");    //¼ö·®
var delqnt = document.getElementsByName("c_packqnt[]");//³»Ç°¼ö

function surangresult(n){    //¼ö·®

    var m = n;
    var div = Number(ordqnt[m].value) / Number(delqnt[m].value);
    var div2 = Number(ordqnt[m].value) % Number(delqnt[m].value);
    if(delqnt[m].value == '0'){
    nat[m].value = parseInt(ordqnt[m].value);
    boxnum[m].value = '0';
    } else {
    boxnum[m].value = parseInt(div);
    nat[m].value = parseInt(div2);
    }
//    hap();
}
</script>

        <!-- °Å·¡Ã³¿øÀå ¸®½ºÆ® -------------------------- ½ÃÀÛ -->
            <table width="950" height="25" border="1" cellpadding="0" cellspacing="0" bordercolor="#0000ff" bgcolor="#3d83bd">
                <tr>
                    <td width="100%" class="txt07" valign="middle">
<? if($optbox == "0"){ ?>
                        <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%" bgcolor="#3d83bd" class="txt03">
                            <tr>
                                <td width="5%" align="center" valign="middle">
                                    <b>¹øÈ£
                                </td>
                                <td width="25%" align="center" valign="middle">
                                    <b>»óǰ¸í    
                                </td>
                                <td width="25%" align="center" valign="middle">
                                    <b>±Ô°Ý    
                                </td>
                                <td width="5%" align="center" valign="middle">
                                    <b>¼ö·®
                                </td>
                                
<? if($optmhide == '1'){ ?>

<? } else { ?>
                                <td width="8%" align="center" valign="middle">
                                    <b>´Ü°¡
                                </td>
                                <td width="8%" align="center" valign="middle">
                                    <b>±Ý¾×    
                                </td>
<? ?>
<? 
if($optmhide == '1'){ ?>
                                <td width="16%" align="center" valign="middle">
                                    <b>ºñ°í    
                                </td>
<? } else { ?>
                                <td width="20%" align="center" valign="middle">
                                    <b>ºñ°í    
                                </td>
<? ?>
                            </tr>
                        </table>
<? } else { ?>
                        <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%" bgcolor="#3d83bd" class="txt03">
                            <tr>
                                <td width="5%" align="center" valign="middle">
                                    <b>¹øÈ£
                                </td>
                                <td width="25%" align="center" valign="middle">
                                    <b>»óǰ¸í    
                                </td>
                                <td width="25%" align="center" valign="middle">
                                    <b>±Ô°Ý    
                                </td>
                                <td width="5%" align="center" valign="middle">
                                    <b>¼ö·®
                                </td>
<? if($optmhide == '1'){ ?>

<? } else { ?>
                                <td width="9%" align="center" valign="middle">
                                    <b>´Ü°¡
                                </td>
                                <td width="9%" align="center" valign="middle">
                                    <b>±Ý¾×    
                                </td>
<? ?>
                                <td width="18%" align="center" valign="middle">
                                    <b>ºñ°í    
                                </td>
                            </tr>
                        </table>
<? ?>

                    </td>
                </tr>
            </table>





    
<?  
        $detailqry 

                SELECT  d.seq, d.pname, d.pcode, d.pnorm, d.ordqnt, d.price, (d.ordqnt * d.price) AS money, d.bigo, m.ordno, m.ccode, p.code, p.packqnt
                FROM product_m AS p LEFT JOIN (ordbook_d AS d LEFT JOIN ordbook_m AS m ON(d.ordno = m.ordno)) ON (p.code =  d.pcode)
                WHERE d.ordno = '
$uid' AND m.ccode = '$cuscode'

                "
;
        
$detailresult mysql_query($detailqry) or die (mysql_error());




$i 1;
    while(
$Drows =  mysql_fetch_array($detailresult)){

            
$tdtotal $Drows[price] * $Drows[ordqnt];
$line $i 2;
if(
$line =="0"){
 
$tdcolor "#f6f6f6";
} else { 
 
$tdcolor "#ffffff";
}
?>
<? 
if($optbox == "0"){ ?>
                        <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%" class="txt07" bgcolor='<?=$tdcolor?>'>
                            <tr class="txt07">
                                <td width="5%" align="center" valign="middle" height="20" >
                                    &nbsp;<?=$i;?>
                                </td>
                                <td width="25%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[pname]?>    
                                </td>
                                <td width="25%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[pnorm]?>    
                                </td>
                                <td width="5%" align="center" valign="middle">
                                    &nbsp;<?=$Drows[ordqnt]?>    
                                </td>
                                
<? if($optmhide == '1'){ ?>

<? } else { ?>
                                <td width="8%" align="right" valign="middle">
                                    &nbsp;<?=number_format($Drows[price])?>&nbsp;    
                                </td>
                                <td width="8%" align="right" valign="middle">
                                    &nbsp;<?=number_format($Drows[money])?>&nbsp;    
                                </td>
<? ?>
<? 
if($optmhide == '1'){ ?>
                                <td width="16%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[bigo]?>    
                                </td>
<? } else { ?>
                                <td width="20%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[bigo]?>    
                                </td>
<? ?>
                            </tr>
                        </table>
<? } else { ?>
                        <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%" class="txt07" bgcolor='<?=$tdcolor?>'>
                            <tr class="txt07">
                                <td width="5%" align="center" valign="middle" height="20" >
                                    &nbsp;<?=$i;?>
                                </td>
                                <td width="25%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[pname]?>    
                                </td>
                                <td width="25%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[pnorm]?>    
                                </td>
                                <td width="5%" align="center" valign="middle">
                                    &nbsp;<?=$Drows[ordqnt]?>    
                                </td>
<? if($optmhide == '1'){ ?>

<? } else { ?>
                                <td width="9%" align="right" valign="middle">
                                    &nbsp;<?=number_format($Drows[price])?>&nbsp;    
                                </td>
                                <td width="9%" align="right" valign="middle">
                                    &nbsp;<?=number_format($Drows[money])?>&nbsp;    
                                </td>
<? ?>
                                <td width="18%" align="left" valign="middle">
                                    &nbsp;<?=$Drows[bigo]?>    
                                </td>
                            </tr>
                        </table>
<? ?>
<script>
surangresult(<?=$i-1?>);
</script>                                

<? $i++;     } ?>