Aggiunta stampa libro giornale

This commit is contained in:
MatteoPistorello 2021-11-12 11:53:42 +01:00
parent eb71e46b3a
commit 519d57d42d
9 changed files with 280 additions and 12 deletions

View File

@ -34,11 +34,11 @@ echo '
</div> </div>
<div class="panel-body"> <div class="panel-body">
<button type="button" class="btn btn-primary col-md-3" data-toggle="modal" data-title="'.tr('Stampa registro IVA vendite').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?dir=entrata&nome_stampa=Registro IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Stampa registro').'<br>'.tr('IVA vendite').'</button> <button type="button" class="btn btn-primary col-md-3" data-toggle="modal" data-title="'.tr('Stampa registro IVA vendite').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?dir=entrata&nome_stampa=Registro IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Registro').'<br>'.tr('IVA vendite').'</button>
<button type="button" class="btn btn-primary col-md-3 col-md-push-1" data-toggle="modal" data-title="'.tr('Stampa registro IVA acquisti').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?dir=uscita&nome_stampa=Registro IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Stampa registro').'<br>'.tr('IVA acquisti').'</button> <button type="button" class="btn btn-primary col-md-3 col-md-push-1" data-toggle="modal" data-title="'.tr('Stampa registro IVA acquisti').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?dir=uscita&nome_stampa=Registro IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Registro').'<br>'.tr('IVA acquisti').'</button>
<button type="button" class="btn btn-primary col-md-4 col-md-push-2" data-toggle="modal" data-title="'.tr('Stampa liquidazione IVA').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?nome_stampa=Liquidazione IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Stampa liquidazione').'<br>'.tr('IVA').'</button> <button type="button" class="btn btn-primary col-md-4 col-md-push-2" data-toggle="modal" data-title="'.tr('Stampa liquidazione IVA').'" data-href="'.base_path().'/modules/stampe_contabili/stampe_contabili.php?nome_stampa=Liquidazione IVA&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Liquidazione').'<br>'.tr('IVA').'</button>
</div> </div>
</div> </div>
</div> </div>
@ -53,7 +53,7 @@ echo '
</div> </div>
<div class="panel-body"> <div class="panel-body">
'.Prints::getLink('Spesometro', $id_record, 'btn-primary col-md-5', '<br>'.tr('Stampa dati fatture').'<br>'.tr(' vendite e acquisti'), '|default| fa-2x', 'dir=uscita').' '.Prints::getLink('Spesometro', $id_record, 'btn-primary col-md-5', '<br>'.tr('Dati fatture').'<br>'.tr(' vendite e acquisti'), '|default| fa-2x', 'dir=uscita').'
</div> </div>
</div> </div>
</div> </div>
@ -61,16 +61,16 @@ echo '
<div class="col-md-4"> <div class="col-md-4">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">'.tr('Fatturato<br> dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Dati economici<br> dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($_SESSION['period_start']), '_START_' => Translator::dateToLocale($_SESSION['period_start']),
'_END_' => Translator::dateToLocale($_SESSION['period_end']), '_END_' => Translator::dateToLocale($_SESSION['period_end']),
]).'</h3> ]).'</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
'.Prints::getLink('Fatturato', $id_record, 'btn-primary col-md-5', '<br>'.tr('Stampa fatturato').'<br>'.tr('in entrata'), '|default| fa-2x', 'dir=entrata').' '.Prints::getLink('Fatturato', $id_record, 'btn-primary col-md-5', '<br>'.tr('Stampa').'<br>'.tr('Fatturato'), '|default| fa-2x', 'dir=entrata').'
'.Prints::getLink('Fatturato', $id_record, 'btn-primary col-md-5 col-md-push-2', '<br>'.tr('Stampa fatturato').'<br>'.tr('in uscita'), '|default| fa-2x', 'dir=uscita').' '.Prints::getLink('Fatturato', $id_record, 'btn-primary col-md-5 col-md-push-2', '<br>'.tr('Stampa').'<br>'.tr('Acquisti').'<br>', '|default| fa-2x', 'dir=uscita').'
</div> </div>
</div> </div>
</div> </div>
@ -80,15 +80,27 @@ echo '
<div class="col-md-4"> <div class="col-md-4">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">'.tr('Piano dei conti').'</h3> <h3 class="panel-title">'.tr('Contabilità').'</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<button type="button" class="btn btn-primary col-md-2" data-toggle="modal" data-title="'.tr('Stampa Bilancio').'" data-href="'.base_path().'/modules/stampe_contabili/stampa_bilancio.php" ><i class="fa fa-print fa-2x"></i> <br>'.tr('Stampa').'<br>'.tr('bilancio').'</button> <button type="button" class="btn btn-primary col-md-3" data-toggle="modal" data-title="'.tr('Stampa Bilancio').'" data-href="'.base_path().'/modules/stampe_contabili/stampa_bilancio.php" ><i class="fa fa-print fa-2x"></i> <br>'.tr('Stampa').'<br>'.tr('Bilancio').'<br></button>
'.Prints::getLink('Mastrino', 1, 'btn-primary col-md-4 col-md-push-1', '<br>'.tr('Stampa situazione').'<br>'.tr('patrimoniale'), '|default| fa-2x', 'lev=1').' '.Prints::getLink('Mastrino', 1, 'btn-primary col-md-3 col-md-push-1', '<br>'.tr('Situazione').'<br>'.tr('patrimoniale'), '|default| fa-2x', 'lev=1').'
'.Prints::getLink('Mastrino', 2, 'btn-primary col-md-4 col-md-push-2', '<br>'.tr('Stampa situazione').'<br>'.tr('economica'), '|default| fa-2x', 'lev=1').' '.Prints::getLink('Mastrino', 2, 'btn-primary col-md-3 col-md-push-2', '<br>'.tr('Situazione').'<br>'.tr('economica'), '|default| fa-2x', 'lev=1').'
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">'.tr('Libro giornale').'</h3>
</div>
<div class="panel-body">
'.Prints::getLink('Libro giornale', 2, 'btn-primary col-md-4', '<br>'.tr('Libro').'<br>'.tr('giornale'), '|default| fa-2x').'
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,29 @@
<?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';
echo '
<tr>
<th colspan="4" class="text-right">TOTALE GENERALE</th>
<th class="text-right">'.moneyFormat(abs($totale_dare)).'</th>
<th class="text-right">'.moneyFormat(abs($totale_avere)).'</th>
</tr>
</tbody>
</table>';

