Files
aportil/objectx/obj_home/home_ticketdia.php

289 lines
17 KiB
PHP

<?php
class HOME_TICKETDIA extends HOME
{
public function home_ticketdia_javainit()
{
}
public function fn_ticketdia_init()
{
if(isset($_REQUEST['task'])){$task=trim(strtolower($_REQUEST['task']));}
if(isset($_POST['task'])){$task=trim(strtolower($_POST['task']));}
if($_REQUEST||$_POST){if($_REQUEST['sec']||$_POST['sec']){$task=$this->dec($task);}}
switch($task)
{
case "default":
$this->fn_default_sum();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_sum();
break;
}
}
public function fn_default_sum()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:80px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgtra;
function initObject()
{";
$qry="select datasets,startvalue,stepvalue,endvalue from ".DB_APORTIL.".tbl_chart_trendsum
where modules='homediaperformance' and isdeleted=0 order by id desc limit 1";
$spval=$this->fn_get_fieldsvalues("datasets,startvalue,stepvalue,endvalue",$qry);
$datasets=$spval[0];$startvalue=$spval[1];$stepvalue=$spval[2];$endvalue=$spval[3];
echo " var datasets=$datasets;
var barChart1 = new dhtmlXChart({
view:\"bar\",
container:\"div_ticketdiabaralarm\",
value:\"#Tclosed#\",
color: \"#2ecc71\",
gradient:\"rising\",
tooltip:{
template:\"#Tclosed#\"
},
width:10,
tooltip:{
template:\"#Tclosed#\"
},
xAxis:{
template:\"'#mon#\"
},
yAxis:{
start:$startvalue,
step:$stepvalue,
end:$endvalue
},
legend:{
values:[
{text:\"Closed\",color:\"#2ecc71\"},
{text:\"Opened\",color:\"#e74c3c\"},
{text:\"Total Ticket\",color:\"#f1c40f\",markerType: \"item\"}
],
valign:\"bottom\",
align:\"center\",
layout:\"x\"
}
});
barChart1.addSeries({
value:\"#Topened#\",
color:\"#e74c3c\",
tooltip:{
template:\"#Topened#\"
}
});
barChart1.addSeries({
//offset:0,
view: \"line\",
item:{
radius:0
},
line:{
color:\"#f1c40f\"
},
value:\"#totalticket#\",
tooltip:{
template:\"#totalticket#\"
},
label:\"<b>#totalticket#</b>\"
});
barChart1.parse(datasets,\"json\");";
// === Trend Pie1 by Revenue
$qry="select datasets,startvalue,stepvalue,endvalue from ".DB_APORTIL.".tbl_chart_trendsum
where modules='homediaperformance2' and isdeleted=0 order by id desc limit 1";
$spval=$this->fn_get_fieldsvalues("datasets,startvalue,stepvalue,endvalue",$qry);
$datasets=$spval[0];$startvalue=$spval[1];$stepvalue=$spval[2];$endvalue=$spval[3];
echo " var datasets=$datasets;
var barChart2 = new dhtmlXChart({
view:\"bar\",
container:\"div_ticketdiabaralarm2\",
value:\"#Tclosed#\",
color: \"#2ecc71\",
gradient:\"rising\",
tooltip:{
template:\"#Tclosed#\"
},
width:10,
tooltip:{
template:\"#Tclosed#\"
},
xAxis:{
template:\"'#times#\"
},
yAxis:{
start:$startvalue,
step:$stepvalue,
end:$endvalue
},
legend:{
values:[
{text:\"Closed\",color:\"#2ecc71\"},
{text:\"Opened\",color:\"#e74c3c\"},
{text:\"Total Ticket\",color:\"#f1c40f\",markerType: \"item\"}
],
valign:\"bottom\",
align:\"center\",
layout:\"x\"
}
});
barChart2.addSeries({
value:\"#Topened#\",
color:\"#e74c3c\",
tooltip:{
template:\"#Topened#\"
}
});
barChart2.addSeries({
//offset:0,
view: \"line\",
item:{
radius:0
},
line:{
color:\"#f1c40f\"
},
value:\"#totalticket#\",
tooltip:{
template:\"#totalticket#\"
},
label:\"<b>#totalticket#</b>\"
});
barChart2.parse(datasets,\"json\");";
echo " };
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("white");
echo "<table width=\"98%\" height=\"100%\" border=\"0\">";
echo " <tr>
<td valign=\"top\" width=\"70%\">
<div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">Trend Tickets Alarm Period ".date("Y")."</div>
<div id=\"div_ticketdiabaralarm\" style=\"width:100%;height:330px;\"></div>
</td>
<td rowspan=\"2\" valign=\"top\">
<div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">ALARM DIA ".date("M")."/".date("Y")."</div>
<div style=\"overflow:auto;width:100%;height:630px;margin-top:10px;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);border-radius:2%;background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);\">";
echo "<table width=\"95%\" style=\"color:white;margin-top:10px;font-size:11pt\" align=\"center\">";
$qry="select id,customerdia,downtime,issues,durationinmonths,durationindays,durationinhours,durationinminutes
from ".DB_APORTIL.".tbl_nits_diaticketsheader
where status=0 order by id asc";
//echo $qry;
$qrycheck="select id,customerdia,downtime,issues,durationinmonths,durationindays,durationinhours,durationinminutes
from ".DB_APORTIL.".tbl_nits_diaticketsheader
where status=0
order by id asc limit 1";
if($this->fn_row_isexists($qrycheck))
{
$rs=$this->selectquery($qry);
if($rs)
{
$i=1;
while($rw=$this->data_row_object($rs))
{
// === GET DURATION DOWN TIME
$df=$this->durationindate($rw->downtime,date("Y-m-d H:i"));
$durationinmonths=0;$durationindays=0;$durationinhours=0;$durationinminutes=0;
if(count($df)>0)
{
$durationinmonths=$df['month'];
$durationindays=$df['day'];
$durationinhours=$df['hour'];
$durationinminutes=$df['minute'];
}
$duration="";
if($durationinmonths){$months="month";if($durationinmonths>1){$months="months";}$duration="$durationinmonths $months ";}
if($durationindays){$days="day";if($durationindays>1){$days="days";}$duration.="$durationindays $days ";}
if($durationinhours){$hours="hour";if($durationinhours>1){$hours="hours";}$duration.="$durationinhours $hours ";}
if($durationinminutes){$minutes="minute";if($durationinminutes>1){$minutes="minutes";}$duration.="$durationinminutes $minutes ";}
echo "<tr>";
echo " <td valign=\"top\" width=\"2px\"><i>$i.</i></td>";
echo " <td valign=\"top\" width=\"90px\"><i>ID</i></td>";
echo " <td valign=\"top\" width=\"2px\">:</td>";
echo " <td valign=\"top\"><i>".$rw->id."</i></td>";
echo "</tr>";
echo "<tr>";
echo " <td></td>";
echo " <td valign=\"top\" width=\"110px\"><i>Customer Name</i></td>";
echo " <td valign=\"top\" width=\"2px\">:</td>";
echo " <td valign=\"top\"><i>".$rw->customerdia."</i></td>";
echo "</tr>";
echo "<tr>";
echo " <td></td>";
echo " <td valign=\"top\">Down Time</td>";
echo " <td valign=\"top\">:</td>";
echo " <td valign=\"top\">".date("Y-m-d H:i:s",strtotime($rw->downtime))."</td>";
echo "</tr>";
echo "<tr>";
echo " <td></td>";
echo " <td valign=\"top\">Duration</td>";
echo " <td valign=\"top\">:</td>";
echo " <td valign=\"top\">$duration</td>";
echo "</tr>";
echo "<tr>";
echo " <td></td>";
echo " <td valign=\"top\">Issues</td>";
echo " <td valign=\"top\">:</td>";
echo " <td valign=\"top\">".$rw->issues."</td>";
echo "</tr>";
echo "<tr>";
echo " <td></td>";
echo " <td valign=\"top\"><b>Last Response</b></td>";
echo " <td valign=\"top\"><b>:</b></td>";
$response="";$dateupdated="-";
if($this->fn_row_isexists("select actions,dateupdated from ".DB_APORTIL.".tbl_nits_diaticketsdetail where idheader='".$rw->id."' and isdeleted=0 order by id desc limit 1"))
{
$sp=$this->fn_get_fieldsvalues("actions,dateupdated","select actions,dateupdated from ".DB_APORTIL.".tbl_nits_diaticketsdetail where idheader='".$rw->id."' and isdeleted=0 order by id desc limit 1");
$response=$sp[0];$dateupdated=$sp[1];
}
$lastresponse="-";
if($response){$lastresponse=$response." at ( $dateupdated )";}
echo " <td valign=\"top\"><b>$lastresponse</b></td>";
echo "</tr>";
echo "<tr height=\"10px\"><td colspan=\"4\"></td></tr>";
$i+=1;
}
}
}
else
{
echo "<tr>";
echo " <td>Nihil.</td>";
echo "</tr>";
}
echo "</table>";
echo " </div>
</td>
</tr>
<tr>
<td valign=\"top\">
<div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">Trend Tickets Alarm By Time Period ".date("M Y")."</div>
<div id=\"div_ticketdiabaralarm2\" style=\"width:100%;height:330px;\"></div>
</td>
</tr>";
echo "</table>";
echo $this->FN_CREATEFOOTER();
}
}
?>