/home/mjc1/public_html/manage/program_month.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
247
<? @session_start();?>
<?
   Header
("P3P: CP='NOI DSP COR IVAa OUR BUS IND UNI COM NAV INT'"); 
   
if(
$_SESSION[ADMINID] == "mijin" || $_SESSION[ADMINID] == "psw" || $_SESSION[ADMINID] == "csh" || $_SESSION[ADMINID] == "jkj"  || $_SESSION[ADMINID] == "osm"  ){

} else {
?>
<script>
 location.href = "index.php";
</script>
<?    
    
}
?>    
<? 

$nowyear 
date("Y"time());
$nowmonth date("m"time());
    if (
$year == "") { 
    
$year $nowyear
      }
    if (
$month == "") { 
         
$month $nowmonth;
      }
?>
<script type="text/javascript" src="../onlinecs/js/PopupCalendar.js"></script>
<?
    
include("../manage/category/common.php");
?>

<?

    $userid 
$_SESSION[ADMINID];

    
$nameQry       =  " SELECT admin_name From admin WHERE admin_id = '$userid' ";
    
$nameResult    =    MYSQL_QUERY($nameQry);

    
$nameRow  =  MYSQL_FETCH_ARRAY($nameResult);

    
$adminName $nameRow[admin_name];
    
mysql_close;

?>

<link href="../css/style.css" rel="stylesheet" type="text/css">

<SCRIPT LANGUAGE="JavaScript">

 function programchg(chg)
 {
    var type = document.getElementsByName("programtype")[0].value;
    var year = document.getElementsByName("year")[0].value;
    var month = document.getElementsByName("month")[0].value;
    location.href = "program_month.php?menu=<?=$menu?>&sub=<?=$sub?>&programtype="+type+"&year="+year+"&month="+month+"";
 }

 function Search()
     {
    var type = document.getElementsByName("programtype")[0].value;
    var year = document.getElementsByName("year")[0].value;
    var month = document.getElementsByName("month")[0].value;
    location.href = "program_month.php?menu=<?=$menu?>&sub=<?=$sub?>&programtype="+type+"&year="+year+"&month="+month+"";
    
}
</SCRIPT>
<title>°ü¸®ÀÚ ÆäÀÌÁö</title> 
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel=stylesheet type=text/css href=style.css>
<script language='javascript' src='../js/left_menu.js'></script>
<script language='javascript' src='../js/img.js'></script>
<body bgcolor=white  topmargin=0 leftmargin=0>
<? include("memberManage.php"); ?>
<? 
include("../manage/category/opcommon.php"); ?>

<br>

<!-- ÇÏ´Ü -->
<table border=0 cellpadding=0 cellspacing=0 width="954" align="center" >
    <tr>
        <td height="20">
        </td>
    </tr>
    <tr>
        <td height="50">
            <img src="../manage/img/program_title2.gif">
        </td>
    </tr>
    <tr>
        <td>
            <!-- Åë°è ¸ÞÀΠ-->
            <?
            
                        
//ÇÁ·Î±×·¥ ÄÚµå
                        
if($programtype == "999"){    
                              
$programcode "";
                            } else if (
$programtype == ""){
                              
$programcode "";
                            } else {
                              
$programcode "AND app_code = '$programtype' ";
                            }
                        if(
$year == "" || $month == ""){

                            
$searchdate "WHERE DATE_FORMAT( `frst_rgst_dtm`,'%Y-%m') = '$nowyear-$nowmonth'";

                        } else {
                            
$searchdate "WHERE DATE_FORMAT( `frst_rgst_dtm`,'%Y-%m') = '$year-$month'";                            
                        }

                          
$total_sql  .=   "SELECT DATE( `frst_rgst_dtm`) AS idxday, DAYOFWEEK(`frst_rgst_dtm`) AS daytype , count(*) AS install ,sum(`uninstalled`)                        AS uninstall from `macs`
                                              
$searchdate $programcode
                                            group by DATE( `frst_rgst_dtm`) 
                                            
                                            "
;

                          
$result      mysql_query($total_sql) or die (mysql_error());
                                                  
                          
$sql    $total_sql "  ORDER BY idxday";
                         
                          
$result mysql_query($sql) or die (mysql_error());
                          
//                        echo $total_sql;
                          
$i 0;    

                        if(
$programtype == "999" || $programtype == ""){
                          
$csql "SELECT COUNT(*) AS instcom, SUM(uninstalled) AS uninstcom FROM macs WHERE DATE_FORMAT( `frst_rgst_dtm`,'%Y-%m') = '$year-$month' ";
                        } else {
                          
$csql "SELECT COUNT(*) AS instcom, SUM(uninstalled) AS uninstcom FROM macs WHERE DATE_FORMAT( `frst_rgst_dtm`,'%Y-%m') = '$year-$month' AND app_code = '$programtype'";
                        }

                          
$cresult mysql_query($csql);
                          
$crow mysql_fetch_array($cresult);
                          
$instcom $crow[instcom];
                          
$uninstcom $crow[uninstcom];

                          if( 
$uninstcom || $instcom ){
                              
$comper1 =  $uninstcom $instcom;
                              
$comper =  $comper1 100;
                          } else {
                             
                              
$comper 0;
                              
                          }

            
