mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
9f02074294
@ -1119,12 +1119,6 @@ div.tip {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Stile Fullcalendar per weekend */
|
||||
.fc-day-sat,
|
||||
.fc-day-sun {
|
||||
background-color: rgba(255,49,21,.3) !important;
|
||||
}
|
||||
|
||||
.login-box .img-responsive {
|
||||
padding: 18px 0px 4px;
|
||||
}
|
||||
@ -1198,4 +1192,35 @@ div.tip {
|
||||
height: 23px;
|
||||
padding: 3px 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Spunta checkbox viste
|
||||
*/
|
||||
table.dataTable>tbody>tr.selected>td.select-checkbox::after,
|
||||
table.dataTable>tbody>tr.selected>th.select-checkbox::after {
|
||||
margin-top: -25px;
|
||||
}
|
||||
|
||||
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
margin: 4px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.sidebar-menu>li {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.widget-user .widget-user-image>img {
|
||||
-webkit-box-shadow: -10px 0px 13px -7px #000000, 10px 0px 13px -7px #000000, 5px 5px 15px 5px rgba(0, 0, 0, 0);
|
||||
box-shadow: -10px 0px 13px -7px #000000, 10px 0px 13px -7px #000000, 5px 5px 15px 5px rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Colore eventi fullcalendar
|
||||
*/
|
||||
.fc .fc-bg-event {
|
||||
background: rgba(255, 49, 21, .5) !important;
|
||||
}
|
@ -468,4 +468,38 @@ switch (filter('op')) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'calendario_eventi':
|
||||
|
||||
$start = filter('start');
|
||||
$end = filter('end');
|
||||
|
||||
$query = 'SELECT * FROM `zz_events` WHERE `zz_events`.`is_bank_holiday` = 1 AND `zz_events`.`data` >= '.prepare($start).' AND `zz_events`.`data` <= '.prepare($end);
|
||||
|
||||
$eventi = $dbo->fetchArray($query);
|
||||
|
||||
$results = [];
|
||||
foreach ($eventi as $evento) {
|
||||
$results[] = [
|
||||
'id' => $evento['id'],
|
||||
'title' => $evento['nome'],
|
||||
'start' => $evento['data'],
|
||||
'end' => date('Y-m-d', strtotime($evento['data']. '+1 day')),
|
||||
|
||||
//'initialDate' => $evento['data'],
|
||||
//'startRecur' => (($evento['is_recurring']) ? $evento['data'] : ''),
|
||||
//'endRecur' => (($evento['is_recurring']) ? date('Y-m-d', strtotime($evento['data']. '+1 day')) : ''),
|
||||
|
||||
'display' => "background",
|
||||
'allDay' => true,
|
||||
'overlap' => true,
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
@ -339,13 +339,31 @@ if ($vista == 'mese') {
|
||||
$def = 'listWeek';
|
||||
}
|
||||
|
||||
$days = [
|
||||
1 => 'Lunedì',
|
||||
2 => 'Martedì',
|
||||
3 => 'Mercoledì',
|
||||
4 => 'Giovedì',
|
||||
5 => 'Venerdì',
|
||||
6 => 'Sabato',
|
||||
0 => 'Domenica'
|
||||
];
|
||||
$working_days = explode(",",setting('Giorni lavorativi'));
|
||||
$non_working_days = [];
|
||||
|
||||
foreach ($days as $key => $day) {
|
||||
if (!in_array($day, $working_days)) {
|
||||
array_push($non_working_days, $key);
|
||||
}
|
||||
}
|
||||
|
||||
$modulo_interventi = Modules::get('Interventi');
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var Draggable = FullCalendar.Draggable;
|
||||
globals.dashboard = {
|
||||
load_url: "'.$structure->fileurl('ajax.php').'?id_module='.$id_module.'",
|
||||
load_url: "'.$structure->fileurl('ajax.php').'",
|
||||
style: "'.$def.'",
|
||||
show_sunday: '.intval(setting('Visualizzare la domenica sul calendario')).',
|
||||
start_time: "'.setting('Ora inizio sul calendario').'",
|
||||
@ -687,10 +705,10 @@ echo '
|
||||
|
||||
eventDidMount: function(info){
|
||||
let element = $(info.el);
|
||||
|
||||
|
||||
let id_record = info.event.extendedProps.idintervento;
|
||||
|
||||
if (globals.dashboard.tooltip == 1) {
|
||||
if (globals.dashboard.tooltip == 1 && element[0].childElementCount > 0 ) {
|
||||
element.tooltipster({
|
||||
content: globals.translations.loading + "...",
|
||||
animation: "grow",
|
||||
@ -713,9 +731,10 @@ echo '
|
||||
id_record: id_record,
|
||||
allDay: info.event.allDay,
|
||||
}, function (data, response) {
|
||||
instance.content(data);
|
||||
|
||||
$origin.data("loaded", true);
|
||||
if (data !== "") {
|
||||
instance.content(data);
|
||||
$origin.data("loaded", true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -723,13 +742,40 @@ echo '
|
||||
}
|
||||
},
|
||||
|
||||
events: {
|
||||
url: globals.dashboard.load_url + "&op=interventi_periodo",
|
||||
type: "GET",
|
||||
error: function () {
|
||||
swal(globals.dashboard.genericError, globals.dashboard.error, "error");
|
||||
eventSources: [
|
||||
{
|
||||
url: globals.dashboard.load_url,
|
||||
type: "POST",
|
||||
extraParams: {
|
||||
op: "interventi_periodo",
|
||||
id_module: "'.$id_module.'"
|
||||
},
|
||||
failure: function () {
|
||||
swal(globals.dashboard.genericError, globals.dashboard.error, "error");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
url: globals.dashboard.load_url,
|
||||
method: "POST",
|
||||
extraParams: {
|
||||
op: "calendario_eventi",
|
||||
id_module: "'.$id_module.'"
|
||||
},
|
||||
failure: function () {
|
||||
swal(globals.dashboard.genericError, globals.dashboard.error, "error");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
calendar.addEvent({
|
||||
daysOfWeek: "'.implode(',', $non_working_days).'",
|
||||
display: "background",
|
||||
overlap: true,
|
||||
allDay: true
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
|
52
modules/segmenti/bulk.php
Normal file
52
modules/segmenti/bulk.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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';
|
||||
|
||||
switch (post('op')) {
|
||||
case 'set_groups':
|
||||
|
||||
$id_gruppi = explode(",",post('gruppi', true)[0]);
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
|
||||
// Aggiornamento dei permessi relativi
|
||||
$dbo->sync('zz_group_segment', ['id_segment' => $id], ['id_gruppo' => (array) $id_gruppi]);
|
||||
|
||||
}
|
||||
|
||||
flash()->info(tr('Gruppi con accesso ai segmenti aggiornati!'));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$operations['set_groups'] = [
|
||||
'text' => '<span><i class="fa fa-users"></i> '.tr('Imposta l\'accesso ai segmenti').'</span>',
|
||||
'data' => [
|
||||
'title' => tr('Imposta l\'accesso ai segmenti.'),
|
||||
'msg' => '{[ "type": "select", "multiple":"1", "label": "<small>'.tr('Seleziona i gruppi che avranno accesso ai segmenti selezionati:').'</small>", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "name": "gruppi[]" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
'blank' => false,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
return $operations;
|
@ -55,7 +55,7 @@ if ($user_photo) {
|
||||
<img src="'.$user_photo.'" class="img-circle" alt="'.$user['username'].'" />';
|
||||
} else {
|
||||
echo '
|
||||
<i class="fa fa-user-circle-o fa-4x pull-left" alt="'.tr('OpenSTAManager').'"></i>';
|
||||
<i style="color:white;margin-left:5px;" class="fa fa-user-circle-o fa-5x" alt="'.tr('OpenSTAManager').'"></i>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
@ -2,8 +2,8 @@
|
||||
"private": true,
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {
|
||||
"@fullcalendar/moment": "^6.1.4",
|
||||
"@fullcalendar/moment-timezone": "^6.1.4",
|
||||
"@fullcalendar/moment": "^6.1.5",
|
||||
"@fullcalendar/moment-timezone": "^6.1.5",
|
||||
"admin-lte": "^2.4.18",
|
||||
"autocompleter": "^6.1.1",
|
||||
"autonumeric": "^4.6.0",
|
||||
@ -22,7 +22,7 @@
|
||||
"dropzone": "^5.7.2",
|
||||
"eonasdan-bootstrap-datetimepicker": "^4.17.49",
|
||||
"font-awesome": "^4.7.0",
|
||||
"fullcalendar-scheduler": "^6.1.4",
|
||||
"fullcalendar-scheduler": "^6.1.5",
|
||||
"geocomplete": "^1.7.0",
|
||||
"hotkeys-js": "^3.8.5",
|
||||
"html5sortable": "^0.13.2",
|
||||
|
@ -207,7 +207,7 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt
|
||||
*/
|
||||
public function getTotaleAttribute()
|
||||
{
|
||||
return $this->calcola('totale_imponibile') + $this->calcola('iva') + $this->rivalsa_inps + $this->iva_rivalsa_inps;
|
||||
return $this->calcola('totale_imponibile') + $this->iva + $this->calcola('rivalsa_inps');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,43 +50,21 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
||||
SUM(subtotale) AS subtotale
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(
|
||||
(iva + iva_rivalsainps) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS iva,
|
||||
SUM(
|
||||
(subtotale - sconto) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 0 AND idstatodocumento NOT IN(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
co_statidocumento
|
||||
WHERE
|
||||
descrizione = "Bozza" OR descrizione = "Annullata"
|
||||
) AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY cod_iva, aliquota, descrizione
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
UNION
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
@ -121,43 +99,21 @@ $iva_vendite = $dbo->fetchArray('
|
||||
SUM(subtotale) AS subtotale
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(
|
||||
(iva + iva_rivalsainps) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS iva,
|
||||
SUM(
|
||||
(subtotale - sconto) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
co_statidocumento
|
||||
WHERE
|
||||
descrizione = "Bozza" OR descrizione = "Annullata"
|
||||
) AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY cod_iva, aliquota, descrizione
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
UNION
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
@ -191,43 +147,21 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
||||
SUM(subtotale) AS subtotale
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(
|
||||
(iva + iva_rivalsainps) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS iva,
|
||||
SUM(
|
||||
(subtotale - sconto) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
co_statidocumento
|
||||
WHERE
|
||||
descrizione = "Bozza" OR descrizione = "Annullata"
|
||||
) AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).'
|
||||
GROUP BY cod_iva, aliquota, descrizione
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
UNION
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
@ -261,43 +195,21 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
||||
SUM(subtotale) AS subtotale
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(
|
||||
(iva + iva_rivalsainps) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS iva,
|
||||
SUM(
|
||||
(subtotale - sconto) *(
|
||||
IF(
|
||||
co_tipidocumento.reversed = 0,
|
||||
1,
|
||||
-1
|
||||
)
|
||||
)
|
||||
) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
co_statidocumento
|
||||
WHERE
|
||||
descrizione = "Bozza" OR descrizione = "Annullata"
|
||||
) AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).'
|
||||
GROUP BY cod_iva, aliquota, descrizione
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
INNER JOIN co_documenti ON co_documenti.id = co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_tipidocumento.id = co_documenti.idtipodocumento
|
||||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
UNION
|
||||
SELECT
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
@ -331,8 +243,8 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -348,8 +260,8 @@ $iva_vendite = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -365,8 +277,8 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -382,8 +294,8 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -400,8 +312,8 @@ $iva_vendite_nonesigibile = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -417,8 +329,8 @@ $iva_acquisti_detraibile = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(((co_righe_documenti.iva*(100-indetraibile)/100) + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -434,8 +346,8 @@ $iva_acquisti_nondetraibile = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM(((co_righe_documenti.iva*indetraibile/100) + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -451,8 +363,8 @@ $iva_acquisti = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -468,8 +380,8 @@ $iva_acquisti = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
@ -485,8 +397,8 @@ $iva_acquisti = $dbo->fetchArray('
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
SUM((co_righe_documenti.iva + iva_rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
SUM((co_righe_documenti.iva + co_righe_documenti.rivalsainps * percentuale/100) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS subtotale
|
||||
FROM
|
||||
co_iva
|
||||
INNER JOIN co_righe_documenti ON co_righe_documenti.idiva = co_iva.id
|
||||
|
@ -38,6 +38,7 @@ if ((!empty($vendita_banco)) && ($id_sezionale == -1) && ($tipo == 'vendite')){
|
||||
SELECT
|
||||
data_registrazione,
|
||||
numero_esterno,
|
||||
data,
|
||||
codice_tipo_documento_fe,
|
||||
percentuale,
|
||||
descrizione,
|
||||
@ -53,14 +54,15 @@ if ((!empty($vendita_banco)) && ($id_sezionale == -1) && ($tipo == 'vendite')){
|
||||
SELECT
|
||||
co_documenti.data_registrazione,
|
||||
co_documenti.numero_esterno,
|
||||
co_documenti.data,
|
||||
co_tipidocumento.codice_tipo_documento_fe,
|
||||
co_iva.percentuale,
|
||||
co_iva.descrizione,
|
||||
co_documenti.id AS id,
|
||||
IF(numero = "", numero_esterno, numero) AS numero,
|
||||
SUM((subtotale-sconto)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS subtotale,
|
||||
SUM((subtotale-sconto+iva+co_righe_documenti.rivalsainps-co_righe_documenti.ritenutaacconto)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS totale,
|
||||
SUM((iva+iva_rivalsainps)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS iva,
|
||||
SUM((subtotale-sconto+co_righe_documenti.rivalsainps)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS subtotale,
|
||||
SUM((subtotale-sconto+co_righe_documenti.rivalsainps+iva+co_righe_documenti.rivalsainps * percentuale/100)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS totale,
|
||||
SUM((iva + co_righe_documenti.rivalsainps * percentuale/100)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS iva,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
an_anagrafiche.codice AS codice_anagrafica
|
||||
FROM
|
||||
@ -77,6 +79,7 @@ if ((!empty($vendita_banco)) && ($id_sezionale == -1) && ($tipo == 'vendite')){
|
||||
SELECT
|
||||
vb_venditabanco.data as data_registrazione,
|
||||
vb_venditabanco.numero as numero_esterno,
|
||||
vb_venditabanco.data as data,
|
||||
"Vendita al banco" as codice_tipo_documento_fe,
|
||||
co_iva.percentuale,
|
||||
co_iva.descrizione,
|
||||
@ -99,7 +102,7 @@ if ((!empty($vendita_banco)) && ($id_sezionale == -1) && ($tipo == 'vendite')){
|
||||
co_iva.id, id, an_anagrafiche.idanagrafica
|
||||
) AS tabella
|
||||
GROUP BY
|
||||
iva, id, data_registrazione, numero_esterno, codice_tipo_documento_fe, percentuale, descrizione, numero, ragione_sociale, codice_anagrafica
|
||||
iva, id, data_registrazione, data, numero_esterno, codice_tipo_documento_fe, percentuale, descrizione, numero, ragione_sociale, codice_anagrafica
|
||||
ORDER BY CAST(numero_esterno AS UNSIGNED)';
|
||||
}
|
||||
|
||||
@ -108,14 +111,15 @@ else {
|
||||
SELECT
|
||||
co_documenti.data_registrazione,
|
||||
co_documenti.numero_esterno,
|
||||
co_documenti.data,
|
||||
co_tipidocumento.codice_tipo_documento_fe,
|
||||
co_iva.percentuale,
|
||||
co_iva.descrizione,
|
||||
co_documenti.id AS id,
|
||||
IF(numero = "", numero_esterno, numero) AS numero,
|
||||
SUM((subtotale-sconto)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS subtotale,
|
||||
SUM((subtotale-sconto+iva+co_righe_documenti.rivalsainps-co_righe_documenti.ritenutaacconto)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS totale,
|
||||
SUM((iva+iva_rivalsainps)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS iva,
|
||||
SUM((subtotale-sconto+co_righe_documenti.rivalsainps)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS subtotale,
|
||||
SUM((subtotale-sconto+co_righe_documenti.rivalsainps+iva+(co_righe_documenti.rivalsainps * percentuale/100))*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS totale,
|
||||
SUM((iva + co_righe_documenti.rivalsainps * percentuale/100)*(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS iva,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
an_anagrafiche.codice AS codice_anagrafica
|
||||
FROM
|
||||
|
@ -655,7 +655,7 @@ CREATE TABLE IF NOT EXISTS `co_dichiarazioni_intento` (
|
||||
|
||||
ALTER TABLE `co_documenti` ADD `id_dichiarazione_intento` int(11), ADD FOREIGN KEY (`id_dichiarazione_intento`) REFERENCES `co_dichiarazioni_intento`(`id`) ON DELETE SET NULL;
|
||||
|
||||
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Dichiarazioni d''Intento', 'Dichiarazioni d''Intento', (SELECT id FROM zz_modules WHERE name = 'Fatture di vendita'), (SELECT id FROM zz_modules WHERE name='Anagrafiche'), 'tab', '', '1', '1', '0', '', '', NULL, '{ "main_query": [ { "type": "table", "fields": "Protocollo, Progressivo, Massimale, Totale, Data inizio, Data fine", "query": "SELECT id, numero_protocollo AS Protocollo, numero_progressivo AS Progressivo, DATE_FORMAT(data_inizio,''%d/%m/%Y'') AS ''Data inizio'', DATE_FORMAT(data_inizio,''%d/%m/%Y'') AS ''Data fine'', ROUND(massimale, 2) AS Massimale, ROUND(totale, 2) AS Totale FROM co_dichiarazioni_intento WHERE 1=1 AND deleted_at IS NULL AND id_anagrafica = |id_parent| HAVING 2=2 ORDER BY co_dichiarazioni_intento.id DESC"} ]}', 'dichiarazioni_intento', '');
|
||||
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Dichiarazioni d''Intento', 'Dichiarazioni d''Intento', (SELECT id FROM zz_modules WHERE name = 'Fatture di vendita'), (SELECT `id` FROM `zz_modules` WHERE name='Anagrafiche'), 'tab', '', '1', '1', '0', '', '', NULL, '{ "main_query": [ { "type": "table", "fields": "Protocollo, Progressivo, Massimale, Totale, Data inizio, Data fine", "query": "SELECT id, numero_protocollo AS Protocollo, numero_progressivo AS Progressivo, DATE_FORMAT(data_inizio,''%d/%m/%Y'') AS ''Data inizio'', DATE_FORMAT(data_inizio,''%d/%m/%Y'') AS ''Data fine'', ROUND(massimale, 2) AS Massimale, ROUND(totale, 2) AS Totale FROM co_dichiarazioni_intento WHERE 1=1 AND deleted_at IS NULL AND id_anagrafica = |id_parent| HAVING 2=2 ORDER BY co_dichiarazioni_intento.id DESC"} ]}', 'dichiarazioni_intento', '');
|
||||
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES
|
||||
(NULL, 'Iva per lettere d''intento', '', 'query=SELECT id, descrizione FROM `co_iva` WHERE codice_natura_fe = ''N3'' AND deleted_at IS NULL ORDER BY descrizione ASC', 1, 'Fatturazione', 11);
|
||||
|
@ -299,8 +299,8 @@ ORDER BY
|
||||
-- Ottimizzazione query vista Template email
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`id`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`id`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = '#';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`NAME`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`SUBJECT`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'Oggetto';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`name`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`subject`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'Oggetto';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = ' `zz_modules`.`name`' WHERE `zz_modules`.`name` = 'Template email' AND `zz_views`.`name` = 'Modulo';
|
||||
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
@ -318,9 +318,9 @@ ORDER BY
|
||||
|
||||
-- Ottimizzazione query vista Campi personalizzati
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_fields`.`id`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`NAME`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_plugins`.`NAME`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Plugin';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_fields`.`NAME`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`name`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_plugins`.`name`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Plugin';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_fields`.`name`' WHERE `zz_modules`.`name` = 'Campi personalizzati' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
FROM
|
||||
@ -335,8 +335,8 @@ HAVING
|
||||
|
||||
-- Ottimizzazione query vista Segmenti
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_segments`.`id`' WHERE `zz_modules`.`name` = 'Segmenti' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_segments`.`NAME`' WHERE `zz_modules`.`name` = 'Segmenti' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`NAME`' WHERE `zz_modules`.`name` = 'Segmenti' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_segments`.`name`' WHERE `zz_modules`.`name` = 'Segmenti' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`name`' WHERE `zz_modules`.`name` = 'Segmenti' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
FROM
|
||||
@ -346,7 +346,7 @@ WHERE
|
||||
1=1
|
||||
HAVING
|
||||
2=2
|
||||
ORDER BY `zz_segments`.`NAME`,
|
||||
ORDER BY `zz_segments`.`name`,
|
||||
`zz_segments`.`id_module`" WHERE `name` = 'Segmenti';
|
||||
|
||||
|
||||
@ -458,9 +458,9 @@ ORDER BY
|
||||
|
||||
-- Ottimizzazione query vista Checklists
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_checklists`.`id`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_checklists`.`NAME`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`NAME`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_plugins`.`NAME`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Plugin';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_checklists`.`name`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_modules`.`name`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`zz_plugins`.`name`' WHERE `zz_modules`.`name` = 'Checklists' AND `zz_views`.`name` = 'Plugin';
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
FROM
|
||||
@ -494,8 +494,8 @@ HAVING
|
||||
|
||||
-- Ottimizzazione query vista Newsletter
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_newsletters`.`id`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_newsletters`.`NAME`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`NAME`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Template';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_newsletters`.`name`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Nome';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`em_templates`.`name`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Template';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`totale`' WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Destinatari';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = "IF(completed_at IS NULL OR em_newsletters.state='DEV', 'No', CONCAT('Sì ', '(', DATE_FORMAT(completed_at, '%d/%m/%Y %H:%i:%s'),')'))" WHERE `zz_modules`.`name` = 'Newsletter' AND `zz_views`.`name` = 'Completato';
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
@ -574,7 +574,7 @@ FROM
|
||||
INNER JOIN mg_articoli ON mg_articoli.id = mg_prezzi_articoli.id_articolo
|
||||
LEFT JOIN mg_categorie AS categoria ON mg_articoli.id_categoria = categoria.id
|
||||
LEFT JOIN mg_categorie AS sottocategoria ON mg_articoli.id_sottocategoria = sottocategoria.id
|
||||
LEFT JOIN zz_modules ON zz_modules.NAME= 'Articoli'
|
||||
LEFT JOIN zz_modules ON zz_modules.name= 'Articoli'
|
||||
LEFT JOIN (SELECT codice_fornitore AS codice, id_articolo, id_fornitore, barcode_fornitore AS barcode, deleted_at FROM mg_fornitore_articolo) AS fornitore ON mg_prezzi_articoli.id_articolo= fornitore.id_articolo AND mg_prezzi_articoli.id_anagrafica=fornitore.id_fornitore AND fornitore.deleted_at IS NULL
|
||||
WHERE
|
||||
1=1 AND mg_articoli.deleted_at IS NULL AND an_anagrafiche.deleted_at IS NULL
|
||||
@ -654,7 +654,7 @@ DELETE FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Formato codice contratti
|
||||
ALTER TABLE `co_righe_promemoria` ADD `provvigione` DECIMAL(15,6) NOT NULL AFTER `prezzo_unitario_ivato`, ADD `provvigione_unitaria` DECIMAL(15,6) NOT NULL AFTER `provvigione`, ADD `provvigione_percentuale` DECIMAL(15,6) NOT NULL AFTER `provvigione_unitaria`, ADD `tipo_provvigione` ENUM('UNT','PRC') NOT NULL DEFAULT 'UNT' AFTER `provvigione_percentuale`;
|
||||
|
||||
-- Ottimizzazione query vista Stampe
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'zz_modules.NAME' WHERE `zz_modules`.`name` = 'Stampe' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'zz_modules.name' WHERE `zz_modules`.`name` = 'Stampe' AND `zz_views`.`name` = 'Modulo';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'zz_prints.id' WHERE `zz_modules`.`name` = 'Stampe' AND `zz_views`.`name` = 'id';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'zz_prints.title' WHERE `zz_modules`.`name` = 'Stampe' AND `zz_views`.`name` = 'Titolo';
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
@ -722,7 +722,7 @@ FROM
|
||||
`mg_listini`
|
||||
LEFT JOIN (SELECT `mg_listini_articoli`.`id_listino`, COUNT(`id_listino`) AS num FROM `mg_listini_articoli` GROUP BY `id_listino`) AS articoli ON `mg_listini`.`id`=`articoli`.`id_listino`
|
||||
LEFT JOIN (SELECT `an_anagrafiche`.`id_listino`, COUNT(`id_listino`) AS num FROM `an_anagrafiche` GROUP BY `id_listino`) AS anagrafiche ON `mg_listini`.`id`=`anagrafiche`.`id_listino`
|
||||
LEFT JOIN (SELECT `zz_users`.`id`, `zz_users`.`username` FROM `zz_users` INNER JOIN (SELECT `id_utente`, `id_record` FROM `zz_operations` INNER JOIN `zz_modules` ON `zz_modules`.`NAME` = 'Listini cliente' ORDER BY `id_utente` DESC LIMIT 0, 1) AS `id`) AS `utente` ON `utente`.`id` = `mg_listini`.`id`
|
||||
LEFT JOIN (SELECT `zz_users`.`id`, `zz_users`.`username` FROM `zz_users` INNER JOIN (SELECT `id_utente`, `id_record` FROM `zz_operations` INNER JOIN `zz_modules` ON `zz_modules`.`name` = 'Listini cliente' ORDER BY `id_utente` DESC LIMIT 0, 1) AS `id`) AS `utente` ON `utente`.`id` = `mg_listini`.`id`
|
||||
WHERE
|
||||
1=1
|
||||
HAVING
|
||||
|
@ -15,10 +15,10 @@ ORDER BY
|
||||
|
||||
-- Aggiunta campo Pagamento predefinito in vista Anagrafiche
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
|
||||
('2', 'Pagamento cliente', '`pagvendita`.`nome`', '15', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
((SELECT `id` FROM `zz_modules` WHERE name='Anagrafiche'), 'Pagamento cliente', '`pagvendita`.`nome`', '15', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
|
||||
('2', 'Pagamento fornitore', '`pagacquisto`.`nome`', '16', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
((SELECT `id` FROM `zz_modules` WHERE name='Anagrafiche'), 'Pagamento fornitore', '`pagacquisto`.`nome`', '16', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
@ -46,7 +46,7 @@ INSERT INTO `co_iva` (`id`, `descrizione`, `percentuale`, `indetraibile`, `esent
|
||||
|
||||
-- Aggiunta campo agente in Preventivi
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
|
||||
('13', 'Agente', '`agente`.`nome`', '11', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
((SELECT `id` FROM `zz_modules` WHERE name='Preventivi'), 'Agente', '`agente`.`nome`', '11', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
@ -74,7 +74,7 @@ ORDER BY
|
||||
|
||||
-- Aggiunta colonna Inviato in DDT in uscita
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
|
||||
('26', 'icon_Inviato', "IF(`email`.`id_email` IS NOT NULL, 'fa fa-envelope text-success', '')", '13', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
((SELECT `id` FROM `zz_modules` WHERE name='Ddt di vendita'), 'icon_Inviato', "IF(`email`.`id_email` IS NOT NULL, 'fa fa-envelope text-success', '')", '13', '1', '0', '0', '0', NULL, NULL, '0', '0', '0');
|
||||
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
@ -176,7 +176,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, "Stato predefinito dell\'attività", IFNULL((SELECT idstatointervento FROM in_statiintervento WHERE codice = "TODO"), 0), 'query=SELECT idstatointervento AS id, descrizione AS text FROM in_statiintervento', '1', 'Attività', NULL, NULL);
|
||||
|
||||
-- Aggiunta colonna KM in vista Attività
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES ((SELECT id from zz_modules WHERE title = "Attività"), 'KM', 'sum(in_interventi_tecnici.km)', '29', '1', '0', '1', '0', NULL, NULL, '0', '1', '0');
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Interventi'), 'KM', 'sum(in_interventi_tecnici.km)', '29', '1', '0', '1', '0', NULL, NULL, '0', '1', '0');
|
||||
|
||||
-- Aggiunta impostazione data emissione automatica
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, "Data emissione fattura automatica", '0', 'boolean', '1', 'Fatturazione', NULL, "Impedisce l'emissione di fatture di vendita con data precedente alla data dell'ultima fattura emessa");
|
||||
|
@ -6,4 +6,26 @@ INSERT INTO `zz_tasks` (`name`, `class`, `expression`) VALUES
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Invio solleciti in automatico', '0', 'boolean', '1', 'Scadenzario', '1', 'Invia automaticamente delle mail di sollecito secondo le tempistiche definite nelle impostazioni');
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Template email invio sollecito', (SELECT `id` FROM `em_templates` WHERE `name`="Sollecito di pagamento"), 'query=SELECT id, name AS descrizione FROM em_templates WHERE deleted_at IS NULL ORDER BY descrizione', '1', 'Scadenzario', '2', NULL);
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, "Ritardo in giorni della scadenza della fattura per invio sollecito pagamento", '10', 'integer', '1', 'Scadenzario', '3', '');
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, "Ritardo in giorni dall'ultima email per invio sollecito pagamento", '10', 'integer', '1', 'Scadenzario', '4', '');
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, "Ritardo in giorni dall'ultima email per invio sollecito pagamento", '10', 'integer', '1', 'Scadenzario', '4', '');
|
||||
|
||||
|
||||
-- Aggiunta colonna "Gruppi con accesso" in vista "Segmenti"
|
||||
UPDATE `zz_modules` SET `options` = "SELECT
|
||||
|select|
|
||||
FROM
|
||||
`zz_segments`
|
||||
LEFT JOIN `zz_modules` ON `zz_modules`.`id` = `zz_segments`.`id_module`
|
||||
INNER JOIN (SELECT GROUP_CONCAT(`zz_groups`.`nome` ORDER BY `zz_groups`.`nome` SEPARATOR ', ') AS `gruppi`, `zz_group_segment`.`id_segment` FROM `zz_group_segment` INNER JOIN `zz_groups` ON `zz_groups`.`id` = `zz_group_segment`.`id_gruppo` GROUP BY `zz_group_segment`.`id_segment`) AS `t` ON `t`.`id_segment` = `zz_segments`.`id`
|
||||
WHERE
|
||||
1=1
|
||||
HAVING
|
||||
2=2
|
||||
ORDER BY `zz_segments`.`name`,
|
||||
`zz_segments`.`id_module`" WHERE `name` = 'Segmenti';
|
||||
|
||||
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
|
||||
((SELECT `id` FROM `zz_modules` WHERE name='Segmenti'), 'Gruppi con accesso', '`t`.`gruppi`', '6', '1', '0', '0', '0', NULL, NULL, '1', '0', '1');
|
||||
|
||||
-- Set NULL campi vuoti search_inside e order_by
|
||||
UPDATE `zz_views` SET `search_inside` = NULL WHERE `search_inside` = '';
|
||||
UPDATE `zz_views` SET `order_by` = NULL WHERE `order_by` = '';
|
Loading…
x
Reference in New Issue
Block a user