<?php /* Smarty version 3.1.27, created on 2024-03-22 19:13:27
         compiled from "/home/ganstrades/public_html/tmpl/withdraw_principal.tpl" */ ?>
<?php
/*%%SmartyHeaderCode:132705228265fdd857252192_17202569%%*/
if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'bb41057d85a9867b4b7797ecceb0b1ad8fa62383' => 
    array (
      0 => '/home/ganstrades/public_html/tmpl/withdraw_principal.tpl',
      1 => 1672898400,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '132705228265fdd857252192_17202569',
  'variables' => 
  array (
    'fatal' => 0,
    'say' => 0,
    'preview' => 0,
    'deposit' => 0,
    'amount' => 0,
    'type' => 0,
    'fee' => 0,
    'to_balance' => 0,
  ),
  'has_nocache_code' => false,
  'version' => '3.1.27',
  'unifunc' => 'content_65fdd8572f7304_70885818',
),false);
/*/%%SmartyHeaderCode%%*/
if ($_valid && !is_callable('content_65fdd8572f7304_70885818')) {
function content_65fdd8572f7304_70885818 ($_smarty_tpl) {
if (!is_callable('smarty_modifier_myescape')) require_once '/home/ganstrades/public_html/inc/libs/smarty3/plugins/modifier.myescape.php';

$_smarty_tpl->properties['nocache_hash'] = '132705228265fdd857252192_17202569';
echo $_smarty_tpl->getSubTemplate ("header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0);
?>


<h3>Withdraw Principal:</h3><br><br>
<?php if ($_smarty_tpl->tpl_vars['fatal']->value) {?>
 <?php if ($_smarty_tpl->tpl_vars['fatal']->value == 'deposit_not_found') {?>Wrong deposit ID has been provided<?php }?> 
 <?php if ($_smarty_tpl->tpl_vars['fatal']->value == 'withdraw_forbidden') {?>Can not process principal withdrawal for this plan<?php }?>
 <?php if ($_smarty_tpl->tpl_vars['fatal']->value == 'too_early_withdraw') {?>Can not process principal withdrawal yet<?php }?>
 <?php if ($_smarty_tpl->tpl_vars['fatal']->value == 'too_late_withdraw') {?>Can not process principal withdrawal longer<?php }?>
 <?php if ($_smarty_tpl->tpl_vars['fatal']->value == 'withdraw_complete') {?>Withdrawal has been sucessfully completed.<?php }?>
<?php } else { ?>
 <?php if ($_smarty_tpl->tpl_vars['say']->value == 'too_big_amount') {?>You have no such amount on this deposit.<br><br><?php }?>
 <?php if ($_smarty_tpl->tpl_vars['say']->value == 'too_small_amount') {?>Provided amount is too small.<br><br><?php }?>

<?php if ($_smarty_tpl->tpl_vars['preview']->value == 1) {?>

<form method=post name=withdraw_form>
<input type=hidden name=a value=withdraw_principal>
<input type=hidden name=action value=withdraw>
<input type=hidden name=deposit value=<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['deposit']->value['id']);?>
>
<input type=hidden name=amount value=<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['amount']->value);?>
>

<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <th>Deposit Amount</th>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['deposit']->value['deposit'],$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</td>
</tr>
<tr>
 <th>Deposit Plan</th>
 <td><?php echo smarty_modifier_myescape(htmlspecialchars($_smarty_tpl->tpl_vars['type']->value['name'], ENT_QUOTES, 'UTF-8', true));?>
</td>
</tr>
<tr>
 <th>Release Amount</th>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['amount']->value,$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</td>
</tr>
<tr>
 <th>Fee</th>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['fee']->value,$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
 (<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['type']->value['withdraw_principal_percent']);?>
%)</td>
</tr>
<tr>
 <th>Receive Amount</th>
 <td><b><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['to_balance']->value,$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</b></td>
</tr>
<tr>
 <td><br><input type=submit value="Confirm" class=sbmt></td>
</tr></table>
</form>

<?php } else { ?>

<?php echo '<script'; ?>
>
var max_amount = new Number('<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['deposit']->value['deposit']);?>
');
var percent = new Number('<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['type']->value['withdraw_principal_percent']);?>
');
var currency_pow = 8;


function withdraw() {
  if (!document.withdraw_form.amount) return;
  var out_val = new Number(document.withdraw_form.amount.value.replace(",","."));
  if (isNaN(out_val))
  { out_val = 0; }
  out_val = out_val;

  if (out_val > max_amount) {
    out_val = max_amount;
    document.withdraw_form.amount.value = out_val.toFixed(currency_pow);
  }

  if (out_val < 0) {
    document.withdraw_form.amount.value = '';
    document.withdraw_form.quote.value = 0;
  } else {
    var fee = out_val * (percent/ 100);
    if (fee <= 0) fee = 0;
    out_val = out_val - fee;
    if (out_val < 0) out_val = 0;
    document.withdraw_form.quote.value = out_val.toFixed(currency_pow);
  }
}

<?php echo '</script'; ?>
>

<form method=post name=withdraw_form>
<input type=hidden name=a value=withdraw_principal>
<input type=hidden name=action value=withdraw_preview>
<input type=hidden name=deposit value=<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['deposit']->value['id']);?>
>

<table cellspacing=0 cellpadding=2 border=0>
<tr>
 <th>Deposit Amount</th>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['deposit']->value['deposit'],$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</td>
</tr>
<tr>
 <th>Deposit Earned</th>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['deposit']->value['earned'],$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</td>
</tr>
<tr>
 <th>Deposit Plan</th>
 <td><?php echo smarty_modifier_myescape(htmlspecialchars($_smarty_tpl->tpl_vars['type']->value['name'], ENT_QUOTES, 'UTF-8', true));?>
</td>
</tr>
<tr>
 <th>Fee</th>
 <td><?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['type']->value['withdraw_principal_percent']);?>
%</td>
</tr>
<?php if ($_smarty_tpl->tpl_vars['type']->value['withdraw_principal_full']) {?>
<tr>
 <th>Release Amount:</td>
 <td><?php echo smarty_modifier_myescape(amount_smarty_fiat($_smarty_tpl->tpl_vars['deposit']->value['deposit'],$_smarty_tpl->tpl_vars['deposit']->value['ec']));?>
</td>
</tr>
<?php } else { ?>
<tr>
 <th>Release Amount:</td>
 <td><?php echo amount_smarty_fiat_func(array('ec'=>$_smarty_tpl->tpl_vars['deposit']->value['ec']),$_smarty_tpl);?>
 <input type=text name=amount value="<?php echo smarty_modifier_myescape($_smarty_tpl->tpl_vars['deposit']->value['deposit']);?>
" class=inpts size=15 onchange="withdraw()" onkeyup="withdraw()"
      onfocusout="withdraw()" onactivate="withdraw()" ondeactivate="withdraw()"></td>
</tr>
<tr>
 <th>Receive Amount:</th>
 <td><?php echo amount_smarty_fiat_func(array('ec'=>$_smarty_tpl->tpl_vars['deposit']->value['ec']),$_smarty_tpl);?>
 <input type=text name=quote readonly class=inpts size=15></td>
</tr>
<?php }?>
<tr>
 <td>&nbsp;</td>
 <td><input type=submit value="Release Deposit" class=sbmt></td>
</tr></table>
</form>

<?php echo '<script'; ?>
>
withdraw();
<?php echo '</script'; ?>
>
<?php }?>
<?php }?>

<?php echo $_smarty_tpl->getSubTemplate ("footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0);

}
}
?>