1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-23 22:03:18 +01:00

Continuo potenziamento plugin Pianificazione interventi da contratto

This commit is contained in:
Luca 2018-05-11 15:53:24 +02:00
parent 6b58c22308
commit 05d2786d7c
5 changed files with 50 additions and 9 deletions

View File

@ -11,6 +11,7 @@ switch (post('op')) {
Gestione righe generiche
*/
case 'addriga':
$descrizione = post('descrizione');
$qta = post('qta');
$um = post('um');

View File

@ -62,7 +62,7 @@ echo '
<input type="hidden" name="idriga" value="'.$idriga.'">
<input type="text" name="idcontratto_riga" value="'.$idcontratto_riga.'">';
<input type="hidden" name="idcontratto_riga" value="'.$idcontratto_riga.'">';
// Descrizione

View File

@ -62,7 +62,7 @@ echo '
<div class="row">
<div class="col-md-6">
{[ "type": "date", "label": "'.tr('Entro il').'", "name": "data_richiesta", "required": 1, "value": "'.$data_richiesta.'", "extra":"'.$readonly.'" ]}
{[ "type": "date", "label": "'.tr('Data promemoria').'", "name": "data_richiesta", "required": 1, "value": "'.$data_richiesta.'", "extra":"'.$readonly.'" ]}
</div>
<div class="col-md-6">
@ -127,7 +127,7 @@ echo '
<div class="panel-body">
<div id="righe">
<?php include $docroot.'/modules/contratti/plugins/ajax_righe.php'; ?>
<?php include $docroot.'/modules/contratti/plugins/ajax_righe.php' ?>
</div>
<?php if (empty($readonly)) {

View File

@ -7,6 +7,9 @@ $idcontratto_riga = $get['idcontratto_riga'];
$query = 'SELECT * FROM co_righe_contratti_materiali WHERE id_riga_contratto='.prepare($idcontratto_riga).' '.Modules::getAdditionalsQuery('Magazzino').' ORDER BY id ASC';
$rs2 = $dbo->fetchArray($query);
if (count($rs2) > 0) {
echo '
<table class="table table-striped table-condensed table-hover table-bordered">
@ -85,10 +88,10 @@ if (count($rs2) > 0) {
// Pulsante per riportare nel magazzino centrale.
// Visibile solo se l'intervento non è stato nè fatturato nè completato.
if (!$records[0]['flag_completato']) {
if (empty($readonly)) {
echo '
<td>
<button type="button" class="btn btn-warning btn-xs" data-toggle="tooltip" data-title="'.tr('Modifica spesa').'" data-target="#bs-popup2" data-toggle="modal" data-href="'.$rootdir.'/modules/contratti/plugins/add_righe.php?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$r['id'].'"><i class="fa fa-edit"></i></button>
<button type="button" class="btn btn-warning btn-xs" data-title="'.tr('Modifica spesa').'" data-target="#bs-popup2" data-toggle="modal" data-href="'.$rootdir.'/modules/contratti/plugins/add_righe.php?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$r['id'].'"><i class="fa fa-edit"></i></button>
<button type="button" class="btn btn-danger btn-xs" data-toggle="tooltip" onclick="if(confirm(\''.tr('Eliminare questa spesa?').'\')){ elimina_riga( \''.$r['id'].'\' ); }"><i class="fa fa-trash"></i></button>
</td>';
}

View File

@ -186,18 +186,22 @@ if (count($rsp) != 0) {
<table class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>'.tr('Entro il').'</th>
<th>'.tr('Data').'</th>
<th>'.tr('Tipo intervento').'</th>
<th>'.tr('Descrizione').'</th>
<th>'.tr('Intervento collegato').'</th>
<th>'.tr('Intervento').'</th>
<th>'.tr('Sede').'</th>
<th>'.tr('Opzioni').'</th>
<th>'.tr('Impianti').'</th>
<th>'.tr('Materiali').'</th>
<th class="text-right" >'.tr('Opzioni').'</th>
</tr>
</thead>
<tbody>';
// Elenco promemoria
for ($i = 0; $i < sizeof($rsp); ++$i) {
// Sede
if ($rsp[$i]['idsede'] == '-1') {
echo '- '.('Nessuna').' -';
@ -223,10 +227,41 @@ if (count($rsp) != 0) {
$info_intervento = '- '.('Nessuno').' -';
$disabled = '';
}
//data_conclusione contratto
if (date('Y', strtotime($records[0]['data_conclusione'])) < 1971) {
$records[0]['data_conclusione'] = '';
}
//info impianti
if (!empty($rsp[$i]['idimpianti'])){
$rsp3 = $dbo->fetchArray('SELECT id, matricola FROM my_impianti WHERE id IN ('.($rsp[$i]['idimpianti']).')');
$info_impianti = '';
if (!empty( $rsp3 )){
for ($a=0; $a<count($rsp3); $a++){
$info_impianti .= Modules::link('MyImpianti', $rsp3[$a]['id'], tr('_NUM_', [
'_NUM_' => $rsp3[$a]['matricola'],
])).'<br>';
}
}
}
$rsp4 = $dbo->fetchArray('SELECT * FROM co_righe_contratti_materiali WHERE id_riga_contratto = '.prepare($rsp[$i]['id']) );
$info_materiali = '';
if (!empty( $rsp4 )){
for ($b=0; $b<count($rsp4); $b++){
$info_materiali .= Modules::link('', $rsp4[$b]['id'], tr(' _QTA_ _UM_ x _DESC_', [
'_DESC_' => $rsp4[$b]['descrizione'],
'_QTA_' => Translator::numberToLocale($rsp4[$b]['qta']),
'_UM_' => $rsp4[$b]['um'],
'_PREZZO_' => $rsp4[$b]['prezzo_vendita'],
])).'<br>';
}
}
echo '
<tr>
<td>'.Translator::dateToLocale($rsp[$i]['data_richiesta']).'<!--br><small>'.Translator::dateToLocale($records[0]['data_conclusione']).'</small--></td>
@ -234,6 +269,8 @@ if (count($rsp) != 0) {
<td>'.nl2br($rsp[$i]['richiesta']).'</td>
<td>'.$info_intervento.'</td>
<td>'.$info_sede.'</td>
<td>'.$info_impianti.'</td>
<td>'.$info_materiali.'</td>
<td align="right">';
echo '