Files
aportil/objectx/obj_home/home_ticket_20200203.php

419 lines
27 KiB
PHP

<?php
class HOME_TICKET extends HOME
{
public function home_ticket_javainit()
{
}
public function fn_ticket_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;
var t1;
function initObject()
{
t1=setTimeout(function(){
fn_getStatusInfo();
},5000);";
echo "var multiple_dataset = [
{ sales:\"20\", sales2:\"35\", year:\"02\" },
{ sales:\"40\", sales2:\"24\", year:\"03\" },
{ sales:\"44\", sales2:\"20\", year:\"04\" },
{ sales:\"23\", sales2:\"50\", year:\"05\" },
{ sales:\"21\", sales2:\"36\", year:\"06\" },
{ sales:\"50\", sales2:\"40\", year:\"07\" },
{ sales:\"30\", sales2:\"65\", year:\"08\" },
{ sales:\"90\", sales2:\"62\", year:\"09\" },
{ sales:\"55\", sales2:\"40\", year:\"10\" },
{ sales:\"72\", sales2:\"45\", year:\"11\" }
];";
echo "var myBarChart = new dhtmlXChart({
view:\"bar\",
container:\"div_ticketbaralarm\",
value:\"#sales#\",
color: \"#58dccd\",
gradient:\"rising\",
tooltip:{
template:\"#sales#\"
},
width:60,
xAxis:{
template:\"'#year#\"
},
yAxis:{
start:0,
step:10,
end:100
},
legend:{
values:[{text:\"Atauro\",color:\"#58dccd\"},{text:\"Oekuse\",color:\"#a7ee70\"}],
valign:\"middle\",
align:\"bottom\",
width:190,
layout:\"x\"
}
});
myBarChart.addSeries({
value:\"#sales2#\",
color:\"#a7ee70\",
tooltip:{
template:\"#sales2#\"
}
});
myBarChart.parse(multiple_dataset,\"json\");
var data = {
first_name: \"Richard\",
last_name: \"Wilson\",
addr1: \"Upton Avenue 1870\",
addr2: \"Liberty Square 4949\",
company: \"Monk Home Loans\"
};
var parentObj = document.getElementById(\"previewData\");
parentObj.innerHTML = window.dhx4.template(parentObj.innerHTML, data);
var destination = [
{ id:1, percent:45, dest:\"Oekuse\", color: \"#ee9e36\"},
{ id:2, percent:55, dest:\"Atauro\", color: \"#eeea36\"}
];
myPieChart = new dhtmlXChart({
view:\"pie\",
container:\"div_pieshippasstrend\",
value:\"#percent#\",
color:\"#color#\",
labelLines: true,
label:\"#dest#: #percent# %\",
shadow:0
});
myPieChart.parse(destination,\"json\");
var destination = [
{ id:1, percent:45, dest:\"Oekuse\", color: \"#ee9e36\"},
{ id:2, percent:55, dest:\"Atauro\", color: \"#eeea36\"}
];
myPieChart1 = new dhtmlXChart({
view:\"pie\",
container:\"div_pieshiptriptrend\",
value:\"#percent#\",
color:\"#color#\",
labelLines: true,
label:\"#dest#: #percent# %\",
shadow:0
});
myPieChart1.parse(destination,\"json\");
";
echo " }
function fn_getStatusInfo(){
//var data=fn_dhtmlxloadobject('".$this->enc("obj_home")."','obj=".$this->enc("home_ticket")."&task=".$this->enc("getstinfo")."');
var data=ajaxuridhtmlx('".$this->enc("obj_home")."','obj=".$this->enc("home_ticket")."&task=".$this->enc("getstinfo")."&idship=1&idroutestart=1');
data=JSON.parse(data);
//alert(data);
t1=setTimeout(function(){
fn_getStatusInfo();
},10000);
//alert(data);
for(var i in data){
var div=document.getElementById('div'+data[i]['ndx']);
div.style.color=data[i]['colorfont'];
div.style.backgroundColor=data[i]['colors'];
}
};
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("white");
echo "<table width=\"98%\" height=\"100%\">";
echo " <tr>
<td valign=\"top\" width=\"70%\">
<div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">Nakroma Passenger Performance Period ".date("Y")."</div>
<div id=\"div_ticketbaralarm\" style=\"width:100%;height:330px;\"></div>
</td>
<td valign=\"top\" rowspan=\"2\">
<div style=\"height:200\">
<table width=\"100%\">
<tr>
<td colspan=\"10\">
<table>
<tr>
<td>Ship</td>
<td>:</td>
<td>Nakroma</td>
<td>,</td>
<td>Rute</td>
<td>:</td>
<td>Dili-Atauro</td>
<td><a href=\"javascript:void(0)\"><i class=\"fa fa-cog\" style=\"font-size:14pt;\"></i></a></td>
</tr>
</table>
</td>
</tr>";
$qry="select totalseat from ".DB_APORTIL.".tbl_ship_information where id=1";
if($this->fn_row_isexists($qry)){
$totalseat=$this->fn_get_fieldvalue("totalseat",$qry);
$j=10;$s=5;
for($i=1;$i<=$totalseat;$i++){
$colors="#ecf0f1";$colorfont="black";
if($i==1||$i==($j+1)){
echo "<tr>";
}
// Content
// === Dili atauro
$qrycheckin="select inctiket,status from ".DB_APORTIL.".tbl_passenger_tiket
where inctiket='$i' and idship=1 and idroutestart=1 and cast(dates as date)=cast(now() as date)";
if($this->fn_row_isexists($qrycheckin)){
$colorfont="white";
$status=$this->fn_get_fieldvalue("status",$qrycheckin);
$colors="#f1c40f";
if($status==1){$colors="#3498db";}
if($status==-2){$colors="#ecf0f1";$colorfont="black";}
}
echo "<td width=\"10px\" height=\"8px\" style=\"height:8px;background-color:transparent\">
<div id=\"div$i\" style=\"color:$colorfont;padding-top:1px;font-size:8pt;text-align:center;border: 1px solid transparent;border-radius: 2px;background-color:$colors;width:25px;height:15px\">
$i
</div>
</td>";
if($i==$s){
echo "<td width=\"20px\">&nbsp</td>";
}
if($i%10==0){
$j+=10;$s+=10;
echo "</tr>";
}
}
}
//$arr=array("4-H"=>"#f1c40f","5-C"=>"#f1c40f","5-F"=>"#f1c40f","5-G"=>"#f1c40f","5-H"=>"#f1c40f","20-C"=>"#2980b9","20-D"=>"#2980b9","30-D"=>"#2980b9");
// === Seat Code
// echo "<tr>";
// for($h=1;$h<=10;$h++){
// if($h==1){
// echo "<td width=\"1px\">&nbsp</td>";
// }
// echo "<td width=\"10\" style=\"font-size:8pt;\">&nbsp;".chr(64+$h)."</td>";
// if($h==5){
// echo "<td width=\"20px\">&nbsp</td>";
// }
// }
// echo "</tr>";
//
// === SEAT Number
// for($i=1;$i<=30;$i++){
// echo "<tr>";
// for($j=1;$j<=10;$j++)
// {
// $colors="#ecf0f1";
//if($i==4&&$j==8){$colors="#f1c40f";}
// if(array_key_exists("$i-".chr(64+$j),$arr)){
// $colors=$arr["$i-".chr(64+$j)];
// }
// if($j==1){
// echo "<td width=\"1px\" style=\"font-size:10pt;color:black\">$i.</td>";
// }
// echo "<td width=\"10px\" height=\"8px\" style=\"height:8px;background-color:none\">
// <div style=\"border: 1px solid transparent;border-radius: 2px;background-color:$colors;width:15px;height:8px\">
// &nbsp;
// </div>
// </td>";
// if($j==5){
// echo "<td width=\"20px\">&nbsp</td>";
// }
// }
// echo "</tr>";
// }
echo " </table>
</div>
</td>
</tr>
<tr>
<td valign=\"top\" style=\"background-color:none\">
<table width=\"100%\">
<tr>
<td>
<div class=\"preview_tpl\" id=\"previewData\" style=\"\">
<div class=\"header_tpl\" style=\"font-weight:bold\">Nakroma Passenger</div>
<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width:400px\">
<tr>
<td>
<div style=\"text-align:center;text-decoration:underline;font-size:20px;color:blue;margin-top:10px\">
Period ".date("Y")."
</div>
<div id=\"div_pieshippasstrend\" style=\"height:200px;margin-top:0px;\"></div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>Atauro</td>
<td>: 55% (1.5K)</td>
<td>Oekuse</td>
<td>: 45% (800)</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td valign=\"top\">
<div class=\"preview_tpl\" id=\"previewData\" style=\"margin-left:20px\">
<div class=\"header_tpl\" style=\"font-weight:bold\">Nakroma Manifest</div>
<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width:450px\">
<thead>
<tr>
<td colspan=\"5\">
<table>
<tr>
<td>Nacroma Tonase</td>
<td>:</td>
<td><span style=\"font-size:19px\">200</span> ton</td>
</tr>
<tr>
<td>Threshold</td>
<td>:</td>
<td><span style=\"font-size:19px\">180</span> ton</td>
</tr>
</table>
</td>
</tr>
</thead>
<tr>
<td style=\"border-bottom:1px solid black;border-right:1px solid black\"></td>
<td style=\"border-bottom:1px solid black;\">Unit</td>
<td align=\"right\" style=\"border-bottom:1px solid black\">Qty</td>
<td align=\"right\" style=\"border-bottom:1px solid black\">( \$ )</td>
<td align=\"right\" style=\"border-bottom:1px solid black\">( ton )</td>
</tr>
<tr>
<td style=\"border-right:1px solid black\">Passenger</td>
<td>Person</td>
<td align=\"right\">300</td>
<td align=\"right\">\$1.800</td>
<td align=\"right\">15.0</td>
</tr>
<tr>
<td style=\"border-right:1px solid black\">Vehichle</td>
<td>unit</td>
<td align=\"right\">10</td>
<td align=\"right\">\$6.800</td>
<td align=\"right\">20.0</td>
</tr>
<tr>
<td style=\"border-right:1px solid black\">Non Vehichle</td>
<td>unit</td>
<td align=\"right\">10</td>
<td align=\"right\">\$4.700</td>
<td align=\"right\">18.0</td>
</tr>
<tr>
<td style=\"border-top:1px dashed black;border-right:1px solid black\">Total</td>
<td style=\"border-top:1px dashed black\"></td>
<td align=\"right\" style=\"border-top:1px dashed black;color:blue;\">330</td>
<td align=\"right\" style=\"border-top:1px dashed black;color:blue;\">\$13.300</td>
<td align=\"right\" style=\"border-top:1px dashed black;color:blue;\">54.0</td>
</tr>
<tfoot>
<tr>
<td colspan=\"5\">
<table width=\"100%\" style=\"background-color:none\">
<tr>
<td width=\"220px\" style=\"font-Size:12pt;\">GAP ( Ton )</td>
<td width=\"1px\" style=\"font-Size:12pt;\">-></td>
<td width=\"220px\" style=\"font-Size:12pt;\">180.0 - 54.0</td>
<td width=\"1px\" style=\"font-Size:12pt;\">=</td>
<td style=\"font-Size:14pt;\">
<div style=\"background-color:green;color:white;padding:5px;border: 2px solid green;border-radius: 5px 2px;\">
126.0
</div>
</td>
</tr>
<tr>
<td colspan=\"5\" style=\"font-Size:14pt;\">
<span>Tonase Status</span>&nbsp;
<span>:</span>&nbsp;
<span style=\"color:green;font-size:16pt;font-weight:bold\">GOOD</span>
</td>
</tr>
</table>
</td>
</tr>
</tfoot>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>";
echo "</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_getstinfo(){
$idship=$_REQUEST['idship'];
$idroutestart=$_REQUEST['idroutestart'];
$arr=array();
$qry="select totalseat from ".DB_APORTIL.".tbl_ship_information where id=$idship";
//echo $qry;return false;
if($this->fn_row_isexists($qry)){
$totalseat=$this->fn_get_fieldvalue("totalseat",$qry);
for($i=1;$i<=$totalseat;$i++){
$colors="#ecf0f1";$colorfont="black";
// === Dili atauro
$qrycheckin="select inctiket,status from ".DB_APORTIL.".tbl_passenger_tiket
where inctiket='$i' and idship=$idship and idroutestart=$idroutestart
and cast(dates as date)=cast(now() as date)";
//echo $qrycheckin;return false;
if($this->fn_row_isexists($qrycheckin)){
$status=$this->fn_get_fieldvalue("status",$qrycheckin);
$colors="#f1c40f";$colorfont="white";
if($status==1){$colors="#3498db";}
if($status==-2){$colors="#ecf0f1";$colorfont="black";}
// array_push($arr,array("$i"=>$colors));
array_push($arr,array("ndx"=>$i,"colors"=>$colors,"colorfont"=>$colorfont));
}
}
}
echo json_encode($arr);
}
}
?>