";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('');
echo "";
$qry="select id,idship,tiketnumber,inctiket,shipnumber,passengername,picdata,dates,idroutestart,idrouteend,seatnumber,quantity,price,baggageinkg,pricebaggage
from ".DB_APORTIL.".tbl_passenger_tiket
where idship like '%$keyword%' and isdeleted=0
order by id asc limit ".TBL_PAGE_LIMIT;
$rs=$this->selectquery($qry);
if($rs)
{
$i=1;
while($row=$this->data_row_array($rs))
{
echo ("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
echo ("");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file ";
}
echo "";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$idship=$_REQUEST['cbo_idship'];
$tiketnumber=$_REQUEST['txt_tiketnumber'];
$inctiket=$_REQUEST['txt_inctiket'];
$shipnumber=$_REQUEST['txt_shipnumber'];
$passengername=$_REQUEST['txt_passengername'];
$picdata=$_REQUEST['txt_picdata'];
$dates=$_REQUEST['txt_dates'];
$idroutestart=$_REQUEST['cbo_idroutestart'];
$idrouteend=$_REQUEST['cbo_idrouteend'];
$seatnumber=$_REQUEST['txt_seatnumber'];
$quantity=$_REQUEST['txt_quantity'];
$price=$_REQUEST['txt_price'];
$baggageinkg=$_REQUEST['txt_baggageinkg'];
$pricebaggage=$_REQUEST['txt_limitbaggage'];
$qry="insert into ".DB_APORTIL.".tbl_passenger_tiket
set idship='$idship',tiketnumber='$tiketnumber',inctiket='$inctiket',shipnumber='$shipnumber',passengername='$passengername',picdata='$picdata',
dates='$dates',idroutestart='$idroutestart',idrouteend='$idrouteend',seatnumber='$seatnumber',quantity='$quantity',price='$price',
baggageinkg='$baggageinkg',pricebaggage='$pricebaggage',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_passenger_tiket
set idship='$idship',tiketnumber='$tiketnumber',inctiket='$inctiket',shipnumber='$shipnumber',passengername='$passengername',picdata='$picdata',
dates='$dates',idroutestart='$idroutestart',idrouteend='$idrouteend',seatnumber='$seatnumber',quantity='$quantity',price='$price',
baggageinkg='$baggageinkg',pricebaggage='$pricebaggage',uby='".$_SESSION['nik']."',udt=now()
where id='$id'";
}
if($this->executequery($qry)){echo "ok|";return true;}
}
public function fn_updrecord(){$this->fn_saverecord(true);}
public function fn_delrecord()
{
$id=$_REQUEST['txt_id'];
$remark=$_REQUEST['txtremark'];
$qry="update ".DB_APORTIL.".tbl_passenger_tiket
set isdeleted=1,remark='$remark',dby='".$_SESSION['nik']."',ddt=now()
where id='$id'";
if($this->executequery($qry)){echo "ok|";return true;}
else
{
echo "failed|".$this->getErrorQuery();
}
}
public function fn_getticket(){
$valticket="";
for($i=1;$i<=8;$i++){
$valticket.=rand(0,9);
}
$sql="select tiketnumber from ".DB_APORTIL.".tbl_passenger_tiket where tiketnumber='".$tiketnumber."' order by id desc limit 1";
if($this->fn_row_isexists($sql)){
$this->fn_getticket();
}
return $valticket;
}
public function fn_getheaderinfo(){
$idship=$_REQUEST['idship'];
$tiketnumber=$this->fn_getticket();
echo "ok|".$tiketnumber;
}
public function fn_getprice(){
$idroutestart=$_REQUEST['idroutestart'];
$idrouteend=$_REQUEST['idrouteend'];
$qry="select prices from ".DB_APORTIL.".tbl_price_information
where idroutestart='".$idroutestart."' and idrouteend='".$idrouteend."' and isdeleted=0
order by id desc limit 1";
$price=0;$status="failed";$statuserr="Price not Found, Please contact your administrator";
if($this->fn_row_isexists($qry)){
$price=$this->fn_get_fieldvalue("prices",$qry);
$status="ok";$statuserr="";
}
// === Price limit baggage
$qry="select prices from ".DB_APORTIL.".tbl_cargoprice_information
where idcategory=2 and idroutestart='$idroutestart' and idrouteend='$idrouteend' and isdeleted=0
order by id desc limit 1";
$pricebaggagelimit=0;
if($this->fn_row_isexists($qry)){
$pricebaggagelimit=$this->fn_get_fieldvalue("prices",$qry);
}
echo "$status|$statuserr|$price|$pricebaggagelimit";
}
public function fn_setbookseat(){
$idship=$_REQUEST['idship'];
$bookingdate=$_REQUEST['bookingdate'];
$spship=$this->fn_get_fieldsvalues("shipnumber,shipname","select shipnumber,shipname from ".DB_APORTIL.".tbl_ship_information where id='$idship'");
$shipnumber=$spship[0];$shipname=$spship[1];
$seatnumber=$_REQUEST['seatnumber'];
$idroutestart=$_REQUEST['idroutestart'];
$routestart=$this->fn_get_fieldvalue("routename","select routename from ".DB_APORTIL.".tbl_route_information where id='$idroutestart'");
$idrouteend=$_REQUEST['idrouteend'];
$routeend=$this->fn_get_fieldvalue("routename","select routename from ".DB_APORTIL.".tbl_route_information where id='$idrouteend'");
$bookingdateend=date("Y-m-d H:i:s",strtotime("+15 minutes"));
$qry="insert into ".DB_APORTIL.".tbl_ship_seatbooking
set idship='$idship',shipnumber='$shipnumber',shipname='$shipname',bookingdate='$bookingdate',bookingdateend='$bookingdateend',
seatnumber='$seatnumber',idroutestart='$idroutestart',routestart='$routestart',idrouteend='$idrouteend',routeend='$routeend',
status=0,iby='".$_SESSION['nik']."',idt=now()";
$rtn="failed|Booking Failed please contact administrator!.";
if($this->executequery($qry)){
$rtn="ok|";
}
echo $rtn;
}
public function fn_cancelseat(){
$seatnumber=$_REQUEST['seatnumber'];
$bookingdate=$_REQUEST['bookingdate'];
$qry="update ".DB_APORTIL.".tbl_ship_seatbooking set status=-2,remark='Cancel Booking by ".$_SESSION['nik']."',uby='".$_SESSION['nik']."',udt=now()
where seatnumber='$seatnumber' and cast(bookingdate as date)=cast('$bookingdate' as date) and isdeleted=0";
//echo "failed|$qry";
if($this->executequery($qry)){
echo "ok|success";
};
}
public function fn_getseatnum(){
$bookingdate=$_REQUEST['bookingdate'];
$idship=$_REQUEST['idship'];
$shipname=$_REQUEST['shipname'];
$seatnumber=$_REQUEST['seatnumber'];
$idroutestart=$_REQUEST['idroutestart'];
$routestart=$_REQUEST['routestart'];
$routeend=$_REQUEST['routeend'];
$idrouteend=$_REQUEST['idrouteend'];
echo $this->FN_CREATEHEADER();
echo "";
echo "
";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "
Ship Name
:
".$shipname."
Route
:
".$routestart." to ".$routeend."
Booking Date
:
".$bookingdate."
";
echo "
";
echo "
";
echo "
";
// === SEAT Number
for($i=1;$i<=30;$i++){
echo "