Tipo de Credito
<?php
if(isset($_GET['mid']) && (trim($_GET['mid']) == base64_encode("404")))
{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Employee Wallet'") or die ("Error" . mysqli_error($link));-->
$get_check = mysqli_fetch_array($check);
$pread = $get_check['pread'];
?>	
	<?php echo ($pread == 1) ? '<li class="active"><a href="mywallet.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("404").'"><i class="fa fa-book"></i> <span>Minha Carteira</span></a></li>' : ''; ?>
<?php
}else{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Employee Wallet'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pread = $get_check['pread'];
	?>
	<?php echo ($pread == 1) ? '<li><a href="mywallet.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("404").'"><i class="fa fa-book"></i> <span>Minha Carteira</span></a></li>' : ''; ?>
<?php } ?>	


Poupancas

<?php-->
<!--if(isset($_GET['mid']) && (trim($_GET['mid']) == base64_encode("410")))-->
<!--{-->
<!--$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Savings Account'") or die ("Error" . mysqli_error($link));-->
<!--$get_check = mysqli_fetch_array($check);-->
<!--$pcreate = $get_check['pcreate'];-->
<!--$pread = $get_check['pread'];-->
<!--?>			-->
<!--		<?php echo ($pcreate == 1) ? '<li class="treeview active"><a href="#"><i class="fa fa-money"></i> <span>Poupança</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>-->
<!--		<?php echo ($pread == 1) ? '<li><a href="customer.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Clientes</a></li>' : ''; ?> -->
<!--		<?php echo ($pcreate == 1) ? '<li><a href="deposit.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Depositos</a></li>' : ''; ?>-->
<!--		<?php echo ($pcreate == 1) ? '<li><a href="withdraw.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Levatamento</a></li>' : ''; ?>-->
<!--		<?php echo ($pread == 1) ? '<li><a href="transaction.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Todas Transações</a></li>' : ''; ?>-->
<!--        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>-->
<!--<?php-->
<!--}-->
<!--else{-->
<!--$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Savings Account'") or die ("Error" . mysqli_error($link));-->
<!--$get_check = mysqli_fetch_array($check);-->
<!--$pcreate = $get_check['pcreate'];-->
<!--$pread = $get_check['pread'];-->
<!--?>			-->
<!--		<?php echo ($pcreate == 1) ? '<li class="treeview"><a href="#"><i class="fa fa-money"></i> <span>Poupança</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>-->
<!--		<?php echo ($pread == 1) ? '<li><a href="customer.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Clientes</a></li>' : ''; ?> -->
<!--		<?php echo ($pcreate == 1) ? '<li><a href="deposit.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Deposito</a></li>' : ''; ?>-->
<!--		<?php echo ($pcreate == 1) ? '<li><a href="withdraw.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Levantamento</a></li>' : ''; ?>-->
<!--		<?php echo ($pread == 1) ? '<li><a href="transaction.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("410").'"><i class="fa fa-circle-o"></i>Todas Transações</a></li>' : ''; ?>-->
<!--        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>-->
<!--<?php } ?>-->


Painel de emails
<?php
if(isset($_GET['mid']) && (trim($_GET['mid']) == base64_encode("402")))
{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Email Panel'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
?>
		<?php echo ($pcreate == 1) ? '<li class="treeview active"><a href="#"><i class="fa fa-book"></i> <span>Painel de Email</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>
 		<?php echo ($pcreate == 1) ? '<li class="active"><a href="newemail.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("402").'"><i class="fa fa-circle-o"></i> Enviar Email</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="listemail.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("402").'"><i class="fa fa-circle-o"></i>Lista de Email</a></li>' : ''; ?>
        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>
<?php
}
else{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Email Panel'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
	?>	
		<?php echo ($pcreate == 1) ? '<li class="treeview"><a href="#"><i class="fa fa-book"></i> <span>Painel de Email</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>
 		<?php echo ($pcreate == 1) ? '<li class="active"><a href="newemail.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("402").'"><i class="fa fa-circle-o"></i> Enviar Email</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="listemail.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("402").'"><i class="fa fa-circle-o"></i>Lista de Email</a></li>' : ''; ?>
        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>
<?php } ?>


