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();
// === Init Route information dashboard
$idship=1;
$idroutestart=1;
$routestartname="Dili";
$idrouteend=3;
$routeendname="Atauro";
$shipname="Nakroma";
$route="Dili-Atauro";
$qry="select idship,shipname,idroutestart,routestartname,idrouteend,routeendname from ".DB_APORTIL.".tbl_dashboard_setting_rute ";
$qry.="where idemployee='".$_SESSION['idemployee']."' and isdeleted=0 order by id asc limit 1";
if($this->fn_row_isexists($qry)){
$sp=$this->fn_get_fieldsvalues("idship,idroutestart,idrouteend,routestartname,routeendname,shipname",$qry);
$idship=$sp[0];$idroutestart=$sp[1];$idrouteend=$sp[2];$routestartname=$sp[3];$routeendname=$sp[4];
$route=$routestartname."-".$routeendname;
$shipname=$sp[5];
}
echo "";
echo "";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("white");
echo "
";
echo "
";
echo "
|
Nakroma Passenger Performance Period ".date("Y")."
|
|
|
";
$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 "";
}
// Content
// === Dili atauro
$qrycheckin="select inctiket,status from ".DB_APORTIL.".tbl_passenger_tiket
where inctiket='$i' and idship=$idship and idroutestart=$idroutestart and idrouteend=$idrouteend and cast(dates as date)=cast(now() as date) and isdeleted=0";
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 "|
$i
| ";
if($i==$s){
echo "  | ";
}
if($i%10==0){
$j+=10;$s+=10;
echo " ";
}
}
}
//$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 "";
// for($h=1;$h<=10;$h++){
// if($h==1){
// echo "|   | ";
// }
// echo " ".chr(64+$h)." | ";
// if($h==5){
// echo "  | ";
// }
// }
// echo " ";
//
// === SEAT Number
// for($i=1;$i<=30;$i++){
// echo "";
// 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 "| $i. | ";
// }
// echo "
//
//
//
// | ";
// if($j==5){
// echo "  | ";
// }
// }
// echo " ";
// }
echo "
|
|
|
| Nacroma Tonase |
: |
200 ton |
| Threshold |
: |
180 ton |
|
|
Unit |
Qty |
( \$ ) |
( ton ) |
| Passenger |
Person |
300 |
\$1.800 |
15.0 |
| Vehichle |
unit |
10 |
\$6.800 |
20.0 |
| Non Vehichle |
unit |
10 |
\$4.700 |
18.0 |
| Total |
|
330 |
\$13.300 |
54.0 |
| GAP ( Ton ) |
-> |
180.0 - 54.0 |
= |
126.0
|
|
Tonase Status
:
GOOD
|
|
|
|
";
echo "
";
echo "
";
echo $this->FN_CREATEFOOTER();
}
public function fn_getstinfo(){
$idship=$_REQUEST['idship'];
// $shipname=$_REQUEST['shipname'];
$idroutestart=$_REQUEST['idroutestart'];
// $routestartname=$_REQUEST['routestartname'];
$idrouteend=$_REQUEST['idrouteend'];
// $routeendname=$_REQUEST['routeendname'];
$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 idrouteend=$idrouteend)
and cast(dates as date)=cast(now() as date) and isdeleted=0";
//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);
}
public function fn_settings()
{
$idship=$_REQUEST['idship'];
$shipname=$_REQUEST['shipname'];
$idroutestart=$_REQUEST['idroutestart'];
$routestartname=$_REQUEST['routestartname'];
$idrouteend=$_REQUEST['idrouteend'];
$routeendname=$_REQUEST['routeendname'];
echo $this->FN_CREATEHEADER();
echo "";
echo "";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "
| ";
$url="location.reload();";
$myuri=array("DASHBOARD CONFIGURATION"=>"$url|id='a_route'");
echo $this->MULTIPLE_LINK($myuri);
echo " |
|
|
";
echo $this->FN_CREATEFOOTER();
}
public function fn_setdashboard($isupdate=null)
{
$year=date("Y");
// if($isupdate){$id=$_REQUEST['txt_id'];}
$idemployee=$_SESSION['idemployee'];
$nik=$_SESSION['nik'];
$idship=$_REQUEST['cbo_idship'];
$sp=$this->fn_get_fieldsvalues("shipname,shipnumber","select shipname,shipnumber from ".DB_APORTIL.".tbl_ship_information where id='$idship'");
$shipnumber=$sp[1];$shipname=$sp[0];
$idroutestart=$_REQUEST['cbo_idroutestart'];
$routenamestart=$this->fn_get_fieldvalue("routename","select routename from ".DB_APORTIL.".tbl_route_information where id='$idroutestart'");
$idrouteend=$_REQUEST['cbo_idrouteend'];
$routenameend=$this->fn_get_fieldvalue("routename","select routename from ".DB_APORTIL.".tbl_route_information where id='$idrouteend'");
$qry="insert into ".DB_APORTIL.".tbl_dashboard_setting_rute
set idemployee='$idemployee',nik='$nik',idship='$idship',shipname='$shipname',idroutestart='$idroutestart',
routestartname='$routenamestart',idrouteend='$idrouteend',routeendname='$routenameend',iby='".$_SESSION['nik']."',idt=now()";
if($this->fn_row_isexists("select id from ".DB_APORTIL.".tbl_dashboard_setting_rute where idemployee='$idemployee'"))
{
$qry="update ".DB_APORTIL.".tbl_dashboard_setting_rute
set idemployee='$idemployee',nik='$nik',idship='$idship',shipname='$shipname',idroutestart='$idroutestart',
routestartname='$routenamestart',idrouteend='$idrouteend',routeendname='$routenameend',uby='".$_SESSION['nik']."',udt=now()
where idemployee='$idemployee'";
}
if($this->executequery($qry))
{
echo 'ok|';
}
}
}
?>