openstamanager/modules/anagrafiche/buttons.php

86 lines
5.6 KiB
PHP
Raw Normal View History

2018-07-03 11:37:15 +02:00
<?php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
2021-01-20 15:08:51 +01:00
* Copyright (C) DevCode s.r.l.
2020-09-07 15:04:06 +02:00
*
* 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/>.
*/
2020-02-05 14:51:39 +01:00
2024-03-12 16:39:34 +01:00
use Models\Group;
2024-03-22 15:52:24 +01:00
use Models\Module;
2024-03-05 16:01:45 +01:00
2020-01-11 13:36:43 +01:00
if (in_array($id_cliente, $tipi_anagrafica) or in_array($id_fornitore, $tipi_anagrafica)) {
2018-07-03 11:37:15 +02:00
echo '
<div class="btn-group">
2024-05-29 12:58:28 +02:00
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2024-05-22 12:00:54 +02:00
<i class="fa fa-magic"></i>
'.tr('Crea').'...
2018-07-03 11:37:15 +02:00
</button>
2024-05-22 12:00:54 +02:00
<div class="dropdown-menu dropdown-menu-right">';
2018-07-03 11:37:15 +02:00
2024-01-15 15:30:45 +01:00
// Aggiunta utente per i tecnici
if (in_array($id_tecnico, $tipi_anagrafica)) {
echo '
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi utente').'" data-widget="modal" data-href="modules/utenti/user.php?id_module='.Module::where('name', 'Utenti e permessi')->first()->id.'&id_record='.Group::where('nome', 'Tecnici')->first()->id.'&idanagrafica='.$record['idanagrafica'].'">
2024-05-22 12:00:54 +02:00
<i class="fa fa-user"></i> '.tr('Nuovo utente').'
</a>';
}
2020-01-11 13:36:43 +01:00
if (in_array($id_cliente, $tipi_anagrafica)) {
echo '
2024-05-22 12:00:54 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi attività').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Interventi')->first()->id.'&idanagrafica='.$record['idanagrafica'].'">
2024-05-22 12:00:54 +02:00
<i class="fa fa-wrench"></i> '.tr('Nuova attività').'
</a>
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi preventivo').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Preventivi')->first()->id.'&idanagrafica='.$record['idanagrafica'].'">
2024-05-22 12:00:54 +02:00
<i class="fa fa-file-text"></i> '.tr('Nuovo preventivo').'
</a>
2018-07-03 11:37:15 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi contratto').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Contratti')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text-o"></i> '.tr('Nuovo contratto').'</a>
2018-07-03 11:37:15 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ordine cliente').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Ordini cliente')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o"></i> '.tr('Nuovo ordine cliente').'</a>
2018-07-03 11:37:15 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ddt in uscita').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Ddt di vendita')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck"></i> '.tr('Nuovo ddt in uscita').'</a>
2018-07-18 15:20:10 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi fattura di vendita').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Fatture di vendita')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file"></i> '.tr('Nuova fattura di vendita').'</a>
2018-07-03 11:37:15 +02:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi registrazione contabile').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Prima nota')->first()->id.'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i> '.tr('Nuova registrazione contabile (cliente)').'</a>';
2020-01-11 13:36:43 +01:00
}
2020-01-09 18:33:01 +01:00
2020-01-11 13:36:43 +01:00
if (in_array($id_fornitore, $tipi_anagrafica)) {
2024-05-22 12:00:54 +02:00
echo '
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ordine fornitore').'" data-widget="modal" data-data-href="add.php?id_module='.Module::where('name', 'Ordini fornitore')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-o fa-flip-horizontal"></i> '.tr('Nuovo ordine fornitore').'</a>
2020-01-09 18:33:01 +01:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ddt in entrata').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Ddt di acquisto')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-truck fa-flip-horizontal"></i> '.tr('Nuovo ddt in entrata').'</a>
2020-01-09 18:33:01 +01:00
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi fattura di acquisto').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Fatture di acquisto')->first()->id.'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file fa-flip-horizontal"></i> '.tr('Nuova fattura di acquisto').'</a>
2024-06-11 16:58:27 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi registrazione contabile').'" data-widget="modal" data-href="add.php?id_module='.Module::where('name', 'Prima nota')->first()->id.'&id_anagrafica='.$record['idanagrafica'].'"><i class="fa fa-euro"></i> '.tr('Nuova registrazione contabile (fornitore)').'</a>';
2020-01-11 13:36:43 +01:00
}
2020-01-09 18:33:01 +01:00
2024-05-23 11:36:25 +02:00
echo '
2024-05-22 12:00:54 +02:00
</div>
2018-07-03 11:37:15 +02:00
</div>';
2023-08-04 14:54:28 +02:00
}
2023-05-11 16:38:19 +02:00
if (in_array($id_agente, $tipi_anagrafica)) {
2024-01-15 15:30:45 +01:00
// Aggiunta liquidazione provvigioni per agente
2023-08-04 14:54:28 +02:00
echo '
2024-05-22 12:00:54 +02:00
<button type="button" class="btn btn-primary" data-title="'.tr('Liquida Provvigioni').'" data-data-href="'.base_path().'/modules/anagrafiche/liquida_provvigioni.php?nome_stampa=Provvigioni&id_record='.$id_record.'" >
<i class="fa fa-print"></i> '.tr('Liquida Provvigioni').'
</button>';
2018-07-03 11:37:15 +02:00
}