/home/mjc1/public_html/manage/test_xls.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
<? 
header
"Content-type: application/vnd.ms-excel" ); 
header"Content-Disposition: attachment; filename=µô·¯ÁÖ¹®ÇöȲ.xls" ); 
header"Content-Description: PHP4 Generated Data" ); 
?> 

<?

  
include("category/common.php");

          if( 
$searchCode2 == 'all')  $Code3 =  " and (m.Mid  like '%$keyword%' or m.Mname  like '%$keyword%' or m.Mcompany  like '%$keyword%' or d.bname  like '%$keyword%' or d.bcomp  like '%$keyword%') ";
          if( 
$searchCode2 == '1')    $Code3 =  " and m.Mid  like '%$keyword%' "//µô·¯¾ÆÀ̵ð
          
if( $searchCode2 == '2')    $Code3 =  " and m.Mname  like '%$keyword%' "//µô·¯À̸§
          
if( $searchCode2 == '3')    $Code3 =  " and m.Mcompany  like '%$keyword%' "//µô·¯È¸»ç¸í
          
if( $searchCode2 == '4')    $Code3 =  " and d.bname  like '%$keyword%' "//±¸¸ÅÀÚÀ̸§
          
if( $searchCode2 == '5')    $Code3 =  " and d.bcomp  like '%$keyword%' "//±¸¸ÅÀÚȸ»ç¸í

          
if( $searchCode1 == 'all')  $Code =  "";
          if( 
$searchCode1 == '1')    $Code =  " and AuthTy = 'card' ";
          if( 
$searchCode1 == '2')    $Code =  " and AuthTy = 'iche' ";
          if( 
$searchCode1 == '3')    $Code =  " and AuthTy = 'noBook' ";       
  
          if( 
$searchCode3 == 'all')  $Code2 =  "";
          if( 
$searchCode3 == '0')    $Code2 =  " and bsend = '0' ";
          if( 
$searchCode3 == '1')    $Code2 =  " and bsend = '1' ";
          if( 
$searchCode3 == '2')    $Code2 =  " and bsend = '2' ";
          if(( 
$txtdate    !== "" ) && ($txtdate !== ""))  $Code4 "  and  d.odate between '$txtdate (00:00)' and '$txtdate2 (23:59)' "//±â°£Ãß°¡


    
$total_sql  .=   " select d.code, d.odate, m.Mid,  m.Mname, m.Mcompany, m.Mtel1, d.bname, d.bsend, d.bdate, d.bmoney, d.bnum, d.bdeliver, d.bcomp, d.btell, d.bhp, d.badd, d.bproduct, d.boption, d.bigo, d.sdate, d.endgubun  from dealerorder as d, member as m  where d.ocode = m.Mcode $Code2 $Code3 $Code4 order by odate desc";

      
//ÇÕ°èÄõ¸®
    
$sum_sql  .=   " select SUM(d.bmoney) AS totalm from dealerorder as d, member as m  where d.ocode = m.Mcode $Code2 $Code3 $Code4 ";

    
$result_sum      mysql_query($sum_sql) or die (mysql_error()); 
 
    
$result      mysql_query($total_sql) or die (mysql_error());
    
$nTotalCount mysql_num_rows($result);

    
$sql    $total_sql;

    
$result mysql_query($sql) or die (mysql_error());

?>

<html> 
<head> 
<title>Excel´Ù¿î</title> 
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"> 
</head> 
<body> 

<table width=100% cellpadding=0 cellspacing=0 border=1> 
<tr align=center height=20 bgcolor=#FFFF99> 
    <td style=font-family:Tahoma;font-size:9pt;><b>ÀÏÀÚ</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>µô·¯¸í</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´¸í</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>Á¦Ç°³»¿ª</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>Ãß°¡¿É¼Ç</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>Àü´Þ»çÇ×</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>±Ý¾×</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´»óÈ£</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´¸í</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´ÀüÈ­</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´ÇÚµåÆù</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b>°í°´ÁÖ¼Ò</b></td> 
</tr>


<?
 
if($num mysql_num_rows($result)){
   
    
$i 1;
   
   while(
$row  mysql_fetch_array($result)) {
   
    if(
$row[AuthTy] == "card")    $AuthTy "Ä«µå";
    if(
$row[AuthTy] == "iche")    $AuthTy "ÀÌü";
    if(
$row[AuthTy] == "noBook")  $AuthTy "¹«ÅëÀå";                   
    
    if(
$row[bsend] == "0")      {  $rSuccYn =  "°áÁ¦";   $_bg "ffffff";}
    elseif(
$row[bsend] == "1")  {  $rSuccYn =  "¹Ì°áÁ¦"$_bg "#CCFFFF";}
    elseif(
$row[bsend] == "2")  {  $rSuccYn =  "¹è¼Û¿Ï·á"$_bg "#FEE2FC";}
    
    if(
$row[bank] == "1"$bank "±¹¹ÎÀºÇà 818102-01-020855";
    else                  
$bank "³óÇù 717-12-054922";
 
 if(
substr$row[rOrdNo] , 0,) == "PRO"){   
   if( 
substr$row[rOrdNo] , 4,) == "A" ) { $code  =  "Á¤Ç°"; }
   if( 
substr$row[rOrdNo] , 4,) == "B" ) { $code  =  "ÀÓ´ë"; }
  }
  else{
    
$code  =  "";
    } 
    
   
$p_Name    explode("-"$row[rOrdNo]); 
  
  if(
$p_Name[0] == "PRO"){
    
   
$p_Qry     "select ProductName from Product WHERE ProductCode = '$p_Name[3]' ";
   
$p_result  =  mysql_query($p_Qry);
                 
  if( 
mysql_num_rows($p_result) > 0){
       
$p_row      mysql_fetch_array($p_result);
       
$p_name  $p_row[0]; 
    }  
  }
 if(
$p_Name[0] == "PAPER"){
   
   
$p_name  "¿ëÁö»óǰ";
   } 
  if(
$p_Name[0] == "HARDWARE"){
   
    
$p_name  $row[rProdNm]; 
    }
    if(
$p_Name[0] == "Direct"){
   
    
//$p_name  = "[¹Ù·Î°áÁ¦]"; 
    
$p_name  $row[rProdNm]; 
    }                    
?>

<tr align=center height=20 bgcolor=#FFFFFF> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[odate];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[Mname];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bname];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bproduct];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[boption];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bigo];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=number_format($row[bmoney]);?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bcomp];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bname];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[btell];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[bhp];?></td> 
    <td style=font-family:Tahoma;font-size:9pt;><?=$row[badd];?></td> 
</tr>

<?
  $i
++;
    } 
?>

            <? 
              $row  
mysql_fetch_array($result_sum)
            
?>

<tr align=center height=20 bgcolor=#CCFFFF> 
    <td style=font-family:Tahoma;font-size:9pt;><b>ÇÕ°è</b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b><?=number_format($row[totalm]);?></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
    <td style=font-family:Tahoma;font-size:9pt;><b></b></td> 
</tr>

<?
 

else{  
   
?>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td height="100" align="cener" colspan="12" width="952"><span style=font-size:9pt;><font face=Verdana>µ¥ÀÌŸ°¡ 
        ¾ø½À´Ï´Ù.</font></span></td>
    </tr>
    <? 
    

?>