Skip to content

Commit

Permalink
refact(core): não gera nota para itens referente a juros/multa
Browse files Browse the repository at this point in the history
pequenas correções na lógica.

refs: #110
  • Loading branch information
andrekutianski committed Mar 14, 2022
1 parent e3374a1 commit c707c46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function hasInvoices($id)
$response = false;
$total = self::getTotalById($id);

if (count($total) > 0) {
if ($total > 0) {
$response = true;
}
return $response;
Expand Down
3 changes: 2 additions & 1 deletion modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public function queue($invoiceId, $force = false)
$userId = $clientData[0]['id'];
$serviceCode = $this->storage->get('service_code');
$hasInvoices = $this->serviceInvoicesRepo->hasInvoices($invoiceId);
$totalById = $this->serviceInvoicesRepo->getTotalById($invoiceId);

// se já houverem notas geradas para esta fatura não faça nada
if ($hasInvoices) {
logModuleCall('NFEioServiceInvoices', __CLASS__ . '-' . __FUNCTION__, "Fatura: {$invoiceId}", "Já possuí NF gerada.");
logModuleCall('NFEioServiceInvoices', __CLASS__ . '-' . __FUNCTION__, "Fatura: {$invoiceId}", "Já possuí NF gerada: {$hasInvoices} - {$totalById}.");
return [
'success' => true,
'alreadyHasNf' => true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<th class="text-center">NF ID</th>
<th class="text-center">ID</th>
<th class="text-center">ID Externo</th>
<th class="text-center">Status</th>
<th class="text-center">Gerada Em</th>
<th class="text-center">Ações</th>
</thead>
<tbody>
{foreach from=$localServiceInvoices item=nota name=nota}
<tr>
<td>{$nota->nfe_id}</td>
<td>{statusLabel data=$nota->status}</td>
<td>{$nota->created_at|date_format:"%d/%m/%Y %H:%M:%S"}</td>
<td class="text-center">{$nota->nfe_id}</td>
<td class="text-center">{$nota->nfe_external_id}</td>
<td class="text-center">{statusLabel data=$nota->status}</td>
<td class="text-center">{$nota->created_at|date_format:"%d/%m/%Y %H:%M:%S"}</td>
<td>
<form action="" method="post" id="nfeio_frm_cancel_{$smarty.foreach.nf.iteration}">
<input type="hidden" name="nfeiosi" value="cancel">
Expand Down

0 comments on commit c707c46

Please sign in to comment.