From c23c589e898eaa66c1720ff670f8d973c3348fa4 Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Tue, 19 Aug 2025 20:35:54 -0300 Subject: [PATCH] =?UTF-8?q?Atualizando=20visualiza=C3=A7=C3=A3o=20dos=20de?= =?UTF-8?q?talhes=20do=20boleto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../financial_movements_ticket_consult.php | 54 ++++++++++++++++++- vendor/model/FinancialMovements.class.php | 19 ++++++- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/vendor/action/financial_movements/financial_movements_ticket_consult.php b/vendor/action/financial_movements/financial_movements_ticket_consult.php index 6677208..608e8f4 100644 --- a/vendor/action/financial_movements/financial_movements_ticket_consult.php +++ b/vendor/action/financial_movements/financial_movements_ticket_consult.php @@ -72,7 +72,59 @@ try{ for($i=0; $iresultado->listaHistorico); $i++){ - echo $response->resultado->listaHistorico[$i]->descricaoHistorico; + /** Verifica se o item do historico é uma taxa */ + if($response->resultado->listaHistorico[$i]->tipoHistorico == 4){ + + /** Verifica se é uma tarifa de entrada */ + if( strstr($response->resultado->listaHistorico[$total]->descricaoHistorico, 'TAR. ENTRADA') ){ + + $movement_value_registration_tariff = $Main->MoeadDB(str_replace('R$', '', strstr($response->resultado->listaHistorico[$total]->descricaoHistorico, 'R$'))); + } + + /** Verifica se é uma tarifa de liquidação */ + if( strstr($response->resultado->listaHistorico[$total]->descricaoHistorico, 'TAR. LIQUIDAÇÃO') ){ + + $movement_value_settlement_tariff = $Main->MoeadDB(str_replace('R$', '', strstr($response->resultado->listaHistorico[$total]->descricaoHistorico, 'R$'))); + } + + } + + /** Verifica se o item do historico é uma taxa */ + if($response->resultado->listaHistorico[$i]->tipoHistorico == 6){ + + + /** Verifica a situação do boleto */ + if($response->resultado->situacaoBoleto != 'Baixado'){ + + + /** Prepara o valor pago */ + $movementValuePaid = $Main->MoeadDB(str_replace('R$', '', strstr($response->resultado->listaHistorico[$i]->descricaoHistorico, 'R$'))); + + /** Descrição da baixa */ + $note = 'Baixado via consulta Sicoob API - '.date('d/m/Y H:i:s') . ' - '.$_SESSION['USERSNAMEFIRST']; + + /** Grava a baixa de pagamento */ + if($FinancialMovements->SaveMovement($FinancialMovementsValidate->getFinancialMovementsId(), + 0, + $FinancialMovementsResult->financial_entries_id, + substr($response->resultado->listaHistorico[$i]->dataHistorico, 0, 10), + $movementValuePaid, + $note, + 0, + $movement_value_registration_tariff, + $movement_value_settlement_tariff)){ + + /** Prepara o retorno */ + $res = 'Consolidado com sucesso!'; + + + } elseif($response->resultado->situacaoBoleto == 'Baixado') { + + /** Retorna a mensagem com seu respectivo erro **/ + throw new InvalidArgumentException($response->resultado->listaHistorico[$i]->descricaoHistorico, 0); + } + + } } diff --git a/vendor/model/FinancialMovements.class.php b/vendor/model/FinancialMovements.class.php index 9b175ed..003c76a 100644 --- a/vendor/model/FinancialMovements.class.php +++ b/vendor/model/FinancialMovements.class.php @@ -52,6 +52,8 @@ class FinancialMovements private $null = null; private $delay = null; private $ourNumber = null; + private $movementValueRegistrationTariff = null; + private $movementValueSettlementTariff = null; /** Construtor da classe */ function __construct() @@ -1220,7 +1222,15 @@ class FinancialMovements } /** Atualiza uma saída/entrada */ - public function SaveMovement(int $financialMovementsId, int $financialOutputsId, int $financialEntriesId, string $movementDatePaid, float $movementValuePaid, string $note, float $movementValueFees) + public function SaveMovement(int $financialMovementsId, + int $financialOutputsId, + int $financialEntriesId, + string $movementDatePaid, + float $movementValuePaid, + string $note, + float $movementValueFees, + float $movementValueRegistrationTariff, + float $movementValueSettlementTariff) { /** Parametros de entrada */ $this->financialMovementsId = $financialMovementsId; @@ -1230,6 +1240,9 @@ class FinancialMovements $this->movementValuePaid = $movementValuePaid; $this->note = $note; $this->movementValueFees = $movementValueFees; + $this->movementValueRegistrationTariff = $movementValueRegistrationTariff; + $this->movementValueSettlementTariff = $movementValueSettlementTariff; + /** Consulta SQL */ $this->sql = "update financial_movements set movement_date_paid = :movement_date_paid, @@ -1237,6 +1250,8 @@ class FinancialMovements note = :note, movement_user_confirmed = :movement_user_confirmed, movement_value_fees = :movement_value_fees, + movement_value_registration_tariff = :movement_value_registration_tariff, + movement_value_settlement_tariff = :movement_value_settlement_tariff, status = 2 where financial_movements_id = :financial_movements_id "; @@ -1259,6 +1274,8 @@ class FinancialMovements $this->stmt->bindParam('movement_date_paid', $this->movementDatePaid); $this->stmt->bindParam('movement_value_paid', $this->movementValuePaid); $this->stmt->bindParam('movement_value_fees', $this->movementValueFees); + $this->stmt->bindParam('movement_value_registration_tariff', $this->movementValueRegistrationTariff); + $this->stmt->bindParam('movement_value_settlement_tariff', $this->movementValueSettlementTariff); $this->stmt->bindParam('note', $this->note); $this->stmt->bindParam('movement_user_confirmed', $_SESSION['USERSID']);/** Informa o usuário responsável pela movimentação cadastrada */ $this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);