This commit is contained in:
MatteoPistorello 2022-05-27 11:50:30 +02:00
commit 5588ce36ec
13 changed files with 105 additions and 24 deletions

59
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,59 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: [bugfix]
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
#exemptLabels:
# - pinned
# - security
# - "[Status] Maybe Later"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: in chiusura
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
Issue chiusa automaticamente in assenza di attività.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
only: issues
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.
# issues:
# exemptLabels:
# - confirmed

View File

@ -37,7 +37,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1" ]}
{[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.((empty($id_anagrafica)) ? 0 : 1).'" ]}
</div>
</div>

View File

@ -88,7 +88,7 @@ if (!empty($record['idpreventivo'])) {
'.Modules::link('Preventivi', $record['idpreventivo'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'" ]}
{[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'", "icon-after": "add|'.Modules::get('Preventivi')['id'].'|pianificabile=1&idanagrafica='.$record['idanagrafica'].'" ]}
</div>
<div class="col-md-6">';

View File

@ -28,7 +28,7 @@ switch ($resource) {
$query = 'SELECT id, IF( codice_natura_fe IS NULL, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), CONCAT( IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), " (", codice_natura_fe, ")" ) ) AS descrizione, percentuale FROM co_iva |where| ORDER BY descrizione ASC';
foreach ($elements as $element) {
$filter[] = '(deleted_at IS NULL OR id='.prepare($element).')';
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {

View File

@ -42,8 +42,16 @@ switch (post('op')) {
$tipo = TipoSessione::find($idtipointervento);
$preventivo = Preventivo::build($anagrafica, $tipo, $nome, $data_bozza, $id_sede);
$preventivo->idstato = post('idstato');
$preventivo->save();
$id_record = $preventivo->id;
if (isAjaxRequest()) {
echo json_encode(['id' => $id_record, 'text' => 'Contratto '.$preventivo->numero.' del '.dateFormat($preventivo->data_bozza).' - '.$preventivo->nome]);
}
flash()->info(tr('Aggiunto preventivo numero _NUM_!', [
'_NUM_' => $preventivo['numero'],
]));

View File

@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php';
$id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica'];
$stati = get('pianificabile') ? 'SELECT id, descrizione FROM co_statipreventivi WHERE is_pianificabile=1' : 'SELECT id, descrizione FROM co_statipreventivi';
?><form action="" method="post" id="add-form">
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
@ -29,26 +31,35 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
<input type="hidden" name="id_record" value="">
<div class="row">
<div class="col-md-6">
{[ "type": "date", "label": "<?php echo tr('Data bozza'); ?>", "name": "data_bozza", "value": "<?php echo '-now-'; ?>", "required": 1 ]}
</div>
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1 ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome preventivo'); ?>", "name": "nome", "required": 1 ]}
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "value": "<?php echo $id_anagrafica; ?>", "ajax-source": "clienti", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "<?php echo ((empty($id_anagrafica)) ? 0 : 1); ?>" ]}
</div>
</div>
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Cliente'); ?>", "name": "idanagrafica", "required": 1, "value": "<?php echo $id_anagrafica; ?>", "ajax-source": "clienti", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Cliente&readonly_tipo=1" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Sede'); ?>", "name": "idsede", "ajax-source": "sedi", "placeholder": "Sede legale" ]}
</div>
<div class="col-md-6">
{[ "type": "date", "label": "<?php echo tr('Data bozza'); ?>", "name": "data_bozza", "value": "<?php echo '-now-'; ?>", "required": 1 ]}
</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" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstato", "required": 1, "values": "query=<?php echo $stati; ?>" ]}
</div>
</div>
<!-- PULSANTI -->

View File

@ -25,6 +25,7 @@ if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT co_preventivi.*,
(SELECT tipo FROM an_anagrafiche WHERE idanagrafica = co_preventivi.idanagrafica) AS tipo_anagrafica,
co_statipreventivi.is_fatturabile,
co_statipreventivi.is_pianificabile,
co_statipreventivi.is_completato,
co_statipreventivi.is_revisionabile,
co_statipreventivi.descrizione AS stato

View File

@ -411,25 +411,27 @@ echo '
</div>';
// Aggiunta interventi se il preventivo é aperto o in attesa o pagato (non si possono inserire interventi collegati ad altri preventivi)
if (in_array($record['stato'], ['Accettato', 'In lavorazione', 'Pagato'])) {
echo '
<form action="" method="post">
$query = 'SELECT id, CONCAT(\'Intervento \', codice, \' del \', DATE_FORMAT(IFNULL((SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento=in_interventi.id), data_richiesta), \'%d/%m/%Y\')) AS descrizione FROM in_interventi WHERE id_preventivo IS NULL AND id_contratto IS NULL AND id_ordine IS NULL AND id NOT IN( SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND id NOT IN( SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL) AND idanagrafica='.prepare($record['idanagrafica']);
$count = $dbo->fetchNum($query);
echo '<hr>
<form action="" method="post" id="aggiungi-intervento">
<input type="hidden" name="op" value="addintervento">
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Aggiungi un altro intervento a questo preventivo').'", "name": "idintervento", "values": "query=SELECT id, CONCAT(\'Intervento \', codice, \' del \', DATE_FORMAT(IFNULL((SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento=in_interventi.id), data_richiesta), \'%d/%m/%Y\')) AS descrizione FROM in_interventi WHERE id_preventivo IS NULL AND id NOT IN( SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND id NOT IN( SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL) AND idanagrafica='.prepare($record['idanagrafica']).'" ]}
<div class="col-md-8">
{[ "type": "select", "label": "'.tr('Aggiungi un intervento a questo preventivo').' ('.$count.')", "name": "idintervento", "values": "query='.$query.'", "required":"1" ]}
</div>
</div>
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary pull-right" onclick="if($(\'#idintervento\').val() && confirm(\'Aggiungere questo intervento al preventivo?\'){ $(this).parent().submit(); }">
<div class="col-md-4">
<p style="margin-top:-5px;" >&nbsp;</p>
<button type="button" class="btn btn-primary" onclick="if($(\'#aggiungi-intervento\').parsley().validate() && confirm(\''.tr('Aggiungere questo intervento al preventivo?').'\') ){ $(\'#aggiungi-intervento\').submit(); }" '.((($record['is_pianificabile']) && !$block_edit ) ? '' : 'disabled').'>
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
</div>
</div>
</form>';
}

View File

@ -165,7 +165,7 @@ foreach ($righe as $riga) {
// Iva
echo '
<td class="text-center" nowrap="nowrap">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
}
} else {

View File

@ -201,7 +201,7 @@ foreach ($righe as $riga) {
// Iva
echo '
<td class="text-center">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
} else {
echo '

View File

@ -271,7 +271,7 @@ if ($has_ritenuta) {
'_PRC_' => Translator::numberToLocale($documento->ritenutaContributi->percentuale, 2),
]);
$acconto = tr('acconto: _PRC_%', [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0),
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 2),
]);
$ritenuta_totale = abs($documento->ritenuta_acconto) + abs($documento->totale_ritenuta_contributi);

View File

@ -192,7 +192,7 @@ foreach ($righe as $riga) {
// Iva
echo '
<td class="text-center">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
}

View File

@ -258,7 +258,7 @@ foreach ($righe as $riga) {
// Iva
echo '
<td class="text-center" style="vertical-align: middle">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).'
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
}
} else {