Painel de Mensagens
<?php
if(isset($_GET['mid']) && (trim($_GET['mid']) == base64_encode("406")))
{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Internal Message'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
?>		
		<?php echo ($pcreate == 1) ? '<li class="treeview active"><a href="#"><i class="fa fa-book"></i> <span>Mensagem</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>
 		<?php echo ($pcreate == 1) ? '<li class="active"><a href="newmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i> Nova SMS</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="inboxmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i>Inbox SMS</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="outboxmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i>Outbox SMS</a></li>' : ''; ?>
        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>
<?php
}
else{
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Internal Message'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
?>		
		<?php echo ($pcreate == 1) ? '<li class="treeview"><a href="#"><i class="fa fa-book"></i> <span>Mensagem</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a><ul class="treeview-menu">' : ''; ?>
 		<?php echo ($pcreate == 1) ? '<li class="active"><a href="newmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i> Nova SMS</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="inboxmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i>Inbox SMS</a></li>' : ''; ?>
        <?php echo ($pread == 1) ? '<li><a href="outboxmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><i class="fa fa-circle-o"></i>Outbox SMS</a></li>' : ''; ?>
        <?php echo ($pcreate == 1) ? '</ul></li>' : ''; ?>
<?php } ?>


Dashboard

Tipo de Carteirinha
<?php
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Employee Wallet'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
if($pcreate == '1' || $pread == '1')
{
?>
        <div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-aqua">
            <div class="inner">
 			
			<h4>
<?php
$tid = $_SESSION['tid'];
$select = mysqli_query($link, "SELECT Total FROM twallet WHERE tid = '$tid'") or die (mysqli_error($link));
if(mysqli_num_rows($select)==0)
{
echo "0.00";
}
else{
while($row = mysqli_fetch_array($select))
{
$select1 = mysqli_query($link, "SELECT * FROM systemset") or die (mysqli_error($link));
while($row1 = mysqli_fetch_array($select1))
{
$currency = $row1['currency'];
echo $currency.number_format($row['Total'],2,".",",")."</b>";
}
}
}
?>			</h4>
              <p>Minha Carteira</p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/ass.png">
              <i class=""></i>
            </div>
            <a href="mywallet.php?tid=<?php echo $_SESSION['tid']; ?>&&mid=<?php echo base64_encode("404"); ?>" class="small-box-footer">Mais info <i class="fa fa-arrow-circle-right"></i></a>
          </div>		  
        </div>
<?php
}
else{
	echo '';
}
?>

Mensagens
<?php
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Internal Message'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
if($pcreate == '1' || $pread == '1')
{
?>
		<div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-aqua">
            <div class="inner">
 			
			<h4>
<?php
$select = mysqli_query($link, "SELECT * FROM message") or die (mysqli_error($link));
$num = mysqli_num_rows($select);
echo $num;
?>
			</h4>
              <p>Mensagens</p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/message.png">
              <i class=""></i>
            </div>
            <?php echo ($pread == 1) ? '<a href="inboxmessage.php?tid='.$_SESSION['tid'].'&&mid='.base64_encode("406").'" class="small-box-footer">Mais info <i class="fa fa-arrow-circle-right"></i></a>' : '<a href="#" class="small-box-footer">-------</a>'; ?>
          </div>
        </div>
<?php
}
else{
	echo '';
}
?>

