1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-02 08:56:48 +01:00

Aggiunto plugin Movimenti contabili in Fatture e Anagrafiche

This commit is contained in:
MatteoPistorello 2021-11-29 17:35:29 +01:00
parent 739a4c8b25
commit 7815054a2e
2 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,67 @@
<?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';
include_once __DIR__.'/../init.php';
use Modules\Fatture\Fattura;
$modulo = Modules::get($id_module)['name'];
if ($modulo == 'Anagrafiche') {
$movimenti = $dbo->fetchArray('SELECT co_movimenti.*, SUM(totale) AS totale, co_pianodeiconti3.descrizione, co_pianodeiconti3.numero AS conto3, co_pianodeiconti2.numero AS conto2 FROM co_movimenti LEFT JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id LEFT JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE id_anagrafica='.prepare($id_record).' GROUP BY idmastrino, idconto ORDER BY data, idmastrino');
} else {
$movimenti = $dbo->fetchArray('SELECT co_movimenti.*, SUM(totale) AS totale, co_pianodeiconti3.descrizione, co_pianodeiconti3.numero AS conto3, co_pianodeiconti2.numero AS conto2 FROM co_movimenti LEFT JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id LEFT JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE iddocumento='.prepare($id_record).' GROUP BY idmastrino, idconto ORDER BY data, idmastrino');
}
if (!empty($movimenti)) {
echo '
<table class="table table-hover table-condensed table-bordered table-striped" style="font-size:11pt;">
<thead>
<tr>
<th width="160">'.tr('Data').'</th>
<th>'.tr('Conto').'</th>
<th width="170">'.tr('Dare').'</th>
<th width="170">'.tr('Avere').'</th>
<th width="170">'.tr('Scalare').'</th>
</tr>
</thead>
<tbody>';
foreach ($movimenti as $movimento) {
$documento = $modulo == 'Anagrafiche' ? Fattura::find($movimento['iddocumento']) : null;
$scalare += $movimento['totale'];
echo '
<tr>
<td class="text-center">'.Translator::dateToLocale($movimento['data']).'</td>
<td>'.$movimento['conto2'].'.'.$movimento['conto3'].' - '.$movimento['descrizione'].'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td>
<td class="text-right">'.($movimento['totale']>0 ? moneyFormat(abs($movimento['totale'])) : "").'</td>
<td class="text-right">'.($movimento['totale']<0 ? moneyFormat(abs($movimento['totale'])) : "").'</td>
<td class="text-right">'.moneyFormat($scalare).'</td>
</tr>';
}
echo '
</tbody>
</table>';
} else {
echo '
<h3 class="text-center">
<small class="help-block">'.tr('Non sono presenti movimenti contabili').'</small>
</h3>';
}

View File

@ -88,4 +88,9 @@ INSERT INTO `zz_segments` (`id_module`, `name`, `clause`, `position`, `pattern`,
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Tentativi', '`em_emails`.`attempt`', 7, 1, 0, 0, '', '', 1, 0, 0),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email'), 'Data creazione', '`em_emails`.`created_at`', 9, 1, 0, 1, '', '', 1, 0, 0);
UPDATE `zz_views` SET `format` = '0' WHERE `zz_views`.`name` = 'Utente' AND id_module=(SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email');
UPDATE `zz_views` SET `format` = '0' WHERE `zz_views`.`name` = 'Utente' AND id_module=(SELECT `id` FROM `zz_modules` WHERE `name` = 'Stato email');
-- Aggiunto plugin Movimenti in fatture di acquisto, vendita e anagrafiche
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Movimenti contabili', 'Movimenti contabili', (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto'), 'tab', '', '1', '1', '0', '', '', NULL, 'custom', 'movimenti_contabili', '');
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Movimenti contabili', 'Movimenti contabili', (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita'), 'tab', '', '1', '1', '0', '', '', NULL, 'custom', 'movimenti_contabili', '');
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Movimenti contabili', 'Movimenti contabili', (SELECT `id` FROM `zz_modules` WHERE `name` = 'Anagrafiche'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Anagrafiche'), 'tab', '', '1', '1', '0', '', '', NULL, 'custom', 'movimenti_contabili', '');