mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 06:47:40 +01:00
Merge branch 'master' into revisione-banche
This commit is contained in:
commit
3fffde3d07
@ -1040,3 +1040,22 @@ div.tip {
|
||||
.skin-default .nav.navbar-nav li a:hover {
|
||||
background: #222222;
|
||||
}
|
||||
|
||||
/* Loading specificato per un div */
|
||||
.local-loader {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0
|
||||
}
|
||||
|
||||
.local-loader > div {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
z-index: 2;
|
||||
opacity: 0.5;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.div-loading {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
70
assets/src/js/functions/loaders.js
Normal file
70
assets/src/js/functions/loaders.js
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||
* Copyright (C) DevCode s.n.c.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Funzione per gestire il loader locale per uno specifico DIV.
|
||||
*
|
||||
* @param div Identificatore JS dell'elemento
|
||||
* @param show
|
||||
*/
|
||||
function localLoading(div, show) {
|
||||
let container = $(div);
|
||||
|
||||
// Ricerca del loader esistente
|
||||
let loader = container.find(".panel-loading");
|
||||
|
||||
// Aggiunta del loader in caso di assenza
|
||||
if (!loader.length) {
|
||||
let html = `<div class="text-center hidden local-loader">
|
||||
<div class="local-loader-content">
|
||||
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
|
||||
<span class="sr-only">
|
||||
` + globals.translations.loading + `
|
||||
</span>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
container.prepend(html);
|
||||
loader = container.find(".local-loader");
|
||||
}
|
||||
|
||||
// Visualizzazione del loader
|
||||
if (show) {
|
||||
loader.removeClass("hidden");
|
||||
container.addClass("div-loading");
|
||||
}
|
||||
// Rimozione del loader
|
||||
else {
|
||||
loader.addClass("hidden");
|
||||
container.removeClass("div-loading");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione per gestire la visualizzazione del loader generale del gestionale.
|
||||
* @param show
|
||||
*/
|
||||
function mainLoader(show) {
|
||||
let loader = $("#main_loading");
|
||||
|
||||
if (show) {
|
||||
loader.show();
|
||||
} else {
|
||||
loader.fadeOut();
|
||||
}
|
||||
}
|
@ -183,8 +183,6 @@ abstract class Description extends Model
|
||||
// Attributi dell'oggetto da copiare
|
||||
$attributes = $this->getAttributes();
|
||||
unset($attributes['id']);
|
||||
unset($attributes['original_id']);
|
||||
unset($attributes['original_type']);
|
||||
unset($attributes['order']);
|
||||
|
||||
if ($qta !== null) {
|
||||
@ -202,9 +200,19 @@ abstract class Description extends Model
|
||||
// Riferimento di origine per l'evasione automatica della riga
|
||||
$is_evasione = true;
|
||||
if ($is_evasione) {
|
||||
$model->original_id = $this->id;
|
||||
$model->original_type = $current;
|
||||
// Mantenimento dell'origine della riga precedente
|
||||
$model->original_id = $attributes['original_id'];
|
||||
$model->original_type = $attributes['original_type'];
|
||||
|
||||
// Aggiornamento dei riferimenti
|
||||
list($riferimento_precedente, $nuovo_riferimento) = $model->impostaOrigine($current, $this->id);
|
||||
|
||||
// Correzione della descrizione
|
||||
$attributes['descrizione'] = str_replace($riferimento_precedente, '', $attributes['descrizione']);
|
||||
$attributes['descrizione'] .= $nuovo_riferimento;
|
||||
}
|
||||
unset($attributes['original_id']);
|
||||
unset($attributes['original_type']);
|
||||
|
||||
// Impostazione del genitore
|
||||
$model->setParent($document);
|
||||
@ -232,6 +240,36 @@ abstract class Description extends Model
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta l'origine dell'elemento, restituendo un array contenente i replace da effettuare per modificare la descrizione in modo coerente.
|
||||
*
|
||||
* @param $type
|
||||
* @param $id
|
||||
*/
|
||||
public function impostaOrigine($type, $id)
|
||||
{
|
||||
$riferimento_precedente = null;
|
||||
$nuovo_riferimento = null;
|
||||
|
||||
// Rimozione del riferimento precedente dalla descrizione
|
||||
if ($this->hasOriginal()) {
|
||||
$riferimento = $this->getOriginal()->parent->getReference();
|
||||
$riferimento_precedente = "\nRif. ".strtolower($riferimento);
|
||||
}
|
||||
|
||||
$this->original_id = $id;
|
||||
$this->original_type = $type;
|
||||
|
||||
// Aggiunta del riferimento nella descrizione
|
||||
$origine = $type::find($id);
|
||||
if (!empty($origine)) {
|
||||
$riferimento = $origine->parent->getReference();
|
||||
$nuovo_riferimento = "\nRif. ".strtolower($riferimento);
|
||||
}
|
||||
|
||||
return [$riferimento_precedente, $nuovo_riferimento];
|
||||
}
|
||||
|
||||
abstract public function parent();
|
||||
|
||||
abstract public function getParentID();
|
||||
|
@ -104,6 +104,7 @@ if (Auth::check()) {
|
||||
'filter' => tr('Filtra'),
|
||||
'long' => tr('La ricerca potrebbe richiedere del tempo'),
|
||||
'details' => tr('Dettagli'),
|
||||
'loading' => tr('Caricamento'),
|
||||
'waiting' => tr('Impossibile procedere'),
|
||||
'waiting_msg' => tr('Prima di proseguire devi selezionare alcuni elementi!'),
|
||||
'hooksExecuting' => tr('Hooks in esecuzione'),
|
||||
|
@ -156,7 +156,7 @@ function reference($document, $text = null)
|
||||
$content = $document->getReference();
|
||||
}
|
||||
|
||||
$description = tr('Rif. _DOCUMENT_', [
|
||||
$description = $text ?: tr('Rif. _DOCUMENT_', [
|
||||
'_DOCUMENT_' => strtolower($content),
|
||||
]);
|
||||
|
||||
|
6493
locale/catalog.pot
6493
locale/catalog.pot
File diff suppressed because it is too large
Load Diff
BIN
locale/de_DE/de_DE.mo
Normal file
BIN
locale/de_DE/de_DE.mo
Normal file
Binary file not shown.
10668
locale/de_DE/de_DE.po
Normal file
10668
locale/de_DE/de_DE.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -168,6 +168,8 @@ class CSV extends CSVImporter
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($record['categoria']);
|
||||
unset($record['sottocategoria']);
|
||||
|
||||
// Individuazione dell'IVA di vendita tramite il relativo Codice
|
||||
$aliquota = null;
|
||||
|
@ -117,7 +117,7 @@ $operations['crea_fattura'] = [
|
||||
'text' => tr('Fattura documenti'),
|
||||
'data' => [
|
||||
'title' => tr('Vuoi davvero fatturare questi documenti?'),
|
||||
'msg' => '{[ "type": "checkbox", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
|
||||
'msg' => '{[ "type": "checkbox", "label": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
'blank' => false,
|
||||
|
@ -348,13 +348,8 @@ echo '
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
|
||||
include $structure->filepath('row-list.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -395,6 +390,23 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
caricaRighe();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#data_accettazione").on("dp.change", function() {
|
||||
if($(this).val()){
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
@ -38,12 +38,23 @@ echo '
|
||||
|
||||
// Righe documento
|
||||
$righe = $contratto->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'">
|
||||
<td class="text-center">
|
||||
'.($key + 1).'
|
||||
</td>';
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginal()->parent, tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
// Descrizione
|
||||
$descrizione = nl2br($riga->descrizione);
|
||||
@ -52,7 +63,6 @@ foreach ($righe as $key => $riga) {
|
||||
}
|
||||
|
||||
echo '
|
||||
<td>
|
||||
'.$descrizione.'
|
||||
</td>';
|
||||
|
||||
|
@ -190,34 +190,52 @@ switch (filter('op')) {
|
||||
}
|
||||
|
||||
// Righe inserite
|
||||
$qp = "SELECT
|
||||
$query_promemoria_contratti = "SELECT
|
||||
co_promemoria.id,
|
||||
idcontratto,
|
||||
richiesta,co_contratti.nome AS nomecontratto,
|
||||
richiesta,
|
||||
co_contratti.nome AS nome_contratto,
|
||||
DATE_FORMAT( data_richiesta, '%m%Y') AS mese,
|
||||
data_richiesta,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
'promemoria' AS ref,
|
||||
(SELECT descrizione FROM in_tipiintervento WHERE idtipointervento = co_promemoria.idtipointervento) AS tipointervento
|
||||
(SELECT descrizione FROM in_tipiintervento WHERE idtipointervento = co_promemoria.idtipointervento) AS tipo_intervento
|
||||
FROM co_promemoria
|
||||
INNER JOIN co_contratti ON co_promemoria.idcontratto = co_contratti.id
|
||||
INNER JOIN an_anagrafiche ON co_contratti.idanagrafica = an_anagrafiche.idanagrafica
|
||||
WHERE idintervento IS NULL AND
|
||||
idcontratto IN (SELECT id FROM co_contratti WHERE idstato IN(SELECT id FROM co_staticontratti WHERE is_pianificabile = 1))
|
||||
ORDER BY data_richiesta ASC";
|
||||
$promemoria_contratti = $dbo->fetchArray($qp);
|
||||
$promemoria_contratti = $dbo->fetchArray($query_promemoria_contratti);
|
||||
|
||||
$query_interventi = "SELECT id, richiesta, id_contratto AS idcontratto, DATE_FORMAT(IF(data_scadenza IS NULL, data_richiesta, data_scadenza),'%m%Y') AS mese, IF(data_scadenza IS NULL, data_richiesta, data_scadenza)AS 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
|
||||
$query_interventi = "SELECT in_interventi.id,
|
||||
in_interventi.richiesta,
|
||||
in_interventi.id_contratto AS idcontratto,
|
||||
in_interventi_tecnici_assegnati.id_tecnico AS id_tecnico,
|
||||
tecnico.ragione_sociale AS ragione_sociale_tecnico,
|
||||
DATE_FORMAT(IF(in_interventi.data_scadenza IS NULL, in_interventi.data_richiesta, in_interventi.data_scadenza), '%m%Y') AS mese,
|
||||
IF(in_interventi.data_scadenza IS NULL, in_interventi.data_richiesta, in_interventi.data_scadenza) AS data_richiesta,
|
||||
in_interventi.data_scadenza,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
'intervento' AS ref,
|
||||
(SELECT descrizione FROM in_tipiintervento WHERE in_tipiintervento.idtipointervento=in_interventi.idtipointervento) AS tipo_intervento
|
||||
FROM in_interventi
|
||||
INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica";
|
||||
|
||||
if (!empty($id_tecnico) && !empty($solo_promemoria_assegnati)) {
|
||||
$query_interventi .= '
|
||||
INNER JOIN in_interventi_tecnici_assegnati ON in_interventi.id = in_interventi_tecnici_assegnati.id_intervento AND id_tecnico = '.prepare($id_tecnico);
|
||||
} elseif ($user->is_admin) {
|
||||
$query_interventi .= '
|
||||
INNER JOIN in_interventi_tecnici_assegnati ON in_interventi.id = in_interventi_tecnici_assegnati.id_intervento';
|
||||
}
|
||||
|
||||
$query_interventi .= '
|
||||
WHERE (SELECT COUNT(*) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento = in_interventi.id) = 0 ORDER BY data_richiesta ASC';
|
||||
LEFT JOIN in_interventi_tecnici ON in_interventi_tecnici.idintervento = in_interventi.id AND in_interventi_tecnici_assegnati.id_tecnico = in_interventi_tecnici.idtecnico
|
||||
LEFT JOIN an_anagrafiche AS tecnico ON in_interventi_tecnici_assegnati.id_tecnico = tecnico.idanagrafica
|
||||
GROUP BY in_interventi.id, in_interventi_tecnici_assegnati.id_tecnico
|
||||
HAVING COUNT(in_interventi_tecnici.id) = 0
|
||||
ORDER BY data_richiesta ASC';
|
||||
$promemoria_interventi = $dbo->fetchArray($query_interventi);
|
||||
|
||||
$promemoria = array_merge($promemoria_contratti, $promemoria_interventi);
|
||||
@ -233,12 +251,24 @@ switch (filter('op')) {
|
||||
$class = 'primary';
|
||||
}
|
||||
|
||||
$link = null;
|
||||
if ($sessione['ref'] == 'intervento') {
|
||||
$modulo_riferimento = 'Interventi';
|
||||
$id_riferimento = $sessione['id'];
|
||||
} else {
|
||||
$modulo_riferimento = 'Contratti';
|
||||
$id_riferimento = $sessione['idcontratto'];
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="fc-event fc-event-'.$class.'" data-id="'.$sessione['id'].'" data-idcontratto="'.$sessione['idcontratto'].'" data-ref="'.$sessione['ref'].'">'.(($sessione['ref'] == 'intervento') ? '<i class=\'fa fa-wrench pull-right\'></i>' : '<i class=\'fa fa-file-text-o pull-right\'></i>').'
|
||||
<b>'.$sessione['ragione_sociale'].'</b><br>'.Translator::dateToLocale($sessione['data_richiesta']).' ('.$sessione['tipointervento'].')<div class="request" >'.(!empty($sessione['richiesta']) ? ' - '.$sessione['richiesta'] : '').'</div>'.(!empty($sessione['nomecontratto']) ? '<br><b>Contratto:</b> '.$sessione['nomecontratto'] : '').
|
||||
(!empty($sessione['data_scadenza'] and $sessione['data_scadenza'] != '0000-00-00 00:00:00') ? '<br><small>'.tr('entro il: ').Translator::dateToLocale($sessione['data_scadenza']).'</small>' : '').
|
||||
(($sessione['ref'] == 'intervento') ? (Modules::link('Interventi', $sessione['id'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-'.$class.' btn-xs pull-right"')).'<br>' : (Modules::link('Contratti', $sessione['idcontratto'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-'.$class.' btn-xs pull-right"')).'<br>').
|
||||
'</div>';
|
||||
<div class="fc-event fc-event-'.$class.'" data-id="'.$sessione['id'].'" data-idcontratto="'.$sessione['idcontratto'].'" data-ref="'.$sessione['ref'].'" data-id_tecnico="'.$sessione['id_tecnico'].'">'.($sessione['ref'] == 'intervento' ? '<i class="fa fa-wrench pull-right"></i>' : '<i class="fa fa-file-text-o pull-right"></i>').'
|
||||
<b>'.$sessione['ragione_sociale'].''.(!empty($sessione['id_tecnico']) ? ' - '.tr('Tecnico').': '.$sessione['ragione_sociale_tecnico'] : '').'</b>
|
||||
<br>'.dateFormat($sessione['data_richiesta']).' ('.$sessione['tipo_intervento'].')
|
||||
<div class="request">'.(!empty($sessione['richiesta']) ? ' - '.$sessione['richiesta'] : '').'</div>
|
||||
'.(!empty($sessione['nome_contratto']) ? '<br><b>Contratto:</b> '.$sessione['nome_contratto'] : '').'
|
||||
'.(!empty($sessione['data_scadenza'] && $sessione['data_scadenza'] != '0000-00-00 00:00:00') ? '<br><small>'.tr('entro il: ').dateFormat($sessione['data_scadenza']).'</small>' : '').'
|
||||
'.Modules::link($modulo_riferimento, $id_riferimento, '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-'.$class.' btn-xs pull-right"').'<br>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ echo '
|
||||
name = "id_intervento";
|
||||
}
|
||||
|
||||
openModal(globals.dashboard.drop.title, globals.dashboard.drop.url + "&data=" + data + "&orario_inizio=" + ora_dal + "&orario_fine=" + ora_al + "&ref=dashboard&idcontratto=" + $(this).data("idcontratto") + "&" + name + "=" + $(this).data("id"));
|
||||
openModal(globals.dashboard.drop.title, globals.dashboard.drop.url + "&data=" + data + "&orario_inizio=" + ora_dal + "&orario_fine=" + ora_al + "&ref=dashboard&idcontratto=" + $(this).data("idcontratto") + "&" + name + "=" + $(this).data("id") + "&id_tecnico=" + $(this).data("id_tecnico"));
|
||||
|
||||
// Ricaricamento dei dati alla chiusura del modal
|
||||
$(this).remove();
|
||||
|
@ -100,6 +100,8 @@ switch (post('op')) {
|
||||
$qta = $riga->qta_rimanente;
|
||||
|
||||
if ($qta > 0) {
|
||||
//Fix per idconto righe fattura
|
||||
$riga->idconto = $fattura->idconto;
|
||||
$copia = $riga->copiaIn($fattura, $qta);
|
||||
|
||||
// Aggiornamento seriali dalla riga dell'ordine
|
||||
@ -144,7 +146,7 @@ $operations['crea_fattura'] = [
|
||||
'text' => tr('Fattura documenti'),
|
||||
'data' => [
|
||||
'title' => tr('Vuoi davvero fatturare questi documenti?'),
|
||||
'msg' => '<br>{[ "type": "checkbox", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}
|
||||
'msg' => '{[ "type": "checkbox", "label": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}
|
||||
<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
|
@ -353,19 +353,14 @@ if (!$block_edit) {
|
||||
<i class="fa fa-plus"></i> '.tr('Sconto/maggiorazione').'
|
||||
</button>';
|
||||
}
|
||||
?>
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<?php
|
||||
include $structure->filepath('row-list.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -407,6 +402,23 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
caricaRighe();
|
||||
});
|
||||
|
||||
$("#idanagrafica").change(function() {
|
||||
updateSelectOption("idanagrafica", $(this).val());
|
||||
session_set("superselect,idanagrafica", $(this).val(), 0);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
@ -38,7 +38,10 @@ echo '
|
||||
|
||||
// Righe documento
|
||||
$righe = $ddt->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
|
||||
$extra = '';
|
||||
$mancanti = 0;
|
||||
|
||||
@ -57,25 +60,34 @@ foreach ($righe as $key => $riga) {
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'" '.$extra.'>
|
||||
<td class="text-center">
|
||||
'.($key + 1).'
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
echo nl2br($riga->descrizione);
|
||||
}
|
||||
<td>
|
||||
<small class="pull-right text-right text-muted">';
|
||||
|
||||
$numero_riferimenti_riga = $riga->referenceTargets()->count();
|
||||
$numero_riferimenti_collegati = $riga->referenceSources()->count();
|
||||
$riferimenti_presenti = $numero_riferimenti_riga;
|
||||
$testo_aggiuntivo = $riferimenti_presenti ? $numero_riferimenti_riga : '';
|
||||
echo '
|
||||
<button type="button" class="btn btn-xs btn-'.($riferimenti_presenti ? 'primary' : 'info').' pull-right" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
<button type="button" class="btn btn-xs btn-'.($riferimenti_presenti ? 'primary' : 'info').'" onclick="apriRiferimenti(this)">
|
||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').' '.$testo_aggiuntivo.'
|
||||
</button>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginal()->parent, tr('Origine'));
|
||||
}
|
||||
echo '
|
||||
</small>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
echo nl2br($riga->descrizione);
|
||||
}
|
||||
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
if (!empty($mancanti)) {
|
||||
@ -90,12 +102,6 @@ foreach ($righe as $key => $riga) {
|
||||
}
|
||||
}
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginal()->parent);
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
@ -29,6 +29,7 @@ use Modules\Fatture\Fattura;
|
||||
use Modules\Fatture\Stato;
|
||||
use Modules\Fatture\Tipo;
|
||||
use Plugins\ExportFE\FatturaElettronica;
|
||||
use Util\XML;
|
||||
|
||||
$module = Modules::get($id_module);
|
||||
|
||||
@ -209,14 +210,14 @@ switch (post('op')) {
|
||||
// Ricalcolo scadenze
|
||||
case 'controlla_totali':
|
||||
try {
|
||||
$xml = \Util\XML::read($fattura->getXML());
|
||||
$xml = XML::read($fattura->getXML());
|
||||
|
||||
// Totale basato sul campo ImportoTotaleDocumento
|
||||
//$dati_generali = $xml['FatturaElettronicaBody']['DatiGenerali']['DatiGeneraliDocumento'];
|
||||
//$totale_documento = abs(floatval($dati_generali['ImportoTotaleDocumento']));
|
||||
$dati_generali = $xml['FatturaElettronicaBody']['DatiGenerali']['DatiGeneraliDocumento'];
|
||||
$totale_documento_indicato = abs(floatval($dati_generali['ImportoTotaleDocumento']));
|
||||
|
||||
// Calcolo del totale basato sui DatiRiepilogo
|
||||
if (empty($totale_documento)) {
|
||||
if (empty($totale_documento) && empty($dati_generali['ScontoMaggiorazione'])) {
|
||||
$totale_documento = 0;
|
||||
|
||||
$riepiloghi = $xml['FatturaElettronicaBody']['DatiBeniServizi']['DatiRiepilogo'];
|
||||
@ -229,6 +230,8 @@ switch (post('op')) {
|
||||
}
|
||||
|
||||
$totale_documento = abs($totale_documento);
|
||||
} else {
|
||||
$totale_documento = $totale_documento_indicato;
|
||||
}
|
||||
|
||||
$totale_documento = $fattura->isNota() ? -$totale_documento : $totale_documento;
|
||||
|
@ -14,34 +14,59 @@ switch ($resource) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Campi di ricerca
|
||||
$search_fields = [];
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = "IF(numero_esterno != '', numero_esterno, numero) LIKE ".prepare('%'.$search.'%');
|
||||
$search_fields[] = "DATE_FORMAT(data, '%d/%m/%Y') LIKE ".prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
$where = implode(' OR ', $search_fields);
|
||||
$where = $where ? '('.$where.')' : '1=1';
|
||||
|
||||
$query_ordini = "SELECT or_ordini.id,
|
||||
CONCAT('Ordine num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d-%m-%Y'), ' [', (SELECT descrizione FROM or_statiordine WHERE id = idstatoordine) , ']') AS text,
|
||||
CONCAT('Ordine num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d/%m/%Y'), ' [', (SELECT descrizione FROM or_statiordine WHERE id = idstatoordine) , ']') AS text,
|
||||
'Ordini' AS optgroup,
|
||||
'ordine' AS tipo
|
||||
FROM or_ordini
|
||||
INNER JOIN or_righe_ordini ON or_righe_ordini.idordine = or_ordini.id
|
||||
WHERE idanagrafica = ".prepare($id_anagrafica)." AND
|
||||
idstatoordine IN (
|
||||
SELECT id FROM or_statiordine WHERE descrizione IN ('Bozza', 'Accettato', 'Parzialmente evaso', 'Parzialmente fatturato')
|
||||
SELECT id FROM or_statiordine WHERE descrizione != 'Fatturato'
|
||||
) AND
|
||||
idtipoordine IN (
|
||||
SELECT id FROM or_tipiordine WHERE dir = ".prepare($direzione).'
|
||||
)
|
||||
) AND |where|
|
||||
GROUP BY or_ordini.id
|
||||
HAVING SUM(or_righe_ordini.qta - or_righe_ordini.qta_evasa) > 0
|
||||
ORDER BY data DESC, numero DESC';
|
||||
|
||||
$query_ddt = "SELECT dt_ddt.id,
|
||||
CONCAT('DDT num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d-%m-%Y'), ' [', (SELECT descrizione FROM dt_statiddt WHERE id = idstatoddt) , ']') AS text,
|
||||
CONCAT('DDT num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d/%m/%Y'), ' [', (SELECT descrizione FROM dt_statiddt WHERE id = idstatoddt) , ']') AS text,
|
||||
'DDT' AS optgroup,
|
||||
'ddt' AS tipo
|
||||
FROM dt_ddt
|
||||
INNER JOIN dt_righe_ddt ON dt_righe_ddt.idddt = dt_ddt.id
|
||||
WHERE idanagrafica = ".prepare($id_anagrafica)." AND
|
||||
idstatoddt IN (
|
||||
SELECT id FROM dt_statiddt WHERE descrizione IN ('Bozza', 'Parzialmente evaso', 'Parzialmente fatturato')
|
||||
SELECT id FROM dt_statiddt WHERE descrizione != 'Fatturato'
|
||||
) AND
|
||||
idtipoddt IN (
|
||||
SELECT id FROM dt_tipiddt WHERE dir=".prepare($direzione).'
|
||||
)
|
||||
) AND |where|
|
||||
GROUP BY dt_ddt.id
|
||||
HAVING SUM(dt_righe_ddt.qta - dt_righe_ddt.qta_evasa) > 0
|
||||
ORDER BY data DESC, numero DESC';
|
||||
|
||||
// Sostituzione per la ricerca
|
||||
$query_ordini = replace($query_ordini, [
|
||||
'|where|' => $where,
|
||||
]);
|
||||
|
||||
$query_ddt = replace($query_ddt, [
|
||||
'|where|' => $where,
|
||||
]);
|
||||
|
||||
$ordini = $database->fetchArray($query_ordini);
|
||||
$ddt = $database->fetchArray($query_ddt);
|
||||
$results = array_merge($ordini, $ddt);
|
||||
|
@ -709,14 +709,8 @@ if ($dir == 'entrata') {
|
||||
<div class="clearfix"></div>
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
|
||||
include $structure->filepath('row-list.php');
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -868,18 +862,33 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#data_registrazione").on("dp.change", function (e) {
|
||||
var data = $("#data_competenza");
|
||||
data.data("DateTimePicker").minDate(e.date);
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
if(data.data("DateTimePicker").date() < e.date){
|
||||
data.data("DateTimePicker").date(e.date);
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
caricaRighe();
|
||||
|
||||
$("#data_registrazione").on("dp.change", function (e) {
|
||||
let data_competenza = $("#data_competenza");
|
||||
data_competenza.data("DateTimePicker").minDate(e.date);
|
||||
|
||||
if(data_competenza.data("DateTimePicker").date() < e.date){
|
||||
data_competenza.data("DateTimePicker").date(e.date);
|
||||
}
|
||||
});
|
||||
|
||||
$("#data").on("dp.change", function (e) {
|
||||
var data_competenza = $("#data_competenza");
|
||||
let data_competenza = $("#data_competenza");
|
||||
data_competenza.data("DateTimePicker").minDate(e.date);
|
||||
|
||||
if(data_competenza.data("DateTimePicker").date() < e.date){
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
@ -37,7 +37,10 @@ echo '
|
||||
|
||||
// Righe documento
|
||||
$righe = $fattura->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
|
||||
$extra = '';
|
||||
$mancanti = 0;
|
||||
$delete = 'delete_riga';
|
||||
@ -88,20 +91,31 @@ foreach ($righe as $key => $riga) {
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'" '.$extra.'>
|
||||
<td class="text-center">
|
||||
'.($key + 1).'
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
|
||||
// Informazioni aggiuntive sulla destra
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">
|
||||
'.$extra_riga;
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginal()->parent, tr('Origine'));
|
||||
}
|
||||
|
||||
echo '
|
||||
</small>';
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
echo nl2br($riga->descrizione);
|
||||
}
|
||||
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.$extra_riga.'</small>';
|
||||
|
||||
if ($riga->isArticolo() && !empty($riga->abilita_serial)) {
|
||||
if (!empty($mancanti)) {
|
||||
echo '
|
||||
@ -115,12 +129,6 @@ foreach ($righe as $key => $riga) {
|
||||
}
|
||||
}
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginal()->parent);
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
@ -38,7 +38,7 @@ if (null == $orario_inizio || '00:00:00' == $orario_inizio) {
|
||||
}
|
||||
|
||||
// Un utente del gruppo Tecnici può aprire attività solo a proprio nome
|
||||
$id_tecnico = null;
|
||||
$id_tecnico = filter('id_tecnico');
|
||||
if ($user['gruppo'] == 'Tecnici' && !empty($user['idanagrafica'])) {
|
||||
$id_tecnico = $user['idanagrafica'];
|
||||
}
|
||||
|
@ -228,12 +228,12 @@ if (!$is_completato) {
|
||||
<!-- AGGIUNTA TECNICO -->
|
||||
<div class="row">
|
||||
<div class="col-md-offset-6 col-md-4">
|
||||
{[ "type": "select", "label": "'.tr('Tecnico').'", "name": "nuovotecnico", "placeholder": "'.tr('Seleziona un tecnico').'", "ajax-source": "tecnici", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Tecnico" ]}
|
||||
{[ "type": "select", "label": "'.tr('Tecnico').'", "name": "nuovo_tecnico", "placeholder": "'.tr('Seleziona un tecnico').'", "ajax-source": "tecnici", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Tecnico" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label> </label>
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="if($(\'#nuovotecnico\').val()){ add_tecnici($(\'#nuovotecnico\').val()); }else{ swal(\''.tr('Attenzione').'\', \''.tr('Seleziona il tecnico da aggiungere').'.\', \'warning\'); $(\'#nuovotecnico\').focus(); }">
|
||||
<button type="button" class="btn btn-primary btn-block" onclick="if($(\'#nuovo_tecnico\').val()){ add_tecnici($(\'#nuovo_tecnico\').val()); }else{ swal(\''.tr('Attenzione').'\', \''.tr('Seleziona il tecnico da aggiungere').'.\', \'warning\'); $(\'#nuovo_tecnico\').focus(); }">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
</div>
|
||||
@ -262,12 +262,8 @@ async function modificaSessione(button) {
|
||||
}
|
||||
}
|
||||
|
||||
function caricaTecnici() {
|
||||
return $("#tecnici").load("'.$module->fileurl('ajax_tecnici.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||
}
|
||||
|
||||
function calcolaConflittiTecnici() {
|
||||
let tecnici = [input("nuovotecnico").get()];
|
||||
let tecnici = [input("nuovo_tecnico").get()];
|
||||
let inizio = moment().startOf("hour");
|
||||
|
||||
return $("#info-conflitti").load("'.$module->fileurl('occupazione_tecnici.php').'", {
|
||||
@ -279,11 +275,7 @@ function calcolaConflittiTecnici() {
|
||||
});
|
||||
}
|
||||
|
||||
function calcolaCosti() {
|
||||
return $("#costi").load("'.$module->fileurl('ajax_costi.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
||||
}
|
||||
|
||||
input("nuovotecnico").change(function() {
|
||||
input("nuovo_tecnico").change(function() {
|
||||
calcolaConflittiTecnici();
|
||||
});
|
||||
|
||||
@ -323,7 +315,7 @@ function add_tecnici(id_tecnico) {
|
||||
type: "post",
|
||||
success: function() {
|
||||
caricaTecnici();
|
||||
calcolaCosti();
|
||||
caricaCosti();
|
||||
|
||||
calcolaConflittiTecnici();
|
||||
}
|
||||
@ -346,7 +338,7 @@ function elimina_sessione(id_sessione) {
|
||||
type: "post",
|
||||
success: function() {
|
||||
caricaTecnici();
|
||||
calcolaCosti();
|
||||
caricaCosti();
|
||||
|
||||
calcolaConflittiTecnici();
|
||||
}
|
||||
|
@ -355,19 +355,7 @@ echo '
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="tecnici">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_tecnici.php')) {
|
||||
?>
|
||||
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<script>$('#tecnici').load('<?php echo $rootdir; ?>/modules/interventi/ajax_tecnici.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-12" id="tecnici"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -423,10 +411,8 @@ $articoli = $intervento->articoli;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="righe">
|
||||
<?php
|
||||
include $structure->filepath('row-list.php');
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -439,19 +425,7 @@ include $structure->filepath('row-list.php');
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="costi">
|
||||
<?php
|
||||
if (file_exists($docroot.'/modules/interventi/custom/ajax_costi.php')) {
|
||||
?>
|
||||
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/custom/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<script>$('#costi').load('<?php echo $rootdir; ?>/modules/interventi/ajax_costi.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>');</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-12" id="costi"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -515,6 +489,51 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\'Attività.
|
||||
*/
|
||||
function caricaTecnici() {
|
||||
let container = $("#tecnici");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('ajax_tecnici.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\'Attività.
|
||||
*/
|
||||
function caricaCosti() {
|
||||
let container = $("#costi");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('ajax_costi.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
caricaRighe();
|
||||
caricaTecnici();
|
||||
caricaCosti();
|
||||
});
|
||||
|
||||
$("#idanagrafica").change(function () {
|
||||
updateSelectOption("idanagrafica", $(this).val());
|
||||
session_set("superselect,idanagrafica", $(this).val(), 0);
|
||||
|
@ -17,15 +17,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Modules\Interventi\Intervento;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
|
||||
|
||||
$intervento = $intervento ?: Intervento::find($id_record);
|
||||
$righe = $intervento->getRighe();
|
||||
|
||||
if (!$righe->isEmpty()) {
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
|
@ -239,12 +239,7 @@ if (!$block_edit) {
|
||||
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
|
||||
include $module->filepath('row-list.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -286,6 +281,23 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
caricaRighe();
|
||||
});
|
||||
|
||||
$("#idanagrafica").change(function() {
|
||||
updateSelectOption("idanagrafica", $(this).val());
|
||||
session_set("superselect,idanagrafica", $(this).val(), 0);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
@ -41,7 +41,10 @@ echo '
|
||||
$today = new Carbon\Carbon();
|
||||
$today = $today->startOfDay();
|
||||
$righe = $ordine->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
|
||||
$extra = '';
|
||||
$mancanti = 0;
|
||||
|
||||
@ -60,11 +63,17 @@ foreach ($righe as $key => $riga) {
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'" '.$extra.'>
|
||||
<td class="text-center">
|
||||
'.($key + 1).'
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginal()->parent, tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
if ($riga->isArticolo()) {
|
||||
echo Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$riga->descrizione);
|
||||
} else {
|
||||
@ -84,12 +93,6 @@ foreach ($righe as $key => $riga) {
|
||||
}
|
||||
}
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<br>'.reference($riga->getOriginal()->parent);
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
|
@ -72,7 +72,7 @@ switch (filter('op')) {
|
||||
$codice_modalita_pagamento_fe = filter('codice_modalita_pagamento_fe');
|
||||
|
||||
if (isset($descrizione)) {
|
||||
$dbo->query('INSERT INTO `co_pagamenti` (`descrizione`, codice_modalita_pagamento_fe ) VALUES ('.prepare($descrizione).', '.prepare($codice_modalita_pagamento_fe).' )');
|
||||
$dbo->query('INSERT INTO `co_pagamenti` (`descrizione`, `codice_modalita_pagamento_fe`, `prc` ) VALUES ('.prepare($descrizione).', '.prepare($codice_modalita_pagamento_fe).', 100 )');
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [
|
||||
|
@ -90,7 +90,7 @@ foreach ($results as $result) {
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "number", "label": "'.tr('Percentuale').'", "name": "percentuale[]", "value": "'.$result['prc'].'", "icon-after": "<i class=\"fa fa-percent\"></i>" ]}
|
||||
{[ "type": "number", "label": "'.tr('Percentuale').'", "name": "percentuale[]", "decimals": "2", "min-value": "0", "value": "'.$result['prc'].'", "icon-after": "<i class=\"fa fa-percent\"></i>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
@ -124,7 +124,7 @@ foreach ($results as $result) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "number", "label": "'.tr('Distanza in giorni').'", "name": "distanza[]", "decimals": "0", "value": "'.$result['num_giorni'].'" ]}
|
||||
{[ "type": "number", "label": "'.tr('Distanza in giorni').'", "name": "distanza[]", "decimals": "0", "min-value": "0", "value": "'.$result['num_giorni'].'" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,6 +92,8 @@ switch (post('op')) {
|
||||
$qta = $riga->qta_rimanente;
|
||||
|
||||
if ($qta > 0) {
|
||||
//Fix per idconto righe fattura
|
||||
$riga->idconto = $fattura->idconto;
|
||||
$copia = $riga->copiaIn($fattura, $qta);
|
||||
|
||||
// Aggiornamento seriali dalla riga dell'ordine
|
||||
@ -117,7 +119,7 @@ $operations['crea_fattura'] = [
|
||||
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura documenti'),
|
||||
'data' => [
|
||||
'title' => tr('Vuoi davvero fatturare questi documenti?'),
|
||||
'msg' => '{[ "type": "checkbox", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
|
||||
'msg' => '{[ "type": "checkbox", "label": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
|
||||
'button' => tr('Procedi'),
|
||||
'class' => 'btn btn-lg btn-warning',
|
||||
'blank' => false,
|
||||
|
@ -246,14 +246,8 @@ echo '
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
|
||||
include $structure->filepath('row-list.php');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" id="righe"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -294,6 +288,23 @@ async function gestioneRiga(button, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento.
|
||||
*/
|
||||
function caricaRighe() {
|
||||
let container = $("#righe");
|
||||
|
||||
localLoading(container, true);
|
||||
return $.get("'.$structure->fileurl('row-list.php').'?id_module='.$id_module.'&id_record='.$id_record.'", function(data) {
|
||||
container.html(data);
|
||||
localLoading(container, false);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
caricaRighe();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#idanagrafica").change(function() {
|
||||
updateSelectOption("idanagrafica", $(this).val());
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
@ -37,12 +37,23 @@ echo '
|
||||
|
||||
// Righe documento
|
||||
$righe = $preventivo->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
|
||||
echo '
|
||||
<tr data-id="'.$riga->id.'" data-type="'.get_class($riga).'">
|
||||
<td class="text-center">
|
||||
'.($key + 1).'
|
||||
</td>';
|
||||
'.$num.'
|
||||
</td>
|
||||
|
||||
<td>';
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if ($riga->hasOriginal()) {
|
||||
echo '
|
||||
<small class="pull-right text-right text-muted">'.reference($riga->getOriginal()->parent, tr('Origine')).'</small>';
|
||||
}
|
||||
|
||||
// Descrizione
|
||||
$descrizione = nl2br($riga->descrizione);
|
||||
@ -50,7 +61,6 @@ foreach ($righe as $key => $riga) {
|
||||
$descrizione = Modules::link('Articoli', $riga->idarticolo, $riga->codice.' - '.$descrizione);
|
||||
}
|
||||
echo '
|
||||
<td>
|
||||
'.$descrizione.'
|
||||
</td>';
|
||||
|
||||
|
@ -178,7 +178,7 @@ function init_calendar(calendar) {
|
||||
</script>';
|
||||
|
||||
// Clienti top
|
||||
$clienti = $dbo->fetchArray('SELECT SUM(co_righe_documenti.subtotale - co_righe_documenti.sconto) AS totale, (SELECT COUNT(*) FROM co_documenti WHERE co_documenti.idanagrafica =an_anagrafiche.idanagrafica AND co_documenti.data BETWEEN '.prepare($start).' AND '.prepare($end).") AS qta, an_anagrafiche.idanagrafica, an_anagrafiche.ragione_sociale FROM co_documenti INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_righe_documenti ON co_righe_documenti.iddocumento=co_documenti.id INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica=co_documenti.idanagrafica WHERE co_tipidocumento.dir='entrata' AND co_documenti.data BETWEEN ".prepare($start).' AND '.prepare($end).' GROUP BY an_anagrafiche.idanagrafica ORDER BY SUM(subtotale - sconto) DESC LIMIT 20');
|
||||
$clienti = $dbo->fetchArray('SELECT SUM(co_righe_documenti.subtotale - co_righe_documenti.sconto) AS totale, (SELECT COUNT(*) FROM co_documenti WHERE co_documenti.idanagrafica =an_anagrafiche.idanagrafica AND co_documenti.data BETWEEN '.prepare($start).' AND '.prepare($end).") AS qta, an_anagrafiche.idanagrafica, an_anagrafiche.ragione_sociale FROM co_documenti INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_righe_documenti ON co_righe_documenti.iddocumento=co_documenti.id INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica=co_documenti.idanagrafica WHERE co_tipidocumento.dir='entrata' AND co_documenti.data BETWEEN ".prepare($start).' AND '.prepare($end).' GROUP BY an_anagrafiche.idanagrafica ORDER BY SUM(subtotale - co_righe_documenti.sconto) DESC LIMIT 20');
|
||||
|
||||
$totale = $dbo->fetchArray("SELECT SUM(co_righe_documenti.subtotale - co_righe_documenti.sconto) AS totale FROM co_documenti INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id INNER JOIN co_righe_documenti ON co_righe_documenti.iddocumento=co_documenti.id WHERE co_tipidocumento.dir='entrata' AND co_documenti.data BETWEEN ".prepare($start).' AND '.prepare($end));
|
||||
|
||||
|
@ -45,7 +45,6 @@ switch (filter('op')) {
|
||||
|
||||
$fornitore->codice_fornitore = post('codice_fornitore');
|
||||
$fornitore->descrizione = post('descrizione');
|
||||
$fornitore->prezzo_acquisto = post('prezzo_acquisto');
|
||||
$fornitore->qta_minima = post('qta_minima');
|
||||
$fornitore->giorni_consegna = post('giorni_consegna');
|
||||
|
||||
|
@ -64,15 +64,11 @@ echo '
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "number", "label": "'.tr('Prezzo acquisto').'", "name": "prezzo_acquisto", "required": 1, "value": "'.$fornitore['prezzo_acquisto'].'", "icon-after": "€" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "number", "label": "'.tr('Qta minima ordinabile').'", "name": "qta_minima", "required": 0, "value": "'.$fornitore['qta_minima'].'", "icon-after": "'.$articolo->um.'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Tempi di consegna').'", "name": "giorni_consegna", "class": "text-right", "required": 0, "value": "'.$fornitore['giorni_consegna'].'", "icon-after": "'.tr('gg').'" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Modules\DDT\DDT;
|
||||
use Modules\Ordini\Ordine;
|
||||
use Plugins\ImportFE\FatturaElettronica;
|
||||
use Plugins\ImportFE\Interaction;
|
||||
|
||||
@ -140,13 +142,13 @@ switch (filter('op')) {
|
||||
|
||||
$fattura_pa->delete();
|
||||
|
||||
//Aggiorno la tipologia di anagrafica fornitore
|
||||
$anagrafica = $dbo->fetchOne('SELECT idanagrafica FROM co_documenti WHERE co_documenti.id='.prepare($id_fattura));
|
||||
$rs_t = $dbo->fetchOne("SELECT * FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica=(SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche WHERE an_tipianagrafiche.descrizione='Fornitore') AND idanagrafica=".prepare($anagrafica['idanagrafica']));
|
||||
// Aggiorno la tipologia di anagrafica fornitore
|
||||
$anagrafica = $database->fetchOne('SELECT idanagrafica FROM co_documenti WHERE co_documenti.id='.prepare($id_fattura));
|
||||
$rs_t = $database->fetchOne("SELECT * FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica=(SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche WHERE an_tipianagrafiche.descrizione='Fornitore') AND idanagrafica=".prepare($anagrafica['idanagrafica']));
|
||||
|
||||
//Se non trovo corrispondenza aggiungo all'anagrafica la tipologia fornitore
|
||||
// Se non trovo corrispondenza aggiungo all'anagrafica la tipologia fornitore
|
||||
if (empty($rs_t)) {
|
||||
$dbo->query("INSERT INTO an_tipianagrafiche_anagrafiche (idtipoanagrafica, idanagrafica) VALUES ((SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche WHERE an_tipianagrafiche.descrizione='Fornitore'), ".prepare($anagrafica['idanagrafica']).')');
|
||||
$database->query("INSERT INTO an_tipianagrafiche_anagrafiche (idtipoanagrafica, idanagrafica) VALUES ((SELECT an_tipianagrafiche.idtipoanagrafica FROM an_tipianagrafiche WHERE an_tipianagrafiche.descrizione='Fornitore'), ".prepare($anagrafica['idanagrafica']).')');
|
||||
}
|
||||
|
||||
// Processo il file ricevuto
|
||||
@ -230,7 +232,7 @@ switch (filter('op')) {
|
||||
return $item->count();
|
||||
});
|
||||
$id_conto = $conti->sort()->keys()->last();
|
||||
$conto = $dbo->fetchOne('SELECT * FROM co_pianodeiconti3 WHERE id = '.prepare($id_conto));
|
||||
$conto = $database->fetchOne('SELECT * FROM co_pianodeiconti3 WHERE id = '.prepare($id_conto));
|
||||
|
||||
// Ricerca dell'IVA più utilizzata secondo percentuali
|
||||
$iva = [];
|
||||
@ -265,4 +267,126 @@ switch (filter('op')) {
|
||||
'iva' => $iva,
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'riferimenti-automatici':
|
||||
if (empty($anagrafica)) {
|
||||
echo json_encode([]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
// Iterazione sulle singole righe
|
||||
$righe = $fattura_pa->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$collegamento = null;
|
||||
|
||||
// Visualizzazione codici articoli
|
||||
$codici = $riga['CodiceArticolo'] ?: [];
|
||||
$codici = !empty($codici) && !isset($codici[0]) ? [$codici] : $codici;
|
||||
|
||||
// Ricerca dell'articolo collegato al codice
|
||||
$id_articolo = null;
|
||||
foreach ($codici as $codice) {
|
||||
if (!empty($anagrafica) && empty($id_articolo)) {
|
||||
$id_articolo = $database->fetchOne('SELECT id_articolo AS id FROM mg_fornitore_articolo WHERE codice_fornitore = '.prepare($codice['CodiceValore']).' AND id_fornitore = '.prepare($anagrafica->id))['id'];
|
||||
}
|
||||
|
||||
if (empty($id_articolo)) {
|
||||
$id_articolo = $database->fetchOne('SELECT id FROM mg_articoli WHERE codice = '.prepare($codice['CodiceValore']))['id'];
|
||||
}
|
||||
|
||||
if (!empty($id_articolo)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$query = "SELECT dt_righe_ddt.id, dt_righe_ddt.idddt AS id_documento, dt_righe_ddt.is_descrizione, dt_righe_ddt.idarticolo, dt_righe_ddt.is_sconto, 'ddt' AS ref,
|
||||
CONCAT('DDT num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d/%m/%Y'), ' [', (SELECT descrizione FROM dt_statiddt WHERE id = idstatoddt) , ']') AS opzione
|
||||
FROM dt_righe_ddt
|
||||
INNER JOIN dt_ddt ON dt_ddt.id = dt_righe_ddt.idddt
|
||||
WHERE dt_ddt.idanagrafica = ".prepare($anagrafica->id)." AND |where_ddt|
|
||||
|
||||
UNION SELECT or_righe_ordini.id, or_righe_ordini.idordine AS id_documento, or_righe_ordini.is_descrizione, or_righe_ordini.idarticolo, or_righe_ordini.is_sconto, 'ordine' AS ref,
|
||||
CONCAT('Ordine num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d/%m/%Y'), ' [', (SELECT descrizione FROM or_statiordine WHERE id = idstatoordine) , ']') AS opzione
|
||||
FROM or_righe_ordini
|
||||
INNER JOIN or_ordini ON or_ordini.id = or_righe_ordini.idordine
|
||||
WHERE or_ordini.idanagrafica = ".prepare($anagrafica->id).' AND |where_ordini|';
|
||||
|
||||
// Ricerca di righe DDT/Ordine con stesso Articolo
|
||||
if (!empty($id_articolo)) {
|
||||
$query_articolo = replace($query, [
|
||||
'|where_ddt|' => 'dt_righe_ddt.idarticolo = '.prepare($id_articolo),
|
||||
'|where_ordini|' => 'or_righe_ordini.idarticolo = '.prepare($id_articolo),
|
||||
]);
|
||||
|
||||
$collegamento = $database->fetchOne($query_articolo);
|
||||
}
|
||||
|
||||
// Ricerca di righe DDT/Ordine per stessa descrizione
|
||||
if (empty($collegamento)) {
|
||||
$query_descrizione = replace($query, [
|
||||
'|where_ddt|' => 'dt_righe_ddt.descrizione = '.prepare($riga['Descrizione']),
|
||||
'|where_ordini|' => 'or_righe_ordini.descrizione = '.prepare($riga['Descrizione']),
|
||||
]);
|
||||
|
||||
$collegamento = $database->fetchOne($query_descrizione);
|
||||
}
|
||||
|
||||
// Ricerca di righe DDT/Ordine per stesso importo
|
||||
if (empty($collegamento)) {
|
||||
$query_descrizione = replace($query, [
|
||||
'|where_ddt|' => 'dt_righe_ddt.prezzo_unitario = '.prepare($riga['PrezzoUnitario']),
|
||||
'|where_ordini|' => 'or_righe_ordini.prezzo_unitario = '.prepare($riga['PrezzoUnitario']),
|
||||
]);
|
||||
|
||||
$collegamento = $database->fetchOne($query_descrizione);
|
||||
}
|
||||
|
||||
if (!empty($collegamento)) {
|
||||
// Individuazione del documento
|
||||
$documento = $collegamento['ref'] == 'ddt' ? DDT::find($collegamento['id_documento']) : Ordine::find($collegamento['id_documento']);
|
||||
|
||||
// Individuazione della classe di gestione per la riga
|
||||
$namespace = $collegamento['ref'] == 'ddt' ? 'Modules\\DDT\\Components\\' : 'Modules\\Ordini\\Components\\';
|
||||
if (!empty($collegamento['idarticolo'])) {
|
||||
$type = 'Articolo';
|
||||
} elseif (!empty($collegamento['is_sconto'])) {
|
||||
$type = 'Sconto';
|
||||
} elseif (!empty($collegamento['is_descrizione'])) {
|
||||
$type = 'Descrizione';
|
||||
} else {
|
||||
$type = 'Riga';
|
||||
}
|
||||
|
||||
// Ricerca della riga
|
||||
$riga = $documento->getRiga($namespace.$type, $collegamento['id']);
|
||||
$riga_origine = $riga->getOriginal();
|
||||
|
||||
// Compilazione dei dati
|
||||
$results[$key] = [
|
||||
'documento' => [
|
||||
'tipo' => $collegamento['ref'],
|
||||
'id' => $collegamento['id_documento'],
|
||||
'descrizione' => reference($documento, tr('Origine')),
|
||||
'opzione' => $collegamento['opzione'],
|
||||
],
|
||||
'riga' => [
|
||||
'tipo' => get_class($riga),
|
||||
'id' => $riga->id,
|
||||
'descrizione' => $riga->descrizione,
|
||||
'qta' => $riga->qta,
|
||||
'um' => $riga->um,
|
||||
'prezzo_unitario' => $riga->prezzo_unitario ?: $riga_origine->prezzo_unitario,
|
||||
'id_iva' => $riga->id_iva,
|
||||
'iva_percentuale' => $riga->aliquota->percentuale,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -18,9 +18,17 @@
|
||||
*/
|
||||
|
||||
echo '
|
||||
<button type="button" class="btn btn-primary tip" '.(!empty($anagrafica) ? '' : 'disabled').' id="compilazione_automatica" onclick="compile(this)" title="'.tr('Tenta la compilazione automatica delle informazioni delle fattura elettronica sulla base delle precedenti fatture del Fornitore').'.">
|
||||
<i class="fa fa-address-book"></i> '.tr('Compila automaticamente').'
|
||||
</button>
|
||||
<div class="tip" data-toggle="tooltip" title="'.tr('Tenta la compilazione automatica delle informazioni delle fattura elettronica sulla base delle precedenti fatture del Fornitore').'.">
|
||||
<button type="button" class="btn btn-primary" '.(!empty($anagrafica) ? '' : 'disabled').' id="compilazione_automatica" onclick="compile(this)" >
|
||||
<i class="fa fa-address-book"></i> '.tr('Compila automaticamente').'
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tip" data-toggle="tooltip" title="'.tr('Tenta il completamento automatico dei riferimenti per le righe delle fattura elettronica sulla base di Ordini e DDT registrati nel gestionale per il Fornitore').'.">
|
||||
<button type="button" class="btn btn-primary" '.(!empty($anagrafica) ? '' : 'disabled').' onclick="compilaRiferimenti(this)" >
|
||||
<i class="fa fa-list"></i> '.tr('Cerca riferimenti').'
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@ -32,12 +40,13 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
function compile(btn) {
|
||||
var restore = buttonLoading(btn);
|
||||
let restore = buttonLoading(btn);
|
||||
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
cache: false,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id_module: "'.$id_module.'",
|
||||
id_plugin: "'.$id_plugin.'",
|
||||
@ -45,27 +54,24 @@ function compile(btn) {
|
||||
op: "compile",
|
||||
},
|
||||
success: function(response) {
|
||||
var data = JSON.parse(response);
|
||||
if (data.length == 0){
|
||||
buttonRestore(btn, restore);
|
||||
buttonRestore(btn, restore);
|
||||
if (response.length === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$("#id_tipo").selectSet(data.id_tipo);
|
||||
$("#pagamento").selectSetNew(data.pagamento.id, data.pagamento.descrizione);
|
||||
$("#id_tipo").selectSet(response.id_tipo);
|
||||
$("#pagamento").selectSetNew(response.pagamento.id, response.pagamento.descrizione);
|
||||
|
||||
$("select[name^=iva]").each(function(){
|
||||
var aliquota = $(this).closest("tr").find("[id^=aliquota]").text();
|
||||
if (data.iva[aliquota] !== undefined){
|
||||
$(this).selectSet(data.iva[aliquota].id);
|
||||
if (response.iva[aliquota] !== undefined){
|
||||
$(this).selectSet(response.iva[aliquota].id);
|
||||
}
|
||||
});
|
||||
|
||||
$("select[name^=conto]").each(function(){
|
||||
$(this).selectSetNew(data.conto.id, data.conto.descrizione);
|
||||
$(this).selectSetNew(response.conto.id, response.conto.descrizione);
|
||||
});
|
||||
|
||||
buttonRestore(btn, restore);
|
||||
},
|
||||
error: function(data) {
|
||||
swal("'.tr('Errore').'", "'.tr('La compilazione automatica dei campi non è andata a buon fine').'.", "error");
|
||||
@ -74,4 +80,40 @@ function compile(btn) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function compilaRiferimenti(btn) {
|
||||
let restore = buttonLoading(btn);
|
||||
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
cache: false,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id_module: "'.$id_module.'",
|
||||
id_plugin: "'.$id_plugin.'",
|
||||
id_record: "'.$id_record.'",
|
||||
op: "riferimenti-automatici",
|
||||
},
|
||||
success: function(response) {
|
||||
buttonRestore(btn, restore);
|
||||
if (response.length === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
for (const [id_riga, data] of response.entries()) {
|
||||
// Selezione dinamica
|
||||
$("#selezione_riferimento" + id_riga).selectSetNew(data.documento.id, data.documento.opzione);
|
||||
|
||||
// Impostazione del riferiment
|
||||
impostaRiferimento(id_riga, data.documento, data.riga);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
swal("'.tr('Errore').'", "'.tr('La ricerca automatica dei riferimenti per le righe non è andata a buon fine').'.", "error");
|
||||
|
||||
buttonRestore(btn, restore);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
|
@ -17,6 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
echo '
|
||||
@ -207,7 +209,7 @@ echo '
|
||||
|
||||
// Data di registrazione
|
||||
$data_registrazione = get('data_registrazione');
|
||||
$data_registrazione = new \Carbon\Carbon($data_registrazione);
|
||||
$data_registrazione = new Carbon($data_registrazione);
|
||||
echo '
|
||||
<div class="col-md-3">
|
||||
{[ "type": "date", "label": "'.tr('Data di registrazione').'", "name": "data_registrazione", "required": 1, "value": "'.($data_registrazione ?: $dati_generali['Data']).'", "max-date": "-now-", "min-date": "'.$dati_generali['Data'].'" ]}
|
||||
@ -268,7 +270,6 @@ echo '
|
||||
|
||||
// Righe
|
||||
$righe = $fattura_pa->getRighe();
|
||||
|
||||
if (!empty($righe)) {
|
||||
echo '
|
||||
<h4>
|
||||
@ -291,7 +292,7 @@ if (!empty($righe)) {
|
||||
<tbody>';
|
||||
|
||||
foreach ($righe as $key => $riga) {
|
||||
$query = 'SELECT id, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)) AS descrizione FROM co_iva WHERE percentuale = '.prepare($riga['AliquotaIVA']);
|
||||
$query = "SELECT id, IF(codice IS NULL, descrizione, CONCAT(codice, ' - ', descrizione)) AS descrizione FROM co_iva WHERE percentuale = ".prepare($riga['AliquotaIVA']);
|
||||
|
||||
if (!empty($riga['Natura'])) {
|
||||
$query .= ' AND codice_natura_fe = '.prepare($riga['Natura']);
|
||||
@ -312,7 +313,13 @@ if (!empty($righe)) {
|
||||
$id_articolo = null;
|
||||
$codice_principale = $codici[0]['CodiceValore'];
|
||||
if (!empty($codice_principale)) {
|
||||
$id_articolo = $database->fetchOne('SELECT id FROM mg_articoli WHERE codice = '.prepare($codice_principale))['id'];
|
||||
if (!empty($anagrafica) && empty($id_articolo)) {
|
||||
$id_articolo = $database->fetchOne('SELECT id_articolo AS id FROM mg_fornitore_articolo WHERE codice_fornitore = '.prepare($codice_principale).' AND id_fornitore = '.prepare($anagrafica->id))['id'];
|
||||
}
|
||||
|
||||
if (empty($id_articolo)) {
|
||||
$id_articolo = $database->fetchOne('SELECT id FROM mg_articoli WHERE codice = '.prepare($codice_principale))['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$qta = $riga['Quantita'];
|
||||
@ -322,11 +329,13 @@ if (!empty($righe)) {
|
||||
echo '
|
||||
<tr data-id="'.$key.'" data-qta="'.$qta.'" data-prezzo_unitario="'.$prezzo_unitario.'" data-iva_percentuale="'.$riga['AliquotaIVA'].'">
|
||||
<td>
|
||||
<small class="pull-right text-muted" id="riferimento_'.$key.'"></small>
|
||||
|
||||
'.$riga['Descrizione'].'<br>
|
||||
|
||||
'.(!empty($codici_articoli) ? '<small>'.implode(', ', $codici_articoli).'</small><br>' : '').'
|
||||
<span id="riferimento_'.$key.'_descrizione"></span>
|
||||
<b id="riferimento_'.$key.'"></b>
|
||||
|
||||
<b id="riferimento_'.$key.'_descrizione"></b>
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
@ -371,7 +380,7 @@ if (!empty($righe)) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "name": "selezione_riferimento['.$key.']", "ajax-source": "riferimenti-fe", "select-options": '.json_encode(['id_anagrafica' => $anagrafica ? $anagrafica->id : '']).', "required": 1, "label": "'.tr('Riferimento').'", "icon-after": '.json_encode('<button type="button" onclick="rimuoviRiferimento(this)" class="btn btn-primary disabled" id="rimuovi_riferimento_'.$key.'"><i class="fa fa-close"></i></button>').' ]}
|
||||
{[ "type": "select", "name": "selezione_riferimento['.$key.']", "ajax-source": "riferimenti-fe", "select-options": '.json_encode(['id_anagrafica' => $anagrafica ? $anagrafica->id : '']).', "required": 0, "label": "'.tr('Riferimento').'", "icon-after": '.json_encode('<button type="button" onclick="rimuoviRiferimento(this)" class="btn btn-primary disabled" id="rimuovi_riferimento_'.$key.'"><i class="fa fa-close"></i></button>').' ]}
|
||||
</div>
|
||||
</td>
|
||||
</tr>';
|
||||
@ -417,7 +426,6 @@ if (!empty($righe)) {
|
||||
|
||||
// Selezione generale per il conto
|
||||
if (conto_selezionato) {
|
||||
console.log(conto_selezionato);
|
||||
conti.each(function() {
|
||||
$(this).selectSetNew(conto_selezionato.id, conto_selezionato.text, conto_selezionato);
|
||||
});
|
||||
@ -463,6 +471,7 @@ function rimuoviRiferimento(button) {
|
||||
input("selezione_riferimento[" + id_riga + "]").enable()
|
||||
.getElement().selectReset();
|
||||
$(button).addClass("disabled");
|
||||
riga.removeClass("success").removeClass("warning");
|
||||
}
|
||||
|
||||
function selezionaRiferimento(riga, tipo_documento, id_documento) {
|
||||
@ -531,21 +540,30 @@ function impostaRiferimento(id_riga, documento, riga) {
|
||||
let riga_fe = $("#id_riga_riferimento_" + id_riga).closest("tr").prev();
|
||||
|
||||
// Informazioni visibili sulla quantità
|
||||
impostaContenuto(riga_fe.data("qta"), riga.qta, "#riferimento_" + id_riga + "_qta");
|
||||
impostaContenuto(riga_fe.data("qta"), riga.qta, (riga.um ? " " + riga.um : ""), "#riferimento_" + id_riga + "_qta");
|
||||
|
||||
// Informazioni visibili sul prezzo unitario
|
||||
impostaContenuto(riga_fe.data("prezzo_unitario"), riga.prezzo_unitario, "#riferimento_" + id_riga + "_prezzo");
|
||||
impostaContenuto(riga_fe.data("prezzo_unitario"), riga.prezzo_unitario, " " + globals.currency, "#riferimento_" + id_riga + "_prezzo");
|
||||
|
||||
// Informazioni visibili sull\'aliquota IVA
|
||||
impostaContenuto(riga_fe.data("iva_percentuale"), riga.iva_percentuale, "#riferimento_" + id_riga + "_iva");
|
||||
impostaContenuto(riga_fe.data("iva_percentuale"), riga.iva_percentuale, "%", "#riferimento_" + id_riga + "_iva");
|
||||
|
||||
$("#riferimento_" + id_riga).html(documento.descrizione ? documento.descrizione : "");
|
||||
$("#riferimento_" + id_riga + "_descrizione").html(riga.descrizione ? riga.descrizione : "");
|
||||
|
||||
// Colorazione dell\'intera riga
|
||||
let warnings = riga_fe.find(".text-warning");
|
||||
if (warnings.length === 0) {
|
||||
riga_fe.addClass("success").removeClass("warning");
|
||||
} else {
|
||||
riga_fe.removeClass("success").addClass("warning");
|
||||
}
|
||||
}
|
||||
|
||||
// Informazioni visibili sull\'aliquota IVA
|
||||
function impostaContenuto(valore_riga, valore_riferimento, id_elemento) {
|
||||
function impostaContenuto(valore_riga, valore_riferimento, contenuto_successivo, id_elemento) {
|
||||
let elemento = $(id_elemento);
|
||||
if (valore_riferimento === undefined){
|
||||
if (valore_riferimento === undefined) {
|
||||
elemento.html("");
|
||||
return;
|
||||
}
|
||||
@ -553,12 +571,12 @@ function impostaContenuto(valore_riga, valore_riferimento, id_elemento) {
|
||||
valore_riga = parseFloat(valore_riga);
|
||||
valore_riferimento = parseFloat(valore_riferimento);
|
||||
|
||||
let contenuto = valore_riferimento.toLocale() + "%";
|
||||
let contenuto = valore_riferimento.toLocale() + contenuto_successivo;
|
||||
if (valore_riferimento === valore_riga) {
|
||||
contenuto = `<i class="fa fa-warning"></i> ` + contenuto;
|
||||
contenuto = `<i class="fa fa-check"></i> ` + contenuto;
|
||||
elemento.addClass("text-success").removeClass("text-warning");
|
||||
} else {
|
||||
contenuto = `<i class="fa fa-check"></i> ` + contenuto;
|
||||
contenuto = `<i class="fa fa-warning"></i> ` + contenuto;
|
||||
elemento.removeClass("text-success").addClass("text-warning");
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,10 @@ echo '
|
||||
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||
<tr>
|
||||
<th>'.tr('Descrizione').'</th>
|
||||
<th width="120">'.tr('Q.tà').' <i title="'.tr('da evadere').' / '.tr('totale').'" class="tip fa fa-question-circle-o"></i></th>
|
||||
<th class="text-center" width="120">
|
||||
'.tr('Q.tà').' <i title="'.tr('da evadere').' / '.tr('totale').'" class="tip fa fa-question-circle-o"></i>
|
||||
</th>
|
||||
<th class="text-center" width="120">'.tr('Prezzo unitario').'</th>
|
||||
<th class="text-center" width="60">#</th>
|
||||
</tr>
|
||||
|
||||
@ -51,20 +54,24 @@ $id_riferimento = get('id_riferimento');
|
||||
$righe = $documento->getRighe();
|
||||
foreach ($righe as $riga) {
|
||||
$qta_rimanente = $riga->qta_rimanente - $righe_utilizzate[$riga->id];
|
||||
$riga_origine = $riga->getOriginal();
|
||||
|
||||
$dettagli = [
|
||||
'tipo' => get_class($riga),
|
||||
'id' => $riga->id,
|
||||
'descrizione' => $riga->descrizione,
|
||||
'qta' => $riga->qta,
|
||||
'prezzo_unitario' => $riga->prezzo_unitario,
|
||||
'um' => $riga->um,
|
||||
'prezzo_unitario' => $riga->prezzo_unitario ?: $riga_origine->prezzo_unitario,
|
||||
'id_iva' => $riga->id_iva,
|
||||
'iva_percentuale' => $riga->aliquota->percentuale,
|
||||
];
|
||||
|
||||
echo '
|
||||
<tr '.($id_riferimento == $riga->id ? 'class="success"' : '').' data-dettagli='.json_encode($dettagli).'>
|
||||
<td>'.$riga->descrizione.'</td>
|
||||
<td>'.numberFormat($qta_rimanente, 'qta').' / '.numberFormat($riga->qta, 'qta').'</td>
|
||||
<td>'.(!empty($riga->codice) ? $riga->codice.' - ' : '').$riga->descrizione.'</td>
|
||||
<td>'.numberFormat($qta_rimanente, 'qta').' / '.numberFormat($riga->qta, 'qta').' '.$riga->um.'</td>
|
||||
<td class="text-right">'.moneyFormat($riga->prezzo_unitario_corrente).'</td>
|
||||
<td class="text-center">';
|
||||
|
||||
if ($qta_rimanente >= $qta) {
|
||||
@ -83,11 +90,13 @@ echo '
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>$(document).ready(init)</script>
|
||||
|
||||
<script>
|
||||
var documento_importazione = {
|
||||
tipo: "'.$tipo_documento.'",
|
||||
id: "'.$id_documento.'",
|
||||
descrizione: "'.$documento->getReference().'",
|
||||
descrizione: '.json_encode(reference($documento, tr('Origine'))).',
|
||||
};
|
||||
|
||||
function selezionaRiga(button) {
|
||||
@ -98,4 +107,12 @@ function selezionaRiga(button) {
|
||||
|
||||
$(button).closest(".modal").modal("hide");
|
||||
}
|
||||
|
||||
// Deselezione del riferimento in caso di selezione riga non effettuata
|
||||
$("#modals > div").on("hidden.bs.modal", function () {
|
||||
if(!$("#id_riferimento_'.$id_riga.'").val()) {
|
||||
input("selezione_riferimento['.$id_riga.']").enable()
|
||||
.getElement().selectReset();
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
@ -152,17 +152,17 @@ class FatturaOrdinaria extends FatturaElettronica
|
||||
$obj = Riga::build($fattura);
|
||||
}
|
||||
|
||||
$obj->descrizione = $riga['Descrizione'];
|
||||
|
||||
// Collegamento al documento di riferimento
|
||||
if (!empty($tipi_riferimenti[$key])) {
|
||||
$obj->original_id = $id_riferimenti[$key];
|
||||
$obj->original_type = $tipi_riferimenti[$key];
|
||||
list($riferimento_precedente, $nuovo_riferimento) = $obj->impostaOrigine($tipi_riferimenti[$key], $id_riferimenti[$key]);
|
||||
|
||||
// Riferimenti deprecati
|
||||
//$id_rif = strpos($tipi_riferimenti[$key], 'Ordini') === false ? 'idddt' : 'idordine';
|
||||
//$obj->{$id_rif} = $obj->original_id;
|
||||
// Correzione della descrizione
|
||||
$obj->descrizione = str_replace($riferimento_precedente, '', $obj->descrizione);
|
||||
$obj->descrizione .= $nuovo_riferimento;
|
||||
}
|
||||
|
||||
$obj->descrizione = $riga['Descrizione'];
|
||||
$obj->id_iva = $iva[$key];
|
||||
$obj->idconto = $conto[$key];
|
||||
|
||||
|
@ -31,8 +31,9 @@ class SessioniInterventi extends AppResource
|
||||
public function getCleanupData($last_sync_at)
|
||||
{
|
||||
// Periodo per selezionare interventi
|
||||
$mesi_precedenti = intval(setting('Mesi per lo storico delle Attività'));
|
||||
$today = new Carbon();
|
||||
$start = $today->copy()->subMonths(2);
|
||||
$start = $today->copy()->subMonths($mesi_precedenti);
|
||||
$end = $today->copy()->addMonth(1);
|
||||
|
||||
// Informazioni sull'utente
|
||||
@ -60,8 +61,9 @@ class SessioniInterventi extends AppResource
|
||||
public function getModifiedRecords($last_sync_at)
|
||||
{
|
||||
// Periodo per selezionare interventi
|
||||
$mesi_precedenti = intval(setting('Mesi per lo storico delle Attività'));
|
||||
$today = new Carbon();
|
||||
$start = $today->copy()->subMonths(2);
|
||||
$start = $today->copy()->subMonths($mesi_precedenti);
|
||||
$end = $today->copy()->addMonth(1);
|
||||
|
||||
// Informazioni sull'utente
|
||||
|
@ -59,7 +59,7 @@ class FileManager implements ManagerInterface
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.tr('Allegati').'</h3>
|
||||
</div>
|
||||
<div class="panel-body"><div id="loading_'.$attachment_id.'" class="text-center hide" style="position:relative;top:100px;z-index:2;opacity:0.5;"><i class="fa fa-refresh fa-spin fa-3x fa-fw"></i><span class="sr-only">'.tr('Caricamento...').'</span></div>';
|
||||
<div class="panel-body">';
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
@ -301,17 +301,15 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
function getFilenameAndExtension(pathfilename){
|
||||
|
||||
var filenameextension = pathfilename.replace(/^.*[\\\/]/, \'\');
|
||||
var filename = filenameextension.substring(0, filenameextension.lastIndexOf(\'.\'));
|
||||
var ext = filenameextension.split(\'.\').pop();
|
||||
function getFilenameAndExtension(path) {
|
||||
let filename_extension = path.replace(/^.*[\\\/]/, \'\');
|
||||
let filename = filename_extension.substring(0, filename_extension.lastIndexOf(\'.\'));
|
||||
let ext = filename_extension.split(\'.\').pop();
|
||||
|
||||
return [filename, ext];
|
||||
|
||||
}
|
||||
|
||||
// Autocompletamento nome
|
||||
// Auto-completamento nome
|
||||
$("#'.$attachment_id.' #blob").change(function(){
|
||||
var nome = $("#'.$attachment_id.' #nome_allegato");
|
||||
|
||||
@ -371,20 +369,17 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
function show_'.$attachment_id.'() {
|
||||
$("#loading_'.$attachment_id.'").removeClass("hide");
|
||||
localLoading($("#'.$attachment_id.' .panel-body"), true);
|
||||
}
|
||||
|
||||
function reload_'.$attachment_id.'() {
|
||||
$("#'.$attachment_id.'").load(globals.rootdir + "/ajax.php?op=list_attachments&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'", function() {
|
||||
|
||||
$("#loading_'.$attachment_id.'").addClass("hide");
|
||||
|
||||
localLoading($("#'.$attachment_id.' .panel-body"), false);
|
||||
|
||||
var id = $("#'.$attachment_id.' table tr").eq(-1).attr("id");
|
||||
if (id !== undefined)
|
||||
$("#"+id).effect("highlight", {}, 1500);
|
||||
|
||||
|
||||
if (id !== undefined) {
|
||||
$("#" + id).effect("highlight", {}, 1500);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
|
@ -17,6 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
/**
|
||||
* Classe per la gestione delle informazioni relative alle stampe installate.
|
||||
*
|
||||
@ -459,14 +461,19 @@ class Prints
|
||||
include DOCROOT.'/templates/info.php';
|
||||
|
||||
// Instanziamento dell'oggetto mPDF
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
$mpdf = new Mpdf([
|
||||
'format' => $settings['format'],
|
||||
'orientation' => strtoupper($settings['orientation']) == 'L' ? 'L' : 'P',
|
||||
'font-size' => $settings['font-size'],
|
||||
'margin_left' => $settings['margins']['left'],
|
||||
'margin_right' => $settings['margins']['right'],
|
||||
'setAutoBottomMargin' => 'stretch',
|
||||
'setAutoTopMargin' => 'stretch',
|
||||
|
||||
'setAutoTopMargin' => $settings['margins']['top'] === 'auto' ? 'stretch' : false,
|
||||
'margin_top' => $settings['margins']['top'] === 'auto' ? 0 : $settings['margins']['top'], // Disabilitato se setAutoTopMargin impostato
|
||||
|
||||
'setAutoBottomMargin' => $settings['margins']['bottom'] === 'auto' ? 'stretch' : false,
|
||||
'margin_bottom' => $settings['margins']['bottom'] === 'auto' ? 0 : $settings['margins']['bottom'], // Disabilitato se setAutoBottomMargin impostato
|
||||
|
||||
'default_font' => 'dejavusanscondensed',
|
||||
|
||||
// Abilitazione per lo standard PDF/A
|
||||
|
@ -22,8 +22,8 @@ $settings = [
|
||||
'format' => 'A4',
|
||||
'font-size' => 10,
|
||||
'margins' => [
|
||||
'top' => 10,
|
||||
'bottom' => 10,
|
||||
'top' => 'auto',
|
||||
'bottom' => 'auto',
|
||||
'left' => 12,
|
||||
'right' => 12,
|
||||
],
|
||||
|
@ -51,17 +51,17 @@ if ($options['pricing']) {
|
||||
|
||||
// Righe documento
|
||||
$righe = $documento->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
$r = $riga->toArray();
|
||||
|
||||
$autofill->count($r['descrizione']);
|
||||
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<td class="text-center" style="vertical-align: middle">
|
||||
'.($key + 1).'
|
||||
'.$num.'
|
||||
</td>';
|
||||
|
||||
echo'
|
||||
|
@ -48,7 +48,9 @@ echo "
|
||||
|
||||
// Righe documento
|
||||
$righe = $documento->getRighe();
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
$r = $riga->toArray();
|
||||
|
||||
$autofill->count($r['descrizione']);
|
||||
@ -61,7 +63,7 @@ foreach ($righe as $key => $riga) {
|
||||
|
||||
echo '
|
||||
<td class="text-center" style="vertical-align: middle">
|
||||
'.($key + 1).'
|
||||
'.$num.'
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
|
@ -67,18 +67,18 @@ if ($options['pricing']) {
|
||||
|
||||
<tbody>';
|
||||
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
$r = $riga->toArray();
|
||||
|
||||
$autofill->count($r['descrizione']);
|
||||
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
echo '
|
||||
<td class="text-center" style="vertical-align: middle">
|
||||
'.($key + 1).'
|
||||
</td>';
|
||||
<tr>
|
||||
<td class="text-center" style="vertical-align: middle">
|
||||
'.$num.'
|
||||
</td>';
|
||||
|
||||
if ($has_image) {
|
||||
if ($riga->isArticolo()) {
|
||||
|
@ -142,18 +142,18 @@ echo '
|
||||
|
||||
<tbody>';
|
||||
|
||||
foreach ($righe as $key => $riga) {
|
||||
$num = 0;
|
||||
foreach ($righe as $riga) {
|
||||
++$num;
|
||||
$r = $riga->toArray();
|
||||
|
||||
$autofill->count($r['descrizione']);
|
||||
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
echo '
|
||||
<td class="text-center" style="vertical-align: middle">
|
||||
'.($key + 1).'
|
||||
</td>';
|
||||
<tr>
|
||||
<td class="text-center" style="vertical-align: middle" width="25">
|
||||
'.$num.'
|
||||
</td>';
|
||||
|
||||
if ($has_images) {
|
||||
echo '<td class=\"text-center\" style=\"vertical-align: middle\" >';
|
||||
@ -258,7 +258,7 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
|
||||
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
|
||||
<th colspan="'.($options['show_only_total'] ? 1 : 3).'" class="text-right">
|
||||
<th colspan="'.($options['show_only_total'] ? (($has_images) ? 2 : 1) : (($has_images) ? 3 : 2)).'" class="text-right">
|
||||
<b>'.moneyFormat($show_sconto ? $imponibile : $totale_imponibile, 2).'</b>
|
||||
</th>
|
||||
</tr>';
|
||||
@ -271,7 +271,7 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
|
||||
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
|
||||
<th colspan="'.($options['show_only_total'] ? 1 : 3).'" class="text-right">
|
||||
<th colspan="'.($options['show_only_total'] ? (($has_images) ? 2 : 1) : (($has_images) ? 3 : 2)).'" class="text-right">
|
||||
<b>'.moneyFormat($sconto, 2).'</b>
|
||||
</th>
|
||||
</tr>';
|
||||
@ -283,7 +283,7 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
|
||||
<b>'.tr('Totale imponibile', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
|
||||
<th colspan="'.($options['show_only_total'] ? 1 : 3).'" class="text-right">
|
||||
<th colspan="'.($options['show_only_total'] ? (($has_images) ? 2 : 1) : (($has_images) ? 3 : 2)).'" class="text-right">
|
||||
<b>'.moneyFormat($totale_imponibile, 2).'</b>
|
||||
</th>
|
||||
</tr>';
|
||||
@ -296,7 +296,7 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
|
||||
<b>'.tr('Totale IVA', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
|
||||
<th colspan="'.($options['show_only_total'] ? 1 : 3).'" class="text-right">
|
||||
<th colspan="'.($options['show_only_total'] ? (($has_images) ? 2 : 1) : (($has_images) ? 3 : 2)).'" class="text-right">
|
||||
<b>'.moneyFormat($totale_iva, 2).'</b>
|
||||
</th>
|
||||
</tr>';
|
||||
@ -307,7 +307,7 @@ if (($options['pricing'] && !isset($options['hide_total'])) || $options['show_on
|
||||
<td colspan="'.($options['show_only_total'] ? 2 : 4).'" class="text-right border-top">
|
||||
<b>'.tr('Totale documento', [], ['upper' => true]).':</b>
|
||||
</td>
|
||||
<th colspan="'.($options['show_only_total'] ? 1 : 3).'" class="text-right">
|
||||
<th colspan="'.($options['show_only_total'] ? (($has_images) ? 2 : 1) : (($has_images) ? 3 : 2)).'" class="text-right">
|
||||
<b>'.moneyFormat($totale, 2).'</b>
|
||||
</th>
|
||||
</tr>';
|
||||
|
@ -88,11 +88,94 @@ UPDATE `zz_views` SET `query` = 'CONCAT(UCASE(LEFT(tipo_movimento, 1)), SUBSTRIN
|
||||
-- Aggiornamento versione API services
|
||||
UPDATE `zz_settings` SET `valore` = 'v3' WHERE `nome` = 'OSMCloud Services API Version';
|
||||
|
||||
-- Aggiornamento margini stampa barbcode
|
||||
UPDATE `zz_prints` SET `options` = '{"width": 54, "height": 20, "format": [64, 55], "margins": {"top": 5,"bottom": 0,"left": 0,"right": 0}}' WHERE `zz_prints`.`name` = 'Barcode';
|
||||
-- Aggiornamento del modulo Banche per il supporto completo alle Anagrafiche
|
||||
ALTER TABLE `co_banche` ADD `id_anagrafica` INT(11) NOT NULL, CHANGE `note` `note` TEXT, CHANGE `filiale` `filiale` varchar(255);
|
||||
UPDATE `co_banche` SET `id_anagrafica` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Azienda predefinita');
|
||||
ALTER TABLE `co_banche` ADD FOREIGN KEY (`id_anagrafica`) REFERENCES `an_anagrafiche`(`idanagrafica`) ON DELETE CASCADE;
|
||||
|
||||
-- Aggiunta riferimenti testuali su descrizione righe per Fatture
|
||||
UPDATE `co_righe_documenti`
|
||||
INNER JOIN `co_righe_contratti` ON `co_righe_documenti`.`original_id` = `co_righe_contratti`.`id`
|
||||
INNER JOIN `co_contratti` ON `co_contratti`.`id` = `co_righe_contratti`.`idcontratto`
|
||||
SET `co_righe_documenti`.`descrizione` = CONCAT(`co_righe_documenti`.`descrizione`, '\nRif. contratto num. ', `co_contratti`.`numero`, ' del ', DATE_FORMAT(`co_contratti`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `co_righe_documenti`.`original_type` LIKE '%Contratti%';
|
||||
UPDATE `co_righe_documenti`
|
||||
INNER JOIN `co_righe_preventivi` ON `co_righe_documenti`.`original_id` = `co_righe_preventivi`.`id`
|
||||
INNER JOIN `co_preventivi` ON `co_preventivi`.`id` = `co_righe_preventivi`.`idpreventivo`
|
||||
SET `co_righe_documenti`.`descrizione` = CONCAT(`co_righe_documenti`.`descrizione`, '\nRif. preventivo num. ', `co_preventivi`.`numero`, ' del ', DATE_FORMAT(`co_preventivi`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `co_righe_documenti`.`original_type` LIKE '%Preventivi%';
|
||||
UPDATE `co_righe_documenti`
|
||||
INNER JOIN `or_righe_ordini` ON `co_righe_documenti`.`original_id` = `or_righe_ordini`.`id`
|
||||
INNER JOIN `or_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine`
|
||||
INNER JOIN `or_tipiordine` ON `or_tipiordine`.`id` = `or_ordini`.`idtipoordine`
|
||||
SET `co_righe_documenti`.`descrizione` = CONCAT(`co_righe_documenti`.`descrizione`, '\nRif. ', LOWER(`or_tipiordine`.`descrizione`), ' num. ', `or_ordini`.`numero`, ' del ', DATE_FORMAT(`or_ordini`.`data`, '%d/%m/%Y'))
|
||||
WHERE `co_righe_documenti`.`original_type` LIKE '%Ordini%';
|
||||
UPDATE `co_righe_documenti`
|
||||
INNER JOIN `dt_righe_ddt` ON `co_righe_documenti`.`original_id` = `dt_righe_ddt`.`id`
|
||||
INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idordine`
|
||||
INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt`
|
||||
SET `co_righe_documenti`.`descrizione` = CONCAT(`co_righe_documenti`.`descrizione`, '\nRif. ', LOWER(`dt_tipiddt`.`descrizione`), ' num. ', `dt_ddt`.`numero`, ' del ', DATE_FORMAT(`dt_ddt`.`data`, '%d/%m/%Y'))
|
||||
WHERE `co_righe_documenti`.`original_type` LIKE '%DDT%';
|
||||
UPDATE `co_righe_documenti`
|
||||
INNER JOIN `in_righe_interventi` ON `co_righe_documenti`.`original_id` = `in_righe_interventi`.`id`
|
||||
INNER JOIN `in_interventi` ON `in_interventi`.`id` = `in_righe_interventi`.`idintervento`
|
||||
SET `co_righe_documenti`.`descrizione` = CONCAT(`co_righe_documenti`.`descrizione`, '\nRif. attività num. ', `in_interventi`.`codice`, ' del ', DATE_FORMAT(`in_interventi`.`data_richiesta`, '%d/%m/%Y'))
|
||||
WHERE `co_righe_documenti`.`original_type` LIKE '%Interventi%';
|
||||
|
||||
-- Aggiunta riferimenti testuali su descrizione righe per Ordini
|
||||
UPDATE `or_righe_ordini`
|
||||
INNER JOIN `co_righe_contratti` ON `or_righe_ordini`.`original_id` = `co_righe_contratti`.`id`
|
||||
INNER JOIN `co_contratti` ON `co_contratti`.`id` = `co_righe_contratti`.`idcontratto`
|
||||
SET `or_righe_ordini`.`descrizione` = CONCAT(`or_righe_ordini`.`descrizione`, '\nRif. contratto num. ', `co_contratti`.`numero`, ' del ', DATE_FORMAT(`co_contratti`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `or_righe_ordini`.`original_type` LIKE '%Contratti%';
|
||||
UPDATE `or_righe_ordini`
|
||||
INNER JOIN `co_righe_preventivi` ON `or_righe_ordini`.`original_id` = `co_righe_preventivi`.`id`
|
||||
INNER JOIN `co_preventivi` ON `co_preventivi`.`id` = `co_righe_preventivi`.`idpreventivo`
|
||||
SET `or_righe_ordini`.`descrizione` = CONCAT(`or_righe_ordini`.`descrizione`, '\nRif. preventivo num. ', `co_preventivi`.`numero`, ' del ', DATE_FORMAT(`co_preventivi`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `or_righe_ordini`.`original_type` LIKE '%Preventivi%';
|
||||
UPDATE `or_righe_ordini`
|
||||
INNER JOIN `dt_righe_ddt` ON `or_righe_ordini`.`original_id` = `dt_righe_ddt`.`id`
|
||||
INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idordine`
|
||||
INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt`
|
||||
SET `or_righe_ordini`.`descrizione` = CONCAT(`or_righe_ordini`.`descrizione`, '\nRif. ', LOWER(`dt_tipiddt`.`descrizione`), ' num. ', `dt_ddt`.`numero`, ' del ', DATE_FORMAT(`dt_ddt`.`data`, '%d/%m/%Y'))
|
||||
WHERE `or_righe_ordini`.`original_type` LIKE '%DDT%';
|
||||
UPDATE `or_righe_ordini`
|
||||
INNER JOIN `in_righe_interventi` ON `or_righe_ordini`.`original_id` = `in_righe_interventi`.`id`
|
||||
INNER JOIN `in_interventi` ON `in_interventi`.`id` = `in_righe_interventi`.`idintervento`
|
||||
SET `or_righe_ordini`.`descrizione` = CONCAT(`or_righe_ordini`.`descrizione`, '\nRif. attività num. ', `in_interventi`.`codice`, ' del ', DATE_FORMAT(`in_interventi`.`data_richiesta`, '%d/%m/%Y'))
|
||||
WHERE `or_righe_ordini`.`original_type` LIKE '%Interventi%';
|
||||
|
||||
-- Aggiunta riferimenti testuali su descrizione righe per DDT
|
||||
UPDATE `dt_righe_ddt`
|
||||
INNER JOIN `co_righe_contratti` ON `dt_righe_ddt`.`original_id` = `co_righe_contratti`.`id`
|
||||
INNER JOIN `co_contratti` ON `co_contratti`.`id` = `co_righe_contratti`.`idcontratto`
|
||||
SET `dt_righe_ddt`.`descrizione` = CONCAT(`dt_righe_ddt`.`descrizione`, '\nRif. contratto num. ', `co_contratti`.`numero`, ' del ', DATE_FORMAT(`co_contratti`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `dt_righe_ddt`.`original_type` LIKE '%Contratti%';
|
||||
UPDATE `dt_righe_ddt`
|
||||
INNER JOIN `co_righe_preventivi` ON `dt_righe_ddt`.`original_id` = `co_righe_preventivi`.`id`
|
||||
INNER JOIN `co_preventivi` ON `co_preventivi`.`id` = `co_righe_preventivi`.`idpreventivo`
|
||||
SET `dt_righe_ddt`.`descrizione` = CONCAT(`dt_righe_ddt`.`descrizione`, '\nRif. preventivo num. ', `co_preventivi`.`numero`, ' del ', DATE_FORMAT(`co_preventivi`.`data_bozza`, '%d/%m/%Y'))
|
||||
WHERE `dt_righe_ddt`.`original_type` LIKE '%Preventivi%';
|
||||
UPDATE `dt_righe_ddt`
|
||||
INNER JOIN `or_righe_ordini` ON `dt_righe_ddt`.`original_id` = `or_righe_ordini`.`id`
|
||||
INNER JOIN `or_ordini` ON `or_ordini`.`id` = `or_righe_ordini`.`idordine`
|
||||
INNER JOIN `or_tipiordine` ON `or_tipiordine`.`id` = `or_ordini`.`idtipoordine`
|
||||
SET `dt_righe_ddt`.`descrizione` = CONCAT(`dt_righe_ddt`.`descrizione`, '\nRif. ', LOWER(`or_tipiordine`.`descrizione`), ' num. ', `or_ordini`.`numero`, ' del ', DATE_FORMAT(`or_ordini`.`data`, '%d/%m/%Y'))
|
||||
WHERE `dt_righe_ddt`.`original_type` LIKE '%Ordini%';
|
||||
UPDATE `dt_righe_ddt`
|
||||
INNER JOIN `in_righe_interventi` ON `dt_righe_ddt`.`original_id` = `in_righe_interventi`.`id`
|
||||
INNER JOIN `in_interventi` ON `in_interventi`.`id` = `in_righe_interventi`.`idintervento`
|
||||
SET `dt_righe_ddt`.`descrizione` = CONCAT(`dt_righe_ddt`.`descrizione`, '\nRif. attività num. ', `in_interventi`.`codice`, ' del ', DATE_FORMAT(`in_interventi`.`data_richiesta`, '%d/%m/%Y'))
|
||||
WHERE `dt_righe_ddt`.`original_type` LIKE '%Interventi%';
|
||||
|
||||
-- Aggiunta campi per i riferimenti in Preventivi
|
||||
ALTER TABLE `co_righe_preventivi` ADD `original_id` int(11), ADD `original_type` varchar(255);
|
||||
|
||||
-- Fix qtà impegnata: aggiunto filtro per ricerca solo su ordini cliente e non tutti gli ordini
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_articoli` LEFT JOIN an_anagrafiche ON mg_articoli.id_fornitore=an_anagrafiche.idanagrafica LEFT JOIN co_iva ON mg_articoli.idiva_vendita=co_iva.id LEFT JOIN (SELECT SUM(qta-qta_evasa) AS qta_impegnata, idarticolo FROM or_righe_ordini INNER JOIN or_ordini ON or_righe_ordini.idordine=or_ordini.id INNER JOIN or_tipiordine ON or_ordini.idtipoordine=or_tipiordine.id WHERE idstatoordine IN(SELECT id FROM or_statiordine WHERE completato=0) AND or_tipiordine.dir=''entrata'' GROUP BY idarticolo) a ON a.idarticolo=mg_articoli.id LEFT JOIN mg_categorie ON mg_articoli.id_categoria=mg_categorie.id LEFT JOIN mg_categorie AS sottocategorie ON mg_articoli.id_sottocategoria=sottocategorie.id WHERE 1=1 AND (`mg_articoli`.`deleted_at`) IS NULL HAVING 2=2 ORDER BY `mg_articoli`.`descrizione`' WHERE `zz_modules`.`name` = 'Articoli';
|
||||
|
||||
-- Collegamento sulla base dei campi aggiuntivi per le Anagrafiche
|
||||
UPDATE `co_banche`
|
||||
INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idbanca_acquisti` = `co_banche`.`id`
|
||||
|
Loading…
x
Reference in New Issue
Block a user