Add version files and new GIF images for UI components

This commit is contained in:
2025-04-03 06:26:44 +07:00
commit 663c28a2ea
5219 changed files with 772528 additions and 0 deletions

View File

@ -0,0 +1,27 @@
<?php
class BASE_DATA extends MY_DHTMLX
{
public function fn_page_construct()
{
}
}
class DATA_HTML extends BASE_DATA
{
public function fn_page_home()
{
}
public function fn_url_home()
{
return "$('#uri').val('');$('#fm').prop('target','_self');$('#fm').submit();";
}
public function fn_url_data_shipinfo()
{
return "$('#uri').val('ajax=0&sec=1&option=6e57499d21cc59dc08e1513988c774bd&obj=8315adc6aa480f698b6655f3d0c9aa69&task=de7eb57f52fc4d8a6fef759e7bb0844b');$('#fm').prop('target','_self');$('#fm').submit();";
}
}
?>

39
objectx/obj_data/data.php Normal file
View File

@ -0,0 +1,39 @@
<?php
require_once($pg.".html.php");
class DATA extends DATA_HTML
{
}
$cl=new DATA();
if(isset($_REQUEST['task'])){$case=$_REQUEST['task'];}
if(isset($_POST['task'])){$case=$_POST['task'];}
if(isset($_REQUEST['obj'])){$obj=$_REQUEST['obj'];}
if(isset($_POST['obj'])){$obj=$_POST['obj'];}
if($_REQUEST){if($_REQUEST['sec']){$case=$cl->dec($case);$obj=$cl->dec($obj);}}
if(file_exists(PATH_OBJECT."/$option/$obj.php"))
{
require_once("$obj.php");
$className=strtoupper($obj);
$clfile=new $className();
$fn_init_java=$className."_javainit";
$init_java=trim($_REQUEST['init_java']);if($init_java){$clfile->$fn_init_java();}
$case=$obj;
}
if(!$case){$case=$obj;if(!file_exists(PATH_OBJECT."/$option/$obj.php")){$cl->under_construction();}}
$sptask=explode("_",$case);$modulename=$sptask[1];$fn_module_init="fn_".$modulename."_init";
switch($case)
{
case "data_$modulename":
$clfile->$fn_module_init();
break;
}
?>

View File

@ -0,0 +1,425 @@
<?php
class DATA_CARGOPRICE extends DATA
{
public function data_cargoprice_javainit()
{
}
public function fn_cargoprice_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_cargoprice();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_cargoprice();
break;
}
}
public function fn_default_cargoprice()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:212px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:310px;margin-top:-6px;position:absolute;}
.besidelabel {margin-left:300px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgcargoprice;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"combo","name"=>"cbo_idcategory","label"=>"Category","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"0",
"tooltip"=>"Pilih Category terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"6","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_cargodescription","label"=>"Cargo Description","required"=>"true","info"=>"true","inputWidth"=>"160","value"=>"",
"tooltip"=>"Insert Cargo Description first. Thank You","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_idroutestart","label"=>"From","required"=>"true","info"=>"true","inputWidth"=>"160","value"=>"",
"tooltip"=>"Pilih From terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_idrouteend","label"=>"To","required"=>"true","info"=>"true","inputWidth"=>"160","value"=>"",
"tooltip"=>"Pilih To terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_idunits","label"=>"Units","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"",
"tooltip"=>"Pilih Units terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"20","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_prices","label"=>"Prices","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"0",
"tooltip"=>"Masukkan Prices terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lblmeter","label"=>"\$","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_years","label"=>"Years","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>date("Y"),
"tooltip"=>"Masukkan Years terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtcenter"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divcargopricenew",$formdata);
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_cargo_category|id,cargocategory')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idcategory","tbl_cargo_category","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idroutestart","tbl_route_information","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idrouteend","tbl_route_information","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_cargo_units|id,units')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idunits","tbl_cargo_units","$urlcbo","");
$arrerror=array("cbo_idcategory"=>"Error Found : Harap Isikan <b>Category</b> terlebih dahulu.TERIMA KASIH",
"txt_cargodescription"=>"Error Found : Harap Isikan <b>Cargo Description</b> terlebih dahulu.TERIMA KASIH",
"cbo_idroutestart"=>"Error Found : Harap Isikan <b>From</b> terlebih dahulu.TERIMA KASIH",
"cbo_idrouteend"=>"Error Found : Harap Isikan <b>To</b> terlebih dahulu.TERIMA KASIH",
"cbo_idunits"=>"Error Found : Harap Isikan <b>Units</b> terlebih dahulu.TERIMA KASIH",
"txt_prices"=>"Error Found : Harap Isikan <b>Prices</b> terlebih dahulu.TERIMA KASIH",
"txt_years"=>"Error Found : Harap Isikan <b>Years</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"cbo_idcategory"=>"",
"txt_cargodescription"=>"",
"cbo_idroutestart"=>"",
"cbo_idrouteend"=>"",
"cbo_idunits"=>"",
"txt_prices"=>0,
"txt_years"=>date("Y")
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_cargoprice")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('cbo_idcategory')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idcategory");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_cargoprice")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getCombo('cbo_idcategory').getComboText()+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idcategory");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idcategory");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_cargoprice","myForm.getItemValue('txt_id')","myForm.getItemValue('cbo_idcategory')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('cbo_idcategory');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_years"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"780","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"5")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divcargopricesearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgcargoprice","divtarget"=>"div_dgcargoprice","divpaging"=>"div_dgcargopricepaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Category"=>"left,ro,144,left,str,false",
"Category Description"=>"left,ro,200,left,str,false",
"Destination"=>"left,ro,160,left,str,false",
"Prices&nbsp;"=>"right,ro,110,right,int,false",
"Units&nbsp;"=>"right,ro,110,right,str,false",
"Years"=>"center,ro,110,center,int,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","cbo_idcategory"=>"idcategory|cargocategory","txt_cargodescription"=>"",
"cbo_idroutestart"=>"idroutestart|routenamestart","cbo_idrouteend"=>"idrouteend|routenameend",
"cbo_idunits"=>"idunits|units","txt_prices"=>"","txt_years"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgcargoprice","myForm","tbl_cargoprice_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_cargoprice")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgcargoprice.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='cargoprice_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>CARGO PRICE INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divcargopricecontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divcargopricenew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divcargopricesearch\" style=\"width:760px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgcargoprice\" style=\"height:380px;width:780px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgcargopricepaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:387px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,idcategory,cargocategory,cargodescription,routenamestart,routenameend,units,prices,years
from ".DB_APORTIL.".tbl_cargoprice_information
where cargocategory 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["cargocategory"]."]]></cell>");
print("<cell><![CDATA[".$row["cargodescription"]."]]></cell>");
$destination=$row['routenamestart']."-".$row['routenameend'];
print("<cell><![CDATA[".$destination."]]></cell>");
print("<cell><![CDATA[".$row["prices"]." \$]]></cell>");
print("<cell><![CDATA[".$row["units"]."]]></cell>");
print("<cell><![CDATA[".$row["years"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$idcategory=$_REQUEST['cbo_idcategory'];
$cargocategory=$this->fn_get_fieldvalue("cargocategory","select cargocategory from ".DB_APORTIL.".tbl_cargo_category where id='".$idcategory."'");
$cargodescription=$_REQUEST['txt_cargodescription'];
$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."'");
$idunits=$_REQUEST['cbo_idunits'];
$units=$this->fn_get_fieldvalue("units","select units from ".DB_APORTIL.".tbl_cargo_units where id='".$idunits."'");
$prices=$_REQUEST['txt_prices'];
$years=$_REQUEST['txt_years'];
// === Check Validation Cargo Price Information
$qry="select id from ".DB_APORTIL.".tbl_cargoprice_information
where idroutestart='$idroutestart' and idrouteend='$idrouteend' and years='$years' and cargodescription='$cargodescription' and isdeleted='0'
order by id desc limit 1";
if($this->fn_row_isexists($qry)&&!$isupdate){
echo "failed|Price is already exists, for editing please click your Table";return false;
}
// =============================================
$qry="insert into ".DB_APORTIL.".tbl_cargoprice_information
set idcategory='$idcategory',cargocategory='$cargocategory',cargodescription='$cargodescription',
idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',
idunits='$idunits',units='$units',prices='$prices',years='$years',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_cargoprice_information
set idcategory='$idcategory',cargocategory='$cargocategory',cargodescription='$cargodescription',
idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',
idunits='$idunits',units='$units',prices='$prices',years='$years',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_cargoprice_information
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();
}
}
}
?>