<?php
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Savings Account'") or die ("Error" . mysqli_error($link));
$get_check = mysqli_fetch_array($check);
$pcreate = $get_check['pcreate'];
$pread = $get_check['pread'];
if($pcreate == '1' || $pread == '1')
{
?>		
		<div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-aqua">
            <div class="inner">
 			
			<h4>
<?php 
$select = mysqli_query($link, "SELECT SUM(amount) FROM transaction WHERE t_type = 'Withdraw'") or die (mysqli_error($link));
while($row = mysqli_fetch_array($select))
{
$select1 = mysqli_query($link, "SELECT * FROM systemset") or die (mysqli_error($link));
while($row1 = mysqli_fetch_array($select1))
{
$currency = $row1['currency'];
echo $currency.number_format($row['SUM(amount)'],2,".",",")."</b>";
}
}
?>
			</h4>
              <p>Total de Levantamentos </p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/utility.png">
              <i class=""></i>
            </div>
            <?php echo ($pread == 1) ? '<a href="transaction.php?tid='.$_SESSION['tid'].'&&mid='.base64_encode("408").'" class="small-box-footer">Mais info<i class="fa fa-arrow-circle-right"></i></a>' : '<a href="#" class="small-box-footer">-------</a>'; ?>
          </div>
        </div>
        <!-- ./col -->	

			<div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-red">
            <div class="inner">
 			
			<h4>
<?php
$select = mysqli_query($link, "SELECT * FROM borrowers") or die (mysqli_error($link));
$num = mysqli_num_rows($select);
echo $num;
?>
			</h4>
              <p>Clientes</p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/school.png">
              <i class=""></i>
            </div>
             <?php echo ($pread == 1) ? '<a href="customer.php?tid='.$_SESSION['tid'].'&&mid='.base64_encode("403").'" class="small-box-footer">Mais info <i class="fa fa-arrow-circle-right"></i></a>' : '<a href="#" class="small-box-footer">-------</a>'; ?>
          </div>
        </div>
		
		<div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-green">
            <div class="inner">
 			
			<h4>
<?php 
$selecte = mysqli_query($link, "SELECT * FROM transaction") or die (mysqli_error($link));
$nume = mysqli_num_rows($selecte);
echo $nume;
?>
			</h4>
              <p>Total Transações </p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/report.png">
              <i class=""></i>
            </div>
             <?php echo ($pread == 1) ? '<a href="transaction.php?tid='.$_SESSION['tid'].'&&mid='.$nume.'" class="small-box-footer">Mais info<i class="fa fa-arrow-circle-right"></i></a>' : '<a href="#" class="small-box-footer">-------</a>'; ?>
          </div>
        </div>
        <!-- ./col -->
		
		<div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-yellow">
            <div class="inner">
 			
			<h4>
<?php 
$select = mysqli_query($link, "SELECT SUM(amount) FROM transaction WHERE t_type = 'Deposit'") or die (mysqli_error($link));
while($row = mysqli_fetch_array($select))
{
$select1 = mysqli_query($link, "SELECT * FROM systemset") or die (mysqli_error($link));
while($row1 = mysqli_fetch_array($select1))
{
$currency = $row1['currency'];
echo $currency.number_format($row['SUM(amount)'],2,".",",")."</b>";
}
}
?>
			</h4>
              <p>Total de Depositos </p>
            </div>
            <div class="icon"><img height="80" width="80" src="../img/fair.png">
              <i class=""></i>
            </div>
             <?php echo ($pread == 1) ? '<a href="transaction.php?tid='.$_SESSION['tid'].'&&mid='.base64_encode("408").'" class="small-box-footer">Mais info<i class="fa fa-arrow-circle-right"></i></a>' : '<a href="#" class="small-box-footer">-------</a>'; ?>
          </div>
        </div>
        <!-- ./col -->	
<?php
}
else{
	echo '';
}
?>


Atualizar Mutuarios, Informacao Financeira
<div class="tab-pane active" id="tab_2">
 <form method="post" action="">
			 	<table>
				<th></th>
				<th align="center" width="400">Ocupação</th>
				<th align="center" width="300">Ganhos Mensais</th>
                <tbody> 
