Aggiunta stampe per modulo Anagrafiche

This commit is contained in:
Beppe 2021-04-19 15:07:51 +02:00
parent 93f0e41c4b
commit 1cfc53693e
6 changed files with 326 additions and 0 deletions

View File

@ -0,0 +1,28 @@
<?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/>.
*/
use Modules\Anagrafiche\Anagrafica;
$anagrafica = Anagrafica::find($id_record);
// Variabili da sostituire
return [
'ragione_sociale' => $anagrafica->ragione_sociale,
'codice' => $anagrafica->codice,
];

176
templates/anagrafiche/body.php Executable file
View File

@ -0,0 +1,176 @@
<?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/>.
*/
use Modules\Interventi\Intervento;
use Carbon\Carbon;
include_once __DIR__.'/../../core.php';
/*
Dati Anagrafici
*/
echo '
<table class="table table-bordered">
<tr>
<th colspan="4" style="font-size:13pt;" class="text-center">'.tr('Dettaglio anagrafica', [], ['upper' => true]).'</th>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Denominazione').': <b>'.$anagrafica['ragione_sociale'].'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Indirizzo').': <b>'.$anagrafica['indirizzo'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2">'.tr('Città').': <b>'.$anagrafica['citta'].'</b></td>
<td class="text-left" >'.tr('Provincia').': <b>'.$anagrafica['provincia'].'</b></td>
<td class="text-left" >'.tr('Cap').': <b>'.$anagrafica['cap'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Partita IVA').': <b>'.$anagrafica['piva'].'</b></td>
<td class="text-left" colspan="2">'.tr('Codice fiscale').': <b>'.$anagrafica['codice_fiscale'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Pec').': <b>'.$anagrafica['pec'].'</b></td>
<td class="text-left" colspan="2">'.tr('Email').': <b>'.$anagrafica['email'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Telefono').': <b>'.$anagrafica['telefono'].'</b></td>
<td class="text-left">'.tr('cellulare').': <b>'.$anagrafica['cellulare'].'</b></td>
<td class="text-left">'.tr('fax').': <b>'.$anagrafica['fax'].'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Agente').': <b>'.$agente['ragione_sociale'].'</b></td>
</tr>
</table>';
/*
Sedi
*/
$sedi = $dbo->fetchArray("SELECT * FROM an_sedi WHERE idanagrafica=".prepare($anagrafica->idanagrafica));
if( !empty($sedi) ){
echo '
<table class="table table-bordered">
<tr>
<th colspan="4" style="font-size:13pt;" class="text-center">'.tr('Sedi', [], ['upper' => true]).'</th>
</tr>';
for($i=0; count($sedi)>$i; $i++){
echo '
<tr>
<td colspan="4" class="text-left" >'.tr('Nome sede').': <b>'.$sedi[$i]['nomesede'].'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Indirizzo').': <b>'.$sedi[$i]['indirizzo'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2">'.tr('Città').': <b>'.$sedi[$i]['citta'].'</b></td>
<td class="text-left" >'.tr('Provincia').': <b>'.$sedi[$i]['prov'].'</b></td>
<td class="text-left" >'.tr('Cap').': <b>'.$sedi[$i]['cap'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('telefono').': <b>'.$sedi[$i]['telefono'].'</b></td>
<td class="text-left" colspan="2">'.tr('cellulare').': <b>'.$sedi[$i]['cellulare'].'</b></td>
</tr>';
if( !empty($sedi[$i+1]) ){
echo '
<tr><td colspan="4"></td></tr>';
}
}
echo '
</table>';
}
/*
Impianti
*/
$impianti = $dbo->fetchArray("SELECT * FROM my_impianti WHERE idanagrafica=".prepare($anagrafica->idanagrafica));
if( !empty($impianti) ){
echo '
<table class="table table-bordered">
<tr>
<th colspan="4" style="font-size:13pt;" class="text-center">'.tr('Impianti', [], ['upper' => true]).'</th>
</tr>';
for($i=0; count($impianti)>$i; $i++){
echo '
<tr>
<td colspan="2" class="text-left" >'.tr('Matricola').': <b>'.$impianti[$i]['matricola'].'</b></td>
<td colspan="2" class="text-left" >'.tr('Data').': <b>'.Translator::dataToLocale($impianti[$i]['data']).'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Nome').': <b>'.$impianti[$i]['nome'].'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('descrizione').': <b>'.$impianti[$i]['descrizione'].'</b></td>
</tr>';
if( !empty($impianti[$i+1]) ){
echo '
<tr><td colspan="4"></td></tr>';
}
}
echo '
</table>';
}
/*
Attività
*/
$interventi = $dbo->fetchArray("SELECT id, sessione.inizio FROM in_interventi LEFT JOIN (SELECT MIN(orario_inizio) AS inizio, in_interventi_tecnici.idintervento FROM in_interventi_tecnici GROUP BY in_interventi_tecnici.idintervento) AS sessione ON sessione.idintervento=in_interventi.id WHERE idanagrafica=".prepare($anagrafica->idanagrafica));
if( !empty($interventi) ){
echo '
<table class="table table-bordered">
<tr>
<th colspan="4" style="font-size:13pt;" class="text-center">'.tr('Attività', [], ['upper' => true]).'</th>
</tr>';
for($i=0; count($interventi)>$i; $i++){
$intervento = Intervento::find($interventi[$i]['id']);
echo '
<tr>
<td class="text-left">'.tr('Data richiesta').': <b>'.Translator::dateToLocale($intervento->data_richiesta).'</b></td>
<td class="text-left" colspan="2" >'.tr('Data scadenza').': <b>'.Translator::dateToLocale($intervento->data_scadenza).'</b></td>
<td class="text-left" >'.tr('Data inizio').': <b>'.Translator::dateToLocale($interventi[$i]['inizio']).'</b></td>
</tr>
<tr>
<td colspan="2" class="text-left" >'.tr('Tipo').': <b>'.$intervento->tipo->descrizione.'</b></td>
<td colspan="2" class="text-left" >'.tr('stato').': <b>'.$intervento->stato->descrizione.'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('richiesta').': <b>'.$intervento->richiesta.'</b></td>
</tr>';
if( !empty($interventi[$i+1]) ){
echo '
<tr><td colspan="4"></td></tr>';
}
}
echo '
</table>';
}

