| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/vilagran/application/controllers/ |
Upload File : |
<?php
// *************************************************************************
// * *
// * iBilling - Accounting, Billing Software *
// * Copyright (c) Sadia Sharmin. All Rights Reserved *
// * *
// *************************************************************************
// * *
// * Email: sadiasharmin3139@gmail.com *
// * Website: http://www.sadiasharmin.com *
// * *
// *************************************************************************
// * *
// * This software is furnished under a license and may be used and copied *
// * only in accordance with the terms of such license and with the *
// * inclusion of the above copyright notice. *
// * If you Purchased from Codecanyon, Please read the full License from *
// * here- http://codecanyon.net/licenses/standard *
// * *
// *************************************************************************
_auth();
$mdate = $routes['1'];
$account = $routes['2'];
$stype = $routes['3'];
if(strlen($mdate) > 12)
{
$mdate = $mdate/1000;
$mdate = date('Y-m-d',$mdate);
}
$d = ORM::for_table('sys_transactions')->where('date',$mdate)->order_by_desc('id');
if($account != 'all')
{
$d->where('sys_accounts_id',$account);
}
if($stype != 'all')
{
$d->where('type',$stype);
}
$d = $d->find_many();
$dr = ORM::for_table('sys_transactions')->where('date',$mdate)->sum('dr');
if($dr == ''){
$dr = '0.00';
}
$cr = ORM::for_table('sys_transactions')->where('date',$mdate)->sum('cr');
if($cr == ''){
$cr = '0.00';
}
//var_dump($d[0]);exit;
?>
<div class="panel-body" id="printable" style="background: #ffffff; margin-top: 10px;">
<!--<h4><?php echo $_L['Total Income']; ?>: <?php echo $config['currency_code'] .' '. number_format($cr,2,$config['dec_point'],$config['thousands_sep']); ?></h4>
<h4><?php echo $_L['Total Expense']; ?>: <?php echo $config['currency_code'] .' '. number_format($dr,2,$config['dec_point'],$config['thousands_sep']); ?></h4>
<div class="clearfix"></div>
<hr>-->
<h2>Todas as Movimentações na data: <?php echo date( $config['df'], strtotime($mdate)); ?></h2>
<table class="table table-striped table-bordered table-responsive">
<th><?php echo $_L['Account']; ?></th>
<th><?php echo $_L['Type']; ?></th>
<th><?php echo $_L['Category']; ?></th>
<!--<th class="text-right"><?php echo $_L['Amount']; ?></th>-->
<th><?php echo $_L['Payer']; ?></th>
<th><?php echo $_L['Method']; ?></th>
<th><?php echo $_L['Ref']; ?></th>
<th><?php echo $_L['Description']; ?></th>
<th class="text-right"><?php echo $_L['Dr']; ?></th>
<th class="text-right"><?php echo $_L['Cr']; ?></th>
<?php
$arr_sum_methods = array();
$arr_sum_cats = array();
$total_cr = 0;
$total_dr = 0;
foreach($d as $ds){
// pego os totais
$total_cr += $ds['cr'];
$total_dr += $ds['dr'];
// pego o somatório dos meios de
if($ds['pmethod_id'] > 0)
{
$m = ORM::for_table('sys_pmethods')->where('id',$ds['pmethod_id'])->find_one();
$method = $m['name'];
if(!isset($arr_sum_methods[$ds['pmethod_id']]))
{
$arr_sum_methods[$ds['pmethod_id']] = array('method' => $m['name'],
'total_cr' => $ds['cr'],
'total_dr' => $ds['dr'] );
}
else
{
$arr_sum_methods[$ds['pmethod_id']]['total_cr'] += $ds['cr'];
$arr_sum_methods[$ds['pmethod_id']]['total_dr'] += $ds['dr'];
}
}
else
{
$method = $_L['Uninformed'];
if(!isset($arr_sum_methods[0]))
{
$arr_sum_methods[0] = array('method' => $_L['Uninformed'],
'total_cr' => $ds['cr'],
'total_dr' => $ds['dr'] );
}
else
{
$arr_sum_methods[0]['total_cr'] += $ds['cr'];
$arr_sum_methods[0]['total_dr'] += $ds['dr'];
}
}
// pego pego o somatório das categorias
if($ds['cat_id'] > 0)
{
$m = ORM::for_table('sys_cats')->where('id',$ds['cat_id'])->find_one();
$category = $m['name'];
if(!isset($arr_sum_cats[$ds['cat_id']]))
{
$arr_sum_cats[$ds['cat_id']] = array('cat' => $m['name'],
'total_cr' => $ds['cr'],
'total_dr' => $ds['dr']);
}
else
{
$arr_sum_cats[$ds['cat_id']]['total_cr'] += $ds['cr'];
$arr_sum_cats[$ds['cat_id']]['total_dr'] += $ds['dr'];
}
}
else
{
$category = $_L['Uninformed'];
if(!isset($arr_sum_cats[0]))
{
$arr_sum_cats[0] = array('cat' => $_L['Uninformed'],
'total_cr' => $ds['cr'],
'total_dr' => $ds['dr'] );
}
else
{
$arr_sum_cats[0]['total_cr'] += $ds['cr'];
$arr_sum_cats[0]['total_dr'] += $ds['dr'];
}
}
$cls = '';
if(($ds['bal']) < 0){
$cls = 'class="text-red"';
}
if($ds['category'] == 'Uncategorized'){
$cat = $_L['Uncategorized'];
}
else{
$cat = $ds['category'];
}
// Pego o contato
$crm_account_id = 0;
if($ds['type'] == 'Income')
{
$crm_account_id = $ds['payerid'];
}
elseif($ds['type'] == 'Income')
{
$crm_account_id = $ds['payeeid'];
}
$contato = '';
if($crm_account_id > 0)
{
$contato = ORM::for_table('crm_accounts')->where('id',$crm_account_id)->find_one();
$contato = $contato['account'];
}
echo ' <tr>
<td>'.$ds['account'].'</td>
<td>'.ib_lan_get_line($ds['type']).'</td>
<td>'.$category.'</td>
<td>'.$contato.'</td>
<td>'.$method.'</td>
<td>'.$ds['ref'].'</td>
<td>'.$ds['description'].'</td>
<td class="text-right">'.$config['currency_code'].' '.number_format($ds['dr'],2,$config['dec_point'],$config['thousands_sep']).'</td>
<td class="text-right">'.$config['currency_code'].' '.number_format($ds['cr'],2,$config['dec_point'],$config['thousands_sep']).'</td>
</tr>';
}
// var_dump($arr_sum_methods);exit;
?>
<tr style="background-color: antiquewhite;">
<td colspan="7">TOTAL</td>
<td><?php echo $config['currency_code'].' '.number_format($total_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
<td><?php echo $config['currency_code'].' '.number_format($total_cr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
<tr style="background-color: antiquewhite;">
<td colspan="7">FLUXO DE CAIXA | <?php echo date( $config['df'], strtotime($mdate)); ?> </td>
<td align="center" colspan="2"><?php echo $config['currency_code'].' '.number_format($total_cr - $total_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
</table>
<hr>
<div id="result_method">
<h2>Resumo por Tipo de Pagamento: <?php echo date( $config['df'], strtotime($mdate)); ?></h2>
<table class="table table-striped table-bordered table-responsive">
<th><?php echo $_L['Method']; ?></th>
<th><?php echo $_L['Dr']; ?></th>
<th><?php echo $_L['Cr']; ?></th>
<?php
$total_method_cr = 0;
$total_method_dr = 0;
foreach ($arr_sum_methods as $sum_method) {
$total_method_cr += $sum_method['total_cr'];
$total_method_dr += $sum_method['total_dr'];
?>
<tr>
<td><?php echo $sum_method['method']?></td>
<td><?php echo $config['currency_code'].' '.number_format($sum_method['total_dr'],2,$config['dec_point'],$config['thousands_sep'])?></td>
<td><?php echo $config['currency_code'].' '.number_format($sum_method['total_cr'],2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
<?php } ?>
<tr style="background-color: antiquewhite;">
<td>TOTAL</td>
<td><?php echo $config['currency_code'].' '.number_format($total_method_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
<td><?php echo $config['currency_code'].' '.number_format($total_method_cr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
<tr style="background-color: antiquewhite;">
<td>FLUXO DE CAIXA | <?php echo date( $config['df'], strtotime($mdate)); ?> </td>
<td colspan="2" align="center"><?php echo $config['currency_code'].' '.number_format($total_method_cr - $total_method_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
</table>
</div>
<hr>
<div id="result_cat">
<h2>Resumo por Tipo Categoria: <?php echo date( $config['df'], strtotime($mdate)); ?></h2>
<table class="table table-striped table-bordered table-responsive">
<th><?php echo $_L['Category']; ?></th>
<th><?php echo $_L['Dr']; ?></th>
<th><?php echo $_L['Cr']; ?></th>
<?php
$total_method_cr = 0;
$total_method_dr = 0;
foreach ($arr_sum_cats as $sum_method) {
$total_method_cr += $sum_method['total_cr'];
$total_method_dr += $sum_method['total_dr'];
?>
<tr>
<td><?php echo $sum_method['cat']?></td>
<td><?php echo $config['currency_code'].' '.number_format($sum_method['total_dr'],2,$config['dec_point'],$config['thousands_sep'])?></td>
<td><?php echo $config['currency_code'].' '.number_format($sum_method['total_cr'],2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
<?php } ?>
<tr style="background-color: antiquewhite;">
<td>TOTAL</td>
<td><?php echo $config['currency_code'].' '.number_format($total_method_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
<td><?php echo $config['currency_code'].' '.number_format($total_method_cr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
<tr style="background-color: antiquewhite;">
<td>FLUXO DE CAIXA | <?php echo date( $config['df'], strtotime($mdate)); ?> </td>
<td colspan="2" align="center"><?php echo $config['currency_code'].' '.number_format($total_method_cr - $total_method_dr,2,$config['dec_point'],$config['thousands_sep'])?></td>
</tr>
</table>
</div>
</div>