openstamanager/modules/anagrafiche/buttons.php

87 lines
5.9 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-16 18:02:50 +02:00
<button type="button" class="btn btn-info dropdown-toggle" data-widget="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-magic"></i>
2019-11-19 16:01:43 +01:00
'.tr('Crea').'... <span class="caret"></span>
2018-07-03 11:37:15 +02:00
<span class="sr-only">Toggle Dropdown</span>
</button>
2020-01-09 18:33:01 +01:00
<ul 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-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi utente').'" 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'].'"><i class="fa fa-user"></i>'.tr('Nuovo utente').'
</a></li>';
}
2020-01-11 13:36:43 +01:00
if (in_array($id_cliente, $tipi_anagrafica)) {
echo '
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi attività').'" data-href="add.php?id_module='.(new Module())->getByField('title', 'Attività', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-wrench"></i>'.tr('Nuova attività').'
2018-07-03 11:37:15 +02:00
</a></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi preventivo').'" data-href="add.php?id_module='.(new Module())->getByField('title', 'Preventivi', Models\Locale::getPredefined()->id).'&idanagrafica='.$record['idanagrafica'].'"><i class="fa fa-file-text"></i>'.tr('Nuovo preventivo').'
2018-07-03 11:37:15 +02:00
</a></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi contratto').'" 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').'
2018-07-03 11:37:15 +02:00
</a></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi ordine cliente').'" 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').'
2018-07-03 11:37:15 +02:00
</a></li>
2018-07-18 15:20:10 +02:00
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi ddt uscita').'" 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').'
2018-07-05 17:23:21 +02:00
</a></li>
2018-07-03 11:37:15 +02:00
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi fattura di vendita').'" 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></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi registrazione contabile').'" 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)').'
2020-01-09 18:33:01 +01:00
</a></li>';
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-16 18:02:50 +02:00
echo '<li><a data-widget="modal" data-title="'.tr('Aggiungi ordine fornitore').'" 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').'
2020-01-09 18:33:01 +01:00
</a></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi ddt entrata').'" 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').'
2020-01-09 18:33:01 +01:00
</a></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi fattura di acquisto').'" 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></li>
2024-05-16 18:02:50 +02:00
<li><a data-widget="modal" data-title="'.tr('Aggiungi registrazione contabile').'" 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)').'
2020-01-09 18:33:01 +01:00
</a></li>';
2020-01-11 13:36:43 +01:00
}
2020-01-09 18:33:01 +01:00
2020-01-11 13:36:43 +01:00
echo '
2018-07-03 11:37:15 +02:00
</ul>
</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 '
<button type="button" class="btn btn-primary" data-title="'.tr('Liquida Provvigioni').'" 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
}