?>
                                <table width="1000" border="0" cellpadding="3" cellspacing="1" bgcolor="#d0daf0">
                                    <tr bgcolor="#ffffff"> 
                                        <td height="30" colspan="10" width="1000" align="center" >
                                            <font color="#333333"><b>¼³Ä¡ÄÄÇ»Åͼö: <font color="#0099ff"><?=$instcom?><font color="#333333"> | 
                                            »èÁ¦ ÄÄÇ»Åͼö:<font color="#f26600">  <?=$uninstcom?> <font color="#333333">(»èÁ¦À²: <font color="#ff0000"><?=round($comper)?>        <font color="#333333">%)
                                        </td>
                                    </tr>
                                    <tr bgcolor="#ffffff">
                                        <td colspan="2" align="center">
                                             <font color="#333333"><b>ÇÁ·Î±×·¥¸í:
                                             <select name="programtype" onchange="programchg(this.value);">
                                                 <option value="999">ÇÁ·Î±×·¥ Àüü </option>
                                     <? 
                                        $codeqry 
"SELECT cde, cde_nm FROM codes WHERE cdiv = '01' AND flag1 = 'A' ORDER BY flag2";
                                        
$coderesult mysql_query($codeqry);
                                        while(
$coderow mysql_fetch_array($coderesult)){ ?>
                                                <option value="<?=$coderow[cde]?><? if($programtype == $coderow[cde]){ echo "selected";} ?> ><? echo $coderow[cde]." ".$coderow[cde_nm]; ?> </option>
                                     <? ?>
                                             </select>
                                        </td>
                                    <form name='searchFrm' method='post' >
                                        <td colspan="3" align="center">
                                            <input type='hidden' name='SearchMdiv' value='search'>
                                            <input type="hidden" name="menu" value="<?=$menu?>">
                                            <input type="hidden" name="sub" value="<?=$sub?>">
                                            <input type='hidden' name='searchid' value='<?=$searchid;?>'>
                                             <font color="#333333"><b>¿ùº°Åë°è:
                                            <select name="year">
                                        <? 
                                            $year 
"2011";
                                            for(
$i=0;$i<=5;$i++){
                                        
?>
                                                <option value="<?=$year?><? if($nowyear == $year){ echo "selected"; } ?> ><?=$year?></option>
                                        <? $year++;
                                            } 
?>
                                            </select>
                                            <select name="month">
                                        <? 
                                            $monthnum 
"1";
                                            for(
$i=0;$i<=11;$i++){
                                            
$monthnum str_pad($monthnum,2,"0",STR_PAD_LEFT); //¾ÕÀÚ¸® 0ä¿ì±â 6ÀÚ¸®·Î ±¸¼º
                                        
?>
                                                <option value="<?=$monthnum?><? if(number_format($month) == $monthnum){ echo "selected"; } ?> ><?=$monthnum?></option>
                                        <? $monthnum++;
                                            } 
?>
                                            </select>
                                            <a href='javascript:Search();'><img src="../onlinecs/img/common/search_bt.gif" border="0" align="absmiddle" style="cursor:hand;">
                                        </td>
                                    </form>
                                    </tr>
                                    <tr bgcolor="#02689f"> 
                                        <td class="txt03" width="20%" height="22" align="center"><font color="#ffffff"><b>³¯Â¥</td>
                                        <td class="txt03" width="20%" height="22" align="center"><font color="#ffffff"><b>¿äÀÏ</td>
                                        <td class="txt03" width="20%" height="22" align="center"><font color="#ffffff"><b>¼³Ä¡¼ö</td>
                                        <td class="txt03" width="20%" height="22" align="center"><font color="#ffffff"><b>»èÁ¦¼ö</td>
                                        <td class="txt03" width="20%" height="22" align="center"><font color="#ffffff"><b>»èÁ¦·ü</td>
                                    </tr>
                <? while ($row =  mysql_fetch_array($result)){ 
                    
                    
$line $i 2;
                    if(
$row[daytype] == "1"$daytype "<font color='#ff0000'>ÀÏ¿äÀÏ";
                    if(
$row[daytype] == "2"$daytype "¿ù¿äÀÏ";
                    if(
$row[daytype] == "3"$daytype "È­¿äÀÏ";
                    if(
$row[daytype] == "4"$daytype "¼ö¿äÀÏ";
                    if(
$row[daytype] == "5"$daytype "¸ñ¿äÀÏ";
                    if(
$row[daytype] == "6"$daytype "±Ý¿äÀÏ";
                    if(
$row[daytype] == "7"$daytype "<font color='#0000ff'>Åä¿äÀÏ";

                    
$percent1 $row[uninstall] / $row[install];
                    
$percent $percent1 100;

                
?>
                                    <tr bgcolor="<? if($line == "1"){ echo "#ffffff"; } else { echo "#f7f7f7"; } ?>">
                                        <td class="txt03" align="center"  style="padding:5pt 5pt;" height ="22"><?=$row[idxday]?></td>
                                        <td class="txt03" align="center"  style="padding:5pt 5pt;"><?=$daytype?></td>
                                        <td class="txt03" align="center"  style="padding:5pt 5pt;"><?=$row[install]?></td>
                                        <td class="txt03" align="center"  style="padding:5pt 5pt;"><?=$row[uninstall]?></td>
                                        <td class="txt03" align="center"  style="padding:5pt 5pt;"><?=number_format($percent,2)?>%</td>
                                    </tr>
                <? $i++;
                    } 
                
?>    
                                </table>

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






<!-- ¸µÅ© µ¥ÄÚ·¹À̼Ǡ³¡ -->


        </td>
        
        <td width="19" >
            <p>&nbsp;</p>
</td>
    </tr>
</table>