Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by macz ( 15 years ago )
<?php session_start();?>
<?php include_once ('../utils/connect.php'); ?>
<?php include_once('../utils/FusionCharts.php');?>
<?php include_once('../utils/createDataSet.php');?>
<?php include_once('../utils/createCategory.php');?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
[removed][removed]
<title>Compare Month</title>
</head>
<?php
 //$year = date('Y');
 $year = 2010;
 $month = ucfirst($_POST['month']);
 $dept1 = $_POST['dept1'];
 $dept2 = $_POST['dept2'];
 
 $select = "SELECT sum(cdr.billsec )AS bill_sec, userprofile.department FROM cdr JOIN userprofile USING (src ) WHERE date_format(calldate , '%b-%Y' ) = '".$month."-".$year."' AND  userprofile.department = '".$dept1."' OR userprofile.department = '".$dept2."' GROUP BY userprofile.department ";

 $strXML = "<chart caption='Compare Month' xAxisName='Department' numberScaleValue='60,60,24,7' numberScaleUnit='min,hr,day,wk'>";
 
 $result = mysql_query($select, $connection);
 $checkNull = false;
 while($row = mysql_fetch_array($result)){
  $strXML .= "<set label='".$row['department']."' value='".$row['bill_sec']."' />";
  $checkNull = true;
 }
 $strXML .= "</chart>"; 

?>

<body>
 <div style="text-align:center">
 <form method="post" name="gMonth" id="gMonth" action="../graph/compareMonth.php">
     <select name="month" id="month" >
         <option value="">-- Select Month --</option>
         <option id="JAN" value="JAN">January</option>
            <option id="FEB" value="FEB">February</option>
            <option id="MAR" value="MAR">March</option>
            <option id="APR" value="APR">April</option>
            <option id="MAY" value="MAY">May</option>
            <option id="JUN" value="JUN">June</option>
            <option id="JUL" value="JUL">July</option>
            <option id="AUG" value="AUG">August</option>
            <option id="SEP" value="SEP">September</option>
            <option id="OCT" value="OCT">October</option>
            <option id="NOV" value="NOV">November</option>
            <option id="DEC" value="DEC">December</option>
        </select>&nbsp;:&nbsp;<?=$year;?>
        <br/>
        <select id="dept1" name="dept1">
         <option value="">-- Select Department --</option>
         <option id="Administator1" value="Administator">Administator</option>
            <option id="Accounting1" value="Accounting">Accounting</option>
            <option id="Financial1" value="Financial">Financial</option>
            <option id="Human Resource1" value="Human Resource">Human Resource</option>
            <option id="Marketing1" value="Marketing">Marketing</option>
        </select>
        AND
        <select id="dept2" name="dept2">
         <option value="">-- Select Department --</option>
         <option id="Administator2" value="Administator">Administator</option>
            <option id="Accounting2" value="Accounting">Accounting</option>
            <option id="Financial2" value="Financial">Financial</option>
            <option id="Human Resource2" value="Human Resource">Human Resource</option>
            <option id="Marketing2" value="Marketing">Marketing</option>
        </select>     
        <input type="submit" value="SHOW"/>   
    </form>
    </div>
 <?php
  if(!empty($_POST['month']) || $_POST['month'] != ''){
   if($checkNull){
    echo renderChart("../Charts/Column3D.swf", "", $strXML, "productSales", 800, 450, false, false);
   }else{
    echo "<br/><br/><br/><br/><br/><div style='text-align:center;color:red'>Data not found.</div>";
   }
  }
 ?>
</body>
[removed]
 var monthSelect = '<?=$_POST[month];?>';
 var dept1Select = '<?=$_POST[dept1];?>';
 var dept2Select = '<?=$_POST[dept2];?>';
 function changeSubmit(){
  if(document.getElementById('month').value != ''){
   if(document.getElementById('dept1').value == document.getElementById('dept2').value){
    alert&#40;"Please don't select duplicate department"&#41;;return false}else if(document.getElementById('dept1').value=='' || document.getElementById('dept2').value == ''){
    alert&#40;"Please select duplicate department"&#41;;
    return false;
   }else{
    return true;
   }
  }else{
   alert&#40;"Please select month."&#41;;
   return false;
  }
 }
 function selected(){
  if(monthSelect != ''){
   document.getElementById(monthSelect).selected = true;
  }
  if(dept1Select != ''){
   document.getElementById(dept1Select+"1").selected = true;
  }
  if(dept2Select != ''){
   document.getElementById(dept2Select+"2").selected = true;
  }  
 }
[removed]
</html>

 

Revise this Paste

Children: 26967
Your Name: Code Language: