Aggiunta scelta del sezionale prima della stampa del registro IVA

This commit is contained in:
Luca 2020-07-01 18:10:00 +02:00
parent 796306369b
commit 8bb0d5d34e
6 changed files with 92 additions and 13 deletions

View File

@ -12,16 +12,22 @@ 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('Registri iva dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Registri iva<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('Registro IVA', $id_record, 'btn-primary', '<br>'.tr('Stampa registro').'<br>'.tr('IVA vendite'), '|default| fa-2x', 'dir=entrata').'
'.Prints::getLink('Registro IVA', $id_record, 'btn-primary', '<br>'.tr('Stampa registro').'<br>'.tr('IVA acquisti'), '|default| fa-2x', 'dir=uscita').' echo '
<button type="button" class="btn btn-primary col-md-5" data-toggle="modal" data-title="'.tr('Stampa registro').'..." data-href="'.ROOTDIR.'/modules/stampe_contabili/stampa_registro_iva.php?dir=entrata&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 col-md-push-2" data-toggle="modal" data-title="'.tr('Stampa registro').'..." data-href="'.ROOTDIR.'/modules/stampe_contabili/stampa_registro_iva.php?dir=uscita&id_record='.$id_record.'" ><i class="fa fa-print fa-2x"></i><br>'.tr('Stampa registro').'<br>'.tr('IVA acquisti').'</button>';
echo '
</div> </div>
</div> </div>
</div> </div>
@ -29,14 +35,14 @@ 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('Comunicazione dati fatture (ex-spesometro) dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Comunicazione dati fatture (ex-spesometro)<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('Spesometro', $id_record, 'btn-primary', '<br>'.tr('Stampa').'<br>'.tr('dati fatture'), '|default| fa-2x', 'dir=uscita').' '.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').'
</div> </div>
</div> </div>
</div> </div>
@ -44,16 +50,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 dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Fatturato<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', '<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 fatturato').'<br>'.tr('in entrata'), '|default| fa-2x', 'dir=entrata').'
'.Prints::getLink('Fatturato', $id_record, 'btn-primary', '<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 fatturato').'<br>'.tr('in uscita'), '|default| fa-2x', 'dir=uscita').'
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,64 @@
<?php
include_once __DIR__.'/../../core.php';
$_SESSION['stampe_contabili']['id_sezionale'] = 0;
$id_record = filter('id_record');
$dir = filter('dir');
// Trovo id_print della stampa
$link = Prints::getHref('Registro IVA', $id_record);
echo '
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return stampa_registro_iva(); }" >
<div class="row">
<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", "value": "'.$_SESSION['stampe_contabili']['id_sezionale'].'" ]}
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['stampe_contabili']['format'].'" ]}
</div>
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\", \"P\": \"'.tr('Verticale').'\"", "value": "'.$_SESSION['stampe_contabili']['orientation'].'" ]}
</div>
<div class="col-md-2">
<p style="line-height:14px;">&nbsp;</p>
<button type="submit" class="btn btn-primary btn-block">
<i class="fa fa-print"></i> '.tr('Stampa').'
</button>
</div>
</div>
</form>
<script>$(document).ready(init)</script>';
echo '
<script>
function stampa_registro_iva (){
window.open("'.$link.'&dir='.$dir.'");
return false;
}
$("#id_sezionale").change(function() {
session_set("stampe_contabili,id_sezionale", $(this).val(), 0, 0);
});
$("#format").change(function() {
session_set("stampe_contabili,format", $(this).val(), 0, 0);
});
$("#orientation").change(function() {
session_set("stampe_contabili,orientation", $(this).val(), 0, 0);
});
$(function() {
});
</script>';

View File