View File

@ -0,0 +1,354 @@
<?php
class DATA_EMPDEPT extends DATA
{
public function data_empdept_javainit()
{
}
public function fn_empdept_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_empdept();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_empdept();
break;
}
}
public function fn_default_empdept()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:210px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:306px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgempdept;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_departmentname","label"=>"Department Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Department Name terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_description","label"=>"Description","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Description terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divempdeptnew",$formdata);
$arrerror=array("txt_departmentname"=>"Error Found : Harap Isikan <b>Department Name</b> terlebih dahulu.TERIMA KASIH",
"txt_description"=>"Error Found : Harap Isikan <b>Description</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_departmentname"=>"",
"txt_description"=>""
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_empdept")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_departmentname')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_departmentname");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_empdept")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_departmentname')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_departmentname");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_departmentname");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_empdept","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_departmentname')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_departmentname');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_description"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divempdeptsearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgempdept","divtarget"=>"div_dgempdept","divpaging"=>"div_dgempdeptpaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Department Name"=>"left,ro,270,left,str,false",
"Description"=>"left,ro,238,left,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_departmentname"=>"","txt_description"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgempdept","myForm","tbl_employee_department",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_empdept")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgempdept.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='employee_department.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>EMPLOYEE DEPARTMENT INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divempdeptcontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divempdeptnew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divempdeptsearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgempdept\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgempdeptpaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,departmentname,description
from ".DB_APORTIL.".tbl_employee_department
where departmentname 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["departmentname"]."]]></cell>");
print("<cell><![CDATA[".$row["description"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$departmentname=$_REQUEST['txt_departmentname'];
$description=$_REQUEST['txt_description'];
$qry="insert into ".DB_APORTIL.".tbl_employee_department
set departmentname='$departmentname',description='$description',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_employee_department
set departmentname='$departmentname',description='$description',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_employee_department
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();
}
}
}
?>

View File

