mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-04-18 03:47:21 +02:00
Modifiche modulo Piano dei conti
This commit is contained in:
parent
01b07e2d27
commit
800e0013ef
@ -229,4 +229,23 @@ switch (post('op')) {
|
|||||||
co_movimenti.data BETWEEN '.prepare($start).' AND '.prepare($end));
|
co_movimenti.data BETWEEN '.prepare($start).' AND '.prepare($end));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'search':
|
||||||
|
$text = post('text');
|
||||||
|
$id_conti2 = 0;
|
||||||
|
$id_conti3 = 0;
|
||||||
|
|
||||||
|
if (!empty($text)) {
|
||||||
|
$id_conti = $dbo->fetchArray('SELECT id AS idpianodeiconti2 FROM co_pianodeiconti2 WHERE descrizione LIKE '.prepare('%'.$text.'%'));
|
||||||
|
$id_conti2 = array_column($id_conti, 'idpianodeiconti2');
|
||||||
|
|
||||||
|
$id_conti = $dbo->fetchArray('SELECT id AS idpianodeiconti3, idpianodeiconti2 FROM co_pianodeiconti3 WHERE descrizione LIKE '.prepare('%'.$text.'%'));
|
||||||
|
|
||||||
|
$id_conti3 = array_column($id_conti, 'idpianodeiconti3');
|
||||||
|
$id_conti2_3 = array_column($id_conti, 'idpianodeiconti2');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(['conti2' => $id_conti2, 'conti3' => $id_conti3, 'conti2_3' => $id_conti2_3]);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
235
modules/partitario/dettagli_conto2.php
Normal file
235
modules/partitario/dettagli_conto2.php
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
$id_conto = get('id_conto');
|
||||||
|
$conto_secondo = $dbo->selectOne('co_pianodeiconti2', '*', ['id' => $id_conto]);
|
||||||
|
$conto_primo = $dbo->selectOne('co_pianodeiconti1', '*', ['id' => $conto_secondo['idpianodeiconti1']]);
|
||||||
|
|
||||||
|
// Livello 3
|
||||||
|
$query3 = 'SELECT `co_pianodeiconti3`.*, movimenti.numero_movimenti, movimenti.totale, movimenti.totale_reddito, anagrafica.idanagrafica, anagrafica.deleted_at
|
||||||
|
FROM `co_pianodeiconti3`
|
||||||
|
LEFT OUTER JOIN (
|
||||||
|
SELECT idanagrafica,
|
||||||
|
idconto_cliente,
|
||||||
|
idconto_fornitore,
|
||||||
|
deleted_at
|
||||||
|
FROM an_anagrafiche
|
||||||
|
) AS anagrafica ON co_pianodeiconti3.id IN (anagrafica.idconto_cliente, anagrafica.idconto_fornitore)
|
||||||
|
LEFT OUTER JOIN (
|
||||||
|
SELECT COUNT(idconto) AS numero_movimenti,
|
||||||
|
idconto,
|
||||||
|
SUM(totale) AS totale,
|
||||||
|
SUM(totale_reddito) AS totale_reddito
|
||||||
|
FROM co_movimenti
|
||||||
|
WHERE data BETWEEN '.prepare($_SESSION['period_start']).' AND '.prepare($_SESSION['period_end']).' GROUP BY idconto
|
||||||
|
) movimenti ON co_pianodeiconti3.id=movimenti.idconto
|
||||||
|
WHERE `idpianodeiconti2` = '.prepare($conto_secondo['id']).' ORDER BY numero ASC';
|
||||||
|
|
||||||
|
$terzo_livello = $dbo->fetchArray($query3);
|
||||||
|
|
||||||
|
if (!empty($terzo_livello)) {
|
||||||
|
echo '
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-hover table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>'.tr('Descrizione').'</th>
|
||||||
|
<th style="width: 10%" class="text-center">'.tr('Importo').'</th>';
|
||||||
|
if ($conto_primo['descrizione'] == 'Economico') {
|
||||||
|
echo '
|
||||||
|
<th style="width: 10%" class="text-center">'.tr('Importo reddito').'</th>';
|
||||||
|
}
|
||||||
|
echo '
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>';
|
||||||
|
foreach ($terzo_livello as $conto_terzo) {
|
||||||
|
// Se il conto non ha documenti collegati posso eliminarlo
|
||||||
|
$numero_movimenti = $conto_terzo['numero_movimenti'];
|
||||||
|
|
||||||
|
$totale_conto = $conto_terzo['totale'];
|
||||||
|
$totale_reddito = $conto_terzo['totale_reddito'];
|
||||||
|
if ($conto_primo['descrizione'] != 'Patrimoniale') {
|
||||||
|
$totale_conto = -$totale_conto;
|
||||||
|
$totale_reddito = -$totale_reddito;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totale_conto2 += $totale_conto;
|
||||||
|
$totale_reddito2 += $totale_reddito;
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<tr class="conto3" id="conto3-'.$conto_terzo['id'].'" style="'.(!empty($numero_movimenti) ? '' : 'opacity: 0.5;').'">
|
||||||
|
<td>';
|
||||||
|
|
||||||
|
// Possibilità di esplodere i movimenti del conto
|
||||||
|
if (!empty($numero_movimenti)) {
|
||||||
|
echo '
|
||||||
|
<button type="button" id="movimenti-'.$conto_terzo['id'].'" class="btn btn-default btn-xs plus-btn"><i class="fa fa-plus"></i></button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Span con i pulsanti
|
||||||
|
echo '
|
||||||
|
<span class="hide tools pull-right">';
|
||||||
|
|
||||||
|
// Possibilità di visionare l'anagrafica
|
||||||
|
$id_anagrafica = $conto_terzo['idanagrafica'];
|
||||||
|
$anagrafica_deleted = $conto_terzo['deleted_at'];
|
||||||
|
if (isset($id_anagrafica)) {
|
||||||
|
echo Modules::link('Anagrafiche', $id_anagrafica, ' <i title="'.(isset($anagrafica_deleted) ? tr('Anagrafica eliminata') : tr('Visualizza anagrafica')).'" class="btn btn-'.(isset($anagrafica_deleted) ? 'danger' : 'primary').' btn-xs fa fa-user" ></i>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stampa mastrino
|
||||||
|
if (!empty($numero_movimenti)) {
|
||||||
|
echo '
|
||||||
|
'.Prints::getLink('Mastrino', $conto_terzo['id'], 'btn-info btn-xs', '', null, 'lev=3');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pulsante per aggiornare il totale reddito del conto di livello 3
|
||||||
|
echo '
|
||||||
|
<button type="button" class="btn btn-info btn-xs" onclick="aggiornaReddito('.$conto_terzo['id'].')">
|
||||||
|
<i class="fa fa-refresh"></i>
|
||||||
|
</button>';
|
||||||
|
|
||||||
|
// Pulsante per modificare il nome del conto di livello 3
|
||||||
|
echo '
|
||||||
|
<button type="button" class="btn btn-warning btn-xs" onclick="modificaConto('.$conto_terzo['id'].')">
|
||||||
|
<i class="fa fa-edit"></i>
|
||||||
|
</button>';
|
||||||
|
|
||||||
|
// Possibilità di eliminare il conto se non ci sono movimenti collegati
|
||||||
|
if ($numero_movimenti <= 0) {
|
||||||
|
echo '
|
||||||
|
<a class="btn btn-danger btn-xs ask" data-toggle="tooltip" title="'.tr('Elimina').'" data-backto="record-list" data-op="del" data-idconto="'.$conto_terzo['id'].'">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</span>';
|
||||||
|
|
||||||
|
// Span con info del conto
|
||||||
|
echo '
|
||||||
|
<span class="clickable" id="movimenti-'.$conto_terzo['id'].'">
|
||||||
|
'.$conto_secondo['numero'].'.'.$conto_terzo['numero'].' '.$conto_terzo['descrizione'].($conto_terzo['percentuale_deducibile'] < 100 ? ' <span class="text-muted">('.tr('deducibile al _PERC_%', ['_PERC_' => Translator::numberToLocale($conto_terzo['percentuale_deducibile'], 0)]).')</span>' : '').'
|
||||||
|
</span>
|
||||||
|
<div id="conto_'.$conto_terzo['id'].'" style="display:none;"></div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-right">
|
||||||
|
'.moneyFormat($totale_conto, 2).'
|
||||||
|
</td>';
|
||||||
|
if ($conto_primo['descrizione'] == 'Economico') {
|
||||||
|
echo '
|
||||||
|
<td class="text-right">
|
||||||
|
'.moneyFormat($totale_reddito, 2).'
|
||||||
|
</td>';
|
||||||
|
}
|
||||||
|
echo '
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '
|
||||||
|
<br><span>'.tr('Nessun conto presente').'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($terzo_livello)) {
|
||||||
|
echo '
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr class="totali">
|
||||||
|
<th class="text-right">'.tr('Totale').'</th>
|
||||||
|
<th class="text-right">'.moneyFormat($totale_conto2).'</th>';
|
||||||
|
if ($conto_primo['descrizione'] == 'Economico') {
|
||||||
|
echo ' <th class="text-right">'.moneyFormat($totale_reddito2).'</th>';
|
||||||
|
}
|
||||||
|
echo '
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<br><br>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("tr").each(function() {
|
||||||
|
$(this).on("mouseover", function() {
|
||||||
|
$(this).find(".tools").removeClass("hide");
|
||||||
|
});
|
||||||
|
|
||||||
|
$(this).on("mouseleave", function() {
|
||||||
|
$(this).find(".tools").addClass("hide");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("span[id^=movimenti-]").each(function() {
|
||||||
|
$(this).unbind().on("click", function() {
|
||||||
|
let movimenti = $(this).parent().find("div[id^=conto_]");
|
||||||
|
|
||||||
|
if(!movimenti.html()) {
|
||||||
|
let id_conto = $(this).attr("id").split("-").pop();
|
||||||
|
|
||||||
|
caricaMovimenti(movimenti.attr("id"), id_conto);
|
||||||
|
} else {
|
||||||
|
movimenti.slideToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("button[id^=movimenti-]").each(function() {
|
||||||
|
$(this).unbind().on("click", function() {
|
||||||
|
let movimenti = $(this).parent().find("div[id^=conto_]");
|
||||||
|
|
||||||
|
if(!movimenti.html()) {
|
||||||
|
let id_conto = $(this).attr("id").split("-").pop();
|
||||||
|
|
||||||
|
caricaMovimenti(movimenti.attr("id"), id_conto);
|
||||||
|
} else {
|
||||||
|
movimenti.slideToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
function caricaMovimenti(selector, id_conto) {
|
||||||
|
$("#main_loading").show();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "'.$structure->fileurl('dettagli_conto3.php').'",
|
||||||
|
type: "get",
|
||||||
|
data: {
|
||||||
|
id_module: globals.id_module,
|
||||||
|
id_conto: id_conto,
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
$("#" + selector).html(data)
|
||||||
|
.slideToggle();
|
||||||
|
|
||||||
|
$("#main_loading").fadeOut();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>';
|
0
modules/partitario/dettagli_conto.php → modules/partitario/dettagli_conto3.php
Executable file → Normal file
0
modules/partitario/dettagli_conto.php → modules/partitario/dettagli_conto3.php
Executable file → Normal file
@ -32,10 +32,16 @@ if ($bilancio_gia_aperto) {
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-offset-4 col-md-4">
|
<div class="col-md-offset-4 col-md-3">
|
||||||
<input type="text" class="form-control input-lg text-center" id="input-cerca" placeholder="'.tr('Cerca').'...">
|
<input type="text" class="form-control input-lg text-center" id="input-cerca" placeholder="'.tr('Cerca').'...">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-1">
|
||||||
|
<button type="button" class="btn btn-lg btn-primary" id="button-search">
|
||||||
|
<i class="fa fa-search"></i> '.tr('Cerca').'
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4 text-right">
|
<div class="col-md-4 text-right">
|
||||||
<button type="button" class="btn btn-lg '.$btn_class.'" data-op="apri-bilancio" data-title="'.tr('Apertura bilancio').'" data-backto="record-list" data-msg="'.$msg.'" data-button="'.tr('Riprendi saldi').'" data-class="btn btn-lg btn-warning" onclick="message( this );">
|
<button type="button" class="btn btn-lg '.$btn_class.'" data-op="apri-bilancio" data-title="'.tr('Apertura bilancio').'" data-backto="record-list" data-msg="'.$msg.'" data-button="'.tr('Riprendi saldi').'" data-class="btn btn-lg btn-warning" onclick="message( this );">
|
||||||
<i class="fa fa-folder-open"></i> '.tr('Apertura bilancio').'
|
<i class="fa fa-folder-open"></i> '.tr('Apertura bilancio').'
|
||||||
@ -75,161 +81,31 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
|
|
||||||
foreach ($secondo_livello as $conto_secondo) {
|
foreach ($secondo_livello as $conto_secondo) {
|
||||||
// Livello 2
|
// Livello 2
|
||||||
|
$totale_conto2 = $dbo->fetchOne('SELECT SUM(-totale) AS totale FROM `co_movimenti` INNER JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id WHERE idconto IN(SELECT id FROM co_pianodeiconti3 WHERE idpianodeiconti2='.prepare($conto_secondo['id']).') AND co_movimenti.data>='.prepare($_SESSION['period_start']).' AND co_movimenti.data<='.prepare($_SESSION['period_end']))['totale'];
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="conto2">
|
<div class="conto2" id="conto2-'.$conto_secondo['id'].'">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
|
<b>'.moneyFormat($totale_conto2, 2).'</b>  
|
||||||
'.Prints::getLink('Mastrino', $conto_secondo['id'], 'btn-info btn-xs', '', null, 'lev=2').'
|
'.Prints::getLink('Mastrino', $conto_secondo['id'], 'btn-info btn-xs', '', null, 'lev=2').'
|
||||||
|
|
||||||
<button type="button" class="btn btn-warning btn-xs" onclick="modificaConto('.$conto_secondo['id'].', 2)">
|
<button type="button" class="btn btn-warning btn-xs" onclick="modificaConto('.$conto_secondo['id'].', 2)">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5>
|
|
||||||
<b>'.$conto_secondo['numero'].' '.$conto_secondo['descrizione'].'</b>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" data-toggle="tooltip" title="'.tr('Aggiungi un nuovo conto...').'" onclick="aggiungiConto('.$conto_secondo['id'].')">
|
<button type="button" class="btn btn-xs btn-primary" data-toggle="tooltip" title="'.tr('Aggiungi un nuovo conto...').'" onclick="aggiungiConto('.$conto_secondo['id'].')">
|
||||||
<i class="fa fa-plus-circle"></i>
|
<i class="fa fa-plus-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h5>
|
||||||
|
<button type="button" id="conto3-'.$conto_secondo['id'].'" class="btn btn-default btn-xs plus-btn search"><i class="fa fa-plus"></i></button>
|
||||||
|
<span class="clickable" id="conto3-'.$conto_secondo['id'].'">
|
||||||
|
<b>'.$conto_secondo['numero'].' '.$conto_secondo['descrizione'].'</b>
|
||||||
|
</span>
|
||||||
|
<div id="conto2_'.$conto_secondo['id'].'" style="display:none;"></div>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-hover table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>'.tr('Descrizione').'</th>
|
|
||||||
<th style="width: 10%" class="text-center">'.tr('Importo').'</th>';
|
|
||||||
if ($conto_primo['descrizione'] == 'Economico') {
|
|
||||||
echo '
|
|
||||||
<th style="width: 10%" class="text-center">'.tr('Importo reddito').'</th>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>';
|
|
||||||
|
|
||||||
// Livello 3
|
|
||||||
$query3 = 'SELECT `co_pianodeiconti3`.*, movimenti.numero_movimenti, movimenti.totale, movimenti.totale_reddito, anagrafica.idanagrafica, anagrafica.deleted_at
|
|
||||||
FROM `co_pianodeiconti3`
|
|
||||||
LEFT OUTER JOIN (
|
|
||||||
SELECT idanagrafica,
|
|
||||||
idconto_cliente,
|
|
||||||
idconto_fornitore,
|
|
||||||
deleted_at
|
|
||||||
FROM an_anagrafiche
|
|
||||||
) AS anagrafica ON co_pianodeiconti3.id IN (anagrafica.idconto_cliente, anagrafica.idconto_fornitore)
|
|
||||||
LEFT OUTER JOIN (
|
|
||||||
SELECT COUNT(idconto) AS numero_movimenti,
|
|
||||||
idconto,
|
|
||||||
SUM(totale) AS totale,
|
|
||||||
SUM(totale_reddito) AS totale_reddito
|
|
||||||
FROM co_movimenti
|
|
||||||
WHERE data BETWEEN '.prepare($_SESSION['period_start']).' AND '.prepare($_SESSION['period_end']).' GROUP BY idconto
|
|
||||||
) movimenti ON co_pianodeiconti3.id=movimenti.idconto
|
|
||||||
WHERE `idpianodeiconti2` = '.prepare($conto_secondo['id']).' ORDER BY numero ASC';
|
|
||||||
$terzo_livello = $dbo->fetchArray($query3);
|
|
||||||
foreach ($terzo_livello as $conto_terzo) {
|
|
||||||
// Se il conto non ha documenti collegati posso eliminarlo
|
|
||||||
$numero_movimenti = $conto_terzo['numero_movimenti'];
|
|
||||||
|
|
||||||
$totale_conto = $conto_terzo['totale'];
|
|
||||||
$totale_reddito = $conto_terzo['totale_reddito'];
|
|
||||||
if ($conto_primo['descrizione'] != 'Patrimoniale') {
|
|
||||||
$totale_conto = -$totale_conto;
|
|
||||||
$totale_reddito = -$totale_reddito;
|
|
||||||
}
|
|
||||||
|
|
||||||
$totale_conto2 += $totale_conto;
|
|
||||||
$totale_reddito2 += $totale_reddito;
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr class="conto3" style="'.(!empty($numero_movimenti) ? '' : 'opacity: 0.5;').'">
|
|
||||||
<td>';
|
|
||||||
|
|
||||||
// Possibilità di esplodere i movimenti del conto
|
|
||||||
if (!empty($numero_movimenti)) {
|
|
||||||
echo '
|
|
||||||
<button type="button" id="movimenti-'.$conto_terzo['id'].'" class="btn btn-default btn-xs plus-btn"><i class="fa fa-plus"></i></button>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Span con i pulsanti
|
|
||||||
echo '
|
|
||||||
<span class="hide tools pull-right">';
|
|
||||||
|
|
||||||
// Possibilità di visionare l'anagrafica
|
|
||||||
$id_anagrafica = $conto_terzo['idanagrafica'];
|
|
||||||
$anagrafica_deleted = $conto_terzo['deleted_at'];
|
|
||||||
if (isset($id_anagrafica)) {
|
|
||||||
echo Modules::link('Anagrafiche', $id_anagrafica, ' <i title="'.(isset($anagrafica_deleted) ? tr('Anagrafica eliminata') : tr('Visualizza anagrafica')).'" class="btn btn-'.(isset($anagrafica_deleted) ? 'danger' : 'primary').' btn-xs fa fa-user" ></i>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stampa mastrino
|
|
||||||
if (!empty($numero_movimenti)) {
|
|
||||||
echo '
|
|
||||||
'.Prints::getLink('Mastrino', $conto_terzo['id'], 'btn-info btn-xs', '', null, 'lev=3');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pulsante per aggiornare il totale reddito del conto di livello 3
|
|
||||||
echo '
|
|
||||||
<button type="button" class="btn btn-info btn-xs" onclick="aggiornaReddito('.$conto_terzo['id'].')">
|
|
||||||
<i class="fa fa-refresh"></i>
|
|
||||||
</button>';
|
|
||||||
|
|
||||||
// Pulsante per modificare il nome del conto di livello 3
|
|
||||||
echo '
|
|
||||||
<button type="button" class="btn btn-warning btn-xs" onclick="modificaConto('.$conto_terzo['id'].')">
|
|
||||||
<i class="fa fa-edit"></i>
|
|
||||||
</button>';
|
|
||||||
|
|
||||||
// Possibilità di eliminare il conto se non ci sono movimenti collegati
|
|
||||||
if ($numero_movimenti <= 0) {
|
|
||||||
echo '
|
|
||||||
<a class="btn btn-danger btn-xs ask" data-toggle="tooltip" title="'.tr('Elimina').'" data-backto="record-list" data-op="del" data-idconto="'.$conto_terzo['id'].'">
|
|
||||||
<i class="fa fa-trash"></i>
|
|
||||||
</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</span>';
|
|
||||||
|
|
||||||
// Span con info del conto
|
|
||||||
echo '
|
|
||||||
<span class="clickable" id="movimenti-'.$conto_terzo['id'].'">
|
|
||||||
'.$conto_secondo['numero'].'.'.$conto_terzo['numero'].' '.$conto_terzo['descrizione'].($conto_terzo['percentuale_deducibile'] < 100 ? ' <span class="text-muted">('.tr('deducibile al _PERC_%', ['_PERC_' => Translator::numberToLocale($conto_terzo['percentuale_deducibile'], 0)]).')</span>' : '').'
|
|
||||||
</span>
|
|
||||||
<div id="conto_'.$conto_terzo['id'].'" style="display:none;"></div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="text-right">
|
|
||||||
'.moneyFormat($totale_conto, 2).'
|
|
||||||
</td>';
|
|
||||||
if ($conto_primo['descrizione'] == 'Economico') {
|
|
||||||
echo '
|
|
||||||
<td class="text-right">
|
|
||||||
'.moneyFormat($totale_reddito, 2).'
|
|
||||||
</td>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
<tfoot>
|
|
||||||
<tr class="totali">
|
|
||||||
<th class="text-right">'.tr('Totale').'</th>
|
|
||||||
<th class="text-right">'.moneyFormat($totale_conto2).'</th>';
|
|
||||||
if ($conto_primo['descrizione'] == 'Economico') {
|
|
||||||
echo '<th class="text-right">'.moneyFormat($totale_reddito2).'</th>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
</div>
|
|
||||||
</div>';
|
</div>';
|
||||||
// Somma dei totali
|
// Somma dei totali
|
||||||
if ($conto_primo['descrizione'] == 'Patrimoniale') {
|
if ($conto_primo['descrizione'] == 'Patrimoniale') {
|
||||||
@ -287,6 +163,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right" width="150">
|
<td class="text-right" width="150">
|
||||||
<big>'.moneyFormat($passivita, 2).'</big>
|
<big>'.moneyFormat($passivita, 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td width="100"></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
// Perdita d'esercizio
|
// Perdita d'esercizio
|
||||||
@ -302,6 +179,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
@ -315,6 +193,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<big>'.moneyFormat(sum($utile_perdita), 2).'</big>
|
<big>'.moneyFormat(sum($utile_perdita), 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,6 +214,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right" width="150">
|
<td class="text-right" width="150">
|
||||||
<big>'.moneyFormat(sum($pareggio2), 2).'</big>
|
<big>'.moneyFormat(sum($pareggio2), 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
@ -345,6 +225,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right" width="150">
|
<td class="text-right" width="150">
|
||||||
<big>'.moneyFormat(sum($totale_ricavi), 2).'</big>
|
<big>'.moneyFormat(sum($totale_ricavi), 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td width="100"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -354,6 +235,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right" width="150">
|
<td class="text-right" width="150">
|
||||||
<big>'.moneyFormat(sum($totale_costi), 2).'</big>
|
<big>'.moneyFormat(sum($totale_costi), 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="totali">
|
<tr class="totali">
|
||||||
@ -363,6 +245,7 @@ foreach ($primo_livello as $conto_primo) {
|
|||||||
<td class="text-right" width="150">
|
<td class="text-right" width="150">
|
||||||
<big>'.moneyFormat(sum($totale_ricavi) - abs(sum($totale_costi)), 2).'</big>
|
<big>'.moneyFormat(sum($totale_ricavi) - abs(sum($totale_costi)), 2).'</big>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,47 +278,35 @@ echo '
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("tr").each(function() {
|
$("button[id^=conto3-]").each(function() {
|
||||||
$(this).on("mouseover", function() {
|
|
||||||
$(this).find(".tools").removeClass("hide");
|
|
||||||
});
|
|
||||||
|
|
||||||
$(this).on("mouseleave", function() {
|
|
||||||
$(this).find(".tools").addClass("hide");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("span[id^=movimenti-]").each(function() {
|
|
||||||
$(this).on("click", function() {
|
$(this).on("click", function() {
|
||||||
let movimenti = $(this).parent().find("div[id^=conto_]");
|
let conto3 = $(this).parent().find("div[id^=conto2_]");
|
||||||
|
|
||||||
if(!movimenti.html()) {
|
if(!conto3.html()) {
|
||||||
let id_conto = $(this).attr("id").split("-").pop();
|
let id_conto = $(this).attr("id").split("-").pop();
|
||||||
|
caricaConti3(conto3.attr("id"), id_conto);
|
||||||
caricaMovimenti(movimenti.attr("id"), id_conto);
|
|
||||||
} else {
|
} else {
|
||||||
movimenti.slideToggle();
|
conto3.slideToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
$("button[id^=movimenti-]").each(function() {
|
$("span[id^=conto3-]").each(function() {
|
||||||
$(this).on("click", function() {
|
$(this).on("click", function() {
|
||||||
let movimenti = $(this).parent().find("div[id^=conto_]");
|
let conto3 = $(this).parent().find("div[id^=conto2_]");
|
||||||
|
|
||||||
if(!movimenti.html()) {
|
if(!conto3.html()) {
|
||||||
let id_conto = $(this).attr("id").split("-").pop();
|
let id_conto = $(this).attr("id").split("-").pop();
|
||||||
|
caricaConti3(conto3.attr("id"), id_conto);
|
||||||
caricaMovimenti(movimenti.attr("id"), id_conto);
|
|
||||||
} else {
|
} else {
|
||||||
movimenti.slideToggle();
|
conto3.slideToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
$(this).parent().find(".plus-btn i").toggleClass("fa-plus").toggleClass("fa-minus");
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function aggiungiConto(id_conto, level = 3) {
|
function aggiungiConto(id_conto, level = 3) {
|
||||||
@ -446,11 +317,11 @@ echo '
|
|||||||
launch_modal("'.tr('Modifica conto').'", "'.$structure->fileurl('edit_conto.php').'?id=" + id_conto + "&lvl=" + level);
|
launch_modal("'.tr('Modifica conto').'", "'.$structure->fileurl('edit_conto.php').'?id=" + id_conto + "&lvl=" + level);
|
||||||
}
|
}
|
||||||
|
|
||||||
function caricaMovimenti(selector, id_conto) {
|
function caricaConti3(selector, id_conto) {
|
||||||
$("#main_loading").show();
|
$("#main_loading").show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "'.$structure->fileurl('dettagli_conto.php').'",
|
url: "'.$structure->fileurl('dettagli_conto2.php').'",
|
||||||
type: "get",
|
type: "get",
|
||||||
data: {
|
data: {
|
||||||
id_module: globals.id_module,
|
id_module: globals.id_module,
|
||||||
@ -469,25 +340,59 @@ echo '
|
|||||||
openModal("'.tr('Ricalcola importo deducibile').'", "'.$structure->fileurl('aggiorna_reddito.php').'?id=" + id_conto)
|
openModal("'.tr('Ricalcola importo deducibile').'", "'.$structure->fileurl('aggiorna_reddito.php').'?id=" + id_conto)
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#input-cerca").keyup(function(){
|
$("#button-search").on("click", function(){
|
||||||
var text = $(this).val();
|
var text = $("#input-cerca").val();
|
||||||
|
|
||||||
if( text == "" ){
|
$.ajax({
|
||||||
|
url: globals.rootdir + "/actions.php",
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
id_module: globals.id_module,
|
||||||
|
text: text,
|
||||||
|
op: "search",
|
||||||
|
},
|
||||||
|
success: function (results) {
|
||||||
|
if (results.conti2 === 0 && results.conti3 === 0){
|
||||||
|
$(".conto2").each(function() {
|
||||||
|
if ($(this).find(".search > i").hasClass("fa-minus")) {
|
||||||
|
$(this).find(".search").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(".conto3").show();
|
||||||
$(".conto1").show();
|
$(".conto1").show();
|
||||||
$(".conto2").show();
|
$(".conto2").show();
|
||||||
$(".conto3").show();
|
|
||||||
$(".totali").show();
|
$(".totali").show();
|
||||||
} else {
|
} else {
|
||||||
$(".conto1").hide();
|
$(".conto1").hide();
|
||||||
$(".conto2").hide();
|
$(".conto2").hide();
|
||||||
$(".conto3").hide();
|
$(".conto3").hide();
|
||||||
$(".totali").hide();
|
$(".totali").hide();
|
||||||
$(".conto1:contains(" + text + ")").show();
|
results.conti2.forEach(function(item) {
|
||||||
$(".conto2:contains(" + text + ")").show();
|
$("#conto2-"+ item).parent().parent().show();
|
||||||
$(".conto3:contains(" + text + ")").show();
|
$("#conto2-"+ item).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
results.conti2_3.forEach(function(item) {
|
||||||
|
$("#conto2-"+ item).parent().parent().show();
|
||||||
|
$("#conto2-"+ item).show();
|
||||||
|
if ($("#conto2-"+ item).find(".search > i").hasClass("fa-plus")) {
|
||||||
|
$("#conto2-"+ item).find(".search").click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
results.conti3.forEach(function(item) {
|
||||||
|
$("#conto3-"+ item).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
|
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
|
||||||
return function( elem ) {
|
return function( elem ) {
|
||||||
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
|
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// File e cartelle deprecate
|
// File e cartelle deprecate
|
||||||
$files = [
|
$files = [
|
||||||
'modules/interventi/widgets/stampa_riepilogo.php',
|
'modules/interventi/widgets/stampa_riepilogo.php',
|
||||||
|
'modules/partitario/dettagli_conto.php',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user