<?php

/*
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
*/


date_default_timezone_set('Asia/Kolkata');


set_time_limit (300);

ob_start();
ini_set('memory_limit','2048444M');

require_once('database.php');

class Package{

	public $pdo;
	public $tableName;	
	public $payoutWeek;	
	
	function __construct() {

		$db = new Database();
		$this->pdo = $db->getConnection();
		$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		
	}

	public function add_payout() {

		$withdrawList = array();

		print "<table border='1' width='50%' align='center'>";
 		print "<tr><td align=center colspan=14><b>Package Approval List</b></td></tr>";			
		print "<tr>
				<td><b>Sr No</b></td>
				<td><b>Name</b></td>
				<td><b>Member ID</b></td>
				<td><b>Date</b></td>
				<td><b>Customer ID</b></td>
				<td><b>Product Price</b></td>
				<td><b>Total PV</b></td>
				<td><b>Paid_By_Online</b></td>
				<td><b>Online Transaction</b></td>
				<td><b>Paid_By_Voucher</b></td>
				<td><b>Voucher Code</b></td>
				<td><b>Total Tax</b></td>
				<td><b>Total Paid</b></td>
		</tr>";

		$sqlEarnBalance = "select * from `my_member_package` WHERE upload_volume=0 ORDER BY date_entered";
		$ebal 			= $this->pdo->prepare($sqlEarnBalance);
		$ebal->execute();
		$i=1;
		while($earnBalance		= $ebal->fetch (PDO::FETCH_ASSOC)) {

			$id			= $earnBalance['id'];
			$refer_id 	= $earnBalance['refer_id'];
			$leftLink 	= "<a onclick='window.location.reload(true);' href='http://localhost/marvel/admin-panel/API/API_uploadvolume.php?refer_id=$refer_id&package_id=$id' target='_blank'>Approve</a>";
			//$leftLink 	= "<a onclick='window.location.reload(true);' href='http://localhost/MyBooster/admin-panel/API/API_uploadvolume.php?refer_id=$refer_id&package_id=$id' target='_blank'>Approve</a>";

			print "<tr>
				<td><b>$i</b></td>
				<td><b>".$earnBalance['name']."</b></td>
				<td><b>".$earnBalance['refer_id']."</b></td>
				<td><b>".$earnBalance['date_entered']."</b></td>
				<td><b>".$earnBalance['product_price']."</b></td>
				<td><b>".$earnBalance['total_PV']."</b></td>
				<td><b>".$earnBalance['paid_by_online']."</b></td>
				<td><b>".$earnBalance['online_TransactionID']."</b></td>
				<td><b>".$earnBalance['paid_by_voucher']."</b></td>
				<td><b>".$earnBalance['voucher_code']."</b></td>
				<td><b>".$earnBalance['total_tax']."</b></td>
				<td><b>".$earnBalance['total_paid']."</b></td>
				<td><b>$leftLink</b></td>
			</tr>";
			$i=$i+1;
		}		
	
		print "</table>";

	}
}

$newPackage		= new Package();
$transferToID 	= $newPackage->add_payout();

?>
