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:
@ -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()";
|
||||
|
||||
Reference in New Issue
Block a user