| 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_setupinvoice/ |
Upload File : |
<?php
function UpdateTrack($id){
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/class/SC_Query.php');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/class/SC_Mysql.php');
$db = new SC_Query();
$db->deleteData("track"," InvoiceID='".$id."'");
$arrDataInsert = array();
$getinsert = $db->getAll("invoiceroute", "*"," InvoiceID='".$id."'","" );
if($getinsert){
foreach($getinsert as $key => $val){
$getbusxroute= $db->getOne("busxroute", "*"," BusXRouteID ='".$val['BusXRouteID']."'","" );
$getcheckstart = $db->getOne("routexpoint", "*"," RouteCode = '".$getbusxroute["RouteCode"]."' and DeliveryPointID = '".$val["StartPoint"]."'","" );
$getcheckend = $db->getOne("routexpoint", "*"," RouteCode = '".$getbusxroute["RouteCode"]."' and DeliveryPointID = '".$val["EndPoint"]."'","" );
$getroutecode = $db->getAll("routexpoint", "*"," RouteCode = '".$getbusxroute["RouteCode"]."'","" );
foreach($getroutecode as $key2 => $val2){
$getpoint= $db->getOne("deliverypoint", "*"," DeliveryPointID ='".$val2['DeliveryPointID']."'","" );
if($val2["PointSequence"] >= $getcheckstart["PointSequence"] && $val2["PointSequence"] <= $getcheckend["PointSequence"]){
$arrDataInsert["InvoiceID"] = $val["InvoiceID"];
$arrDataInsert["Sequence"] = $val2["PointSequence"];
$arrDataInsert["TrackPoint"] = $val2["DeliveryPointID"];
$arrDataInsert["TrackRouteNum"] = $val["RouteNum"];
$arrDataInsert["TrackStatus"] = "Process";
$db->insertData("track",$arrDataInsert);
}
}
}
}
}
if(@$_GET['act']=="add"){
$arrData = array();
$getbxr = $db->getOne("busxroute", "*"," RouteCode = '".$_POST['RouteCode']."' and SetDate = '".$objMaster->getdateformat($_POST['SetDate'])."' and SetTime = '".$_POST['SetTime']."'","" );
$bxrid = $getbxr['BusXRouteID'];
$arrData['InvoiceID'] = $_GET['InvoiceID'];
$arrData['BusXRouteID'] = $bxrid;
$arrData['StartPoint'] = $_POST['StartPoint'];
$arrData['EndPoint'] = $_POST['EndPoint'];
$arrData['RouteNum'] = $_POST['RouteNum'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
//echo "<pre>"; print_r($arrData);
//exit;
$db->insertData("invoiceroute",$arrData);
UpdateTrack($_GET['InvoiceID']);
//exit;
$msg = "Save Data complete.";
$res = true;
}elseif(@$_GET['act']=="editdata"){
$arrData = array();
$getbxr = $db->getOne("busxroute", "*"," RouteCode = '".$_POST['RouteCode']."' and SetDate = '".$objMaster->getdateformat($_POST['SetDate'])."' and SetTime = '".$_POST['SetTime']."'","" );
$bxrid = $getbxr['BusXRouteID'];
$arrData['InvoiceID'] = $_GET['InvoiceID'];
$arrData['BusXRouteID'] = $bxrid;
$arrData['StartPoint'] = $_POST['StartPoint'];
$arrData['EndPoint'] = $_POST['EndPoint'];
$arrData['RouteNum'] = $_POST['RouteNum'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
$db->updateData("invoiceroute",$arrData," InvoiceRouteID='".$_POST['InvoiceRouteID']."'");
UpdateTrack($_GET['InvoiceID']);
$msg = "Edit Data complete.";
$res = true;
}elseif(@$_GET['act']=="edit"){
$arrRes = $db->getOne("invoiceroute","*"," InvoiceRouteID='".$_GET['InvoiceRouteID']."'");
$bxrRes = $db->getOne("busxroute","*"," BusXRouteID='".$arrRes['BusXRouteID']."'");
$getTime = $db->getAll( "busxroute", "*"," SetDate = '".$bxrRes["SetDate"]."' and RouteCode = '".$bxrRes["RouteCode"]."'","" );
$getPoint = $db->getAll( "routexpoint", "*"," RouteCode = '".$bxrRes["RouteCode"]."' and lang_code='".$lang_code."'","" );
}elseif(@$_GET['act']=="deletedata"){
$db->deleteData("invoiceroute"," InvoiceRouteID='".$_GET['InvoiceRouteID']."'");
UpdateTrack($_GET['InvoiceID']);
$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("invoiceroute"," InvoiceRouteID='".$val."'");
}
}
UpdateTrack($_GET['InvoiceID']);
$msg = "Delete Data complete.";
$res = true;
}
$where_f = " InvoiceID='".$_GET['InvoiceID']."'";
$page = @$_GET['page'] ? @$_GET['page'] : 1;
$arrpageP = $db->getAll( "invoiceroute", "*",$where_f,"" );
$arrPage = $objMaster->viewPages($page, $arrpageP, "15");
$getPage = $db->getAll("invoiceroute","*",$where_f,"",$arrPage["offset"]);
$getRoute = $db->getAll( "route", "*"," RouteStatus = '1'","" );
//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['invoiceroute_title']; ?></h3>
<ul class="content-box-tabs">
<li><a href="#list" <?php echo ($_GET['act']=="" ? 'class="default-tab"' : '');?>><?php echo $lang_set['list_invoiceroute']; ?></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_invoiceroute']; ?></a></li>
</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=index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>">
<?php }?>
<!-- Start Tab Content id="list"-->
<div class="tab-content <?php echo ($_GET['act']=="" ? 'default-tab' : '');?>" id="list">
<form action="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=deleteAll" method="post">
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="20"><input type="checkbox" class="check_all" /></th>
<th width="100" align="left"><?php echo $lang_set['route_code']; ?></th>
<th width="100" align="left"><?php echo $lang_set['busxroute_date']; ?></th>
<th width="50" align="left"><?php echo $lang_set['busxroute_time']; ?></th>
<th width="100" align="left"><?php echo $lang_set['bus_name']; ?></th>
<th width="100" align="left"><?php echo $lang_set['driver_name']; ?></th>
<th width="75" align="left"><?php echo $lang_set['invoiceroute_start']; ?></th>
<th width="75" align="left"><?php echo $lang_set['invoiceroute_end']; ?></th>
<th width="50" align="left"><?php echo $lang_set['invoiceroute_routenum']; ?></th>
<th width="77"><?php echo $lang_set['action']; ?></th>
</tr>
</thead>
<?php
if($getPage){
foreach($getPage as $key => $val){
$getbxrdata = $db->getOne( "busxroute", "*"," BusXRouteID = '".$val['BusXRouteID']."'","" );
$getbus = $db->getOne( "bus", "*"," BusID = '".$getbxrdata['BusID']."' and lang_code='".$lang_code."'","" );
$getdriver = $db->getOne( "driver", "*"," DriverID = '".$getbxrdata['DriverID']."' and lang_code='".$lang_code."'","" );
$startpoint = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$val['StartPoint']."' and lang_code='".$lang_code."'","" );
$endpoint = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$val['EndPoint']."' and lang_code='".$lang_code."'","" );
?>
<tr>
<th><input type="checkbox" name="pagedel[]" value="<?php echo $val['InvoiceRouteID'];?>"/></th>
<th><?php echo $getbxrdata['RouteCode'];?></th>
<th><?php echo $objMaster->getdbdateformat($getbxrdata['SetDate']);?></th>
<th><?php echo $getbxrdata['SetTime'];?></th>
<th><?php echo $getbus['BusName'];?></th>
<th><?php echo $getdriver['DriverName'];?></th>
<th><?php echo $startpoint['DeliveryPointName'];?></th>
<th><?php echo $endpoint['DeliveryPointName'];?></th>
<th><?php echo $val['RouteNum'];?></th>
<th>
<a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=edit&InvoiceRouteID=<?php echo $val['InvoiceRouteID']?>#add" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a> |
<a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=deletedata&InvoiceRouteID=<?php echo $val['InvoiceRouteID']?>" title="Delete"><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 -->
<div class="pagination">
<a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo $arrPage["startPage"];?>" title="First Page">« First</a><a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo ($page-1);?>" title="Previous Page">« Previous</a>
<?php if( $arrPage["startPage"]!="" && $arrPage["endPage"] !="" ){?>
<?php
for($i = $arrPage["startPage"]; $i <= $arrPage["endPage"]; ++$i) {
echo'<a href="index.php?name=manu_setupinvoice&file=route&InvoiceID='.$_GET["InvoiceID"].'&page='.$i.'" '.($page == $i ? 'class="number current"' : '').'>'.($i).'</a>';
}?>
<?php }?>
<a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo ($page+1);?>" title="Next Page">Next »</a><a href="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo $arrPage["endPage"];?>" title="Last Page">Last »</a>
</div>
<!-- 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="index.php?name=manu_setupinvoice&file=route&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=<?php echo ($_GET['act']=="edit" ? "editdata" : "add");?>#add" method="post" enctype="multipart/form-data" ><!--onsubmit="return checkdelivery();"-->
<fieldset>
<input type="hidden" name="InvoiceRouteID" value="<?php echo $_GET['InvoiceRouteID'];?>">
<p>
<label><?php echo $lang_set['busxroute_date']; ?>:</label>
<input type="text" class="text date_picker" name="SetDate" id="SetDate" value="<?php echo $bxrRes['SetDate'] == ''? '':$bxrRes['SetDate'];?>" onchange="SelectGetTime('date');"/>
</p>
<p>
<label><?php echo $lang_set['route_code']; ?>:</label>
<select name="RouteCode" id="RouteCode" onchange="SelectGetTime('route');">
<option value="">Select Route</option>
<?php
if($getRoute){foreach($getRoute as $key => $val){
?>
<option value="<?php echo $val['RouteCode'];?>" <?php echo ($val['RouteCode']=='' || $val['RouteCode']==@$bxrRes['RouteCode'] ? "selected" : "")?>><?php echo $val['RouteCode'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo $lang_set['busxroute_time']; ?>:</label>
<select name="SetTime" id="SetTime" onchange="SelectGetTime('Time');">
<option value="">Select Date</option>
<?php
if($getTime){foreach($getTime as $key => $val){
?>
<option value="<?php echo $val['SetTime'];?>" <?php echo ($val['SetTime']=='' || $val['SetTime']==@$bxrRes['SetTime'] ? "selected" : "")?>><?php echo $val['SetTime'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo $lang_set['invoiceroute_start']; ?>:</label>
<select name="StartPoint" id="StartPoint">
<option value="">Select RouteCode</option>
<?php
if($getPoint){foreach($getPoint as $key => $val1){
$startpoint = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$val1['DeliveryPointID']."'","" );
?>
<option value="<?php echo $val1['DeliveryPointID'];?>" <?php echo ($val1['DeliveryPointID']=='' || $val1['DeliveryPointID']==$arrRes['StartPoint'] ? "selected" : "")?>><?php echo $startpoint['DeliveryPointName'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo $lang_set['invoiceroute_end']; ?>:</label>
<select name="EndPoint" id="EndPoint">
<option value="">Select RouteCode</option>
<?php
if($getPoint){foreach($getPoint as $key => $val2){
$end = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$val2['DeliveryPointID']."'","" );
?>
<option value="<?php echo $val2['DeliveryPointID'];?>" <?php echo ($val2['DeliveryPointID']=='' || $val2['DeliveryPointID']==$arrRes['EndPoint'] ? "selected" : "")?>><?php echo $end['DeliveryPointName'];?></option>
<?php }
}
?>
</select>
</p>
<p>
<label><?php echo $lang_set['bus_name']; ?>:</label>
<input type="text" class="text-input smail-input" name="BusName" id="BusName" value="<?php echo $getbus['BusName'];?>" disabled="disabled"/>
</p>
<p>
<label><?php echo $lang_set['driver_name']; ?>:</label>
<input type="text" class="text-input smail-input" name="DriverName" id="DriverName" value="<?php echo $getdriver['DriverName'];?>" disabled="disabled"/>
</p>
<p>
<label><?php echo $lang_set['invoiceroute_routenum']; ?>:</label>
<input type="text" class="text-input smail-input" name="RouteNum" id="RouteNum" value="<?php echo $arrRes['RouteNum'];?>" />
</p>
<p>
<input type="submit" class="button" value="<?php echo $lang_set['submit']; ?>" />
</p>
</fieldset>
</form>
</div>
<!-- End Tab Content id="add"-->
</div>