mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-08 07:38:54 +01:00
Bugfix e rimozione warnings
This commit is contained in:
parent
893d1b6081
commit
5f5e836652
@ -161,7 +161,7 @@ if (!empty($result_query) && $result_query != 'menu' && $result_query != 'custom
|
||||
|
||||
// Icona
|
||||
if (preg_match('/^color_(.+?)$/', $field, $m)) {
|
||||
$value = $r['color_title_'.$m[1]] ?: '';
|
||||
$value = isset($r['color_title_'.$m[1]]) ? $r['color_title_'.$m[1]] : '';
|
||||
|
||||
$column['class'] = 'text-center small';
|
||||
$column['data-background'] = $r[$field];
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
$result['idarticolo'] = isset($result['idarticolo']) ? $result['idarticolo'] : null;
|
||||
|
||||
// Articolo
|
||||
if (!isset($options['edit_articolo']) || !empty($options['edit_articolo'])) {
|
||||
echo '
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
$result['id'] = isset($result['id']) ? $result['id'] : null;
|
||||
|
||||
/*
|
||||
Form di inserimento riga documento
|
||||
*/
|
||||
|
@ -42,9 +42,10 @@ switch ($resource) {
|
||||
$rs = $dbo->fetchArray($query);
|
||||
foreach ($rs as $r) {
|
||||
if ($prev != $r['id_sottocategoria']) {
|
||||
$categoria = $dbo->fetchArray('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_categoria']))[0]['nome'];
|
||||
$categoria = $dbo->fetchOne('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_categoria']))['nome'];
|
||||
|
||||
$sottocategoria = $dbo->fetchArray('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_sottocategoria']))[0]['nome'];
|
||||
$sottocategoria = $dbo->fetchOne('SELECT `nome` FROM `mg_categorie` WHERE `id`='.prepare($r['id_sottocategoria']));
|
||||
$sottocategoria = isset($sottocategoria['nome']) ? $sottocategoria['nome'] : null;
|
||||
|
||||
$prev = $r['id_sottocategoria'];
|
||||
$results[] = ['text' => $categoria.' ('.(!empty($r['id_sottocategoria']) ? $sottocategoria : '-').')', 'children' => []];
|
||||
|
@ -41,7 +41,7 @@ $_SESSION['superselect']['id_categoria'] = $records[0]['id_categoria'];
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "number", "label": "<?php echo tr('Quantità'); ?>", "name": "qta", "required": 1, "value": "$qta$", "readonly": 1, "decimals": "qta", "min-value": "undefined" ]}
|
||||
<input type="hidden" id="old_qta" value="<?=$records[0]['qta']?>">
|
||||
<input type="hidden" id="old_qta" value="<?php echo $records[0]['qta']; ?>">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{[ "type": "checkbox", "label": "<?php echo tr('Modifica quantità manualmente'); ?>", "name": "qta_manuale", "value": 0, "help": "<?php echo tr('Seleziona per modificare manualmente la quantità'); ?>", "placeholder": "<?php echo tr('Quantità manuale'); ?>", "extra": "<?php echo ($records[0]['servizio']) ? 'disabled' : ''; ?>" ]}
|
||||
|
@ -12,7 +12,7 @@ include_once __DIR__.'/../../core.php';
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "value": "<?php echo $idanagrafica; ?>", "ajax-source": "clienti" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "value": "<?php echo $user['idanagrafica']; ?>", "ajax-source": "clienti" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -33,7 +33,7 @@ $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Sede'); ?>", "name": "idsede", "values": "query=SELECT 0 AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS( ' - ', nomesede, citta ) AS descrizione FROM an_sedi WHERE idanagrafica='$idanagrafica$'", "value": "$idsede$", "ajax-source": "sedi", "extra": "<?php echo $readonly; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Sede'); ?>", "name": "idsede", "values": "query=SELECT 0 AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS( ' - ', nomesede, citta ) AS descrizione FROM an_sedi WHERE idanagrafica='$idanagrafica$'", "value": "$idsede$", "ajax-source": "sedi" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -4,7 +4,6 @@ include_once __DIR__.'/../../../core.php';
|
||||
|
||||
$idriga = filter('idriga');
|
||||
|
||||
|
||||
//Lettura idanagrafica cliente e percentuale di sconto/rincaro in base al listino
|
||||
//$rs = $dbo->fetchArray('SELECT idanagrafica, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino_vendite FROM an_anagrafiche WHERE idanagrafica=.in_interventi.idanagrafica)) AS prc_sconto FROM in_interventi WHERE id='.prepare($id_record));
|
||||
//$idanagrafica = $rs[0]['idanagrafica'];
|
||||
@ -27,7 +26,6 @@ if (empty($idriga)) {
|
||||
}
|
||||
|
||||
(empty($idcontratto_riga)) ? $idcontratto_riga = $dbo->fetchArray('SELECT MAX(id) AS max_idcontratto_riga FROM `co_righe_contratti`')[0]['max_idcontratto_riga'] : '';
|
||||
|
||||
} else {
|
||||
$op = 'editriga';
|
||||
$button = '<i class="fa fa-edit"></i> '.tr('Modifica');
|
||||
@ -48,10 +46,6 @@ if (empty($idriga)) {
|
||||
$tipo_sconto = $rsr[0]['tipo_sconto'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Form di inserimento
|
||||
<form id="add-righe" action="'.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&idcontratto_riga='.$idcontratto_riga.'" method="post">
|
||||
@ -64,7 +58,6 @@ echo '
|
||||
|
||||
<input type="hidden" name="idcontratto_riga" value="'.$idcontratto_riga.'">';
|
||||
|
||||
|
||||
// Descrizione
|
||||
echo '
|
||||
<div class="row">
|
||||
@ -136,8 +129,6 @@ echo '
|
||||
|
||||
// Ricarico le righe
|
||||
$('#righe').load(globals.rootdir + '/modules/contratti/plugins/ajax_righe.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&idcontratto_riga=<?php echo $idcontratto_riga; ?>');
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ $mesi = [
|
||||
];
|
||||
|
||||
// Pianificazione fatture
|
||||
if ($get['op'] == 'add_fatturazione') {
|
||||
if (get('op') == 'add_fatturazione') {
|
||||
$prev_data = '';
|
||||
|
||||
// Azzero la pianificazione zone se era già stata fatta, per poter sostituire la pianificazione,
|
||||
@ -50,7 +50,7 @@ if ($get['op'] == 'add_fatturazione') {
|
||||
}
|
||||
|
||||
// Eliminazione pianificazione specifica
|
||||
elseif ($get['op'] == 'del_pianificazione') {
|
||||
elseif (get('op') == 'del_pianificazione') {
|
||||
$idpianificazione = $get['idpianificazione'];
|
||||
|
||||
$n = $dbo->fetchNum('SELECT id FROM co_ordiniservizio_pianificazionefatture WHERE id='.prepare($idpianificazione));
|
||||
@ -64,7 +64,7 @@ elseif ($get['op'] == 'del_pianificazione') {
|
||||
}
|
||||
|
||||
// Creazione fattura pianificata
|
||||
elseif ($get['op'] == 'addfattura') {
|
||||
elseif (get('op') == 'addfattura') {
|
||||
include_once $docroot.'/modules/fatture/modutil.php';
|
||||
|
||||
$idpianificazione = $get['idpianificazione'];
|
||||
|
@ -21,7 +21,7 @@ $mesi = [
|
||||
];
|
||||
|
||||
// Generazione ordini di servizio
|
||||
if ($get['op'] == 'add_ordineservizio') {
|
||||
if (get('op') == 'add_ordineservizio') {
|
||||
$prev_data = '';
|
||||
|
||||
// Ciclo fra le voci in arrivo dal form
|
||||
@ -49,7 +49,7 @@ if ($get['op'] == 'add_ordineservizio') {
|
||||
}
|
||||
|
||||
// Eliminazione pianificazione specifica
|
||||
elseif ($get['op'] == 'del_ordineservizio') {
|
||||
elseif (get('op') == 'del_ordineservizio') {
|
||||
$idordineservizio = $get['idordineservizio'];
|
||||
|
||||
$n = $dbo->fetchNum('SELECT id FROM co_ordiniservizio WHERE id='.prepare($idordineservizio)." AND stato='aperto'");
|
||||
|
@ -2,28 +2,22 @@
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
|
||||
|
||||
|
||||
// Pianificazione intervento
|
||||
switch (filter('op')) {
|
||||
|
||||
case 'add-pianifica':
|
||||
|
||||
$data_richiesta = filter('data_richiesta');
|
||||
$query = 'INSERT INTO `co_righe_contratti` ( `idcontratto`, `data_richiesta` ) VALUES ('.prepare($id_record).', '.prepare($data_richiesta).')';
|
||||
|
||||
if ($dbo->query($query)) {
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr("Errore durante l'aggiunta del promemoria!");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'edit-pianifica':
|
||||
|
||||
|
||||
$idcontratto_riga = filter('idcontratto_riga');
|
||||
|
||||
$data_richiesta = filter('data_richiesta');
|
||||
@ -31,7 +25,7 @@ switch (filter('op')) {
|
||||
$idtipointervento = filter('idtipointervento');
|
||||
$richiesta = filter('richiesta');
|
||||
$idsede = filter('idsede_c');
|
||||
$idimpianti = implode(",", $post['idimpianti']);
|
||||
$idimpianti = implode(',', $post['idimpianti']);
|
||||
|
||||
$query = 'UPDATE co_righe_contratti SET idtipointervento='.prepare($idtipointervento).', data_richiesta='.prepare($data_richiesta).', richiesta='.prepare($richiesta).', idsede='.prepare($idsede).', idimpianti='.prepare($idimpianti).' WHERE id = '.prepare($idcontratto_riga);
|
||||
|
||||
@ -39,7 +33,7 @@ switch (filter('op')) {
|
||||
if ($dbo->query($query)) {
|
||||
$_SESSION['infos'][] = tr('Promemoria inserito!');
|
||||
} else {
|
||||
$_SESSION['errors'][] = tr("Errore durante la modifica del promemoria!");
|
||||
$_SESSION['errors'][] = tr('Errore durante la modifica del promemoria!');
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -80,7 +74,6 @@ switch (filter('op')) {
|
||||
$parti_da_oggi = post('parti_da_oggi');
|
||||
|
||||
if (!empty($idcontratto_riga) && !empty($intervallo)) {
|
||||
|
||||
$qp = 'SELECT *, (SELECT idanagrafica FROM co_contratti WHERE id = '.$id_record.' ) AS idanagrafica, (SELECT data_conclusione FROM co_contratti WHERE id = '.$id_record.' ) AS data_conclusione, '.
|
||||
'(SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=co_righe_contratti.idtipointervento) AS tipointervento FROM co_righe_contratti '.
|
||||
'WHERE co_righe_contratti.id = '.$idcontratto_riga;
|
||||
@ -118,12 +111,10 @@ switch (filter('op')) {
|
||||
if ((date('Y-m-d', strtotime($data_richiesta)) >= $min_date) && (date('Y-m-d', strtotime($data_richiesta)) <= date('Y-m-d', strtotime($data_conclusione)))) {
|
||||
//Controllo che non esista già un promemoria idcontratto, idtipointervento e data_richiesta.
|
||||
if (count($dbo->fetchArray("SELECT id FROM co_righe_contratti WHERE data_richiesta = '".$data_richiesta."' AND idtipointervento = '".$idtipointervento."' AND idcontratto = '".$id_record."' ")) == 0) {
|
||||
|
||||
//inserisco il nuovo promemoria
|
||||
$query = 'INSERT INTO `co_righe_contratti`(`idcontratto`, `idtipointervento`, `data_richiesta`, `richiesta`, `idsede`, `idimpianti` ) VALUES('.prepare($id_record).', '.prepare($idtipointervento).', '.prepare($data_richiesta).', '.prepare($richiesta).', '.prepare($idsede).', '.prepare($idimpianti).')';
|
||||
|
||||
if ($dbo->query($query)) {
|
||||
|
||||
$idriga = $dbo->lastInsertedID();
|
||||
|
||||
//copio anche righe materiali nel nuovo promemoria
|
||||
@ -132,7 +123,6 @@ switch (filter('op')) {
|
||||
//copio righe articoli nel nuovo promemoria
|
||||
$dbo->query('INSERT INTO co_righe_contratti_articoli (idarticolo, id_riga_contratto,descrizione,prezzo_acquisto,prezzo_vendita,sconto, sconto_unitario, tipo_sconto,idiva,desc_iva,iva,idautomezzo, qta, um, abilita_serial, idimpianto) SELECT idarticolo, '.$idriga.',descrizione,prezzo_acquisto,prezzo_vendita,sconto,sconto_unitario,tipo_sconto,idiva,desc_iva,iva,idautomezzo, qta, um, abilita_serial, idimpianto FROM co_righe_contratti_articoli WHERE id_riga_contratto = '.$idcontratto_riga.' ');
|
||||
|
||||
|
||||
$_SESSION['infos'][] = tr('Promemoria intervento pianificato!');
|
||||
|
||||
//pianificare anche l' intervento?
|
||||
@ -200,11 +190,9 @@ switch (filter('op')) {
|
||||
// Collego gli impianti del promemoria all' intervento appena inserito
|
||||
$rs_idimpianti = explode(',', $idimpianti);
|
||||
foreach ($rs_idimpianti as $idimpianto) {
|
||||
$dbo->query('INSERT INTO my_impianti_interventi (idintervento, idimpianto) VALUES ('.$idintervento.', '.$idimpianto.' )' );
|
||||
$dbo->query('INSERT INTO my_impianti_interventi (idintervento, idimpianto) VALUES ('.$idintervento.', '.$idimpianto.' )');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $_SESSION['infos'][] = tr('Intervento '.$codice.' pianificato correttamente.');
|
||||
|
||||
$_SESSION['infos'][] = tr('Interventi pianificati correttamente.');
|
||||
@ -268,8 +256,6 @@ if (count($rsp) != 0) {
|
||||
|
||||
// Elenco promemoria
|
||||
for ($i = 0; $i < sizeof($rsp); ++$i) {
|
||||
|
||||
|
||||
// Sede
|
||||
if ($rsp[$i]['idsede'] == '-1') {
|
||||
echo '- '.('Nessuna').' -';
|
||||
@ -303,10 +289,10 @@ if (count($rsp) != 0) {
|
||||
|
||||
//info impianti
|
||||
$info_impianti = '';
|
||||
if (!empty($rsp[$i]['idimpianti'])){
|
||||
if (!empty($rsp[$i]['idimpianti'])) {
|
||||
$rsp3 = $dbo->fetchArray('SELECT id, matricola, nome FROM my_impianti WHERE id IN ('.($rsp[$i]['idimpianti']).')');
|
||||
if (!empty( $rsp3 )){
|
||||
for ($a=0; $a<count($rsp3); $a++){
|
||||
if (!empty($rsp3)) {
|
||||
for ($a = 0; $a < count($rsp3); ++$a) {
|
||||
$info_impianti .= Modules::link('MyImpianti', $rsp3[$a]['id'], tr('_NOME_ (_MATRICOLA_)', [
|
||||
'_NOME_' => $rsp3[$a]['nome'],
|
||||
'_MATRICOLA_' => $rsp3[$a]['matricola'],
|
||||
@ -315,15 +301,14 @@ if (count($rsp) != 0) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rsp4 = $dbo->fetchArray('SELECT id, descrizione,qta,um,prezzo_vendita, \'\' AS idarticolo FROM co_righe_contratti_materiali WHERE id_riga_contratto = '.prepare($rsp[$i]['id']).'
|
||||
UNION SELECT id, descrizione,qta,um,prezzo_vendita, idarticolo FROM co_righe_contratti_articoli WHERE id_riga_contratto = '.prepare($rsp[$i]['id']) );
|
||||
UNION SELECT id, descrizione,qta,um,prezzo_vendita, idarticolo FROM co_righe_contratti_articoli WHERE id_riga_contratto = '.prepare($rsp[$i]['id']));
|
||||
|
||||
$info_materiali = '';
|
||||
if (!empty( $rsp4 )){
|
||||
for ($b=0; $b<count($rsp4); $b++){
|
||||
if (!empty($rsp4)) {
|
||||
for ($b = 0; $b < count($rsp4); ++$b) {
|
||||
$info_materiali .= tr(' _QTA_ _UM_ x _DESC_', [
|
||||
'_DESC_' => ((!empty($rsp4[$b]['idarticolo'])) ? Modules::link('Articoli', $rsp4[$b]['idarticolo'], $rsp4[$b]['descrizione']) : $rsp4[$b]['descrizione'] ),
|
||||
'_DESC_' => ((!empty($rsp4[$b]['idarticolo'])) ? Modules::link('Articoli', $rsp4[$b]['idarticolo'], $rsp4[$b]['descrizione']) : $rsp4[$b]['descrizione']),
|
||||
'_QTA_' => Translator::numberToLocale($rsp4[$b]['qta']),
|
||||
'_UM_' => $rsp4[$b]['um'],
|
||||
'_PREZZO_' => $rsp4[$b]['prezzo_vendita'],
|
||||
@ -371,10 +356,8 @@ if (count($rsp) != 0) {
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo ' <button type="button" title="Aggiungi un nuovo promemoria da pianificare." data-toggle="tooltip" class="btn btn-primary" id="add_promemoria">
|
||||
<i class="fa fa-plus"></i> '.tr('Nuovo promemoria').'
|
||||
</button>';
|
||||
@ -425,7 +408,6 @@ echo '
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -433,22 +415,20 @@ echo '
|
||||
$( "#add_promemoria" ).click(function() {
|
||||
|
||||
swal({
|
||||
title: '<?php echo tr("Aggiungere un nuovo promemoria?") ?>',
|
||||
title: '<?php echo tr('Aggiungere un nuovo promemoria?'); ?>',
|
||||
type: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '<?php echo tr("Aggiungi") ?>',
|
||||
confirmButtonText: '<?php echo tr('Aggiungi'); ?>',
|
||||
confirmButtonClass: 'btn btn-lg btn-success',
|
||||
}).then(
|
||||
function (result) {
|
||||
prev_html = $("#add_promemoria").html();
|
||||
$("#add_promemoria").html("<i class='fa fa-spinner fa-pulse fa-fw'></i> <?php echo tr("Attendere...") ?>");
|
||||
$("#add_promemoria").html("<i class='fa fa-spinner fa-pulse fa-fw'></i> <?php echo tr('Attendere...'); ?>");
|
||||
$("#add_promemoria").prop('disabled', true);
|
||||
|
||||
$.post( "<?php echo $rootdir ?>/editor.php?id_module=<?php echo Modules::get('Contratti')['id'] ?>&id_record=<?php echo $id_record ?>", { backto: "record-edit", op: "add-pianifica", data_richiesta: '<?php echo date('Y-m-d'); ?>' })
|
||||
$.post( "<?php echo $rootdir; ?>/editor.php?id_module=<?php echo Modules::get('Contratti')['id']; ?>&id_record=<?php echo $id_record; ?>", { backto: "record-edit", op: "add-pianifica", data_richiesta: '<?php echo date('Y-m-d'); ?>' })
|
||||
.done(function( data ) {
|
||||
|
||||
//$('#righe').load(globals.rootdir + '/modules/contratti/plugins/ajax_righe.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&idcontratto_riga=<?php echo $idcontratto_riga; ?>');
|
||||
launch_modal('Nuovo promemoria', '<?php echo $rootdir ?>/modules/contratti/plugins/addpianficazione.php?id_module=<?php echo Modules::get('Contratti')['id'] ?>&id_plugin=<?php echo Plugins::get('Pianificazione interventi')['id'] ?>&ref=interventi_contratti&id_record=<?php echo $id_record?>', 1, '#bs-popup');
|
||||
launch_modal('Nuovo promemoria', '<?php echo $rootdir; ?>/modules/contratti/plugins/addpianficazione.php?id_module=<?php echo Modules::get('Contratti')['id']; ?>&id_plugin=<?php echo Plugins::get('Pianificazione interventi')['id']; ?>&ref=interventi_contratti&id_record=<?php echo $id_record; ?>', 1, '#bs-popup');
|
||||
|
||||
$("#add_promemoria").html(prev_html);
|
||||
$("#add_promemoria").prop('disabled', false);
|
||||
|
@ -22,10 +22,8 @@ echo '
|
||||
</thead>
|
||||
<tbody class="sortable">';
|
||||
|
||||
// se ho almeno un articolo caricato mostro la riga
|
||||
if (!empty($rs)) {
|
||||
foreach ($rs as $r) {
|
||||
// descrizione
|
||||
foreach ($rs as $r) {
|
||||
// Descrizione
|
||||
echo '
|
||||
<tr data-id="'.$r['id'].'">
|
||||
<td>';
|
||||
@ -38,7 +36,7 @@ if (!empty($rs)) {
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// q.tà
|
||||
// Q.tà
|
||||
echo '
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
@ -58,7 +56,7 @@ if (!empty($rs)) {
|
||||
echo '
|
||||
</td>';
|
||||
|
||||
// costo unitario
|
||||
// Costo unitario
|
||||
echo '
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
@ -76,7 +74,7 @@ if (!empty($rs)) {
|
||||
echo'
|
||||
</td>';
|
||||
|
||||
// iva
|
||||
// IVA
|
||||
echo '
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
@ -131,23 +129,19 @@ if (!empty($rs)) {
|
||||
echo '
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
// Calcoli
|
||||
$imponibile = sum(array_column($rs, 'subtotale'));
|
||||
$sconto = sum(array_column($rs, 'sconto'));
|
||||
$iva = sum(array_column($rs, 'iva'));
|
||||
|
||||
// Calcoli
|
||||
$imponibile = sum(array_column($rs, 'subtotale'));
|
||||
$sconto = sum(array_column($rs, 'sconto'));
|
||||
$iva = sum(array_column($rs, 'iva'));
|
||||
$imponibile_scontato = sum($imponibile, -$sconto);
|
||||
|
||||
$imponibile_scontato = sum($imponibile, -$sconto);
|
||||
|
||||
$totale = sum([
|
||||
$totale = sum([
|
||||
$imponibile_scontato,
|
||||
$iva,
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
echo '
|
||||
</tbody>';
|
||||
|
@ -10,6 +10,13 @@ unset($_SESSION['superselect']['idsede']);
|
||||
$idanagrafica = filter('idanagrafica');
|
||||
$idsede = filter('idsede');
|
||||
|
||||
$idimpianto = null;
|
||||
$idzona = null;
|
||||
$idtipointervento = null;
|
||||
$idstatointervento = null;
|
||||
$idtecnico = null;
|
||||
$richiesta = null;
|
||||
|
||||
$impianti = [];
|
||||
|
||||
if (!empty($idanagrafica)) {
|
||||
@ -39,8 +46,6 @@ if (!empty($idcontratto) && !empty($idordineservizio)) {
|
||||
$idanagrafica = $rs[0]['idanagrafica'];
|
||||
$idzona = $rs[0]['idzona'];
|
||||
|
||||
|
||||
|
||||
// Info riga pianificata
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_ordiniservizio WHERE idcontratto='.prepare($idcontratto).' AND id='.prepare($idordineservizio));
|
||||
$data = $rs[0]['data_scadenza'];
|
||||
@ -61,10 +66,10 @@ elseif (!empty($idcontratto) && !empty($idcontratto_riga)) {
|
||||
$idanagrafica = $rs[0]['idanagrafica'];
|
||||
$idzona = $rs[0]['idzona'];
|
||||
|
||||
//aumento orario inizio del tempo standard definito dalla tipologia dell'intervento (PRESO DAL CONTRATTO)
|
||||
if (!empty($rs[0]['tempo_standard']))
|
||||
$orario_fine = date('H:i', strtotime($orario_inizio) + ((60 * 60 ) * $rs[0]['tempo_standard']));
|
||||
|
||||
// aumento orario inizio del tempo standard definito dalla tipologia dell'intervento (PRESO DAL CONTRATTO)
|
||||
if (!empty($rs[0]['tempo_standard'])) {
|
||||
$orario_fine = date('H:i', strtotime($orario_inizio) + ((60 * 60) * $rs[0]['tempo_standard']));
|
||||
}
|
||||
|
||||
// Info riga pianificata
|
||||
$rs = $dbo->fetchArray('SELECT *, (SELECT tempo_standard FROM in_tipiintervento WHERE idtipointervento = co_righe_contratti.idtipointervento) AS tempo_standard FROM co_righe_contratti WHERE idcontratto='.prepare($idcontratto).' AND id='.prepare($idcontratto_riga));
|
||||
@ -74,16 +79,16 @@ elseif (!empty($idcontratto) && !empty($idcontratto_riga)) {
|
||||
$idsede = $rs[0]['idsede'];
|
||||
$idimpianti = $rs[0]['idimpianti'];
|
||||
|
||||
//aumento orario inizio del tempo standard definito dalla tipologia dell'intervento (PRESO DAL PROMEMORIA)
|
||||
if (!empty($rs[0]['tempo_standard']))
|
||||
$orario_fine = date('H:i', strtotime($orario_inizio) + ((60 * 60 ) * $rs[0]['tempo_standard']));
|
||||
// aumento orario inizio del tempo standard definito dalla tipologia dell'intervento (PRESO DAL PROMEMORIA)
|
||||
if (!empty($rs[0]['tempo_standard'])) {
|
||||
$orario_fine = date('H:i', strtotime($orario_inizio) + ((60 * 60) * $rs[0]['tempo_standard']));
|
||||
}
|
||||
|
||||
|
||||
//se gli impianti non sono stati definiti nel promemoria, carico tutti gli impianti a contratto
|
||||
if (empty($idimpianti)){
|
||||
// se gli impianti non sono stati definiti nel promemoria, carico tutti gli impianti a contratto
|
||||
if (empty($idimpianti)) {
|
||||
$rs = $dbo->fetchArray('SELECT idimpianto FROM my_impianti_contratti WHERE idcontratto='.prepare($idcontratto));
|
||||
$idimpianto = implode(',', array_column($rs, 'idimpianto'));
|
||||
}else{
|
||||
} else {
|
||||
$idimpianto = $idimpianti;
|
||||
}
|
||||
|
||||
@ -119,7 +124,7 @@ if (empty($new_codice)) {
|
||||
|
||||
<form action="" method="post" id="add-form" id="add-form" onsubmit="if($(this).parsley().validate()) { return add_intervento(); }">
|
||||
<input type="hidden" name="op" value="add">
|
||||
<input type="hidden" name="ref" value="<?php echo $_GET['ref']; ?>">
|
||||
<input type="hidden" name="ref" value="<?php echo get('ref'); ?>">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<!-- DATI CLIENTE -->
|
||||
@ -148,7 +153,7 @@ if (empty($new_codice)) {
|
||||
<!-- RIGA 2 -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "select", "label": "<?php echo tr('Preventivo'); ?>", "name": "idpreventivo", "value": "<?php echo $idpreventivo; ?>", "placeholder": "<?php echo tr('Seleziona prima un cliente'); ?>...", "ajax-source": "preventivi" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Preventivo'); ?>", "name": "idpreventivo", "placeholder": "<?php echo tr('Seleziona prima un cliente'); ?>...", "ajax-source": "preventivi" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
@ -162,7 +167,7 @@ if (empty($new_codice)) {
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "label": "<?php echo tr('Componenti'); ?>", "multiple": 1, "name": "componenti[]", "value": "<?php echo $componenti; ?>", "placeholder": "<?php echo tr('Seleziona prima un impianto'); ?>...", "ajax-source": "componenti" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Componenti'); ?>", "multiple": 1, "name": "componenti[]", "placeholder": "<?php echo tr('Seleziona prima un impianto'); ?>...", "ajax-source": "componenti" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,11 +191,11 @@ if (empty($new_codice)) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "date", "label": "<?php echo tr('Data intervento'); ?>", "name": "data", "required": <?php echo ($get['ref']) ? 1 : 0; ?>, "value": "<?php echo $data; ?>" ]}
|
||||
{[ "type": "date", "label": "<?php echo tr('Data intervento'); ?>", "name": "data", "required": <?php echo get('ref') ? 1 : 0; ?>, "value": "<?php echo $data; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY nome", "value": "<?php echo $idzona; ?>", "placeholder": "<?php echo tr('Nessuna zona'); ?>", "help":"<?php echo 'La zona viene definita automaticamente in base al cliente selezionato' ?>.", "extra": "readonly" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Zona'); ?>", "name": "idzona", "values": "query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY nome", "value": "<?php echo $idzona; ?>", "placeholder": "<?php echo tr('Nessuna zona'); ?>", "help":"<?php echo 'La zona viene definita automaticamente in base al cliente selezionato'; ?>.", "extra": "readonly" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -205,18 +210,18 @@ if (empty($new_codice)) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "time", "label": "<?php echo tr('Orario inizio'); ?>", "name": "orario_inizio", "required": <?php echo ($get['ref']) ? 1 : 0; ?>, "value": "<?php echo $orario_inizio; ?>" ]}
|
||||
{[ "type": "time", "label": "<?php echo tr('Orario inizio'); ?>", "name": "orario_inizio", "required": <?php echo get('ref') ? 1 : 0; ?>, "value": "<?php echo $orario_inizio; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "time", "label": "<?php echo tr('Orario fine'); ?>", "name": "orario_fine", "required": <?php echo ($get['ref']) ? 1 : 0; ?>, "value": "<?php echo $orario_fine; ?>" ]}
|
||||
{[ "type": "time", "label": "<?php echo tr('Orario fine'); ?>", "name": "orario_fine", "required": <?php echo get('ref') ? 1 : 0; ?>, "value": "<?php echo $orario_fine; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RIGA 5 -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "label": "<?php echo tr('Tecnici'); ?>", "multiple": "1", "name": "idtecnico[]", "required": <?php echo ($get['ref']) ? 1 : 0; ?>, "ajax-source": "tecnici", "value": "<?php echo $idtecnico; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Tecnici'); ?>", "multiple": "1", "name": "idtecnico[]", "required": <?php echo get('ref') ? 1 : 0; ?>, "ajax-source": "tecnici", "value": "<?php echo $idtecnico; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
@ -306,7 +311,7 @@ if (empty($new_codice)) {
|
||||
}else{
|
||||
$('#idzona').val('').change();
|
||||
}
|
||||
//session_set('superselect,idzona', $(this).selectData().idzona, 0);
|
||||
// session_set('superselect,idzona', $(this).selectData().idzona, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -323,7 +328,7 @@ if (empty($new_codice)) {
|
||||
}else{
|
||||
$('#idzona').val('').change();
|
||||
}
|
||||
//session_set('superselect,idzona', $(this).selectData().idzona, 0);
|
||||
// session_set('superselect,idzona', $(this).selectData().idzona, 0);
|
||||
}
|
||||
|
||||
});
|
||||
@ -355,9 +360,9 @@ if (empty($new_codice)) {
|
||||
|
||||
$('#idtipointervento').change( function(){
|
||||
|
||||
if ( (($(this).selectData().tempo_standard)>0) && ('<?php echo filter('orario_fine') ?>' == '')){
|
||||
//data = moment('<?php echo $data.' '.$orario_inizio ?>').format('YYYY-MM-DD HH:mm
|
||||
data = moment( moment().format('YYYY-MM-DD') + '<?php echo ' '.$orario_inizio ?>').format('YYYY-MM-DD HH:mm');
|
||||
if ( (($(this).selectData().tempo_standard)>0) && ('<?php echo filter('orario_fine'); ?>' == '')){
|
||||
// data = moment('<?php echo $data.' '.$orario_inizio; ?>').format('YYYY-MM-DD HH:mm
|
||||
data = moment( moment().format('YYYY-MM-DD') + '<?php echo ' '.$orario_inizio; ?>').format('YYYY-MM-DD HH:mm');
|
||||
tempo_standard = $(this).selectData().tempo_standard;
|
||||
orario_fine = moment(data).add(tempo_standard, 'hours').format("HH:mm");
|
||||
$('input[name=orario_fine]').val(orario_fine);
|
||||
@ -366,15 +371,17 @@ if (empty($new_codice)) {
|
||||
});
|
||||
|
||||
$('#idtecnico').change( function(){
|
||||
<?php if (!$get['ref']){ ?>
|
||||
<?php if (!get('ref')) {
|
||||
?>
|
||||
var value = ($(this).val()>0) ? true : false;
|
||||
$('#orario_inizio').prop("required", value);
|
||||
$('#orario_fine').prop("required", value);
|
||||
$('#data').prop("required", value);
|
||||
<?php } ?>
|
||||
<?php
|
||||
} ?>
|
||||
});
|
||||
|
||||
var ref = "<?php echo $get['ref']; ?>";
|
||||
var ref = "<?php echo get('ref'); ?>";
|
||||
|
||||
function add_intervento(){
|
||||
// Se l'aggiunta intervento proviene dal calendario, faccio il submit via ajax e ricarico gli eventi...
|
||||
|
@ -32,7 +32,6 @@ switch (post('op')) {
|
||||
if ($dbo->query($query)) {
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
?><form action="<?php echo ROOTDIR ?>/editor.php?id_module=<?php echo Modules::get('Modelli prima nota')['id']; ?>" method="post" id="add-form">
|
||||
?><form action="" method="post" id="add-form">
|
||||
<input type="hidden" name="op" value="add">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "<?php echo $descrizione; ?>" ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1 ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -27,22 +27,14 @@ include_once __DIR__.'/../../core.php';
|
||||
</tr>';
|
||||
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$required = ($i <= 1) ? 1 : 0;
|
||||
|
||||
($i<=1) ? $required = 1 : $required = 0;
|
||||
// Conto
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
{[ "type": "select", "name": "idconto['.$i.']", "value": "';
|
||||
if ($i == 0) {
|
||||
echo $idconto_controparte;
|
||||
} elseif ($i == 1) {
|
||||
echo $idconto_aziendale;
|
||||
}
|
||||
echo '", "ajax-source": "conti", "required": "'.$required.'" ]}
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
{[ "type": "select", "name": "idconto['.$i.']", "ajax-source": "conti", "required": "'.$required.'" ]}
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
@ -56,21 +48,5 @@ include_once __DIR__.'/../../core.php';
|
||||
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready( function(){
|
||||
$('select').on('change', function(){
|
||||
if($(this).parent().parent().find('input[disabled]').length != 1){
|
||||
if($(this).val()) {
|
||||
$(this).parent().parent().find('input').prop("disabled", false);
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().find('input').prop("disabled", true);
|
||||
$(this).parent().parent().find('input').val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
|
||||
|
@ -16,15 +16,15 @@ include_once __DIR__.'/../../core.php';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
$conti3 = []; // contenitore conti di terzo livello
|
||||
$idmastrino = $records[0]['idmastrino'];
|
||||
$conti3 = []; // contenitore conti di terzo livello
|
||||
$idmastrino = $records[0]['idmastrino'];
|
||||
|
||||
// Salvo l'elenco conti in un array (per non fare il ciclo ad ogni riga)
|
||||
$query2 = 'SELECT * FROM co_pianodeiconti2';
|
||||
$conti2 = $dbo->fetchArray($query2);
|
||||
for ($x = 0; $x < sizeof($conti2); ++$x) {
|
||||
// Salvo l'elenco conti in un array (per non fare il ciclo ad ogni riga)
|
||||
$query2 = 'SELECT * FROM co_pianodeiconti2';
|
||||
$conti2 = $dbo->fetchArray($query2);
|
||||
for ($x = 0; $x < sizeof($conti2); ++$x) {
|
||||
$query3 = 'SELECT * FROM co_pianodeiconti3 WHERE idpianodeiconti2='.prepare($conti2[$x]['id']);
|
||||
$rs3 = $dbo->fetchArray($query3);
|
||||
for ($y = 0; $y < sizeof($rs3); ++$y) {
|
||||
@ -32,43 +32,34 @@ include_once __DIR__.'/../../core.php';
|
||||
$conti3[$rs3[$y]['idpianodeiconti2']][$y]['id'] = $rs3[$y]['id'];
|
||||
$conti3[$rs3[$y]['idpianodeiconti2']][$y]['descrizione'] = $conti2[$x]['numero'].'.'.$rs3[$y]['numero'].' '.$rs3[$y]['descrizione'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Form di modifica riga movimento
|
||||
*/
|
||||
// Lettura movimenti del mastrino selezionato
|
||||
$query = 'SELECT * FROM co_movimenti_modelli WHERE idmastrino='.prepare($records[0]['idmastrino']);
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$n = sizeof($rs);
|
||||
|
||||
echo '
|
||||
*/
|
||||
echo '
|
||||
<table class="table table-striped table-condensed table-hover table-bordered"
|
||||
<tr>
|
||||
<th>'.tr('Conto').'</th>
|
||||
</tr>';
|
||||
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
|
||||
($i<=1) ? $required = 1 : $required = 0;
|
||||
// Lettura movimenti del mastrino selezionato
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_movimenti_modelli WHERE idmastrino='.prepare($records[0]['idmastrino']));
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$required = ($i <= 1) ? 1 : 0;
|
||||
|
||||
// Conto
|
||||
echo '
|
||||
<tr>
|
||||
<td>
|
||||
{[ "type": "select", "name": "idconto['.$i.']", "value": "'.$rs[$i]['idconto'].'", "ajax-source": "conti", "required": "'.$required.'" ]}
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Totale per controllare sbilancio
|
||||
|
||||
// Verifica sbilancio
|
||||
echo '
|
||||
echo '
|
||||
</table>';
|
||||
?>
|
||||
?>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -2,15 +2,17 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
if (get('source') == 'Attività') {
|
||||
$source = get('source');
|
||||
$idanagrafica = null;
|
||||
|
||||
if ($source == 'Attività') {
|
||||
$idanagrafica = $_SESSION['superselect']['idanagrafica'];
|
||||
$source = get('source');
|
||||
}
|
||||
|
||||
?><form action="" method="post" id="add-form">
|
||||
<input type="hidden" name="op" value="add">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="source" value="<?=$source?>">
|
||||
<input type="hidden" name="source" value="<?php echo $source; ?>">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
@ -22,7 +24,7 @@ if (get('source') == 'Attività') {
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Cliente' AND deleted=0 ORDER BY ragione_sociale", "value": "<?=$idanagrafica?>", "ajax-source": "clienti" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Cliente' AND deleted=0 ORDER BY ragione_sociale", "value": "<?php echo $idanagrafica; ?>", "ajax-source": "clienti" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
@ -79,7 +79,7 @@ switch (filter('op')) {
|
||||
}
|
||||
|
||||
// Componenti non ancora collegati
|
||||
if ($id_list == '') {
|
||||
if (empty($id_list)) {
|
||||
$id_list = '0';
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ if ($module['name'] == 'Ordini cliente') {
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo $tipo_anagrafica; ?>", "name": "idanagrafica", "required": 1, "value": "", "value": "<?php echo $idanagrafica; ?>", "ajax-source": "<?php echo $ajax; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo $tipo_anagrafica; ?>", "name": "idanagrafica", "required": 1, "value": "", "value": "<?php echo $user['idanagrafica']; ?>", "ajax-source": "<?php echo $ajax; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -6,10 +6,10 @@ switch ($resource) {
|
||||
case 'conti':
|
||||
$query = 'SELECT co_pianodeiconti2.* FROM co_pianodeiconti2 LEFT JOIN co_pianodeiconti3 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id |where| GROUP BY co_pianodeiconti2.id';
|
||||
|
||||
if($search!=''){
|
||||
$wh = "WHERE (co_pianodeiconti3.descrizione LIKE ".prepare('%'.$search.'%')." OR CONCAT( co_pianodeiconti2.numero, '.', co_pianodeiconti3.numero ) LIKE ".prepare("%".$search."%").")";
|
||||
}else{
|
||||
$wh = "";
|
||||
if ($search != '') {
|
||||
$wh = 'WHERE (co_pianodeiconti3.descrizione LIKE '.prepare('%'.$search.'%')." OR CONCAT( co_pianodeiconti2.numero, '.', co_pianodeiconti3.numero ) LIKE ".prepare('%'.$search.'%').')';
|
||||
} else {
|
||||
$wh = '';
|
||||
}
|
||||
$query = str_replace('|where|', $wh, $query);
|
||||
|
||||
@ -24,7 +24,7 @@ switch ($resource) {
|
||||
$search_fields = [];
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'id='.prepare($element);
|
||||
$filter[] = 'co_pianodeiconti3.id='.prepare($element);
|
||||
}
|
||||
if (!empty($filter)) {
|
||||
$where[] = '('.implode(' OR ', $filter).')';
|
||||
@ -33,7 +33,7 @@ switch ($resource) {
|
||||
$where[] = 'idpianodeiconti2='.prepare($r['id']);
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = "(co_pianodeiconti3.descrizione LIKE ".prepare('%'.$search.'%')." OR CONCAT( co_pianodeiconti2.numero, '.', co_pianodeiconti3.numero ) LIKE ".prepare("%".$search."%").")";
|
||||
$search_fields[] = '(co_pianodeiconti3.descrizione LIKE '.prepare('%'.$search.'%')." OR CONCAT( co_pianodeiconti2.numero, '.', co_pianodeiconti3.numero ) LIKE ".prepare('%'.$search.'%').')';
|
||||
}
|
||||
if (!empty($search_fields)) {
|
||||
$where[] = '('.implode(' OR ', $search_fields).')';
|
||||
@ -47,7 +47,7 @@ switch ($resource) {
|
||||
|
||||
$rs2 = $dbo->fetchArray($subquery);
|
||||
foreach ($rs2 as $r2) {
|
||||
$results[count($results) - 1]['children'][] = ['id' => $r2['id'], 'text' => $r['numero'].".".$r2['numero']." ".$r2['descrizione']];
|
||||
$results[count($results) - 1]['children'][] = ['id' => $r2['id'], 'text' => $r['numero'].'.'.$r2['numero'].' '.$r2['descrizione']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,15 @@ include_once __DIR__.'/../../core.php';
|
||||
{[ "type": "text", "label": "<?php echo tr('Nome preventivo'); ?>", "name": "nome", "required": 1, "value": "" ]}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione, idtipointervento_default FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE (descrizione='Cliente') AND deleted=0 ORDER BY ragione_sociale", "value": "", "value": "<?php echo $idanagrafica; ?>", "ajax-source": "clienti", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Cliente" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione, idtipointervento_default FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE (descrizione='Cliente') AND deleted=0 ORDER BY ragione_sociale", "value": "", "value": "<?php echo $user['idanagrafica']; ?>", "ajax-source": "clienti", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Cliente" ]}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Tipo di Attività'); ?>", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento", "value": "<?php echo $idtipointervento; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Tipo di Attività'); ?>", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento" ]}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -104,7 +104,7 @@ function get_imponibile_preventivo($idpreventivo)
|
||||
$query = 'SELECT SUM(co_righe_preventivi.subtotale - co_righe_preventivi.sconto) AS imponibile FROM co_righe_preventivi GROUP BY idpreventivo HAVING idpreventivo='.prepare($idpreventivo);
|
||||
$rs = $dbo->fetchArray($query);
|
||||
|
||||
return $rs[0]['imponibile'];
|
||||
return isset($rs[0]['imponibile']) ? $rs[0]['imponibile'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -299,10 +299,8 @@ echo '
|
||||
'.Prints::getLink('Consuntivo preventivo', $id_record, 'btn-primary', tr('Stampa consuntivo')).'
|
||||
</div>';
|
||||
|
||||
/*
|
||||
Aggiunta interventi se il preventivo é aperto o in attesa o pagato (non si possono inserire interventi collegati ad altri preventivi)
|
||||
*/
|
||||
if ($stato == 'Accettato' || $stato == 'In lavorazione' || $stato = 'Pagato') {
|
||||
// Aggiunta interventi se il preventivo é aperto o in attesa o pagato (non si possono inserire interventi collegati ad altri preventivi)
|
||||
if (in_array($records[0]['stato'], ['Accettato', 'In lavorazione', 'Pagato'])) {
|
||||
echo '
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="op" value="addintervento">
|
||||
|
@ -24,8 +24,7 @@ echo '
|
||||
<tbody class="sortable">';
|
||||
|
||||
// se ho almeno un articolo caricato mostro la riga
|
||||
if (!empty($rs)) {
|
||||
foreach ($rs as $r) {
|
||||
foreach ($rs as $r) {
|
||||
echo '
|
||||
<tr data-id="'.$r['id'].'">
|
||||
<td>';
|
||||
@ -44,7 +43,7 @@ if (!empty($rs)) {
|
||||
<td class="text-right">';
|
||||
if (empty($r['is_descrizione'])) {
|
||||
echo '
|
||||
'.Translator::numberToLocale($r['qta'] - $r['qta_evasa']);
|
||||
'.Translator::numberToLocale($r['qta']);
|
||||
}
|
||||
echo '
|
||||
</td>';
|
||||
@ -128,7 +127,6 @@ if (!empty($rs)) {
|
||||
echo '
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Calcoli
|
||||
|
@ -23,7 +23,7 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
$nota_accredito = false;
|
||||
|
||||
if( $tipo_doc == 'Nota di accredito' ){
|
||||
if ($tipo_doc == 'Nota di accredito') {
|
||||
$nota_accredito = true;
|
||||
}
|
||||
|
||||
@ -189,10 +189,10 @@ include_once __DIR__.'/../../core.php';
|
||||
}
|
||||
|
||||
// Se è una nota di accredito, inverto i valori
|
||||
if( $nota_accredito ){
|
||||
if ($nota_accredito) {
|
||||
$tmp = $value_dare;
|
||||
$value_dare = $value_avere;
|
||||
$value_avere= $tmp;
|
||||
$value_avere = $tmp;
|
||||
}
|
||||
|
||||
// Dare
|
||||
|
@ -45,13 +45,13 @@ $month = intval($d1->format('m')) - 1;
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$month = $month % 12;
|
||||
|
||||
if (intval($fatturato[$i]['month']) != $month + 1) {
|
||||
if (!isset($fatturato[$i]) || intval($fatturato[$i]['month']) != $month + 1) {
|
||||
array_splice($fatturato, $i, 0, [[
|
||||
'totale' => 0,
|
||||
]]);
|
||||
}
|
||||
|
||||
if (intval($acquisti[$i]['month']) != $month + 1) {
|
||||
if (!isset($acquisti[$i]) || intval($acquisti[$i]['month']) != $month + 1) {
|
||||
array_splice($acquisti, $i, 0, [[
|
||||
'totale' => 0,
|
||||
]]);
|
||||
@ -215,7 +215,7 @@ foreach ($tipi as $tipo) {
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$month = $month % 12;
|
||||
|
||||
if (intval($interventi[$i]['month']) != $month + 1) {
|
||||
if (!isset($interventi[$i]) || intval($interventi[$i]['month']) != $month + 1) {
|
||||
array_splice($interventi, $i, 0, [[
|
||||
'totale' => 0,
|
||||
]]);
|
||||
|
@ -4,8 +4,8 @@ include_once __DIR__.'/../../core.php';
|
||||
|
||||
$records = $dbo->fetchArray('SELECT in_tariffe.id AS idtariffa, in_tipiintervento.idtipointervento, idtecnico, ragione_sociale, descrizione, in_tariffe.costo_ore, in_tariffe.costo_km, in_tariffe.costo_dirittochiamata, in_tariffe.costo_ore_tecnico, in_tariffe.costo_km_tecnico, in_tariffe.costo_dirittochiamata_tecnico FROM ((in_tariffe INNER JOIN an_anagrafiche ON in_tariffe.idtecnico=an_anagrafiche.idanagrafica) LEFT OUTER JOIN in_tipiintervento ON in_tariffe.idtipointervento=in_tipiintervento.idtipointervento) WHERE in_tariffe.id='.prepare($id_record));
|
||||
|
||||
//Se non ci sono record nelle tariffe leggo i dati del tecnico singolarmente e creo l'associazione tecnico-tariffe nel primo submit
|
||||
if ($records[0]['idtariffa'] != $id_record) {
|
||||
// Se non ci sono record nelle tariffe leggo i dati del tecnico singolarmente e creo l'associazione tecnico-tariffe nel primo submit
|
||||
if (isset($records[0]) && $records[0]['idtariffa'] != $id_record) {
|
||||
$v = explode('|', $id_record);
|
||||
|
||||
$idanagrafica = $v[0];
|
||||
|
@ -43,8 +43,10 @@ class App
|
||||
*/
|
||||
public static function getCurrentModule()
|
||||
{
|
||||
if (empty(self::$current_module)) {
|
||||
self::$current_module = Modules::get(filter('id_module'));
|
||||
$id = filter('id_module');
|
||||
|
||||
if (empty(self::$current_module) && !empty($id)) {
|
||||
self::$current_module = Modules::get($id);
|
||||
}
|
||||
|
||||
return self::$current_module;
|
||||
|
@ -74,8 +74,8 @@ class FileManager implements ManagerInterface
|
||||
<i class="fa fa-download"></i>
|
||||
</a>';
|
||||
|
||||
//Anteprime supportate dal browser
|
||||
$extension = strtolower(end((explode('.', $r['original']))));
|
||||
// Anteprime supportate dal browser
|
||||
$extension = pathinfo($r['original'])['extension'];
|
||||
$supported_extensions = ['pdf', 'jpg', 'png', 'gif', 'jpeg', 'bmp'];
|
||||
if (in_array($extension, $supported_extensions)) {
|
||||
$result .= "<div class='hide' id='view-".$r['id']."' >";
|
||||
|
@ -80,6 +80,7 @@ class Mail extends PHPMailer\PHPMailer\PHPMailer
|
||||
$results = $database->fetchArray('SELECT * FROM zz_emails WHERE deleted = 0');
|
||||
|
||||
$templates = [];
|
||||
$references = [];
|
||||
|
||||
// Inizializzazione dei riferimenti
|
||||
foreach (Modules::getModules() as $module) {
|
||||
@ -109,11 +110,13 @@ class Mail extends PHPMailer\PHPMailer\PHPMailer
|
||||
*/
|
||||
public static function getTemplate($template)
|
||||
{
|
||||
$templates = self::getTemplates();
|
||||
|
||||
if (!is_numeric($template) && !empty(self::$references[$template])) {
|
||||
$template = self::$references[$template];
|
||||
}
|
||||
|
||||
return self::getTemplates()[$template];
|
||||
return $templates[$template];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,13 +44,14 @@ class Modules
|
||||
$results = $database->fetchArray('SELECT * FROM `zz_modules` LEFT JOIN (SELECT `idmodule`, `permessi` FROM `zz_permissions` WHERE `idgruppo` = (SELECT `idgruppo` FROM `zz_users` WHERE `id` = '.prepare($user['id_utente']).')) AS `zz_permissions` ON `zz_modules`.`id`=`zz_permissions`.`idmodule`');
|
||||
|
||||
$modules = [];
|
||||
$references = [];
|
||||
|
||||
foreach ($results as $result) {
|
||||
$result['options'] = App::replacePlaceholder($result['options']);
|
||||
$result['options2'] = App::replacePlaceholder($result['options2']);
|
||||
|
||||
$result['option'] = empty($result['options2']) ? $result['options'] : $result['options2'];
|
||||
|
||||
if (empty($modules[$result['id']])) {
|
||||
if (empty($result['permessi'])) {
|
||||
if (Auth::admin()) {
|
||||
$result['permessi'] = 'rw';
|
||||
@ -64,7 +65,6 @@ class Modules
|
||||
$modules[$result['id']] = $result;
|
||||
$references[$result['name']] = $result['id'];
|
||||
}
|
||||
}
|
||||
|
||||
self::$modules = $modules;
|
||||
self::$references = $references;
|
||||
@ -101,11 +101,13 @@ class Modules
|
||||
*/
|
||||
public static function get($module)
|
||||
{
|
||||
$modules = self::getModules();
|
||||
|
||||
if (!is_numeric($module) && !empty(self::$references[$module])) {
|
||||
$module = self::$references[$module];
|
||||
}
|
||||
|
||||
return self::getModules()[$module];
|
||||
return $modules[$module];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user