| Server IP : 54.233.248.239 / Your IP : 172.28.20.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/storage/framework/views/ |
Upload File : |
<?php $__env->startSection('content'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Conta Receber
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo e(url('admin')); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li class="active">Conta Receber</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header no-print">
<h4>Filtros</h4>
<form id="form-conta-receber" method="GET" action="<?php echo url('admin/conta-receber'); ?>">
<div class="row">
<div class="col-md-2">
<div class="row">
<div class="col-md-12">
<h5>Empresa:</h5>
<select id="empresa_id" required class="form-control select2" name="empresa_id">
<option value="0">Selecione a empresa</option>
<?php foreach ($empresas as $empresa): ?>
<option <?php echo (isset($empresa_id) && $empresa_id == $empresa->id) ? 'selected' : ''; ?> value="<?php echo $empresa->id; ?>"><?php echo $empresa->nome; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="col-md-2">
<div class="row">
<div class="col-md-12">
<h5>Unidade:</h5>
<select id="unidade_negocio_id" required class="form-control select2" name="unidade_negocio_id">
<option value="0">Selecione a unidade</option>
<?php foreach ($unidades as $unidade): ?>
<option <?php echo (isset($unidade_negocio_id) && $unidade_negocio_id == $unidade->id) ? 'selected' : ''; ?> value="<?php echo $unidade->id; ?>"><?php echo $unidade->nome; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="col-md-2">
<div class="row">
<div class="col-md-12">
<h5>Tipo:</h5>
<select class="form-control select2" name="tipo_conta" id="tipo_conta">
<option value="card" <?php echo ($tipo_conta == 'card' ? 'selected="selected"' : '')?>>Cartão</option>
<option value="deposito" <?php echo ($tipo_conta == 'deposito' ? 'selected="selected"' : '')?>>Depósito</option>
</select>
</div>
</div>
</div>
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
<h5>Data inicial (<span class="small">período</span>):</h5>
<input type="date" value="<?php echo (isset($data_inicial)) ? $data_inicial : ''; ?>" class="form-control" name="data_inicial" id="data_inicial">
<input type="hidden" name="data_start" id="data_start" value="<?php echo date('Y-m-d') ?>">
<input type="hidden" name="data_card" id="data_card" value="<?php echo (isset($data_final)) ? $data_final : ''; ?>">
<input type="hidden" name="data_deposito" id="data_deposito" value="<?php echo (isset($data_deposito)) ? $data_deposito : ''; ?>">
</div>
<div class="col-md-6">
<h5>Data final (<span class="small">período</span>):</h5>
<input type="date" value="<?php echo (isset($data_final)) ? $data_final : ''; ?>" class="form-control" name="data_final" id="data_final">
</div>
</div>
</div>
<div class="col-md-2">
<div class="row">
<div class="col-md-12">
<button type="button" id="filtrarContas" class="btn btn-block btn-primary" style="margin-top:35px;">Filtrar</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- /.box-header -->
<div class="box-body">
<h5>Número de Registros: <?php echo count($registros); ?></h5>
<?php if(count($registros) > 0): ?>
<?php if($tipo_conta == 'deposito'): ?>
<p><a type="button" id="btn-gerar-titulos" class="btn btn-primary"><i class="fa fa-fw fa-sync"></i> Gerar Títulos ERP</a></p>
<?php endif; ?>
<table class="table table-bordered table-striped">
<thead>
<?php if($tipo_conta == 'card'):?>
<tr>
<th>Data</th>
<th>Valor Previsto</th>
<th>Estornos</th>
<th>Valor Bruto</th>
<th>Taxas</th>
<th>Valor Antecipado</th>
<th>Valor Líquido</th>
<th>Valor Gerado</th>
<th class="th-action">Ações</th>
</tr>
<?php else: ?>
<tr>
<th class="no-sort"><input type="checkbox" name="selecionar_todos"/></th>
<th>Data</th>
<th>Cliente</th>
<th>Pedido Venda</th>
<th>Qtd. Produtos</th>
<th>Valor</th>
<th>Status</th>
<th class="th-action">Comprovante</th>
</tr>
<?php endif;?>
</thead>
<tbody>
<?php
if($tipo_conta == 'card'):
foreach($registros as $day):
$date = explode("-", $day);
$dia = $date[2];
$mes = $date[1];
$style = (isset($valorLog["DIA{$dia}{$mes}"]) && $valorLog["DIA{$dia}{$mes}"] > 0 ? "text-decoration: line-through;" : "");
?>
<tr>
<td><?php echo strftime('%d/%m/%Y',strtotime($day)); ?></td>
<td style="<?php echo e($style); ?>"><?php echo (isset($valorPrevisto["DIA{$dia}{$mes}"]) ? number_format($valorPrevisto["DIA{$dia}{$mes}"], 2,',','.') : '0,00'); ?></td>
<td style="<?php echo e($style); ?>"><?php echo (isset($valorEstorno["DIA{$dia}{$mes}"]) ? number_format($valorEstorno["DIA{$dia}{$mes}"], 2,',','.') : '0,00'); ?></td>
<td style="<?php echo e($style); ?>">
<?php
$valorBruto = (isset($valorPrevisto["DIA{$dia}{$mes}"]) ? $valorPrevisto["DIA{$dia}{$mes}"] : 0) - (isset($valorEstorno["DIA{$dia}{$mes}"]) ? $valorEstorno["DIA{$dia}{$mes}"] : 0);
echo number_format($valorBruto, 2,',','.');
?>
</td>
<td style="<?php echo e($style); ?>"><?php echo (isset($valorTaxa["DIA{$dia}{$mes}"]) ? number_format($valorTaxa["DIA{$dia}{$mes}"], 2,',','.') : '0,00')?></td>
<td style="<?php echo e($style); ?>"><?php echo (isset($valorAntecipado["DIA{$dia}{$mes}"]) ? number_format($valorAntecipado["DIA{$dia}{$mes}"], 2,',','.') : '0,00')?></td>
<td style="<?php echo e($style); ?>">
<?php
$valorPrevistoDia = isset($valorPrevisto["DIA{$dia}{$mes}"]) ? $valorPrevisto["DIA{$dia}{$mes}"] : 0;
$valorAntecipadoDia = isset($valorAntecipado["DIA{$dia}{$mes}"]) ? $valorAntecipado["DIA{$dia}{$mes}"] : 0;
$valorEstornoDia = isset($valorEstorno["DIA{$dia}{$mes}"]) ? $valorEstorno["DIA{$dia}{$mes}"] : 0;
$valorTaxaDia = isset($valorTaxa["DIA{$dia}{$mes}"]) ? $valorTaxa["DIA{$dia}{$mes}"] : 0;
$valorLiquido = $valorPrevistoDia - $valorEstornoDia - $valorTaxaDia;
echo number_format($valorLiquido, 2,',','.');
?>
</td>
<td style="<?php echo e($style); ?>"><?php echo (isset($valorLog["DIA{$dia}{$mes}"]) ? number_format($valorLog["DIA{$dia}{$mes}"], 2,',','.') : '0,00')?></td>
<td>
<a data-valor-titulo="<?php echo number_format($valorLiquido, 2,'.',''); ?>" data-day="<?php echo $day; ?>" href="javascript:void(0)" class="btn btn-primary btn-gerar-titulo"><i class="fa fa-fw fa-sync"></i> Gerar Título</a>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<?php
foreach ($registros as $registro):
$style = ($registro->conta_receber_log == 1 ? "text-decoration: line-through;" : "");
?>
<tr>
<td class="no-sort">
<?php if($registro->id_status_pedido_venda == 2): ?>
<input type="checkbox" name="item_pedido[]" value="<?php echo $registro->id; ?>"/>
<?php endif; ?>
</td>
<td style="<?php echo e($style); ?>"><?php echo strftime('%d/%m/%Y',strtotime($registro->data_fechamento)); ?></td>
<td><?php echo $registro->cliente->nome; ?> <?php echo $registro->cliente->sobrenome; ?></td>
<td><a href="<?php echo e(url('/admin/pedido-venda/edit/' . $registro->id)); ?>" target="_blank"><?php echo $registro->id; ?></a></td>
<td>
<?php
$produtos = 0;
if(isset($registro->produtos) && count($registro->produtos) > 0){
foreach ($registro->produtos as $produto) {
$produtos += $produto->quantidade;
}
}
echo $produtos;
?>
</td>
<td style="<?php echo e($style); ?>"><?php echo number_format($registro->total, 2,',','.'); ?></td>
<td><?php echo $registro->status->nome; ?></td>
<td>
<?php if($registro->comprovante){ ?>
<a target="_blank" class="comprovante" href="<?php echo get_file_s3($registro->comprovante, 'pedido-venda/comprovante'); ?>">Ver Comprovante</a>
<?php }else{ ?>
<form class="form-comprovante">
<input type="hidden" name="pagamento" value="<?php echo $registro->id; ?>">
<a target="_blank" href="#" class="comprovante enviarComprovanteButton">Enviar comprovante</a>
<input type="file" class="hidden" name="enviar-comprovante">
</form>
<?php } ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- /.box-body -->
<div class="box-footer">
</div>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
$(document).ready(function(){
$(document).on('change','#tipo_conta',function(e){
var data_inicial = $('#data_deposito').val();
var data_final = $('#data_start').val();
if($(this).val() == 'card'){
data_inicial = $('#data_start').val();
data_final = $('#data_card').val();
}
$('#data_inicial').val(data_inicial);
$('#data_final').val(data_final);
});
$(document).on('click','#filtrarContas',function(e){
e.preventDefault();
if($('#empresa_id').val() == '0'){
alertUtil.alertError('Selecione uma empresa!');
}else if($('#unidade_negocio_id').val() == '0'){
alertUtil.alertError('Selecione uma Unidade!');
}else{
$('#form-conta-receber').submit();
}
});
$('.btn-gerar-titulo').click(function(e){
var self = this;
var day = $(this).data('day');
var valor_titulo = $(this).data('valor-titulo');
$.ajax({
url: '/admin/conta-receber/gerar-titulo',
type: 'POST',
data: {
day : day,
valor : valor_titulo,
empresa : '<?php echo (isset($empresa_id) ? $empresa_id : 0); ?>',
tipo : 'card'
},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
$('.carregando').fadeOut();
alertUtil.alertSuccess(data.message);
},
error:function(){
$('.loading').fadeOut();
alertUtil.alertError('Erro durante geração título!');
}
});
});
$('#btn-gerar-titulos').click(function(e){
if(!confirm('Você tem certeza?')){
e.preventDefault();
}else{
var pedidos_selecionados = [];
$('[name="item_pedido[]"]:checked').each(function(){
pedidos_selecionados.push($(this).val());
});
if(pedidos_selecionados.length > 0){
$.ajax({
url:'/admin/conta-receber/gerar-titulos',
type:'POST',
data:{
ids_pedido : pedidos_selecionados,
tipo : 'deposito'
},
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if (data.status) {
alertUtil.alertSuccess(data.message);
}else{
alertUtil.alertWarning(data.message);
}
$('.carregando').fadeOut();
},
error:function(data){
alertUtil.alertError('Erro ao processar ao gerar títulos.');
}
});
}else{
alertUtil.alertError('Você deve selecionar ao menos um pedido!');
}
}
});
$('[name="selecionar_todos"]').click(function(){
if($(this).is(':checked')){
$('[name="item_pedido[]"]').prop('checked', true);
}else{
$('[name="item_pedido[]"]').prop('checked', false);
}
});
$(document).on('click', '.enviarComprovanteButton', function(e){
e.preventDefault();
$(this).next().trigger('click');
});
$('[name="enviar-comprovante"]').change(function(){
var td = $(this).closest('td');
var form = new FormData($(this).closest('.form-comprovante')[0]);
form.append('fileUpload', $(this)[0].files[0]);
$.ajax({
url:'/perfil/enviar-comprovante',
type:'POST',
processData: false,
contentType: false,
data:form,
beforeSend:function(){
$('.carregando').fadeIn();
},
success:function(data){
if(data.status){
td.find('a').attr('href', data.url);
if ($(window).width() <= 700) {
td.find('a').html('Ver');
}
else {
td.find('a').html('Ver comprovante');
}
td.find('a').removeClass('enviarComprovanteButton');
alertUtil.alertSuccess(data.message);
}else{
alertUtil.alertError(data.message);
}
$('.carregando').fadeOut();
},
error:function(data){
alertUtil.alertError('Erro ao processar a compra. Tente novamente mais tarde.');
}
});
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make($current_template, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>