View File

@ -0,0 +1,34 @@
<?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/>.
*/
echo '
<table style="color:#aaa; font-size:10px;">
<tr>
<td align="left" style="width:97mm;">
'.tr('Stampato con OpenSTAManager il _DATE_', ['_DATE_' => date('d/m/Y')]).'
</td>
<td class="text-right" style="width:97mm;">
'.tr('Pagina _PAGE_ di _TOTAL_', [
'_PAGE_' => '{PAGENO}',
'_TOTAL_' => '{nb}',
]).'
</td>
</tr>
</table>';

View File

@ -0,0 +1,32 @@
<?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/>.
*/
/*
* Header di default.
* I contenuti di questo file vengono utilizzati per generare l'header delle stampe nel caso non esista un file header.php all'interno della stampa.
*
* Per modificare l'header della stampa basta aggiungere un file header.php all'interno della cartella della stampa con i contenuti da mostrare (vedasi templates/fatture/header.php).
*
* La personalizzazione specifica dell'header deve comunque seguire lo standard della cartella custom: anche se il file header.php non esiste nella stampa originaria, se si vuole personalizzare l'header bisogna crearlo all'interno della cartella custom.
*/
echo '
<h5 style="border-bottom:1px solid #777; display:block;">
<div class="col-md-7">STAMPA LIBRO GIORNALE <small>'.Translator::dateToLocale($date_start).' - '.Translator::dateTolocale($date_end).'</small></div>
<div class="col-md-5 text-right">'.$azienda['ragione_sociale'].'</div>
</h5>';

View File

@ -0,0 +1,25 @@
<?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';
$azienda = $dbo->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica='.setting('Azienda predefinita'));
$date_start = $_SESSION['period_start'];
$date_end = $_SESSION['period_end'];
$records = $dbo->fetchArray('SELECT co_movimenti.*, co_pianodeiconti3.descrizione AS conto, co_pianodeiconti2.numero AS numero2, co_pianodeiconti3.numero, SUM(co_movimenti.totale) AS totale FROM co_movimenti INNER JOIN co_pianodeiconti3 ON co_movimenti.idconto=co_pianodeiconti3.id INNER JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE co_movimenti.data>='.prepare($date_start).' AND co_movimenti.data<='.prepare($date_end).' GROUP BY co_movimenti.idmastrino, co_movimenti.idconto ORDER BY co_movimenti.data, co_movimenti.idmastrino');

View File

