mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 14:57:46 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
92539aecfd
29
CHANGELOG.md
29
CHANGELOG.md
@ -25,24 +25,37 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
|
||||
### Aggiunto (Added)
|
||||
|
||||
- Possibilità di ricalcolare le scadenze delle **Fatture di acquisto** importate da fatture elettroniche
|
||||
- Aggiunto campo data ricezione per le **Fatture di acquisto**
|
||||
- Aggiunta stampa **Preventivo** senza costi totali
|
||||
- Aggiunto export massivo XML fatture
|
||||
- Aggiunte le impostazioni "Riferimento dei documenti nelle stampe" e "Riferimento dei documenti in Fattura Elettronica" per permettere l'inclusione o meno delle relative diciture in stampe e Fattura Elettronica
|
||||
- Aggiunto supporto all'importazione delle Fatture Elettroniche Semplificate
|
||||
- Aggiunto modulo **Stato dei servizi** per la gestione di widget e moduli, e la visualizzazione dello spazione occupato
|
||||
- Campo *Data ricezione* per le **Fatture di acquisto**
|
||||
- Stampa **Preventivo** senza costi totali
|
||||
- Impostazione di esportazione massiva degli XML delle **Fatture di vendita**
|
||||
- Impostazioni "Riferimento dei documenti nelle stampe" e "Riferimento dei documenti in Fattura Elettronica" per permettere l'inclusione o meno delle relative diciture in stampe e Fattura Elettronica
|
||||
- Supporto all'importazione delle Fatture Elettroniche Semplificate e alle notifiche ZIP
|
||||
- Sistema di confronto dei totali delle Fatture Elettroniche importate (totale nel file XML) con il totale calcolato dal gestionale per la visualizzazione grafica di eventuali errori di arrotondamento
|
||||
- Pulsante per impostare la Fatture Elettroniche remota come processata **(integrazione con sistemi interni)**
|
||||
- Modulo **Stato dei servizi** per la gestione di widget e moduli, e la visualizzazione dello spazione occupato
|
||||
- Sistema di hook (e notifiche) per l'esecuzione automatica di alcune azioni periodiche
|
||||
- Controllo automatico della presenza di Fatture Elettroniche da importare **(integrazione con sistemi interni)**
|
||||
- Controllo automatico della presenza di ricevute di Fatture Elettroniche rilasciate **(integrazione con sistemi interni)**
|
||||
- Possibilità di duplicare gli **Impianti**
|
||||
|
||||
### Modificato (Changed)
|
||||
|
||||
- Corretto calcolo marca da bollo contemplando solo le righe con esenzione iva da natura N1 a N4
|
||||
- Aggiornati stylesheet per le notifiche fattura elettronica
|
||||
- La marca da bollo considera solo le righe con esenzione iva da natura N1 a N4, ed è modificabile manualmente a livello di fattura
|
||||
- Gli sconti incodizionati sono ora gestiti a tutti gli effetti come righe
|
||||
- Miglioramento della procedura di interpretazione degli XML codificati in P7M (basata sulla libreria OpenSSL)
|
||||
- Aggiornati gli stylesheet per le notifiche della Fattura elettronica
|
||||
- Possibilità di ricercare per valori maggiori/uguali o minori/uguali sui campi delle tabelle (importi)
|
||||
- Spostamento della gestione di widget e moduli da **Aggiornamenti** al modulo **Stato dei servizi**
|
||||
- I totali vengono visualizzati e arrotondati sempre a due cifre per legge (la modifica consiste **solo nella visualizzazione dei totali**, e non influenza i conteggi in alcun modo)
|
||||
- Modernizzazione del plugin *Statistiche* nel modulo **Anagrafiche**
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix selezione righe multiple sulle tabelle
|
||||
- Fix dei conteggi dei widget *Acquisti* e *Fatturato* (esclusione dell'IVA)
|
||||
- Fix dei ripristini delle quantità evase nei **Preventivi** e nei **Contratti**
|
||||
- Fix API per APP OSM
|
||||
- Fix per compatibilità con MySQL 8
|
||||
- Risolti altri bug generali
|
||||
|
||||
## 2.4.8 (2019-03-01)
|
||||
|
30
ajax.php
30
ajax.php
@ -2,6 +2,8 @@
|
||||
|
||||
include_once __DIR__.'/core.php';
|
||||
|
||||
use Models\Hook;
|
||||
|
||||
switch (get('op')) {
|
||||
// Imposta un valore ad un array di $_SESSION
|
||||
// esempio: push di un valore in $_SESSION['dashboard']['idtecnici']
|
||||
@ -77,5 +79,31 @@ switch (get('op')) {
|
||||
]);
|
||||
|
||||
echo json_encode($datas);
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case 'hooks':
|
||||
$hooks = Hook::all();
|
||||
|
||||
$results = [];
|
||||
foreach ($hooks as $hook) {
|
||||
$results[] = [
|
||||
'id' => $hook->id,
|
||||
'name' => $hook->name,
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
|
||||
break;
|
||||
|
||||
case 'hook':
|
||||
$hook_id = filter('id');
|
||||
$hook = Hook::find($hook_id);
|
||||
|
||||
$response = $hook->execute();
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -29,13 +29,6 @@ a.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.btn-calendar>.btn {
|
||||
color: inherit;
|
||||
background: transparent;
|
||||
font-size: 20px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
#progress {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
@ -61,14 +54,6 @@ a.disabled {
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
#right-menu {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#right-menu .fa-info {
|
||||
padding: 0 5px
|
||||
}
|
||||
|
||||
.ui-menu {
|
||||
position: fixed;
|
||||
}
|
||||
@ -158,13 +143,13 @@ a.disabled {
|
||||
filter: alpha(opacity=90);
|
||||
}
|
||||
|
||||
#main_loading>div {
|
||||
#main_loading > div {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#main_loading>div>i {
|
||||
#main_loading > div > i {
|
||||
font-size: 300px;
|
||||
margin-top: -150px;
|
||||
color: #e24e1e;
|
||||
@ -177,10 +162,10 @@ a.disabled {
|
||||
z-index: 9000;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba( 0, 0, 0, 0.15);
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
#mini-loader>div {
|
||||
#mini-loader > div {
|
||||
position: absolute;
|
||||
bottom: 50%;
|
||||
left: 50%;
|
||||
@ -206,19 +191,15 @@ body .header .logo {
|
||||
}
|
||||
|
||||
.btn-github {
|
||||
color: #ffffff;
|
||||
background-color: #444444;
|
||||
border-color: rgba(0, 0, 0, 0.2);
|
||||
color: #ffffff !important;
|
||||
background-color: #444444 !important;
|
||||
border-color: rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
|
||||
.btn-github:hover,
|
||||
.btn-github:focus,
|
||||
.btn-github:active,
|
||||
.btn-github.active,
|
||||
.open .dropdown-toggle.btn-github {
|
||||
color: #ffffff;
|
||||
background-color: #303030;
|
||||
border-color: rgba(0, 0, 0, 0.2);
|
||||
.navbar-custom-menu>ul>li>a:hover,
|
||||
.navbar-custom-menu>ul>li>a:focus,
|
||||
.navbar-custom-menu>ul>li>a:active{
|
||||
filter: brightness(75%);
|
||||
}
|
||||
|
||||
.btn-github:active,
|
||||
@ -260,7 +241,7 @@ span.form-control {
|
||||
padding: 5px 8px;
|
||||
}
|
||||
|
||||
.dropdown.col-md-3>.dropdown-menu {
|
||||
.dropdown.col-md-3 > .dropdown-menu {
|
||||
width: 91.5%;
|
||||
left: 15px;
|
||||
padding: 5px;
|
||||
@ -309,16 +290,16 @@ span.form-control {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.close:focus, .close:hover{
|
||||
.close:focus, .close:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.li-widget button.close:hover, .li-widget button.close:focus{
|
||||
.li-widget button.close:hover, .li-widget button.close:focus {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.li-widget button.close{
|
||||
padding-right:5px;
|
||||
.li-widget button.close {
|
||||
padding-right: 5px;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
@ -331,12 +312,16 @@ span.form-control {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.nav-tabs-custom>.nav-tabs.pull-right>li>a.back-btn {
|
||||
.nav-tabs-custom > .nav-tabs.pull-right > li > a.back-btn {
|
||||
font-size: 12px;
|
||||
color: #3C8DBC;
|
||||
}
|
||||
|
||||
.nav-tabs-custom>.nav-tabs.pull-right>li>a.back-btn:hover {
|
||||
.navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a, .navbar-nav > .messages-menu > .dropdown-menu > li .menu > li > a, .navbar-nav > .tasks-menu > .dropdown-menu > li .menu > li > a {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.nav-tabs-custom > .nav-tabs.pull-right > li > a.back-btn:hover {
|
||||
cursor: pointer;
|
||||
color: #72AFD2;
|
||||
}
|
||||
@ -428,7 +413,7 @@ span.form-control {
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.02) inset;
|
||||
}
|
||||
|
||||
.sidebar-menu li>a>.pull-right-container {
|
||||
.sidebar-menu li > a > .pull-right-container {
|
||||
position: absolute;
|
||||
padding: 12px;
|
||||
right: 10px;
|
||||
@ -491,7 +476,7 @@ span.form-control {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.input-group-addon.no-padding>* {
|
||||
.input-group-addon.no-padding > * {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
@ -535,21 +520,27 @@ input.small-width {
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
#main_loading>div>i {
|
||||
#main_loading > div > i {
|
||||
font-size: 160px;
|
||||
margin-top: -80px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
.navbar-left{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.box-center,
|
||||
.box-center-large {
|
||||
width: 90%;
|
||||
margin-top: 20px
|
||||
}
|
||||
|
||||
.main-header .logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
.content-wrapper,
|
||||
.right-side,
|
||||
@ -566,12 +557,12 @@ input.small-width {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 992px) {
|
||||
.table-bordered>thead>tr>th,
|
||||
.table-bordered>tbody>tr>th,
|
||||
.table-bordered>tfoot>tr>th,
|
||||
.table-bordered>thead>tr>td,
|
||||
.table-bordered>tbody>tr>td,
|
||||
.table-bordered>tfoot>tr>td {
|
||||
.table-bordered > thead > tr > th,
|
||||
.table-bordered > tbody > tr > th,
|
||||
.table-bordered > tfoot > tr > th,
|
||||
.table-bordered > thead > tr > td,
|
||||
.table-bordered > tbody > tr > td,
|
||||
.table-bordered > tfoot > tr > td {
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
@ -580,6 +571,7 @@ input.small-width {
|
||||
.push {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.signature-pad {
|
||||
top: 0;
|
||||
left: 0;
|
||||
@ -603,21 +595,21 @@ input.small-width {
|
||||
|
||||
/*fix per tabs editor */
|
||||
|
||||
.nav-tabs-custom>.nav-tabs>li {
|
||||
.nav-tabs-custom > .nav-tabs > li {
|
||||
border-top: 3px solid #ddd;
|
||||
}
|
||||
|
||||
.nav-tabs-custom>.nav-tabs.pull-right>li:first-of-type.active>a {
|
||||
.nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type.active > a {
|
||||
border-right-color: #f4f4f4;
|
||||
border-right-width: 1px;
|
||||
border-left-width: 0px;
|
||||
}
|
||||
|
||||
.nav-tabs-custom>.nav-tabs>li.header {
|
||||
.nav-tabs-custom > .nav-tabs > li.header {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.nav-tabs-custom>.nav-tabs>li {
|
||||
.nav-tabs-custom > .nav-tabs > li {
|
||||
margin-bottom: -1px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
@ -657,32 +649,32 @@ input.small-width {
|
||||
margin-left: -4.5px;
|
||||
}
|
||||
|
||||
.timeline>li {
|
||||
.timeline > li {
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.timeline>li:before,
|
||||
.timeline>li:after {
|
||||
.timeline > li:before,
|
||||
.timeline > li:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.timeline>li:after {
|
||||
.timeline > li:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.timeline>li:before,
|
||||
.timeline>li:after {
|
||||
.timeline > li:before,
|
||||
.timeline > li:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.timeline>li:after {
|
||||
.timeline > li:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.timeline>li>.timeline-panel {
|
||||
.timeline > li > .timeline-panel {
|
||||
width: 50%;
|
||||
float: left;
|
||||
border: 1px solid #d4d4d4;
|
||||
@ -693,20 +685,20 @@ input.small-width {
|
||||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
|
||||
}
|
||||
|
||||
.timeline>li.timeline-inverted+li:not(.timeline-inverted),
|
||||
.timeline>li:not(.timeline-inverted)+li.timeline-inverted {
|
||||
.timeline > li.timeline-inverted + li:not(.timeline-inverted),
|
||||
.timeline > li:not(.timeline-inverted) + li.timeline-inverted {
|
||||
margin-top: -60px;
|
||||
}
|
||||
|
||||
.timeline>li:not(.timeline-inverted) {
|
||||
.timeline > li:not(.timeline-inverted) {
|
||||
padding-right: 90px;
|
||||
}
|
||||
|
||||
.timeline>li.timeline-inverted {
|
||||
.timeline > li.timeline-inverted {
|
||||
padding-left: 90px;
|
||||
}
|
||||
|
||||
.timeline>li>.timeline-panel:before {
|
||||
.timeline > li > .timeline-panel:before {
|
||||
position: absolute;
|
||||
top: 26px;
|
||||
right: -15px;
|
||||
@ -718,7 +710,7 @@ input.small-width {
|
||||
content: " ";
|
||||
}
|
||||
|
||||
.timeline>li>.timeline-panel:after {
|
||||
.timeline > li > .timeline-panel:after {
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
right: -14px;
|
||||
@ -730,7 +722,7 @@ input.small-width {
|
||||
content: " ";
|
||||
}
|
||||
|
||||
.timeline>li>.timeline-badge {
|
||||
.timeline > li > .timeline-badge {
|
||||
color: #fff;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
@ -749,18 +741,18 @@ input.small-width {
|
||||
border-bottom-left-radius: 50%;
|
||||
}
|
||||
|
||||
.timeline>li.timeline-inverted>.timeline-panel {
|
||||
.timeline > li.timeline-inverted > .timeline-panel {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.timeline>li.timeline-inverted>.timeline-panel:before {
|
||||
.timeline > li.timeline-inverted > .timeline-panel:before {
|
||||
border-left-width: 0;
|
||||
border-right-width: 15px;
|
||||
left: -15px;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
.timeline>li.timeline-inverted>.timeline-panel:after {
|
||||
.timeline > li.timeline-inverted > .timeline-panel:after {
|
||||
border-left-width: 0;
|
||||
border-right-width: 14px;
|
||||
left: -14px;
|
||||
@ -792,31 +784,31 @@ input.small-width {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.timeline-body>p,
|
||||
.timeline-body>ul {
|
||||
.timeline-body > p,
|
||||
.timeline-body > ul {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline-body>p+p {
|
||||
.timeline-body > p + p {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.img-circle.square{
|
||||
box-shadow: 0px 0px 1px 1px lightgray;
|
||||
.img-circle.square {
|
||||
box-shadow: 0px 0px 1px 1px lightgray;
|
||||
}
|
||||
|
||||
.select2-dropdown{
|
||||
.select2-dropdown {
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
.after.input-group-addon .select2-selection, .after.input-group-addon{
|
||||
border-radius:0px 4px 4px 0px;
|
||||
border-left:none;
|
||||
.after.input-group-addon .select2-selection, .after.input-group-addon {
|
||||
border-radius: 0px 4px 4px 0px;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.before.input-group-addon .select2-selection, .before.input-group-addon{
|
||||
border-radius:4px 0px 0px 4px;
|
||||
border-right:none;
|
||||
.before.input-group-addon .select2-selection, .before.input-group-addon {
|
||||
border-radius: 4px 0px 0px 4px;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.hide-it-off-screen {
|
||||
@ -825,6 +817,6 @@ input.small-width {
|
||||
top: -10000px;
|
||||
}
|
||||
|
||||
.box-info ul > li > :last-child{
|
||||
margin-bottom:5px;
|
||||
.box-info ul > li > :last-child {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
@ -41,19 +41,19 @@
|
||||
color: #72AFD2;
|
||||
}
|
||||
|
||||
.skin-default .main-header .navbar {
|
||||
.skin-default .main-header .navbar > span {
|
||||
color: #eee;
|
||||
background: #222;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.skin-default .main-header .navbar .nav li a
|
||||
.skin-default .main-header .navbar .nav li a:hover,
|
||||
.skin-default .main-header .navbar .nav li a:active,
|
||||
.skin-default .main-header .navbar .nav li a:focus,
|
||||
.skin-default .main-header .navbar .nav .open a,
|
||||
.skin-default .main-header .navbar .nav .open a:hover,
|
||||
.skin-default .main-header .navbar .nav .open a:focus,
|
||||
.skin-default .main-header .navbar .nav > li > a
|
||||
.skin-default .main-header .navbar .nav > li > a:hover,
|
||||
.skin-default .main-header .navbar .nav > li > a:active,
|
||||
.skin-default .main-header .navbar .nav > li > a:focus,
|
||||
.skin-default .main-header .navbar .nav .open > a,
|
||||
.skin-default .main-header .navbar .nav .open > a:hover,
|
||||
.skin-default .main-header .navbar .nav .open > a:focus,
|
||||
.skin-default .main-header .navbar .nav .active a,
|
||||
.skin-default .main-header .navbar .nav .actual a,
|
||||
.skin-default .main-header .navbar .nav .menu-open a {
|
||||
|
@ -50,6 +50,66 @@ if (Auth::check()) {
|
||||
echo '
|
||||
<style>'.$custom_css.'</style>';
|
||||
}
|
||||
|
||||
// Hooks
|
||||
echo '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/ajax.php",
|
||||
type: "get",
|
||||
data: {
|
||||
op: "hooks",
|
||||
},
|
||||
success: function(data) {
|
||||
hooks = JSON.parse(data);
|
||||
|
||||
hooks.forEach(function(item, index){
|
||||
executeHook(item, hooks.length);
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
function executeHook(hook, length){
|
||||
$("#hooks").append(\'<li id="hook-loader-\' + hook.id + \'"><a href="#">'.tr('Hook "_NAME_" in esecuzione', [
|
||||
'_NAME_' => '\' + hook.name + \'',
|
||||
]).'</a></li>\');
|
||||
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/ajax.php",
|
||||
type: "get",
|
||||
data: {
|
||||
op: "hook",
|
||||
id: hook.id,
|
||||
},
|
||||
success: function(data) {
|
||||
result = JSON.parse(data);
|
||||
|
||||
$("#hook-loader-" + hook.id).remove();
|
||||
message = \'<li class="hook-element"><a href="\' + (result.link ? result.link : "#") + \'"><i class="\' + result.icon + \'"></i><span class="small" > \' + result.message + \'</span></a></li>\';
|
||||
|
||||
// Inserimento della notifica
|
||||
if(result.notify) {
|
||||
hooks_count = $("#hooks-count");
|
||||
number = parseInt(hooks_count.text());
|
||||
number = isNaN(number) ? 0 : number;
|
||||
|
||||
hooks_count.text(parseInt(number) + 1);
|
||||
|
||||
$("#hooks").prepend(message);
|
||||
} else {
|
||||
$("#hooks").append(message);
|
||||
}
|
||||
|
||||
// Rimozione eventuale della rotella di caricamento
|
||||
if($(".hook-element").length == hooks.length) {
|
||||
$("#hooks-loading").hide();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
@ -35,7 +35,7 @@ echo '
|
||||
var sconto_percentuale = form.find("#sconto_percentuale");
|
||||
var sconto_unitario = form.find("#sconto_unitario");
|
||||
|
||||
var totale = '.$options['imponibile_scontato'].';
|
||||
var totale = '.($options['imponibile_scontato'] ?: 0).';
|
||||
|
||||
function aggiorna_sconto_percentuale() {
|
||||
var sconto = sconto_percentuale.val().toEnglish();
|
||||
|
@ -11,6 +11,7 @@ abstract class Article extends Row
|
||||
{
|
||||
protected $serialRowID = null;
|
||||
protected $abilita_movimentazione = true;
|
||||
protected $serialsList = null;
|
||||
|
||||
protected $qta_movimentazione = 0;
|
||||
|
||||
@ -38,13 +39,17 @@ abstract class Article extends Row
|
||||
*/
|
||||
public function setSerialsAttribute($serials)
|
||||
{
|
||||
$serials = array_clean($serials);
|
||||
|
||||
database()->sync('mg_prodotti', [
|
||||
'id_riga_'.$this->serialRowID => $this->id,
|
||||
'dir' => $this->getDirection(),
|
||||
'id_articolo' => $this->idarticolo,
|
||||
], [
|
||||
'serial' => array_clean($serials),
|
||||
'serial' => $serials,
|
||||
]);
|
||||
|
||||
$this->serialsList = $serials;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,6 +66,8 @@ abstract class Article extends Row
|
||||
], [
|
||||
'serial' => array_clean($serials),
|
||||
]);
|
||||
|
||||
$this->serialsList = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,10 +81,24 @@ abstract class Article extends Row
|
||||
return [];
|
||||
}
|
||||
|
||||
// Individuazione dei seriali
|
||||
$results = database()->fetchArray('SELECT serial FROM mg_prodotti WHERE serial IS NOT NULL AND id_riga_'.$this->serialRowID.' = '.prepare($this->id));
|
||||
if (!isset($this->serialsList)) {
|
||||
// Individuazione dei seriali
|
||||
$results = database()->fetchArray('SELECT serial FROM mg_prodotti WHERE serial IS NOT NULL AND id_riga_'.$this->serialRowID.' = '.prepare($this->id));
|
||||
|
||||
return array_column($results, 'serial');
|
||||
$this->serialsList = array_column($results, 'serial');
|
||||
}
|
||||
|
||||
return $this->serialsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il numero di seriali mancanti per il completamento dell'articolo.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getMissingSerialsAttribute()
|
||||
{
|
||||
return $this->qta - count($this->serials);
|
||||
}
|
||||
|
||||
/**
|
||||
|
10
include/src/HookManager.php
Normal file
10
include/src/HookManager.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Common;
|
||||
|
||||
abstract class HookManager
|
||||
{
|
||||
abstract public function manage();
|
||||
|
||||
abstract public function response($results);
|
||||
}
|
@ -196,7 +196,7 @@ if (Auth::check()) {
|
||||
<div id="tiny-loader" style="display:none;"></div>
|
||||
|
||||
<header class="main-header">
|
||||
<a href="https://www.openstamanager.com" class="logo" title="'.tr('Il gestionale open source per l\'assistenza tecnica e la fatturazione').'" target="_blank">
|
||||
<a href="https://www.openstamanager.com" class="logo" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'" target="_blank">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini">'.tr('OSM').'</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
@ -212,32 +212,61 @@ if (Auth::check()) {
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
|
||||
<div class="input-group btn-calendar pull-left">
|
||||
<button id="daterange" class="btn"><i class="fa fa-calendar" style="color:'.$calendar.'"></i> <i class="fa fa-caret-down" style="color:'.$calendar.';" ></i></button>
|
||||
<span class="hidden-xs" style="vertical-align:middle; color:'.$calendar.';">
|
||||
'.Translator::dateToLocale($_SESSION['period_start']).' - '.Translator::dateToLocale($_SESSION['period_end']).'
|
||||
</span>
|
||||
</div>
|
||||
<!-- Navbar Left Menu -->
|
||||
<div class="navbar-left" class="hidden-xs">
|
||||
<ul class="nav navbar-nav" class="hidden-xs">
|
||||
<li><a href="#" id="daterange" style="color:'.$calendar.';background:inherit">
|
||||
<i class="fa fa-calendar" style="color:inherit"></i> <i class="fa fa-caret-down" style="color:inherit"></i>
|
||||
</a></li>
|
||||
|
||||
<li><a href="#" style="color:'.$calendar.';background:inherit">
|
||||
'.Translator::dateToLocale($_SESSION['period_start']).' - '.Translator::dateToLocale($_SESSION['period_end']).'
|
||||
</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown notifications-menu">
|
||||
<a href="#" class="dropdown-toggle btn-github" data-toggle="dropdown">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="label label-warning">
|
||||
<span id="hooks-loading"><i class="fa fa-spinner fa-spin"></i></span>
|
||||
<span id="hooks-count"></span>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><ul class="menu" id="hooks">
|
||||
|
||||
</ul></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><a href="#" onclick="window.print()" class="btn-github tip" style="background-color:#5bc0de!important" title="'.tr('Stampa').'">
|
||||
<i class="fa fa-print"></i>
|
||||
</a></li>
|
||||
|
||||
<li><a href="'.$rootdir.'/bug.php" class="btn-github tip" title="'.tr('Segnalazione bug').'">
|
||||
<i class="fa fa-bug"></i>
|
||||
</a></li>
|
||||
|
||||
<li><a href="'.$rootdir.'/log.php" class="btn-github tip" title="'.tr('Log accessi').'">
|
||||
<i class="fa fa-book"></i>
|
||||
</a></li>
|
||||
|
||||
<li><a href="'.$rootdir.'/info.php" class="btn-github tip" title="'.tr('Informazioni').'">
|
||||
<i class="fa fa-info"></i>
|
||||
</a></li>
|
||||
|
||||
<li><a href="'.$rootdir.'/index.php?op=logout" class="btn-github tip" style="background-color:#dd4b39!important" title="'.tr('Esci').'">
|
||||
<i class="fa fa-power-off"></i>
|
||||
</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="right-menu" class="pull-right">
|
||||
<button onclick="window.print()" class="btn btn-sm btn-info tip" title="'.tr('Stampa').'">
|
||||
<i class="fa fa-print"></i>
|
||||
</button>
|
||||
<a href="'.$rootdir.'/bug.php" class="btn btn-sm btn-github tip" title="'.tr('Segnalazione bug').'">
|
||||
<i class="fa fa-bug"></i>
|
||||
</a>
|
||||
<a href="'.$rootdir.'/log.php" class="btn btn-sm btn-github tip" title="'.tr('Log accessi').'">
|
||||
<i class="fa fa-book"></i>
|
||||
</a>
|
||||
<a href="'.$rootdir.'/info.php" class="btn btn-sm btn-github tip" title="'.tr('Informazioni').'">
|
||||
<i class="fa fa-info"></i>
|
||||
</a>
|
||||
<a href="'.$rootdir.'/index.php?op=logout" class="btn btn-sm btn-danger tip" title="'.tr('Esci').'">
|
||||
<i class="fa fa-power-off"></i>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<aside class="main-sidebar">
|
||||
|
@ -83,4 +83,17 @@ switch ($resource) {
|
||||
echo json_encode($results);
|
||||
|
||||
break;
|
||||
|
||||
case 'get_mansioni':
|
||||
$q = 'SELECT DISTINCT mansione FROM an_referenti';
|
||||
$rs = $dbo->fetchArray($q);
|
||||
$n = sizeof($rs);
|
||||
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
echo html_entity_decode($rs[$i]['mansione']);
|
||||
if (($i + 1) < $n) {
|
||||
echo '|';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -5,27 +5,31 @@ include_once __DIR__.'/../../core.php';
|
||||
switch (post('op')) {
|
||||
case 'delete-bulk':
|
||||
|
||||
if (App::debug()) {
|
||||
$idtipoanagrafica_azienda = $dbo->fetchArray("SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione='Azienda'")[0]['idtipoanagrafica'];
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
$anagrafica = $dbo->fetchArray('SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche INNER JOIN an_tipianagrafiche_anagrafiche ON an_tipianagrafiche.idtipoanagrafica=an_tipianagrafiche_anagrafiche.idtipoanagrafica WHERE idanagrafica='.prepare($id));
|
||||
$tipi = array_column($anagrafica, 'idtipoanagrafica');
|
||||
$idtipoanagrafica_azienda = $dbo->fetchArray("SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione='Azienda'")[0]['idtipoanagrafica'];
|
||||
|
||||
// Se l'anagrafica non è di tipo Azienda
|
||||
if (!in_array($idtipoanagrafica_azienda, $tipi)) {
|
||||
$dbo->query('UPDATE an_anagrafiche SET deleted_at = NOW() WHERE idanagrafica = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
}
|
||||
foreach ($id_records as $id) {
|
||||
$anagrafica = $dbo->fetchArray('SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche INNER JOIN an_tipianagrafiche_anagrafiche ON an_tipianagrafiche.idtipoanagrafica=an_tipianagrafiche_anagrafiche.idtipoanagrafica WHERE idanagrafica='.prepare($id));
|
||||
$tipi = array_column($anagrafica, 'idtipoanagrafica');
|
||||
|
||||
// Se l'anagrafica non è di tipo Azienda
|
||||
if (!in_array($idtipoanagrafica_azienda, $tipi)) {
|
||||
$dbo->query('UPDATE an_anagrafiche SET deleted_at = NOW() WHERE idanagrafica = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
}
|
||||
|
||||
flash()->info(tr('Anagrafiche eliminate!'));
|
||||
|
||||
flash()->info(tr('Anagrafiche eliminate!'));
|
||||
} else {
|
||||
flash()->warning(tr('Procedura in fase di sviluppo. Nessuna modifica apportata.'));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
'delete-bulk' => tr('Elimina selezione'),
|
||||
];
|
||||
|
||||
if (App::debug()) {
|
||||
$operations = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
return $operations;
|
||||
|
@ -132,6 +132,7 @@ switch (post('op')) {
|
||||
// Duplica contratto
|
||||
case 'copy':
|
||||
$new = $contratto->replicate();
|
||||
$new->numero = Contratto::getNextNumero();
|
||||
$new->idstato = 1;
|
||||
$new->save();
|
||||
|
||||
|
@ -145,7 +145,7 @@ switch (get('op')) {
|
||||
|
||||
$rsp = $dbo->fetchArray($qp);
|
||||
|
||||
$interventi = $dbo->fetchArray("SELECT id, richiesta, id_contratto AS idcontratto, DATE_FORMAT(data_richiesta,'%m%Y') AS mese, data_richiesta, an_anagrafiche.ragione_sociale, 'intervento' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE in_tipiintervento.idtipointervento=in_interventi.idtipointervento) AS tipointervento FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica WHERE (SELECT COUNT(*) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento = in_interventi.id) = 0 ORDER BY data_richiesta ASC");
|
||||
$interventi = $dbo->fetchArray("SELECT id, richiesta, id_contratto AS idcontratto, DATE_FORMAT(data_richiesta,'%m%Y') AS mese, data_richiesta, data_scadenza, an_anagrafiche.ragione_sociale, 'intervento' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE in_tipiintervento.idtipointervento=in_interventi.idtipointervento) AS tipointervento FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica WHERE (SELECT COUNT(*) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento = in_interventi.id) = 0 ORDER BY data_richiesta ASC");
|
||||
|
||||
$rsp = array_merge($rsp, $interventi);
|
||||
|
||||
@ -163,7 +163,8 @@ switch (get('op')) {
|
||||
|
||||
echo '
|
||||
<div class="fc-event '.$class.'" data-id="'.$r['id'].'" data-idcontratto="'.$r['idcontratto'].'" data-ref="'.$r['ref'].'">'.(($r['ref'] == 'intervento') ? '<i class=\'fa fa-wrench pull-right\'></i>' : '<i class=\'fa fa-file-text-o pull-right\'></i>').'
|
||||
<b>'.$r['ragione_sociale'].'</b><br>'.Translator::dateToLocale($r['data_richiesta']).' ('.$r['tipointervento'].')'.(!empty($r['richiesta']) ? ' - '.$r['richiesta'] : '').'
|
||||
<b>'.$r['ragione_sociale'].'</b><br>'.Translator::dateToLocale($r['data_richiesta']).' ('.$r['tipointervento'].')'.(!empty($r['richiesta']) ? ' - '.$r['richiesta'] : '').
|
||||
(!empty($r['data_scadenza'] AND $r['data_scadenza'] != '0000-00-00 00:00:00') ? '<br><small>'.tr('entro il: ').''.Translator::dateToLocale($r['data_scadenza']).'</small>' : '').'
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
@ -368,42 +368,47 @@ if ($vista == 'mese') {
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#select-intreventi-pianificare').change(function(){
|
||||
var mese = $(this).val();
|
||||
$.get( '<?php echo $rootdir; ?>/modules/dashboard/actions.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$('#interventi-pianificare').html(data);
|
||||
$('#external-events .fc-event').each(function() {
|
||||
function load_interventi_da_pianificare(mese){
|
||||
|
||||
if (mese == undefined){
|
||||
// Seleziono il mese corrente per gli interventi da pianificare
|
||||
var date = new Date();
|
||||
var mese;
|
||||
date.setDate(date.getDate());
|
||||
|
||||
//Note: January is 0, February is 1, and so on.
|
||||
mese = ('0' + (date.getMonth()+1)).slice(-2) + date.getFullYear();
|
||||
|
||||
$('#select-intreventi-pianificare option[value='+mese+']').attr('selected','selected').trigger('change');
|
||||
}
|
||||
|
||||
$('#interventi-pianificare').html('<center><br><br><i class=\'fa fa-refresh fa-spin fa-2x fa-fw\'></i></center>');
|
||||
$.get( '<?php echo $rootdir; ?>/modules/dashboard/actions.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
|
||||
})
|
||||
.done(function( data ) {
|
||||
$('#interventi-pianificare').html(data);
|
||||
$('#external-events .fc-event').each(function() {
|
||||
$(this).draggable({
|
||||
zIndex: 999,
|
||||
revert: true,
|
||||
revertDuration: 0
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
$('#select-intreventi-pianificare').change(function(){
|
||||
var mese = $(this).val();
|
||||
load_interventi_da_pianificare(mese);
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
// Seleziono il mese corrente per gli interventi da pianificare
|
||||
var date = new Date();
|
||||
var mese;
|
||||
date.setDate(date.getDate());
|
||||
|
||||
//Note: January is 0, February is 1, and so on.
|
||||
mese = ('0' + (date.getMonth()+1)).slice(-2) + date.getFullYear();
|
||||
|
||||
$('#select-intreventi-pianificare option[value='+mese+']').attr('selected','selected').trigger('change');
|
||||
|
||||
$.get( '<?php echo $rootdir; ?>/modules/dashboard/actions.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$('#interventi-pianificare').html(data);
|
||||
$('#external-events .fc-event').each(function() {
|
||||
$(this).draggable({
|
||||
zIndex: 999,
|
||||
revert: true,
|
||||
revertDuration: 0
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
load_interventi_da_pianificare();
|
||||
|
||||
// Comandi seleziona tutti
|
||||
$('#selectallstati').click(function(event) {
|
||||
|
@ -116,24 +116,29 @@ switch (post('op')) {
|
||||
|
||||
case 'delete-bulk':
|
||||
|
||||
if (App::debug()) {
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM dt_ddt WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM dt_righe_ddt WHERE idddt='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE idddt='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
flash()->info(tr('Ddt eliminati!'));
|
||||
} else {
|
||||
flash()->warning(tr('Procedura in fase di sviluppo. Nessuna modifica apportata.'));
|
||||
}
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM dt_ddt WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM dt_righe_ddt WHERE idddt='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE idddt='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
flash()->info(tr('Ddt eliminati!'));
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$operations = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
'crea_fattura' => [
|
||||
|
||||
if (App::debug()) {
|
||||
|
||||
$operations = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$operations['crea_fattura'] = [
|
||||
'text' => tr('Crea fattura'),
|
||||
'data' => [
|
||||
'title' => tr('Vuoi davvero creare una fattura per questi interventi?'),
|
||||
@ -142,7 +147,7 @@ $operations = [
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
'blank' => false,
|
||||
],
|
||||
],
|
||||
];
|
||||
];
|
||||
|
||||
|
||||
return $operations;
|
||||
|
@ -40,85 +40,76 @@ switch (post('op')) {
|
||||
|
||||
case 'update':
|
||||
if (post('id_record') !== null) {
|
||||
$idstatodocumento = post('idstatodocumento');
|
||||
$idpagamento = post('idpagamento');
|
||||
$fattura->data = post('data');
|
||||
$fattura->data_ricezione = post('data_ricezione');
|
||||
$fattura->numero_esterno = post('numero_esterno');
|
||||
$fattura->note = post('note');
|
||||
$fattura->note_aggiuntive = post('note_aggiuntive');
|
||||
|
||||
$totale_imponibile = get_imponibile_fattura($id_record);
|
||||
$totale_fattura = get_totale_fattura($id_record);
|
||||
$fattura->idstatodocumento = post('idstatodocumento');
|
||||
$fattura->idtipodocumento = post('idtipodocumento');
|
||||
$fattura->idanagrafica = post('idanagrafica');
|
||||
$fattura->idagente = post('idagente');
|
||||
$fattura->idpagamento = post('idpagamento');
|
||||
$fattura->idbanca = post('idbanca');
|
||||
$fattura->idcausalet = post('idcausalet');
|
||||
$fattura->idspedizione = post('idspedizione');
|
||||
$fattura->idporto = post('idporto');
|
||||
$fattura->idaspettobeni = post('idaspettobeni');
|
||||
$fattura->idvettore = post('idvettore');
|
||||
$fattura->idsede = post('idsede');
|
||||
$fattura->idconto = post('idconto');
|
||||
$fattura->split_payment = post('split_payment') ?: 0;
|
||||
$fattura->is_fattura_conto_terzi = post('is_fattura_conto_terzi') ?: 0;
|
||||
$fattura->n_colli = post('n_colli');
|
||||
$fattura->tipo_resa = post('tipo_resa');
|
||||
|
||||
$fattura->rivalsainps = 0;
|
||||
$fattura->ritenutaacconto = 0;
|
||||
$fattura->iva_rivalsainps = 0;
|
||||
|
||||
$fattura->codice_stato_fe = post('codice_stato_fe') ?: null;
|
||||
$fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null;
|
||||
|
||||
$data = [];
|
||||
if ($dir == 'uscita') {
|
||||
$data = [
|
||||
'numero' => post('numero'),
|
||||
'numero_esterno' => post('numero_esterno'),
|
||||
'idrivalsainps' => post('id_rivalsa_inps'),
|
||||
'idritenutaacconto' => post('id_ritenuta_acconto'),
|
||||
];
|
||||
$fattura->numero = post('numero');
|
||||
$fattura->numero_esterno = post('numero_esterno');
|
||||
$fattura->idrivalsainps = post('id_rivalsa_inps');
|
||||
$fattura->idritenutaacconto = post('id_ritenuta_acconto');
|
||||
}
|
||||
|
||||
// Leggo la descrizione del pagamento
|
||||
$query = 'SELECT descrizione FROM co_pagamenti WHERE id='.prepare($idpagamento);
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$pagamento = $rs[0]['descrizione'];
|
||||
$fattura->addebita_bollo = post('addebita_bollo');
|
||||
$bollo_automatico = post('bollo_automatico');
|
||||
if (empty($bollo_automatico)) {
|
||||
$fattura->bollo = post('bollo');
|
||||
} else {
|
||||
$fattura->bollo = null;
|
||||
}
|
||||
|
||||
// Query di aggiornamento
|
||||
$dbo->update('co_documenti', array_merge([
|
||||
'data' => post('data'),
|
||||
'data_ricezione' => post('data_ricezione'),
|
||||
'numero_esterno' => post('numero_esterno'),
|
||||
'note' => post('note'),
|
||||
'note_aggiuntive' => post('note_aggiuntive'),
|
||||
|
||||
'idstatodocumento' => $idstatodocumento,
|
||||
'idtipodocumento' => post('idtipodocumento'),
|
||||
'idanagrafica' => post('idanagrafica'),
|
||||
'idagente' => post('idagente'),
|
||||
'idpagamento' => $idpagamento,
|
||||
'idbanca' => post('idbanca'),
|
||||
'idcausalet' => post('idcausalet'),
|
||||
'idspedizione' => post('idspedizione'),
|
||||
'idporto' => post('idporto'),
|
||||
'idaspettobeni' => post('idaspettobeni'),
|
||||
'idvettore' => post('idvettore'),
|
||||
'idsede' => post('idsede'),
|
||||
'idconto' => post('idconto'),
|
||||
'split_payment' => post('split_payment') ?: 0,
|
||||
'is_fattura_conto_terzi' => post('is_fattura_conto_terzi') ?: 0,
|
||||
'n_colli' => post('n_colli'),
|
||||
'tipo_resa' => post('tipo_resa'),
|
||||
'addebita_bollo' => post('addebita_bollo'),
|
||||
'bollo' => 0,
|
||||
'rivalsainps' => 0,
|
||||
'ritenutaacconto' => 0,
|
||||
'iva_rivalsainps' => 0,
|
||||
'codice_stato_fe' => post('codice_stato_fe') ?: null,
|
||||
'id_ritenuta_contributi' => post('id_ritenuta_contributi') ?: null,
|
||||
], $data), ['id' => $id_record]);
|
||||
|
||||
$query = 'SELECT descrizione FROM co_statidocumento WHERE id='.prepare($idstatodocumento);
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$fattura->save();
|
||||
|
||||
// Ricalcolo inps, ritenuta e bollo (se la fattura non è stata pagata)
|
||||
ricalcola_costiagg_fattura($id_record);
|
||||
|
||||
$stato = $fattura->stato;
|
||||
// Elimino la scadenza e tutti i movimenti, poi se la fattura è emessa le ricalcolo
|
||||
if ($rs[0]['descrizione'] == 'Bozza' or $rs[0]['descrizione'] == 'Annullata') {
|
||||
if ($stato['descrizione'] == 'Bozza' or $stato['descrizione'] == 'Annullata') {
|
||||
elimina_scadenza($id_record);
|
||||
//elimina_movimento($id_record, 0);
|
||||
//elimino movimento anche prima nota (se pagata o parzialmente pagata)
|
||||
elimina_movimento($id_record, 1);
|
||||
} elseif ($rs[0]['descrizione'] == 'Emessa') {
|
||||
} elseif ($stato['descrizione'] == 'Emessa') {
|
||||
elimina_scadenza($id_record);
|
||||
elimina_movimento($id_record, 0);
|
||||
} elseif (($rs[0]['descrizione'] == 'Pagato' or $rs[0]['descrizione'] == 'Parzialmente pagato') and ($dbo->fetchNum('SELECT id FROM co_scadenziario WHERE iddocumento = '.prepare($id_record)) == 0)) {
|
||||
} elseif (($stato['descrizione'] == 'Pagato' or $stato['descrizione'] == 'Parzialmente pagato') and ($dbo->fetchNum('SELECT id FROM co_scadenziario WHERE iddocumento = '.prepare($id_record)) == 0)) {
|
||||
// aggiungo la scadenza come già pagata
|
||||
aggiungi_scadenza($id_record, $pagamento, 1);
|
||||
aggiungi_scadenza($id_record, null, 1);
|
||||
aggiungi_movimento($id_record, $dir);
|
||||
}
|
||||
|
||||
// Se la fattura è in stato "Emessa" posso inserirla in scadenzario e aprire il mastrino cliente
|
||||
if ($rs[0]['descrizione'] == 'Emessa') {
|
||||
aggiungi_scadenza($id_record, $pagamento);
|
||||
if ($stato['descrizione'] == 'Emessa') {
|
||||
aggiungi_scadenza($id_record);
|
||||
aggiungi_movimento($id_record, $dir);
|
||||
}
|
||||
|
||||
|
@ -51,18 +51,16 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'delete-bulk':
|
||||
if (App::debug()) {
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM co_documenti WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_righe_documenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_scadenziario WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
flash()->info(tr('Fatture eliminate!'));
|
||||
} else {
|
||||
flash()->warning(tr('Procedura in fase di sviluppo. Nessuna modifica apportata.'));
|
||||
}
|
||||
foreach ($id_records as $id) {
|
||||
$dbo->query('DELETE FROM co_documenti WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_righe_documenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM co_scadenziario WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE iddocumento='.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
|
||||
flash()->info(tr('Fatture eliminate!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'export-xml-bulk':
|
||||
@ -79,7 +77,7 @@ switch (post('op')) {
|
||||
}
|
||||
|
||||
// Selezione delle fatture da stampare
|
||||
$fatture = $dbo->fetchArray('SELECT co_documenti.id, numero_esterno, data, ragione_sociale, co_tipidocumento.descrizione, co_tipidocumento.dir FROM co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id WHERE co_documenti.id IN('.implode(',', $id_records).') AND co_statidocumento.descrizione="Emessa"');
|
||||
$fatture = $dbo->fetchArray('SELECT co_documenti.id, numero_esterno, data, ragione_sociale, co_tipidocumento.descrizione, co_tipidocumento.dir FROM co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id WHERE co_documenti.id IN('.implode(',', $id_records).')');
|
||||
|
||||
$failed = [];
|
||||
if (!empty($fatture)) {
|
||||
@ -283,11 +281,15 @@ switch (post('op')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$bulk = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
];
|
||||
if (App::debug()) {
|
||||
|
||||
$bulk['registra-contabile'] = [
|
||||
$operations = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$operations['registra-contabile'] = [
|
||||
'text' => tr('Registra contabile pagamento'),
|
||||
'data' => [
|
||||
'msg' => tr('Vuoi aggiungere un movimento contabile per le fatture selezionate? (le fatture dovranno essere in stato emessa altrimenti non verranno elaborate)'),
|
||||
@ -298,7 +300,7 @@ $bulk['registra-contabile'] = [
|
||||
];
|
||||
|
||||
if ($module->name == 'Fatture di vendita') {
|
||||
$bulk['export-bulk'] = [
|
||||
$operations['export-bulk'] = [
|
||||
'text' => tr('Esporta stampe'),
|
||||
'data' => [
|
||||
'msg' => tr('Vuoi davvero esportare tutte le stampe in un archivio?'),
|
||||
@ -309,7 +311,7 @@ if ($module->name == 'Fatture di vendita') {
|
||||
];
|
||||
}
|
||||
|
||||
$bulk['export-xml-bulk'] = [
|
||||
$operations['export-xml-bulk'] = [
|
||||
'text' => tr('Esporta XML'),
|
||||
'data' => [
|
||||
'msg' => tr('Vuoi davvero esportare tutte le fatture elettroniche in un archivio?'),
|
||||
@ -319,4 +321,4 @@ $bulk['export-xml-bulk'] = [
|
||||
],
|
||||
];
|
||||
|
||||
return $bulk;
|
||||
return $operations;
|
||||
|
@ -221,21 +221,6 @@ if (empty($record['is_fiscale'])) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if ($dir == 'uscita') {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "number", "label": "<?php echo tr('Marca da bollo'); ?>", "name": "bollo", "value": "$bollo$", "help": "<?php echo tr('Applicato solo se il totale della fattura è maggiore di _MONEY_', [
|
||||
'_MONEY_' => moneyFormat(setting("Soglia minima per l'applicazione della marca da bollo")),
|
||||
]),'.'; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Split payment'); ?>", "name": "split_payment", "value": "$split_payment$", "help": "<?php echo tr('Abilita lo split payment per questo documento. Le aliquote iva con natura N6 (reverse charge) non saranno disponibili.'); ?>", "placeholder": "<?php echo tr('Split payment'); ?>" ]}
|
||||
@ -256,11 +241,6 @@ if ($dir == 'uscita') {
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Ritenuta contributi'); ?>", "name": "id_ritenuta_contributi", "value": "$id_ritenuta_contributi$", "values": "query=SELECT * FROM co_ritenuta_contributi" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Addebita marca da bollo'); ?>", "name": "addebita_bollo", "value": "$addebita_bollo$" ]}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -278,6 +258,38 @@ if ($dir == 'uscita') {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo '
|
||||
<div class="box box-info">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><i class="fa fa-certificate "></i> '.tr('Marca da bollo').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "checkbox", "label": "'.tr('Addebita marca da bollo').'", "name": "addebita_bollo", "value": "$addebita_bollo$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "checkbox", "label": "'.tr('Marca da bollo automatica').'", "name": "bollo_automatico", "value": "'.intval(!isset($record['bollo'])).'", "help": "'.tr("Seleziona per impostare automaticamente l'importo della marca da bollo").'. '.tr('Applicata solo se il totale della fattura è maggiore di _MONEY_', [
|
||||
'_MONEY_' => moneyFormat(setting("Soglia minima per l'applicazione della marca da bollo")),
|
||||
]).'.", "placeholder": "'.tr('Bollo automatico').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "number", "label": "'.tr('Importo marca da bollo').'", "name": "bollo", "value": "$bollo$", "disabled": '.intval(!isset($record['bollo'])).' ]}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#bollo_automatico").click(function(){
|
||||
$("#bollo").attr("disabled", $(this).is(":checked"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
if ($tipodoc == 'Fattura accompagnatoria di vendita') {
|
||||
echo '
|
||||
|
@ -271,7 +271,6 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
||||
|
||||
$segno_mov4_inps = 1;
|
||||
$segno_mov5_ritenutaacconto = -1;
|
||||
$segno_mov6_bollo = 1;
|
||||
|
||||
// Lettura conto fornitore
|
||||
$query = 'SELECT idconto_fornitore FROM an_anagrafiche INNER JOIN co_documenti ON an_anagrafiche.idanagrafica=co_documenti.idanagrafica WHERE co_documenti.id='.prepare($iddocumento);
|
||||
@ -290,7 +289,6 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
||||
|
||||
$segno_mov4_inps = -1;
|
||||
$segno_mov5_ritenutaacconto = 1;
|
||||
$segno_mov6_bollo = -1;
|
||||
|
||||
// Lettura conto cliente
|
||||
$query = 'SELECT idconto_cliente FROM an_anagrafiche INNER JOIN co_documenti ON an_anagrafiche.idanagrafica=co_documenti.idanagrafica WHERE co_documenti.id='.prepare($iddocumento);
|
||||
@ -343,7 +341,6 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
||||
aggiuntivo:
|
||||
4) eventuale rivalsa inps
|
||||
5) eventuale ritenuta d'acconto
|
||||
6) eventuale marca da bollo
|
||||
*/
|
||||
// 1) Aggiungo la riga del conto cliente
|
||||
$importo_cliente = $totale_fattura;
|
||||
@ -420,18 +417,6 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
||||
$query2 = 'INSERT INTO co_movimenti(idmastrino, data, data_documento, iddocumento, idanagrafica, descrizione, idconto, totale, primanota) VALUES('.prepare($idmastrino).', '.prepare($data).', '.prepare($data_documento).', '.prepare($iddocumento).", '', ".prepare($descrizione.' del '.date('d/m/Y', strtotime($data)).' ('.$ragione_sociale.')').', '.prepare($idconto_controparte).', '.prepare(($totale_ritenutaacconto * $segno_mov5_ritenutaacconto) * -1).', '.prepare($primanota).')';
|
||||
$dbo->query($query2);
|
||||
}
|
||||
|
||||
// 6) Aggiungo la marca da bollo se c'è
|
||||
// Lettura id conto marca da bollo
|
||||
if ($totale_bolli != 0) {
|
||||
$query = "SELECT id, descrizione FROM co_pianodeiconti3 WHERE descrizione='Rimborso spese marche da bollo'";
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$idconto_bolli = $rs[0]['id'];
|
||||
$descrizione_conto_bolli = $rs[0]['descrizione'];
|
||||
|
||||
$query2 = 'INSERT INTO co_movimenti(idmastrino, data, data_documento, iddocumento, idanagrafica, descrizione, idconto, totale, primanota) VALUES('.prepare($idmastrino).', '.prepare($data).', '.prepare($data_documento).', '.prepare($iddocumento).", '', ".prepare($descrizione.' del '.date('d/m/Y', strtotime($data)).' ('.$ragione_sociale.')').', '.prepare($idconto_bolli).', '.prepare($totale_bolli * $segno_mov6_bollo).', '.prepare($primanota).')';
|
||||
$dbo->query($query2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -707,23 +692,49 @@ function rimuovi_riga_fattura($id_documento, $id_riga, $dir)
|
||||
}
|
||||
|
||||
// Rimozione articoli collegati ad un preventivo importato con riga unica
|
||||
if (empty($riga['idarticolo']) && $riga['is_preventivo']) {
|
||||
if (empty($riga['idarticolo']) && $riga['idpreventivo']) {
|
||||
//rimetto a magazzino gli articoli collegati al preventivo
|
||||
$rsa = $dbo->fetchArray('SELECT idarticolo, qta FROM co_righe_preventivi WHERE idpreventivo = '.prepare($riga['idpreventivo']));
|
||||
$rsa = $dbo->fetchArray('SELECT id, idarticolo, qta FROM co_righe_preventivi WHERE idpreventivo = '.prepare($riga['idpreventivo']));
|
||||
for ($i = 0; $i < sizeof($rsa); ++$i) {
|
||||
if (!empty($rsa[$i]['idarticolo'])) {
|
||||
add_movimento_magazzino($rsa[$i]['idarticolo'], $rsa[$i]['qta'], ['iddocumento' => $id_documento]);
|
||||
if ($riga['is_preventivo']) {
|
||||
if (!empty($rsa[$i]['idarticolo'])) {
|
||||
add_movimento_magazzino($rsa[$i]['idarticolo'], $rsa[$i]['qta'], ['iddocumento' => $id_documento]);
|
||||
}
|
||||
} else {
|
||||
$qta_evasa = $rsa[$i]['qta_evasa'] + $riga['qta'];
|
||||
// Ripristino le quantità da evadere nel preventivo
|
||||
$dbo->update('co_righe_preventivi',
|
||||
[
|
||||
'qta_evasa' => $qta_evasa,
|
||||
],
|
||||
[
|
||||
'id' => $rsa[$i]['id'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rimozione articoli collegati ad un contratto importato con riga unica
|
||||
if (empty($riga['idarticolo']) && $riga['is_contratto']) {
|
||||
if (empty($riga['idarticolo']) && $riga['idcontratto']) {
|
||||
//rimetto a magazzino gli articoli collegati al contratto
|
||||
$rsa = $dbo->fetchArray('SELECT idarticolo, qta FROM co_righe_contratti WHERE idcontratto = '.prepare($riga['idcontratto']));
|
||||
$rsa = $dbo->fetchArray('SELECT id, idarticolo, qta FROM co_righe_contratti WHERE idcontratto = '.prepare($riga['idcontratto']));
|
||||
for ($i = 0; $i < sizeof($rsa); ++$i) {
|
||||
if (!empty($rsa[$i]['idarticolo'])) {
|
||||
add_movimento_magazzino($rsa[$i]['idarticolo'], $rsa[$i]['qta'], ['iddocumento' => $id_documento]);
|
||||
if ($riga['is_contratto']) {
|
||||
if (!empty($rsa[$i]['idarticolo'])) {
|
||||
add_movimento_magazzino($rsa[$i]['idarticolo'], $rsa[$i]['qta'], ['iddocumento' => $id_documento]);
|
||||
}
|
||||
} else {
|
||||
$qta_evasa = $rsa[$i]['qta_evasa'] + $riga['qta'];
|
||||
// Ripristino le quantità da evadere nel contratto
|
||||
$dbo->update('co_righe_contratti',
|
||||
[
|
||||
'qta_evasa' => $qta_evasa,
|
||||
],
|
||||
[
|
||||
'id' => $rsa[$i]['id'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,5 +170,15 @@ trait RelationTrait
|
||||
elseif (!empty($this->idordine)) {
|
||||
$database->query('UPDATE or_righe_ordini SET qta_evasa = qta_evasa + '.$diff.' WHERE descrizione = '.prepare($this->descrizione).' AND idarticolo = '.prepare($this->idarticolo).' AND idordine = '.prepare($this->idordine).' AND idiva = '.prepare($this->idiva).' AND qta_evasa < qta LIMIT 1');
|
||||
}
|
||||
|
||||
// Se c'è un collegamento ad un preventivo, aggiorno la quantità evasa
|
||||
elseif (!empty($this->idpreventivo)) {
|
||||
$database->query('UPDATE co_righe_preventivi SET qta_evasa = qta_evasa + '.$diff.' WHERE descrizione = '.prepare($this->descrizione).' AND idarticolo = '.prepare($this->idarticolo).' AND idpreventivo = '.prepare($this->idpreventivo).' AND idiva = '.prepare($this->idiva).' AND qta_evasa < qta LIMIT 1');
|
||||
}
|
||||
|
||||
// Se c'è un collegamento ad un contratto, aggiorno la quantità evasa
|
||||
elseif (!empty($this->idcontratto)) {
|
||||
$database->query('UPDATE co_righe_contratti SET qta_evasa = qta_evasa + '.$diff.' WHERE descrizione = '.prepare($this->descrizione).' AND idarticolo = '.prepare($this->idarticolo).' AND idcontratto = '.prepare($this->idcontratto).' AND idiva = '.prepare($this->idiva).' AND qta_evasa < qta LIMIT 1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,12 @@ class Fattura extends Document
|
||||
public function save(array $options = [])
|
||||
{
|
||||
// Fix dei campi statici
|
||||
$this->calcolaMarcaDaBollo();
|
||||
$bollo = $this->bollo;
|
||||
if ($bollo == null) {
|
||||
$bollo = $this->calcolaMarcaDaBollo();
|
||||
}
|
||||
|
||||
$this->manageRigaMarcaDaBollo($bollo, $this->addebita_bollo);
|
||||
|
||||
$this->attributes['ritenutaacconto'] = $this->ritenuta_acconto;
|
||||
$this->attributes['iva_rivalsainps'] = $this->iva_rivalsa_inps;
|
||||
@ -529,12 +534,15 @@ class Fattura extends Document
|
||||
// Se l'importo è negativo può essere una nota di credito, quindi cambio segno alla marca da bollo
|
||||
$marca_da_bollo = abs($marca_da_bollo);
|
||||
|
||||
$this->bollo = $marca_da_bollo;
|
||||
return $marca_da_bollo;
|
||||
}
|
||||
|
||||
protected function manageRigaMarcaDaBollo($marca_da_bollo, $addebita_bollo)
|
||||
{
|
||||
$riga = $this->rigaBollo;
|
||||
|
||||
// Rimozione riga bollo se nullo
|
||||
if (empty($this->addebita_bollo) || empty($marca_da_bollo)) {
|
||||
if (empty($addebita_bollo) || empty($marca_da_bollo)) {
|
||||
if (!empty($riga)) {
|
||||
$this->id_riga_bollo = null;
|
||||
|
||||
|
@ -9,6 +9,7 @@ use Modules\Interventi\Components\Riga;
|
||||
use Modules\Interventi\Intervento;
|
||||
use Modules\Interventi\Stato;
|
||||
use Modules\Interventi\TipoSessione;
|
||||
use Modules\Interventi\Components\Sconto;
|
||||
|
||||
switch (post('op')) {
|
||||
case 'update':
|
||||
@ -353,9 +354,9 @@ switch (post('op')) {
|
||||
|
||||
case 'manage_sconto':
|
||||
if (post('idriga') != null) {
|
||||
$sconto = Riga::find(post('idriga'));
|
||||
$sconto = Sconto::find(post('idriga'));
|
||||
} else {
|
||||
$sconto = Riga::build($intervento);
|
||||
$sconto = Sconto::build($intervento);
|
||||
}
|
||||
|
||||
$sconto->descrizione = post('descrizione');
|
||||
|
@ -113,6 +113,7 @@ elseif (!empty($id_intervento)) {
|
||||
$idtipointervento = $rs[0]['idtipointervento'];
|
||||
$data = (null !== filter('data')) ? filter('data') : $rs[0]['data_richiesta'];
|
||||
$data_richiesta = $rs[0]['data_richiesta'];
|
||||
$data_scadenza = $rs[0]['data_scadenza'];
|
||||
$richiesta = $rs[0]['richiesta'];
|
||||
$idsede = $rs[0]['idsede'];
|
||||
$idanagrafica = $rs[0]['idanagrafica'];
|
||||
@ -228,7 +229,7 @@ if (!empty($id_intervento)) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora scadenza'); ?>", "name": "data_scadenza", "required": 0, "value": "" ]}
|
||||
{[ "type": "timestamp", "label": "<?php echo tr('Data/ora scadenza'); ?>", "name": "data_scadenza", "required": 0, "value": "<?php echo $data_scadenza; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -89,7 +89,7 @@ if (count($rs2) > 0) {
|
||||
// Pulsante per riportare nel magazzino centrale.
|
||||
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
|
||||
if (!$record['flag_completato']) {
|
||||
$link = $record['prezzo_vendita'] == 0 ? $structure->fileurl('row-edit.php') : $structure->fileurl('add_righe.php');
|
||||
$link = $r['is_sconto'] == 1 ? $structure->fileurl('row-edit.php') : $structure->fileurl('add_righe.php');
|
||||
|
||||
echo '
|
||||
<td class="text-center">
|
||||
|
@ -165,7 +165,7 @@ function add_tecnico($idintervento, $idtecnico, $inizio, $fine, $idcontratto = n
|
||||
if (!empty($tecnico['email'])) {
|
||||
$n = new Notifications\EmailNotification();
|
||||
|
||||
$n->setTemplate('Notifica intervento', $id_record);
|
||||
$n->setTemplate('Notifica intervento', $idintervento);
|
||||
$n->setReceivers($tecnico['email']);
|
||||
|
||||
$n->send();
|
||||
|
39
modules/iva/bulk.php
Normal file
39
modules/iva/bulk.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
switch (post('op')) {
|
||||
case 'delete-bulk':
|
||||
$count_iva = $dbo->fetchNum('SELECT id FROM `co_iva` WHERE deleted_at IS NOT NULL');
|
||||
foreach ($id_records as $id) {
|
||||
$res = $dbo->fetchNum('SELECT `co_righe_documenti`.`id` FROM `co_righe_documenti` WHERE `co_righe_documenti`.`idiva`='.prepare($id).
|
||||
' UNION SELECT `co_righe_preventivi`.`id` FROM `co_righe_preventivi` WHERE `co_righe_preventivi`.`idiva` = '.prepare($id).
|
||||
' UNION SELECT `co_righe_contratti`.`id` FROM `co_righe_contratti` WHERE `co_righe_contratti`.`idiva` = '.prepare($id).
|
||||
' UNION SELECT `dt_righe_ddt`.`id` FROM `dt_righe_ddt` WHERE `dt_righe_ddt`.`idiva` = '.prepare($id).
|
||||
' UNION SELECT `or_righe_ordini`.`id` FROM `or_righe_ordini` WHERE `or_righe_ordini`.`idiva` = '.prepare($id).
|
||||
' UNION SELECT `mg_articoli`.`id` FROM `mg_articoli` WHERE `mg_articoli`.`idiva_vendita` = '.prepare($id).
|
||||
' UNION SELECT `an_anagrafiche`.`idanagrafica` AS `id` FROM `an_anagrafiche` WHERE `an_anagrafiche`.`idiva_vendite` = '.prepare($id).' OR `an_anagrafiche`.`idiva_acquisti` = '.prepare($id));
|
||||
|
||||
if (empty($res)) {
|
||||
$dbo->query('UPDATE `co_iva` SET deleted_at = NOW() WHERE id = '.prepare($id).Modules::getAdditionalsQuery($id_module));
|
||||
}
|
||||
}
|
||||
$count_iva = $dbo->fetchNum('SELECT id FROM `co_iva` WHERE deleted_at IS NOT NULL') - $count_iva;
|
||||
|
||||
if ($count_iva > 0) {
|
||||
$msg = tr('_NUM_ tipologi_A_ iva eliminat_A_.', [
|
||||
'_NUM_' => $count_iva,
|
||||
'_A_' => ($count_iva == 1) ? 'a' : 'e', ]);
|
||||
|
||||
flash()->info($msg);
|
||||
} else {
|
||||
flash()->warning(tr('Nessuna tipologia iva eliminata!'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$bulk = [
|
||||
'delete-bulk' => tr('Elimina selezionati'),
|
||||
];
|
||||
|
||||
return $bulk;
|
@ -2,13 +2,6 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (!$record['default']) {
|
||||
$attr = '';
|
||||
} else {
|
||||
$attr = 'readonly';
|
||||
echo '<div class="alert alert-warning">'.tr('Alcune impostazioni non possono essere modificate.').'</div>';
|
||||
}
|
||||
|
||||
$esigibilita = [
|
||||
[
|
||||
'id' => 'I',
|
||||
@ -79,16 +72,6 @@ $esigibilita = [
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
// Record eliminabile solo se permesso
|
||||
if (!$record['default']) {
|
||||
?>
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
@ -108,3 +91,26 @@ $(document).ready(function(){
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$res = $dbo->fetchNum('SELECT `co_righe_documenti`.`id` FROM `co_righe_documenti` WHERE `co_righe_documenti`.`idiva`='.prepare($id_record).
|
||||
' UNION SELECT `co_righe_preventivi`.`id` FROM `co_righe_preventivi` WHERE `co_righe_preventivi`.`idiva` = '.prepare($id_record).
|
||||
' UNION SELECT `co_righe_contratti`.`id` FROM `co_righe_contratti` WHERE `co_righe_contratti`.`idiva` = '.prepare($id_record).
|
||||
' UNION SELECT `dt_righe_ddt`.`id` FROM `dt_righe_ddt` WHERE `dt_righe_ddt`.`idiva` = '.prepare($id_record).
|
||||
' UNION SELECT `or_righe_ordini`.`id` FROM `or_righe_ordini` WHERE `or_righe_ordini`.`idiva` = '.prepare($id_record).
|
||||
' UNION SELECT `mg_articoli`.`id` FROM `mg_articoli` WHERE `mg_articoli`.`idiva_vendita` = '.prepare($id_record).
|
||||
' UNION SELECT `an_anagrafiche`.`idanagrafica` AS `id` FROM `an_anagrafiche` WHERE `an_anagrafiche`.`idiva_vendite` = '.prepare($id_record).' OR `an_anagrafiche`.`idiva_acquisti` = '.prepare($id_record));
|
||||
|
||||
if ($res) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
<p>'.tr('Ci sono '.count($res).' documenti collegati a questa aliquota IVA. Non è possibile eliminarla.').'</p>
|
||||
</div>';
|
||||
} else {
|
||||
echo '
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ switch (filter('op')) {
|
||||
'giorno' => $giorno,
|
||||
'prc' => post('percentuale')[$key],
|
||||
'descrizione' => $descrizione,
|
||||
'riba' => post('riba'),
|
||||
'idconto_vendite' => post('idconto_vendite'),
|
||||
'idconto_acquisti' => post('idconto_acquisti'),
|
||||
'codice_modalita_pagamento_fe' => post('codice_modalita_pagamento_fe'),
|
||||
|
@ -18,9 +18,13 @@ include_once __DIR__.'/../../core.php';
|
||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "value": "$descrizione$", "required": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "select", "label": "<?php echo tr('Codice Modalità (Fatturazione Elettronica)'); ?>", "name": "codice_modalita_pagamento_fe", "value": "$codice_modalita_pagamento_fe$", "values": "query=SELECT codice as id, CONCAT(codice, ' - ', descrizione) AS descrizione FROM fe_modalita_pagamento", "required": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Pagamento di tipo Ri.Ba.'); ?>", "name": "riba", "value": "$riba$", "help": "<?php echo tr('Abilitando questa impostazione, nelle fatture verrà visualizzata la banca del cliente'); ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -24,10 +24,10 @@ class Pagamento extends Model
|
||||
$rate = $this->rate->sortBy('num_giorni');
|
||||
$number = count($rate);
|
||||
|
||||
//dd($rate, $this);
|
||||
$totale = 0.0;
|
||||
|
||||
$results = [];
|
||||
$count = 0;
|
||||
foreach ($rate as $key => $rata) {
|
||||
// X giorni esatti
|
||||
if ($rata['giorno'] == 0) {
|
||||
@ -60,7 +60,7 @@ class Pagamento extends Model
|
||||
}
|
||||
|
||||
// All'ultimo ciclo imposto come cifra da pagare il totale della fattura meno gli importi già inseriti in scadenziario per evitare di inserire cifre arrotondate "male"
|
||||
if ($key + 1 == $number) {
|
||||
if ($count + 1 == $number) {
|
||||
$da_pagare = sum($importo, -$totale, 2);
|
||||
}
|
||||
|
||||
@ -75,6 +75,8 @@ class Pagamento extends Model
|
||||
'scadenza' => $scadenza,
|
||||
'importo' => $da_pagare,
|
||||
];
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -100,6 +100,7 @@ switch (post('op')) {
|
||||
// Duplica preventivo
|
||||
case 'copy':
|
||||
$new = $preventivo->replicate();
|
||||
$new->numero = Preventivo::getNextNumero();
|
||||
$new->idstato = 1;
|
||||
$new->master_revision = $preventivo->id;
|
||||
$new->save();
|
||||
|
@ -36,7 +36,7 @@ echo '
|
||||
<th width="30">'.tr('Posizione').'</th>
|
||||
</tr>';
|
||||
|
||||
$widgets = $dbo->fetchArray('SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC');
|
||||
$widgets = $dbo->fetchArray('SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location, help FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC');
|
||||
|
||||
$previous = '';
|
||||
|
||||
@ -82,7 +82,7 @@ foreach ($widgets as $widget) {
|
||||
|
||||
echo '
|
||||
<tr class="'.$class.'">
|
||||
<td>'.$widget['widget_name'].'</td>
|
||||
<td>'.$widget['widget_name'].((!empty($widget['help'])) ? ' <i class="tip fa fa-question-circle-o" class="tip" title="'.$widget['help'].'"</i>' : '').'</td>
|
||||
<td align="right"><small>'.$location.'</small></td>
|
||||
<td align="center">'.$stato.'</td>
|
||||
<td align="center">'.$posizione.'</td>
|
||||
|
@ -81,6 +81,6 @@ function crea_grafico(values){
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="chart-container" style="width:20vw">
|
||||
<div class="chart-container" style="width:25em;">
|
||||
<canvas id="chart"></canvas>
|
||||
</div>';
|
||||
|
@ -14,7 +14,7 @@ echo '
|
||||
<!-- DATI -->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Opzioni di visualizzazione').'</h3>
|
||||
<h3 class="panel-title">'.tr('Opzioni generali').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">';
|
||||
@ -79,369 +79,32 @@ echo '
|
||||
|
||||
if (!empty($options) && $options != 'custom' && $options != 'menu') {
|
||||
echo '
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs nav-justified">
|
||||
<li class="active"><a data-toggle="tab" href="#fields">'.tr('Campi').'</a></li>
|
||||
<li><a data-toggle="tab" href="#filters">'.tr('Filtri').'</a></li>
|
||||
</ul>
|
||||
|
||||
<form action="" method="post" role="form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="fields">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Campi disponibili').'</h3>
|
||||
</div>
|
||||
<!-- CAMPI -->
|
||||
<div id="fields" class="tab-pane fade in active">';
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="data">';
|
||||
|
||||
$key = 0;
|
||||
$fields = $dbo->fetchArray('SELECT * FROM zz_views WHERE id_module='.prepare($record['id']).' ORDER BY `order` ASC');
|
||||
foreach ($fields as $key => $field) {
|
||||
$editable = !($field['default'] && $enable_readonly);
|
||||
|
||||
echo '
|
||||
<div class="box ';
|
||||
if ($field['visible']) {
|
||||
echo 'box-success';
|
||||
} else {
|
||||
echo 'box-danger';
|
||||
}
|
||||
echo '">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<a data-toggle="collapse" href="#field-'.$field['id'].'">'.tr('Campo in posizione _POSITION_', [
|
||||
'_POSITION_' => $field['order'],
|
||||
]).' ('.$field['name'].')</a>
|
||||
</h3>';
|
||||
if ($editable) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-id="'.$field['id'].'">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
<div id="field-'.$field['id'].'" class="box-body collapse">
|
||||
<div class="row">
|
||||
<input type="hidden" value="'.$field['id'].'" name="id['.$key.']">
|
||||
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name['.$key.']", "value": "'.$field['name'].'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ', "help": "'.tr('Nome con cui il campo viene identificato e visualizzato nella tabella').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query prevista').'", "name": "query['.$key.']", "value": "'.prepareToField($field['query']).'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ', "required": "1", "help": "'.tr('Nome effettivo del campo sulla tabella oppure subquery che permette di ottenere il valore del campo').'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Gruppi con accesso').'", "name": "gruppi['.$key.'][]", "multiple": "1", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "value": "';
|
||||
$results = $dbo->fetchArray('SELECT GROUP_CONCAT(DISTINCT id_gruppo SEPARATOR \',\') AS gruppi FROM zz_group_view WHERE id_vista='.prepare($field['id']));
|
||||
|
||||
echo $results[0]['gruppi'].'"';
|
||||
|
||||
echo ', "help": "'.tr('Gruppi di utenti in grado di visualizzare questo campo').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Visibilità').'", "name": "visible['.$key.']", "values": "list=\"0\":\"'.tr('Nascosto (variabili di stato)').'\",\"1\": \"'.tr('Visibile nella sezione').'\"", "value": "'.$field['visible'].'", "help": "'.tr('Stato del campo: visibile nella tabella oppure nascosto').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricercabile').'", "name": "search['.$key.']", "value": "'.$field['search'].'", "help": "'.tr('Indica se il campo è ricercabile').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricerca lenta').'", "name": "slow['.$key.']", "value": "'.$field['slow'].'", "help": "'.tr("Indica se la ricerca per questo campo è lenta (da utilizzare nel caso di evidenti rallentamenti, mostra solo un avviso all'utente").'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Sommabile').'", "name": "sum['.$key.']", "value": "'.$field['summable'].'", "help": "'.tr('Indica se il campo è da sommare').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Formattabile').'", "name": "format['.$key.']", "value": "'.$field['format'].'", "help": "'.tr('Indica se il campo è formattabile in modo automatico').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ricerca tramite').'", "name": "search_inside['.$key.']", "value": "'.$field['search_inside'].'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ', "help": "'.tr('Query personalizzata per la ricerca (consigliata per colori e icone)').'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ordina tramite').'", "name": "order_by['.$key.']", "value": "'.$field['order_by'].'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ', "help": "'.tr("Query personalizzata per l'ordinamento (date e numeri formattati tramite query)").'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="button" class="btn btn-info" id="add">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi nuovo campo').'
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="fa fa-check"></i> '.tr('Salva').'
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Ordine di visualizzazione').' <span class="tip pull-right" title="'.tr('Trascina per ordinare le colonne').'."><i class="fa fa-question-circle-o"></i></span></h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body sortable">';
|
||||
|
||||
foreach ($fields as $field) {
|
||||
echo '
|
||||
<p class="clickable" data-id="'.$field['id'].'">
|
||||
<i class="fa fa-sort" ></i>
|
||||
';
|
||||
if ($field['visible']) {
|
||||
echo '<strong class="text-success">'.$field['name'].'</strong>';
|
||||
} else {
|
||||
echo '<span class="text-danger">'.$field['name'].'</span>';
|
||||
}
|
||||
echo '
|
||||
</p>';
|
||||
}
|
||||
include $module->filepath('fields.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<form class="hide" id="template">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr('Nuovo campo').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<input type="hidden" value="" name="id[-id-]">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query prevista').'", "name": "query[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Gruppi con accesso').'", "name": "gruppi[-id-][]", "multiple": "1", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Visibilità').'", "name": "visible[-id-]", "values": "list=\"0\":\"'.tr('Nascosto (variabili di stato)').'\",\"1\": \"'.tr('Visibile nella sezione').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricercabile').'", "name": "search[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricerca lenta').'", "name": "slow[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Sommabile').'", "name": "sum[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Formattabile').'", "name": "format[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ricerca tramite').'", "name": "search_inside[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ordina tramite').'", "name": "order_by[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<form action="" method="post" role="form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="filters">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Filtri per gruppo di utenti').'</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="data">';
|
||||
|
||||
$num = 0;
|
||||
$additionals = $dbo->fetchArray('SELECT * FROM zz_group_module WHERE idmodule='.prepare($record['id']).' ORDER BY `id` ASC');
|
||||
foreach ($additionals as $num => $additional) {
|
||||
$editable = !($additional['default'] && $enable_readonly);
|
||||
|
||||
echo '
|
||||
<div class="box ';
|
||||
if ($additional['enabled']) {
|
||||
echo 'box-success';
|
||||
} else {
|
||||
echo 'box-danger';
|
||||
}
|
||||
echo '">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<a data-toggle="collapse" href="#additional-'.$additional['id'].'">'.tr('Filtro: _NAME_', [
|
||||
'_NAME_' => $additional['name'],
|
||||
]).'</a>
|
||||
</h3>';
|
||||
if ($editable) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-op="delete_filter" data-id="'.$additional['id'].'">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
echo '
|
||||
<a class="btn btn-warning ask pull-right" data-backto="record-edit" data-msg="'.($additional['enabled'] ? tr('Disabilitare questo elemento?') : tr('Abilitare questo elemento?')).'" data-op="change" data-id="'.$additional['id'].'" data-class="btn btn-lg btn-warning" data-button="'.($additional['enabled'] ? tr('Disabilita') : tr('Abilita')).'">
|
||||
<i class="fa fa-eye-slash"></i> '.($additional['enabled'] ? tr('Disabilita') : tr('Abilita')).'
|
||||
</a>';
|
||||
echo '
|
||||
</div>
|
||||
<div id="additional-'.$additional['id'].'" class="box-body collapse">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query').'", "name": "query['.$num.']", "value": "'.prepareToField($additional['clause']).'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<input type="hidden" value="'.$additional['id'].'" name="id['.$num.']">
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Name').'", "name": "name['.$num.']", "value": "'.$additional['name'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Gruppo').'", "name": "gruppo['.$num.']", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "value": "'.$additional['idgruppo'].'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ' ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Posizione').'", "name": "position['.$num.']", "values": "list=\"0\":\"'.tr('WHERE').'\",\"1\": \"'.tr('HAVING').'\"", "value": "'.$additional['position'].'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": "1"';
|
||||
}
|
||||
echo ' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="button" class="btn btn-info" id="add_filter">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi nuovo filtro').'
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="fa fa-check"></i> '.tr('Salva').'
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
<!-- FILTRI -->
|
||||
<div id="filters" class="tab-pane fade">';
|
||||
|
||||
include $module->filepath('filters.php');
|
||||
|
||||
echo '
|
||||
<form class="hide" id="template_filter">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr('Nuovo filtro').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query').'", "name": "query[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<input type="hidden" value="" name="id[-id-]">
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Gruppo').'", "name": "gruppo[-id-]", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Posizione').'", "name": "position[-id-]", "values": "list=\"0\":\"'.tr('WHERE').'\",\"1\": \"'.tr('HAVING').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>';
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
<script>
|
||||
@ -471,56 +134,5 @@ function testQuery(){
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.replace(new RegExp(find, "g"), replace);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#save").addClass("hide");
|
||||
|
||||
var n = '.$key.';
|
||||
$(document).on("click", "#add", function(){
|
||||
$("#template .superselect, #template .superselectajax").select2().select2("destroy");
|
||||
n++;
|
||||
var text = replaceAll($("#template").html(), "-id-", "" + n);
|
||||
$(this).parent().parent().parent().find(".data").append(text);
|
||||
start_superselect();
|
||||
});
|
||||
|
||||
var i = '.$num.';
|
||||
$(document).on("click", "#add_filter", function(){
|
||||
$("#template_filter .superselect, #template_filter .superselectajax").select2().select2("destroy");
|
||||
i++;
|
||||
var text = replaceAll($("#template_filter").html(), "-id-", "" + i);
|
||||
$(this).parent().parent().parent().find(".data").append(text);
|
||||
start_superselect();
|
||||
});
|
||||
|
||||
$( ".sortable" ).disableSelection();
|
||||
$(".sortable").each(function() {
|
||||
$(this).sortable({
|
||||
axis: "y",
|
||||
cursor: "move",
|
||||
dropOnEmpty: true,
|
||||
scroll: true,
|
||||
update: function(event, ui) {
|
||||
|
||||
var order = "";
|
||||
$("div.panel-body.sortable p[data-id]").each( function(){
|
||||
order += ","+$(this).data("id");
|
||||
});
|
||||
|
||||
order = order.replace(/^,/, "");
|
||||
|
||||
$.post("'.$rootdir.'/actions.php", {
|
||||
id: ui.item.data("id"),
|
||||
id_module: '.$id_module.',
|
||||
id_record: '.$id_record.',
|
||||
op: "update_position",
|
||||
order: order,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
// Fix apertura non corrisposta di un tag div
|
||||
echo '</div>';
|
||||
}
|
||||
|
248
modules/viste/fields.php
Normal file
248
modules/viste/fields.php
Normal file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
echo '
|
||||
|
||||
<form action="" method="post" role="form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="fields">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="data">';
|
||||
|
||||
$key = 0;
|
||||
$fields = $dbo->fetchArray('SELECT * FROM zz_views WHERE id_module='.prepare($record['id']).' ORDER BY `order` ASC');
|
||||
foreach ($fields as $key => $field) {
|
||||
$editable = !($field['default'] && $enable_readonly);
|
||||
|
||||
echo '
|
||||
<div class="box box-'.($field['visible'] ? 'success' : 'danger').'">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<a data-toggle="collapse" href="#field-'.$field['id'].'">'.tr('Campo in posizione _POSITION_', [
|
||||
'_POSITION_' => $field['order'],
|
||||
]).' ('.$field['name'].')</a>
|
||||
</h3>';
|
||||
|
||||
if ($editable) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-id="'.$field['id'].'">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div id="field-'.$field['id'].'" class="box-body collapse">
|
||||
<div class="row">
|
||||
<input type="hidden" value="'.$field['id'].'" name="id['.$key.']">
|
||||
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name['.$key.']", "value": "'.$field['name'].'", "readonly": "'.(!$editable).'", "help": "'.tr('Nome con cui il campo viene identificato e visualizzato nella tabella').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query prevista').'", "name": "query['.$key.']", "value": "'.prepareToField($field['query']).'", "readonly": "'.(!$editable).'", "required": "1", "help": "'.tr('Nome effettivo del campo sulla tabella oppure subquery che permette di ottenere il valore del campo').'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Gruppi con accesso').'", "name": "gruppi['.$key.'][]", "multiple": "1", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "value": "';
|
||||
$results = $dbo->fetchArray('SELECT GROUP_CONCAT(DISTINCT id_gruppo SEPARATOR \',\') AS gruppi FROM zz_group_view WHERE id_vista='.prepare($field['id']));
|
||||
|
||||
echo $results[0]['gruppi'].'"';
|
||||
|
||||
echo ', "help": "'.tr('Gruppi di utenti in grado di visualizzare questo campo').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Visibilità').'", "name": "visible['.$key.']", "values": "list=\"0\":\"'.tr('Nascosto (variabili di stato)').'\",\"1\": \"'.tr('Visibile nella sezione').'\"", "value": "'.$field['visible'].'", "help": "'.tr('Stato del campo: visibile nella tabella oppure nascosto').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricercabile').'", "name": "search['.$key.']", "value": "'.$field['search'].'", "help": "'.tr('Indica se il campo è ricercabile').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricerca lenta').'", "name": "slow['.$key.']", "value": "'.$field['slow'].'", "help": "'.tr("Indica se la ricerca per questo campo è lenta (da utilizzare nel caso di evidenti rallentamenti, mostra solo un avviso all'utente").'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Sommabile').'", "name": "sum['.$key.']", "value": "'.$field['summable'].'", "help": "'.tr('Indica se il campo è da sommare').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Formattabile').'", "name": "format['.$key.']", "value": "'.$field['format'].'", "help": "'.tr('Indica se il campo è formattabile in modo automatico').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ricerca tramite').'", "name": "search_inside['.$key.']", "value": "'.$field['search_inside'].'", "readonly": "'.(!$editable).'", "help": "'.tr('Query personalizzata per la ricerca (consigliata per colori e icone)').'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ordina tramite').'", "name": "order_by['.$key.']", "value": "'.$field['order_by'].'", "readonly": "'.(!$editable).'", "help": "'.tr("Query personalizzata per l'ordinamento (date e numeri formattati tramite query)").'.<br>'.tr('ATTENZIONE: utilizza sempre i caratteri < o > seguiti da spazio!').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="button" class="btn btn-info" id="add">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi nuovo campo').'
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="fa fa-check"></i> '.tr('Salva').'
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Ordine di visualizzazione').' <span class="tip pull-right" title="'.tr('Trascina per ordinare le colonne').'."><i class="fa fa-question-circle-o"></i></span></h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body sortable">';
|
||||
|
||||
foreach ($fields as $field) {
|
||||
echo '
|
||||
<p class="clickable" data-id="'.$field['id'].'">
|
||||
<i class="fa fa-sort" ></i>
|
||||
';
|
||||
|
||||
if ($field['visible']) {
|
||||
echo '<strong class="text-success">'.$field['name'].'</strong>';
|
||||
} else {
|
||||
echo '<span class="text-danger">'.$field['name'].'</span>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</p>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<form class="hide" id="template">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr('Nuovo campo').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<input type="hidden" value="" name="id[-id-]">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query prevista').'", "name": "query[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Gruppi con accesso').'", "name": "gruppi[-id-][]", "multiple": "1", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Visibilità').'", "name": "visible[-id-]", "values": "list=\"0\":\"'.tr('Nascosto (variabili di stato)').'\",\"1\": \"'.tr('Visibile nella sezione').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricercabile').'", "name": "search[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Ricerca lenta').'", "name": "slow[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Sommabile').'", "name": "sum[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "'.tr('Formattabile').'", "name": "format[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ricerca tramite').'", "name": "search_inside[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ordina tramite').'", "name": "order_by[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<script>
|
||||
var n = '.$key.';
|
||||
$(document).on("click", "#add", function(){
|
||||
$("#template .superselect, #template .superselectajax").select2().select2("destroy");
|
||||
n++;
|
||||
var text = replaceAll($("#template").html(), "-id-", "" + n);
|
||||
$(this).parent().parent().parent().find(".data").append(text);
|
||||
start_superselect();
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#save").addClass("hide");
|
||||
|
||||
$( ".sortable" ).disableSelection();
|
||||
$(".sortable").each(function() {
|
||||
$(this).sortable({
|
||||
axis: "y",
|
||||
cursor: "move",
|
||||
dropOnEmpty: true,
|
||||
scroll: true,
|
||||
update: function(event, ui) {
|
||||
|
||||
var order = "";
|
||||
$("div.panel-body.sortable p[data-id]").each( function(){
|
||||
order += ","+$(this).data("id");
|
||||
});
|
||||
|
||||
order = order.replace(/^,/, "");
|
||||
|
||||
$.post("'.$rootdir.'/actions.php", {
|
||||
id: ui.item.data("id"),
|
||||
id_module: '.$id_module.',
|
||||
id_record: '.$id_record.',
|
||||
op: "update_position",
|
||||
order: order,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
128
modules/viste/filters.php
Normal file
128
modules/viste/filters.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
echo '
|
||||
<form action="" method="post" role="form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="filters">
|
||||
|
||||
<div class="data">';
|
||||
|
||||
$num = 0;
|
||||
$additionals = $dbo->fetchArray('SELECT * FROM zz_group_module WHERE idmodule='.prepare($record['id']).' ORDER BY `id` ASC');
|
||||
foreach ($additionals as $num => $additional) {
|
||||
$editable = !($additional['default'] && $enable_readonly);
|
||||
|
||||
echo '
|
||||
<div class="box box-'.($additional['enabled'] ? 'success' : 'danger').'">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<a data-toggle="collapse" href="#additional-'.$additional['id'].'">'.tr('Filtro: _NAME_', [
|
||||
'_NAME_' => $additional['name'],
|
||||
]).'</a>
|
||||
</h3>';
|
||||
|
||||
if ($editable) {
|
||||
echo '
|
||||
<a class="btn btn-danger ask pull-right" data-backto="record-edit" data-op="delete_filter" data-id="'.$additional['id'].'">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<a class="btn btn-warning ask pull-right" data-backto="record-edit" data-msg="'.($additional['enabled'] ? tr('Disabilitare questo elemento?') : tr('Abilitare questo elemento?')).'" data-op="change" data-id="'.$additional['id'].'" data-class="btn btn-lg btn-warning" data-button="'.($additional['enabled'] ? tr('Disabilita') : tr('Abilita')).'">
|
||||
<i class="fa fa-eye-slash"></i> '.($additional['enabled'] ? tr('Disabilita') : tr('Abilita')).'
|
||||
</a>';
|
||||
echo '
|
||||
</div>
|
||||
<div id="additional-'.$additional['id'].'" class="box-body collapse">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query').'", "name": "query['.$num.']", "value": "'.prepareToField($additional['clause']).'"';
|
||||
if (!$editable) {
|
||||
echo ', "readonly": '.(!$editable).'';
|
||||
}
|
||||
echo ' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<input type="hidden" value="'.$additional['id'].'" name="id['.$num.']">
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Name').'", "name": "name['.$num.']", "value": "'.$additional['name'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Gruppo').'", "name": "gruppo['.$num.']", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC", "value": "'.$additional['idgruppo'].'", "readonly": '.(!$editable).' ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Posizione').'", "name": "position['.$num.']", "values": "list=\"0\":\"'.tr('WHERE').'\",\"1\": \"'.tr('HAVING').'\"", "value": "'.$additional['position'].'", "readonly": '.(!$editable).' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="button" class="btn btn-info" id="add_filter">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi nuovo filtro').'
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-success">
|
||||
<i class="fa fa-check"></i> '.tr('Salva').'
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<form class="hide" id="template_filter">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'.tr('Nuovo filtro').'</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "'.tr('Query').'", "name": "query[-id-]" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<input type="hidden" value="" name="id[-id-]">
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name[-id-]" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Gruppo').'", "name": "gruppo[-id-]", "values": "query=SELECT id, nome AS descrizione FROM zz_groups ORDER BY id ASC" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Posizione').'", "name": "position[-id-]", "values": "list=\"0\":\"'.tr('WHERE').'\",\"1\": \"'.tr('HAVING').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
<script>
|
||||
var i = '.$num.';
|
||||
$(document).on("click", "#add_filter", function(){
|
||||
$("#template_filter .superselect, #template_filter .superselectajax").select2().select2("destroy");
|
||||
i++;
|
||||
var text = replaceAll($("#template_filter").html(), "-id-", "" + i);
|
||||
$(this).parent().parent().parent().find(".data").append(text);
|
||||
start_superselect();
|
||||
});
|
||||
</script>';
|
@ -803,14 +803,14 @@ class FatturaElettronica
|
||||
$dati['NumItem'] = $element['num_item'];
|
||||
}
|
||||
|
||||
if (!empty($element['codice_cig'])) {
|
||||
$dati['CodiceCIG'] = $element['codice_cig'];
|
||||
}
|
||||
|
||||
if (!empty($element['codice_cup'])) {
|
||||
$dati['CodiceCUP'] = $element['codice_cup'];
|
||||
}
|
||||
|
||||
if (!empty($element['codice_cig'])) {
|
||||
$dati['CodiceCIG'] = $element['codice_cig'];
|
||||
}
|
||||
|
||||
$result[] = $dati;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ switch (filter('op')) {
|
||||
'id_pagamento' => post('pagamento'),
|
||||
'id_segment' => post('id_segment'),
|
||||
'id_tipo' => post('id_tipo'),
|
||||
'data_ricezione' => post('data_ricezione'),
|
||||
'articoli' => post('articoli'),
|
||||
'iva' => post('iva'),
|
||||
'conto' => post('conto'),
|
||||
|
@ -37,7 +37,7 @@ if (!empty($list)) {
|
||||
}
|
||||
|
||||
echo '
|
||||
<button type="button" class="btn btn-warning" onclick="download(this, \''.$element.'\')">
|
||||
<button type="button" class="btn btn-warning" '.((!extension_loaded('ssl') and strpos($element, 'p7m') !== false) ? 'disabled' : '').' onclick="download(this, \''.$element.'\')">
|
||||
<i class="fa fa-download"></i> '.tr('Importa').'
|
||||
</button>
|
||||
</td>
|
||||
|
@ -37,7 +37,7 @@ echo '
|
||||
<div class="row" >
|
||||
<div class="col-md-6">
|
||||
<h4>'.
|
||||
$ragione_sociale.'<br>
|
||||
$ragione_sociale.' '.((empty($idanagrafica = $dbo->fetchOne('SELECT idanagrafica FROM an_anagrafiche WHERE ( codice_fiscale = '.prepare($codice_fiscale).' AND codice_fiscale != \'\' ) OR ( piva = '.prepare($partita_iva).' AND piva != \'\' ) ')['idanagrafica'])) ? '<span class="badge badge-success" >'.tr('Nuova').'</span>' : '<small>'.Modules::link('Anagrafiche', $idanagrafica, '', null, '')).'</small>'.'<br>
|
||||
<small>
|
||||
'.(!empty($codice_fiscale) ? (tr('Codice Fiscale').': '.$codice_fiscale.'<br>') : '').'
|
||||
'.(!empty($partita_iva) ? (tr('Partita IVA').': '.$partita_iva.'<br>') : '').'
|
||||
@ -82,6 +82,14 @@ echo '
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
// Data ricezione
|
||||
echo '
|
||||
<div class="row" >
|
||||
<div class="col-md-6">
|
||||
{[ "type": "date", "label": "'.tr('Data ricezione').'", "name": "data_ricezione", "required": 0, "value": "" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
// Blocco DatiPagamento è valorizzato (opzionale)
|
||||
$pagamenti = $fattura_pa->getBody()['DatiPagamento'];
|
||||
if (!empty($pagamenti)) {
|
||||
@ -169,17 +177,43 @@ if (!empty($righe)) {
|
||||
|
||||
$query .= ' ORDER BY descrizione ASC';
|
||||
|
||||
/*Visualizzo codici articoli*/
|
||||
$codici_articoli = '';
|
||||
|
||||
//caso di un solo codice articolo
|
||||
if (isset($riga['CodiceArticolo']) and empty($riga['CodiceArticolo'][0]['CodiceValore'])) {
|
||||
$riga['CodiceArticolo'][0]['CodiceValore'] = $riga['CodiceArticolo']['CodiceValore'];
|
||||
$riga['CodiceArticolo'][0]['CodiceTipo'] = $riga['CodiceArticolo']['CodiceTipo'];
|
||||
}
|
||||
|
||||
foreach ($riga['CodiceArticolo'] as $key => $item) {
|
||||
foreach ($item as $key => $name) {
|
||||
if ($key == 'CodiceValore') {
|
||||
if (!empty($item['CodiceValore'])) {
|
||||
$codici_articoli .= '<small>'.$item['CodiceValore'].' ('.$item['CodiceTipo'].')</small>';
|
||||
|
||||
if (($item['CodiceValore'] != end($riga['CodiceArticolo'][(count($riga['CodiceArticolo']) - 1)])) and (is_array($riga['CodiceArticolo'][1]))) {
|
||||
$codici_articoli .= ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*###*/
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
'.$riga['Descrizione'].'<br>
|
||||
|
||||
'.(($codici_articoli != '') ? $codici_articoli.'<br>' : '').'
|
||||
|
||||
<small>'.tr('Q.tà: _QTA_ _UM_', [
|
||||
'_QTA_' => Translator::numberToLocale($riga['Quantita']),
|
||||
'_UM_' => $riga['UnitaMisura'],
|
||||
]).'</small><br>
|
||||
|
||||
<small>'.tr('Aliquota IVA _VALUE_ _DESC_', [
|
||||
<small>'.tr('Aliquota IVA: _VALUE_ _DESC_', [
|
||||
'_VALUE_' => empty($riga['Natura']) ? numberFormat($riga['AliquotaIVA']).'%' : $riga['Natura'],
|
||||
'_DESC_' => $riga['RiferimentoNormativo'] ? ' - '.$riga['RiferimentoNormativo'] : '',
|
||||
]).'</small>
|
||||
|
@ -70,7 +70,7 @@ class FatturaElettronica
|
||||
$module = Modules::get('Fatture di acquisto');
|
||||
|
||||
$plugin = $module->plugins->first(function ($value, $key) {
|
||||
return $value->name = 'Fatturazione Elettronica';
|
||||
return $value->name == 'Fatturazione Elettronica';
|
||||
});
|
||||
|
||||
self::$directory = DOCROOT.'/'.$plugin->upload_directory;
|
||||
@ -266,7 +266,7 @@ class FatturaElettronica
|
||||
*
|
||||
* @return Fattura
|
||||
*/
|
||||
public function saveFattura($id_pagamento, $id_sezionale, $id_tipo)
|
||||
public function saveFattura($id_pagamento, $id_sezionale, $id_tipo, $data_ricezione)
|
||||
{
|
||||
$anagrafica = $this->saveAnagrafica();
|
||||
|
||||
@ -287,7 +287,10 @@ class FatturaElettronica
|
||||
|
||||
// Per il destinatario, la data di ricezione della fattura assume grande rilievo ai fini IVA, poiché determina la decorrenza dei termini per poter esercitare il diritto alla detrazione.
|
||||
// La data di ricezione della fattura è contenuta all’interno della “ricevuta di consegna” visibile al trasmittente della stessa.
|
||||
$fattura->data_ricezione = $dati_generali['Data'];
|
||||
if (empty($data_ricezione))
|
||||
$fattura->data_ricezione = $dati_generali['Data'];
|
||||
else
|
||||
$fattura->data_ricezione = $data_ricezione;
|
||||
|
||||
$stato_documento = StatoFattura::where('descrizione', 'Emessa')->first();
|
||||
$fattura->stato()->associate($stato_documento);
|
||||
@ -328,7 +331,7 @@ class FatturaElettronica
|
||||
|
||||
public function save($info = [])
|
||||
{
|
||||
$this->saveFattura($info['id_pagamento'], $info['id_segment'], $info['id_tipo']);
|
||||
$this->saveFattura($info['id_pagamento'], $info['id_segment'], $info['id_tipo'], $info['data_ricezione']);
|
||||
|
||||
$this->saveRighe($info['articoli'], $info['iva'], $info['conto'], $info['movimentazione']);
|
||||
|
||||
|
43
plugins/importFE/src/InvoiceHook.php
Normal file
43
plugins/importFE/src/InvoiceHook.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Plugins\ImportFE;
|
||||
|
||||
use Common\HookManager;
|
||||
use Modules;
|
||||
|
||||
class InvoiceHook extends HookManager
|
||||
{
|
||||
public function manage()
|
||||
{
|
||||
$list = Interaction::listToImport();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function response($results)
|
||||
{
|
||||
$count = count($results);
|
||||
|
||||
$module = Modules::get('Fatture di acquisto');
|
||||
$plugin = $module->plugins->first(function ($value, $key) {
|
||||
return $value->name == 'Fatturazione Elettronica';
|
||||
});
|
||||
|
||||
$link = ROOTDIR.'/controller.php?id_module='.$module->id.'#tab_'.$plugin->id;
|
||||
|
||||
if ($count>0){
|
||||
$message = tr('Ci sono _NUM_ fatture passive da importare', [
|
||||
'_NUM_' => $count,
|
||||
]);
|
||||
}else{
|
||||
$message = tr('Nessuna fattura passiva da importare');
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => 'fa fa-file-text-o',
|
||||
'link' => $link,
|
||||
'message' => $message,
|
||||
'notify' => !empty($count),
|
||||
];
|
||||
}
|
||||
}
|
@ -6,22 +6,6 @@ use Plugins\ReceiptFE\Interaction;
|
||||
use Plugins\ReceiptFE\Ricevuta;
|
||||
|
||||
switch (filter('op')) {
|
||||
case 'save':
|
||||
$content = file_get_contents($_FILES['blob']['tmp_name']);
|
||||
$file = FatturaElettronica::store($_FILES['blob']['name'], $content);
|
||||
|
||||
if (FatturaElettronica::isValid($file)) {
|
||||
echo json_encode([
|
||||
'filename' => $file,
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'already' => 1,
|
||||
]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'import':
|
||||
$list = Interaction::getReceiptList();
|
||||
|
||||
|
44
plugins/receiptFE/src/ReceiptHook.php
Normal file
44
plugins/receiptFE/src/ReceiptHook.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Plugins\ReceiptFE;
|
||||
|
||||
use Common\HookManager;
|
||||
use Modules;
|
||||
|
||||
class ReceiptHook extends HookManager
|
||||
{
|
||||
public function manage()
|
||||
{
|
||||
$list = Interaction::getReceiptList();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function response($results)
|
||||
{
|
||||
$count = count($results);
|
||||
|
||||
$module = Modules::get('Fatture di vendita');
|
||||
$plugin = $module->plugins->first(function ($value, $key) {
|
||||
return $value->name == 'Ricevute FE';
|
||||
});
|
||||
|
||||
$link = ROOTDIR.'/controller.php?id_module='.$module->id.'#tab_'.$plugin->id;
|
||||
|
||||
if ($count>0){
|
||||
$message = tr('Ci sono _NUM_ ricevute da importare', [
|
||||
'_NUM_' => $count,
|
||||
]);
|
||||
}else{
|
||||
$message = tr('Nessuna ricevuta da importare');
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => 'fa fa-ticket',
|
||||
'link' => $link,
|
||||
'message' => $message,
|
||||
'notify' => !empty($count),
|
||||
];
|
||||
|
||||
}
|
||||
}
|
@ -41,3 +41,11 @@ echo '
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
?>
|
||||
<script>
|
||||
$(document).ready( function(){
|
||||
$(document).load("ajax_complete.php?op=get_mansioni", function(response){
|
||||
$("#mansione").autocomplete({source: response.split("|")});
|
||||
} );
|
||||
});
|
||||
</script>
|
@ -47,3 +47,11 @@ echo '
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
?>
|
||||
<script>
|
||||
$(document).ready( function(){
|
||||
$(document).load("ajax_complete.php?op=get_mansioni", function(response){
|
||||
$("#mansione").autocomplete({source: response.split("|")});
|
||||
} );
|
||||
});
|
||||
</script>
|
@ -452,7 +452,7 @@ class Database extends Util\Singleton
|
||||
if (!empty($order)) {
|
||||
foreach ((array) $order as $key => $value) {
|
||||
$order = is_numeric($key) ? 'ASC' : strtoupper($value);
|
||||
$field = is_numeric($key) ? $value : key;
|
||||
$field = is_numeric($key) ? $value : $key;
|
||||
|
||||
if ($order == 'ASC') {
|
||||
$statement = $statement->orderBy($field);
|
||||
|
84
src/Models/Hook.php
Normal file
84
src/Models/Hook.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterval;
|
||||
use Common\Model;
|
||||
use Traits\StoreTrait;
|
||||
|
||||
class Hook extends Model
|
||||
{
|
||||
use StoreTrait;
|
||||
|
||||
protected $table = 'zz_hooks';
|
||||
|
||||
protected $cached = null;
|
||||
protected $use_cached = null;
|
||||
|
||||
public function getIsCachedAttribute()
|
||||
{
|
||||
if (!isset($this->use_cached)) {
|
||||
$cache = $this->cache;
|
||||
|
||||
$use_cached = false;
|
||||
if (!empty($cache)) {
|
||||
$date = new Carbon($cache['created_at']);
|
||||
$interval = CarbonInterval::make($this->frequency);
|
||||
|
||||
$date = $date->add($interval);
|
||||
|
||||
$now = new Carbon();
|
||||
$use_cached = $date->greaterThan($now);
|
||||
}
|
||||
|
||||
$this->use_cached = $use_cached;
|
||||
}
|
||||
|
||||
return $this->use_cached;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$class = $this->class;
|
||||
$hook = new $class();
|
||||
|
||||
if ($this->is_cached) {
|
||||
$results = $this->cache['results'];
|
||||
|
||||
// Interpretazione della cache
|
||||
$results = json_decode($results, true);
|
||||
} else {
|
||||
$results = $hook->manage();
|
||||
|
||||
// Rimozione cache precedente
|
||||
$database = database();
|
||||
$database->delete('zz_hook_cache', [
|
||||
'hook_id' => $this->id,
|
||||
]);
|
||||
|
||||
// Aggiunta del risultato come cache
|
||||
$cache = json_encode($results);
|
||||
$database->insert('zz_hook_cache', [
|
||||
'hook_id' => $this->id,
|
||||
'results' => $cache,
|
||||
]);
|
||||
|
||||
$this->cached = null;
|
||||
$this->getCacheAttribute();
|
||||
}
|
||||
|
||||
return $hook->response($results);
|
||||
}
|
||||
|
||||
public function getCacheAttribute()
|
||||
{
|
||||
if (!isset($this->cached)) {
|
||||
$cache = database()->selectOne('zz_hook_cache', '*', ['hook_id' => $this->id], ['id' => 'DESC']);
|
||||
|
||||
$this->cached = $cache;
|
||||
}
|
||||
|
||||
return $this->cached;
|
||||
}
|
||||
}
|
@ -77,7 +77,8 @@ echo '
|
||||
<td colspan=2 class="border-full"'.(!$fattura_accompagnatoria ? ' style="height:20mm;"' : '').'>
|
||||
<p class="small-bold">'.tr('Spett.le', [], ['upper' => true]).'</p>
|
||||
<p>$c_ragionesociale$</p>
|
||||
<p>$c_indirizzo$<br>$c_citta_full$</p>
|
||||
<p>'.(!empty($c_indirizzo) ? $c_indirizzo : '').(!empty($c_citta_full) ? '<br>'.$c_citta_full : '').'</p>
|
||||
<small>'.(!empty($c_codice_destinatario) ? tr('Cod.Fatturazione').': '.$c_codice_destinatario : '').'</small>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -22,6 +22,7 @@ foreach ($prefixes as $prefix) {
|
||||
$replaces[$prefix.'codicefiscale'] = '';
|
||||
}
|
||||
|
||||
$replaces[$prefix.'codice_destinatario'] = !empty($replaces[$prefix.'codice_destinatario']) ? 'Cod.Fatturazione: '.$replaces[$prefix.'codice_destinatario'] : '';
|
||||
$replaces[$prefix.'capsoc'] = !empty($replaces[$prefix.'capsoc']) ? 'Cap.Soc.: '.$replaces[$prefix.'capsoc'] : '';
|
||||
$replaces[$prefix.'sitoweb'] = !empty($replaces[$prefix.'sitoweb']) ? 'Web: '.$replaces[$prefix.'sitoweb'] : '';
|
||||
$replaces[$prefix.'telefono'] = !empty($replaces[$prefix.'telefono']) ? 'Tel: '.$replaces[$prefix.'telefono'] : '';
|
||||
|
@ -7,7 +7,7 @@ include_once DOCROOT.'/modules/interventi/modutil.php';
|
||||
$id_iva = setting('Iva predefinita');
|
||||
$iva = $dbo->fetchOne('SELECT * FROM co_iva WHERE id='.prepare($id_iva));
|
||||
|
||||
$interventi = $dbo->fetchArray('SELECT * FROM in_interventi WHERE sconto_globale != 0');
|
||||
$interventi = $dbo->fetchArray('SELECT * FROM in_interventi WHERE sconto_globale != 0 AND sconto_globale != NULL');
|
||||
foreach ($interventi as $intervento) {
|
||||
$costi = get_costi_intervento($intervento['id']);
|
||||
$sconto_globale = $costi['sconto_globale'];
|
||||
|
@ -111,7 +111,7 @@ INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`,
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stati dei contratti'), 'Descrizione', 'descrizione', 2, 1, 0, 0, 1),
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stati dei contratti'), 'id', 'id', 1, 0, 0, 1, 0);
|
||||
|
||||
-- Aggiornamento sconti incodizionati
|
||||
-- Aggiornamento sconti incondizionati
|
||||
ALTER TABLE `co_documenti` DROP `sconto_globale`, DROP `tipo_sconto_globale`;
|
||||
ALTER TABLE `co_preventivi` DROP `sconto_globale`, DROP `tipo_sconto_globale`;
|
||||
ALTER TABLE `co_contratti` DROP `sconto_globale`, DROP `tipo_sconto_globale`;
|
||||
@ -253,8 +253,10 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
|
||||
ALTER TABLE `zz_settings` CHANGE `help` `help` varchar(255);
|
||||
UPDATE `zz_settings` SET `help` = NULL WHERE `help` = '';
|
||||
|
||||
ALTER TABLE `co_documenti` CHANGE `data_stato_fe` `data_stato_fe` TIMESTAMP NULL, ADD `addebita_bollo` BOOLEAN NOT NULL DEFAULT TRUE, ADD `id_riga_bollo` int(11), ADD FOREIGN KEY (`id_riga_bollo`) REFERENCES `co_righe_documenti`(`id`) ON DELETE SET NULL;
|
||||
UPDATE `co_documenti` SET `data_ricezione` = NULL WHERE `data_ricezione` = '0000-00-00';
|
||||
ALTER TABLE `co_documenti` CHANGE `bollo` `bollo` decimal(12,4), CHANGE `data_stato_fe` `data_stato_fe` TIMESTAMP NULL, ADD `addebita_bollo` BOOLEAN NOT NULL DEFAULT TRUE, ADD `id_riga_bollo` int(11), ADD FOREIGN KEY (`id_riga_bollo`) REFERENCES `co_righe_documenti`(`id`) ON DELETE SET NULL;
|
||||
UPDATE `co_documenti` SET `bollo` = NULL;
|
||||
UPDATE `co_documenti` SET `data_ricezione` = NULL WHERE `data_ricezione` = 0000-00-00;
|
||||
UPDATE `co_documenti` SET `data_ricezione` = `data` WHERE `data_ricezione` IS NULL AND idtipodocumento IN (SELECT id FROM co_tipidocumento WHERE dir = 'uscita');
|
||||
UPDATE `co_documenti` SET `data_stato_fe` = NULL WHERE `data_stato_fe` = '0000-00-00 00:00:00';
|
||||
|
||||
-- Rimozione tasto di stampa scadenzario totale da dentro la scadenza
|
||||
@ -283,7 +285,7 @@ INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `
|
||||
-- Aggiunta vista ore rimanenti nei contratti
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`="Contratti"), 'Ore rimanenti', '( (SELECT SUM(co_righe_contratti.qta) FROM co_righe_contratti WHERE co_righe_contratti.um=''ore'' AND co_righe_contratti.idcontratto=co_contratti.id) - IFNULL( (SELECT SUM(in_interventi_tecnici.ore) FROM in_interventi_tecnici INNER JOIN in_interventi ON in_interventi_tecnici.idintervento=in_interventi.id WHERE in_interventi.id_contratto=co_contratti.id ), 0) )', '5', '1', '0', '1', '', '', '0', '0', '0');
|
||||
|
||||
-- inserimento stato intervento da programmare
|
||||
-- Inserimento stato intervento da programmare
|
||||
INSERT INTO `in_statiintervento` (`idstatointervento`, `descrizione`, `colore`, `can_delete`, `completato`, `created_at`, `notifica`, `id_email`, `destinatari`) VALUES ('DAP', 'Da programmare', '#2deded', '1', '0', NULL, '0', NULL, NULL);
|
||||
|
||||
-- Widget attività in programmazione
|
||||
@ -304,3 +306,73 @@ INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`
|
||||
|
||||
-- Aggiunta vista con data conclusione e flag rinnovabile nei contratti
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Contratti'), 'Rinnovabile', 'IF(`co_contratti`.`rinnovabile`=1, \'SI\', \'NO\')', '6', '1', '0', '1', '', '', '0', '0', '0'), (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Contratti'), 'Data conclusione', 'IF(data_conclusione=0, \'\', data_conclusione)', '7', '1', '0', '1', '', '', '0', '0', '0');
|
||||
|
||||
-- Aggiunta visualizzazione importo totale negli ordini
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM ((`or_ordini` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`) INNER JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`) LEFT OUTER JOIN `or_righe_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine` WHERE 1=1 AND `dir` = \'entrata\' |date_period(`data`)| GROUP BY or_ordini.id HAVING 2=2 ORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`name` = 'Ordini cliente';
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM ((`or_ordini` INNER JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`) INNER JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`) LEFT OUTER JOIN `or_righe_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine` WHERE 1=1 AND `dir` = \'uscita\' |date_period(`data`)| GROUP BY or_ordini.id HAVING 2=2 ORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC' WHERE `zz_modules`.`name` = 'Ordini fornitore';
|
||||
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ordini cliente'), 'Totale', 'SUM(`subtotale` - `sconto`)', '5', '1', '0', '1', '', '', '1', '1', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ordini fornitore'), 'Totale', 'SUM(`subtotale` - `sconto`)', '5', '1', '0', '1', '', '', '1', '1', '0');
|
||||
|
||||
UPDATE `zz_views` SET `query` = '`an_anagrafiche`.`ragione_sociale`' WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ordini cliente', 'Ordini fornitore')) AND `name` = 'Ragione sociale';
|
||||
|
||||
-- Riordinamento campi degli ordini cliente e fornitore
|
||||
UPDATE `zz_views` SET `order` = 3 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ordini cliente', 'Ordini fornitore')) AND `name` = 'Data';
|
||||
UPDATE `zz_views` SET `order` = 4 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ordini cliente', 'Ordini fornitore')) AND `name` = 'Ragione sociale';
|
||||
UPDATE `zz_views` SET `order` = 6 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ordini cliente', 'Ordini fornitore')) AND `name` = 'icon_Stato';
|
||||
UPDATE `zz_views` SET `order` = 7 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ordini cliente', 'Ordini fornitore')) AND `name` = 'icon_title_Stato';
|
||||
|
||||
-- Aggiunta visualizzazione nuovi campi utili nei ddt
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM ((((((`dt_ddt` INNER JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id`) LEFT OUTER JOIN `dt_righe_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt`) LEFT OUTER JOIN `dt_causalet` ON `dt_ddt`.`idcausalet` = `dt_causalet`.`id`) LEFT OUTER JOIN `dt_spedizione` ON `dt_ddt`.`idspedizione` = `dt_spedizione`.`id`) LEFT OUTER JOIN `an_anagrafiche` `vettori` ON `dt_ddt`.`idvettore` = `vettori`.`idanagrafica`) LEFT OUTER JOIN `an_anagrafiche` AS `destinatari` ON `dt_ddt`.`idanagrafica` = `destinatari`.`idanagrafica`) LEFT OUTER JOIN `an_sedi` ON `dt_ddt`.`idsede` = `an_sedi`.`id` WHERE 1=1 AND `dir` = \'entrata\' |date_period(`data`)| GROUP BY dt_ddt.id HAVING 2=2 ORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC,`dt_ddt`.created_at DESC' WHERE `zz_modules`.`name` = 'Ddt di vendita';
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM ((((((`dt_ddt` INNER JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id`) LEFT OUTER JOIN `dt_righe_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt`) LEFT OUTER JOIN `dt_causalet` ON `dt_ddt`.`idcausalet` = `dt_causalet`.`id`) LEFT OUTER JOIN `dt_spedizione` ON `dt_ddt`.`idspedizione` = `dt_spedizione`.`id`) LEFT OUTER JOIN `an_anagrafiche` `vettori` ON `dt_ddt`.`idvettore` = `vettori`.`idanagrafica`) LEFT OUTER JOIN `an_anagrafiche` AS `destinatari` ON `dt_ddt`.`idanagrafica` = `destinatari`.`idanagrafica`) LEFT OUTER JOIN `an_sedi` ON `dt_ddt`.`idsede` = `an_sedi`.`id` WHERE 1=1 AND `dir` = \'uscita\' |date_period(`data`)| GROUP BY dt_ddt.id HAVING 2=2 ORDER BY `data` DESC, CAST(`numero_esterno` AS UNSIGNED) DESC,`dt_ddt`.created_at DESC' WHERE `zz_modules`.`name` = 'Ddt di acquisto';
|
||||
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Sede', 'IF(`dt_ddt`.`idsede`=0, \'Sede legale\', `an_sedi`.`nomesede`)', '5', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Causale', '`dt_causalet`.`descrizione`', '6', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Tipo spedizione', '`dt_spedizione`.`descrizione`', '7', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Vettore', '`vettori`.`ragione_sociale`', '8', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di vendita'), 'Totale', 'SUM(`subtotale` - `sconto`)', '9', '1', '0', '1', '', '', '1', '1', '0');
|
||||
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), 'Sede', 'IF(`dt_ddt`.`idsede`=0, \'Sede legale\', `an_sedi`.`nomesede`)', '5', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), 'Causale', '`dt_causalet`.`descrizione`', '6', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), 'Tipo spedizione', '`dt_spedizione`.`descrizione`', '7', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), 'Vettore', '`vettori`.`ragione_sociale`', '8', '1', '0', '1', '', '', '1', '0', '0');
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), 'Totale', 'SUM(`subtotale` - `sconto`)', '9', '1', '0', '1', '', '', '1', '1', '0');
|
||||
|
||||
UPDATE `zz_views` SET `query` = '`destinatari`.`ragione_sociale`' WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ddt di vendita', 'Ddt di acquisto')) AND `name` = 'Ragione sociale';
|
||||
|
||||
-- Riordinamento campi dei ddt in ingresso e uscita
|
||||
UPDATE `zz_views` SET `order` = 10 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ddt di vendita', 'Ddt di acquisto')) AND `name` = 'icon_Stato';
|
||||
UPDATE `zz_views` SET `order` = 11 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ddt di vendita', 'Ddt di acquisto')) AND `name` = 'icon_title_Stato';
|
||||
UPDATE `zz_views` SET `order` = 12 WHERE `id_module` IN (SELECT `id` FROM `zz_modules` WHERE `name` IN('Ddt di vendita', 'Ddt di acquisto')) AND `name` = 'dir';
|
||||
|
||||
-- Aggiornamento widget "Fatturato" (iva esclusa)
|
||||
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS('' '', REPLACE(REPLACE(REPLACE(FORMAT((SELECT SUM(subtotale-sconto-co_righe_documenti.ritenutaacconto)), 2), '','', ''#''), ''.'', '',''), ''#'', ''.''), ''€'') AS dato FROM (co_righe_documenti INNER JOIN co_documenti ON co_righe_documenti.iddocumento=co_documenti.id) INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_tipidocumento.dir=''entrata'' |segment| AND data >= ''|period_start|'' AND data <= ''|period_end|'' AND 1=1', `help` = 'Fatturato IVA esclusa.' WHERE `zz_widgets`.`name` = 'Fatturato';
|
||||
|
||||
-- Aggiornamento widget "Acquisti" (iva esclusa)
|
||||
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS('' '', REPLACE(REPLACE(REPLACE(FORMAT((SELECT SUM(subtotale-sconto-co_righe_documenti.ritenutaacconto)), 2), '','', ''#''), ''.'', '',''), ''#'', ''.''), ''€'') AS dato FROM (co_righe_documenti INNER JOIN co_documenti ON co_righe_documenti.iddocumento=co_documenti.id) INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_tipidocumento.dir=''uscita'' |segment| AND data >= ''|period_start|'' AND data <= ''|period_end|'' AND 1=1', `help` = 'Fatturato IVA esclusa.' WHERE `zz_widgets`.`name` = 'Acquisti';
|
||||
|
||||
-- Sistema Hook
|
||||
CREATE TABLE IF NOT EXISTS `zz_hooks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`class` varchar(255) NOT NULL,
|
||||
`frequency` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `zz_hook_cache` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`hook_id` int(11) NOT NULL,
|
||||
`results` TEXT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`hook_id`) REFERENCES `zz_hooks`(`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO `zz_hooks` (`id`, `name`, `class`, `frequency`) VALUES
|
||||
(NULL, 'Ricevute', 'Plugins\\ReceiptFE\\ReceiptHook', '1 day'),
|
||||
(NULL, 'Fatture', 'Plugins\\ImportFE\\InvoiceHook', '1 day');
|
||||
|
||||
-- Aggiunte variabili di sistema per stampa riepilogo interventi
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Interventi'), 'richiesta', 'richiesta', '14', '1', '0', '0', '', '', '0', '0', '1');
|
||||
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Interventi'), 'descrizione', 'descrizione', '15', '1', '0', '0', '', '', '0', '0', '1');
|
||||
|
@ -92,6 +92,8 @@ return [
|
||||
'zz_groups',
|
||||
'zz_group_module',
|
||||
'zz_group_view',
|
||||
'zz_hooks',
|
||||
'zz_hook_cache',
|
||||
'zz_logs',
|
||||
'zz_modules',
|
||||
'zz_operations',
|
||||
|
Loading…
x
Reference in New Issue
Block a user