192 lines
6.2 KiB
PHTML
Raw Normal View History

2012-09-21 10:13:07 +00:00
<style>
.editable { background-color:#30A5FF; }
.editable-error { background-color:#FF0000; }
.editable-change { background-color:#89FF30; }
span.unit select { width:50px; }
span.poste { color:black; display:block; width:100%; }
span.poste input { width:50px; }
</style>
2012-06-08 13:18:09 +00:00
<div id="center">
2012-09-13 14:43:14 +00:00
<?php if ($message!='') {?>
2012-06-08 13:18:09 +00:00
<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">
2012-09-13 14:43:14 +00:00
<div class="clearfix">
2012-06-08 13:18:09 +00:00
<label>Num&eacute;ro identifiant Siret</label>
<?=$this->SiretTexte($this->siret)?>
</div>
<div class="clearfix">
<label>Raison Sociale</label>
<?=$this->raisonSociale?>
</div>
2012-09-13 14:43:14 +00:00
</div>
<div class="paragraph">
<?php if ($this->infos) {?>
<div class="tabbed_area">
<ul class="tabs">
<?php foreach ($this->ancres as $id => $name):?>
<li><a href="#<?=$id?>" title="<?=$name?>" class="tab"><?=$name?></a></li>
<?php endforeach;?>
</ul>
</div>
<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>
2012-09-21 19:40:45 +00:00
<div style="text-align:center;">
<input type="button" class="button" id=onlycheck name="onlycheck" value="Verifier" />
<input type="submit" class="button" id="normal" name="normal" value="Enregistrer" />
<input style="display:none;" type="button" class="button" id="nocheck" name="nocheck" value="Forcer" />
</div>
<?=$this->partial()->view->inlineScript();?>
2012-09-13 14:43:14 +00:00
<script>
$('span.unit').editable(function(value, settings) {
return value;
}, {
data : " {'U':'&euro;','K':'K&euro;','M':'M&euro;'}",
type : 'select',
tooltip : 'Click to edit',
});
$('span.dateCloture').editable(function(value, settings) {
if ( isInteger(value) && value.length==8 ) {
$(this).addClass('editable-change');
return value;
}
return 'AAAAMMJJ';
}, {
tooltip : 'Click to edit',
});
$('span.duree').editable(function(value, settings) {
if ( isInteger(value) && value.length<3 ) {
$(this).addClass('editable-change');
return value;
}
}, {
tooltip : 'Click to edit',
});
$('span.poste').editable(function(value, settings) {
var id = $(this).attr('id')
if ( isInteger(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
};
});
2012-09-21 19:40:45 +00:00
$('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: $('span#dateCloture').html(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('span#dateCloturePre').html(),
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.';
}
$('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');
}
}
msg=data.message;
}
$('div#saveMsg').html(msg);
$('input#'+step).css('display', 'block');
}
}, '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);
}
2012-09-13 14:43:14 +00:00
</script>
<?php } else {?>
Aucune sélection.
<?php }?>
</div>
2012-06-08 13:18:09 +00:00
</div>