@ -0,0 +1,72 @@
<?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';
if ($record['data']!=$last_data && !empty($last_data)) {
echo '
<tr>
<td colspan="4" class="text-right"><b>TOTALE GIORNO</b></td>
<td class="text-right"><b>'.moneyFormat(abs($dare_giorno), 2).'</b></td>
<td class="text-right"><b>'.moneyFormat(abs($avere_giorno), 2).'</b></td>
</tr>';
$totale_dare += $dare_giorno;
$totale_avere += $avere_giorno;
$dare_giorno = 0;
$avere_giorno = 0;
}
echo '
<tr>
<td class="text-center">'.Translator::dateToLocale($record['data']).'</td>
<td class="text-center">'.$record['numero2'].'.'.$record['numero'].'</td>
<td>'.$record['conto'].'</td>
<td>'.$record['descrizione'].'</td>';
if ($record['totale'] >= 0) {
echo '<td class="text-right">'.moneyFormat(abs($record['totale']), 2).'</td>
<td></td>';
$dare_giorno += $record['totale'];
} else {
echo ' <td></td>
<td class="text-right">'.moneyFormat(abs($record['totale']), 2).'</td>';
$avere_giorno += $record['totale'];
}
echo '
</tr>';
if (end($records)==$record) {
echo '
<tr>
<td colspan="4" class="text-right"><b>TOTALE GIORNO</b></td>
<td class="text-right"><b>'.moneyFormat(abs($dare_giorno), 2).'</b></td>
<td class="text-right"><b>'.moneyFormat(abs($avere_giorno), 2).'</b></td>
</tr>';
$totale_dare += $dare_giorno;
$totale_avere += $avere_giorno;
$dare_giorno = 0;
$avere_giorno = 0;
}
$last_data = $record['data'];

View File

@ -0,0 +1,23 @@
<?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/>.
*/
return [
'font-size' => '10pt',
'orientation' => 'L',
];

View File

@ -0,0 +1,34 @@
<?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';
echo '
<table class="table table-striped table-bordered" id="contents">
<thead>
<tr>
<th width="7%">DATA</th>
<th width="9%">CODICE</th>
<th width="20%">DENOMINAZIONE</th>
<th>DESCRIZIONE</th>
<th width="11%">DARE</th>
<th width="11%">AVERE</th>
</tr>
</thead>
<tbody>';

View File

@ -24,3 +24,10 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
-- Aggiunto controllo sul widget fatturato per non conteggiare le fatture in Bozza -- Aggiunto controllo sul widget fatturato per non conteggiare le fatture in Bozza
UPDATE `zz_widgets` SET `query` = 'SELECT\n CONCAT_WS(\' \', REPLACE(REPLACE(REPLACE(FORMAT((\n SELECT SUM(\n (co_righe_documenti.subtotale - co_righe_documenti.sconto) * IF(co_tipidocumento.reversed, -1, 1)\n )\n ), 2), \',\', \'#\'), \'.\', \',\'), \'#\', \'.\'), \'&euro;\') AS dato\nFROM co_righe_documenti\n INNER JOIN co_documenti ON co_righe_documenti.iddocumento = co_documenti.id\n INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento = co_tipidocumento.id\n INNER JOIN co_statidocumento ON co_documenti.idstatodocumento = co_statidocumento.id\nWHERE co_statidocumento.descrizione!=\'Bozza\' AND co_tipidocumento.dir=\'entrata\' |segment| AND data >= \'|period_start|\' AND data <= \'|period_end|\' AND 1=1' WHERE `zz_widgets`.`name` = 'Fatturato'; UPDATE `zz_widgets` SET `query` = 'SELECT\n CONCAT_WS(\' \', REPLACE(REPLACE(REPLACE(FORMAT((\n SELECT SUM(\n (co_righe_documenti.subtotale - co_righe_documenti.sconto) * IF(co_tipidocumento.reversed, -1, 1)\n )\n ), 2), \',\', \'#\'), \'.\', \',\'), \'#\', \'.\'), \'&euro;\') AS dato\nFROM co_righe_documenti\n INNER JOIN co_documenti ON co_righe_documenti.iddocumento = co_documenti.id\n INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento = co_tipidocumento.id\n INNER JOIN co_statidocumento ON co_documenti.idstatodocumento = co_statidocumento.id\nWHERE co_statidocumento.descrizione!=\'Bozza\' AND co_tipidocumento.dir=\'entrata\' |segment| AND data >= \'|period_start|\' AND data <= \'|period_end|\' AND 1=1' WHERE `zz_widgets`.`name` = 'Fatturato';
-- Spostamento stampe contabili
UPDATE `zz_prints` SET `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name`='Stampe contabili') WHERE `zz_prints`.`name` = 'Mastrino';
UPDATE `zz_prints` SET `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name`='Stampe contabili') WHERE `zz_prints`.`name` = 'Bilancio';
-- Aggiunta stampa libro giornale
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Stampe contabili'), '1', 'Libro giornale', 'Libro giornale', 'Libro giornale', 'libro_giornale', 'idconto', '', 'fa fa-print', '', '', '0', '0', '1', '1');