<?php include '../plugin/sms_send.php';
//ecomme Actions

if(isset($_GET['apprPay'])){
	QueryDB("UPDATE payment SET pay_status=1,time_paid='".time()."',date_paid='".date('Y-m-d')."',amt_paid=amt_before,month='".date('m')."',year=='".date('Y')."' where id='".$_GET['apprPay']."' ");
	$_SESSION['receipt_id'] =$_GET['rep_id'];
	print "<script>swal({text:'Payment was Successful',type:'success',title:'Success'},function(){ window.location = 'receeipts.php?no=".$_SESSION['receipt_id']."';});</script>";
}

//Waybill Status
if(isset($_POST['change_status_waybill'])){
	QueryDB("UPDATE biller SET track_status='".$_POST['pay_status']."',track_status_date='".date('Y-m-d H:i:s A')."' where receipt_id='".$_POST['where']."' ");
	print "<script>swal({text:'Way Bill Status Changed',type:'success',title:'Success'},function(){ window.location = 'waybill.php';});</script>";
}


//Change Cost
if(isset($_POST['chnage_way_cost'])){
	QueryDB("UPDATE lga SET way_bill_cost='".$_POST['cost']."',status='".$_POST['status']."' where id='".$_POST['where']."' ");
	print "<script>swal({text:'Update Successful',type:'success',title:'Success'},function(){ window.location = 'waybill_cost';});</script>";
}


//Slider Image Upload
if(isset($_POST['send_shop_img'])){
if (isset($_FILES['selImg'])){
$filename = $_FILES['selImg']['name'];
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$valid_ext = array("png","jpeg","jpg");
        if(in_array($ext, $valid_ext)){ 
       $filename = rand().str_replace(' ','_',$filename);

        $path = '../../img/slides/'.$filename; 
        $pathSave = 'img/slides/'.$filename;

if(move_uploaded_file($_FILES['selImg']['tmp_name'],$path)){
smart_resize_image(null , file_get_contents($path), '1366' , '800' , false , $path , false , false ,100 );
    		}
 $caption = collect('selcaption'); $title =collect('selTitle');
 QueryDB("INSERT INTO shop_slider VALUES('','$pathSave','$title','$caption','".time()."',1) ");	 			
}

print "<script>swal({text:'Shop Slider Loaded',type:'success',title:'Approved'},function(){ window.location = 'page_slider';});</script>"; 
}


}

//Remove Shop Slider
if(isset($_GET['linkImg'])){
QueryDB("DELETE FROM shop_slider where id='".$_GET['linkImg']."' ");
$file = '../../'.$_GET['img'];
if(file_exists($file)){unlink($file);}
print "<script>swal({text:'Slider Successfully Trashed',type:'success',title:'Approved'},function(){ window.location = 'page_slider';});</script>"; 
}
// 08064550475

//App Source
if(isset($_POST['shop_app_source'])){ $pathSave='';

if (isset($_FILES['selImg']) and !empty($_FILES['selImg'])){
$filename = $_FILES['selImg']['name'];
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$valid_ext = array("png","jpeg","jpg");
        if(in_array($ext, $valid_ext)){ 
       $filename = rand().str_replace(' ','_',$filename);
        $path = '../../'.$filename;$pathSave =$filename;
if(move_uploaded_file($_FILES['selImg']['tmp_name'],$path)){
@smart_resize_image(null , file_get_contents($path), '100' , '66' , false , $path , false , false ,100 );
}	}
}else {  $pathSave = $_POST['existImage'];  }

QueryDB("UPDATE appsource SET comp_logo='".$pathSave."',comp_name='".collect('comp_name')."',comp_addr='".collect('comp_address')."',comp_email='".collect('comp_email')."',comp_phone='".collect('comp_phone')."',comp_motto='".collect('comp_motto')."',web_title='".collect('comp_web_title')."',about_='".collect('comp_about')."'  ");

print "<script>swal({text:'Web Information Updated',type:'success',title:'Approved'},function(){ window.location = 'page_slider';});</script>"; 

}














?>