Add duration field and validation for ticket cancellation

This commit is contained in:
2025-05-29 06:31:31 +07:00
parent 33ef7566af
commit 6f0921ca2c
3 changed files with 55 additions and 8 deletions

View File

@ -48,6 +48,7 @@
array("type"=>"fieldset","width"=>"1080","label"=>"Search", array("type"=>"fieldset","width"=>"1080","label"=>"Search",
"list"=>array( "list"=>array(
array("type"=>"hidden","name"=>"txt_idcargo"), array("type"=>"hidden","name"=>"txt_idcargo"),
array("type"=>"hidden","name"=>"txt_duration"),
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240", array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"), "tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"), array("type"=>"newcolumn"),
@ -94,13 +95,18 @@
"Price "=>"right,ro,120,right,int,false", "Price "=>"right,ro,120,right,int,false",
"Quantity "=>"right,ro,144,right,int,false", "Quantity "=>"right,ro,144,right,int,false",
"Weight "=>"right,ro,144,right,int,false", "Weight "=>"right,ro,144,right,int,false",
"Total "=>"right,ro,120,right,int,false"); "Total "=>"right,ro,120,right,int,false",
"Insert Date "=>"center,ro,170,center,str,false",
"Duration ( Hours ) "=>"center,ro,120,center,str,false"
);
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()"); $this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$oneditcell="if(colid==1&&stage==1)"; $oneditcell="if(colid==1&&stage==1)";
$oneditcell.="{"; $oneditcell.="{";
$oneditcell.=" var status=dgresult.cells(rowid,4).getValue();"; $oneditcell.=" var status=dgresult.cells(rowid,4).getValue();";
$oneditcell.=" var idcargo=dgresult.cells(rowid,0).getValue();"; $oneditcell.=" var idcargo=dgresult.cells(rowid,0).getValue();";
$oneditcell.=" var duration=dgresult.cells(rowid,18).getValue();";
$oneditcell.=" myFormsearch.setItemValue('txt_duration',duration);";
$oneditcell.=" var tiketnumber=dgresult.cells(rowid,7).getValue();"; $oneditcell.=" var tiketnumber=dgresult.cells(rowid,7).getValue();";
$oneditcell.=" if(status!=0){fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number!!');return false;}"; $oneditcell.=" if(status!=0){fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number!!');return false;}";
$oneditcell.=" myFormsearch.setItemValue('txt_idcargo',idcargo+'|'+tiketnumber);"; $oneditcell.=" myFormsearch.setItemValue('txt_idcargo',idcargo+'|'+tiketnumber);";
@ -122,7 +128,13 @@
function fn_cancelcrg() function fn_cancelcrg()
{"; {
var duration=myFormsearch.getItemValue('txt_duration');
if(duration>6)
{
fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number, because the duration is <b>more than 6 hours</b>!!');
return false;
}";
//var idcargo=myFormsearch.getItemValue('txt_idcargo'); //var idcargo=myFormsearch.getItemValue('txt_idcargo');
//var url='?ajax=1&sec=1&option=".$this->enc("obj_ss")."&obj=".$this->enc("ss_necheck")."&task=".$this->enc("viewchecklist")."&idchecklist='+idchecklist+'&checklistnumber='+checklistnumber+'&category='+category;"; //var url='?ajax=1&sec=1&option=".$this->enc("obj_ss")."&obj=".$this->enc("ss_necheck")."&task=".$this->enc("viewchecklist")."&idchecklist='+idchecklist+'&checklistnumber='+checklistnumber+'&category='+category;";
$rtn="var idcargo=myFormsearch.getItemValue('txt_idcargo');"; $rtn="var idcargo=myFormsearch.getItemValue('txt_idcargo');";
@ -281,7 +293,7 @@
$qry="select id,0 ischecklist,idship,shipname,tiketnumber,tiketnumberpassenger,voynumber,inctiket,idcategory,cargodescription,passengername, $qry="select id,0 ischecklist,idship,shipname,tiketnumber,tiketnumberpassenger,voynumber,inctiket,idcategory,cargodescription,passengername,
idcardtype,cardtype,cardnumber,dates,idroutestart,routenamestart,idrouteend, idcardtype,cardtype,cardnumber,dates,idroutestart,routenamestart,idrouteend,
routenameend,price,quantity,weight,totalprice,units,modifcount,status routenameend,price,quantity,weight,totalprice,units,modifcount,status,iby,idt
from ".DB_APORTIL.".tbl_cargo_tiket from ".DB_APORTIL.".tbl_cargo_tiket
where (tiketnumber like '%$keyword%' or voynumber like '%$keyword%' or passengername like '%$keyword%') and isdeleted=0 and status=0 where (tiketnumber like '%$keyword%' or voynumber like '%$keyword%' or passengername like '%$keyword%') and isdeleted=0 and status=0
order by id desc limit ".TBL_PAGE_LIMIT; order by id desc limit ".TBL_PAGE_LIMIT;
@ -313,6 +325,17 @@
print("<cell><![CDATA["."<span style='color:$color'>".$row["quantity"]."</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:$color'>".$row["quantity"]."</span>"."]]></cell>");
print("<cell><![CDATA["."<span style='color:$color'>".$row["weight"]."</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:$color'>".$row["weight"]."</span>"."]]></cell>");
print("<cell><![CDATA["."<span style='color:$color'>".$row["totalprice"]." \$</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:$color'>".$row["totalprice"]." \$</span>"."]]></cell>");
print("<cell><![CDATA[".date("Y-m-d H:i:s",strtotime($row["idt"]))."]]></cell>");
$now=date("Y-m-d H:i:s");
$idt=date("Y-m-d H:i:s",strtotime($row["idt"]));
$df=$this->NewDateDiff($idt,$now);
$durationinhours=0;
if(count($df)>0)
{
$durationindays=$df['day']*24;
$durationinhours=$df['hour']+$durationindays;
}
print("<cell><![CDATA[".$durationinhours."]]></cell>");
echo ("</row>"); echo ("</row>");
$i+=1; $i+=1;
} }

