2018-05-04 17:57:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
?><form action="" method="post" id="edit-form">
|
|
|
|
<input type="hidden" name="op" value="editriga">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="id_record" value="<?php echo $id_record; ?>">
|
2018-07-18 15:20:10 +02:00
|
|
|
<input type="hidden" name="idmastrino" value="<?php echo $record['idmastrino']; ?>">
|
|
|
|
<input type="hidden" name="iddocumento" value="<?php echo $record['iddocumento']; ?>">
|
2018-05-04 17:57:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{[ "type": "text", "label": "<?php echo tr('Causale predefinita'); ?>", "name": "descrizione", "required": 1, "value": "$descrizione$" ]}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
<?php
|
2018-05-04 17:57:46 +02:00
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
$conti3 = []; // contenitore conti di terzo livello
|
2018-07-18 15:20:10 +02:00
|
|
|
$idmastrino = $record['idmastrino'];
|
2018-05-04 17:57:46 +02:00
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
// Salvo l'elenco conti in un array (per non fare il ciclo ad ogni riga)
|
|
|
|
$query2 = 'SELECT * FROM co_pianodeiconti2';
|
|
|
|
$conti2 = $dbo->fetchArray($query2);
|
|
|
|
for ($x = 0; $x < sizeof($conti2); ++$x) {
|
|
|
|
$query3 = 'SELECT * FROM co_pianodeiconti3 WHERE idpianodeiconti2='.prepare($conti2[$x]['id']);
|
|
|
|
$rs3 = $dbo->fetchArray($query3);
|
|
|
|
for ($y = 0; $y < sizeof($rs3); ++$y) {
|
|
|
|
// Creo un array con le descrizioni dei conti di livello 3 che ha come indice l'id del livello2 e del livello3
|
|
|
|
$conti3[$rs3[$y]['idpianodeiconti2']][$y]['id'] = $rs3[$y]['id'];
|
|
|
|
$conti3[$rs3[$y]['idpianodeiconti2']][$y]['descrizione'] = $conti2[$x]['numero'].'.'.$rs3[$y]['numero'].' '.$rs3[$y]['descrizione'];
|
2018-05-04 17:57:46 +02:00
|
|
|
}
|
2018-06-23 18:35:08 +02:00
|
|
|
}
|
2018-05-04 17:57:46 +02:00
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
/*
|
|
|
|
Form di modifica riga movimento
|
|
|
|
*/
|
|
|
|
echo '
|
2018-05-04 17:57:46 +02:00
|
|
|
<table class="table table-striped table-condensed table-hover table-bordered"
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Conto').'</th>
|
|
|
|
</tr>';
|
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
// Lettura movimenti del mastrino selezionato
|
2018-07-18 15:20:10 +02:00
|
|
|
$rs = $dbo->fetchArray('SELECT * FROM co_movimenti_modelli WHERE idmastrino='.prepare($record['idmastrino']));
|
2018-06-23 18:35:08 +02:00
|
|
|
for ($i = 0; $i < 10; ++$i) {
|
|
|
|
$required = ($i <= 1) ? 1 : 0;
|
|
|
|
|
|
|
|
// Conto
|
|
|
|
echo '
|
2018-05-04 17:57:46 +02:00
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
{[ "type": "select", "name": "idconto['.$i.']", "value": "'.$rs[$i]['idconto'].'", "ajax-source": "conti", "required": "'.$required.'" ]}
|
2018-06-23 18:35:08 +02:00
|
|
|
</td>
|
2018-05-04 17:57:46 +02:00
|
|
|
</tr>';
|
2018-06-23 18:35:08 +02:00
|
|
|
}
|
2018-05-04 17:57:46 +02:00
|
|
|
|
2018-06-23 18:35:08 +02:00
|
|
|
echo '
|
2018-05-04 17:57:46 +02:00
|
|
|
</table>';
|
2018-06-23 18:35:08 +02:00
|
|
|
?>
|
2018-05-04 17:57:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready( function(){
|
|
|
|
$('select').on('change', function(){
|
|
|
|
if($(this).parent().parent().find('input[disabled]').length != 1){
|
|
|
|
if($(this).val()) {
|
|
|
|
$(this).parent().parent().find('input').prop("disabled", false);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$(this).parent().parent().find('input').prop("disabled", true);
|
|
|
|
$(this).parent().parent().find('input').val("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2018-06-23 18:35:08 +02:00
|
|
|
|
2018-05-04 17:57:46 +02:00
|
|
|
</form>
|
|
|
|
|
2018-07-18 15:20:10 +02:00
|
|
|
<a class="btn btn-danger ask" data-backto="record-list" data-idmastrino="<?php echo $record['idmastrino']; ?>">
|
2018-05-04 17:57:46 +02:00
|
|
|
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
|
|
|
</a>
|