HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /www/exchange0old/exchange/admin/cache/%%2E^2EF^2EF56E28%%add_transaction.html.php
<?php /* Smarty version 2.6.19, created on 2024-06-17 08:48:48
         compiled from investors/add_transaction.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'siteUrl', 'investors/add_transaction.html', 6, false),array('modifier', 'boguiUrl', 'investors/add_transaction.html', 7, false),)), $this); ?>
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: Credebt Exchange - Admin Panel ::</title>
<link type="text/css" href="<?php echo ((is_array($_tmp='/css/bootstrap.min.css')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
" rel="stylesheet" />
<link rel="stylesheet" href="<?php echo ((is_array($_tmp='/css/stylesheet.css')) ? $this->_run_mod_handler('boguiUrl', true, $_tmp) : smarty_modifier_boguiUrl($_tmp)); ?>
" type="text/css" />
<link rel="shortcut icon" href="<?php echo ((is_array($_tmp='images/logo_favicon.ico')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
"  />
<script type="text/javascript" src="<?php echo ((is_array($_tmp='/js/jquery-1.4.2.min.js')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
"></script>
<script type="text/javascript" src="<?php echo ((is_array($_tmp='/js/aj_admin_home.js')) ? $this->_run_mod_handler('boguiUrl', true, $_tmp) : smarty_modifier_boguiUrl($_tmp)); ?>
"></script>
<link type="text/css" href="<?php echo ((is_array($_tmp='/css/jquery-ui-1.7.2.custom.css')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
" rel="stylesheet" />
<link type="text/css" href="<?php echo ((is_array($_tmp='/css/select2.min.css')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
" rel="stylesheet" />
<script type="text/javascript" src="<?php echo ((is_array($_tmp='/js/jquery.ui.core.js')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
"></script>
<script type="text/javascript" src="<?php echo ((is_array($_tmp='/js/ui.datepicker.js?ver=2')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
"></script>
<script type="text/javascript" src="<?php echo ((is_array($_tmp='/js/select2.min.js')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
"></script>
</head>
<head>

<body>

      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left" valign="top">
            <table cellpadding="0" cellspacing="0" border="0" width="100%" class="margin_table">
              <tr>
                <td valign="top" align="left" width="2%" class="hdr_tl">&nbsp;</td>
                <td valign="top" align="left" class="hdr_tc" width=""><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>Investor Transactions</td>
                      <td align="right"></td>
                    </tr>
                  </table></td>
                <td valign="middle" align="right" class="hdr_tr" width="2%">&nbsp;</td>
              </tr>
              <tr>
                <td valign="top" align="left" colspan="3" class="hdr_center">
                    <form action="adminindex.php?do=save_investor_transaction" method="post" enctype="multipart/form-data" id="save_transaction">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%" id="transaction">
                     <tr class="row2">
                        <td width="23%" valign="top" align="left">Transaction Type :</td>
                        <td width="" valign="top" align="left">
                            <select class="cmb_bx1" name="investment_type" id="investment_type">
                            <option value="">Select transaction type</option>
                            <?php $_from = $this->_tpl_vars['transactions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                            <option value="<?php echo $this->_tpl_vars['item']['transaction_id']; ?>
" <?php if ($this->_tpl_vars['values']['investment_type'] == $this->_tpl_vars['item']['transaction_id']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['item']['transaction_name']; ?>
 </option>
                            <?php endforeach; endif; unset($_from); ?>
                            </select>
                            <br>
                            <span style="color:#FF0000">
                            <?php echo $this->_tpl_vars['errmsg']['investment_type']; ?>

                            </span>
                        </td>
                      </tr>
                    
                    
                    <tr class="row1">
                        <td width="23%" valign="top" align="left">Investor :</td>
                        <td width="" valign="top" align="left">
                            <select class="cmb_bx1" name="investor_id" id="investor_id">
                                <option value="">Select</option>
                            </select>
                            <br>
                            <span style="color:#FF0000">
                            <?php echo $this->_tpl_vars['errmsg']['investor_id']; ?>

                            </span>
                        </td>
                      </tr>
                      <tr class="row2" id="investment_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Investment :</td>
                        <td width="" valign="top" align="left">
                            <div id="investments_area">
                                <select class="cmb_bx1" name="investment_group" id="investment_group">
                                    <option value="">Please select investment</option>
                                </select>
                            </div>
                            <div id="investment_details" style="display: none;"></div>
                            <span style="color:#FF0000">
                            <?php echo $this->_tpl_vars['errmsg']['investment_group']; ?>

                            </span>
                        </td>
                      </tr>
                     
                      
                      <tr class="row1">
                        <td align="left" valign="top">Date: <span class="txt_11_cute">(DD/MM/YYYY)</span></td>
                        <td align="left" valign="top" style="font-size: 11px; padding-left: 10px;">
                            <div id="body_tag">
                                <div id="search_all_id" class="search_all">
                                    <div class="search_element1">
                                        <div class="city_div">
                                            <table cellspacing="0" cellpadding="0" border="0" width="55%">
                                                <tbody>
                                                    <tr>
                                                        <td align="left" width="13%" valign="top" style="border:none; padding:5px 0px;"> <input type="text" maxlength="2" size="2" class="text_dd_code" id="trans_date" name="trans_date" value="<?php echo $this->_tpl_vars['values']['trans_date']; ?>
" style="vertical-align:top;"></td>
                                                        <td align="left" width="13%" valign="top" style="border:none; padding:5px 0px;"><input type="text" maxlength="2" size="2" class="text_dd_code" id="trans_month" name="trans_month" value="<?php echo $this->_tpl_vars['values']['trans_month']; ?>
" style="vertical-align:top;"></td>
                                                        <td align="left"  valign="top" style="border:none; padding:5px 0px;"><input type="text" maxlength="4" size="4" class="text_c_code" id="trans_year" name="trans_year" value="<?php echo $this->_tpl_vars['values']['trans_year']; ?>
" style="vertical-align:top;"></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        <script>
                                        //For Date Picker
                                        $(function() {
                                          $( "#trans_year" ).datepicker({
                                            maxDate: "+0D",
                                            showOn: "button",
                                            buttonImage: "<?php echo ((is_array($_tmp='/images/calender_month.png')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
",
                                            buttonImageOnly: true,
                                            onSelect: function( selectedDate ) {
                                                var i =0;selDate = selectedDate.split('/');var dates = new Array("trans_month","trans_date","trans_year");
                                                for(i = 0; i <=2; i++){
                                                    $( "#"+dates[i] ).val(selDate[i]);
                                                }
                                                refreshDetails();
                                            }
                                          });
                                       });
                                      </script>
                                      </div>
                                    </div>
                                    <div class="clear_div"></div>
                                    <span style="color:#FF0000">
                                        <?php echo $this->_tpl_vars['errmsg']['trans_date']; ?>

                                    </span>
                                </div>
                            </div>
                        </td>
                      </tr>
                      <tr class="row1" id="currency_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Currency :</td>
                        <td width="" valign="top" align="left">
                            <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "common/currencies.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
                        </td>
                      </tr>
                      <tr class="row2">
                        <td width="23%" valign="top" align="left">Amount :</td>
                        <td width="" valign="top" align="left">
                            <input type="text"  size="25" class="text_b_small" value="<?php echo $this->_tpl_vars['values']['amount']; ?>
" name="amount" id="amount">
                            <br/>
                            <span style="color:#FF0000">
                                <?php echo $this->_tpl_vars['errmsg']['amount']; ?>

                            </span>
                        </td>
                      </tr>
                      <tr  class="row1" id="source_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Investment Type : </td>
                        <td width="" valign="top" align="left">
                            <select name="investment_source">
                                <option value="">Please Select</option>
                                <option value="IB" <?php if ($this->_tpl_vars['values']['investment_source'] == 'IB'): ?>selected="selected"<?php endif; ?> >Investabill</option>
                                <option value="LB" <?php if ($this->_tpl_vars['values']['investment_source'] == 'LB'): ?>selected="selected"<?php endif; ?> >Leasabill</option>
                            </select>
                            <br/>
                            <span style="color:#FF0000">
                                <?php echo $this->_tpl_vars['errmsg']['investment_source']; ?>

                            </span>
                        </td>
                      </tr>
                      <tr  class="row1" id="buy_rate_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Buy rate : <span class="txt_11_cute">(%)</span></td>
                        <td width="" valign="top" align="left">
                            <input type="text"  size="25" class="text_b_small" value="<?php echo $this->_tpl_vars['values']['buy_rate']; ?>
" name="buy_rate" id="buy_rate">
                            <br/>
                            <span style="color:#FF0000">
                                <?php echo $this->_tpl_vars['errmsg']['buy_rate']; ?>

                            </span>
                        </td>
                      </tr>
                      <tr  class="row1" id="commission_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Commission : <span class="txt_11_cute">(%)</span></td>
                        <td width="" valign="top" align="left">
                            <input type="text"  size="25" class="text_b_small" value="<?php echo $this->_tpl_vars['values']['commission']; ?>
" name="commission" id="commission">
                            <br/>
                            <span style="color:#FF0000">
                                <?php echo $this->_tpl_vars['errmsg']['commission']; ?>

                            </span>
                        </td>
                      </tr>
                      <tr  class="row1" id="months_row" style="display: none;">
                        <td width="23%" valign="top" align="left">Months : </td>
                        <td width="" valign="top" align="left">
                            <input type="text"  size="25" class="text_b_small" value="<?php echo $this->_tpl_vars['values']['months']; ?>
" name="months" id="months">
                            <br/>
                            <span style="color:#FF0000">
                                <?php echo $this->_tpl_vars['errmsg']['months']; ?>

                            </span>
                        </td>
                      </tr>
                      
                      <tr class="row1">
                        <td valign="top" align="left">Notes/Comments :</td>
                        <td valign="top" align="left">
                            <textarea style="height: 150px;width:310px;overflow:auto" class="text_b" name="notes" id="notes"><?php echo $this->_tpl_vars['values']['notes']; ?>
</textarea>
                          <br>
                          <span style="color:#FF0000">
                          <?php echo $this->_tpl_vars['errmsg']['notes']; ?>

                          </span></td>
                      </tr>
                      <tr>
                        <td align="left" valign="top" ></td>
                        <td align="left" valign="top" id="waiting_box">&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="left" valign="top" ></td>
                        <td align="left" valign="top">&nbsp;&nbsp;
                            <input type="submit" value="Save"  class="login_bttn">
                        </td>
                      </tr>
                    </table>
                  </form>
                  </td>
              </tr>
              <tr>
                <td valign="top" align="left" width="2%" class="hdr_bl">&nbsp;</td>
                <td valign="top" align="left" width="96%" class="hdr_bc">&nbsp;</td>
                <td valign="top" align="left" width="2%" class="hdr_br">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>

</body>
<style>
.grays_bg td{
  padding:5px 0px 5px 2px !important;
}
.row1 td , .row2 td{
  padding:5px 0px 5px 2px !important;
}
.grays_bg img{
  padding-bottom: 2px;
    vertical-align: bottom;
}
</style>

<script type="text/javascript">
  var investement_details = new Array();
  
  function showDetails(investor_id)
  {
      investor_id = investor_id || $("#investor_id").val();
      
      $("#currency_row,#buy_rate_row,#commission_row,#months_row,#source_row").hide();
      $('#investment_type option').show();
      if($('#investment_group').val())
      {
          $("#investment_details").show().html('<img src="../images/loading1.gif" />Please wait...');
          
          $.ajax({
              url:'adminindex.php?do=get_investment_details&group_id='+$('#investment_group').val()+'&investor_id='+investor_id
          }).done(function(data){
              $("#investment_details").html(data);
              showFields();
          })
      }
  }
  
  function showFields(investment_type)
  {
      investment_type  = investment_type || $('#investment_type').val();
      
      switch(investment_type)
      {
          case '<?php echo @INVESTMENT_RPA; ?>
':{
              $("#buy_rate_row,#commission_row,#months_row,#currency_row,#source_row").show();
              $('#investment_row').hide();
              break;
          }
          case '<?php echo @INVESTMENT_COMPOUND; ?>
':{
              $("#buy_rate_row,#commission_row,#months_row").show();
              $('#amount').attr('readonly', 'readonly').val(Math.round((parseFloat(investement_details.amount) + parseFloat(investement_details.yield)) * 100) / 100);
              break;
          }
          case '<?php echo @INVESTMENT_COUPON; ?>
':{
              $('#amount').attr('readonly','readonly').val((parseFloat(investement_details.yield)).toFixed(2));
              break;
          }
          case '<?php echo @INVESTMENT_REDEEMED; ?>
':{
              $('#amount').attr('readonly','readonly').val((parseFloat(investement_details.amount)+parseFloat(investement_details.yield)).toFixed(2));
              break;
          }
          case '<?php echo @INVESTMENT_ADDITION; ?>
':{
              $('#amount').removeAttr('readonly');
              break;
          }
          case '<?php echo @INVESTMENT_CONTINUE; ?>
':{
              $("#buy_rate_row,#commission_row,#months_row").show();
              $('#amount').attr('readonly','readonly').val((parseFloat(investement_details.amount)).toFixed(2));
              break;
          }
          case '<?php echo @INVESTMENT_REDEMPTION; ?>
':{
              $('#amount').removeAttr('readonly').val(0);
              break;
          }
          case '<?php echo @INVESTMENT_PARTIAL_COUPON; ?>
':{
              $('#amount').attr('readonly','readonly').val((parseFloat(investement_details.yield)).toFixed(2));
              break;
          }
      }
  }
  
  $('document').ready(function(){
      $('body').on('change','#investment_group',function(){
          showDetails();
      })
      
      $("#investor_id").select2({
          placeholder: "Select investor"
      });
      
      /*
      $('body').on('change','#investment_type',function(){
          showFields();
      })
      
      */
      $('#trans_date,#trans_month,#trans_year').change(function(){
          if ($('#trans_date').val() && $('#trans_month').val() && $('#trans_year').val())
          {
              refreshDetails();
          }
      })
      
      
 /*     <?php if ($this->_tpl_vars['values']['investment_group']): ?>
      loadInvestments($('#investor_id').val(),'<?php echo $this->_tpl_vars['values']['investment_group']; ?>
');
      <?php endif; ?>*/
      
      $('#investment_type').change(function(){
          $("#buy_rate_row,#commission_row,#months_row,#currency_row,#investment_row").hide();
          $("#buy_rate_row input,#commission_row input,#months_row input,#amount,#notes,#trans_date,#trans_month,#trans_year").val('');
          $('#amount').removeAttr('readonly');
          loadInvestors();
      })
      
      
      $("#investor_id").change(function(){
          if ($('#investor_id').val())
          {
              if ($('#investment_type option:selected').val()!='<?php echo @INVESTMENT_RPA; ?>
')
              {
                  if ('<?php echo $this->_tpl_vars['values']['investment_group']; ?>
' && '<?php echo $this->_tpl_vars['values']['investor_id']; ?>
'==$('#investor_id').val())
                  {
                      loadInvestments('<?php echo $this->_tpl_vars['values']['investor_id']; ?>
','<?php echo $this->_tpl_vars['values']['investment_group']; ?>
');    
                  }
                  else
                  {
                      loadInvestments($('#investor_id').val());        
                  }
                  
                  $('#investment_row').show();
              }
              else
              {
                  showFields('<?php echo @INVESTMENT_RPA; ?>
');
              }
          }
          else
          {
              $('#investments_area').html('<select class="cmb_bx1" name="investment_group" id="investment_group"><option value="">Please select investment</option></select>');
              $('#investment_details').html('');
              $('#investment_type option').show();
          }
          
          <?php if (! $this->_tpl_vars['values']): ?>
          $('#amount').val('').removeAttr('readonly');
          $("#buy_rate_row input,#commission_row input,#months_row input,#amount,#notes,#trans_date,#trans_month,#trans_year").val('');
          $('#investment_details').html('');
          <?php endif; ?>
      })
      
      <?php if ($this->_tpl_vars['values']['investment_type'] && $this->_tpl_vars['values']['investment_type'] == @INVESTMENT_RPA): ?>
      showFields('<?php echo @INVESTMENT_RPA; ?>
');
      <?php endif; ?>
      
      <?php if ($this->_tpl_vars['values']['investment_type']): ?>
      loadInvestors(<?php echo $this->_tpl_vars['values']['investor_id']; ?>
);
      <?php endif; ?>
      
      <?php if ($this->_tpl_vars['values']['investor_id'] && $this->_tpl_vars['values']['investment_type'] != @INVESTMENT_RPA): ?>
      loadInvestments(<?php echo $this->_tpl_vars['values']['investor_id']; ?>
,'<?php echo $this->_tpl_vars['values']['investment_group']; ?>
');
      <?php endif; ?>
      
  })
  
  function loadInvestors(active_investor)
  {
      active_investor = active_investor || false;
      
      $.ajax({
          url:'adminindex.php?do=get-investors-for-transactions&type='+$('#investment_type option:selected').val()+'&active_investor='+active_investor
      }).done(function(html){
          $('#investor_id').html(html);
          $("#investor_id").val(active_investor).trigger("change");
      })
  }
  
  function loadInvestments(investor_id,active_investment)
  {
      active_investment = active_investment || false;
      
      $("#investments_area").html('<img src="../images/loading1.gif" />Please wait...');
      $.ajax({
          url:'adminindex.php?do=get_investor_investments&investor_id='+investor_id+'&active_investment='+active_investment+'&transaction_type='+$('#investment_type option:selected').val(),
      }).done(function(data){
          $("#investments_area").html(data);
          showDetails(investor_id);
      })
  }
  
  function refreshDetails()
  {
      if (
            (
                $('#investment_type option:selected').val()=='<?php echo @INVESTMENT_REDEEMED; ?>
' && 
                (!investement_details.is_completed || investement_details.completed_at>($('#trans_year').val()+'-'+$('#trans_month').val()+'-'+$('#trans_date').val()))
            ) || 
            $('#investment_type option:selected').val()=='<?php echo @INVESTMENT_PARTIAL_COUPON; ?>
'
        )
      {
          $.ajax({
              url:'adminindex.php?do=get_investment_details&group_id='+$('#investment_group').val()+'&investor_id='+$("#investor_id").val()+'&end_date='+($('#trans_year').val()+'-'+$('#trans_month').val()+'-'+$('#trans_date').val())
          }).done(function(data){
              $("#investment_details").html(data);
              $('#amount').attr('readonly','readonly');
              
              if ($('#investment_type option:selected').val()=='<?php echo @INVESTMENT_REDEEMED; ?>
')
              {
                  $('#amount').val((parseFloat(investement_details.amount)+parseFloat(investement_details.yield)).toFixed(2));
              }
              else if($('#investment_type option:selected').val()=='<?php echo @INVESTMENT_PARTIAL_COUPON; ?>
')
              {
                  $('#amount').val((parseFloat(investement_details.yield)).toFixed(2));
              }
          });
      }
  }
  
</script>