25
templates/anagrafiche/init.php Executable file
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';
use Modules\Anagrafiche\Anagrafica;
$anagrafica = Anagrafica::find($id_record);
$agente = Anagrafica::find($anagrafica->idagente);

67
templates/azienda/body.php Executable file
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/>.
*/
use Modules\Interventi\Intervento;
use Modules\Banche\Banca;
use Carbon\Carbon;
include_once __DIR__.'/../../core.php';
$banca = Banca::where('id_anagrafica',$anagrafica->idanagrafica)
->where('predefined', 1)
->first();
/*
Dati Anagrafici
*/
echo '
<table class="table table-bordered">
<tr>
<th colspan="4" style="font-size:13pt;" class="text-center">'.tr('Dettaglio anagrafica', [], ['upper' => true]).'</th>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Denominazione').': <b>'.$anagrafica['ragione_sociale'].'</b></td>
</tr>
<tr>
<td colspan="4" class="text-left" >'.tr('Indirizzo').': <b>'.$anagrafica['indirizzo'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2">'.tr('Città').': <b>'.$anagrafica['citta'].'</b></td>
<td class="text-left" >'.tr('Provincia').': <b>'.$anagrafica['provincia'].'</b></td>
<td class="text-left" >'.tr('Cap').': <b>'.$anagrafica['cap'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Partita IVA').': <b>'.$anagrafica['piva'].'</b></td>
<td class="text-left" colspan="2">'.tr('Codice fiscale').': <b>'.$anagrafica['codice_fiscale'].'</b></td>
</tr>
<tr>
<td class="text-left" >'.tr('Banca').': <b>'.$banca->nome.'</b></td>
<td class="text-left" colspan="2">'.tr('IBAN').': <b>'.$banca->iban.'</b></td>
<td class="text-left">'.tr('Codice destinatario').': <b>'.$anagrafica['codice_destinatario'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Pec').': <b>'.$anagrafica['pec'].'</b></td>
<td class="text-left" colspan="2">'.tr('Email').': <b>'.$anagrafica['email'].'</b></td>
</tr>
<tr>
<td class="text-left" colspan="2" >'.tr('Telefono').': <b>'.$anagrafica['telefono'].'</b></td>
<td class="text-left">'.tr('cellulare').': <b>'.$anagrafica['cellulare'].'</b></td>
<td class="text-left">'.tr('fax').': <b>'.$anagrafica['fax'].'</b></td>
</tr>
</table>';

24
templates/azienda/init.php Executable file
View File

@ -0,0 +1,24 @@
<?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';
use Modules\Anagrafiche\Anagrafica;
$anagrafica = Anagrafica::find(setting('Azienda predefinita'));

View File

@ -152,3 +152,9 @@ ALTER TABLE `or_righe_ordini` ADD `ora_evasione` TIME NULL AFTER `data_evasione`
-- Aggiunta indice sull'id preventivo per velocizzare il caricamento del rif. numero fattura in vista preventivi -- Aggiunta indice sull'id preventivo per velocizzare il caricamento del rif. numero fattura in vista preventivi
ALTER TABLE `co_righe_documenti` ADD INDEX(`idpreventivo`); ALTER TABLE `co_righe_documenti` ADD INDEX(`idpreventivo`);
-- Aggiunta stampa dettaglio anagrafica
INSERT INTO `zz_prints` (`id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES ((SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Anagrafiche'), '1', 'Dettaglio anagrafica', 'Dettaglio anagrafica', 'Anagrafica {codice} - {ragione_sociale}', 'anagrafiche', 'idanagrafica', '', 'fa fa-print', '', '', '0', '1', '1', '1');
-- Aggiunta stampa dati aziendali
INSERT INTO `zz_prints` (`id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES ((SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Anagrafiche'), '1', 'Dati aziendali', 'Dati aziendali', 'Dati aziendali {ragione_sociale}', 'azienda', 'idanagrafica', '', 'fa fa-print', '', '', '0', '0', '0', '1');