openstamanager/modules/anagrafiche/buttons.php

86 lines
6.1 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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi utente').'" data-widget="modal" data-href="modules/utenti/user.php?id_module='.(new Module())->getByField('title', 'Utenti e permessi', Models\Locale::getPredefined()->id)->id_record.'&id_record='.(new Group())->getByField('title', 'Tecnici', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi attività').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Attività', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'">
2024-05-22 12:00:54 +02:00
<i class="fa fa-wrench"></i> '.tr('Nuova attività').'
</a>
2024-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi preventivo').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Preventivi', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi contratto').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Contratti', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ordine cliente').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Ordini cliente', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ddt in uscita').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Ddt in uscita', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi fattura di vendita').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Fatture di vendita', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi registrazione contabile').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Prima nota', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ordine fornitore').'" data-widget="modal" data-data-href="add.php?id_module='.(new Module())->getByField('title', 'Ordini fornitore', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi ddt in entrata').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Ddt in entrata', Models\Locale::getPredefined()->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-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi fattura di acquisto').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Fatture di acquisto', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file fa-flip-horizontal"></i> '.tr('Nuova fattura di acquisto').'</a>
2024-05-30 15:18:28 +02:00
<a class="dropdown-item" data-title="'.tr('Aggiungi registrazione contabile').'" data-widget="modal" data-href="add.php?id_module='.(new Module())->getByField('title', 'Prima nota', Models\Locale::getPredefined()->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
}