@ -4,6 +4,9 @@ include_once __DIR__.'/../../core.php';
$dir = $_GET['dir']; $dir = $_GET['dir'];
$stampe_contabili = $_SESSION['stampe_contabili'];
$id_sezionale = $stampe_contabili['id_sezionale'];
$date_start = $_SESSION['period_start']; $date_start = $_SESSION['period_start'];
$date_end = $_SESSION['period_end']; $date_end = $_SESSION['period_end'];
@ -24,9 +27,9 @@ FROM co_documenti
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id
INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id
INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_documenti.idanagrafica INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = co_documenti.idanagrafica
WHERE dir = '.prepare($dir).' AND idstatodocumento NOT IN (SELECT id FROM co_statidocumento WHERE descrizione="Bozza" OR descrizione="Annullata") AND is_descrizione = 0 AND co_documenti.data >= '.prepare($date_start).' AND co_documenti.data <= '.prepare($date_end).' WHERE dir = '.prepare($dir).' AND idstatodocumento NOT IN (SELECT id FROM co_statidocumento WHERE descrizione="Bozza" OR descrizione="Annullata") AND is_descrizione = 0 AND co_documenti.data >= '.prepare($date_start).' AND co_documenti.data <= '.prepare($date_end).' AND '.((!empty($id_sezionale)) ? 'co_documenti.id_segment = '.prepare($id_sezionale).'' : '1=1').'
GROUP BY co_documenti.id, co_righe_documenti.idiva GROUP BY co_documenti.id, co_righe_documenti.idiva
ORDER BY co_documenti.id, co_documenti.'.(($dir == 'entrata') ? 'data' : 'numero'); ORDER BY co_documenti.'.(($dir == 'entrata') ? 'data' : 'numero').', co_documenti.'.(($dir == 'entrata') ? 'numero_esterno' : 'data_competenza');
$records = $dbo->fetchArray($query); $records = $dbo->fetchArray($query);
// Sostituzioni specifiche // Sostituzioni specifiche

View File

@ -28,6 +28,7 @@ if ($record['numero'] == $previous_number) {
<td>'.(($dir == 'uscita') ? $record['numero'] : '-').'</td> <td>'.(($dir == 'uscita') ? $record['numero'] : '-').'</td>
<td>'.$record['numero_esterno'].'</td> <td>'.$record['numero_esterno'].'</td>
<td>'.Translator::datetoLocale($record['data']).'</td> <td>'.Translator::datetoLocale($record['data']).'</td>
<td>'.Translator::datetoLocale($record['data_competenza']).'</td>
<td>'.$record['codice_tipo_documento_fe'].'</td> <td>'.$record['codice_tipo_documento_fe'].'</td>
<td>'.$record['codice_anagrafica'].' / '.safe_truncate(mb_strtoupper(html_entity_decode($record['ragione_sociale']), 'UTF-8'), 50).'</td> <td>'.$record['codice_anagrafica'].' / '.safe_truncate(mb_strtoupper(html_entity_decode($record['ragione_sociale']), 'UTF-8'), 50).'</td>
<td>'.moneyFormat($record['totale']).'</td>'; <td>'.moneyFormat($record['totale']).'</td>';

View File

@ -1,6 +1,10 @@
<?php <?php
$format = (isset($_SESSION['stampe_contabili']['format'])) ? $_SESSION['stampe_contabili']['format'] : 'A4';
$orientation = (isset($_SESSION['stampe_contabili']['orientation'])) ? $_SESSION['stampe_contabili']['orientation'] : 'L';
return [ return [
'orientation' => 'L', 'format' => $format,
'orientation' => $orientation,
'font-size' => '11pt', 'font-size' => '11pt',
]; ];

View File

@ -32,7 +32,8 @@ echo '<h4><b>'.$titolo.'</b></h4>
<tr bgcolor="'.$color.'"> <tr bgcolor="'.$color.'">
<th>'.tr('Prot.').'</th> <th>'.tr('Prot.').'</th>
<th>'.tr('N<sup>o</sup>&nbsp;doc.').'</th> <th>'.tr('N<sup>o</sup>&nbsp;doc.').'</th>
<th>'.tr('Data').'</th> <th>'.tr('Data doc.').'</th>
<th>'.tr('Data comp.').'</th>
<th>'.tr('Tipo').'</th> <th>'.tr('Tipo').'</th>
<th>'.$tipo.'</th> <th>'.$tipo.'</th>
<th>'.tr('Tot.&nbsp;doc.').'</th> <th>'.tr('Tot.&nbsp;doc.').'</th>