}
-var namePatt = new RegExp(/-(\d+)-/);
-formCount = null;
-
-function ajouterLigne(addLnk) {
- if (formCount == null) {
- formCount = $('.remunform').length;
- }
- var prev = addLnk.parent('td').parent('tr').prev('tr');
- var copyOfLastInGroup = prev.clone();
- copyOfLastInGroup.find('input, select, td.cumulable').each(function(i, e){
- var origName = $(e).attr('id');
- var origId = $(e).attr('id');
- $(e).attr('name', origName.replace(namePatt, '-' + formCount + '-'))
- $(e).attr('id', origId.replace(namePatt, '-' + formCount + '-'))
- $(e).val('');
- });
-
- prev.after(copyOfLastInGroup);
-
- copyOfLastInGroup.find('input, select').change(function(e){
- remun_totaux();
- });
- formCount++;
-}
-
function loadSalaire() {
var implantation = $('#implantation').val();
var devise = $('#id_devise').val();
return Math.round(n * 100) / 100;
}
-function remun_line(input) {
- var idParts = input.attr('id').split('-');
- var prefix = idParts[0] + "-" + idParts[1];
- var field = idParts[2];
-
- var montant_annuel = $('#' + prefix + '-montant');
- var montant_annuel_euros = $('#' + prefix + '-montant_annuel_euros');
-
- /* auto calcul a besoin d'un type (autrement ca devient un champs requis)*/
- // if ($('#' + prefix + '-type').val() == '') {
- // montant_annuel.val('');
- // montant_annuel_euros.val('');
- // return;
- // }
-
- value = (montant_annuel.val());
- value = roundNumber(value, 2)
-
- montant_annuel.val(roundNumber(value, 2));
-
- var devise = $('#' + prefix + '-devise').val();
- var taux = parseFloat(DEVISES[devise]);
- if (isNaN(taux)) taux = 0;
- montant_annuel_euros.text(roundNumber((value * taux), 2));
-}
-
-function totalByIndex(selector, accessor) {
- /*
- aelector: the element where to display costs, and from which the index will be calculated.
- accessor: a function to get all items that will be part of the total.
- */
- $(selector).each(function(){
- var subtot = 0;
- var i = $(this).index();
- var prevs = accessor($(this));
- prevs.each(function(){
- var cell = $($(this).children('td')[i]);
- var val;
- if (cell.children('input').length == 1) {
- val = cell.children('input').val();
- } else {
- val = cell.html();
- }
- subtot += clean_float(val);
- });
- $(this).html(roundNumber(subtot, 2));
- });
-}
-
-function remun_totaux() {
- $('#global-cost tr td.monnaie.cumulable input[type="text"], #global-cost tr td.monnaie.cumulable input[type="hidden"]').each(function() {
- remun_line($(this));
- });
- totalByIndex('#global-cost td.sous-total',
- function(x){return x.parent('tr').prevUntil(':not(.calculable)')});
- totalByIndex('#global-cost th.total',
- function(x){return x.parent('tr').prevAll('.sous-totaux')});
-}
-
-
activateDossierDropDowns();
/* Ajout des datespickers sur les inputs loadés via AJAX.
});
contrat_mois();
- /* totaux remu */
- $('#global-cost input, #global-cost select').change(function() {
- // remun_line($(this));
- remun_totaux();
- });
-
/* Ajouter une ligne aux couts globals */
/*$('#type-remun').change(function() {
var dossier_id = $('#dossier').attr('dossier');
}
});
*/
- remun_totaux();
-
- $('#global-cost .addlink').click(function(e){
- e.preventDefault();
- el = $(this);
- ajouterLigne(el);
- });
-
/* Traitement de la recherche AJAX pour les dossiers de comparaison */
$(".results_on_deck").bind('added', function() {
--- /dev/null
+var namePatt = new RegExp(/-(\d+)-/);
+formCount = null;
+
+function remun_line(input) {
+ var idParts = input.attr('id').split('-');
+ var prefix = idParts[0] + "-" + idParts[1];
+ var field = idParts[2];
+
+ var montant_annuel = $('#' + prefix + '-montant');
+ var montant_annuel_euros = $('#' + prefix + '-montant_annuel_euros');
+
+ /* auto calcul a besoin d'un type (autrement ca devient un champs requis)*/
+ // if ($('#' + prefix + '-type').val() == '') {
+ // montant_annuel.val('');
+ // montant_annuel_euros.val('');
+ // return;
+ // }
+
+ value = (montant_annuel.val());
+ value = roundNumber(value, 2)
+
+ montant_annuel.val(roundNumber(value, 2));
+
+ var devise = $('#' + prefix + '-devise').val();
+ var taux = parseFloat(DEVISES[devise]);
+ if (isNaN(taux)) taux = 0;
+ montant_annuel_euros.text(roundNumber((value * taux), 2));
+}
+
+function ajouterLigne(addLnk) {
+ if (formCount == null) {
+ formCount = $('.remunform').length;
+ }
+ var prev = addLnk.parent('td').parent('tr').prev('tr');
+ var copyOfLastInGroup = prev.clone();
+ copyOfLastInGroup.find('input, select, td.cumulable').each(function(i, e){
+ var origName = $(e).attr('id');
+ var origId = $(e).attr('id');
+ $(e).attr('name', origName.replace(namePatt, '-' + formCount + '-'))
+ $(e).attr('id', origId.replace(namePatt, '-' + formCount + '-'))
+ $(e).val('');
+ });
+
+ prev.after(copyOfLastInGroup);
+
+ copyOfLastInGroup.find('input, select').change(function(e){
+ remun_totaux();
+ });
+ formCount++;
+}
+
+
+function totalByIndex(selector, accessor) {
+ /*
+ aelector: the element where to display costs, and from which the index will be calculated.
+ accessor: a function to get all items that will be part of the total.
+ */
+ $(selector).each(function(){
+ var subtot = 0;
+ var i = $(this).index();
+ var prevs = accessor($(this));
+ prevs.each(function(){
+ var cell = $($(this).children('td')[i]);
+ var val;
+ if (cell.children('input').length == 1) {
+ val = cell.children('input').val();
+ } else {
+ val = cell.html();
+ }
+ subtot += clean_float(val);
+ });
+ $(this).html(roundNumber(subtot, 2));
+ });
+}
+
+function remun_totaux() {
+ $('#global-cost tr td.monnaie.cumulable input[type="text"], #global-cost tr td.monnaie.cumulable input[type="hidden"]').each(function() {
+ remun_line($(this));
+ });
+ totalByIndex('#global-cost td.sous-total',
+ function(x){return x.parent('tr').prevUntil(':not(.calculable)')});
+ totalByIndex('#global-cost th.total',
+ function(x){return x.parent('tr').prevAll('.sous-totaux')});
+}
+
+
+$(document).ready(function(){
+ /* totaux remu */
+ $('#global-cost input, #global-cost select').change(function() {
+ // remun_line($(this));
+ remun_totaux();
+ });
+
+ $('#global-cost .addlink').click(function(e){
+ e.preventDefault();
+ el = $(this);
+ ajouterLigne(el);
+ });
+ remun_totaux();
+
+
+});
)
RemunForm = remun_formset_factory_factory(read_only=False)
-ReadOnlyRemunForm = remun_formset_factory_factory(read_only=True)
+ReadOnlyRemunFormSet = remun_formset_factory_factory(read_only=True)
class PosteForm(forms.ModelForm):
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}jquery-autocomplete/jquery.autocomplete.css" />
<script src="{{ STATIC_URL }}js/dae.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}js/dae-embauche.js" type="text/javascript"></script>
+ <script src="{{ STATIC_URL }}js/remun.js" type="text/javascript"></script>
{% endblock %}
{% block main %}
{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/dae.css" />
<link rel="stylesheet" type="text/css" media="print" href="{{ STATIC_URL }}css/print.css" />
+ <script src="{{ STATIC_URL }}js/jquery-1.5.1.min.js"
+ type="text/javascript"></script>
+ <script type="text/javascript">
+ var DEVISES = {};
+ {% for d in devises %}
+ DEVISES['{{d.devise_code}}'] = {{d.taux_euro|stringformat:"f"}};
+ {% endfor %}
+ </script>
+ <script src="{{ STATIC_URL }}js/dae.js" type="text/javascript"></script>
+ <script src="{{ STATIC_URL }}js/remun.js" type="text/javascript"></script>
{% endblock %}
{% block main %}
<fieldset>
<table cellspacing="0" id="global-cost">
- {% include 'dae/embauche-remun-consulter.html' %}
+ {% include 'dae/embauche-remun.html' %}
</table>
+ {% comment %}
+ <!-- <table cellspacing="0" id="global-cost"> -->
+ <!-- {% include 'dae/embauche-remun-consulter.html' %} -->
+ <!-- </table> -->
+ {% endcomment %}
</fieldset>
<h2 class="section">SECTION 4 - JUSTIFICATION DE LA DEMANDE (OBLIGATOIRE)</h2>
EmployeForm, DossierForm, DossierPieceForm, \
DossierComparaisonFormSet, RemunForm, ContratForm, DAENumeriseeForm, \
label_poste_display, DAEFinaliseesSearchForm, \
- remun_formset_factory, ReadOnlyRemunForm
+ remun_formset_factory, ReadOnlyRemunFormSet
from project.dae.mail import send_drh_finalisation_mail
from project.dae.workflow import \
DOSSIER_ETAT_FINALISE, DOSSIER_ETAT_REGION_FINALISATION, \
request.user
)
comparaisons = dossier.dae_comparaisons.ma_region_ou_service(request.user)
+ remunForm = ReadOnlyRemunFormSet(instance=dossier)
return render(request, 'dae/embauche_consulter.html', {
'dossier': dossier,
+ 'devises': devises(),
'validationForm': validationForm,
'comparaisons_internes': comparaisons_internes,
'comparaisons': comparaisons,
+ 'remunForm': remunForm,
'importer': request.user.is_superuser,
})