Atualizando visualização dos detalhes do boleto

This commit is contained in:
Kenio 2025-08-19 20:35:54 -03:00
parent f2c4e85f61
commit c23c589e89
2 changed files with 71 additions and 2 deletions

View file

@ -72,7 +72,59 @@ try{
for($i=0; $i<count($response->resultado->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 = '<span class="badge badge-success">Consolidado com sucesso!</span>';
} elseif($response->resultado->situacaoBoleto == 'Baixado') {
/** Retorna a mensagem com seu respectivo erro **/
throw new InvalidArgumentException($response->resultado->listaHistorico[$i]->descricaoHistorico, 0);
}
}
}

View file

@ -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);