<?php
$id = $_GET['id'];
$search = mysqli_query($link, "SELECT * FROM fin_info WHERE get_id = '$id'") or die (mysqli_error($link));
if(mysqli_num_rows($search) > 0){
    while($have = mysqli_fetch_array($search))
    {
    $idme= $have['id'];
    ?>			
				<tr>
				<td width="30"><input id="optionsCheckbox" class="uniform_on" name="selector[]" type="checkbox" value="<?php echo $idme; ?>" checked></td>
                <td width="800"><input name="occupation[]" type="text" class="form-control" placeholder="Ocupação" value="<?php echo $have['occupation']; ?>"></td>
                <td width="300"><input name="mincome[]" type="number" class="form-control" placeholder="Valor" value="<?php echo $have['mincome']; ?>"></td>
				</tr>
    <?php 
    }
}else{
    ?>
        <tr>
			
            <td width="800"><input name="occupation" type="text" class="form-control" placeholder="Ocupação" ></td>
            <td width="300"><input name="mincome" type="number" class="form-control" placeholder="Valor" ></td>
		</tr>
    <?php
}
?>

				</tbody>
                </table>
<div align="left">
              <div class="box-footer">
                <button type="submit" class="btn btn-success btn-flat" name="add_fees_rows"><i class="fa fa-plus">&nbsp;Adicionar</i></button>
                <button name="delrow" type="submit" class="btn btn-danger btn-flat"><i class="fa fa-trash">&nbsp;Apagar</i></button>

              </div>
			  </div>
   <?php
						if(isset($_POST['delrow'])){
						$idm = $_GET['id'];
							$id=$_POST['selector'];
							$N = count($id);
						if($N == 0){
						echo "<script>alert('Row Not Selected!!!'); </script>";	
						echo "<script>window.location='updateborrowers.php?id=".$idm."&&mid=".base64_encode("403")."'; </script>";
							}
							else{
							for($i=0; $i < $N; $i++)
							{
								$result = mysqli_query($link,"DELETE FROM fin_info WHERE id ='$id[$i]'");
								echo "<script>window.location='updateborrowers.php?id=".$idm."&&mid=".base64_encode("403")."'; </script>";
							}
							}
							}
?>

<?php
if(isset($_POST['add_fees_rows']))
{
$id = $_GET['id'];
$occupation = $_GET['occupation'];
$mincome = $_GET['mincome'];
$tid = $_SESSION['tid'];

    $insert = mysqli_query($link, "INSERT INTO fin_info(get_id,tid,occupation,mincome) VALUES($id','$tid','$occupation','$mincome')") or die (mysqli_error($link));

if(!$insert)
{
echo "<script>alert('Unable to add row!!!'); </script>";
echo "<script>window.location='updateborrowers.php?id=".$id."&&mid=".base64_encode("403")."'; </script>";
}
else{
echo "<script>window.location='updateborrowers.php?id=".$id."&&mid=".base64_encode("403")."'; </script>";
}
}
?>
<div align="right">
              <div class="box-footer">
               <button type="submit" class="btn btn-info btn-flat" name="add_fees"><i class="fa fa-save">&nbsp;Actualizar Taxas</i></button>

              </div>
			  </div>
<?php
if(isset($_POST['add_fees']))
{
$idm = $_GET['id'];
$id = $_POST['selector'];
if($id == ''){
echo "<script>alert('Row Not Selected!!!'); </script>";	
echo "<script>window.location='updateborrowers.php?id=".$idm."&&mid=".base64_encode("403")."'; </script>";
}
else{
$i = 0;
foreach($_POST['selector'] as $s)
{
$fee = mysqli_real_escape_string($link, $_POST['occupation'][$i]);
$amount = mysqli_real_escape_string($link, $_POST['mincome'][$i]);
$update = mysqli_query($link, "UPDATE fin_info SET occupation = '$fee', mincome = '$amount' WHERE id = '$s'") or die (mysqli_error($link));
$i++;
if(!$update)
{
echo "<script>alert('Não inserido..Tente mas tarde!'); </script>";
}
else{
echo "<script>alert('Informação de Pagamento actualizada!!'); </script>";
echo "<script>window.location='updateborrowers.php?id=".$idm."&&mid=".base64_encode("403")."'; </script>";
}
}
}
}
?>
				</form>
              </div>
              
              
              
