mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Gestione contratto predefinito e miglioramenti plugin
This commit is contained in:
parent
075748132b
commit
389b7c27b0
@ -23,7 +23,7 @@ include_once __DIR__.'/../../../core.php';
|
|||||||
|
|
||||||
switch ($resource) {
|
switch ($resource) {
|
||||||
case 'clienti':
|
case 'clienti':
|
||||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, is_bloccata, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(deleted_at IS NULL, '', ' (".tr('eliminata').")'), IF(is_bloccata = 1, CONCAT(' (', an_relazioni.descrizione, ')'), '') ) AS descrizione, idtipointervento_default AS idtipointervento, in_tipiintervento.descrizione AS idtipointervento_descrizione, an_anagrafiche.idzona FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN in_tipiintervento ON an_anagrafiche.idtipointervento_default=in_tipiintervento.idtipointervento LEFT JOIN an_relazioni ON an_anagrafiche.idrelazione=an_relazioni.id |where| ORDER BY ragione_sociale";
|
$query = "SELECT an_anagrafiche.idanagrafica AS id, is_bloccata, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(deleted_at IS NULL, '', ' (".tr('eliminata').")'), IF(is_bloccata = 1, CONCAT(' (', an_relazioni.descrizione, ')'), '') ) AS descrizione, idtipointervento_default AS idtipointervento, in_tipiintervento.descrizione AS idtipointervento_descrizione, an_anagrafiche.idzona, contratto.id AS id_contratto, contratto.descrizione AS descrizione_contratto FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN in_tipiintervento ON an_anagrafiche.idtipointervento_default=in_tipiintervento.idtipointervento LEFT JOIN an_relazioni ON an_anagrafiche.idrelazione=an_relazioni.id LEFT JOIN (SELECT co_contratti.id, idanagrafica, CONCAT('Contratto ', numero, ' del ', DATE_FORMAT(data_bozza, '%d/%m/%Y'), ' - ', co_contratti.nome, ' [', `co_staticontratti`.`descrizione` , ']') AS descrizione FROM co_contratti LEFT JOIN co_staticontratti ON co_contratti.idstato=co_staticontratti.id WHERE co_contratti.predefined=1 AND is_pianificabile=1) AS contratto ON an_anagrafiche.idanagrafica=contratto.idanagrafica |where| ORDER BY ragione_sociale";
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
||||||
|
@ -517,6 +517,10 @@ echo '
|
|||||||
// Impostazione del tipo intervento da anagrafica
|
// Impostazione del tipo intervento da anagrafica
|
||||||
input("idtipointervento").getElement()
|
input("idtipointervento").getElement()
|
||||||
.selectSetNew(data.idtipointervento, data.idtipointervento_descrizione);
|
.selectSetNew(data.idtipointervento, data.idtipointervento_descrizione);
|
||||||
|
|
||||||
|
// Impostazione del contratto predefinito da anagrafica
|
||||||
|
input("idcontratto").getElement()
|
||||||
|
.selectSetNew(data.id_contratto, data.descrizione_contratto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
|
41
plugins/contratti_anagrafiche/actions.php
Normal file
41
plugins/contratti_anagrafiche/actions.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?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';
|
||||||
|
|
||||||
|
$operazione = filter('op');
|
||||||
|
|
||||||
|
switch ($operazione) {
|
||||||
|
case 'updatecontratto':
|
||||||
|
$opt_out_newsletter = post('disable_newsletter');
|
||||||
|
|
||||||
|
if (!empty(post('predefined'))) {
|
||||||
|
$dbo->update('co_contratti', [
|
||||||
|
'predefined' => 0,
|
||||||
|
], ['idanagrafica' => $id_parent]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbo->update('co_contratti', [
|
||||||
|
'predefined' => post('predefined'),
|
||||||
|
], ['id' => $id_record]);
|
||||||
|
|
||||||
|
flash()->info(tr('Salvataggio completato!'));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
46
plugins/contratti_anagrafiche/edit.php
Normal file
46
plugins/contratti_anagrafiche/edit.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?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';
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<form action="" method="post" role="form">
|
||||||
|
<input type="hidden" name="id_plugin" value="'.$id_plugin.'">
|
||||||
|
<input type="hidden" name="id_parent" value="'.$id_parent.'">
|
||||||
|
<input type="hidden" name="id_record" value="'.$id_record.'">
|
||||||
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
|
<input type="hidden" name="op" value="updatecontratto">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
'.Modules::link('Contratti', $record['id'], null, null, 'class="pull-right"').'
|
||||||
|
{[ "type": "select", "label": "'.tr('Contratto').'", "name": "idcontratto", "value": "$id$", "ajax-source": "contratti", "disabled": "1" ]}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
{[ "type": "checkbox", "label": "'.tr('Predefinito').'", "name": "predefined", "value" : "$predefined$" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- PULSANTI -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check"></i> '.tr('Salva').'</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>';
|
24
plugins/contratti_anagrafiche/init.php
Normal file
24
plugins/contratti_anagrafiche/init.php
Normal 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';
|
||||||
|
|
||||||
|
if (isset($id_record)) {
|
||||||
|
$record = $dbo->fetchOne('SELECT * FROM co_contratti WHERE id='.prepare($id_record));
|
||||||
|
}
|
3
update/2_4_32.sql
Normal file
3
update/2_4_32.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
UPDATE `zz_plugins` SET `script` = '', `options` = ' { \"main_query\": [ { \"type\": \"table\", \"fields\": \"Numero, Nome, Totale, Stato, Predefinito\", \"query\": \"SELECT co_contratti.id, numero AS Numero, `co_contratti`.`nome` AS Nome, an_anagrafiche.ragione_sociale AS Cliente, FORMAT(righe.totale_imponibile,2) AS Totale, co_staticontratti.descrizione AS Stato, IF(`co_contratti`.`predefined`=1, \'SÌ\', \'NO\') AS Predefinito FROM `co_contratti` LEFT JOIN `an_anagrafiche` ON `co_contratti`.`idanagrafica` = `an_anagrafiche`.`idanagrafica` LEFT JOIN `co_staticontratti` ON `co_contratti`.`idstato` = `co_staticontratti`.`id` LEFT JOIN (SELECT `idcontratto`, SUM(`subtotale` - `sconto`) AS `totale_imponibile`, SUM(`subtotale` - `sconto` + `iva`) AS `totale` FROM `co_righe_contratti` GROUP BY `idcontratto` ) AS righe ON `co_contratti`.`id` =`righe`.`idcontratto` WHERE 1=1 AND `co_contratti`.`idanagrafica`=|id_parent| GROUP BY `co_contratti`.`id` HAVING 2=2 ORDER BY `co_contratti`.`id` ASC\"} ]}', `directory` = 'contratti_anagrafiche' WHERE `zz_plugins`.`name` = 'Contratti del cliente';
|
||||||
|
|
||||||
|
ALTER TABLE `co_contratti` ADD `predefined` BOOLEAN NOT NULL AFTER `condizioni_fornitura`;
|
Loading…
x
Reference in New Issue
Block a user