ajouter le formulaire d'ajout , d'edution et suppression d'un RIB/IBAN

This commit is contained in:
Jean Vladimir TWAHIRWA 2016-10-12 17:17:25 +02:00
parent 6846c9934f
commit 9fd67f1c30
5 changed files with 211 additions and 3 deletions

View File

@ -1042,12 +1042,17 @@ class FinanceController extends Zend_Controller_Action
} else {
$infos = $this->getRequest()->getParam('infos');
}
$user = new Scores_Utilisateur();
$this->view->assign('edition', $user->checkModeEdition());
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('banques', $infos->result->item);
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
$this->view->assign('siren', substr($this->siret, 0, 9));
$this->view->assign('exportObjet', $infos);
$this->view->assign('siret', $this->siret);
}
/**

View File

@ -259,7 +259,7 @@ class SaisieController extends Zend_Controller_Action
$lib[$key] = $row['libPays'];
}
array_multisort($lib, SORT_ASC, SORT_STRING, $countries);
$this->countries = $countries;
$this->countries = $countries;
}
//devIso (index), devNom
@ -2902,5 +2902,48 @@ class SaisieController extends Zend_Controller_Action
$ws->setGeoCode($p);
}
}
public function ribibanAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$siren = $request->getParam('siren', null);
$mode = $request->getParam('mode');
$guichetMod = $request->getParam('guichetMod');
$banqueMod = $request->getParam('banqueMod');
$ws = new WsScores();
$result = $ws->getIdentite($siren);
$infos = $ws->getBanques($siren);
$this->view->assign('actif',$result->Actif);
$this->view->assign('siren', $siren);
$this->view->assign('mode', $mode);
$this->view->assign('banques', $infos->result->item);
$this->view->assign('guichetMod', $guichetMod);
$this->view->assign('banqueMod', $banqueMod);
}
public function ribansaveAction(){
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$codeBanque = str_replace(' ', '',$request->getParam('code_banque'));
$codeGuichet = str_replace(' ', '',$request->getParam('code_guichet'));
$numCompte = str_replace(' ', '',$request->getParam('num_compte'));
$bicSwift = str_replace(' ', '',$request->getParam('bic_swift'));
$iban = str_replace(' ', '',$request->getParam('iban'));
$mode = $request->getParam('mode');
$this->view->assign('code_banque', $guichetMod);
$this->view->assign('code_guichet', $codeGuichet);
$this->view->assign('num_compte', $numCompte);
$this->view->assign('bic_swift', $bicSwift);
$this->view->assign('iban', $iban);
}
}

View File

@ -17,6 +17,16 @@
<h2>Liste des relations bancaires</h2>
<div class="paragraph">
<?php if (empty($this->AutrePage) && $this->edition) {?>
<div style="line-height:16px;">
<a class="dialog" title="Ajouter RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'add','siren'=>$this->siren), null, true)?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/ajouter.png" /> Ajouter une autre relation bancaire</a>
</div>
<?php
}?>
<?php if(count($this->banques)>0) { ?>
<table class="data">
<thead>
@ -30,7 +40,12 @@
<tbody>
<?php foreach($this->banques as $relation) { ?>
<tr>
<td valign="top" style="text-decoration:underline;"><?=$relation->libBanque?></td>
<td valign="top" ><p style="text-decoration:underline;"><?=$relation->libBanque?></p>
<?php if (empty($this->AutrePage) && $this->edition) {?>
<a class="dialog" title="Edition RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'edit','siren'=>$this->siren, 'guichetMod'=>$relation->codeGuichet, 'banqueMod'=>$relation->codeBanque), null, true)?>"><img src="/themes/default/images/interfaces/editer.png" /></a>
<a class="dialog" title="Supprimer RIB/IBAN" href="<?=$this->url(array('controller'=>'saisie','action'=>'ribiban','mode'=>'delete','siren'=>$this->siren,'siret'=>$this->siret), null, true)?>"><img src="/themes/default/images/interfaces/supprimer.png" /></a>
<?php }?>
</td>
<td>
<?php if($relation->adresse1!='') {?>
<?=$relation->adresse1?><br />
@ -50,4 +65,33 @@
<?php } ?>
</div>
<?php echo $this->render('cgu.phtml', $this->cgu);?>
</div>
</div>
<script>
$('a.dialog').on('click', function(){
var href = $(this).attr('href');
if (href!='#') {
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 650,
height: 600,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Quitter: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
}
});
</script>

View File

@ -0,0 +1,116 @@
<style>
div#dialog form em {color:#FF0000;}
div#dialog fieldset {border:1px solid; padding:1px; }
div#dialog fieldset legend {padding:5px; font-weight:bold; }
</style>
<form name="saveRiban" action="<?=$this->url(array('controller'=>'saisie', 'action'=>'ribansave'),null, true)?>" method="post">
<?php if($this->mode == add || $this->mode == edit){?>
<input type="hidden" name="mode" value="<?=$this->mode?>" />
<input type="hidden" name="siren" value="<?=$this->siren?>" />
<div class="fieldgrp">
<label>Siren</label>
<div class="field">
<div style="float:left;"><?=$this->siren?></div>
</div>
</div>
<div class="fieldgrp">
<label>Situation RIB</label>
<div class="field">
<?php
if ($this->actif==1){
$checkActive = 'checked';
} else {
$checkInactive = 'checked';
}
?>
<div style="float:left;">Active<input type="radio" name="actif" value="1" <?=$checkActive;?>/></div>
<div style="float:left;">Inactive<input type="radio" name="actif" value="0" <?=$checkInactive;?>/></div>
</div>
</div>
<div class="fieldgrp">
<fieldset>
<legend>Saisie RIB</legend>
<div class="fieldgrp">
<label>Banque</label>
<div class="field" >
<select name="Banque" style="width:160px;" >
<option value=""><?=$this->banqueMod?></option>
<?php foreach( $this->banques as $val ) {?>
<option value="<?=$val->codeBanque?>"><?=$val->codeBanque?></option>
<?php }?>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Guichet</label>
<div class="field" >
<select name="Guichet" style="width:160px;" >
<option value=""><?=$this->guichetMod?></option>
<?php foreach( $this->banques as $val ) {?>
<option value="<?=$val->codeGuichet?>"><?=$val->codeGuichet?></option>
<?php }?>
</select>
</div>
</div>
<div class="fieldgrp">
<label>RIB</label>
<div class="field">
<input type="text" name="code_banque" size="4" value=""/>
<input type="text" name="code_guichet" size="4" value=""/>
<input type="text" name="num_compte" size="32" value=""/>
</div>
</div>
</fieldset>
</div>
<div class="fieldgrp">
<fieldset>
<legend>Saisie BIC/IBAN</legend>
<div class="fieldgrp">
<label>BIC/SWIFT</label>
<div class="field">
<input type="text" name="bic_swift" value="" size="20"/>
</div>
</div>
<div class="fieldgrp">
<label>IBAN</label>
<div class="field">
<input type="text" name="iban" value="" size="47"/>
</div>
</div>
</fieldset>
<?php }else {?>
<p>Voulez vous supprimer ce RIB ?</p>
<?php }?>
</form>
<script>
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() {
var form = $('form[name=saveRiban]');
$.post(form.attr('action'), form.serialize(), function(data){
form.replaceWith(data);
}).fail(function(){ alert('Unknow error'); });
} },
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
] });
</script>