@ -0,0 +1,368 @@
<?php
class DATA_EMPSEC extends DATA
{
public function data_empsec_javainit()
{
}
public function fn_empsec_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_empsec();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_empsec();
break;
}
}
public function fn_default_empsec()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:215px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:312px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgempsec;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_sectionname","label"=>"Section Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Section Name terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_iddept","label"=>"Department","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"0",
"tooltip"=>"Pilih Department terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_description","label"=>"Description","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Description terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divempsecnew",$formdata);
//$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_employee_department|id,departmentname:id,departmentname')";
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_employee_department|id,departmentname')";
//$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_employee|id,nik,fullname:nik,fullname".$exp."')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_iddept","tbl_employee_department","$urlcbo","");
//$this->FN_COMBOVALIDATIONVALUENEW("myFormsearch","cbonik","tbl_employee","$urlcbo","");
$arrerror=array("txt_sectionname"=>"Error Found : Harap Isikan <b>Section Name</b> terlebih dahulu.TERIMA KASIH",
"txt_description"=>"Error Found : Harap Isikan <b>Description</b> terlebih dahulu.TERIMA KASIH",
"cbo_iddept"=>"Error Found : Harap Isikan <b>Department</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_sectionname"=>"",
"txt_description"=>"",
"cbo_iddept"=>""
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_empsec")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_sectionname')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_sectionname");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_empsec")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_sectionname')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_sectionname");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_sectionname");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_empsec","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_sectionname')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_sectionname');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_description"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"5")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divempsecsearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgempsec","divtarget"=>"div_dgempsec","divpaging"=>"div_dgempsecpaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Section Name"=>"left,ro,226,left,str,false",
"Description"=>"left,ro,218,left,str,false",
"Department"=>"left,ro,220,left,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_sectionname"=>"","txt_description"=>"","cbo_iddept"=>"iddept|departmentname");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgempsec","myForm","tbl_employee_section",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_empsec")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgempsec.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='employee_section.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>EMPLOYEE SECTION INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divempseccontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divempsecnew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divempsecsearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgempsec\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgempsecpaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,sectionname,description,iddept,departmentname
from ".DB_APORTIL.".tbl_employee_section
where sectionname 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["sectionname"]."]]></cell>");
print("<cell><![CDATA[".$row["description"]."]]></cell>");
print("<cell><![CDATA[".$row["departmentname"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$sectionname=$_REQUEST['txt_sectionname'];
$description=$_REQUEST['txt_description'];
$iddept=$_REQUEST['cbo_iddept'];
$departmentname=$this->fn_get_fieldvalue("departmentname","select departmentname from ".DB_APORTIL.".tbl_employee_department where id='".$iddept."'");
$qry="insert into ".DB_APORTIL.".tbl_employee_section
set sectionname='$sectionname',description='$description',iddept='$iddept',departmentname='$departmentname',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_employee_section
set sectionname='$sectionname',description='$description',iddept='$iddept',departmentname='$departmentname',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_employee_section
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();
}
}
}
?>

View File

@ -0,0 +1,394 @@
<?php
class DATA_PRICEINFO extends DATA
{
public function data_priceinfo_javainit()
{
}
public function fn_priceinfo_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_priceinfo();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_priceinfo();
break;
}
}
public function fn_default_priceinfo()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:214px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:310px;margin-top:-6px;position:absolute;}
.besidelabel {margin-left:340px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgpriceinfo;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"combo","name"=>"cbo_idroutestart","label"=>"From","required"=>"true","info"=>"true","inputWidth"=>"150","value"=>"",
"tooltip"=>"Pilih From terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_idrouteend","label"=>"To","required"=>"true","info"=>"true","inputWidth"=>"150","value"=>"",
"tooltip"=>"Pilih To terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_prices","label"=>"Price","required"=>"true","info"=>"true","inputWidth"=>"150","value"=>"0",
"tooltip"=>"Masukkan Price terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtright",
"numberFormat"=>"0,000.00"),
array("type"=>"label","name"=>"lblmeter","label"=>"\$","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_years","label"=>"Years","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>date("Y"),
"tooltip"=>"Masukkan Years terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divpriceinfonew",$formdata);
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idroutestart","tbl_route_information","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idrouteend","tbl_route_information","$urlcbo","");
$arrerror=array("cbo_idroutestart"=>"Error Found : Harap Isikan <b>From</b> terlebih dahulu.TERIMA KASIH",
"cbo_idrouteend"=>"Error Found : Harap Isikan <b>To</b> terlebih dahulu.TERIMA KASIH",
"txt_prices"=>"Error Found : Harap Isikan <b>Price</b> terlebih dahulu.TERIMA KASIH",
"txt_years"=>"Error Found : Harap Isikan <b>Years</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"cbo_idroutestart"=>"",
"cbo_idrouteend"=>"",
"txt_prices"=>0,
"txt_years"=>date("Y")
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
if(myForm.getItemValue('txt_prices')<=0){
fn_dhtmlxmessage('error','Please insert price!');
myForm.setItemFocus('txt_prices');
return false;
}
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_priceinfo")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('cbo_idroutestart')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_priceinfo")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('cbo_idroutestart')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_priceinfo","myForm.getItemValue('txt_id')","myForm.getItemValue('cbo_idroutestart')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('cbo_idroutestart');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_years"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"5")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divpriceinfosearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgpriceinfo","divtarget"=>"div_dgpriceinfo","divpaging"=>"div_dgpriceinfopaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"From"=>"left,ro,112,left,str,false",
"To"=>"left,ro,112,left,str,false",
"Price&nbsp;"=>"right,ro,120,right,int,false",
"Years"=>"center,ro,120,center,int,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","cbo_idroutestart"=>"idroutestart|routenamestart","cbo_idrouteend"=>"idrouteend|routenameend","txt_prices"=>"","txt_years"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgpriceinfo","myForm","tbl_price_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_priceinfo")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgpriceinfo.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='passengerprice_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>PRICE INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divpriceinfocontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divpriceinfonew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divpriceinfosearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgpriceinfo\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgpriceinfopaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,idroutestart,routenamestart,idrouteend,routenameend,prices,years
from ".DB_APORTIL.".tbl_price_information
where idroutestart 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["routenamestart"]."]]></cell>");
print("<cell><![CDATA[".$row["routenameend"]."]]></cell>");
print("<cell><![CDATA[".number_format($row["prices"],2,".","00")." \$]]></cell>");
print("<cell><![CDATA[".$row["years"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$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."'");
$prices=$_REQUEST['txt_prices'];
$years=$_REQUEST['txt_years'];
// === Check Validation Route Price Information
$qry="select id from ".DB_APORTIL.".tbl_price_information
where idroutestart='$idroutestart' and idrouteend='$idrouteend' and years='$years' and isdeleted='0'
order by id desc limit 1";
if($this->fn_row_isexists($qry)&&!$isupdate){
echo "failed|Price is already exists, for editing please click your Table";return false;
}
// =============================================
$qry="insert into ".DB_APORTIL.".tbl_price_information
set idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',
prices='$prices',years='$years',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_price_information
set idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',
prices='$prices',years='$years',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_price_information
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();
}
}
}
?>