Lista de Emprestimos, atualizar estado
<td align="center" class="alert alert-danger"><?php echo $upstatus; ?><br><?php echo ($pupdate == '1') ? '<a href="updateloans.php?id='.$id.'&&mid='.base64_encode("405").'">Clique para resgistrar</a>' : ''; ?></td>




muturarios
//$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
//$image_name = addslashes($_FILES['image']['name']);
//$image_size = getimagesize($_FILES['image']['tmp_name']);

// $target_dir = "../img/";
// $target_file = $target_dir.basename($_FILES["image"]["name"]);
// $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// $check = getimagesize($_FILES["image"]["tmp_name"]);

// if($check == false)
// {
// 	echo '<meta http-equiv="refresh" content="2;url=view_emp.php?tid='.$id.'&&mid='.base64_encode("409").'">';
// 	echo '<br>';
// 	echo'<span class="itext" style="color: #FF0000">Tipo Inválido</span>';
// }
// elseif(file_exists($target_file)) 
// {
// 	echo '<meta http-equiv="refresh" content="2;url=view_emp.php?tid='.$id.'&&mid='.base64_encode("409").'">';
// 	echo '<br>';
// 	echo'<span class="itext" style="color: #FF0000">Já Existe.</span>';
// }
// elseif($_FILES["image"]["size"] > 30000000)
// {
// 	echo '<meta http-equiv="refresh" content="2;url=view_emp.php?tid='.$id.'&&mid='.base64_encode("409").'">';
// 	echo '<br>';
// 	echo'<span class="itext" style="color: #FF0000">Image must not more than 2MB!</span>';
// }
// elseif($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif")
// {
// 	echo '<meta http-equiv="refresh" content="2;url=view_emp.php?tid='.$id.'&&mid='.base64_encode("409").'">';
// 	echo '<br>';
// 	echo'<span class="itext" style="color: #FF0000">Desculpa, only JPG, JPEG, PNG & GIF tipos permitido.</span>';
// }
// else{
// 	$sourcepath = $_FILES["image"]["tmp_name"];
// 	$targetpath = "../img/" . $_FILES["image"]["name"];
// 	move_uploaded_file($sourcepath,$targetpath);
	
// 	$location = "img/".$_FILES['image']['name'];


<?php
$check = mysqli_query($link, "SELECT * FROM emp_permission WHERE tid = '".$_SESSION['tid']."' AND module_name = 'Internal Message'") or die ("Error" . mysqli_error($link));
while($get_check = mysqli_fetch_array($check)){
$pcreate = $get_check['pcreate'];
?>
	<?php echo ($pcreate == '1') ? '<a href="send_smsloan.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'"><button type="button" class="btn btn-flat btn-info"><i class="fa fa-envelope"></i>&nbsp;Enviar SMS</button></a>' : ''; ?>
<?php } ?>

<?php 
if(isset($_POST['saveExcel'])){
    // $arquivo = $_FILES['ficheiro'];
    // var_dump($arquivo);
    if(!empty($_FILES['ficheiro']['tmp_name'])){
        $arquivo = new DomDocument();
        $arquivo->load($_FILES['ficheiro']['tmp_name']);
        // var_dump($arquivo);
        $linhas = $arquivo->getElementsByTagName("Row");
        // var_dump($linha);
        foreach($linhas as $linha){
            
        }
    }
}
?>




TIpo de Credito
<button type="button" class="btn btn-flat btn-info" disabled>&nbsp;Total de Movimentos:&nbsp;
<strong class="alert alert-success">
<?php
$tid = $_SESSION['tid'];
//$select = mysqli_query($link, "SELECT Total FROM twallet WHERE tid") or die (mysqli_error($link))
$select = mysqli_query($link, "SELECT Total FROM twallet WHERE tid = '$tid'") or die (mysqli_error($link));

