193 lines
6.6 KiB
PHTML

<style>
.editable { background-color:#30A5FF; }
.editable-error { background-color:#FF0000; }
.editable-change { background-color:#89FF30; }
span.unit select { width:50px; }
span.poste { min-width:50px; color:black; display:block; width:100%; }
span.poste input { width:50px; }
</style>
<div id="center">
<?php if ($message!='') {?>
<div style="margin:5px; padding: 0pt 0.7em;" class="ui-state-highlight ui-corner-all">
<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
<?=$message?></p>
</div>
<?php } ?>
<h1 class="titre">Saisie ou Correction Liasse</h1>
<div class="paragraph">
<div class="clearfix">
<label>Num&eacute;ro identifiant Siret</label>
<?=$this->SiretTexte($this->siret)?>
</div>
<div class="clearfix">
<label>Raison Sociale</label>
<?=$this->raisonSociale?>
</div>
</div>
<h2>Liasse</h2>
<div class="paragraph">
<?php if ($this->infos) {?>
<div class="content">
<?php
if ($this->typeBilan=='N' || $this->typeBilan=='C') {
echo $this->partial('saisie/liasse/2050.phtml');
} elseif ($this->typeBilan=='S') {
echo $this->partial('saisie/liasse/2033.phtml');
}
?>
</div>
<div id="saveMsg" style="text-align:center;"></div>
<div style="text-align:center;">
<input type="submit" class="button" id=onlycheck name="onlycheck" value="Verifier" />
<input type="submit" class="button" id="normal" name="normal" value="Publier" />
<input style="display:none;" type="submit" class="button" id="nocheck" name="nocheck" value="Forcer" />
</div>
<?=$this->partial()->view->inlineScript();?>
<script>
$(document).ready(function(){
$.datepicker.setDefaults( $.datepicker.regional['fr'] );
});
$('span.unit').editable(function(value, settings) {
return value;
}, {
data : "{'U':'&euro;','K':'K&euro;','M':'M&euro;'}",
type : 'select',
tooltip : 'Click to edit',
});
$('input.dateCloture').datepicker();
$('span.duree').editable(function(value, settings) {
if ( isFloat(value) && value.length<3 ) {
$(this).addClass('editable-change');
return value;
}
}, {
data : "{'1':'1','2':'2','3':'3','4':'4','5':'5','6':'6','7':'7','8':'8','9':'9','10':'10','11':'11','12':'12','13':'13','14':'14','15':'15','16':'16','17':'17','18':'18','19':'19','20':'20','21':'21','22':'22','23':'23'}",
type : 'select',
tooltip : 'Click to edit',
});
$('span.poste').editable(function(value, settings) {
var id = $(this).attr('id')
if ( isFloat(value) && id!=value ) {
$(this).addClass('editable-change');
return value;
}
$(this).removeClass('editable-change').addClass('editable');
return id;
}, {
tooltip : 'Click to edit',
}).click(function(){ $(this).find('input').select(); });
$('span.poste').bind('keydown', function(e) {
if(e.keyCode==9 || e.keyCode==13) {
$(this).find('form').submit();
var nextBox='';
var currentBoxIndex=$('span.poste').index(this);
if (currentBoxIndex == ($('span.poste').length-1)) {
nextBox=$('span.poste:first'); //last box, go to first
} else {
nextBox=$('span.poste').eq(currentBoxIndex+1); //Next box in line
}
$(this).find('input').blur();
$(nextBox).click().find('input').select(); //Go to assigned next box
return false; //Suppress normal keypress
};
});
$('input#onlycheck').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Vérification en cours....');
sendInfo('onlycheck');
});
$('input#normal').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Enregistrement en cours....');
sendInfo('normal');
});
$('input#nocheck').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Enregistrement en cours....');
sendInfo('nocheck');
});
function sendInfo(step)
{
$('input#'+step).css('display', 'none');
var strPostes = '';
$('span.poste').each(function(){
id = $(this).attr('id');
val = $(this).html();
if (val != id && val != '' && val != '-') {
if (strPostes!='') strPostes = strPostes + ';';
strPostes = strPostes + id + '=' + val;
}
});
$.post('/saisie/liassesave/siren/<?=$this->siren?>', {
step: step,
unite: $('span#unit').html(),
dateCloture: $('input#dateCloture').val(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('input#dateCloturePre').val(),
dureeMoisPre: $('span#dureeMoisPre').html(),
typeBilan: $('span#typeBilan').html(),
postes: strPostes
}, function(data) {
$('span.editable-error').addClass('editable-change').removeClass('editable-error');
if (data.status=='OK') {
var msg = 'Bilan saisie.';
if (step == 'onlycheck') {
msg = 'Vérification OK.';
$('input#'+step).css('display', 'block');
}
$('div#saveMsg').html('Bilan saisie.');
} else {
var msg='Unknow Error';
if (data.status=='ERR') {
if (data.postes.length>0) {
for (i in data.postes) {
$('span#'+data.postes[i]).removeClass('editable-change').addClass('editable-error');
}
var offset = $('span#'+data.postes[i]).offset();
window.scrollTo(window.scrollX, offset.top);
}
msg=data.message;
}
$('div#saveMsg').html(msg);
if (step=='normal') { $('input#nocheck').css('display', 'inline'); }
$('input#'+step).css('display', 'inline');
}
}, 'json'
).error(function(){
$('div#saveMsg').html('Error Timeout');
$('input#'+step).css('display', 'block');
});
}
function isInteger(number)
{
var exp = new RegExp("^[\-0-9]+$","g");
return exp.test(number);
}
function isFloat(number)
{
var exp = new RegExp("^[\-0-9\.]+$","g");
return exp.test(number);
}
</script>
<?php } else {?>
Aucune sélection.
<?php }?>
</div>
</div>