View File

@ -0,0 +1,354 @@
<?php
class DATA_ROUTE extends DATA
{
public function data_route_javainit()
{
}
public function fn_route_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_route();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_route();
break;
}
}
public function fn_default_route()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:108px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:210px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:306px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgroute;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_routename","label"=>"Route Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Route Name terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_description","label"=>"Description","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Description terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divroutenew",$formdata);
$arrerror=array("txt_routename"=>"Error Found : Harap Isikan <b>Route Name</b> terlebih dahulu.TERIMA KASIH",
"txt_description"=>"Error Found : Harap Isikan <b>Description</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_routename"=>"",
"txt_description"=>""
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_route")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_routename')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_route")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_routename')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_route","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_routename')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_routename');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_description"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divroutesearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgroute","divtarget"=>"div_dgroute","divpaging"=>"div_dgroutepaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Route Name"=>"left,ro,230,left,str,false",
"Description"=>"left,ro,238,left,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_routename"=>"","txt_description"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgroute","myForm","tbl_route_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_route")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgroute.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='route_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>ROUTE INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divroutecontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divroutenew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divroutesearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgroute\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgroutepaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,routename,description
from ".DB_APORTIL.".tbl_route_information
where routename 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["routename"]."]]></cell>");
print("<cell><![CDATA[".$row["description"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$routename=$_REQUEST['txt_routename'];
$description=$_REQUEST['txt_description'];
$qry="insert into ".DB_APORTIL.".tbl_route_information
set routename='$routename',description='$description',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_route_information
set routename='$routename',description='$description',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_route_information
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();
}
}
}
?>

View File

@ -0,0 +1,358 @@
<?php
class DATA_ROUTE extends DATA
{
public function data_route_javainit()
{
}
public function fn_route_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_route();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_route();
break;
}
}
public function fn_default_route()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:108px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:210px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:306px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgroute;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_routename","label"=>"Route Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Route Name terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_description","label"=>"Description","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Description terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_timedeparture","label"=>"Time Departure","required"=>"true","info"=>"true","inputWidth"=>"120","value"=>"00:00:00",
"tooltip"=>"Masukkan tanggal berangkat terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"20","className"=>"txtcenter"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divroutenew",$formdata);
$arrerror=array("txt_routename"=>"Error Found : Harap Isikan <b>Route Name</b> terlebih dahulu.TERIMA KASIH",
"txt_description"=>"Error Found : Harap Isikan <b>Description</b> terlebih dahulu.TERIMA KASIH",
"txt_timedeparture"=>"Error Found : Harap Isikan <b>Tanggal Berangkat</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_routename"=>"",
"txt_description"=>"",
"txt_timedeparture"=>"00:00:00"
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_route")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_routename')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_route")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_routename')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_routename");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_route","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_routename')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_routename');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_description"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divroutesearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgroute","divtarget"=>"div_dgroute","divpaging"=>"div_dgroutepaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Route Name"=>"left,ro,230,left,str,false",
"Description"=>"left,ro,238,left,str,false",
"Time Departure"=>"center,ro,130,center,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_routename"=>"","txt_description"=>"","txt_timedeparture"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgroute","myForm","tbl_route_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_route")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgroute.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$url="location.reload();";
$myuri=array("<b>ROUTE INFORMATION</b>"=>"$url|id='a_route'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divroutecontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divroutenew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divroutesearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgroute\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgroutepaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,routename,description,timedeparture
from ".DB_APORTIL.".tbl_route_information
where routename 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["routename"]."]]></cell>");
print("<cell><![CDATA[".$row["description"]."]]></cell>");
print("<cell><![CDATA[".$row["timedeparture"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$routename=$_REQUEST['txt_routename'];
$description=$_REQUEST['txt_description'];
$timedeparture=$_REQUEST['txt_timedeparture'];
$qry="insert into ".DB_APORTIL.".tbl_route_information
set routename='$routename',description='$description',timedeparture='$timedeparture',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_route_information
set routename='$routename',description='$description',timedeparture='$timedeparture',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_route_information
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();
}
}
}
?>

View File

