Aggiunta stampa liquidazione iva

This commit is contained in:
MatteoPistorello 2020-10-13 17:50:37 +02:00
parent 80ab357f03
commit c85d5e5eb5
8 changed files with 497 additions and 11 deletions

View File

@ -33,12 +33,13 @@ echo '
</div>
<div class="panel-body">';
echo '
<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>';
echo '
<button type="button" class="btn btn-primary col-md-5" 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 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>';
echo '
<button type="button" class="btn btn-primary col-md-5 col-md-push-2" 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-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>';
echo '
</div>

View File

@ -27,13 +27,17 @@ $nome_stampa = filter('nome_stampa');
$link = Prints::getHref($nome_stampa, $id_record);
echo '
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return stampa_registro_iva(); }" >
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return avvia_stampa(); }" >
<div class="row">
<div class="row">';
if($nome_stampa != 'Liquidazione IVA'){
echo'
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_sezionale", "required": "1", "values": "query=SELECT id AS id, name AS descrizione FROM zz_segments WHERE id_module = (SELECT id FROM zz_modules WHERE name = \''.(($dir == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto').'\') AND is_fiscale = 1 UNION SELECT 0 AS id, \'Tutti i sezionali\' AS descrizione" ]}
</div>
</div>';
}
echo'
<div class="col-md-4">
{[ "type": "date", "label": "'.tr('Data inizio').'", "required": "1", "name": "date_start", "value": "'.Translator::dateToLocale($_SESSION['period_start']).'" ]}
</div>
@ -68,11 +72,10 @@ echo '
echo '
<script>
function stampa_registro_iva (){
window.open("'.$link.'&dir='.$dir.'&id_sezionale="+$("#id_sezionale").val()+"&date_start="+$("#date_start").val()+"&date_end="+$("#date_end").val()+"");
function avvia_stampa (){
window.open("'.$link.'&dir='.$dir.'&id_sezionale="+$("#id_sezionale").val()+"&date_start="+$("#date_start").val()+"&date_end="+$("#date_end").val()+"");
return false;
}
}
$("#format").change(function() {
session_set("stampe_contabili,format", $(this).val(), 0, 0);
});

View File

@ -0,0 +1,313 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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';
$totale_iva_vendite = sum(array_column($iva_vendite, 'iva'));
$totale_subtotale_vendite = sum(array_column($iva_vendite, 'subtotale'));
$totale_iva_acquisti = sum(array_column($iva_acquisti, 'iva'));
$totale_subtotale_acquisti = sum(array_column($iva_acquisti, 'subtotale'));
$totale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'iva'));
$totale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'iva'));
$subtotale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'subtotale'));
$subtotale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'subtotale'));
$totale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'iva'));
$totale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'iva'));
$subtotale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'subtotale'));
$subtotale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'subtotale'));
$totale_iva_vendite_anno_precedente = sum(array_column($iva_vendite_anno_precedente, 'iva'));
$totale_iva_acquisti_anno_precedente = sum(array_column($iva_acquisti_anno_precedente, 'iva'));
$totale_iva_anno_precedente = $totale_iva_vendite_anno_precedente - $totale_iva_acquisti_anno_precedente;
$totale_iva_vendite_periodo_precedente = sum(array_column($iva_vendite_periodo_precedente, 'iva'));
$totale_iva_acquisti_periodo_precedente = sum(array_column($iva_acquisti_periodo_precedente, 'iva'));
$totale_iva_periodo_precedente = $totale_iva_vendite_periodo_precedente - $totale_iva_acquisti_periodo_precedente;
$totale_iva = $totale_iva_esigibile - $totale_iva_detraibile;
if($periodo == 'Trimestrale' && $totale_iva > 0){
$maggiorazione = $totale_iva * 0.01;
$totale_iva_maggiorata = $totale_iva + $maggiorazione;
}
echo'
<h5 class="text-center">VENDITE</h5>
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th width="15%">Aliquota</th>
<th width="15%">Natura IVA</th>
<th width="30%">Descrizione</th>
<th class="text-right" width="20%">Imponibile</th>
<th class="text-right" width="20%">Imposta</th>
</tr>
<tr>
<th class="text-center" colspan="5">IVA ESIGIBILE DEL PERIODO</th>
</tr>
</thead>
<tbody>';
foreach($iva_vendite_esigibile as $record){
echo '
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<td colspan="2"></td>
<td>TOTALI</td>
<td class=text-right>'.moneyFormat($subtotale_iva_esigibile).'</td>
<td class=text-right>'.moneyFormat($totale_iva_esigibile).'</td>
</tr>
<tr>
<th class="text-center" colspan="5">IVA NON ESIGIBILE DEL PERIODO</th>
</tr>';
foreach($iva_vendite_nonesigibile as $record){
echo'
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<td colspan="2"></td>
<td>TOTALI</td>
<td class=text-right>'.moneyFormat($subtotale_iva_nonesigibile).'</td>
<td class=text-right>'.moneyFormat($totale_iva_nonesigibile).'</td>
</tr>
<tr>
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA VENDITE</th>
</tr>';
foreach($iva_vendite as $record){
echo'
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<th colspan="2"></th>
<th>TOTALE</th>
<th class=text-right>'.moneyFormat($totale_subtotale_vendite).'</th>
<th class=text-right>'.moneyFormat($totale_iva_vendite).'</th>
</tr>
</tbody>
</table>
<h5 class="text-center">ACQUISTI</h5>
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th width="15%">Aliquota</th>
<th width="15%">Natura IVA</th>
<th width="30%">Descrizione</th>
<th class="text-right" width="20%">Imponibile</th>
<th class="text-right" width="20%">Imposta</th>
</tr>
<tr>
<th class="text-center" colspan="5">IVA DETRAIBILE DEL PERIODO</th>
</tr>
</thead>
<tbody>';
foreach($iva_acquisti_detraibile as $record){
echo '
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<td colspan="2"></td>
<td>TOTALI</td>
<td class=text-right>'.moneyFormat($subtotale_iva_detraibile).'</td>
<td class=text-right>'.moneyFormat($totale_iva_detraibile).'</td>
</tr>
<tr>
<th class="text-center" colspan="5">IVA NON DETRAIBILE DEL PERIODO</th>
</tr>';
foreach($iva_acquisti_nondetraibile as $record){
echo'
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<td colspan="2"></td>
<td>TOTALI</td>
<td class=text-right>'.moneyFormat($subtotale_iva_nondetraibile).'</td>
<td class=text-right>'.moneyFormat($totale_iva_nondetraibile).'</td>
</tr>
<tr>
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA ACQUISTI</th>
</tr>';
foreach($iva_acquisti as $record){
echo'
<tr>
<td>'.round($record['aliquota']).'%</td>
<td>'.$record['cod_iva'].'</td>
<td>'.$record['descrizione'].'</td>
<td class=text-right>'.moneyFormat($record['subtotale']).'</td>
<td class=text-right>'.moneyFormat($record['iva']).'</td>
</tr>';
}
echo'
<tr>
<th colspan="2"></th>
<th>TOTALE</th>
<th class=text-right>'.moneyFormat($totale_subtotale_acquisti).'</th>
<th class=text-right>'.moneyFormat($totale_iva_acquisti).'</th>
</tr>
</tbody>
</table>
<br>
<br>
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th class="text-center" colspan="2">PROSPETTO RIEPILOGATIVO DI LIQUIDAZIONE I.V.A.</th>
<tr>
<th width="70%">DESCRIZIONE</th>
<th class="text-right" width="30%">IMPORTO</th>
</tr>
</thead>
<tbody>
<tr>';
if($totale_iva_anno_precedente >=0){
echo' <td>DEBITO ANNO PRECEDENTE</td>';
}else{
echo' <td>CREDITO ANNO PRECEDENTE</td>';
}
echo'<td class=text-right>'.moneyFormat(abs($totale_iva_anno_precedente)).'</td>
</tr>
<tr>';
if($totale_iva_periodo_precedente >=0){
echo' <td>DEBITO PERIODO PRECEDENTE</td>';
}else{
echo' <td>CREDITO PERIODO PRECEDENTE</td>';
}
echo' <td class=text-right>'.moneyFormat(abs($totale_iva_periodo_precedente)).'</td>
</tr>
<tr>
<td>TOTALE IVA SU VENDITE ESIGIBILE</td>
<td class=text-right>'.moneyFormat($totale_iva_esigibile).'</td>
</tr>
<tr>
<td>TOTALE IVA OGGETTIVAMENTE NON A DEBITO SU VENDITE</td>
<td class=text-right>'.moneyFormat($totale_iva_nonesigibile).'</td>
</tr>
<tr>
<td>TOTALE IVA SU ACQUISTI DETRAIBILI</td>
<td class=text-right>'.moneyFormat($totale_iva_detraibile).'</td>
</tr>
<tr>
<td>TOTALE IVA OGGETTIVAMENTE INDETRAIBILI SU ACQUISTI</td>
<td class=text-right>'.moneyFormat($totale_iva_nondetraibile).'</td>
</tr>
<tr>
<td>TOTALE IVA DETRAIBILI</td>
<td class=text-right>'.moneyFormat($totale_iva_detraibile).'</td>
</tr>
<tr>
<td>VARIAZIONE DI IMPOSTA RELATIVE A PERIODI PRECEDENTI</td>
<td class=text-right></td>
</tr>
<tr>
<td>DI CUI INTERESSI PER RAVVEDIMENTO</td>
<td class=text-right></td>
</tr>
<tr>
<td>DI CUI INTERESSI PER MAGGIORAZIONE TRIMESTRALI</td>
<td class=text-right></td>
</tr>
<tr>
<td>CREDITO IVA COMPENSABILE</td>
<td class=text-right></td>
</tr>
<tr>';
if($totale_iva >=0){
echo' <td>IVA A DEBITO</td>';
}else{
echo' <td>IVA A CREDITO</td>';
}
echo' <td class=text-right>'.moneyFormat(abs($totale_iva)).'</td>
</tr>
<tr>
<td>CREDITO SPECIALE DI IMPOSTA</td>
<td class=text-right></td>
</tr>
<tr>
<td>MAGGIORAZIONE 1,00%</td>
<td class=text-right>'.moneyFormat($maggiorazione).'</td>
</tr>
<tr>
<td>IVA A DEBITO CON MAGGIORAZIONE</td>
<td class=text-right>'.moneyFormat($totale_iva_maggiorata).'</td>
</tr>
<tr>
<td>IMPORTO DA VERSARE</td>
<td class=text-right>'.moneyFormat($totale_iva_maggiorata).'</td>
</tr>
<tr>
<td>CREDITO INFRANNUALE DI IMPOSTA CHIESTO A RIMBORSO</td>
<td class=text-right></td>
</tr>
<tr>
<td>CREDITO INFRANNUALE DA UTILIZZARE IN COMPENSAZIONE</td>
<td class=text-right></td>
</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.n.c.
*
* 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,40 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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.
*/
$year_start = date('Y', strtotime($date_start));
$year_end = date('Y', strtotime($date_end));
$esercizio = $year_start == $year_end ? ' - '.tr('Esercizio _YEAR_', [
'_YEAR_' => $year_end,
]) : '';
$titolo = tr('PROSPETTO LIQUIDAZIONE IVA DAL _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start),
'_END_' => Translator::dateToLocale($date_end),
], ['upper' => true]);
echo '<h6>'.$titolo.'</h6>';

View File

@ -0,0 +1,62 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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';
use Carbon\Carbon;
$date_start = filter('date_start');
$date_end = filter('date_end');
$anno_precedente_start = (new Carbon($date_start))->subYears(1)->format('Y-m-d');
$anno_precedente_end = (new Carbon($date_end))->subYears(1)->format('Y-m-d');
$periodo = $dbo->fetchOne('SELECT valore FROM zz_settings WHERE nome="Liquidazione iva"');
if($periodo['valore'] == 'Mensile'){
$periodo_precedente_start = (new Carbon($date_start))->subMonth(1)->format('Y-m-d');
$periodo_precedente_end = (new Carbon($date_end))->subMonth(1)->format('Y-m-d');
}
else{
$periodo_precedente_start = (new Carbon($date_start))->subMonth(3)->format('Y-m-d');
$periodo_precedente_end = (new Carbon($date_end))->subMonth(3)->format('Y-m-d');
}
$maggiorazione = 0;
$iva_vendite_esigibile=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota, co_iva.descrizione AS descrizione, SUM(iva) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE co_documenti.split_payment=0 AND dir="entrata" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' GROUP BY idiva');
$iva_vendite_nonesigibile=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE co_documenti.split_payment=1 AND dir="entrata" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' GROUP BY idiva');
$iva_vendite=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="entrata" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' GROUP BY idiva');
$iva_vendite_anno_precedente=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva) AS iva FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="entrata" AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).' GROUP BY idiva');
$iva_vendite_periodo_precedente=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva) AS iva FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="entrata" AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).' GROUP BY idiva');
$iva_acquisti_detraibile=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva-iva/100*indetraibile) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE co_documenti.split_payment=0 AND dir="uscita" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' AND co_iva.indetraibile = 0 GROUP BY idiva');
$iva_acquisti_nondetraibile=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota, co_iva.descrizione AS descrizione, co_iva.indetraibile AS indetraibile, SUM(iva-iva/100*indetraibile) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="uscita" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' AND co_iva.indetraibile != 0 GROUP BY idiva');
$iva_acquisti=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva-iva/100*indetraibile) AS iva, SUM(subtotale-sconto) AS subtotale FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="uscita" AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' GROUP BY idiva');
$iva_acquisti_anno_precedente=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva-iva/100*indetraibile) AS iva FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="uscita" AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).' GROUP BY idiva');
$iva_acquisti_periodo_precedente=$dbo->fetchArray('SELECT co_iva.codice_natura_fe AS cod_iva, co_iva.percentuale AS aliquota,co_iva.descrizione AS descrizione, SUM(iva-iva/100*indetraibile) AS iva FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE dir="uscita" AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).' GROUP BY idiva');

View File

@ -0,0 +1,27 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
$format = (isset($_SESSION['stampe_contabili']['format'])) ? $_SESSION['stampe_contabili']['format'] : 'A4';
$orientation = (isset($_SESSION['stampe_contabili']['orientation'])) ? $_SESSION['stampe_contabili']['orientation'] : 'L';
return [
'format' => $format,
'orientation' => $orientation,
'font-size' => '11pt',
];

View File

@ -307,3 +307,9 @@ UPDATE `fe_stati_documento` SET `tipo` = 'danger';
UPDATE `fe_stati_documento` SET `tipo` = 'warning' WHERE `codice` IN ('ERVAL', 'MC', 'WAIT', 'NE');
UPDATE `fe_stati_documento` SET `tipo` = 'success' WHERE `codice` IN ('EC01', 'RC');
UPDATE `fe_stati_documento` SET `tipo` = 'info' WHERE `codice` IN ('GEN');
-- Aggiunta stampa liquidazione IVA
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', 'Liquidazione IVA', 'Liquidazione IVA', 'Liquidazione IVA', 'liquidazione_iva', '', '', 'fa fa-print', '', '', '0', '0', '1', '1');
-- Aggiunta impostazione per Liquidazione IVA
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Liquidazione iva', 'Mensile', 'list[Mensile,Trimestrale]', '1', 'Fatturazione', '16', NULL);