mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Aggiunto pulsante per visualizzare movimenti prima nota
This commit is contained in:
parent
dd9d1ac023
commit
1fca7b633c
117
modules/primanota/dettagli.php
Normal file
117
modules/primanota/dettagli.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?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';
|
||||
|
||||
$prima_nota = Modules::get('Prima nota');
|
||||
|
||||
$id_conto = get('id_conto');
|
||||
$conto = $dbo->fetchOne('SELECT co_pianodeiconti2.numero AS numero2, co_pianodeiconti3.numero AS numero3, co_pianodeiconti3.descrizione FROM co_pianodeiconti3 LEFT JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2 = co_pianodeiconti2.id WHERE co_pianodeiconti3.id='.prepare($id_conto));
|
||||
|
||||
// Calcolo totale conto da elenco movimenti di questo conto
|
||||
$query = 'SELECT co_movimenti.*,
|
||||
SUM(totale) AS totale,
|
||||
dir FROM co_movimenti
|
||||
LEFT OUTER JOIN co_documenti ON co_movimenti.iddocumento = co_documenti.id
|
||||
LEFT OUTER JOIN co_tipidocumento ON co_documenti.idtipodocumento = co_tipidocumento.id
|
||||
WHERE co_movimenti.idconto='.prepare($id_conto).' AND
|
||||
co_movimenti.data >= '.prepare($_SESSION['period_start']).' AND
|
||||
co_movimenti.data <= '.prepare($_SESSION['period_end']).'
|
||||
GROUP BY co_movimenti.idmastrino
|
||||
ORDER BY co_movimenti.data ASC, co_movimenti.descrizione';
|
||||
$movimenti = $dbo->fetchArray($query);
|
||||
|
||||
echo '
|
||||
<br><p class="text-center"><b>'.$conto['numero2'].'.'.$conto['numero3'].' '.$conto['descrizione'].'</b></p>';
|
||||
|
||||
if (!empty($movimenti)) {
|
||||
echo '
|
||||
<table class="table table-bordered table-hover table-condensed table-striped">
|
||||
<tr>
|
||||
<th>'.tr('Causale').'</th>
|
||||
<th width="100">'.tr('Data').'</th>
|
||||
<th width="100">'.tr('Dare').'</th>
|
||||
<th width="100">'.tr('Avere').'</th>
|
||||
<th width="100">'.tr('Scalare').'</th>
|
||||
</tr>';
|
||||
|
||||
$scalare = 0;
|
||||
$righe_movimenti = 0;
|
||||
|
||||
// Elenco righe del partitario
|
||||
foreach ($movimenti as $movimento) {
|
||||
$scalare += $movimento['totale'];
|
||||
$righe_movimenti++;
|
||||
|
||||
if (sizeof($movimenti) - $righe_movimenti < 25 ) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
$modulo_fattura = ($movimento['dir'] == 'entrata') ? Modules::get('Fatture di vendita') : Modules::get('Fatture di acquisto');
|
||||
|
||||
if (!empty($movimento['primanota'])) {
|
||||
echo Modules::link($prima_nota->id, $movimento['idmastrino'], $movimento['descrizione']);
|
||||
} else {
|
||||
echo Modules::link($modulo_fattura->id, $movimento['iddocumento'], $movimento['descrizione']);
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// Data
|
||||
echo '
|
||||
<td>
|
||||
'.dateFormat($movimento['data']).'
|
||||
</td>';
|
||||
|
||||
// Dare
|
||||
if ($movimento['totale'] > 0) {
|
||||
echo '
|
||||
<td class="text-right">
|
||||
'.moneyFormat(abs($movimento['totale']), 2).'
|
||||
</td>
|
||||
<td></td>';
|
||||
}
|
||||
|
||||
// Avere
|
||||
else {
|
||||
echo '
|
||||
<td></td>
|
||||
<td class="text-right">
|
||||
'.moneyFormat(abs($movimento['totale']), 2).'
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<td class="text-right">
|
||||
'.moneyFormat($scalare, 2).'
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
</table>';
|
||||
} else {
|
||||
echo '
|
||||
<span>'.tr('Nessun movimento presente').'</span>';
|
||||
}
|
@ -30,7 +30,7 @@ function renderRiga($id, $riga)
|
||||
<input type="hidden" name="id_scadenza['.$id.']" value="'.$riga['id_scadenza'].'">
|
||||
|
||||
<td>
|
||||
{[ "type": "select", "name": "idconto['.$id.']", "id": "conto'.$id.'", "value": "'.($riga['id_conto'] ?: '').'", "ajax-source": "conti" ]}
|
||||
{[ "type": "select", "name": "idconto['.$id.']", "id": "conto'.$id.'", "value": "'.($riga['id_conto'] ?: '').'", "ajax-source": "conti", "icon-after": '.json_encode('<button type="button" onclick="visualizzaMovimenti(this)" class="btn btn-info '.($riga['id_conto'] ? '' : 'disabled').'"><i class="fa fa-eye"></i></button>').' ]}
|
||||
</td>';
|
||||
|
||||
// Dare
|
||||
@ -299,13 +299,20 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$(document).on("change", "select", function() {
|
||||
let row = $(this).parent().parent();
|
||||
let row = $(this).parent().parent().parent();
|
||||
|
||||
if (row.find("input[disabled]").length > 1) {
|
||||
row.find("input").prop("disabled", !$(this).val());
|
||||
}
|
||||
|
||||
controllaConti();
|
||||
|
||||
let button = $(this).parent().find("button");
|
||||
if ($(this).val()) {
|
||||
button.removeClass("disabled");
|
||||
} else {
|
||||
button.addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("keyup change", "input[id*=dare]", function() {
|
||||
@ -327,4 +334,9 @@ $(document).on("keyup change", "input[id*=avere]", function() {
|
||||
controllaConti();
|
||||
}
|
||||
});
|
||||
|
||||
function visualizzaMovimenti(button) {
|
||||
let id_conto = $(button).parent().parent().find("select").val();
|
||||
openModal("'.tr('Ultimi 25 movimenti').'", "'.$module->fileurl('dettagli.php').'?id_module=" + globals.id_module + "&id_conto=" + id_conto);
|
||||
}
|
||||
</script>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user