Compare commits
11 Commits
1cc40b76e2
...
143272993e
Author | SHA1 | Date |
---|---|---|
Pek5892 | 143272993e | |
MatteoPistorello | f4a85c583e | |
MatteoPistorello | 818ce3cc1e | |
Pek5892 | 4c23e1cf95 | |
Pek5892 | e0f02d302d | |
Pek5892 | ed5d524fff | |
Pek5892 | 672c9ce34e | |
Pek5892 | f57ee2ab7e | |
Pek5892 | fbc4b3d718 | |
Pek5892 | eadeb43b8a | |
Pek5892 | 146a36ab9e |
|
@ -59,7 +59,7 @@ $plugins = Plugin::where('idmodule_to', $id_module)->where('position', 'tab_main
|
|||
foreach ($plugins as $plugin) {
|
||||
echo '
|
||||
<li>
|
||||
<a data-toggle="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->title.'</a>
|
||||
<a data-toggle="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->getTranslation('title').'</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ echo '
|
|||
<input type="hidden" name="blocca_minimo_vendita" value="'.setting('Bloccare i prezzi inferiori al minimo di vendita').'">';
|
||||
|
||||
// Selezione impianto per gli Interventi
|
||||
if ($module->getTranslation('title') == 'Interventi') {
|
||||
if ($module->getTranslation('title') == 'Attività') {
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
|
|
@ -130,7 +130,7 @@ if (!empty($options['create_document'])) {
|
|||
}
|
||||
|
||||
// Opzioni aggiuntive per gli Interventi
|
||||
elseif ($final_module->getTranslation('title') == 'Interventi') {
|
||||
elseif ($final_module->getTranslation('title') == 'Attività') {
|
||||
echo '
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato_intervento", "required": 1, "values": "query=SELECT `in_statiintervento`.`id`, `in_statiintervento_lang`.`title` as `descrizione`, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `deleted_at` IS NULL AND `is_completato` = 0 ORDER BY `title`" ]}
|
||||
|
@ -152,7 +152,7 @@ if (!empty($options['create_document'])) {
|
|||
}
|
||||
|
||||
// Opzioni aggiuntive per i DDT
|
||||
elseif (in_array($final_module->getTranslation('title'), ['Ddt di vendita', 'Ddt di acquisto'])) {
|
||||
elseif (in_array($final_module->getTranslation('title'), ['Ddt in uscita', 'Ddt in entrata'])) {
|
||||
$stato_predefinito = (new Stato())->getByField('title', 'Bozza', Models\Locale::getPredefined()->id);
|
||||
|
||||
echo '
|
||||
|
|
|
@ -456,7 +456,7 @@ switch ($resource) {
|
|||
|
||||
case 'regioni':
|
||||
if (isset($superselect['id_nazione'])) {
|
||||
$query = 'SELECT `an_regioni`.`id` AS id, `an_regioni`.`iso2`, CONCAT(CONCAT_WS(\' - \', `an_regioni`.`iso2`, `an_regioni_lang`.`title`), \' (\', `an_nazioni`.`iso2`, \')\') AS descrizione FROM `an_regioni` LEFT JOIN `an_regioni_lang` ON (`an_regioni`.`id` = `an_regioni_lang`.`id_record` AND `an_regioni_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_nazioni` ON `an_regioni`.`id_nazione` = `an_nazioni`.`id` |where| ORDER BY `an_regioni_lang`.`title`';
|
||||
$query = 'SELECT `an_regioni`.`id` AS id, `an_regioni_lang`.`title` AS descrizione FROM `an_regioni` LEFT JOIN `an_regioni_lang` ON (`an_regioni`.`id` = `an_regioni_lang`.`id_record` AND `an_regioni_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_nazioni` ON `an_regioni`.`id_nazione` = `an_nazioni`.`id` |where| ORDER BY `an_regioni_lang`.`title`';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = '`an_regioni`.`id`='.prepare($element);
|
||||
|
@ -466,8 +466,6 @@ switch ($resource) {
|
|||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = '`an_regioni_lang`.`title` LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = '`an_regioni`.`iso2` LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'CONCAT_WS(\' - \', `an_regioni`.`iso2`, `an_regioni_lang`.`title`) LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -69,8 +69,8 @@ class Anagrafica extends Model
|
|||
|
||||
$model->ragione_sociale = $ragione_sociale;
|
||||
|
||||
$model->nome = $nome;
|
||||
$model->cognome = $cognome;
|
||||
$model->nome = $nome ?: '';
|
||||
$model->cognome = $cognome ?: '';
|
||||
|
||||
$model->codice = static::getNextCodice();
|
||||
$model->id_ritenuta_acconto_vendite = setting("Ritenuta d'acconto predefinita");
|
||||
|
|
|
@ -37,10 +37,9 @@ class Categoria extends Model
|
|||
|
||||
protected static $parent_identifier = 'parent';
|
||||
|
||||
public static function build($nota = null, $colore = null)
|
||||
public static function build($colore = null)
|
||||
{
|
||||
$model = new static();
|
||||
$model->nota = $nota;
|
||||
$model->colore = $colore;
|
||||
$model->save();
|
||||
|
||||
|
|
|
@ -32,9 +32,6 @@ switch (filter('op')) {
|
|||
flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.'));
|
||||
} else {
|
||||
$attributo = Attributo::build();
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$attributo->name = $descrizione;
|
||||
}
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
$attributo->setTranslation('title', $descrizione);
|
||||
$attributo->setTranslation('title', $title);
|
||||
|
@ -52,9 +49,6 @@ switch (filter('op')) {
|
|||
flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.'));
|
||||
} else {
|
||||
$attributo->setTranslation('title', $title);
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$attributo->name = $descrizione;
|
||||
}
|
||||
$attributo->save();
|
||||
|
||||
flash()->info(tr('Attributo aggiornato correttamente!'));
|
||||
|
|
|
@ -25,10 +25,6 @@ echo '
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 1, "help": "'.tr("Nome univoco dell'attributo").'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
|
||||
</div>
|
||||
|
|
|
@ -31,10 +31,6 @@ echo '
|
|||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "span", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$attributo->getTranslation('title').'", "help": "'.tr("Nome univoco dell'attributo").'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->getTranslation('title').'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
|
||||
</div>
|
||||
|
|
|
@ -28,13 +28,10 @@ switch (filter('op')) {
|
|||
$id_original = filter('id_original') ?: null;
|
||||
|
||||
if (isset($nome) && isset($nota) && isset($colore)) {
|
||||
$categoria->nota = $nota;
|
||||
$categoria->colore = $colore;
|
||||
$categoria->parent = $id_original ?: null;
|
||||
$categoria->setTranslation('title', $nome);
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$categoria->name = $descrizione;
|
||||
}
|
||||
$categoria->setTranslation('note', $nota);
|
||||
$categoria->save();
|
||||
|
||||
flash()->info(tr('Salvataggio completato!'));
|
||||
|
@ -68,12 +65,10 @@ switch (filter('op')) {
|
|||
if (!empty($categoria_new)) {
|
||||
flash()->error(tr('Questo nome è già stato utilizzato per un altra categoria.'));
|
||||
} else {
|
||||
$categoria = Categoria::build($nota, $colore);
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$categoria->name = $descrizione;
|
||||
}
|
||||
$categoria = Categoria::build($colore);
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
$categoria->parent = $id_original;
|
||||
$categoria->setTranslation('note', $nota);
|
||||
$categoria->setTranslation('title', $nome);
|
||||
$categoria->save();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ use Models\Module;
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$nota$" ]}
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$note$" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,7 @@ echo '
|
|||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "value": "$title$", "required": 1 ]}
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "value": "$name$", "required": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
|
|
@ -17,9 +17,6 @@ switch (filter('op')) {
|
|||
} else {
|
||||
if (empty($combinazione)) {
|
||||
$combinazione = Combinazione::build();
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$combinazione->name = $nome;
|
||||
}
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
}
|
||||
$combinazione->setTranslation('title', $nome);
|
||||
|
|
|
@ -37,7 +37,7 @@ include_once __DIR__.'/../../core.php';
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "required": 1, "value": "$title$" ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "required": 1, "value": "$name$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
|
|
@ -34,7 +34,7 @@ use Modules\Ordini\Stato as StatoOrdine;
|
|||
|
||||
$module = Module::find($id_module);
|
||||
|
||||
if ($module->getTranslation('title') == 'Ddt di vendita') {
|
||||
if ($module->getTranslation('title') == 'Ddt in uscita') {
|
||||
$dir = 'entrata';
|
||||
} else {
|
||||
$dir = 'uscita';
|
||||
|
|
|
@ -26,7 +26,7 @@ use Modules\Fatture\Fattura;
|
|||
use Modules\Fatture\Stato;
|
||||
use Modules\Fatture\Tipo;
|
||||
|
||||
if ($module->getTranslation('title') == 'Ddt di vendita') {
|
||||
if ($module->getTranslation('title') == 'Ddt in uscita') {
|
||||
$dir = 'entrata';
|
||||
$module_fatture = 'Fatture di vendita';
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ $tipo_documento_finale = Fattura::class;
|
|||
|
||||
$module = Module::find($id_module);
|
||||
|
||||
if ($module->getTranslation('title') == 'Ddt di vendita') {
|
||||
if ($module->getTranslation('title') == 'Ddt in uscita') {
|
||||
$final_module = 'Fatture di vendita';
|
||||
$dir = 'entrata';
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ if ($module_name == 'Ddt di acquisto') {
|
|||
}
|
||||
|
||||
if (!empty($id_record)) {
|
||||
$ddt = DDT::with('tipo', 'stato')->find($id_record);
|
||||
$ddt = DDT::find($id_record);
|
||||
|
||||
$record = $dbo->fetchOne('SELECT
|
||||
`dt_ddt`.*,
|
||||
|
@ -43,7 +43,7 @@ if (!empty($id_record)) {
|
|||
`dt_tipiddt_lang`.`title` AS `descrizione_tipodoc`,
|
||||
`an_anagrafiche`.`tipo` AS tipo_anagrafica
|
||||
FROM `dt_ddt`
|
||||
INNER JOIN `dt_statiddt` ON dt_ddt.idstatoddt=dt_statiddt.id
|
||||
INNER JOIN `dt_statiddt` ON `dt_ddt`.`idstatoddt`=`dt_statiddt`.`id`
|
||||
LEFT JOIN `dt_statiddt_lang` ON (`dt_statiddt_lang`.`id_record` = `dt_statiddt`.`id` AND `dt_statiddt_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).')
|
||||
INNER JOIN `an_anagrafiche` ON `dt_ddt`.`idanagrafica`=`an_anagrafiche`.`idanagrafica`
|
||||
INNER JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt`=`dt_tipiddt`.`id`
|
||||
|
|
|
@ -135,7 +135,7 @@ switch ($op) {
|
|||
$fattura->note_aggiuntive = post('note_aggiuntive');
|
||||
|
||||
$fattura->idanagrafica = post('idanagrafica');
|
||||
$fattura->idagente = post('idagente');
|
||||
$fattura->idagente = post('idagente') ?: '';
|
||||
$fattura->idreferente = post('idreferente');
|
||||
$fattura->idpagamento = post('idpagamento');
|
||||
$fattura->id_banca_azienda = post('id_banca_azienda');
|
||||
|
@ -764,7 +764,7 @@ switch ($op) {
|
|||
$fattura->idsede_destinazione = $idsede;
|
||||
$fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null;
|
||||
$fattura->idreferente = $documento->idreferente;
|
||||
$fattura->idagente = $documento->idagente;
|
||||
$fattura->idagente = $documento->idagente ?: '';
|
||||
|
||||
$fattura->save();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ if (in_array($module->getTranslation('title'), ['Fatture di vendita', 'Fatture d
|
|||
$is_rientrabile = $database->fetchOne('SELECT * FROM `dt_causalet` WHERE `id` = '.prepare($ddt->idcausalet))['is_rientrabile'];
|
||||
} elseif (in_array($module->getTranslation('title'), ['Ordini cliente', 'Ordini fornitore'])) {
|
||||
$modulo = 'ord';
|
||||
} elseif ($module->getTranslation('title') == 'Interventi') {
|
||||
} elseif ($module->getTranslation('title') == 'Attività') {
|
||||
$modulo = 'int';
|
||||
} elseif ($module->getTranslation('title') == 'Contratti') {
|
||||
$modulo = 'con';
|
||||
|
|
|
@ -122,7 +122,7 @@ class Fattura extends Document
|
|||
if ($numero_esterno) {
|
||||
$model->numero_esterno = $numero_esterno;
|
||||
}
|
||||
$model->idagente = $anagrafica->idagente;
|
||||
$model->idagente = $anagrafica->idagente ?: '';
|
||||
|
||||
// Sede aziendale scelta tra le sedi disponibili per l'utente
|
||||
$id_sede = $user->sedi[0];
|
||||
|
|
|
@ -30,7 +30,7 @@ foreach ($stati_abilitati as $stato) {
|
|||
// Crea revisione
|
||||
echo '
|
||||
<div class="tip" data-toggle="tooltip" title="'.tr('Per creare una nuova revisione lo stato del preventivo deve essere tra: _STATE_LIST_', [
|
||||
'_STATE_LIST_' => $stati,
|
||||
'_STATE_LIST_' => implode(", ", $stati),
|
||||
]).'">
|
||||
<button type="button" class="btn btn-warning '.($record['is_revisionabile'] ? '' : 'disabled').'" onclick="openModal(\''.tr('Crea revisione').'\', \''.$module->fileurl('crea_revisione.php').'?id_module='.$id_module.'&id_record='.$id_record.'\')">
|
||||
<i class="fa fa-edit"></i> '.tr('Crea nuova revisione...').'
|
||||
|
@ -51,7 +51,7 @@ foreach ($stati_abilitati as $stato) {
|
|||
// Creazione altri documenti
|
||||
echo '
|
||||
<div class="btn-group tip" data-toggle="tooltip" title="'.tr('Per creare un documento deve essere inserita almeno una riga e lo stato del preventivo deve essere tra: _STATE_LIST_', [
|
||||
'_STATE_LIST_' => $stati,
|
||||
'_STATE_LIST_' => implode(', ', $stati),
|
||||
]).'">
|
||||
<button class="btn btn-info dropdown-toggle '.($disabled ? '' : 'disabled').'" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea').'...
|
||||
|
|
|
@ -41,7 +41,7 @@ if (get('documento') == 'fattura') {
|
|||
$op = 'add_ordine_fornitore';
|
||||
$tipo_documento_finale = Ordine::class;
|
||||
} elseif (get('documento') == 'ddt') {
|
||||
$final_module = 'Ddt di vendita';
|
||||
$final_module = 'Ddt in uscita';
|
||||
$op = 'add_documento';
|
||||
$tipo_documento_finale = DDT::class;
|
||||
} elseif (get('documento') == 'contratto') {
|
||||
|
@ -49,7 +49,7 @@ if (get('documento') == 'fattura') {
|
|||
$op = 'add_preventivo';
|
||||
$tipo_documento_finale = Contratto::class;
|
||||
} else {
|
||||
$final_module = 'Interventi';
|
||||
$final_module = 'Attività';
|
||||
$op = 'add_documento';
|
||||
$tipo_documento_finale = Intervento::class;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ if (!empty($rs)) {
|
|||
$data_accettazione = ($preventivo->data_accettazione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_accettazione) : '';
|
||||
$data_conclusione = ($preventivo->data_conclusione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_conclusione) : '';
|
||||
|
||||
if (strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
|
||||
if ($data_conclusione != '' && strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d'))) {
|
||||
$attr = ' class="danger"';
|
||||
} else {
|
||||
$attr = '';
|
||||
|
|
|
@ -60,7 +60,7 @@ switch (post('op')) {
|
|||
], ['id' => $id_record]);
|
||||
|
||||
$dbo->update('zz_segments_lang', [
|
||||
'name' => post('name'),
|
||||
'title' => post('name'),
|
||||
], ['id_record' => $id_record, 'id_lang' => Models\Locale::getDefault()->id]);
|
||||
|
||||
// Aggiornamento dei permessi relativi
|
||||
|
@ -95,7 +95,7 @@ switch (post('op')) {
|
|||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
$dbo->insert('zz_segments_lang', [
|
||||
'name' => post('name'),
|
||||
'title' => post('name'),
|
||||
'id_record' => $id_record,
|
||||
'id_lang' => Models\Locale::getDefault()->id,
|
||||
]);
|
||||
|
|
|
@ -21,7 +21,7 @@ include_once __DIR__.'/../../../core.php';
|
|||
|
||||
switch ($resource) {
|
||||
case 'tipi_scadenze':
|
||||
$query = 'SELECT `title` AS `id`, `description` as `descrizione` FROM `co_tipi_scadenze` LEFT JOIN `co_tipi_scadenze_lang` ON (`co_tipi_scadenze_lang`.`id_record` = `co_tipi_scadenze`.`id` AND `co_tipi_scadenze_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') |where| ORDER BY `title` ASC';
|
||||
$query = 'SELECT `title` AS `id`, `title` as `descrizione` FROM `co_tipi_scadenze` LEFT JOIN `co_tipi_scadenze_lang` ON (`co_tipi_scadenze_lang`.`id_record` = `co_tipi_scadenze`.`id` AND `co_tipi_scadenze_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') |where| ORDER BY `title` ASC';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = '`co_tipi_scadenze`.`id`='.prepare($element);
|
||||
|
@ -29,7 +29,6 @@ switch ($resource) {
|
|||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = '`title` LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = '`description` LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -115,7 +115,7 @@ function saveNota(id) {
|
|||
note: $("#note_" + id).val(),
|
||||
id: id
|
||||
}, function() {
|
||||
alertPush();
|
||||
renderMessages();
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").removeClass("btn-success");
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").addClass("btn-default");
|
||||
});
|
||||
|
|
|
@ -23,13 +23,13 @@ use Models\Module;
|
|||
use Modules\Checklists\Check;
|
||||
|
||||
$operazione = filter('op');
|
||||
$id_modulo_impianti = (new Module())->getByField('title', 'Impianti', Models\Locale::getPredefined()->id);
|
||||
|
||||
switch ($operazione) {
|
||||
case 'add_impianto':
|
||||
if (post('id_impianto')) {
|
||||
$dbo->query('INSERT INTO my_impianti_interventi(idimpianto, idintervento) VALUES('.prepare(post('id_impianto')).', '.prepare($id_record).')');
|
||||
|
||||
$id_modulo_impianti = (new Module())->getByField('title', 'Impianti', Models\Locale::getPredefined()->id);
|
||||
$checks_impianti = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare($id_modulo_impianti).' AND id_record = '.prepare(post('id_impianto')));
|
||||
foreach ($checks_impianti as $check_impianto) {
|
||||
$id_parent_new = null;
|
||||
|
@ -52,7 +52,7 @@ switch ($operazione) {
|
|||
break;
|
||||
|
||||
case 'update_impianto':
|
||||
$components = (array) post('componenti');
|
||||
$components = (post('componenti') ? (array) post('componenti') : []);
|
||||
$note = post('note');
|
||||
$id_impianto = post('id_impianto');
|
||||
|
||||
|
@ -74,7 +74,6 @@ switch ($operazione) {
|
|||
break;
|
||||
|
||||
case 'delete_impianto':
|
||||
$id_modulo_impianti = (new Module())->getByField('title', 'Impianti', Models\Locale::getPredefined()->id);
|
||||
$dbo->query('DELETE FROM my_impianti_interventi WHERE idintervento='.prepare($id_record).' AND idimpianto = '.prepare(post('id')));
|
||||
Check::deleteLinked([
|
||||
'id_module' => $id_module,
|
||||
|
@ -92,5 +91,21 @@ switch ($operazione) {
|
|||
|
||||
flash()->info(tr('Impianto rimosso correttamente!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'load_checklist':
|
||||
$checks = Check::where('id_module_from', $id_modulo_impianti)->where('id_record_from', post('id_impianto'))->where('id_module', $id_module)->where('id_record', $id_record)->where('id_parent', null)->get();
|
||||
|
||||
$response = '';
|
||||
foreach ($checks as $check) {
|
||||
$response .= renderChecklist($check);
|
||||
}
|
||||
|
||||
/*echo json_encode([
|
||||
'checklist' => $response
|
||||
]);*/
|
||||
|
||||
echo $response;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ foreach ($impianti_collegati as $impianto) {
|
|||
echo '
|
||||
<tr data-id="'.$impianto['id'].'">
|
||||
<td class="text-left">
|
||||
<button type="button" class="btn btn-xs btn-default '.$class.'" onclick="toggleDettagli(this)">
|
||||
<button type="button" class="btn btn-xs btn-default '.$class.'" onclick="loadChecklist('.$impianto['id'].'); toggleDettagli(this);">
|
||||
<i class="fa fa-'.$icon.'"></i>
|
||||
</button>
|
||||
|
||||
|
@ -137,11 +137,8 @@ foreach ($impianti_collegati as $impianto) {
|
|||
<tr style="display: none">
|
||||
<td colspan="7">
|
||||
<table class="table">
|
||||
<tbody class="sort check-impianto" data-sonof="0">';
|
||||
foreach ($checks as $check) {
|
||||
echo renderChecklist($check);
|
||||
}
|
||||
echo '
|
||||
<tbody class="sort check-impianto" data-sonof="0" id="checklist_'.$impianto['id'].'">
|
||||
<span class="text-muted" id="loading-checks_'.$impianto['id'].'"><i class="fa fa-spin fa-spinner"></i> '.tr('Caricamento checklist').'...</span>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -209,88 +206,6 @@ function updateImpianto(id) {
|
|||
});
|
||||
}
|
||||
|
||||
sortable("#tab_checks .sort", {
|
||||
axis: "y",
|
||||
handle: ".handle",
|
||||
cursor: "move",
|
||||
dropOnEmpty: true,
|
||||
scroll: true,
|
||||
});
|
||||
|
||||
sortable_table = sortable("#tab_checks .sort").length;
|
||||
|
||||
for(i=0; i<sortable_table; i++){
|
||||
sortable("#tab_checks .sort")[i].addEventListener("sortupdate", function(e) {
|
||||
|
||||
var sonof = $(this).data("sonof");
|
||||
|
||||
let order = $(this).find(".sonof_"+sonof+"[data-id]").toArray().map(a => $(a).data("id"))
|
||||
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "update_position",
|
||||
order: order.join(","),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("textarea[name=\'note_checklist\']").keyup(function() {
|
||||
$(this).parent().parent().parent().find(".save-nota").removeClass("btn-default");
|
||||
$(this).parent().parent().parent().find(".save-nota").addClass("btn-success");
|
||||
});
|
||||
|
||||
function saveNota(id) {
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_note",
|
||||
note: $("#note_" + id).val(),
|
||||
id: id
|
||||
}, function() {
|
||||
alertPush();
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").removeClass("btn-success");
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").addClass("btn-default");
|
||||
});
|
||||
}
|
||||
|
||||
$(".check-impianto .checkbox").click(function(){
|
||||
if($(this).is(":checked")){
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_checkbox",
|
||||
id: $(this).attr("data-id"),
|
||||
},function(result){
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".text").css("text-decoration", "line-through");
|
||||
|
||||
parent = $(this).attr("data-id");
|
||||
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
|
||||
if(!$(this).is(":checked")){
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
$(this).parent().parent().find(".verificato").removeClass("hidden");
|
||||
$(this).parent().parent().find(".verificato").text("'.tr('Verificato da _USER_ il _DATE_', [
|
||||
'_USER_' => $user->username,
|
||||
'_DATE_' => dateFormat(date('Y-m-d')).' '.date('H:i'),
|
||||
]).'");
|
||||
}else{
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "remove_checkbox",
|
||||
id: $(this).attr("data-id"),
|
||||
},function(result){
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".text").css("text-decoration", "none");
|
||||
|
||||
parent = $(this).attr("data-id");
|
||||
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
|
||||
if($(this).is(":checked")){
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".verificato").addClass("hidden");
|
||||
}
|
||||
})
|
||||
|
||||
function delete_check(id){
|
||||
if(confirm("Eliminare questa checklist?")){
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
|
@ -305,4 +220,108 @@ function delete_check(id){
|
|||
function edit_check(id){
|
||||
launch_modal("Modifica checklist", "'.$checklist_module->fileurl('components/edit-check.php').'?id_record="+id, 1);
|
||||
}
|
||||
|
||||
function saveNota(id) {
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_note",
|
||||
note: $("#note_" + id).val(),
|
||||
id: id
|
||||
}, function() {
|
||||
renderMessages();
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").removeClass("btn-success");
|
||||
$("#note_" + id).parent().parent().parent().find(".save-nota").addClass("btn-default");
|
||||
});
|
||||
}
|
||||
|
||||
function loadChecklist(id){
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
id_module: globals.id_module,
|
||||
id_plugin: '.$id_plugin.',
|
||||
id_record: globals.id_record,
|
||||
op: "load_checklist",
|
||||
id_impianto: id,
|
||||
},
|
||||
success: function (response) {
|
||||
$("#loading-checks_" + id).hide();
|
||||
$("#checklist_" + id).html(response);
|
||||
init();
|
||||
|
||||
sortable("#tab_checks .sort", {
|
||||
axis: "y",
|
||||
handle: ".handle",
|
||||
cursor: "move",
|
||||
dropOnEmpty: true,
|
||||
scroll: true,
|
||||
});
|
||||
|
||||
sortable_table = sortable("#tab_checks .sort").length;
|
||||
|
||||
for(i=0; i<sortable_table; i++){
|
||||
sortable("#tab_checks .sort")[i].addEventListener("sortupdate", function(e) {
|
||||
|
||||
var sonof = $(this).data("sonof");
|
||||
|
||||
let order = $(this).find(".sonof_"+sonof+"[data-id]").toArray().map(a => $(a).data("id"))
|
||||
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "update_position",
|
||||
order: order.join(","),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("textarea[name=\'note_checklist\']").keyup(function() {
|
||||
$(this).parent().parent().parent().find(".save-nota").removeClass("btn-default");
|
||||
$(this).parent().parent().parent().find(".save-nota").addClass("btn-success");
|
||||
});
|
||||
|
||||
$(".check-impianto .checkbox").click(function(){
|
||||
if($(this).is(":checked")){
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_checkbox",
|
||||
id: $(this).attr("data-id"),
|
||||
},function(result){
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".text").css("text-decoration", "line-through");
|
||||
|
||||
parent = $(this).attr("data-id");
|
||||
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
|
||||
if(!$(this).is(":checked")){
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
$(this).parent().parent().find(".verificato").removeClass("hidden");
|
||||
$(this).parent().parent().find(".verificato").text("'.tr('Verificato da _USER_ il _DATE_', [
|
||||
'_USER_' => $user->username,
|
||||
'_DATE_' => dateFormat(date('Y-m-d')).' '.date('H:i'),
|
||||
]).'");
|
||||
}else{
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "remove_checkbox",
|
||||
id: $(this).attr("data-id"),
|
||||
},function(result){
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".text").css("text-decoration", "none");
|
||||
|
||||
parent = $(this).attr("data-id");
|
||||
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
|
||||
if($(this).is(":checked")){
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
|
||||
$(this).parent().parent().find(".verificato").addClass("hidden");
|
||||
}
|
||||
})
|
||||
},
|
||||
error: function() {
|
||||
renderMessages();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
|
|
|
@ -574,7 +574,7 @@ if (!empty($righe)) {
|
|||
<div class="box-header">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
{[ "type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.(new Module())->getByField('title', 'Articoli', Models\Locale::getPredefined()->id).'|codice='.urlencode($codice_principale).'&descrizione='.urlencode($riga['Descrizione']).'&prezzo_acquisto='.urlencode($riga['PrezzoUnitario']).'", "value": "'.$id_articolo.'", "label": "'.tr('Articolo').'", "extra": "data-id=\''.$key.'\'" ]}
|
||||
{["type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.(new Module())->getByField('title', 'Articoli', Models\Locale::getPredefined()->id).'|codice='.($codice_principale ? urlencode($codice_principale) : '').'&descrizione='.($riga['Descrizione'] ? urlencode($riga['Descrizione']) : '').'&prezzo_acquisto='. ($riga['PrezzoUnitario'] ? urlencode($riga['PrezzoUnitario']) : '').'", "value": "'.$id_articolo.'", "label": "'.tr('Articolo').'","extra": "data-id=\''.$key.'\'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
|
|
@ -196,7 +196,7 @@ class FatturaElettronica
|
|||
}
|
||||
|
||||
// Registrazione XML come allegato
|
||||
\Uploads::upload($this->file, array_merge($info, [
|
||||
\Uploads::upload(file_get_contents($this->file), array_merge($info, [
|
||||
'name' => tr('Fattura Elettronica'),
|
||||
'original_name' => basename($this->file),
|
||||
]));
|
||||
|
|
|
@ -107,9 +107,9 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||
}
|
||||
} elseif (isset($sm['Importo'])) {
|
||||
if ($sm['Tipo'] == 'SC') {
|
||||
$importo -= $sm['Importo'];
|
||||
$importo -= $sm['Importo'] * $linea['Quantita'];
|
||||
} else {
|
||||
$importo += $sm['Importo'];
|
||||
$importo += $sm['Importo'] * $linea['Quantita'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||
$importo = $linea['PrezzoUnitario'];
|
||||
}
|
||||
|
||||
$imponibile[$linea['AliquotaIVA']] = ($imponibile[$linea['AliquotaIVA']] ?? 0) + round($importo, 2);
|
||||
$imponibile[$linea['AliquotaIVA']] += round($importo, 2);
|
||||
}
|
||||
|
||||
// Aggiunta degli arrotondamenti IVA come righe indipendenti
|
||||
|
|
Loading…
Reference in New Issue