+ Fix bug when make savings

This commit is contained in:
Djery-Tom 2020-11-07 15:23:42 +01:00
parent 80ccf453c4
commit 8dbdf2bee1
1 changed files with 4 additions and 2 deletions

View File

@ -220,7 +220,8 @@ class NanoCreditController extends Controller
// Demandes de credits en cours pour le remboursement // Demandes de credits en cours pour le remboursement
public function getNanoCreditsDemandsInProgress($id_user) public function getNanoCreditsDemandsInProgress($id_user)
{ {
$demandes = DB::select("SELECT i.montant , i.user as destinataire, i.* FROM infos_users_demandes_credits i WHERE i.id_user = :id AND i.etat = 'VALIDE' ORDER BY date_creation DESC;", ['id' => $id_user]); $demandes = DB::select("SELECT id_demande , montant , type_caution , montant_rembourse ,partiellement_rembourse , duree_mois , etat , interet , taxe , date_validation ,date_remboursement_prevu,
retrait_cash , agent , date_creation FROM infos_users_demandes_credits i WHERE i.id_user = :id AND i.etat = 'VALIDE' ORDER BY date_creation DESC;", ['id' => $id_user]);
$result = array_map(function ($demand) { $result = array_map(function ($demand) {
$demand->etat = str_replace('_', ' ', $demand->etat); $demand->etat = str_replace('_', ' ', $demand->etat);
return $demand; return $demand;
@ -252,7 +253,7 @@ class NanoCreditController extends Controller
// Demandes d'epargnes pour la cassation // Demandes d'epargnes pour la cassation
public function getSavingsDemandsInProgress($id_user) public function getSavingsDemandsInProgress($id_user)
{ {
$savings = DB::select("SELECT i.montant , i.user as destinataire, i.* FROM infos_users_epargnes i WHERE i.id_user = :id AND i.etat = 'EN_COURS' ORDER BY i.date_creation DESC;", ['id' => $id_user]); $savings = DB::select("SELECT id_epargne , montant, etat, i.type , duree_mois , interet , taxe , date_creation , date_fin FROM infos_users_epargnes i WHERE i.id_user = :id AND i.etat = 'EN_COURS' ORDER BY i.date_creation DESC;", ['id' => $id_user]);
$result = array_map(function ($demand) { $result = array_map(function ($demand) {
$demand->etat = str_replace('_', ' ', $demand->etat); $demand->etat = str_replace('_', ' ', $demand->etat);
return $demand; return $demand;
@ -465,6 +466,7 @@ class NanoCreditController extends Controller
$saving->interet = 0; $saving->interet = 0;
$saving->taxe = 0; $saving->taxe = 0;
$saving->type = 'SIMPLE'; $saving->type = 'SIMPLE';
$saving->duree_mois = null;
} }
$walletHyper = WalletAgent::where('category', 'hyper')->where('network_id', $config->id_network)->firstOrFail(); $walletHyper = WalletAgent::where('category', 'hyper')->where('network_id', $config->id_network)->firstOrFail();