View File

@ -48,6 +48,7 @@
array("type"=>"fieldset","width"=>"1080","label"=>"Search", array("type"=>"fieldset","width"=>"1080","label"=>"Search",
"list"=>array( "list"=>array(
array("type"=>"hidden","name"=>"txt_idticketing"), array("type"=>"hidden","name"=>"txt_idticketing"),
array("type"=>"hidden","name"=>"txt_duration"),
array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240", array("type"=>"input","name"=>"txtsearch","label"=>"Insert Your Keyword","info"=>"true","inputWidth"=>"240",
"tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"), "tooltip"=>"Insert Your Keyword","maxLength"=>"","className"=>"txtleft","labelWidth"=>"210"),
array("type"=>"newcolumn"), array("type"=>"newcolumn"),
@ -77,7 +78,7 @@
$footerevent.="</div>"; $footerevent.="</div>";
$grdinit=array("gridname"=>"dgresult","divtarget"=>"div_dgresult","divpaging"=>"div_dgresultpaging","paginglimit"=>PAGE_LIMIT, $grdinit=array("gridname"=>"dgresult","divtarget"=>"div_dgresult","divpaging"=>"div_dgresultpaging","paginglimit"=>PAGE_LIMIT,
"showloader"=>"true","enableMultiline"=>"true","footer"=>"$footerevent","footerspan"=>"16"); "showloader"=>"true","enableMultiline"=>"true","footer"=>"$footerevent","footerspan"=>"21");
$gridproperties=array("id"=>"right,ro,96,right,int,false,true", $gridproperties=array("id"=>"right,ro,96,right,int,false,true",
"<font color='green'><b>C&nbsp;&nbsp;</b></font>"=>"center,ra,30,center,int,false", "<font color='green'><b>C&nbsp;&nbsp;</b></font>"=>"center,ra,30,center,int,false",
"No.&nbsp;"=>"right,ro,35,center,int,false", "No.&nbsp;"=>"right,ro,35,center,int,false",
@ -97,12 +98,17 @@
"Quantity&nbsp;"=>"right,ro,110,right,int,false", "Quantity&nbsp;"=>"right,ro,110,right,int,false",
"Price&nbsp;"=>"right,ro,120,right,int,false", "Price&nbsp;"=>"right,ro,120,right,int,false",
"Baggage&nbsp;"=>"right,ro,136,right,int,false", "Baggage&nbsp;"=>"right,ro,136,right,int,false",
"Price&nbsp;"=>"right,ro,120,right,int,false"); "Price baggage&nbsp;"=>"right,ro,120,right,int,false",
"Insert Date&nbsp;"=>"center,ro,170,center,str,false",
"Duration ( Hours )&nbsp;"=>"center,ro,120,center,str,false"
);
$this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()"); $this->FN_DHTMLXGRIDVIEW($grdinit,$gridproperties,"bricks","","fn_grid_loaddata()");
$oneditcell="if(colid==1&&stage==1)"; $oneditcell="if(colid==1&&stage==1)";
$oneditcell.="{"; $oneditcell.="{";
$oneditcell.=" var status=dgresult.cells(rowid,4).getValue();"; $oneditcell.=" var status=dgresult.cells(rowid,4).getValue();";
$oneditcell.=" var duration=dgresult.cells(rowid,21).getValue();";
$oneditcell.=" myFormsearch.setItemValue('txt_duration',duration);";
$oneditcell.=" var idticketing=dgresult.cells(rowid,0).getValue();"; $oneditcell.=" var idticketing=dgresult.cells(rowid,0).getValue();";
$oneditcell.=" var tiketnumber=dgresult.cells(rowid,7).getValue();"; $oneditcell.=" var tiketnumber=dgresult.cells(rowid,7).getValue();";
$oneditcell.=" if(status!=0){fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number!!');return false;}"; $oneditcell.=" if(status!=0){fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number!!');return false;}";
@ -125,7 +131,13 @@
function fn_cancelticketing() function fn_cancelticketing()
{"; {
var duration=myFormsearch.getItemValue('txt_duration');
if(duration>6)
{
fn_dhtmlxmessage('error','I\'m sorry you can\'t cancel this Tiket number, because the duration is <b>more than 6 hours</b>!!');
return false;
}";
//var idticketing=myFormsearch.getItemValue('txt_idticketing'); //var idticketing=myFormsearch.getItemValue('txt_idticketing');
//var url='?ajax=1&sec=1&option=".$this->enc("obj_ss")."&obj=".$this->enc("ss_necheck")."&task=".$this->enc("viewchecklist")."&idchecklist='+idchecklist+'&checklistnumber='+checklistnumber+'&category='+category;"; //var url='?ajax=1&sec=1&option=".$this->enc("obj_ss")."&obj=".$this->enc("ss_necheck")."&task=".$this->enc("viewchecklist")."&idchecklist='+idchecklist+'&checklistnumber='+checklistnumber+'&category='+category;";
$rtn="var idticketing=myFormsearch.getItemValue('txt_idticketing');"; $rtn="var idticketing=myFormsearch.getItemValue('txt_idticketing');";
@ -283,7 +295,8 @@
echo "<rows id='0'>"; echo "<rows id='0'>";
$qry="select id,0 ischecklist,idship,tiketnumber,inctiket,shipname,shipnumber,passengername,picdata,dates,idroutestart, $qry="select id,0 ischecklist,idship,tiketnumber,inctiket,shipname,shipnumber,passengername,picdata,dates,idroutestart,
routenamestart,idrouteend,routenameend,seatnumber,quantity,price,baggageinkg,pricebaggage,modifcount,status routenamestart,idrouteend,routenameend,seatnumber,quantity,price,baggageinkg,pricebaggage,modifcount,status,
idt
from ".DB_APORTIL.".tbl_passenger_tiket from ".DB_APORTIL.".tbl_passenger_tiket
where (tiketnumber like '%$keyword%' or passengername like '%$keyword%') and isdeleted=0 and status=0 where (tiketnumber like '%$keyword%' or passengername like '%$keyword%') and isdeleted=0 and status=0
order by id desc limit ".TBL_PAGE_LIMIT; order by id desc limit ".TBL_PAGE_LIMIT;
@ -318,6 +331,17 @@
print("<cell><![CDATA["."<span style='color:black'>"."\$".$row["price"]."</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:black'>"."\$".$row["price"]."</span>"."]]></cell>");
print("<cell><![CDATA["."<span style='color:black'>".$row["baggageinkg"]."</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:black'>".$row["baggageinkg"]."</span>"."]]></cell>");
print("<cell><![CDATA["."<span style='color:black'>"."\$".$row["pricebaggage"]."</span>"."]]></cell>"); print("<cell><![CDATA["."<span style='color:black'>"."\$".$row["pricebaggage"]."</span>"."]]></cell>");
print("<cell><![CDATA[".date("Y-m-d H:i:s",strtotime($row["idt"]))."]]></cell>");
$now=date("Y-m-d H:i:s");
$idt=date("Y-m-d H:i:s",strtotime($row["idt"]));
$df=$this->NewDateDiff($idt,$now);
$durationinhours=0;
if(count($df)>0)
{
$durationindays=$df['day']*24;
$durationinhours=$df['hour']+$durationindays;
}
print("<cell><![CDATA[".$durationinhours."]]></cell>");
echo ("</row>"); echo ("</row>");
$i+=1; $i+=1;
} }