if(mysqli_num_rows($select)==0)
{
echo "0.00";
}
else{
while($row = mysqli_fetch_array($select))
{
$select1 = mysqli_query($link, "SELECT * FROM systemset") or die (mysqli_error($link));
while($row1 = mysqli_fetch_array($select1))
{
$currency = $row1['currency'];
echo $currency.number_format($row['Total'],2,".",",")."</b>";
}
}
}
?>
</strong>
	</button>
	
	<?php echo ($pupdate == '1') ? '<button data-target= "#c" data-toggle="modal" type="button" class="btn btn-flat btn-info"><i class="fa fa-dollar"></i>&nbsp;Transferencia</button>' : ''; ?>



try{
		$tid = $_SESSION['tid'];
		$credito = mysqli_real_escape_string($link, $_POST['credito']);
// 		$desc = mysqli_real_escape_string($link, $_POST['desc']);
// 		$wtype = mysqli_real_escape_string($link, $_POST['wtype']);
		
		if($amt < 0){
				throw new UnexpectedValueException();
		}
		elseif($wtype == "debit")
		{
		$select = mysqli_query($link, "SELECT Total FROM twallet WHERE tid = '$tid'") or die (mysqli_error($link));
		if(mysqli_num_rows($select)==0)
		{
		$insert1 = mysqli_query($link, "INSERT INTO twallet VALUES('','$tid','$amt')") or die (mysqli_error($link));
		$insert2 = mysqli_query($link, "INSERT INTO mywallet VALUES('','$tid','NIL','$amt','$desc','$wtype',NOW())") or die (mysqli_error($link));

		echo "<script>alert('Adcionou pagamento com sucesso!'); </script>";
		echo "<script>window.location='mywallet.php?tid=".$_SESSION['tid']."'; </script>";
		}
		else{
		$row3 = mysqli_fetch_array($select);
		$Get_amt3 = $row3['Total'];
		$Total =  $Get_amt3 + $amt;
		$update3 = mysqli_query($link, "UPDATE twallet SET Total='$Total' WHERE tid = '$tid'") or die (mysqli_error($link));
		$insert1 = mysqli_query($link, "INSERT INTO mywallet VALUES('','$tid','NIL','$amt','$desc','$wtype',NOW())") or die (mysqli_error($link));
		if(!($update3 && $insert1))
		{
		echo "<script>alert('Erro ao inserir!....Tente novamente!!'); </script>";
		echo "<script>window.location='mywallet.php?tid=".$_SESSION['tid']."'; </script>";
		}
		else{
		echo "<script>alert('Adcionou pagamento com sucesso!'); </script>";
		echo "<script>window.location='mywallet.php?tid=".$_SESSION['tid']."'; </script>";
		}
		}
		}
		elseif($wtype == "credit")
		{
		$select = mysqli_query($link, "SELECT Total FROM twallet WHERE tid = '$tid'") or die (mysqli_error($link));
		while($row = mysqli_fetch_array($select))
		{
		$Get_amt = $row['Total'] - $amt;

		$update = mysqli_query($link, "UPDATE twallet SET Total = '$Get_amt' WHERE tid = '$tid'") or die (mysqli_error($link));
		$insert = mysqli_query($link, "INSERT INTO mywallet VALUES('','$tid','NIL','$amt','$desc','$wtype',NOW())") or die (mysqli_error($link));
		if(!($update && $insert))
		{
		echo "<script>alert('Valor nao creditado.....Please try again later!'); </script>";
		echo "<script>window.location='mywallet.php?tid=".$_SESSION['tid']."'; </script>";
		}
		else{
		echo "<script>alert('Valor Creditado com sucesso!'); </script>";
		echo "<script>window.location='mywallet.php?tid=".$_SESSION['tid']."'; </script>";
		}
		}
		}
	}catch(UnexpectedValueException $ex)
	{
		echo "<script>alert('Montabde invalido!!'); </script>";
	}
	
	
	
	
	top bar
	<?php echo ($pcreate == 1) ? '<div class="pull-left"><a href="newmessage.php?id='.$_SESSION['tid'].'&&mid='.base64_encode("406").'" class="btn btn-info btn-flat">Nova Mensagem</a></div>' : ''; ?>