| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/fulltion.com/private_html/administrator/modules/manu_masterbus/ |
Upload File : |
<?php
$linkUrl = "index.php?name=manu_masterbus&file=planbus";
if(@$_GET['act']=="add"){
@$arrData = array();
@$arrchk = @$db->getOne("busxroute"," count(*) as cost","BusID = '".@$_POST['BusID']."' and SetDate = '".@$objMaster->getdateformat(@$_POST['SetDate'])."'","","");
@$chk = @$arrchk['cost'];
if(@$chk == '0'){
$setDate = @$objMaster->getdateformat(@$_POST['SetDate']) < date('Y-m-d') ? date('Y-m-d') : @$objMaster->getdateformat(@$_POST['SetDate']);
@$arrData['RouteID'] = @$_POST['RouteID'];
@$arrData['SetDate'] = $setDate;
@$arrData['SetTime'] = @$_POST['SetTime'];
@$arrData['BusID'] = @$_POST['BusID'];
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
//echo "<pre>"; print_r(@$arrData);
//exit;
@$db->insertData("busxroute",@$arrData);
//exit;
@$msg = "Save Data complete.";
@$res = true;
}else{
@$err = "Save Data Unsuccessful.";
}
}elseif(@$_GET['act']=="editdata"){
@$arrData = array();
@$arrchk = @$db->getOne("busxroute"," count(*) as cost","BusID = '".@$_POST['BusID']."' and SetDate = '".@$objMaster->getdateformat(@$_POST['SetDate'])."' and BusXRouteID not in (select BusXRouteID from ".DB_PREFIX."busxroute where BusXRouteID='".@$_POST['BusXRouteID']."' )","","");
@$chk = @$arrchk['cost'];
if(@$chk == "0"){
@$arrData['RouteID'] = @$_POST['RouteID'];
@$arrData['SetDate'] = @$objMaster->getdateformat(@$_POST['SetDate']);
@$arrData['SetTime'] = @$_POST['SetTime'];
@$arrData['BusID'] = @$_POST['BusID'];
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
@$db->updateData("busxroute",@$arrData," BusXRouteID='".@$_POST['BusXRouteID']."'");
@$msg = "Edit Data complete.";
@$res = true;
}else{
@$err = "Save Data Unsuccessful.";
}
}elseif(@$_GET['act']=="edit"){
@$arrRes = @$db->getOne("busxroute","*"," BusXRouteID='".@$_GET['BusXRouteID']."'");
@$getBusEdit = @$db->getOne("bus","*"," BusID='".@$arrRes['BusID']."'");
@$getBusTypeEdit = @$db->getOne("bustype","*"," BusTypeID='".@$getBusEdit['BusType']."'");
}elseif(@$_GET['act']=="deletedata"){
@$arrchk = @$db->getOne("hist"," status "," BusXRouteID='".@$_GET['BusXRouteID']."'");
@$chk = @$arrchk['status'];
@$arrData = array();
if (@$arrchk != null)
{
echo "<script type='text/javascript'>window.alert('มีพัสดุอยู่บนรถไม่สามารถลบได้')";
echo "</script>";
echo "<script type='text/javascript'>";
echo "window.location='index.php?name=manu_masterbus&file=planbus'";
echo "</script>";
exit();
// if (@$chk <= 2)
// {
// $arrData['status'] = 1;
//
// foreach(@$arrData as $k => $v ){
// @$arrData[@$k] = str_replace("'", "\'", @$v);
// }
//
// @$db->updateData("hist",@$arrData," BusXRouteID='".@$_GET['BusXRouteID']."'");
//
// }
//
//
// @$arrchk = @$db->getOne("invoicedetail"," status "," BusXRouteID='".@$_GET['BusXRouteID']."'");
// @$chk = @$arrchk['status'];
// @$arrData = array();
//
// if (@$arrchk != null)
// {
// if (@$chk <= 2)
// {
// $arrData['status'] = 1;
//
// foreach(@$arrData as $k => $v ){
// @$arrData[@$k] = str_replace("'", "\'", @$v);
// }
//
// @$db->updateData("invoicedetail",@$arrData," BusXRouteID='".@$_GET['BusXRouteID']."'");
//
// }
// }
}
@$db->deleteData("busxroute"," BusXRouteID='".@$_GET['BusXRouteID']."'");
@$msg = "Delete Data complete.";
@$res = true;
}elseif(@$_GET['act']=="deleteAll"){
//echo "<pre>"; print_r(@$_POST);
if(count(@$_POST['pagedel']) > 0){
foreach(@$_POST['pagedel'] as $key => $val){
@$db->deleteData("busxroute"," BusXRouteID='".@$val."'");
}
}
@$msg = "Delete Data complete.";
@$res = true;
}
@$where_f = "";
//@$where_point = "lang_code='".@$lang_code."' and DeliveryPointStatus='1'";
@$search = @$_POST['keyword'] ? @$_POST['keyword'] : @$_GET['keyword'];
if(@$search){
@$searchnew = str_replace("'", "\'", @$search);
if(@$where_f){
@$where_f .= " and (SetDate = '".@$objMaster->getdateformat(@$searchnew)."')";
}else{
@$where_f = " (SetDate = '".@$objMaster->getdateformat(@$searchnew)."')";
}
}else{
if(@$where_f){
@$where_f .= " and ( SetDate like '%".@date("Y-m-d")."%')";
}else{
@$where_f = " ( SetDate like '%".@date("Y-m-d")."%')";
}
}
@$page = @$_GET['page'] ? @$_GET['page'] : 1;
@$arrpageP = @$db->getJoin( "*","better_busxroute a inner join better_bus b on a.BusID = b.BusID ",@$where_f,"" );
@$arrPage = @$objMaster->viewPages(@$page, @$arrpageP, "15");
//@$getPage = @$db->getJoin( "*","better_busxroute a inner join better_bus b on a.BusID = b.BusID ",@$where_f,"order by BusName",@$arrPage["offset"]);
@$getPage = @$db->getJoin( "*","better_busxroute a inner join better_bus b on a.BusID = b.BusID ",@$where_f,"order by a.RouteID",@$arrPage["offset"]);
/*echo "<pre>";
print_r(@$getPage);*/
//echo "<pre>";print_r($getPage);
if(@$_SESSION['member']['permistion'] == "4"){
@$getRoute = @$db->getAll( "route", "*"," RouteStatus = '1'","" );
}else{
@$getRoute = @$db->getJoin( "distinct b.*","better_routexpoint a inner join better_route b on a.RouteID = b.RouteID "," b.RouteStatus = '1' and a.DeliveryPointID = ".@$_SESSION['member']['point'],"" );
}
@$getBusType = @$db->getAll( "bustype", "*"," BusTypeStatus = '1' and lang_code='".@$lang_code."'","" );
@$getBus = @$db->getAll( "bus", "*"," BusStatus = '1' and lang_code='".@$lang_code."'"," order by BusName" );
//echo "<pre>"; print_r(@$getPage);
?>
<!-- Start Content Box -->
<div class="content-box">
<!-- Start Content Box Header-->
<div class="content-box-header">
<h3><?php echo @$lang_set['busxroute_title']; ?></h3>
<span style="width:60px; float:left; padding-top:10px;"><a href="<?php echo $linkUrl;?>"><img src="images/icon_back.gif" border="0" /></a></span>
<ul class="content-box-tabs">
<?php if(@$_GET['act']!="edit"){?>
<li><a href="#list" <?php echo (@$_GET['act']=="" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['list_busxroute']; ?></a></li> <!-- href must be unique and match the id of target div -->
<li><a href="#add" <?php echo (@$_GET['act']=="edit" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['add_busxroute']; ?></a></li>
<?php }else{?>
<li><a href="#add" <?php echo (@$_GET['act']=="edit" ? 'class="default-tab"' : '');?>>แก้ไขข้อมูล</a></li>
<?php }?>
</ul>
<div class="clear"></div>
</div>
<!-- End Content Box Header-->
<!-- Start Content Box Content-->
<div class="content-box-content">
<?php if(@$res){?>
<div class="notification success png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo @$msg;?>
</div>
</div>
<meta http-equiv="refresh" content="1;URL=<?php echo $linkUrl;?>">
<?php }?>
<?php if(@$err != ""){?>
<div class="notification error png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo @$err;?>
</div>
</div>
<meta http-equiv="refresh" content="1;URL=<?php echo $linkUrl;?>">
<?php }?>
<!-- Start Tab Content id="list"-->
<div class="tab-content <?php echo (@$_GET['act']=="" ? 'default-tab' : '');?>" id="list">
<form action="<?php echo $linkUrl;?>" method="post" name="form_search" >
แผนการเดินรถวันที่ :
<input type="text" class="text date_picker" name="keyword" value="<?php echo @$search == ''? @$objMaster->getdbdateformat(date("Y-m-d")) : @$search ;?>"/>
<input type="submit" class="button" value="ค้นหา"/>
</form>
<form action="<?php echo $linkUrl;?>&act=deleteAll" method="post" onsubmit="return confirmDelete(this);">
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="20"><input type="checkbox" class="check_all" /></th>
<th style="text-align:left"><?php echo @$lang_set['route_code']; ?></th>
<th style="text-align:left"><?php echo @$lang_set['route_name']; ?></th>
<th style="text-align:left"><?php echo @$lang_set['busxroute_date']; ?></th>
<th style="text-align:left"><?php echo @$lang_set['busxroute_time']; ?></th>
<th style="text-align:left"><?php echo @$lang_set['bus_name']; ?></th>
<th style="text-align:left"><?php echo @$lang_set['bustype_name']; ?></th>
<th style="text-align:center;"><?php echo @$lang_set['action']; ?></th>
</tr>
</thead>
<?php
if(@$getPage){
foreach(@$getPage as $key => $val){
@$getbus = @$db->getOne( "bus", "*"," BusID = '".@$val['BusID']."'","" );
@$getroute = @$db->getOne( "route", "*"," RouteID = '".@$val['RouteID']."'","" );
@$getbustype = @$db->getOne( "bustype", "*"," BusTypeID = '".@$getbus['BusType']."'","" );
@$getroutecheck = @$db->getJoin( " distinct b.*","better_routexpoint a inner join better_route b on a.RouteID = b.RouteID "," b.RouteStatus = '1' and b.RouteID = '".@$val['RouteID']."' ");
/*
echo "<pre>";
priSION);*/
/* @nt_r($_SES$getroutecheck = @$db->getJoin( " distinct b.*","better_routexpoint a inner join better_route b on a.RouteID = b.RouteID "," b.RouteStatus = '1' and b.RouteID = '".@$val['RouteID']."' and a.DeliveryPointID = ".@$_SESSION['member']['point']." ");*/
@$getroutecheck = @$db->getJoin( " distinct b.*","better_routexpoint a inner join better_route b on a.RouteID = b.RouteID "," b.RouteStatus = '1' and b.RouteID = '".@$val['RouteID']."'".($_SESSION['member']['type']!="Administrator" ? "and a.DeliveryPointID = ".@$_SESSION['member']['point'] : ""),"" );
/*echo "<pre>";
print_r(@$getroutecheck);*/
//echo "<pre>"; print_r($val);
if(@$getroutecheck){
?>
<tr>
<th><input type="checkbox" name="pagedel[]" value="<?php echo @$val['BusXRouteID'];?>"/></th>
<th><?php echo @$getroute['RouteCode'];?></th>
<th><?php echo @$getroute['RouteName'];?></th>
<th><?php echo @$objMaster->getdbdateformat(@$val['SetDate']);?></th>
<th><?php echo @$val['SetTime'];?></th>
<th><?php echo @$getbus['BusName'];?></th>
<th><?php echo @$getbustype['BusTypeName'];?></th>
<th style="text-align:center;">
<a href="index.php?name=manu_masterbus&file=planbuspoint&BusXRouteID=<?php echo @$val['BusXRouteID']?>" title="PlanBusPoint"><img src="resources/images/icons/icon_links.png" alt="PlanBusPoint" /></a> |
<a href="<?php echo $linkUrl;?>&act=edit&BusXRouteID=<?php echo @$val['BusXRouteID']?>#add" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a> |
<a href="javascript:void();" title="Delete" onclick="chkConfirm('<?php echo $linkUrl;?>&act=deletedata&BusXRouteID=<?php echo @$val['BusXRouteID']?>','ยืนยันการลบข้อมูล');"><img src="resources/images/icons/cross.png" alt="Delete" /></a>
</th>
</tr>
<?php }
}
}else{
?>
<tr>
<th colspan="11" style="text-align:center"><?php echo @$lang_set['not_data']; ?></th>
</tr>
<?php
}
?>
<tfoot>
<tr>
<td colspan="11">
<div class="bulk-actions align-left">
<select name="actdel">
<option value="del"><?php echo @$lang_set['delete']; ?></option>
</select>
<input class="button" type="submit" value="<?php echo @$lang_set['selected']; ?>" />
</div>
<!-- Start .pagination -->
<?php if($arrPage['allpage']>1){?>
<div class="pagination">
<a href="<?php echo $linkUrl;?>&page=1&keyword=<?PHP echo @$search;?>" title="หน้าแรก">« หน้าแรก</a><a href="<?php echo $linkUrl;?>&page=<?php echo ($page==1 ? $page : @$page-1);?>&keyword=<?PHP echo @$search;?>" title="ก่อนหน้า">« ก่อนหน้า</a>
<?php if( @$arrPage["startPage"]!="" && @$arrPage["endPage"] !="" ){?>
<?php
for($i = @$arrPage["startPage"]; $i <= @$arrPage["endPage"]; ++$i) {
echo'<a href="'.$linkUrl.'&keyword='.@$search.'&page='.@$i.'" '.(@$page == @$i ? 'class="number current"' : '').'>'.(@$i).'</a>';
}?>
<?php }?>
<a href="<?php echo $linkUrl;?>&page=<?php echo ($page==$arrPage["allpage"] ? $page : $page+1);?>&keyword=<?PHP echo @$search;?>" title="ถัดไป">ถัดไป »</a><a href="<?php echo $linkUrl;?>&page=<?php echo @$arrPage["allpage"];?>&keyword=<?PHP echo @$search;?>" title="หน้าสุดท้าย">หน้าสุดท้าย »</a>
</div>
<?php }?>
<!-- End .pagination -->
<div class="clear"></div>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<!-- End Tab Content id="list"-->
<!-- Start Tab Content id="add"-->
<div class="tab-content <?php echo (@$_GET['act']=="edit" ? 'default-tab' : '');?>" id="add">
<form action="<?php echo $linkUrl;?>&act=<?php echo (@$_GET['act']=="edit" ? "editdata" : "add");?>#add" method="post" enctype="multipart/form-data"><!--onsubmit="return checkdelivery();"-->
<fieldset>
<input type="hidden" name="BusXRouteID" value="<?php echo @$_GET['BusXRouteID'];?>">
<p>
<label><?php echo @$lang_set['route_name']; ?>:</label>
<select name="RouteID">
<?php
if(@$getRoute){foreach(@$getRoute as $key => $val){
?>
<option value="<?php echo @$val['RouteID'];?>" <?php echo (@$val['RouteID']=='' || @$val['RouteID']==@$arrRes['RouteID'] ? "selected" : "")?>><?php echo @$val['RouteName'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo @$lang_set['busxroute_date']; ?>:</label>
<input type="text" class="text date_picker" id="SetDate" name="SetDate" value="<?php echo @$arrRes['SetDate'] == '' ? @$objMaster->getdbdateformat(date("Y-m-d")) :@$objMaster->getdbdateformat(@$arrRes['SetDate']);?>" onmouseover="AJAX_CheckDate();"/>
<div style="color:#900; font-size:12px;" id="errorSetDate"> !! ไม่สามารถกรอก แผนการเดินรถย้อนหลังได้ค่ะ ระบบจะปรับเป็นวันที่ปัจจุบัน ตอนเก็บบันทึก </div>
</p>
<p>
<label><?php echo @$lang_set['busxroute_time']; ?>:</label>
<input type="text" class="text-input small-input" name="SetTime" id="SetTime" value="<?php echo @$arrRes['SetTime'] == ''? "00:00:00":@$arrRes['SetTime'];?>" onclick="javascript:getIt(this,'SetTime')" onfocus="cleartextbox('SetTime');" onblur="validatetime('SetTime')" maxlength="8"/>
<!--<span class="input-notification error png_bg" id="span_value"></span>--></p>
<p>
<label><?php echo @$lang_set['bustype_name']; ?>:</label>
<select name="BusTypeID" id="BusTypeID" onchange="SelectBusType('<?PHP echo @$lang_code;?>')" onblur="SelectBusType('<?PHP echo @$lang_code;?>')" >
<option value="">--ประเภทรถ--</option>
<?php
if(@$getBusType){foreach(@$getBusType as $key => $val){
?>
<option value="<?php echo @$val['BusTypeID'];?>" <?php echo (@$val['BusTypeID']=='' || @$val['BusTypeID']==@$getBusTypeEdit['BusTypeID'] ? "selected" : "")?>><?php echo @$val['BusTypeName'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo @$lang_set['bus_name']; ?>:</label>
<select name="BusID" id="BusID">
<option value="">--หมายเลขรถ--</option>
<?php
if(@$getBus){foreach(@$getBus as $key => $val){
?>
<option value="<?php echo @$val['BusID'];?>" <?php echo (@$val['BusID']=='' || @$val['BusID']==@$arrRes['BusID'] ? "selected" : "")?>><?php echo @$val['BusName'];?> / <?php echo @$val['BusBrand'];?> / <?php echo @$val['BusPlate'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<input type="submit" class="button" value="<?php echo @$lang_set['submit']; ?>" />
</p>
</fieldset>
</form>
</div>
<!-- End Tab Content id="add"-->
</div>
<?PHP if(@$_GET['act']=="editdata"){?>
<script type="text/javascript">
SelectBusType('<?PHP echo @$lang_code;?>');
</script>
<?PHP }?>