@ -0,0 +1,453 @@
<?php
class DATA_SHIPINFO extends DATA
{
public function data_shipinfo_javainit()
{
}
public function fn_shipinfo_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_shipinfo();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_shipinfo();
break;
}
}
public function fn_default_shipinfo()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:213px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:322px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:310px;margin-top:-6px;position:absolute;}
.besidelabel {margin-left:280px;margin-top:-5px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgshipinfo;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_shipnumber","label"=>"Voy Number","required"=>"true","info"=>"true","inputWidth"=>"180","value"=>"",
"tooltip"=>"Masukkan Voy Number first. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_shipname","label"=>"Ship Name","required"=>"true","info"=>"true","inputWidth"=>"180","value"=>"",
"tooltip"=>"Masukkan Ship Name first. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"calendar","name"=>"txt_datecreated","label"=>"Created Date","required"=>"true","info"=>"true","inputWidth"=>"90","readonly"=>"true","value"=>date("Y-m-d"),
"tooltip"=>"Masukkan Created Date first. Obrigado","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtcenter","dateFormat"=>"%Y-%m-%d"),
array("type"=>"input","name"=>"txt_width","label"=>"Width","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Width first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lblmeter","label"=>"Meter","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_shiplength","label"=>"Length","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Length first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lbllength","label"=>"Meter","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_height","label"=>"Height","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Height first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lblheight","label"=>"Meter","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_totalseat","label"=>"Total Seat","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Total Seat first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"input","name"=>"txt_maxton","label"=>"Maximal Tonase","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Maximal Tonase first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lblheight","label"=>"Kg","className"=>"besidelabel"),
array("type"=>"input","name"=>"txt_thresholdton","label"=>"Threshold Tonase","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Threshold Tonase first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"input","name"=>"txt_totalsekoci","label"=>"Total Lifeboat","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Total Lifeboat first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"input","name"=>"txt_totalrestroom","label"=>"Total RestRoom","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Total RestRoom first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"input","name"=>"txt_fuel","label"=>"Fuel","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"Solar",
"tooltip"=>"Masukkan Fuel first. Obrigado","validate"=>"NotEmpty","maxLength"=>"20","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_capacityfuel","label"=>"Max Capacity","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Masukkan Max Capacity first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"","className"=>"txtright"),
array("type"=>"label","name"=>"lblcapacityfuel","label"=>"Ltr","className"=>"besidelabel"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"0","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"0","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divshipinfonew",$formdata);
$arrerror=array("txt_shipnumber"=>"Error Found : Please Insert <b>Voy Number</b> First.Obrigado",
"txt_shipname"=>"Error Found : Please Insert <b>Ship Name</b> first.Obrigado",
"txt_datecreated"=>"Error Found : Please Insert <b>Created Date</b> first.Obrigado",
"txt_width"=>"Error Found : Insert <b>Width</b> Information First with numeric.Obrigado",
"txt_shiplength"=>"Error Found : Insert <b>Length</b> Information First with numeric.Obrigado",
"txt_height"=>"Error Found : Please Insert <b>Height</b> first.Obrigado",
"txt_totalseat"=>"Error Found : Please Insert <b>Total Seat</b> first.Obrigado",
"txt_maxton"=>"Error Found : Please Insert <b>Maximal Tonase</b> first.Obrigado",
"txt_thresholdton"=>"Error Found : Please Insert <b>Threshold Tonase</b> first.Obrigado",
"txt_totalsekoci"=>"Error Found : Please Insert <b>Total Lifeboat</b> first.Obrigado",
"txt_totalrestroom"=>"Error Found : Please Insert <b>Total RestRoom</b> first.Obrigado",
"txt_fuel"=>"Error Found : Please Insert <b>Fuel</b> first.Obrigado",
"txt_capacityfuel"=>"Error Found : Please Insert <b>Max Capacity</b> first.Obrigado"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_shipnumber"=>"",
"txt_shipname"=>"",
"txt_datecreated"=>"",
"txt_width"=>"",
"txt_shiplength"=>"",
"txt_height"=>"",
"txt_totalseat"=>"",
"txt_maxton"=>"",
"txt_thresholdton"=>"",
"txt_totalsekoci"=>"",
"txt_totalrestroom"=>"",
"txt_fuel"=>"",
"txt_capacityfuel"=>""
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_shipinfo")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_shipnumber')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_shipnumber");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_shipinfo")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_shipnumber')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_shipnumber");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_shipnumber");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_shipinfo","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_shipnumber')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_shipnumber');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_capacityfuel"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"5")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divshipinfosearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgshipinfo","divtarget"=>"div_dgshipinfo","divpaging"=>"div_dgshipinfopaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Voy Number"=>"center,ro,110,center,str,false",
"Ship Name"=>"left,ro,180,left,str,false",
"Created Date"=>"center,ro,90,center,date,false",
"Width&nbsp;"=>"right,ro,90,right,int,false",
"Length&nbsp;"=>"right,ro,90,right,int,false",
"Height&nbsp;"=>"right,ro,90,right,int,false",
"Total Seat&nbsp;"=>"right,ro,110,right,int,false",
"Maximal Tonase(Kg)&nbsp;"=>"right,ro,140,right,int,false",
"Threshold Tonase(Kg)&nbsp;"=>"right,ro,140,right,int,false",
"Total Lifeboat&nbsp;"=>"right,ro,110,right,int,false",
"Total RestRoom&nbsp;"=>"right,ro,110,right,int,false",
"Fuel"=>"left,ro,102,left,str,false",
"Max Capacity&nbsp;"=>"right,ro,110,right,int,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_shipnumber"=>"","txt_shipname"=>"","txt_datecreated"=>"","txt_width"=>"","txt_shiplength"=>"","txt_height"=>"","txt_totalseat"=>"","txt_maxton"=>"","txt_thresholdton"=>"","txt_totalsekoci"=>"","txt_totalrestroom"=>"","txt_fuel"=>"","txt_capacityfuel"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgshipinfo","myForm","tbl_ship_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_shipinfo")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgshipinfo.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='ships_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>SHIP INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divshipinfocontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divshipinfonew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divshipinfosearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgshipinfo\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgshipinfopaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,shipnumber,shipname,datecreated,width,shiplength,height,totalseat,maxton,thresholdton,totalsekoci,totalrestroom,fuel,capacityfuel
from ".DB_APORTIL.".tbl_ship_information
where shipnumber 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["shipnumber"]."]]></cell>");
print("<cell><![CDATA[".$row["shipname"]."]]></cell>");
print("<cell><![CDATA[".date("Y-m-d",strtotime($row["datecreated"]))."]]></cell>");
print("<cell><![CDATA[".$row["width"]."]]></cell>");
print("<cell><![CDATA[".$row["shiplength"]."]]></cell>");
print("<cell><![CDATA[".$row["height"]."]]></cell>");
print("<cell><![CDATA[".$row["totalseat"]."]]></cell>");
print("<cell><![CDATA[".$row["maxton"]."]]></cell>");
print("<cell><![CDATA[".$row["thresholdton"]."]]></cell>");
print("<cell><![CDATA[".$row["totalsekoci"]."]]></cell>");
print("<cell><![CDATA[".$row["totalrestroom"]."]]></cell>");
print("<cell><![CDATA[".$row["fuel"]."]]></cell>");
print("<cell><![CDATA[".$row["capacityfuel"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$shipnumber=$_REQUEST['txt_shipnumber'];
$shipname=$_REQUEST['txt_shipname'];
$datecreated=$_REQUEST['txt_datecreated'];
$width=$_REQUEST['txt_width'];
$shiplength=$_REQUEST['txt_shiplength'];
$height=$_REQUEST['txt_height'];
$totalseat=$_REQUEST['txt_totalseat'];
$maxton=$_REQUEST['txt_maxton'];
$thresholdton=$_REQUEST['txt_thresholdton'];
$totalsekoci=$_REQUEST['txt_totalsekoci'];
$totalrestroom=$_REQUEST['txt_totalrestroom'];
$fuel=$_REQUEST['txt_fuel'];
$capacityfuel=$_REQUEST['txt_capacityfuel'];
$qry="insert into ".DB_APORTIL.".tbl_ship_information
set shipnumber='$shipnumber',shipname='$shipname',datecreated='$datecreated',width='$width',shiplength='$shiplength',height='$height',
totalseat='$totalseat',maxton='$maxton',thresholdton='$thresholdton',totalsekoci='$totalsekoci',totalrestroom='$totalrestroom',fuel='$fuel',
capacityfuel='$capacityfuel',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_ship_information
set shipnumber='$shipnumber',shipname='$shipname',datecreated='$datecreated',width='$width',shiplength='$shiplength',height='$height',
totalseat='$totalseat',maxton='$maxton',thresholdton='$thresholdton',totalsekoci='$totalsekoci',totalrestroom='$totalrestroom',fuel='$fuel',
capacityfuel='$capacityfuel',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_ship_information
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();
}
}
}
?>

