Add cargo manifest functionality to ticketing system

- Updated `tra_cargticket.php` to include a new hidden input for cargo manifest and added JavaScript functions to handle cargo manifest display and updates.
- Introduced new methods in `tra_cargticketc.php` for managing cargo details, including setting, deleting, and loading cargo data.
- Modified `tra_newticket.php` to accommodate changes in passenger type handling and validation.
- Enhanced `tra_newticketc.php` to support dynamic loading of cargo details and improved user interaction for adding and deleting cargo records.
- Implemented server-side logic to handle cargo data retrieval and deletion in the new `tra_cargticketc` class.
This commit is contained in:
2025-04-25 07:27:12 +07:00
parent 63c4109a7c
commit 33ef7566af
4 changed files with 493 additions and 48 deletions

View File

@ -35,15 +35,16 @@
echo "<style>
.besidecboidcard {margin-left:280px;margin-top:-5px;position:absolute;}
.besidetxttiketnumber {margin-left:325px;margin-top:-6px;position:absolute;}
.underpassengername {margin-left:180px;margin-top:-10px;position:static;}
.besidelabel {margin-left:280px;margin-top:-5px;position:absolute;}
.containerpicture {margin-left:0px;margin-top:0px;}
.containerbtnlookcategory {margin-left:400px;margin-top:-19px;position:absolute;}
.besidelabelprice {margin-left:275px;margin-top:-6px;position:absolute;}
.besidecbofrom {margin-left:305px;margin-top:-5px;position:absolute;}
.besidebtnsave {margin-left:104px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:198px;margin-top:-6px;position:absolute;}
.besidebtnsave {margin-left:110px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:218px;margin-top:-6px;position:absolute;}
.besidebtnsubmit {margin-left:292px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:288px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:318px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,myFormcat,dgcargticket,dwins,dhxwin,dgfindcategory;
@ -56,12 +57,13 @@
array("type"=>"hidden","name"=>"txt_id"),
array("type"=>"hidden","name"=>"txt_idcategory"),
array("type"=>"hidden","name"=>"txt_modifcount"),
array("type"=>"hidden","name"=>"txt_cargmanifest"),
array("type"=>"hidden","name"=>"txt_units"),
array("type"=>"combo","name"=>"cbo_idship","label"=>"Ship Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"0","placeholder"=>"Please enter your email",
"tooltip"=>"Pilih Ship Name First. Obrigado","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_tiketnumber","label"=>"Ticket Number","info"=>"true","inputWidth"=>"135","value"=>"",
"tooltip"=>"Entry Ticket Number First. Obrigado","maxLength"=>"40","className"=>"txtcenter","readonly"=>"true"),
array("type"=>"input","name"=>"txt_tiketnumberpassenger","label"=>"","info"=>"true","inputWidth"=>"135","value"=>"-","note"=>array("text"=>"Passenger Tiket ( Optional )"),
array("type"=>"input","name"=>"txt_tiketnumberpassenger","label"=>"","info"=>"true","inputWidth"=>"135","value"=>"-","note"=>array("text"=>"<span style='font-size:8pt'>Passenger Tiket ( optional )</span>"),
"tooltip"=>"Entry Ticket Number First. Obrigado","maxLength"=>"40","className"=>"txtleft besidetxttiketnumber"),
array("type"=>"input","name"=>"txt_voynumber","label"=>"Voyage Number","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"","offsetTop"=>"20",
"tooltip"=>"Entry Voyage Number First. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
@ -69,10 +71,12 @@
// "tooltip"=>"Entry No. Sequence First. Obrigado","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"input","name"=>"txt_passengername","label"=>"Passenger Name","required"=>"true","info"=>"true","inputWidth"=>"280","value"=>"",
"tooltip"=>"Entry Passenger Name First. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft"),
array("type"=>"label","name"=>"lbllookuphist","label"=>"<a id='acargo' href='javascript:void(0)' onClick='fn_showcargo()'><span id='spcargo'>0</span> Manifest</a>","className"=>"underpassengername","offsetLeft"=>"0","offsetTop"=>"15"),
array("type"=>"combo","name"=>"cbo_idcardtype","label"=>"ID Card","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Pilih ID Card First. Obrigado","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtcenter"),
array("type"=>"newColumn"),
array("type"=>"input","name"=>"txt_cardnumber","label"=>"","required"=>"true","info"=>"true","inputWidth"=>"120","value"=>"",
array("type"=>"input","name"=>"txt_cardnumber","label"=>"","required"=>"true","info"=>"true","inputWidth"=>"180","value"=>"",
"tooltip"=>"Entry Picture First. Obrigado","validate"=>"NotEmpty","maxLength"=>"100","className"=>"txtleft besidecboidcard",
"note"=>array("text"=>"Insert ID card Number")),
//array("type"=>"container","name"=>"containerpicture","label"=>"Take Picture","className"=>"containerpicture","offsetTop"=>"20"),
@ -124,6 +128,8 @@
);
$this->FN_DHTMLXFORM("myForm","divcargticketnew",$formdata);
echo "myForm.setFontSize('12pt');";
$mycontainerpic="var divpicture=document.createElement('DIV');";
$mycontainerpic.="divpicture.id='divpicture';divpicture.style.height='100%';";
$mycontainerpic.="var divpicturecontent='<table id=\"tbfindinvoice\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-top:0px;margin-left:-5px;\">';";
@ -251,6 +257,7 @@
if(sp[0]=='ok')
{
fn_dhtmlxmessage('','Ticket Number <b>'+myForm.getItemValue('txt_tiketnumber')+'</b> has been saved');";
$onformsenddata.="fn_cargomanifestdefault();";
$onformsenddata.="myForm.setItemLabel('lblmeasure','Measure');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idship");
$onformsenddata.="fn_grid_loaddata();
@ -284,6 +291,7 @@
{
fn_dhtmlxmessage('','Ticket Number <b>'+myForm.getItemValue('txt_tiketnumber')+'</b> has been update');";
$onformsenddata.=$this->FN_DHTMLXFORMCLEAR2("myForm",$arrayControls,"cbo_idship");
$onformsenddata.="fn_cargomanifestdefault();";
$onformsenddata.="myForm.setItemLabel('lblmeasure','Measure');";
$onformsenddata.="myForm.enableItem('btnsave');";
$onformsenddata.="myForm.disableItem('btnupdate');";
@ -362,10 +370,10 @@
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")
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")
)
)
);
@ -422,11 +430,52 @@
$otherevent.="myForm.disableItem('txt_tiketnumber');";
$otherevent.="myForm.setItemFocus('txt_voynumber');";
$otherevent.="myForm.setItemLabel('lblmeasure',spres[15]);";
$otherevent.="var cargomanifest=ajaxuridhtmlx('".$this->enc("obj_tra")."','obj=".$this->enc("tra_cargticket")."&task=".$this->enc("getcargo")."&idtiketcargo='+spres[0]);";
$otherevent.="if(trim(cargomanifest)!=''){";
$otherevent.=" myForm.setItemValue('txt_cargmanifest',cargomanifest);fn_recalcargos();";
$otherevent.="}";
//$otherevent.="document.getElementById('imgtiket').src='uploads/temps/'+spres[16];";
$this->FN_DHTMLXGRIDVIEWTOFORMNEW("dgcargticket","myForm","tbl_cargo_tiket",0,$arrfields,"",$otherevent);
echo " }
function fn_showcargo(){
// fn_dhtmlxmessage('error','Your module still underconstruction');return false;
var idtiketcargoheader=myForm.getItemValue('txt_id');
var tiketnumber=myForm.getItemValue('txt_tiketnumber');
var cargmanifest=myForm.getItemValue('txt_cargmanifest');
if(!tiketnumber){
fn_dhtmlxmessage('error','Please Insert Cargo first!');return false;
}
var url='?ajax=1&sec=1&option=".$this->enc("obj_tra")."&obj=".$this->enc("tra_cargticketc")."&task=".$this->enc("default")."&tiketnumber='+tiketnumber+'&cargmanifest='+cargmanifest+'&idtiketcargoheader='+idtiketcargoheader;
dwins=new dhtmlXWindows();
dwins.createWindow(\"winchild\",0,0,screen.width-500,screen.height-350);
dwins.window('winchild').progressOn();
dwins.window(\"winchild\").setText(\"Manifest Setting\");
dwins.window(\"winchild\").attachURL(url);
dwins.window('winchild').setModal(true);
dwins.window('winchild').progressOff();
}
function fn_closecargo(data){
myForm.setItemValue('txt_cargmanifest',data);
dwins.window('winchild').close();
fn_recalcargos();
}
function fn_recalcargos(){
var datacargos=myForm.getItemValue('txt_cargmanifest');
var sp=datacargos.split(';');
var labelcargo='<a id=\'achilds\' href=\'javascript:void(0)\' onClick=\'fn_showcargo()\'><span id=\'spcargo\'>'+sp.length+'</span> Manifest</a>';
myForm.setItemLabel('lbllookuphist',labelcargo);
// console.log(document.getElementbyId('spcargo'));
// document.getElementbyId('spcargo').innerHTML = sp.length;
}
function fn_cargomanifestdefault(){
var datacargos='<a id=\'achilds\' href=\'javascript:void(0)\' onClick=\'fn_showcargo()\'><span id=\'spcargo\'>0</span> Manifest</a>';
myForm.setItemLabel('lbllookuphist', datacargos);
}
function fn_printtraold(tiketnumber,idtransaction,idcategory){
var sp=ajaxuridhtmlx('".$this->enc("obj_tra")."','obj=".$this->enc("tra_cargticket")."&task=".$this->enc("printtra")."&idtransaction='+idtransaction+'&txt_tiketnumber='+tiketnumber+'&txt_category='+idcategory).split('|');
//alert(tiketnumber+' '+idtransaction+' '+idcategory);
@ -494,7 +543,7 @@
dwins=new dhtmlXWindows();dwins.attachViewportTo(\"winVP\");
var picdata=myForm.getItemValue('txt_picdata');
var url='?ajax=1&sec=1&option=".$this->enc("obj_tra")."&obj=".$this->enc("tra_cargticket")."&task=".$this->enc("getpic")."&picdata='+picdata;";
$url="?ajax=1&sec=1&option=".$this->enc("obj_tra")."&obj=".$this->enc("tra_newticket")."&task=".$this->enc("getpic");
$url="?ajax=1&sec=1&option=".$this->enc("obj_tra")."&obj=".$this->enc("tra_cargticket")."&task=".$this->enc("getpic");
$this->FN_DHTMLXWINDOWSURL("dwins","winpic","Get Picture","50","50","560","400",$url,false,true);
echo " }
@ -509,6 +558,7 @@
function fn_grid_loaddata()
{
fn_cargomanifestdefault();
var keyword=myFormsearch.getItemValue('txtsearch');
url=fn_dhtmlxloadobject('".$this->enc("obj_tra")."','obj=".$this->enc("tra_cargticket")."&task=".$this->enc("grdrecord")."&keyword='+keyword);
//alert(url);
@ -630,6 +680,32 @@
}
public function fn_getcargo(){
$idtiketcargo=$_REQUEST['idtiketcargo'];
$qry="select * from ".DB_APORTIL.".tbl_cargo_tiketdetail where idtiketcargo='$idtiketcargo' and isdeleted=0 order by id asc";
$rs=$this->selectquery($qry);
if($rs)
{
$i=1;$data="";
while($row=$this->data_row_array($rs))
{
$id=$row['id'];
$names=$row['names'];
$birthofdate=$row['birthofdate'];
$ages=$row['ages'];
$gender=$row['gender'];
$notes=$row['notes'];
$data.=$id."|".$names."|".$birthofdate."|".$ages."|".$gender."|".$notes.";";
$i+=1;
}
if($data){
$data=substr($data,0,strlen($data)-1);
}
echo $data;
}
}
public function fn_saverecord($isupdate=null)
{
$year=date("Y");$id=0;
@ -639,6 +715,7 @@
$shipnumber=$sp[1];$shipname=$sp[0];
$tiketnumber=$_REQUEST['txt_tiketnumber'];
$tiketnumberpassenger=$_REQUEST['txt_tiketnumberpassenger'];
$cargomanifest=$_REQUEST['txt_cargmanifest'];
$voynumber=$_REQUEST['txt_voynumber'];
$inctiket=$_REQUEST['txt_inctiket'];
$idcategory=$_REQUEST['txt_idcategory'];
@ -700,6 +777,34 @@
if($this->executequery($qry))
{
if(!$id){$id=mysql_insert_id();}
// ==== Manifest
if($cargomanifest){
$spcargo=explode(";", $cargomanifest);
for($j=0;$j<count($spcargo);$j++){
$spdata=explode("|", $spcargo[$j]);
$idcargodetail=$spdata[0];
$manifestnumber=$spdata[1];
$manifestname=$spdata[2];
$unitname=$spdata[3];
$weight=$spdata[4];
$cargotype=$spdata[5];
$description=$spdata[6];
$idtiketcargo=$spdata[7];
$qryins="insert into ".DB_APORTIL.".tbl_cargo_tiketdetail
set idtiketcargo='$id',manifestnumber='$manifestnumber',manifestname='$manifestname',unitname='$unitname',
weight='$weight',cargotype='$cargotype',description='$description',iby='".$_SESSION['nik']."',idt=now()";
if($this->fn_row_isexists("select id from ".DB_APORTIL.".tbl_cargo_tiketdetail where id='$idcargodetail' order by id asc limit 1")){
$qryins="update ".DB_APORTIL.".tbl_cargo_tiketdetail
set manifestnumber='$manifestnumber',manifestname='$manifestname',unitname='$unitname',
weight='$weight',cargotype='$cargotype',description='$description',
uby='".$_SESSION['nik']."',udt=now()
where id='$idcargodetail'";
}
$this->executequery($qryins);
}
}
$qry="insert into ".DB_APORTIL.".tbl_cargo_tiket_log
set idcargoticket='$id',dates='".date("Y-m-d")."',status=0,remarkstatus='Submitted',
remark='',iby='".$_SESSION['nik']."',idt=now()";

View File

@ -0,0 +1,322 @@
<?php
class TRA_CARGTICKETC extends TRA
{
public function tra_cargticketc_javainit()
{
}
public function fn_cargticketc_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_cargticketc();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_cargticketc();
break;
}
}
public function fn_default_cargticketc()
{
echo $this->FN_CREATEHEADER();
$tiketnumber=$_REQUEST['tiketnumber'];
$cargmanifest=$_REQUEST['cargmanifest'];
$idtiketcargoheader=$_REQUEST['idtiketcargo'];
$idtiketcargo=$this->fn_get_fieldvalue("id","select id from ".DB_APORTIL.".tbl_cargo_tiket where tiketnumber='$tiketnumber'");
echo "<style>
.besidebtnsave {margin-left:104px;margin-top:-6px;position:absolute;}
.besidebtnupdate {margin-left:198px;margin-top:-6px;position:absolute;}
.besidebtndelete {margin-left:288px;margin-top:-6px;position:absolute;}
</style>";
echo "<script>
var myForm,myFormsearch,dgcargo;
var rowid=0;
function initObject()
{";
$formdata=array(
array("type"=>"settings","position"=>"label-left","labelWidth"=>"180","inputWidth"=>"120"),
array("type"=>"block","width"=>"500","label"=>"",
"list"=>array(
array("type"=>"hidden","name"=>"txt_tiketnumber","value"=>$tiketnumber),
array("type"=>"hidden","name"=>"txt_idtiketcargo","value"=>$idtiketcargo),
array("type"=>"label","name"=>"lblinfoselect","label"=>"Tiket Number <b>$tiketnumber</b>","className"=>"","labelWidth"=>"280","offsetTop"=>"-5","offsetLeft"=>"0"),
array("type"=>"newcolumn"),
array("type"=>"button","name"=>"btnsetcargo","value"=>"Set Manifest","className"=>"button_saveas","offsetLeft"=>"10","disabled"=>"0"),
)
)
);
$this->FN_DHTMLXFORM("myForm","divfrmchild",$formdata,true);
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
"btnsetcargo"=>"fn_setcargo();"
)
)
);
$this->FN_DHTMLXFORMEVENT("myForm",$arrevent);
$footerevent="<div style='height:15pt;padding-top:3pt;font-size:10pt'>";
// $footerevent.="<a href='javascript:void(0)' onClick='fn_grid_newrow()'><span>Tambah Record</span></a>&nbsp;&nbsp;";
$footerevent.="<a href='javascript:void(0)' onClick='fn_grid_new()' style='font-size:16px'><span>Add</span></a>&nbsp;&nbsp;";
$footerevent.="<a href='javascript:void(0)' onClick='fn_grid_delrow()' style='font-size:16px'><span>Delete Record</span></a>&nbsp;&nbsp;";
$footerevent.="</div>";
$grdinit=array("gridname"=>"dgcargo","divtarget"=>"div_dgcargo","divpaging"=>"div_dgcargopaging","paginglimit"=>5,
"showloader"=>"true","footer"=>"$footerevent","footerspan"=>"8","footeralign"=>"left",
"enableMultiline"=>"true","setdateformat"=>"%Y-%m-%d"
);
$gridproperties=array("grid"=>"right,ro,96,right,str,false,true",
"id&nbsp;&nbsp;"=>"left,ro,210,left,str,false,true",
"Manifest Number&nbsp;&nbsp;"=>"left,ed,210,left,str,false",
"Name&nbsp;&nbsp;"=>"left,ed,210,left,str,false",
"Unit Name&nbsp;"=>"center,ed,220,center,str,false",
"Weight&nbsp;"=>"center,ed,220,center,str,false",
"Types&nbsp;"=>"left,ed,220,left,str,false",
"Description&nbsp;"=>"left,ed,220,left,str,false",
"idtiketcargo"=>"left,ro,110,left,int,false,true",
);
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
echo "dgcargo.setStyle('font-size:14px','font-size:14px','');";
echo "dgcargo.setDateFormat('%Y-%m-%d', '%Y-%m-%d');";
$eventrowselect="rowid=(dgcargo.cells(rId,1).getValue());";
// $eventxle="rwcount=dgtrasoap.getRowsNum();";
// $eventxle.="var isvitanam=0;";
// $eventxle.="if(rwcount>0){isvitanam=1;}";
// $eventxle.="window.parent.fn_setvalidationheader('isvitanam',isvitanam);";
// $eventxle.="window.parent.fn_setvalidationheader('iscppt',isvitanam);";
// $eventxle.="for(i=1;i<=rwcount;i++){";
// $eventxle.=" var insertby=dgtrasoap.cells(i,11).getValue();";
// $eventxle.=" if(trim(insertby)!==trim('".$_SESSION['nik']."')){";
// $eventxle.=" dgtrasoap.setRowTextStyle(i, \"color:grey;\");";
// $eventxle.=" }";
// $eventxle.="}";
$arrevent=array(
array("eventname"=>"onRowSelect","eventparam"=>"rId",
"statement"=>"$eventrowselect"
),
// array("eventname"=>"onXLE","eventparam"=>"grid_obj,rcount",
// "statement"=>"$eventxle"
// )
);
$this->FN_DHTMLXGRIDVIEWEVENT("dgcargo",$arrevent);
// if($cargmanifest&&!$idtiketcargoheader){
// echo "fn_grid_default();";
// }
echo " }
function fn_grid_new(){
var idx=rowid;
// console.log('".$cargmanifest."');
var cargmanifest='".$cargmanifest."';
var rowcount=dgcargo.getRowsNum()+1;
var idtiketcargo=myForm.getItemValue('txt_idtiketcargo');
var gridid=dgcargo.uid();";
echo " dgcargo.addRow(rowcount,[gridid,0,'','','Kg','','','',idtiketcargo]);
}
function fn_grid_delrow(){
dhtmlx.confirm({
title:'Confirmation',text:'Are you sure for delete this row?',type:'confirm',
callback:function(result){
if(result)
{
dgcargo.deleteSelectedRows();
if(rowid==0){
dgcargo.deleteSelectedRows();
}
else{
var delchargo=ajaxuridhtmlx('".$this->enc("obj_tra")."','obj=".$this->enc("tra_cargticketc")."&task=".$this->enc("delcargo")."&id='+rowid).split('|');
if(delchargo[0]=='ok'){
fn_dhtmlxmessage('','Data has been deleted. Thank you');
// fn_grid_loaddata();
}
else{
fn_dhtmlxmessage('error',delchargo[1]);
}
}
}
}
});
}
function fn_grid_default(){
var idx=rowid;
var cargmanifest='".$cargmanifest."';
var rowcount=dgcargo.getRowsNum()+1;
var idtiketcargo=myForm.getItemValue('txt_idtiketcargo');
if(cargmanifest){
var sp=cargmanifest.split(';');
for(i=0;i<sp.length;i++)
{
var gridid=dgcargo.uid();
var spcargo=sp[i].split('|');
var idcargo=spcargo[1];
var manifestnumber=spcargo[2];
var manifestname=spcargo[3];
var unitname=spcargo[4];
var weight=spcargo[5];
var types=spcargo[6];
var description=spcargo[7];
var idtiketcargo=spcargo[8];
dgcargo.addRow((i+1),[gridid,idcargo,manifestnumber,manifestname,unitname,weight,types,description,idtiketcargo]);
}
}
}
function fn_setcargo(){
var rowcount=dgcargo.getRowsNum();
// alert(rowcount);
if(rowcount<=0)
{
fn_dhtmlxmessage('error','Please add child first!');
return false;
}
var valcargo='';
for(i=1;i<=rowcount;i++)
{
// alert(valcargo);
var idcargos=dgcargo.cells(i,1).getValue();
// alert('dd');
var manifestnumber=dgcargo.cells(i,2).getValue();
var manifestname=dgcargo.cells(i,3).getValue();
var unitname=dgcargo.cells(i,4).getValue();
var weight=dgcargo.cells(i,5).getValue();
var types=dgcargo.cells(i,6).getValue();
var description=dgcargo.cells(i,7).getValue();
var idtiketcargo=dgcargo.cells(i,8).getValue();
valcargo+=idcargos+'|'+manifestnumber+'|'+manifestname+'|'+unitname+'|'+weight+'|'+types+'|'+description+'|'+idtiketcargo+';';
}
valcargo=valcargo.substring(0,valcargo.length-1);
window.parent.fn_closecargo(valcargo);
}
function fn_grid_loaddata()
{
var idtiketcargo=myForm.getItemValue('txt_idtiketcargo');
var url=fn_dhtmlxloadobject('".$this->enc("obj_tra")."','obj=".$this->enc("tra_cargticketc")."&task=".$this->enc("grdrecord")."&idtiketcargo='+idtiketcargo);
console.log(url);
dgcargo.clearAndLoad(url);";
echo " }
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\" style=\"\">
<tr>
<td valign=\"top\">
<div id=\"divfrmchild\" style=\"width:560px;margin-top:-6px;\"></div>
</td>
</tr>
<tr>
<td valign=\"top\">
".$this->CREATE_LINK('window.location.reload();','REFRESH','javascript:void(0)','_self','','','','')."
</td>
</tr>
<tr>
<td>
<div id=\"div_dgcargo\" style=\"height:360px;width:99%;overflow:hidden\"></div>
</td>
</tr>
<tr>
<td>
<div id=\"div_dgcargopaging\" style=\"width:740px;margin-top:1px\"></div>
</td>
</tr>
<tr><td valign=\"top\"><div id=\"loadergrid\" style=\"z-index:100;position:absolute;margin-top:-220px;margin-left:50%;display:visibility;\">".$this->CREATE_IMAGE("loadergrid.gif")."</div></td></tr>
<tr>
<td valign=\"top\" align=\"left\">
<table>
<tr>
<td style='color:red;font-weight:bold;'>Notes</td>
<td>:</td>
<td>- Double click row for edit</td>
</tr>
</table>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_grdrecord()
{
$idtiketcargo=$_REQUEST["idtiketcargo"];
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="utf-8"?>');
echo "<rows id='0'>";
$qry="select * from ".DB_APORTIL.".tbl_cargo_tiketdetail
where idtiketcargo='$idtiketcargo' 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='".$i."'>");
print("<cell><![CDATA[".$i."]]></cell>");
print("<cell><![CDATA[".$row["id"]."]]></cell>");
print("<cell><![CDATA[".$row["manifestnumber"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["manifestname"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["unitname"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["weight"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["cargotype"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["description"]."</span>"."]]></cell>");
print("<cell><![CDATA[".$row["idtiketcargo"]."</span>"."]]></cell>");
echo ("</row>");
$i+=1;
}
}
else
{
// echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
echo "error at ".__LINE__." line in ".__FILE__." file<br>";
}
echo "</rows>";
}
public function fn_delcargo(){
$id=$_REQUEST['id'];
$qry="update ".DB_APORTIL.".tbl_cargo_tiketdetail set isdeleted=1,remarkdeleted='Cancel by user ',dby='".$_SESSION['nik']."',ddt=now()
where id='$id'";
if($this->executequery($qry)){
echo "ok|";
}
else{
echo "failed|Failed remove child";
}
}
}
?>

View File

@ -110,7 +110,7 @@
array("type"=>"combo","name"=>"cbo_bodday","label"=>"","required"=>"true","info"=>"true","inputWidth"=>"60","value"=>"",
"tooltip"=>"Choice Day of Birthdate. Thank You","validate"=>"NotEmpty","maxLength"=>"","className"=>"besidecbobodmonth txtcenter","note"=>array("text"=>"ex : 31")),
array("type"=>"combo","name"=>"cbo_passengertype","label"=>"Passenger Type","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
array("type"=>"combo","name"=>"cbo_idpassengertype","label"=>"Passenger Type","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Choice Passenger Type. Thank You","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtleft"),
array("type"=>"newColumn"),
array("type"=>"input","name"=>"txt_passengertypedescription","label"=>"","required"=>"false","info"=>"true","inputWidth"=>"180","value"=>"",
@ -148,8 +148,8 @@
array("type"=>"newColumn"),
array("type"=>"label","name"=>"lblmeter","label"=>"OTL","className"=>"besidelabelprice"),
array("type"=>"input","name"=>"txt_price","label"=>"Price","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0","readonly"=>"true",
"tooltip"=>"Insert Price first. Thank You","validate"=>"NotEmpty","maxLength"=>"","className"=>"txtright"),
array("type"=>"input","name"=>"txt_price","label"=>"Price","required"=>"false","info"=>"true","inputWidth"=>"90","value"=>"0","readonly"=>"true",
"tooltip"=>"Insert Price first. Thank You","maxLength"=>"","className"=>"txtright"),
array("type"=>"newColumn"),
array("type"=>"label","name"=>"lblmeter","label"=>"\$","className"=>"besidelabelprice"),
@ -170,8 +170,8 @@
array("type"=>"column"),
array("type"=>"label","name"=>"lblmeter","label"=>"\$","className"=>"besidelabelprice"),
array("type"=>"input","name"=>"txt_totalprice","label"=>"Total","required"=>"true","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Insert total first. Thank You","validate"=>"NotEmpty","maxLength"=>"11","className"=>"txtright txttotalbiaya"),
array("type"=>"input","name"=>"txt_totalprice","label"=>"Total","required"=>"false","info"=>"true","inputWidth"=>"90","value"=>"0",
"tooltip"=>"Insert total first. Thank You","maxLength"=>"11","className"=>"txtright txttotalbiaya"),
array("type"=>"newColumn"),
array("type"=>"label","name"=>"lblmeter","label"=>"\$","className"=>"besidelabelprice"),
@ -205,11 +205,11 @@
}
$this->FN_COMBOVALIDATIONVALUEARRAY("myForm","cbo_bodday",$arrval);
$arrval=array();
array_push($arrval,array("value"=>"General","text"=>"General"),
array("value"=>"VIP","text"=>"VIP")
);
$this->FN_COMBOVALIDATIONVALUEARRAY("myForm","cbo_passengertype",$arrval);
// $arrval=array();
// array_push($arrval,array("value"=>"1","text"=>"General"),
// array("value"=>"2","text"=>"VIP")
// );
// $this->FN_COMBOVALIDATIONVALUEARRAY("myForm","cbo_idpassengertype",$arrval);
$mycontainerpic="var divpicture=document.createElement('DIV');";
$mycontainerpic.="divpicture.id='divpicture';divpicture.style.height='100%';";
$mycontainerpic.="var divpicturecontent='<table id=\"tbfindinvoice\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-top:0px;margin-left:-5px;\">';";
@ -233,6 +233,9 @@
//echo $mycontainerpic;
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_passenger_type|id,passengertype')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idpassengertype","tbl_passenger_type","$urlcbo","");
$urlcbo="fn_dhtmlxloadobject('".$this->enc("obj_controller")."','obj=".$this->enc("-")."&task=".$this->enc("dhtmlxcbofilter")."&tableobj=tbl_ship_information|id,shipname')";
$this->FN_COMBOVALIDATIONVALUENEW("myForm","cbo_idship","tbl_ship_information","$urlcbo","");
@ -262,6 +265,8 @@
"txt_bodyears"=>"Error Found : Please Insert <b>Years of birthdate</b> First. Thank You",
"cbo_bodmonth"=>"Error Found : Please Insert <b>Month of birthdate</b> First. Thank You",
"cbo_bodday"=>"Error Found : Please Insert <b>day of birthdate</b> First. Thank You",
"cbo_idpassengertype"=>"Error Found : Please Insert Passengertype first. Thank You",
"cbo_idcardtype"=>"Error Found : Please Insert identity Card first. Thank You",
"cbo_idcardtype"=>"Error Found : Please Insert identity Card first. Thank You",
"txt_nationality"=>"Error Found : Please Insert Nationality first. Thank You",
//"txt_picdata"=>"Error Found : Please Insert <b>Picture</b> first. Thank You",
@ -279,10 +284,11 @@
$arrayControls=array("txt_id"=>"","cbo_idship"=>"","txt_tiketnumber"=>"","txt_voynumber"=>"",
"txt_passengername"=>"","cbo_idgender"=>"","txt_bod"=>"","txt_bodyears"=>"",
"cbo_idcardtype"=>"","txt_nationality"=>"Timor Leste","txt_childspassenger"=>"",
"cbo_idpassengertype"=>"","txt_passengertypedescription"=>"","cbo_idcardtype"=>"","txt_nationality"=>"Timor Leste","txt_childspassenger"=>"",
"txt_cardnumber"=>"","txt_picdata"=>"aportildefault.png","txt_dates"=>date("Y-m-d"),"txt_price"=>0,
"txt_timeschedule"=>"00:00:00","txt_baggageinkg"=>0,"txt_limitbaggage"=>80,"txt_overlimitbaggage"=>0,
"txt_priceoverinkg"=>0,"txt_pricebaggage"=>0,"txt_totalprice"=>0,"cbo_idroutestart"=>"","cbo_idrouteend"=>""
);
// === Form Event
@ -302,7 +308,7 @@
// === Cbo Route End Change
$onchangecboidrouteend="if(myForm.getItemValue('cbo_idrouteend')!='')";
$onchangecboidrouteend.="{";
$onchangecboidrouteend.=" fn_getprice(0);";
$onchangecboidrouteend.=" fn_getprice();";
//$onchangecboidrouteend.=" alert('f');";
// $onchangecboidrouteend.=" var sp=ajaxuridhtmlx('".$this->enc("obj_tra")."','obj=".$this->enc("tra_newticket")."&task=".$this->enc("getprice")."&idroutestart='+myForm.getItemValue('cbo_idroutestart')+'&idrouteend='+myForm.getItemValue('cbo_idrouteend')).split('|');";
// $onchangecboidrouteend.=" if(trim(sp[0])=='failed'){fn_dhtmlxmessage('error',sp[1]);".$this->FN_DHTMLXWINDOWSHIDEPROGRESS().";return false;}";
@ -424,11 +430,12 @@
$onbuttonclickbtncancel.="myForm.setItemValue('cbo_bodmonth','');myForm.setItemValue('cbo_bodday','');";
$onchangepassengertype="var passengertype=myForm.getItemValue('cbo_passengertype').toString().toLowerCase();";
$onchangepassengertype.="if(passengertype=='general'){";
$onchangepassengertype.=" fn_getprice(0);";
$onchangepassengertype.="}";
$onchangepassengertype.="else{fn_getprice(1);}";
$onchangepassengertype="var passengertype=myForm.getItemValue('cbo_idpassengertype').toString().toLowerCase();";
$onchangepassengertype.="fn_getprice();";
// $onchangepassengertype.="if(passengertype=='general'){";
// $onchangepassengertype.=" fn_getprice(0);";
// $onchangepassengertype.="}";
// $onchangepassengertype.="else{fn_getprice(1);}";
$arrevent=array(
array("eventname"=>"onbuttonclick","eventparam"=>"id,val",
"switch"=>array(
@ -448,7 +455,7 @@
array("eventname"=>"onchange","eventparam"=>"id,ev,val",
"switch"=>array(
"cbo_idrouteend"=>"$onchangecboidrouteend $onchangetxtbaggage",
"cbo_passengertype"=>"$onchangepassengertype",
"cbo_idpassengertype"=>"$onchangepassengertype",
)
)
@ -516,7 +523,8 @@
"txt_passengername"=>"","cbo_idgender"=>"","txt_bod"=>"","cbo_idcardtype"=>"idcardtype|cardtype","txt_cardnumber"=>"",
"txt_nationality"=>"","txt_voynumber"=>"","txt_picdata"=>"","txt_dates"=>"","cbo_idroutestart"=>"idroutestart|routenamestart",
"cbo_idrouteend"=>"idrouteend|routenameend","txt_price"=>"","txt_baggageinkg"=>"","txt_limitbaggage"=>"","txt_overlimitbaggage"=>"",
"txt_priceoverinkg"=>"","txt_pricebaggage"=>"","txt_totalprice"=>"","txt_modifcount"=>""
"txt_priceoverinkg"=>"","txt_pricebaggage"=>"","txt_totalprice"=>"","txt_modifcount"=>"","cbo_idpassengertype"=>"idpassengertype|passengertype",
"txt_passengertypedescription"=>""
);
$otherevent="if(spres[23]>1)";
$otherevent.="{";
@ -542,9 +550,15 @@
echo " }
function fn_getprice(isfree){
function fn_getprice(){
var sp=ajaxuridhtmlx('".$this->enc("obj_tra")."','obj=".$this->enc("tra_newticket")."&task=".$this->enc("getprice")."&idroutestart='+myForm.getItemValue('cbo_idroutestart')+'&idrouteend='+myForm.getItemValue('cbo_idrouteend')).split('|');
if(trim(sp[0])=='failed'){fn_dhtmlxmessage('error',sp[1]);".$this->FN_DHTMLXWINDOWSHIDEPROGRESS().";return false;}
var idxpassengertype = myForm.getItemValue('cbo_idpassengertype');
// alert(idxpassengertype);
var isfree=0;
if(idxpassengertype==2){
isfree=1;
}
if(!isfree){
myForm.setItemValue('txt_price',sp[2]);
}
@ -887,6 +901,9 @@
$idcardtype=$_REQUEST['cbo_idcardtype'];
$cardtype=$this->fn_get_fieldvalue("cardtype","select cardtype from ".DB_APORTIL.".tbl_passenger_identifycardtype where id='$idcardtype'");
$cardnumber=$_REQUEST['txt_cardnumber'];
$idpassengertype=$_REQUEST['cbo_idpassengertype'];
$passengertype=($idpassengertype==1 ? "General" : "VIP");
$passengertypedescription=$_REQUEST['txt_passengertypedescription'];
$nationality=$_REQUEST['txt_nationality'];
$picdata="aportildefault.png";//$_REQUEST['txt_picdata'];
$dates=$_REQUEST['txt_dates'];
@ -929,18 +946,19 @@
$qry="insert into ".DB_APORTIL.".tbl_passenger_tiket
set idship='$idship',tiketnumber='$tiketnumber',voynumber='$voynumber',inctiket='$inctiket',inctiketyear='$inctiketyear',shipname='$shipname',shipnumber='$shipnumber',passengername='$passengername',
bod='$bod',idgender='$idgender',gender='$gender',idcardtype='$idcardtype',cardtype='$cardtype',cardnumber='$cardnumber',nationality='$nationality',picdata='$picdata',dates='$dates',idroutestart='$idroutestart',
routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',seatnumber='$seatnumber',quantity='1',price='$price',baggageinkg='$baggageinkg',
limitbaggage='$limitbaggage',overlimitbaggage='$overlimitbaggage',priceoverinkg='$priceoverinkg',pricebaggage='$pricebaggage',totalprice='$totalprice',years='$year',ipclient='$ipprintclient',
modifcount=0,status=0,iby='".$_SESSION['nik']."',idt=now()";
bod='$bod',idgender='$idgender',gender='$gender',idcardtype='$idcardtype',cardtype='$cardtype',cardnumber='$cardnumber',idpassengertype='$idpassengertype',passengertype='$passengertype',passengertypedescription='$passengertypedescription',
nationality='$nationality',picdata='$picdata',dates='$dates',idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',seatnumber='$seatnumber',
quantity='1',price='$price',baggageinkg='$baggageinkg',limitbaggage='$limitbaggage',overlimitbaggage='$overlimitbaggage',priceoverinkg='$priceoverinkg',pricebaggage='$pricebaggage',totalprice='$totalprice',
years='$year',ipclient='$ipprintclient',modifcount=0,status=0,iby='".$_SESSION['nik']."',idt=now()";
if($isupdate)
{
$qry="update ".DB_APORTIL.".tbl_passenger_tiket
set idship='$idship',tiketnumber='$tiketnumber',voynumber='$voynumber',shipname='$shipname',shipnumber='$shipnumber',passengername='$passengername',
bod='$bod',idgender='$idgender',gender='$gender',idcardtype='$idcardtype',cardtype='$cardtype',cardnumber='$cardnumber',nationality='$nationality',
picdata='$picdata',dates='$dates',idroutestart='$idroutestart',routenamestart='$routenamestart',idrouteend='$idrouteend',
routenameend='$routenameend',quantity='1',price='$price',baggageinkg='$baggageinkg',limitbaggage='$limitbaggage',overlimitbaggage='$overlimitbaggage',
priceoverinkg='$priceoverinkg',pricebaggage='$pricebaggage',totalprice='$totalprice',years='$year',modifcount=modifcount+1,ipclient='$ipprintclient',uby='".$_SESSION['nik']."',udt=now()
bod='$bod',idgender='$idgender',gender='$gender',idcardtype='$idcardtype',cardtype='$cardtype',cardnumber='$cardnumber',idpassengertype='$idpassengertype',
passengertype='$passengertype',passengertypedescription='$passengertypedescription',nationality='$nationality',picdata='$picdata',dates='$dates',idroutestart='$idroutestart',
routenamestart='$routenamestart',idrouteend='$idrouteend',routenameend='$routenameend',quantity='1',price='$price',baggageinkg='$baggageinkg',
limitbaggage='$limitbaggage',overlimitbaggage='$overlimitbaggage',priceoverinkg='$priceoverinkg',pricebaggage='$pricebaggage',totalprice='$totalprice',
years='$year',modifcount=modifcount+1,ipclient='$ipprintclient',uby='".$_SESSION['nik']."',udt=now()
where id='$id'";
}

View File

@ -118,9 +118,9 @@
);
$this->FN_DHTMLXGRIDVIEWEVENT("dgchild",$arrevent);
// if($childspassenger){
// echo "fn_grid_default();";
// }
if($childspassenger){
echo "fn_grid_default();";
}
echo " }
@ -173,13 +173,13 @@
{
var gridid=dgchild.uid();
var spchild=sp[i].split('|');
var idchild=spchild[1];
var names=spchild[2];
var birthofdate=spchild[3];
var ages=spchild[4];
var gender=spchild[5];
var notes=spchild[6];
var idtiketpassenger=spchild[7];
var idchild=spchild[0];
var names=spchild[1];
var birthofdate=spchild[2];
var ages=spchild[3];
var gender=spchild[4];
var notes=spchild[5];
var idtiketpassenger=spchild[6];
dgchild.addRow((i+1),[gridid,idchild,names,birthofdate,ages,gender,notes,idtiketpassenger]);
}