File: /home/durgeshpandey215/www/zeeroprice.skilladders.com/product-sold.php
<? require_once "application_top.php";
require_once "protect.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Sold Products</title>
<? require_once "scripts.php";?>
</head>
<body>
<? $pagename = 'product-sold'; require "header.php";?>
<div class="w3-bar w3-medium">
<a href="#" class="w3-bar-item w3-button w3-border w3-right noteicon"><i class="fa fa-lightbulb-o"></i> Help</a>
</div>
<div class="tip w3-border w3-card" style="display:none;">
<span onclick="this.parentElement.style.display='none'" class="w3-button w3-large w3-display-topright">×</span>
To complete transaction please enter Delivery Code.<br/>
On completion of delivery and return days your uncleared funds will be cleared.
</div>
<div class="w3-col m12 w3-container"><!--w3-twothird starts here -->
<?
$db->where('sellerid',$useridsess);
$db->where('isCancelled',0);
$rowsod = $db->get('orders_detail');
$clearedfund = 0;
$unclearedfund = 0;
if($rowsod){
foreach($rowsod as $rowod){
//for not yet delivered Products
if(!$rowod['isDelivered']){
$unclearedfund = $rowod['mrp'] + $unclearedfund;
}else{
$clearedfund = $rowod['mrp'] + $clearedfund;
}
}
}
?>
<div class="w3-col s6 w3-container">
<div class="w3-panel w3-pale-blue w3-leftbar w3-border-blue">
<h5>Cleared Funds</h5>
<font style="font-size:35px;"><?=currSign('INR');?> <?=$clearedfund;?></font>
</div>
</div>
<div class="w3-col s6 w3-container">
<div class="w3-panel w3-pale-red w3-leftbar w3-border-red">
<h5>Uncleared Funds</h5>
<font style="font-size:35px;"><?=currSign('INR');?> <?=$unclearedfund;?></font>
</div>
</div>
<br/>
<h1 class="heading">Sold Products</h1>
<?
$db->where('sellerid',$useridsess);
$db->orderBy('postedon','desc');
//---------------Paginate BOF---------------------------------------
$paginatetable = 'orders_detail'; //table name
$extra ="key="; //use '&' in between if more than 1 parameter
$adjacents = 2;
$limit = 20; //how many items to show per page
$db->pageLimit = $limit;
$targetpage = $_SERVER['PHP_SELF']; //your file name (the name of this file)
require "paginate.php";
//------------------------------------------------------------------
if(count($rows)){
?>
<table class="listingtable">
<th>Image</th>
<th>Order Id</th>
<th>Customer Cost</th>
<th>MRP</th>
<th>Confirm Delivery</th>
<th>Cancel Order</th>
<?
foreach($rows as $row){
$db->where('pid',$row['pid']);
$rowpr = $db->getOne('products');
?>
<tr>
<td align="center"><img src="<?=HTTP_SERVER;?>images/products/<?=($rowpr['pic1'])? $rowpr['pic1']:"default.jpg";?>" style="width:70px;height:70px;"/>
<br/><?=currSign($rowpr['currency']);?><?=$rowpr['mrp'];?>
</td>
<td align="center"><?=$row['orderid'];?></td>
<td align="center"><?=currSign($rowpr['currency']);?> <?=$row['customercost'];?></td>
<td align="center">
<?=currSign($rowpr['currency']) ." ".$row['mrp'];?>
</td>
<td align="center">
<? if($row['isCancelled']){ ?>
<? }elseif($row['isDelivered']){ ?>
Delivered
<? }else{ ?>
<form class="frm" id="frm">
<input type="text" id="otp" style="width:150px;" placeholder="Enter OTP" required /><br/>
<input type="hidden" id="id" value="<?=$row['orderid'];?>"/>
<div class="ResultDiv"></div>
<input type="submit" class="vrfotp w3-btn w3-black" value="Confirm Delivery">
</form>
<? } ?>
</td>
<td>
<? if($row['isCancelled']){ ?>
Cancelled
<? }else{?>
<a href="disapproved.php?id=<?=encode($row['orderid']);?>" class="w3-btn w3-black" onclick="return confirm('Are you sure you want to cancel this order?')">Cancel</a>
<? } ?>
</td>
</tr>
<?
}
?>
</table>
<?
}else{
?><h4>There are no sold products.</h4>
<a href="<?=HTTP_SERVER;?>product-live.php" class="w3-button w3-border">My Products</a>
<?
}
?>
<?=$pagination;?>
<br/><br/>
<script>
$(document).ready(function(){
var HTTP_SERVER_JQUERY = $('#HTTP_SERVER').val(); //this #id is in footer
$('.frm').on('submit', function(event) {
event.preventDefault();
var otp = $(this).find('#otp').val();
var orderid = $(this).find('#id').val();
$(this).find('.vrfotp').prop('value','Processing...');
$(this).find('.vrfotp').prop('disabled',true);
callurl = $('#HTTP_SERVER').val()+"ajax_confirmotp.php?otp="+otp+"&id="+orderid;
//window.location = callurl;return;
$.ajax({dataType : 'json',url:callurl,
context: this,
success: function(data){
if(data.error){
$(this).find('.ResultDiv').html(data.error);
}else{
$(this).find('.ResultDiv').html(data.successmsg);
}
$(this).find('.vrfotp').prop('value','Confirm Delivery');
$(this).find('.vrfotp').prop('disabled',false);
}
});
});
});
</script>
</div><!--w3-twothird ends here -->
<? include "footer.php";?>
</body>
</html>