View File

@ -0,0 +1,368 @@
<?php
class DATA_TIMESCHE extends DATA
{
public function data_timesche_javainit()
{
}
public function fn_timesche_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_timesche();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_timesche();
break;
}
}
public function fn_default_timesche()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:104px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:198px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:300px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgtimesche;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"combo","name"=>"cbo_idroutestart","label"=>"Departure","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"0",
"tooltip"=>"Pilih Keberangkatan terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"combo","name"=>"cbo_idrouteend","label"=>"Arrival","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"0",
"tooltip"=>"Pilih Tujuan terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_scheduletime","label"=>"Time Schedule","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"00:00:00",
"tooltip"=>"Masukkan Jadwal Keberangkatan terlebih dahulu. TERIMA KASIH","validate"=>"NotEmpty","maxLength"=>"20","className"=>"txtcenter"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"10","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"20","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"20","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divtimeschenew",$formdata);
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idroutestart","tbl_route_information","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_route_information|id,routename')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idrouteend","tbl_route_information","$urlcbo","");
$arrerror=array("cbo_idroutestart"=>"Error Found : Harap Isikan <b>Keberangkatan</b> terlebih dahulu.TERIMA KASIH",
"cbo_idrouteend"=>"Error Found : Harap Isikan <b>Tujuan</b> terlebih dahulu.TERIMA KASIH",
"txt_scheduletime"=>"Error Found : Harap Isikan <b>Jadwal Keberangkatan</b> terlebih dahulu.TERIMA KASIH"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"cbo_idroutestart"=>"",
"cbo_idrouteend"=>"",
"txt_scheduletime"=>"00:00:00"
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_timesche")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('cbo_idroutestart')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_timesche")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('cbo_idroutestart')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idroutestart");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_timesche","myForm.getItemValue('txt_id')","myForm.getItemValue('cbo_idroutestart')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('cbo_idroutestart');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_scheduletime"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divtimeschesearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dgtimesche","divtarget"=>"div_dgtimesche","divpaging"=>"div_dgtimeschepaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Departure"=>"center,ro,176,center,str,false",
"Arrival"=>"center,ro,160,center,str,false",
"Schedule Time"=>"center,ro,166,center,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","cbo_idroutestart"=>"idroutestart|routenamestart","cbo_idrouteend"=>"idrouteend|routenameend","txt_scheduletime"=>"");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgtimesche","myForm","tbl_routetime_information",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_timesche")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dgtimesche.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$url="location.reload();";
$myuri=array("<b>Schedule Information</b>"=>"$url|id='a_timesche'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divtimeschecontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divtimeschenew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divtimeschesearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgtimesche\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgtimeschepaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,idroutestart,routenamestart,idrouteend,routenameend,scheduletime
from ".DB_APORTIL.".tbl_routetime_information
where (routenamestart like '%$keyword%' or routenameend 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["routenamestart"]."]]></cell>");
print("<cell><![CDATA[".$row["routenameend"]."]]></cell>");
print("<cell><![CDATA[".$row["scheduletime"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$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."'");
$scheduletime=$_REQUEST['txt_scheduletime'];
$qry="insert into ".DB_APORTIL.".tbl_routetime_information
set idroutestart='$idroutestart',routenamestart='$routenamestart',
idrouteend='$idrouteend',routenameend='$routenameend',scheduletime='$scheduletime',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_routetime_information
set idroutestart='$idroutestart',routenamestart='$routenamestart',
idrouteend='$idrouteend',routenameend='$routenameend',scheduletime='$scheduletime',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_routetime_information
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();
}
}
}
?>

