<?php

include "header.php";
require_once "../common/class/transaction_admin.class.php";
$transaction = new transaction_admin();
if ($_GET['action'] == "delete" && $_GET['id'] == "") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $transaction->delete_transaction($w, $table);
    }
    echo "<script>alert('transaction Deleted ...'); window.location='transaction_management.php';</script>";
} else {
    $transaction->delete_transaction($_GET['id'], $table);
    echo "<script>alert('transaction Deleted ...'); window.location='transaction_management.php';</script>";
}
?>

{
	checkBoxArr = getSelectedCheckboxValue(document.listtransaction.checkdel);
	if (checkBoxArr.length == 0) 
 	{ 
	 alert("No Users Selected");  
	 return false;
	 }
	var arv = checkBoxArr.toString();
	document.getElementById('selectcheck').value=arv;
	document.getElementById('type').value="complete";
		return confirm("Are You Sure ?");
}
</script>

<?php 
$transaction = new transaction_admin();
?>

<table align="left" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; font-size:16px;">
	<tr><td colspan="6" align="center" valign="middle">
    <table align="center" >
    <tr>
    <td><img src="images/listmain.png" /></td>
    <td style="color:#003399; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:18px;" align="center" valign="middle">
    &nbsp;&nbsp;List</td>
    </tr>
    </table>
	</td></tr>

<tr><td colspan="6"><table width="100%"><tr><td>
<br />
{
	checkBoxArr = getSelectedCheckboxValue(document.listtransaction.checkdel);
	if (checkBoxArr.length == 0) 
 	{ 
	 alert("No Row Selected");  
	 return false;
	 }
	var arv = checkBoxArr.toString();
	document.getElementById('selectcheck').value=arv;
	document.getElementById('type').value="cancel";
		return confirm("Are You Sure ?");
}
</script>

<?php 
$transaction = new transaction_admin();
?>

<table align="left" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; font-size:16px;">
	<tr><td colspan="6" align="center" valign="middle">
    <table align="center" >
    <tr>
    <td><img src="images/listmain.png" /></td>
    <td style="color:#003399; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:18px;" align="center" valign="middle">
    &nbsp;&nbsp;List of withdraw</td>
    </tr>
    </table>
	</td></tr>

<tr><td colspan="6"><table width="100%"><tr><td>
<br />
<?php

include "header.php";
require_once "../common/class/transaction_admin.class.php";
$delete_page = new transaction_admin();
if ($_POST['type'] == "pending") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_page->pending_withdraw($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Transaction Withdraw Pending ...'); window.location='trans_withdraw_management.php';</script>";
} elseif ($_POST['type'] == "process") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_page->process_withdraw($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Transaction Withdraw Processed !..'); window.location='trans_withdraw_management.php';</script>";
} elseif ($_POST['type'] == "cancel") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_page->cancel_withdraw($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Transaction Withdraw Canceled !..'); window.location='trans_withdraw_management.php';</script>";
}
?>

	if (checkBoxArr.length == 0) 
 	{ 
	 alert("No Transaction row Selected");  
	 return false;
	 }
	var arv = checkBoxArr.toString();
	document.getElementById('selectcheck').value=arv;
		return confirm("Are You Sure ?");
}


</script>


<?php 
$transaction = new transaction_admin();
if ($_GET['wtdo'] == 'add_transaction') {
    $add = $transaction->add_transaction($_POST);
}
if ($_GET['wtdo'] == 'edit_transaction') {
    $add = $transaction->edit_transaction($_POST, $_GET['id']);
}
?>
<table align="left" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; font-size:16px;">
	<tr><td colspan="6" align="center" valign="middle">
    <table align="center" >
    <tr>
    <td><img src="images/listmain.png" /></td>
    <td style="color:#003399; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:18px;" align="center" valign="middle">
    &nbsp;&nbsp;List</td>
    </tr>
<?php

include "header.php";
require_once "../common/class/transaction_admin.class.php";
$delete_page = new transaction_admin();
if ($_POST['type'] == "cancel") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_page->cancel_escrow($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Transaction Escrow Cancel ...'); window.location='trans_escrow_management.php';</script>";
} elseif ($_POST['type'] == "complete") {
    $midarray = explode(",", $_POST['selectcheck']);
    foreach ($midarray as $w) {
        $delete_page->complete_escrow($w);
    }
    //disconnect_db($cn);
    echo "<script>alert('Transaction Escrow Completed !..'); window.location='trans_escrow_management.php';</script>";
}
?>

<?php

include "header.php";
require_once "../common/class/user.class.php";
require_once "../common/class/transaction_admin.class.php";
$transaction = new transaction_admin();
$transaction_details = $transaction->getbyid($_GET['id']);
?>
<script>
function check_amount()
{
var transaction_type=document.getElementById('transaction_type').value;
if(transaction_type=="credit")
{
document.getElementById('plus_amount').style.display="inline";
document.getElementById('minus_amount').style.display="none"
}
else
{
if(transaction_type=="debit")
{
document.getElementById('minus_amount').style.display="inline";
document.getElementById('plus_amount').style.display="none";
}
}
}
</script>
<table  width="100%">
<tr align="center">
<td align="center" bgcolor="#66CCFF">Edit Transaction</td>
</tr>