diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index b6dfd05e7..1399ad6da 100755 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -31,20 +31,20 @@ if (!$is_cliente && !$is_fornitore && $is_tecnico) { foreach ($ignore as $plugin) { echo ' -'; + '; } } if (!$is_cliente) { - $ignore = $dbo->fetchArray("SELECT id FROM zz_plugins WHERE name='Impianti del cliente' OR name='Ddt del cliente'"); + $ignore = $dbo->fetchArray("SELECT id FROM zz_plugins WHERE name IN ('Impianti del cliente','Contratti del cliente','Ddt del cliente')"); foreach ($ignore as $plugin) { echo ' -'; + '; } } diff --git a/modules/anagrafiche/plugins/contratti_cliente.php b/modules/anagrafiche/plugins/contratti_cliente.php new file mode 100755 index 000000000..a46606065 --- /dev/null +++ b/modules/anagrafiche/plugins/contratti_cliente.php @@ -0,0 +1,216 @@ +. + */ + +include_once __DIR__.'/../../../core.php'; + +use Modules\Contratti\Contratto; + +//Estraggo tutti i contratti del cliente +$contratti = $dbo->table("co_contratti")->where('idanagrafica',$id_record)->get(); + +if( !$contratti->isEmpty() ){ + echo ' +
+
+ + + + + + '; + + foreach($contratti as $c){ + $contratto = Contratto::find($c->id); + $righe = $contratto->getRighe(); + + // Calcoli + $imponibile = abs($contratto->imponibile); + $sconto = $contratto->sconto; + $totale_imponibile = abs($contratto->totale_imponibile); + $iva = abs($contratto->iva); + $totale = abs($contratto->totale); + + $descrizione = tr('Contratto num. _NUM_ del _DATA_',[ + '_NUM_' => $contratto->numero, + '_DATA_' => Translator::dateToLocale($contratto->data_bozza), + ]); + echo ' + + + + + '; + + if( $righe->isempty() ){ + echo ' + + + '; + }else{ + echo ' + + + '; + } + } + + echo ' +
'.tr('Documento').''.tr('Totale').'
'.Modules::link('Contratti', $contratto->id, $descrizione).''.moneyFormat($contratto->totale, 2).' + +
'.tr('Nessuna riga presente!').'
+
+
'; +}else{ + echo ' +
+
+ '.tr('Non è stato trovato nessun contratto associato a questo cliente!').' +
+
'; +} \ No newline at end of file diff --git a/update/2_4_27.sql b/update/2_4_27.sql index 80a16758f..ccecabc94 100644 --- a/update/2_4_27.sql +++ b/update/2_4_27.sql @@ -25,4 +25,7 @@ INSERT INTO `zz_tasks` (`id`, `name`, `class`, `expression`, `next_execution_at` (NULL, 'Eliminazione automatica coda d\'invio', 'Modules\\StatoEmail\\EliminaMailTask', '0 */4 * * *', NULL, NULL); INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES -(NULL, 'Numero di giorni mantenimento coda di invio', '0', 'integer', 1, 'Mail', 1, NULL); \ No newline at end of file +(NULL, 'Numero di giorni mantenimento coda di invio', '0', 'integer', 1, 'Mail', 1, NULL); + +-- Plugin contratti del cliente +INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Contratti del cliente', 'Contratti del cliente', '2', '2', 'tab', 'contratti_cliente.php', '1', '0', '0', '', '', NULL, NULL, '', ''); \ No newline at end of file