View File

@ -0,0 +1,390 @@
<?php
class DATA_USER extends DATA
{
public function data_user_javainit()
{
}
public function fn_user_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_user();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_user();
break;
}
}
public function fn_default_user()
{
echo $this->FN_CREATEHEADER();
echo "<style>
.besidebtnsave {margin-left:104px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:208px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:308px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dguser;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500",
"list"=>array(
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"input","name"=>"txt_nik","label"=>"Nik","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"",
"tooltip"=>"Masukkan Nik first. Obrigado","validate"=>"NotEmpty","maxLength"=>"20","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_employeename","label"=>"Employee Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Employee Name first. Obrigado","validate"=>"NotEmpty","maxLength"=>"80","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_employeetitle","label"=>"Title","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Masukkan Title first. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"combo","name"=>"cbo_idsection","label"=>"Section","required"=>"true","info"=>"true","inputWidth"=>"110","value"=>"0",
"tooltip"=>"Pilih Section first. Obrigado","validate"=>"NotEmpty","maxLength"=>"6","className"=>"txtleft"),
array("type"=>"input","name"=>"txt_msisdn","label"=>"MSISDN","required"=>"true","info"=>"true","inputWidth"=>"160","value"=>"",
"tooltip"=>"Masukkan MSISDN first. Obrigado","validate"=>"NotEmpty,ValidNumeric","maxLength"=>"8","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_email","label"=>"Email","required"=>"true","info"=>"true","inputWidth"=>"160","value"=>"",
"tooltip"=>"Masukkan Email first. Obrigado","validate"=>"NotEmpty","maxLength"=>"80","className"=>"txtleft"),
array("type"=>"button","name"=>"btnsave","value"=>"Save","className"=>"button_update","offsetLeft"=>"20","offsetTop"=>"15"),
array("type"=>"button","name"=>"btnupdate","value"=>"Update","className"=>"button_saveas besidebtnsave","offsetLeft"=>"10","disabled"=>"1"),
//array("type"=>"button","name"=>"btnsubmit","value"=>"Submit","className"=>"button_submit besidebtnupdate","offsetLeft"=>"0","disabled"=>"1"),
array("type"=>"button","name"=>"btndelete","value"=>"Delete","className"=>"button_delete besidebtnupdate","offsetLeft"=>"10","disabled"=>"1"),
array("type"=>"button","name"=>"btncancel","value"=>"Cancel","className"=>"button_cancel besidebtndelete","offsetLeft"=>"10","disabled"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myForm","divusernew",$formdata);
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_employee_section|id,sectionname')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idsection","tbl_employee_section","$urlcbo","");
$arrerror=array("txt_nik"=>"Error Found : Please Insert <b>Nik</b> first.Obrigado",
"txt_employeename"=>"Error Found : Please Insert <b>Employee Name</b> first.Obrigado",
"txt_employeetitle"=>"Error Found : Please Insert <b>Title</b> first.Obrigado",
"cbo_idsection"=>"Error Found : Please Insert <b>Section</b> first.Obrigado",
"txt_msisdn"=>"Error Found : Please Insert <b>MSISDN</b> first with number.Obrigado",
"txt_email"=>"Error Found : Please Insert <b>Email</b> first.Obrigado"
);
$this->FN_DHTMLXFORMVALIDATIONERROR("myForm",$arrerror);
$arrayControls=array("txt_id"=>"",
"txt_nik"=>"",
"txt_employeename"=>"",
"txt_employeetitle"=>"",
"cbo_idsection"=>"",
"txt_msisdn"=>"",
"txt_email"=>""
);
// === Form Event
$onobjkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();if(myForm.isItemEnabled('btnupdate')){myForm.setItemFocus('btnupdate');dhtmlXclickButton('btnupdate');}else{myForm.setItemFocus('btnsave');}return false;}";
$onbuttonclickbtnsave="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be saved and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_user")."&task=".$this->enc("saverecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_nik')+'</b> has been saved');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_nik");
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnsave.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnsave.=" }
}
});
}";
$onbuttonclickbtnupdt="if(myForm.validate())
{
dhtmlx.confirm({
title:'Confirmation',text:'Are you will be updated and data is correctly?',type:'confirm',
callback:function(result){
if(result)
{";
$params="'obj=".$this->enc("data_user")."&task=".$this->enc("updrecord")."'";
$onformsenddata="url=fn_dhtmlxsenddata('".$this->enc("obj_data")."',$params);
myForm.send(url,\"get\",function(loader, response){";
$onformsenddata.=$this->FN_DHTMLXWINDOWSHIDEPROGRESS();
$onformsenddata.="var sp=trim(response).split('|');
//alert(response);
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Data <b>'+myForm.getItemValue('txt_nik')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_nik");
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
$onformsenddata.="myForm.disableItem('btndelete');";
$onformsenddata.="fn_grid_loaddata();
}
else if(sp[0]=='failed')
{fn_dhtmlxmessage('error','Error Found : '+sp[1]);}
else
{fn_dhtmlxmessage('error','Error Found : '+response);}
});";
$onbuttonclickbtnupdt.=$this->FN_DHTMLXWINDOWSHOWPROGESS($onformsenddata);
$onbuttonclickbtnupdt.=" }
}
});
}";
$eventafterdeleted=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"txt_nik");
$eventafterdeleted.="myForm.enableItem('btnsave');";
$eventafterdeleted.="myForm.disableItem('btnupdate');";
$eventafterdeleted.="myForm.disableItem('btndelete');";
$eventafterdeleted.="fn_grid_loaddata();";
$onbuttonclickbtndeleted=$this->FN_DHTMLXREMARKFORDELETED2("obj_data","data_user","myForm.getItemValue('txt_id')","myForm.getItemValue('txt_nik')",$eventafterdeleted);
$onbuttonclickbtncancel=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls);
$onbuttonclickbtncancel.="myForm.enableItem('btnsave');";
$onbuttonclickbtncancel.="myForm.disableItem('btnupdate');";
$onbuttonclickbtncancel.="myForm.disableItem('btndelete');";
$onbuttonclickbtncancel.="myForm.setItemFocus('txt_nik');";
$onbuttonclickbtncancel.="fn_grid_loaddata();";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsave"=>"$onbuttonclickbtnsave",
"btnupdate"=>"$onbuttonclickbtnupdt",
"btndelete"=>"$onbuttonclickbtndeleted",
"btncancel"=>"$onbuttonclickbtncancel"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txt_email"=>"$onobjkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
// === FORM SEARCH AND GRID
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"fieldset","width"=>"580","label"=>"Search",
"list"=>array(
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnfind","value"=>"","className"=>"button_find","offsetLeft"=>"10","offsetTop"=>"0")
)
)
);
$this->FN_DHTMLXFORM("myFormsearch","divusersearch",$formdata,true);
$ontxtsearchkeydown="if(ev.keyCode==13){ev.stopPropagation();ev.preventDefault();myFormsearch.setItemFocus('btnfind');}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnfind"=>"fn_grid_loaddata()"
)
),
array("eventname"=>"onkeydown","eventparam"=>"inp,ev,id,val",
"switch"=>array(
"txtsearch"=>"$ontxtsearchkeydown"
)
)
);
$this->FN_DHTMLXFORMEVENT("myFormsearch",$arrevent);
$grdinit=array("gridname"=>"dguser","divtarget"=>"div_dguser","divpaging"=>"div_dguserpaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"No.&nbsp;"=>"right,ro,35,center,int,false",
"Nik"=>"left,ro,94,left,str,false",
"Employee Name"=>"left,ro,160,left,str,false",
"Title"=>"left,ro,190,left,str,false",
"Section"=>"right,ro,136,right,int,false",
"MSISDN"=>"left,ro,128,left,str,false",
"Email"=>"left,ro,120,left,str,false");
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$arrfields=array("txt_id"=>"","txt_nik"=>"","txt_employeename"=>"","txt_employeetitle"=>"","txt_msisdn"=>"","txt_email"=>"","cbo_idsection"=>"idsection|sectionname");
$otherevent="";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dguser","myForm","tbl_employee",0,$arrfields,"");
echo " }
function fn_grid_loaddata()
{
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_data")."','obj=".$this->enc("data_user")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
dguser.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" border=\"0\">
<tr>
<td>";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='employee_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook="<a href='".UPLOAD_DIR."/manualbook/$filepdf"."' target='_blank'><img src='".PATH_THEME."/images/pdf.png' />&nbsp;<b>MANUAL BOOK</b></a>";
$url="location.reload();";
$myuri=array("<b>EMPLOYEE INFORMATION</b>"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " </td>
</tr>
<tr>
<td>
<div id=\"divusercontent\" style=\"margin-left:0px;\">
<table width=\"98%\" border=\"0\">
<tr>
<td width=\"45%\" valign=\"top\">
<div id=\"divusernew\" style=\"\"></div>
</td>
<td valign=\"top\">
<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\">
<div id=\"divusersearch\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dguser\" style=\"height:380px;width:580px;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dguserpaging\" style=\"width:598px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:287px;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Click Row For Edit</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select id,nik,employeename,employeetitle,msisdn,email,sectionname
from ".DB_APORTIL.".tbl_employee
where (nik like '%$keyword%' or employeename 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 ("<row id='".$row["id"]."'>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["nik"]."]]></cell>");
print("<cell><![CDATA[".$row["employeename"]."]]></cell>");
print("<cell><![CDATA[".$row["employeetitle"]."]]></cell>");
print("<cell><![CDATA[".$row["sectionname"]."]]></cell>");
print("<cell><![CDATA[".$row["msisdn"]."]]></cell>");
print("<cell><![CDATA[".$row["email"]."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$nik=$_REQUEST['txt_nik'];
$employeename=$_REQUEST['txt_employeename'];
$employeetitle=$_REQUEST['txt_employeetitle'];
$msisdn=$_REQUEST['txt_msisdn'];
$email=$_REQUEST['txt_email'];
$idsection=$_REQUEST['cbo_idsection'];
$spsec=$this->fn_get_fieldsvalues("sectionname,iddept,departmentname","select id,sectionname,iddept,departmentname from ".DB_APORTIL.".tbl_employee_section where id='".$idsection."'");
$sectionname=$spsec[0];$iddept=$spsec[1];$departmentname=$spsec[2];
$qry="insert into ".DB_APORTIL.".tbl_employee
set nik='$nik',employeename='$employeename',employeetitle='$employeetitle',msisdn='$msisdn',email='$email',idsection='$idsection',
sectionname='$sectionname',iddept='$iddept',deptname='$departmentname',iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_employee
set nik='$nik',employeename='$employeename',employeetitle='$employeetitle',msisdn='$msisdn',email='$email',idsection='$idsection',
sectionname='$sectionname',iddept='$iddept',deptname='$departmentname',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_employee
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();
}
}
}
?>