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 "";
echo "";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "
";
$qry="select filepdf from ".DB_APORTIL.".tbl_manualbook where isdeleted=0 and filepdf='cargoprice_information.pdf'";
$filepdf=$this->fn_get_fieldvalue("filepdf",$qry);
$urlmanualbook=" MANUAL BOOK";
$url="location.reload();";
$myuri=array("CARGO PRICE INFORMATION"=>"$url|id='a_newticket'","$urlmanualbook"=>"|id='a_manualbook'");
echo $this->MULTIPLE_LINK($myuri);
echo " |
|
|
|
|
|
|
|
|
".$this->CREATE_IMAGE("loadergrid.gif")." |
| Notes |
: |
- Click Row For Edit |
|
|
|
";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$keyword=$_REQUEST["keyword"];
header("Content-type: text/xml");
echo('');
echo "";
$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 ("");
print(" | ");
print(" | ");
print(" | ");
print(" | ");
$destination=$row['routenamestart']."-".$row['routenameend'];
print(" | ");
print(" | ");
print(" | ");
print(" | ");
echo ("
");
$i+=1;
}
}
else
{
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file
";
}
echo "";
}
public function fn_saverecord($isupdate=null)
{
if($isupdate){$id=$_REQUEST['txt_id'];}
$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();
}
}
}
?>