Rimozione Translator

This commit is contained in:
Dasc3er 2021-01-04 18:54:23 +01:00 committed by Thomas Zilio
parent 12c6243b8d
commit a72c68909a
111 changed files with 338 additions and 1154 deletions

View File

@ -129,13 +129,13 @@ if (!empty($query)) {
// Formattazione automatica // Formattazione automatica
if (!empty($total['format'][$pos]) && !empty($value)) { if (!empty($total['format'][$pos]) && !empty($value)) {
if (formatter()->isStandardTimestamp($value)) { if (formatter()->isStandardTimestamp($value)) {
$value = Translator::timestampToLocale($value); $value = timestampFormat($value);
} elseif (formatter()->isStandardDate($value)) { } elseif (formatter()->isStandardDate($value)) {
$value = Translator::dateToLocale($value); $value = dateFormat($value);
} elseif (formatter()->isStandardTime($value)) { } elseif (formatter()->isStandardTime($value)) {
$value = Translator::timeToLocale($value); $value = timeFormat($value);
} elseif (formatter()->isStandardNumber($value)) { } elseif (formatter()->isStandardNumber($value)) {
$value = Translator::numberToLocale($value); $value = numberFormat($value);
} }
} }

View File

@ -39,12 +39,6 @@ if (file_exists(__DIR__.'/config.inc.php')) {
include_once __DIR__.'/config.inc.php'; include_once __DIR__.'/config.inc.php';
} }
// Individuazione dei percorsi di base
AppLegacy::definePaths(__DIR__);
$docroot = DOCROOT;
$rootdir = ROOTDIR;
$baseurl = BASEURL;
/* /*
// Sicurezza della sessioni // Sicurezza della sessioni
ini_set('session.cookie_samesite', 'strict'); ini_set('session.cookie_samesite', 'strict');
@ -151,7 +145,6 @@ $dbo = $database = database();
// Istanziamento del gestore delle traduzioni del progetto // Istanziamento del gestore delle traduzioni del progetto
$lang = !empty($config['lang']) ? $config['lang'] : (isset($_GET['lang']) ? $_GET['lang'] : null); $lang = !empty($config['lang']) ? $config['lang'] : (isset($_GET['lang']) ? $_GET['lang'] : null);
$formatter = !empty($config['formatter']) ? $config['formatter'] : []; $formatter = !empty($config['formatter']) ? $config['formatter'] : [];
AppLegacy::setFormatter($lang, $formatter);
//$translator->addLocalePath(base_dir().'/locale'); //$translator->addLocalePath(base_dir().'/locale');
//$translator->addLocalePath(base_dir().'/modules/*/locale'); //$translator->addLocalePath(base_dir().'/modules/*/locale');
//$translator->setLocale($lang, $formatter); //$translator->setLocale($lang, $formatter);

View File

@ -133,7 +133,7 @@ if (empty($record) || !$has_access) {
$operation = $dbo->fetchOne("SELECT zz_operations.created_at, username FROM zz_operations INNER JOIN zz_users ON zz_operations.id_utente = zz_users.id WHERE op='delete' AND id_module=".prepare($id_module).' AND id_record='.prepare($id_record).' ORDER BY zz_operations.created_at DESC'); $operation = $dbo->fetchOne("SELECT zz_operations.created_at, username FROM zz_operations INNER JOIN zz_users ON zz_operations.id_utente = zz_users.id WHERE op='delete' AND id_module=".prepare($id_module).' AND id_record='.prepare($id_record).' ORDER BY zz_operations.created_at DESC');
$info = tr('Il record è stato eliminato il <b>_DATE_</b> da <b>_USER_</b>', [ $info = tr('Il record è stato eliminato il <b>_DATE_</b> da <b>_USER_</b>', [
'_DATE_' => (($operation['created_at']) ? Translator::timestampToLocale($operation['created_at']) : Translator::timestampToLocale($record['deleted_at'])), '_DATE_' => (($operation['created_at']) ? timestampFormat($operation['created_at']) : timestampFormat($record['deleted_at'])),
'_USER_' => ((!empty($operation['username'])) ? $operation['username'] : 'N.D.'), '_USER_' => ((!empty($operation['username'])) ? $operation['username'] : 'N.D.'),
]).'. '; ]).'. ';
@ -381,7 +381,7 @@ if (empty($record) || !$has_access) {
<h4 class="timeline-title">'.$description.'</h4> <h4 class="timeline-title">'.$description.'</h4>
</div> </div>
<div class="col-md-4 text-right"> <div class="col-md-4 text-right">
<p><small class="label label-default tip" title="'.Translator::timestampToLocale($operation['created_at']).'"><i class="fa fa-clock-o"></i> '.Carbon::parse($operation['created_at'])->diffForHumans().'</small></p> <p><small class="label label-default tip" title="'.timestampFormat($operation['created_at']).'"><i class="fa fa-clock-o"></i> '.Carbon::parse($operation['created_at'])->diffForHumans().'</small></p>
<p><small class="label label-default"><i class="fa fa-user"></i> '.$operation['username'].'</small></p> <p><small class="label label-default"><i class="fa fa-user"></i> '.$operation['username'].'</small></p>
</div> </div>
</div> </div>

View File

@ -204,9 +204,9 @@ if (auth()->check()) {
full_locale: "'.$lang.'", full_locale: "'.$lang.'",
start_date: "'.session('period_start').'", start_date: "'.session('period_start').'",
start_date_formatted: "'.Translator::dateToLocale(session('period_start')).'", start_date_formatted: "'.dateFormat(session('period_start')).'",
end_date: "'.session('period_end').'", end_date: "'.session('period_end').'",
end_date_formatted: "'.Translator::dateToLocale(session('period_end')).'", end_date_formatted: "'.dateFormat(session('period_end')).'",
collapse_plugin_sidebar: '.intval(setting('Nascondere la barra dei plugin di default')).', collapse_plugin_sidebar: '.intval(setting('Nascondere la barra dei plugin di default')).',
@ -384,7 +384,7 @@ if (auth()->check()) {
</a></li> </a></li>
<li><a style="cursor:default;padding:0px;padding-right:5px;padding-left:5px;margin-top:15px;" class="label label-'.$calendar_color_label.'"> <li><a style="cursor:default;padding:0px;padding-right:5px;padding-left:5px;margin-top:15px;" class="label label-'.$calendar_color_label.'">
'.Translator::dateToLocale(session('period_start')).' - '.Translator::dateToLocale(session('period_end')).' '.dateFormat(session('period_start')).' - '.dateFormat(session('period_end')).'
</a></li> </a></li>
</ul> </ul>
</div> </div>

View File

@ -142,7 +142,7 @@ function discountInfo(Accounting $riga, $mostra_maggiorazione = true)
$totale = !empty($riga->sconto_percentuale) ? $riga->sconto_percentuale : $riga->sconto_unitario_corrente; $totale = !empty($riga->sconto_percentuale) ? $riga->sconto_percentuale : $riga->sconto_unitario_corrente;
return replace($text, [ return replace($text, [
'_TOT_' => Translator::numberToLocale(abs($totale)), '_TOT_' => numberFormat(abs($totale)),
'_TYPE_' => !empty($riga->sconto_percentuale) ? '%' : currency(), '_TYPE_' => !empty($riga->sconto_percentuale) ? '%' : currency(),
]); ]);
} }

View File

@ -356,7 +356,7 @@ function doc_references($info, $dir, $ignore = [])
$description = tr('Rif. _DOC_ num. _NUM_ del _DATE_', [ $description = tr('Rif. _DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $document, '_DOC_' => $document,
'_NUM_' => $data[0]['numero'], '_NUM_' => $data[0]['numero'],
'_DATE_' => Translator::dateToLocale($data[0]['data']), '_DATE_' => dateFormat($data[0]['data']),
]); ]);
} else { } else {
$description = tr('_DOC_ di riferimento _ID_ eliminato', [ $description = tr('_DOC_ di riferimento _ID_ eliminato', [

View File

@ -437,3 +437,30 @@ function base_dir()
{ {
return base_url().'/legacy/'; return base_url().'/legacy/';
} }
/**
* Argomenti di ricerca dalla sessione.
*
* @param $module_id
*
* @since 2.5
*
* @return array
*/
function getSessionSearch($module_id)
{
$search = [];
$array = session('module_'.$module_id);
if (!empty($array)) {
foreach ($array as $field => $value) {
if (!empty($value) && string_starts_with($field, 'search_')) {
$field_name = str_replace('search_', '', $field);
$search[$field_name] = $value;
}
}
}
return $search;
}

View File

@ -197,7 +197,7 @@ if (!function_exists('_')) {
*/ */
function numberFormat($number, $decimals = null) function numberFormat($number, $decimals = null)
{ {
return Translator::numberToLocale($number, $decimals); return formatter()->formatNumber($number, $decimals);
} }
/** /**
@ -211,7 +211,7 @@ function numberFormat($number, $decimals = null)
*/ */
function timestampFormat($timestamp) function timestampFormat($timestamp)
{ {
return Translator::timestampToLocale($timestamp); return formatter()->formatTimestamp($timestamp);
} }
/** /**
@ -225,7 +225,7 @@ function timestampFormat($timestamp)
*/ */
function dateFormat($date) function dateFormat($date)
{ {
return Translator::dateToLocale($date); return formatter()->formatDate($date);
} }
/** /**
@ -239,7 +239,7 @@ function dateFormat($date)
*/ */
function timeFormat($time) function timeFormat($time)
{ {
return Translator::timeToLocale($time); return formatter()->formatTime($time);
} }
/** /**
@ -251,7 +251,7 @@ function timeFormat($time)
*/ */
function currency() function currency()
{ {
return \Translator::getCurrency(); return AppLegacy::getCurrency();
} }
/** /**

View File

@ -59,7 +59,7 @@ for ($i = 0; $i < $n; ++$i) {
$username = $rs[$i]['username']; $username = $rs[$i]['username'];
$ip = $rs[$i]['ip']; $ip = $rs[$i]['ip'];
$timestamp = Translator::timestampToLocale($rs[$i]['created_at']); $timestamp = timestampFormat($rs[$i]['created_at']);
$status = auth()->getStatus(); $status = auth()->getStatus();
if ($rs[$i]['stato'] == $status['success']['code']) { if ($rs[$i]['stato'] == $status['success']['code']) {

View File

@ -759,8 +759,8 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ _NUM_ del _DATE_ _DELETED_AT_', [ $descrizione = tr('_DOC_ _NUM_ del _DATE_ _DELETED_AT_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'], '_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
'_DELETED_AT_' => (!empty($elemento['deleted_at']) ? tr('Eliminato il:').' '.Translator::dateToLocale($elemento['deleted_at']) : ''), '_DELETED_AT_' => (!empty($elemento['deleted_at']) ? tr('Eliminato il:').' '.dateFormat($elemento['deleted_at']) : ''),
]); ]);
//se non è un preventivo è un ddt o una fattura //se non è un preventivo è un ddt o una fattura

View File

@ -138,7 +138,7 @@ echo '
</a> </a>
</td> </td>
<td>'.Modules::link(Modules::get($allegato['id_module'])['name'], $file->id_record, $documento['descrizione']).'</td> <td>'.Modules::link(Modules::get($allegato['id_module'])['name'], $file->id_record, $documento['descrizione']).'</td>
<td class="text-center">'.Translator::dateToLocale($file->created_at).'</td> <td class="text-center">'.dateFormat($file->created_at).'</td>
</tr>'; </tr>';
} }
} }

View File

@ -48,7 +48,7 @@ if( !$contratti->isEmpty() ){
$descrizione = tr('Contratto num. _NUM_ del _DATA_',[ $descrizione = tr('Contratto num. _NUM_ del _DATA_',[
'_NUM_' => $contratto->numero, '_NUM_' => $contratto->numero,
'_DATA_' => Translator::dateToLocale($contratto->data_bozza), '_DATA_' => dateFormat($contratto->data_bozza),
]); ]);
echo ' echo '
<tr> <tr>

View File

@ -44,7 +44,7 @@ switch ($resource) {
($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento']; ($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento'];
$link_id = Modules::get($documenti[$i]['modulo'])['id']; $link_id = Modules::get($documenti[$i]['modulo'])['id'];
echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.Translator::dateToLocale($documenti[$i]['data_documento'])." </a></td>\n"; echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.dateFormat($documenti[$i]['data_documento'])." </a></td>\n";
echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n"; echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n";
array_push($ids, '"'.$documenti[$i]['id'].'"'); array_push($ids, '"'.$documenti[$i]['id'].'"');
} }
@ -73,7 +73,7 @@ switch ($resource) {
($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento']; ($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento'];
$link_id = Modules::get($documenti[$i]['modulo'])['id']; $link_id = Modules::get($documenti[$i]['modulo'])['id'];
echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.Translator::dateToLocale($documenti[$i]['data_documento'])." </a></td>\n"; echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.dateFormat($documenti[$i]['data_documento'])." </a></td>\n";
echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n"; echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n";
array_push($ids, '"'.$documenti[$i]['id'].'"'); array_push($ids, '"'.$documenti[$i]['id'].'"');
} }
@ -101,7 +101,7 @@ switch ($resource) {
($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento']; ($documenti[$i]['n2_documento'] != '') ? $n_documento = $documenti[$i]['n2_documento'] : $n_documento = $documenti[$i]['n_documento'];
$link_id = Modules::get($documenti[$i]['modulo'])['id']; $link_id = Modules::get($documenti[$i]['modulo'])['id'];
echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.Translator::dateToLocale($documenti[$i]['data_documento'])." </a></td>\n"; echo "<tr><td class='first_cell text-left'><a href='".base_url().'/editor.php?id_module='.$link_id.'&id_record='.$documenti[$i]['id']."' target=\"_blank\" title=\"Apri il documento su una nuova finestra\">".$documenti[$i]['tipo'].'. n. '.$n_documento.' del '.dateFormat($documenti[$i]['data_documento'])." </a></td>\n";
echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n"; echo "<td class='table_cell text-right'>".moneyFormat($documenti[$i]['costo_unitario'])."</td></tr>\n";
array_push($ids, '"'.$documenti[$i]['id'].'"'); array_push($ids, '"'.$documenti[$i]['id'].'"');
} }

View File

@ -168,7 +168,7 @@ switch ($resource) {
$qta_sede = $dbo->fetchOne('SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede WHERE mg_movimenti.idarticolo = '.prepare($r['id']).' AND idsede = '.prepare($superselect['idsede_partenza']))['qta']; $qta_sede = $dbo->fetchOne('SELECT SUM(mg_movimenti.qta) AS qta FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede WHERE mg_movimenti.idarticolo = '.prepare($r['id']).' AND idsede = '.prepare($superselect['idsede_partenza']))['qta'];
$rs[$k] = array_merge($r, [ $rs[$k] = array_merge($r, [
'text' => $r['codice'].' - '.$r['descrizione'].' '.(!$r['servizio'] ? '('.Translator::numberToLocale($qta_sede).(!empty($r['um']) ? ' '.$r['um'] : '').')' : ''), 'text' => $r['codice'].' - '.$r['descrizione'].' '.(!$r['servizio'] ? '('.numberFormat($qta_sede).(!empty($r['um']) ? ' '.$r['um'] : '').')' : ''),
'disabled' => $qta_sede <= 0 && !$permetti_movimenti_sotto_zero && !$r['servizio'], 'disabled' => $qta_sede <= 0 && !$permetti_movimenti_sotto_zero && !$r['servizio'],
]); ]);
} }

View File

@ -371,7 +371,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'], '_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
]); ]);
//se non è un preventivo è un ddt o una fattura //se non è un preventivo è un ddt o una fattura
@ -389,7 +389,7 @@ if (!empty($elementi)) {
echo ' echo '
<tr> <tr>
<td>'.Modules::link($modulo, $id, $descrizione).'</td> <td>'.Modules::link($modulo, $id, $descrizione).'</td>
<td class="text-center">'.Translator::numberToLocale($elemento['qta_totale']).'</td> <td class="text-center">'.numberFormat($elemento['qta_totale']).'</td>
<td class="text-right">'.moneyFormat($elemento['prezzo_unitario']).'</td> <td class="text-right">'.moneyFormat($elemento['prezzo_unitario']).'</td>
<td class="text-right">'.moneyFormat($elemento['prezzo_totale']).'</td> <td class="text-right">'.moneyFormat($elemento['prezzo_totale']).'</td>
<tr>'; <tr>';

View File

@ -132,7 +132,7 @@ for ($i = 0; $i < count($rs2); ++$i) {
<td>'.$rs2[$i]['serial'].'</td>'; <td>'.$rs2[$i]['serial'].'</td>';
echo ' echo '
<td>'.Translator::timestampToLocale($rs2[$i]['created_at']).'</td>'; <td>'.timestampFormat($rs2[$i]['created_at']).'</td>';
// Ricerca acquisti // Ricerca acquisti
$acquisti = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'uscita\' AND id_articolo='.prepare($id_record).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL) AND serial='.prepare($rs2[$i]['serial'])); $acquisti = $dbo->fetchArray('SELECT * FROM mg_prodotti WHERE dir=\'uscita\' AND id_articolo='.prepare($id_record).' AND (id_riga_documento IS NOT NULL OR id_riga_ordine IS NOT NULL OR id_riga_ddt IS NOT NULL) AND serial='.prepare($rs2[$i]['serial']));
@ -183,7 +183,7 @@ for ($i = 0; $i < count($rs2); ++$i) {
$text = tr('_DOC_ num. _NUM_ del _DATE_', [ $text = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $data[0]['tipo_documento'], '_DOC_' => $data[0]['tipo_documento'],
'_NUM_' => $numero, '_NUM_' => $numero,
'_DATE_' => Translator::dateToLocale($data[0]['data']), '_DATE_' => dateFormat($data[0]['data']),
]).(!empty($extra) ? ' '.$extra : ''); ]).(!empty($extra) ? ' '.$extra : '');
echo echo
@ -202,7 +202,7 @@ for ($i = 0; $i < count($rs2); ++$i) {
<span>'.moneyFormat($subtotale + $iva).'</span>'; <span>'.moneyFormat($subtotale + $iva).'</span>';
if (!empty($subtotale) && !empty($iva)) { if (!empty($subtotale) && !empty($iva)) {
echo ' echo '
<small style="color:#555;">('.Translator::numberToLocale($subtotale).' + '.Translator::numberToLocale($iva).')</small>'; <small style="color:#555;">('.numberFormat($subtotale).' + '.numberFormat($iva).')</small>';
} }
echo ' echo '
<br>'; <br>';
@ -285,11 +285,11 @@ for ($i = 0; $i < count($rs2); ++$i) {
$text = tr('_DOC_ num. _NUM_ del _DATE_', [ $text = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $data[0]['tipo_documento'], '_DOC_' => $data[0]['tipo_documento'],
'_NUM_' => $numero, '_NUM_' => $numero,
'_DATE_' => Translator::dateToLocale($data[0]['data']), '_DATE_' => dateFormat($data[0]['data']),
]).(!empty($extra) ? ' '.$extra : ''); ]).(!empty($extra) ? ' '.$extra : '');
echo echo '
Modules::link($module_id, $id, $text).'<br>'; '.Modules::link($module_id, $id, $text).'<br>';
} }
echo ' echo '
@ -304,7 +304,7 @@ for ($i = 0; $i < count($rs2); ++$i) {
<span>'.moneyFormat($subtotale + $iva).'</span>'; <span>'.moneyFormat($subtotale + $iva).'</span>';
if (!empty($subtotale) && !empty($iva)) { if (!empty($subtotale) && !empty($iva)) {
echo ' echo '
<small style="color:#555;">('.Translator::numberToLocale($subtotale).' + '.Translator::numberToLocale($iva).')</small>'; <small style="color:#555;">('.numberFormat($subtotale).' + '.numberFormat($iva).')</small>';
} }
echo ' echo '
<br>'; <br>';

View File

@ -55,10 +55,10 @@ $qta_totale = $dbo->fetchOne('SELECT SUM(qta) AS qta FROM mg_movimenti WHERE ida
$qta_totale_attuale = $dbo->fetchOne('SELECT SUM(qta) AS qta FROM mg_movimenti WHERE idarticolo='.prepare($id_record).' AND data <= CURDATE()')['qta']; $qta_totale_attuale = $dbo->fetchOne('SELECT SUM(qta) AS qta FROM mg_movimenti WHERE idarticolo='.prepare($id_record).' AND data <= CURDATE()')['qta'];
echo ' echo '
<p>'.tr('Quantità calcolata dai movimenti').': <b>'.Translator::numberToLocale($qta_totale, 'qta').' '.$record['um'].'</b> <span class="tip" title="'.tr('Quantità calcolata da tutti i movimenti registrati').'." ><i class="fa fa-question-circle-o"></i></span></p>'; <p>'.tr('Quantità calcolata dai movimenti').': <b>'.numberFormat($qta_totale, 'qta').' '.$record['um'].'</b> <span class="tip" title="'.tr('Quantità calcolata da tutti i movimenti registrati').'." ><i class="fa fa-question-circle-o"></i></span></p>';
echo ' echo '
<p>'.tr('Quantità calcolata attuale').': <b>'.Translator::numberToLocale($qta_totale_attuale, 'qta').' '.$record['um'].'</b> <span class="tip" title="'.tr('Quantità calcolata secondo i movimenti registrati con data oggi o date trascorse').'." ><i class="fa fa-question-circle-o"></i></span></p>'; <p>'.tr('Quantità calcolata attuale').': <b>'.numberFormat($qta_totale_attuale, 'qta').' '.$record['um'].'</b> <span class="tip" title="'.tr('Quantità calcolata secondo i movimenti registrati con data oggi o date trascorse').'." ><i class="fa fa-question-circle-o"></i></span></p>';
// Individuazione movimenti // Individuazione movimenti
$movimenti = $articolo->movimentiComposti() $movimenti = $articolo->movimentiComposti()

View File

@ -37,7 +37,7 @@ if (!empty($rs)) {
<br><small>'.$r['codice'].'</small> <br><small>'.$r['codice'].'</small>
</td> </td>
<td> <td>
'.Translator::numberToLocale($r['qta'], 'qta').' '.$r['unitamisura'].' '.numberFormat($r['qta'], 'qta').' '.$r['unitamisura'].'
</td> </td>
</tr>'; </tr>';
} }

View File

@ -222,8 +222,8 @@ if (file_exists($backup_dir)) {
echo ' echo '
<div class="callout callout-info"> <div class="callout callout-info">
<h4>'.tr('Backup del _DATE_ alle _TIME_', [ <h4>'.tr('Backup del _DATE_ alle _TIME_', [
'_DATE_' => Translator::dateToLocale($data), '_DATE_' => dateFormat($data),
'_TIME_' => Translator::timeToLocale($ora), '_TIME_' => timeFormat($ora),
]).'</h4> ]).'</h4>
<p><small> <p><small>
'.tr('Nome del file').': '.$name.'<br> '.tr('Nome del file').': '.$name.'<br>
@ -272,8 +272,8 @@ if (file_exists($backup_dir)) {
echo ' echo '
<div class="callout callout-warning"> <div class="callout callout-warning">
<h4>'.tr('Backup del _DATE_ alle _TIME_', [ <h4>'.tr('Backup del _DATE_ alle _TIME_', [
'_DATE_' => Translator::dateToLocale($data), '_DATE_' => dateFormat($data),
'_TIME_' => Translator::timeToLocale($ora), '_TIME_' => timeFormat($ora),
]).'</h4> ]).'</h4>
<p><small> <p><small>
'.tr('Nome del file').': '.$name.'<br> '.tr('Nome del file').': '.$name.'<br>

View File

@ -482,7 +482,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'], '_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
]); ]);
echo ' echo '

View File

@ -52,7 +52,7 @@ if (!empty($interventi)) {
<a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a> <a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a>
'.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [ '.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [
'_NUM_' => $intervento->codice, '_NUM_' => $intervento->codice,
'_DATE_' => Translator::dateToLocale($intervento->inizio), '_DATE_' => dateFormat($intervento->inizio),
])).' ])).'
</td> </td>
@ -289,31 +289,31 @@ echo '
echo ' echo '
<tr> <tr>
<td>'.tr('Ore a contratto').':</td> <td>'.tr('Ore a contratto').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore_contratto).'</td> <td class="text-right">'.numberFormat($totale_ore_contratto).'</td>
</tr>'; </tr>';
} }
echo ' echo '
<tr> <tr>
<td>'.tr('Ore erogate totali').':</td> <td>'.tr('Ore erogate totali').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore).'</td> <td class="text-right">'.numberFormat($totale_ore).'</td>
</tr>'; </tr>';
if (!empty($totale_ore_contratto)) { if (!empty($totale_ore_contratto)) {
echo ' echo '
<tr> <tr>
<td>'.tr('Ore residue totali').':</td> <td>'.tr('Ore residue totali').':</td>
<td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore)).'</td> <td class="text-right">'.numberFormat(floatval($totale_ore_contratto) - floatval($totale_ore)).'</td>
</tr>'; </tr>';
} }
echo ' echo '
<tr> <tr>
<td>'.tr('Ore erogate concluse').':</td> <td>'.tr('Ore erogate concluse').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore_completate).'</td> <td class="text-right">'.numberFormat($totale_ore_completate).'</td>
</tr>'; </tr>';
if (!empty($totale_ore_contratto)) { if (!empty($totale_ore_contratto)) {
echo ' echo '
<tr> <tr>
<td>'.tr('Ore residue concluse').':</td> <td>'.tr('Ore residue concluse').':</td>
<td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore_completate)).'</td> <td class="text-right">'.numberFormat(floatval($totale_ore_contratto) - floatval($totale_ore_completate)).'</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -345,10 +345,10 @@ if (empty($totale_ore_contratto)) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ore']).'</td> <td class="text-right">'.numberFormat($tipologia['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' </td> <td class="text-right">'.numberFormat($tipologia['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' </td> <td class="text-right">'.numberFormat($tipologia['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -372,11 +372,11 @@ if (empty($totale_ore_contratto)) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ore']).'</td> <td class="text-right">'.numberFormat($tecnico['ore']).'</td>
<td class="text-right">'.(int)$tecnico['km'].'</td> <td class="text-right">'.(int)$tecnico['km'].'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' </td> <td class="text-right">'.numberFormat($tecnico['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' </td> <td class="text-right">'.numberFormat($tecnico['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -401,10 +401,10 @@ if (empty($totale_ore_contratto)) {
echo ' echo '
<tr> <tr>
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td> <td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($stato['ore']).'</td> <td class="text-right">'.numberFormat($stato['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' </td> <td class="text-right">'.numberFormat($stato['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' </td> <td class="text-right">'.numberFormat($stato['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -430,9 +430,9 @@ if (empty($totale_ore_contratto)) {
<tr> <tr>
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td> <td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
} }
@ -446,9 +446,9 @@ if (empty($totale_ore_contratto)) {
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '

View File

@ -28,6 +28,6 @@ return [
'ragione_sociale' => $r['ragione_sociale'], 'ragione_sociale' => $r['ragione_sociale'],
'numero' => $r['numero'], 'numero' => $r['numero'],
'descrizione' => $r['descrizione'], 'descrizione' => $r['descrizione'],
'data' => Translator::dateToLocale($r['data_bozza']), 'data' => dateFormat($r['data_bozza']),
'id_anagrafica' => $r['idanagrafica'], 'id_anagrafica' => $r['idanagrafica'],
]; ];

View File

@ -44,9 +44,9 @@ if (!empty($rs)) {
</tr>'; </tr>';
foreach ($rs as $r) { foreach ($rs as $r) {
$data_accettazione = !empty($r['data_accettazione']) ? Translator::dateToLocale($r['data_accettazione']) : ''; $data_accettazione = !empty($r['data_accettazione']) ? dateFormat($r['data_accettazione']) : '';
$data_conclusione = !empty($r['data_conclusione']) ? Translator::dateToLocale($r['data_conclusione']) : ''; $data_conclusione = !empty($r['data_conclusione']) ? dateFormat($r['data_conclusione']) : '';
// Se scaduto, segna la riga in rosso // Se scaduto, segna la riga in rosso
$class = (strtotime($r['data_conclusione']) < strtotime(date('Y-m-d')) && !empty($data_conclusione)) ? 'danger' : ''; $class = (strtotime($r['data_conclusione']) < strtotime(date('Y-m-d')) && !empty($data_conclusione)) ? 'danger' : '';

View File

@ -223,7 +223,7 @@ switch (filter('op')) {
if (!empty($rs)) { if (!empty($rs)) {
$tecnici = []; $tecnici = [];
foreach ($rs as $sessione) { foreach ($rs as $sessione) {
$tecnici[] = $sessione['nome_tecnico'].' ('.Translator::timestampToLocale($sessione['orario_inizio']).' - '.Translator::timeToLocale($sessione['orario_fine']).')'; $tecnici[] = $sessione['nome_tecnico'].' ('.timestampFormat($sessione['orario_inizio']).' - '.timeFormat($sessione['orario_fine']).')';
} }
// Lettura dati intervento // Lettura dati intervento
@ -243,10 +243,10 @@ switch (filter('op')) {
$tooltip = '<b>'.tr('Numero intervento').'</b>: '.$rs[0]['codice'].'<br/>'; $tooltip = '<b>'.tr('Numero intervento').'</b>: '.$rs[0]['codice'].'<br/>';
$tooltip .= '<b>'.tr('Data richiesta').'</b>: '.Translator::timestampToLocale($rs[0]['data_richiesta']).'<br/>'; $tooltip .= '<b>'.tr('Data richiesta').'</b>: '.timestampFormat($rs[0]['data_richiesta']).'<br/>';
if (!empty($rs[0]['data_scadenza'])) { if (!empty($rs[0]['data_scadenza'])) {
$tooltip .= '<b>'.tr('Data scadenza').'</b>: '.Translator::timestampToLocale($rs[0]['data_scadenza']).'<br/>'; $tooltip .= '<b>'.tr('Data scadenza').'</b>: '.timestampFormat($rs[0]['data_scadenza']).'<br/>';
} }
$tooltip .= '<b>'.tr('Tipo intervento').'</b>: '.nl2br($desc_tipointervento).'<br/>'; $tooltip .= '<b>'.tr('Tipo intervento').'</b>: '.nl2br($desc_tipointervento).'<br/>';

View File

@ -52,7 +52,7 @@ foreach ($rs as $r) {
$numero = empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno']; $numero = empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'];
$result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id']; $result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id'];
$result['title'] = $r['tipologia'].' num. '.$numero.' del '.Translator::dateToLocale($r['data']); $result['title'] = $r['tipologia'].' num. '.$numero.' del '.dateFormat($r['data']);
$result['category'] = $r['tipologia']; $result['category'] = $r['tipologia'];
// Campi da evidenziare // Campi da evidenziare

View File

@ -515,7 +515,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $fattura['tipo_documento'], '_DOC_' => $fattura['tipo_documento'],
'_NUM_' => !empty($fattura['numero_esterno']) ? $fattura['numero_esterno'] : $fattura['numero'], '_NUM_' => !empty($fattura['numero_esterno']) ? $fattura['numero_esterno'] : $fattura['numero'],
'_DATE_' => Translator::dateToLocale($fattura['data']), '_DATE_' => dateFormat($fattura['data']),
]); ]);
$modulo = ($fattura['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto'; $modulo = ($fattura['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto';

View File

@ -26,7 +26,7 @@ return [
'email' => $r['email'], 'email' => $r['email'],
'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'], 'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'],
'note' => $r['note'], 'note' => $r['note'],
'data' => Translator::dateToLocale($r['data']), 'data' => dateFormat($r['data']),
'id_anagrafica' => $r['idanagrafica'], 'id_anagrafica' => $r['idanagrafica'],
'ragione_sociale' => $r['ragione_sociale'], 'ragione_sociale' => $r['ragione_sociale'],
]; ];

View File

@ -71,7 +71,7 @@ foreach ($rs as $key => $value) {
$intervento = \Modules\Interventi\Intervento::find($value['id']); $intervento = \Modules\Interventi\Intervento::find($value['id']);
$prezzo = $intervento->totale; $prezzo = $intervento->totale;
$rs[$key]['prezzo'] = Translator::numberToLocale($prezzo); $rs[$key]['prezzo'] = numberFormat($prezzo);
$rs[$key]['descrizione_intervento'] = strip_tags($rs[$key]['descrizione_intervento']); $rs[$key]['descrizione_intervento'] = strip_tags($rs[$key]['descrizione_intervento']);
} }

View File

@ -54,7 +54,7 @@ foreach ($rs as $r) {
$numero = empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno']; $numero = empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'];
$result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id']; $result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id'];
$result['title'] = $r['tipologia'].' num. '.$numero.' del '.Translator::dateToLocale($r['data']); $result['title'] = $r['tipologia'].' num. '.$numero.' del '.dateFormat($r['data']);
$result['category'] = $r['tipologia']; $result['category'] = $r['tipologia'];
// Campi da evidenziare // Campi da evidenziare

View File

@ -229,7 +229,7 @@ elseif ($record['stato'] == 'Bozza') {
?> ?>
<div class="col-md-2" <?php echo ($is_fiscale) ? '' : 'hidden'; ?> > <div class="col-md-2" <?php echo ($is_fiscale) ? '' : 'hidden'; ?> >
{[ "type": "select", "label": "<?php echo tr('Stato FE'); ?>", "name": "codice_stato_fe", "values": "query=SELECT codice as id, CONCAT_WS(' - ',codice,descrizione) as text FROM fe_stati_documento", "value": "$codice_stato_fe$", "disabled": <?php echo intval(Interaction::isEnabled() || ($record['stato'] == 'Bozza' && $abilita_genera)); ?>, "class": "unblockable", "help": "<?php echo (!empty($record['data_stato_fe'])) ? Translator::timestampToLocale($record['data_stato_fe']) : ''; ?>" ]} {[ "type": "select", "label": "<?php echo tr('Stato FE'); ?>", "name": "codice_stato_fe", "values": "query=SELECT codice as id, CONCAT_WS(' - ',codice,descrizione) as text FROM fe_stati_documento", "value": "$codice_stato_fe$", "disabled": <?php echo intval(Interaction::isEnabled() || ($record['stato'] == 'Bozza' && $abilita_genera)); ?>, "class": "unblockable", "help": "<?php echo (!empty($record['data_stato_fe'])) ? timestampFormat($record['data_stato_fe']) : ''; ?>" ]}
</div> </div>
<?php <?php
@ -867,7 +867,7 @@ if (!empty($note_accredito)) {
foreach ($note_accredito as $nota) { foreach ($note_accredito as $nota) {
$text = tr('Rif. fattura _NUM_ del _DATE_', [ $text = tr('Rif. fattura _NUM_ del _DATE_', [
'_NUM_' => $nota['numero'], '_NUM_' => $nota['numero'],
'_DATE_' => Translator::dateToLocale($nota['data']), '_DATE_' => dateFormat($nota['data']),
]); ]);
echo ' echo '

View File

@ -198,10 +198,10 @@ class Fattura extends Document
// Registrazione dell'operazione nelle note // Registrazione dell'operazione nelle note
$notes[] = tr("Operazione non imponibile come da vostra dichiarazione d'intento nr _PROT_ del _PROT_DATE_ emessa in data _RELEASE_DATE_, da noi registrata al nr _ID_ del _DATE_", [ $notes[] = tr("Operazione non imponibile come da vostra dichiarazione d'intento nr _PROT_ del _PROT_DATE_ emessa in data _RELEASE_DATE_, da noi registrata al nr _ID_ del _DATE_", [
'_PROT_' => $dichiarazione->numero_protocollo, '_PROT_' => $dichiarazione->numero_protocollo,
'_PROT_DATE_' => Translator::dateToLocale($dichiarazione->data_protocollo), '_PROT_DATE_' => dateFormat($dichiarazione->data_protocollo),
'_RELEASE_DATE_' => Translator::dateToLocale($dichiarazione->data_emissione), '_RELEASE_DATE_' => dateFormat($dichiarazione->data_emissione),
'_ID_' => $dichiarazione->id, '_ID_' => $dichiarazione->id,
'_DATE_' => Translator::dateToLocale($dichiarazione->data), '_DATE_' => dateFormat($dichiarazione->data),
]).'.'; ]).'.';
} }

View File

@ -60,7 +60,7 @@ return [
'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'], 'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'],
'tipo_documento' => $r['tipo_documento'], 'tipo_documento' => $r['tipo_documento'],
'note' => $r['note'], 'note' => $r['note'],
'data' => Translator::dateToLocale($r['data']), 'data' => dateFormat($r['data']),
'logo_azienda' => !empty($logo_azienda) ? '<img src="'.$logo_azienda.'" />' : '', 'logo_azienda' => !empty($logo_azienda) ? '<img src="'.$logo_azienda.'" />' : '',
'conto' => $conto, 'conto' => $conto,
'conto_descrizione' => $conto_descrizione, 'conto_descrizione' => $conto_descrizione,

View File

@ -54,7 +54,7 @@ foreach ($rs as $r) {
$result = []; $result = [];
$result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id']; $result['link'] = base_url().'/editor.php?id_module='.$link_id.'&id_record='.$r['id'];
$result['title'] = 'Intervento '.$r['codice'].' del '.Translator::dateToLocale($r['data']); $result['title'] = 'Intervento '.$r['codice'].' del '.dateFormat($r['data']);
$result['category'] = 'Interventi'; $result['category'] = 'Interventi';
// Campi da evidenziare // Campi da evidenziare

View File

@ -98,39 +98,39 @@ if (!empty($sessioni)) {
// Orario di inizio // Orario di inizio
echo ' echo '
<td> <td>
'.Translator::timestampToLocale($sessione['orario_inizio']).' '.timestampFormat($sessione['orario_inizio']).'
</td>'; </td>';
// Orario di fine // Orario di fine
echo ' echo '
<td> <td>
'.Translator::timestampToLocale($sessione['orario_fine']).' '.timestampFormat($sessione['orario_fine']).'
</td>'; </td>';
// ORE // ORE
echo ' echo '
<td style="border-right:1px solid #aaa;"> <td style="border-right:1px solid #aaa;">
'.Translator::numberToLocale($ore).' '.numberFormat($ore).'
<div class="extra hide"> <div class="extra hide">
<table class="table table-condensed table-bordered"> <table class="table table-condensed table-bordered">
<tr> <tr>
<th class="text-danger">'.tr('Costo').':</th> <th class="text-danger">'.tr('Costo').':</th>
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($costo_ore_consuntivo_tecnico)." '.numberFormat($costo_ore_consuntivo_tecnico)."
<small class='help-block'>".Translator::numberToLocale($costo_ore_unitario_tecnico).'x'.Translator::numberToLocale($ore).'<br>+'.Translator::numberToLocale($costo_dirittochiamata_tecnico).'</small> <small class='help-block'>".numberFormat($costo_ore_unitario_tecnico).'x'.numberFormat($ore).'<br>+'.numberFormat($costo_dirittochiamata_tecnico).'</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>'.tr('Addebito').':</th> <th>'.tr('Addebito').':</th>
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($costo_ore_consuntivo).' '.numberFormat($costo_ore_consuntivo).'
<small class="help-block">'.Translator::numberToLocale($costo_ore_unitario).'x'.Translator::numberToLocale($ore).'<br>+'.Translator::numberToLocale($costo_dirittochiamata).'</small> <small class="help-block">'.numberFormat($costo_ore_unitario).'x'.numberFormat($ore).'<br>+'.numberFormat($costo_dirittochiamata).'</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>'.tr('Scontato').':</th> <th>'.tr('Scontato').':</th>
<td class="text-right">'.Translator::numberToLocale($costo_ore_consuntivo - $sconto).'</td> <td class="text-right">'.numberFormat($costo_ore_consuntivo - $sconto).'</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -139,31 +139,31 @@ if (!empty($sessioni)) {
// KM // KM
echo ' echo '
<td style="border-right:1px solid #aaa;"> <td style="border-right:1px solid #aaa;">
'.Translator::numberToLocale($km).' '.numberFormat($km).'
<div class="extra hide"> <div class="extra hide">
<table class="table table-condensed table-bordered"> <table class="table table-condensed table-bordered">
<tr> <tr>
<th class="text-danger">'.tr('Costo').':</th> <th class="text-danger">'.tr('Costo').':</th>
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($costo_km_consuntivo_tecnico).' '.numberFormat($costo_km_consuntivo_tecnico).'
<small class="help-block"> <small class="help-block">
'.Translator::numberToLocale($costo_km_unitario_tecnico).'x'.Translator::numberToLocale($km).' '.numberFormat($costo_km_unitario_tecnico).'x'.numberFormat($km).'
</small><br> </small><br>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>'.tr('Addebito').':</th> <th>'.tr('Addebito').':</th>
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($costo_km_consuntivo).' '.numberFormat($costo_km_consuntivo).'
<small class="help-block"> <small class="help-block">
'.Translator::numberToLocale($costo_km_unitario).'x'.Translator::numberToLocale($km).' '.numberFormat($costo_km_unitario).'x'.numberFormat($km).'
</small><br> </small><br>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>'.tr('Scontato').':</th> <th>'.tr('Scontato').':</th>
<td class="text-right">'.Translator::numberToLocale($costo_km_consuntivo - $scontokm).'</td> <td class="text-right">'.numberFormat($costo_km_consuntivo - $scontokm).'</td>
</tr> </tr>
</table> </table>
</div> </div>
@ -174,7 +174,7 @@ if (!empty($sessioni)) {
echo ' echo '
<td style="border-right:1px solid #aaa;"> <td style="border-right:1px solid #aaa;">
'.tr('_TOT_ _TYPE_', [ '.tr('_TOT_ _TYPE_', [
'_TOT_' => Translator::numberToLocale($sessione['sconto_unitario']), '_TOT_' => numberFormat($sessione['sconto_unitario']),
'_TYPE_' => ($sessione['tipo_sconto'] == 'PRC' ? '%' : currency()), '_TYPE_' => ($sessione['tipo_sconto'] == 'PRC' ? '%' : currency()),
]).' ]).'
</td>'; </td>';
@ -185,7 +185,7 @@ if (!empty($sessioni)) {
echo ' echo '
<td style="border-right:1px solid #aaa;"> <td style="border-right:1px solid #aaa;">
'.tr('_TOT_ _TYPE_', [ '.tr('_TOT_ _TYPE_', [
'_TOT_' => Translator::numberToLocale($sessione['scontokm_unitario']), '_TOT_' => numberFormat($sessione['scontokm_unitario']),
'_TYPE_' => ($sessione['tipo_sconto_km'] == 'PRC' ? '%' : currency()), '_TYPE_' => ($sessione['tipo_sconto_km'] == 'PRC' ? '%' : currency()),
]).' ]).'
</td>'; </td>';

View File

@ -118,7 +118,7 @@ switch (post('op')) {
$descrizione = tr('Attività numero _NUM_ del _DATE_ [_STATE_]', [ $descrizione = tr('Attività numero _NUM_ del _DATE_ [_STATE_]', [
'_NUM_' => $intervento['codice_intervento'], '_NUM_' => $intervento['codice_intervento'],
'_DATE_' => Translator::dateToLocale($intervento['data']), '_DATE_' => dateFormat($intervento['data']),
'_STATE_' => $intervento['stato'], '_STATE_' => $intervento['stato'],
]); ]);

View File

@ -25,8 +25,8 @@ if (empty($record['firma_file'])) {
} else { } else {
$frase = tr('Nuova anteprima e firma'); $frase = tr('Nuova anteprima e firma');
$info_firma = ''.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [ $info_firma = ''.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
'_DATE_' => Translator::dateToLocale($record['firma_data']), '_DATE_' => dateFormat($record['firma_data']),
'_TIME_' => Translator::timeToLocale($record['firma_data']), '_TIME_' => timeFormat($record['firma_data']),
'_PERSON_' => '<b>'.$record['firma_nome'].'</b>', '_PERSON_' => '<b>'.$record['firma_nome'].'</b>',
]).''; ]).'';
} }

View File

@ -534,8 +534,8 @@ $articoli = $intervento->articoli;
echo ' echo '
<img src="'.base_url().'/files/interventi/'.$record['firma_file'].'" class="img-thumbnail"><div>&nbsp;</div> <img src="'.base_url().'/files/interventi/'.$record['firma_file'].'" class="img-thumbnail"><div>&nbsp;</div>
<div class="col-md-6 col-md-offset-3 alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [ <div class="col-md-6 col-md-offset-3 alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
'_DATE_' => Translator::dateToLocale($record['firma_data']), '_DATE_' => dateFormat($record['firma_data']),
'_TIME_' => Translator::timeToLocale($record['firma_data']), '_TIME_' => timeFormat($record['firma_data']),
'_PERSON_' => '<b>'.$record['firma_nome'].'</b>', '_PERSON_' => '<b>'.$record['firma_nome'].'</b>',
]).'</div>'; ]).'</div>';
} }
@ -763,7 +763,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_ [_STATE_]', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_ [_STATE_]', [
'_DOC_' => $fattura['tipo_documento'], '_DOC_' => $fattura['tipo_documento'],
'_NUM_' => !empty($fattura['numero_esterno']) ? $fattura['numero_esterno'] : $fattura['numero'], '_NUM_' => !empty($fattura['numero_esterno']) ? $fattura['numero_esterno'] : $fattura['numero'],
'_DATE_' => Translator::dateToLocale($fattura['data']), '_DATE_' => dateFormat($fattura['data']),
'_STATE_' => $fattura['stato_documento'], '_STATE_' => $fattura['stato_documento'],
]); ]);

View File

@ -98,7 +98,7 @@ $righe = $intervento->getRighe();
// Quantità // Quantità
echo ' echo '
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($riga->qta, 'qta').' '.$riga->um.' '.numberFormat($riga->qta, 'qta').' '.$riga->um.'
</td>'; </td>';
if ($show_prezzi) { if ($show_prezzi) {

View File

@ -29,9 +29,9 @@ return [
'numero' => $r['codice'], 'numero' => $r['codice'],
'richiesta' => $r['richiesta'], 'richiesta' => $r['richiesta'],
'descrizione' => $r['descrizione'], 'descrizione' => $r['descrizione'],
'data' => Translator::dateToLocale($r['data_richiesta']), 'data' => dateFormat($r['data_richiesta']),
'data richiesta' => Translator::dateToLocale($r['data_richiesta']), 'data richiesta' => dateFormat($r['data_richiesta']),
'data fine intervento' => empty($r['data_fine']) ? Translator::dateToLocale($r['data_richiesta']) : Translator::dateToLocale($r['data_fine']), 'data fine intervento' => empty($r['data_fine']) ? dateFormat($r['data_richiesta']) : dateFormat($r['data_fine']),
'id_anagrafica' => $r['idanagrafica'], 'id_anagrafica' => $r['idanagrafica'],
'stato' => $r['stato'], 'stato' => $r['stato'],
]; ];

View File

@ -30,7 +30,7 @@ if (!empty($rs)) {
</tr>'; </tr>';
foreach ($rs as $r) { foreach ($rs as $r) {
$data_richiesta = !empty($r['data_richiesta']) ? Translator::dateToLocale($r['data_richiesta']) : ''; $data_richiesta = !empty($r['data_richiesta']) ? dateFormat($r['data_richiesta']) : '';
echo ' echo '
<tr > <tr >

View File

@ -92,7 +92,7 @@ foreach ($raggruppamenti as $mese => $raggruppamento) {
echo ' echo '
</small> </small>
</td> </td>
<td>'.Translator::dateToLocale($r['data_richiesta']).' '.((empty($r['data_scadenza'])) ? '' : '<br><small>Entro il '.Translator::dateToLocale($r['data_scadenza']).'</small>').'</td> <td>'.dateFormat($r['data_richiesta']).' '.((empty($r['data_scadenza'])) ? '' : '<br><small>Entro il '.dateFormat($r['data_scadenza']).'</small>').'</td>
<td> <td>
'.$rs_tecnici[0]['tecnici'].' '.$rs_tecnici[0]['tecnici'].'
</td> </td>

View File

@ -53,7 +53,7 @@ if (!empty($rs)) {
echo ' echo '
</small> </small>
</td> </td>
<td>'.Translator::dateToLocale($r['data_richiesta']).' '.((empty($r['data_scadenza'])) ? '' : '<br><small>Entro il '.Translator::dateToLocale($r['data_scadenza']).'</small>').'</td> <td>'.dateFormat($r['data_richiesta']).' '.((empty($r['data_scadenza'])) ? '' : '<br><small>Entro il '.dateFormat($r['data_scadenza']).'</small>').'</td>
<td> <td>
'.$rs_tecnici[0]['tecnici'].' '.$rs_tecnici[0]['tecnici'].'
</td> </td>

View File

@ -358,7 +358,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'], '_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
]); ]);
if (!in_array($elemento['tipo_documento'], ['Ddt in uscita', 'Ddt in entrata'])) { if (!in_array($elemento['tipo_documento'], ['Ddt in uscita', 'Ddt in entrata'])) {

View File

@ -49,7 +49,7 @@ if (!empty($interventi)) {
<a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a> <a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a>
'.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [ '.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [
'_NUM_' => $intervento->codice, '_NUM_' => $intervento->codice,
'_DATE_' => Translator::dateToLocale($intervento->inizio), '_DATE_' => dateFormat($intervento->inizio),
])).' ])).'
</td> </td>
@ -290,10 +290,10 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ore']).'</td> <td class="text-right">'.numberFormat($tipologia['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' </td> <td class="text-right">'.numberFormat($tipologia['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' </td> <td class="text-right">'.numberFormat($tipologia['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -317,11 +317,11 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ore']).'</td> <td class="text-right">'.numberFormat($tecnico['ore']).'</td>
<td class="text-right">'.(int)$tecnico['km'].'</td> <td class="text-right">'.(int)$tecnico['km'].'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' </td> <td class="text-right">'.numberFormat($tecnico['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' </td> <td class="text-right">'.numberFormat($tecnico['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -346,10 +346,10 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td> <td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($stato['ore']).'</td> <td class="text-right">'.numberFormat($stato['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' </td> <td class="text-right">'.numberFormat($stato['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' </td> <td class="text-right">'.numberFormat($stato['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -375,9 +375,9 @@ if ($diff > 0) {
<tr> <tr>
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td> <td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
} }
@ -391,9 +391,9 @@ if ($diff > 0) {
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '

View File

@ -130,12 +130,12 @@ foreach ($righe as $riga) {
} }
if (!empty($riga->ora_evasione)) { if (!empty($riga->ora_evasione)) {
$ora_evasione = '<br>'.Translator::timeToLocale($riga->ora_evasione).''; $ora_evasione = '<br>'.timeFormat($riga->ora_evasione).'';
} else { } else {
$ora_evasione = ''; $ora_evasione = '';
} }
$info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.Translator::dateToLocale($riga->data_evasione).$ora_evasione.'</span>'; $info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.dateFormat($riga->data_evasione).$ora_evasione.'</span>';
} }
echo ' echo '

View File

@ -27,5 +27,5 @@ return [
'id_anagrafica' => $r['idanagrafica'], 'id_anagrafica' => $r['idanagrafica'],
'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'], 'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'],
'note' => $r['note'], 'note' => $r['note'],
'data' => Translator::dateToLocale($r['data']), 'data' => dateFormat($r['data']),
]; ];

View File

@ -195,7 +195,7 @@ foreach ($primo_livello as $conto_primo) {
// Span con info del conto // Span con info del conto
echo ' echo '
<span class="clickable" id="movimenti-'.$conto_terzo['id'].'"> <span class="clickable" id="movimenti-'.$conto_terzo['id'].'">
&nbsp;'.$conto_secondo['numero'].'.'.$conto_terzo['numero'].' '.$conto_terzo['descrizione'].($conto_terzo['percentuale_deducibile'] < 100 ? ' <span class="text-muted">('.tr('deducibile al _PERC_%', ['_PERC_' => Translator::numberToLocale($conto_terzo['percentuale_deducibile'], 0)]).')</span>' : '').' &nbsp;'.$conto_secondo['numero'].'.'.$conto_terzo['numero'].' '.$conto_terzo['descrizione'].($conto_terzo['percentuale_deducibile'] < 100 ? ' <span class="text-muted">('.tr('deducibile al _PERC_%', ['_PERC_' => numberFormat($conto_terzo['percentuale_deducibile'], 0)]).')</span>' : '').'
</span> </span>
<div id="conto_'.$conto_terzo['id'].'" style="display:none;"></div> <div id="conto_'.$conto_terzo['id'].'" style="display:none;"></div>
</td> </td>

View File

@ -50,7 +50,7 @@ foreach ($rs as $r) {
$result['title'] = 'Preventivo '.$r['numero']; $result['title'] = 'Preventivo '.$r['numero'];
if ($r['data_accettazione'] == '0000-00-00') { if ($r['data_accettazione'] == '0000-00-00') {
$result['title'] .= ' del '.Translator::dateToLocale($r['data_accettazione']); $result['title'] .= ' del '.dateFormat($r['data_accettazione']);
} }
$result['category'] = 'Preventivi'; $result['category'] = 'Preventivi';

View File

@ -402,7 +402,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'], '_NUM_' => !empty($elemento['numero_esterno']) ? $elemento['numero_esterno'] : $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
]); ]);
echo ' echo '

View File

@ -49,7 +49,7 @@ if (!empty($interventi)) {
<a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a> <a href="javascript:;" class="btn btn-primary btn-xs" onclick="$(\'#dettagli_'.$intervento->id.'\').toggleClass(\'hide\'); $(this).find(\'i\').toggleClass(\'fa-plus\').toggleClass(\'fa-minus\');"><i class="fa fa-plus"></i></a>
'.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [ '.Modules::link('Interventi', $intervento->id, tr('Intervento num. _NUM_ del _DATE_', [
'_NUM_' => $intervento->codice, '_NUM_' => $intervento->codice,
'_DATE_' => Translator::dateToLocale($intervento->inizio), '_DATE_' => dateFormat($intervento->inizio),
])).' ])).'
</td> </td>
@ -290,10 +290,10 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ore']).'</td> <td class="text-right">'.numberFormat($tipologia['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($tipologia['costo']).' </td> <td class="text-right">'.numberFormat($tipologia['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tipologia['ricavo']).' </td> <td class="text-right">'.numberFormat($tipologia['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -317,11 +317,11 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ore']).'</td> <td class="text-right">'.numberFormat($tecnico['ore']).'</td>
<td class="text-right">'.(int)$tecnico['km'].'</td> <td class="text-right">'.(int)$tecnico['km'].'</td>
<td class="text-right">'.Translator::numberToLocale($tecnico['costo']).' </td> <td class="text-right">'.numberFormat($tecnico['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($tecnico['ricavo']).' </td> <td class="text-right">'.numberFormat($tecnico['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -346,10 +346,10 @@ if ($diff > 0) {
echo ' echo '
<tr> <tr>
<td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td> <td><div class="img-circle" style="width:18px; height:18px; position:relative; bottom:-2px; background:'.$stato['colore'].'; float:left;"></div> '.$key.'</td>
<td class="text-right">'.Translator::numberToLocale($stato['ore']).'</td> <td class="text-right">'.numberFormat($stato['ore']).'</td>
<td class="text-right">'.Translator::numberToLocale($stato['costo']).' </td> <td class="text-right">'.numberFormat($stato['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($stato['ricavo']).' </td> <td class="text-right">'.numberFormat($stato['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -375,9 +375,9 @@ if ($diff > 0) {
<tr> <tr>
<td>'.Modules::link('Articoli', $materiale['id'], $key).'</td> <td>'.Modules::link('Articoli', $materiale['id'], $key).'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
} }
@ -391,9 +391,9 @@ if ($diff > 0) {
<tr> <tr>
<td>'.$key.'</td> <td>'.$key.'</td>
<td class="text-center">'.$materiale['qta'].'</td> <td class="text-center">'.$materiale['qta'].'</td>
<td class="text-right">'.Translator::numberToLocale($materiale['costo']).' </td> <td class="text-right">'.numberFormat($materiale['costo']).' </td>
<td class="text-right">'.Translator::numberToLocale($materiale['ricavo']).' </td> <td class="text-right">'.numberFormat($materiale['ricavo']).' </td>
<td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.Translator::numberToLocale($margine).' ('.$margine_prc.'%)</td> <td class="text-right '.($margine>0 ? 'bg-success' : 'bg-danger').'">'.numberFormat($margine).' ('.$margine_prc.'%)</td>
</tr>'; </tr>';
} }
echo ' echo '

View File

@ -91,12 +91,12 @@ foreach ($righe as $riga) {
} }
if (!empty($riga->ora_evasione)) { if (!empty($riga->ora_evasione)) {
$ora_evasione = '<br>'.Translator::timeToLocale($riga->ora_evasione).''; $ora_evasione = '<br>'.timeFormat($riga->ora_evasione).'';
} else { } else {
$ora_evasione = ''; $ora_evasione = '';
} }
$info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.Translator::dateToLocale($riga->data_evasione).$ora_evasione.'</span>'; $info_evasione = '<span class="tip" title="'.$evasione_help.'"><i class="'.$evasione_icon.'"></i> '.dateFormat($riga->data_evasione).$ora_evasione.'</span>';
} }
echo ' echo '

View File

@ -30,7 +30,7 @@ return [
'numero' => $r['numero'], 'numero' => $r['numero'],
'ragione_sociale' => $r['ragione_sociale'], 'ragione_sociale' => $r['ragione_sociale'],
'descrizione' => $r['descrizione'], 'descrizione' => $r['descrizione'],
'data' => Translator::dateToLocale($r['data_bozza']), 'data' => dateFormat($r['data_bozza']),
'id_anagrafica' => $r['idanagrafica'], 'id_anagrafica' => $r['idanagrafica'],
'revisione' => $revisione, 'revisione' => $revisione,
]; ];

View File

@ -33,8 +33,8 @@ if (!empty($rs)) {
</tr>"; </tr>";
foreach ($rs as $preventivo) { foreach ($rs as $preventivo) {
$data_accettazione = ($preventivo['data_accettazione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_accettazione']) : ''; $data_accettazione = ($preventivo['data_accettazione'] != '0000-00-00') ? dateFormat($preventivo['data_accettazione']) : '';
$data_conclusione = ($preventivo['data_conclusione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_conclusione']) : ''; $data_conclusione = ($preventivo['data_conclusione'] != '0000-00-00') ? dateFormat($preventivo['data_conclusione']) : '';
if (strtotime($preventivo['data_conclusione']) < strtotime(date('Y-m-d')) && $data_conclusione != '') { if (strtotime($preventivo['data_conclusione']) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
$attr = ' class="danger"'; $attr = ' class="danger"';

View File

@ -227,13 +227,13 @@ if ($numero_documenti + $numero_scadenze > 1) {
'_OP_' => $operation, '_OP_' => $operation,
'_DOC_' => strtolower($tipo_fattura), '_DOC_' => strtolower($tipo_fattura),
'_NUM_' => $numero_fattura, '_NUM_' => $numero_fattura,
'_DATE_' => Translator::dateToLocale($fattura['data']), '_DATE_' => dateFormat($fattura['data']),
'_NAME_' => $fattura->anagrafica['ragione_sociale'], '_NAME_' => $fattura->anagrafica['ragione_sociale'],
]); ]);
} elseif ($numero_scadenze == 1) { } elseif ($numero_scadenze == 1) {
$descrizione = tr('Pag. _OP_ del _DATE_', [ $descrizione = tr('Pag. _OP_ del _DATE_', [
'_OP_' => $scadenza['descrizione'], '_OP_' => $scadenza['descrizione'],
'_DATE_' => Translator::dateToLocale($scadenza['scadenza']), '_DATE_' => dateFormat($scadenza['scadenza']),
]); ]);
} }

View File

@ -70,7 +70,7 @@ if (!empty($documento)) {
<tr> <tr>
<th>'.tr('Data').':</th> <th>'.tr('Data').':</th>
<td>'.Translator::dateToLocale($documento->data).'</td> <td>'.dateFormat($documento->data).'</td>
</tr> </tr>
<tr> <tr>
@ -94,7 +94,7 @@ if (!empty($documento)) {
if( !empty($record['presentazioni_exported_at']) ){ if( !empty($record['presentazioni_exported_at']) ){
$export_riba = '<i class="fa fa-check text-success"></i> '.tr('Esportata il _DATA_',[ $export_riba = '<i class="fa fa-check text-success"></i> '.tr('Esportata il _DATA_',[
'_DATA_' => Translator::timestampToLocale($record['presentazioni_exported_at']), '_DATA_' => timestampFormat($record['presentazioni_exported_at']),
]).''; ]).'';
}else{ }else{
$export_riba = '<i class="fa fa-clock-o text-warning"></i> '.tr('Non ancora esportata'); $export_riba = '<i class="fa fa-clock-o text-warning"></i> '.tr('Non ancora esportata');

View File

@ -39,8 +39,8 @@ return [
'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'], 'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'],
'note' => $r['note'], 'note' => $r['note'],
'pagamento' => $r['pagamento'], 'pagamento' => $r['pagamento'],
'totale' => Translator::numberToLocale(abs($r['totale'])), 'totale' => numberFormat(abs($r['totale'])),
'data_scadenza' => Translator::dateToLocale($r['scadenza']), 'data_scadenza' => dateFormat($r['scadenza']),
'data' => Translator::dateToLocale($r['data']), 'data' => dateFormat($r['data']),
'logo_azienda' => !empty($logo_azienda) ? '<img src="'.$logo_azienda.'" />' : '', 'logo_azienda' => !empty($logo_azienda) ? '<img src="'.$logo_azienda.'" />' : '',
]; ];

View File

@ -47,8 +47,8 @@ echo '
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">'.tr('Comunicazione dati fatture (ex-spesometro)<br> dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Comunicazione dati fatture (ex-spesometro)<br> dal _START_ al _END_', [
'_START_' => Translator::dateToLocale(session('period_start')), '_START_' => dateFormat(session('period_start')),
'_END_' => Translator::dateToLocale(session('period_end')), '_END_' => dateFormat(session('period_end')),
]).'</h3> ]).'</h3>
</div> </div>
@ -62,8 +62,8 @@ echo '
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">'.tr('Dati economici<br> dal _START_ al _END_', [ <h3 class="panel-title">'.tr('Dati economici<br> dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($_SESSION['period_start']), '_START_' => dateFormat($_SESSION['period_start']),
'_END_' => Translator::dateToLocale($_SESSION['period_end']), '_END_' => dateFormat($_SESSION['period_end']),
]).'</h3> ]).'</h3>
</div> </div>

View File

@ -39,11 +39,11 @@ echo '
} }
echo ' echo '
<div class="col-md-4"> <div class="col-md-4">
{[ "type": "date", "label": "'.tr('Data inizio').'", "required": "1", "name": "date_start", "value": "'.Translator::dateToLocale(session('period_start')).'" ]} {[ "type": "date", "label": "'.tr('Data inizio').'", "required": "1", "name": "date_start", "value": "'.dateFormat(session('period_start')).'" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{[ "type": "date", "label": "'.tr('Data fine').'", "required": "1", "name": "date_end", "value": "'.Translator::dateToLocale(session('period_end')).'" ]} {[ "type": "date", "label": "'.tr('Data fine').'", "required": "1", "name": "date_end", "value": "'.dateFormat(session('period_end')).'" ]}
</div> </div>
</div>'; </div>';

View File

@ -211,7 +211,7 @@ if (!empty($clienti)) {
<td>'.Modules::link('Anagrafiche', $cliente['idanagrafica'], $cliente['ragione_sociale']).'</td> <td>'.Modules::link('Anagrafiche', $cliente['idanagrafica'], $cliente['ragione_sociale']).'</td>
<td class="text-right">'.intval($cliente['qta']).'</td> <td class="text-right">'.intval($cliente['qta']).'</td>
<td class="text-right">'.moneyFormat($cliente['totale'], 2).'</td> <td class="text-right">'.moneyFormat($cliente['totale'], 2).'</td>
<td class="text-right">'.Translator::numberToLocale($cliente['totale'] * 100 / $totale[0]['totale'], 2).' %</td> <td class="text-right">'.numberFormat($cliente['totale'] * 100 / $totale[0]['totale'], 2).' %</td>
</tr>'; </tr>';
} }
echo ' echo '
@ -257,8 +257,8 @@ if (!empty($articoli)) {
echo ' echo '
<tr> <tr>
<td>'.Modules::link('Articoli', $articolo['id'], $articolo['codice'].' - '.$articolo['descrizione']).'</td> <td>'.Modules::link('Articoli', $articolo['id'], $articolo['codice'].' - '.$articolo['descrizione']).'</td>
<td class="text-right">'.Translator::numberToLocale($articolo['qta'], 'qta').' '.$articolo['um'].'</td> <td class="text-right">'.numberFormat($articolo['qta'], 'qta').' '.$articolo['um'].'</td>
<td class="text-right">'.Translator::numberToLocale($articolo['qta'] * 100 / $totale[0]['totale_qta'], 2).' %</td> <td class="text-right">'.numberFormat($articolo['qta'] * 100 / $totale[0]['totale_qta'], 2).' %</td>
<td class="text-right">'.moneyFormat($articolo['totale'], 2).'</td> <td class="text-right">'.moneyFormat($articolo['totale'], 2).'</td>
</tr>'; </tr>';
} }

View File

@ -20,7 +20,7 @@
if (!empty($record['failed_at'])) { if (!empty($record['failed_at'])) {
echo ' echo '
<span class="label label-danger"> <span class="label label-danger">
<i class="fa fa-times"></i> '.tr('Email fallita il: ').Translator::timestampToLocale($record['failed_at']).' <i class="fa fa-times"></i> '.tr('Email fallita il: ').timestampFormat($record['failed_at']).'
</span> &nbsp;'; </span> &nbsp;';
echo ' echo '
@ -35,6 +35,6 @@ if (!empty($record['failed_at'])) {
} elseif (!empty($record['sent_at'])) { } elseif (!empty($record['sent_at'])) {
echo ' echo '
<span class="label label-success"> <span class="label label-success">
<i class="fa fa-success"></i> '.tr('Email inviata il: ').Translator::timestampToLocale($record['sent_at']).' <i class="fa fa-success"></i> '.tr('Email inviata il: ').timestampFormat($record['sent_at']).'
</span>'; </span>';
} }

View File

@ -140,7 +140,7 @@ if (!empty($elementi)) {
$descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [ $descrizione = tr('_DOC_ num. _NUM_ del _DATE_', [
'_DOC_' => $elemento['tipo_documento'], '_DOC_' => $elemento['tipo_documento'],
'_NUM_' => $elemento['numero'], '_NUM_' => $elemento['numero'],
'_DATE_' => Translator::dateToLocale($elemento['data']), '_DATE_' => dateFormat($elemento['data']),
]); ]);
if (in_array($elemento['tipo_documento'], ['Intervento'])) { if (in_array($elemento['tipo_documento'], ['Intervento'])) {

View File

@ -26,7 +26,6 @@ use Modules\Anagrafiche\Anagrafica;
use Modules\Fatture\Fattura; use Modules\Fatture\Fattura;
use Modules\Fatture\Gestori\Bollo; use Modules\Fatture\Gestori\Bollo;
use Prints; use Prints;
use Translator;
use UnexpectedValueException; use UnexpectedValueException;
use Uploads; use Uploads;
use Validate; use Validate;
@ -1427,7 +1426,7 @@ class FatturaElettronica
if (!empty($riga['ritenuta_contributi'])) { if (!empty($riga['ritenuta_contributi'])) {
$dettaglio[]['AltriDatiGestionali'] = [ $dettaglio[]['AltriDatiGestionali'] = [
'TipoDato' => 'CASSA-PREV', 'TipoDato' => 'CASSA-PREV',
'RiferimentoTesto' => setting('Tipo Cassa Previdenziale').' - '.$ritenuta_contributi->descrizione.' ('.Translator::numberToLocale($ritenuta_contributi->percentuale).'%)', 'RiferimentoTesto' => setting('Tipo Cassa Previdenziale').' - '.$ritenuta_contributi->descrizione.' ('.numberFormat($ritenuta_contributi->percentuale).'%)',
'RiferimentoNumero' => $riga->ritenuta_contributi, 'RiferimentoNumero' => $riga->ritenuta_contributi,
]; ];
} }

View File

@ -158,7 +158,7 @@ echo '
<br><small> <br><small>
'.$tipo_documento.' '.$tipo_documento.'
<br>'.Translator::dateToLocale($dati_generali['Data']).' <br>'.dateFormat($dati_generali['Data']).'
<br>'.$dati_generali['Divisa'].' <br>'.$dati_generali['Divisa'].'
</small> </small>
</h4> </h4>

View File

@ -95,7 +95,7 @@ if (!$clienti->isEmpty()) {
<td class="text-right"> <td class="text-right">
'.moneyFormat($dettaglio->prezzo_unitario).' '.moneyFormat($dettaglio->prezzo_unitario).'
<p><small class="label label-default tip" title="'.Translator::timestampToLocale($dettaglio['updated_at']).'"><i class="fa fa-clock-o"></i> '.Carbon::parse($dettaglio['updated_at'])->diffForHumans().'</small></p> <p><small class="label label-default tip" title="'.timestampFormat($dettaglio['updated_at']).'"><i class="fa fa-clock-o"></i> '.Carbon::parse($dettaglio['updated_at'])->diffForHumans().'</small></p>
</td> </td>
<td class="text-right"> <td class="text-right">

View File

@ -181,7 +181,7 @@ if (!$fornitori_disponibili->isEmpty()) {
<td class="text-right"> <td class="text-right">
'.moneyFormat($dettaglio->prezzo_unitario).' '.moneyFormat($dettaglio->prezzo_unitario).'
<p><small class="label label-default tip" title="'.Translator::timestampToLocale($dettaglio['updated_at']).'"><i class="fa fa-clock-o"></i> '.$dettaglio->updated_at->diffForHumans().'</small></p> <p><small class="label label-default tip" title="'.timestampFormat($dettaglio['updated_at']).'"><i class="fa fa-clock-o"></i> '.$dettaglio->updated_at->diffForHumans().'</small></p>
</td> </td>
<td class="text-right"> <td class="text-right">

View File

@ -57,7 +57,7 @@ if (!empty($movimenti)) {
echo ' echo '
<tr> <tr>
<td class="text-center">'.Translator::dateToLocale($movimento['data']).'</td> <td class="text-center">'.dateFormat($movimento['data']).'</td>
<td>'.$descrizione.'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td> <td>'.$descrizione.'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td>
<td class="text-right">'.($movimento['totale']>0 ? moneyFormat(abs($movimento['totale'])) : "").'</td> <td class="text-right">'.($movimento['totale']>0 ? moneyFormat(abs($movimento['totale'])) : "").'</td>
<td class="text-right">'.($movimento['totale']<0 ? moneyFormat(abs($movimento['totale'])) : "").'</td> <td class="text-right">'.($movimento['totale']<0 ? moneyFormat(abs($movimento['totale'])) : "").'</td>
@ -82,7 +82,7 @@ if (!empty($movimenti)) {
echo ' echo '
<tr> <tr>
<td class="text-center">'.Translator::dateToLocale($altro_movimento['data']).'</td> <td class="text-center">'.dateFormat($altro_movimento['data']).'</td>
<td>'.$descrizione.'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td> <td>'.$descrizione.'<small class="pull-right text-right text-muted" style="font-size:8pt;">'.($documento ? $documento->getReference() : '').'</small></td>
<td class="text-right">'.($altro_movimento['totale']>0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td> <td class="text-right">'.($altro_movimento['totale']>0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td>
<td class="text-right">'.($altro_movimento['totale']<0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td> <td class="text-right">'.($altro_movimento['totale']<0 ? moneyFormat(abs($altro_movimento['totale'])) : "").'</td>

View File

@ -130,7 +130,7 @@ foreach ($righe as $riga) {
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "descrizione['.$riga->id.']", "value": "'.$descrizione.'", "extra": "rows=6" ]} {[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "descrizione['.$riga->id.']", "value": "'.$descrizione.'", "extra": "rows=6" ]}
{[ "type": "number", "label": "'.tr('Q.tà per fattura').'", "class":"qta_fattura", "name": "qta['.$riga->id.']", "required": 1, "value": "1", "decimals": "qta", "min-value": "1", "icon-after":"'.tr('su _TOT_ totali', [ {[ "type": "number", "label": "'.tr('Q.tà per fattura').'", "class":"qta_fattura", "name": "qta['.$riga->id.']", "required": 1, "value": "1", "decimals": "qta", "min-value": "1", "icon-after":"'.tr('su _TOT_ totali', [
'_TOT_' => Translator::numberToLocale(($riga->qta - $riga->qta_evasa)), '_TOT_' => numberFormat(($riga->qta - $riga->qta_evasa)),
]).'", "options":"'.str_replace('"', '\"', $options).'" ]} ]).'", "options":"'.str_replace('"', '\"', $options).'" ]}
</div> </div>
<div class="col-md-3" id="totali_'.$riga->id.'"> <div class="col-md-3" id="totali_'.$riga->id.'">
@ -142,7 +142,7 @@ foreach ($righe as $riga) {
echo ' <div class="label label-warning alert_rate hide"> echo ' <div class="label label-warning alert_rate hide">
<i class="fa fa-warning"></i> <span>'.tr('Attenzione, sono previste _RATE_ rate su _TOT_ quantità totali', [ <i class="fa fa-warning"></i> <span>'.tr('Attenzione, sono previste _RATE_ rate su _TOT_ quantità totali', [
'_RATE_' => '<span class="num_rate"></span>', '_RATE_' => '<span class="num_rate"></span>',
'_TOT_' => '<span class="qta_disponibili">'.Translator::numberToLocale(($riga->qta - $riga->qta_evasa)).'</span>', '_TOT_' => '<span class="qta_disponibili">'.numberFormat(($riga->qta - $riga->qta_evasa)).'</span>',
]).'</span>. ]).'</span>.
</div><hr>'; </div><hr>';

View File

@ -29,9 +29,9 @@
</ul>'; </ul>';
if (!empty($descrizione)) { if (!empty($descrizione)) {
$result['descrizione'] = str_replace('{periodo}', 'durata dal '.Translator::dateToLocale($inizio).' al '.Translator::dateToLocale($fine), $descrizione); $result['descrizione'] = str_replace('{periodo}', 'durata dal '.dateFormat($inizio).' al '.dateFormat($fine), $descrizione);
$result['descrizione'] = str_replace('{data_inizio}', Translator::dateToLocale($inizio), $result['descrizione']); $result['descrizione'] = str_replace('{data_inizio}', dateFormat($inizio), $result['descrizione']);
$result['descrizione'] = str_replace('{data_fine}', Translator::dateToLocale($fine), $result['descrizione']); $result['descrizione'] = str_replace('{data_fine}', dateFormat($fine), $result['descrizione']);
$result['descrizione'] = str_replace('{mese_fatturazione}', $mese[date('m', strtotime($inizio))], $result['descrizione']); $result['descrizione'] = str_replace('{mese_fatturazione}', $mese[date('m', strtotime($inizio))], $result['descrizione']);
$result['descrizione'] = str_replace('{rata_attuale}', $rata, $result['descrizione']); $result['descrizione'] = str_replace('{rata_attuale}', $rata, $result['descrizione']);
$result['descrizione'] = str_replace('{numero_rate}', $numero_fatture, $result['descrizione']); $result['descrizione'] = str_replace('{numero_rate}', $numero_fatture, $result['descrizione']);

View File

@ -122,7 +122,7 @@ if (!$elenco_promemoria->isEmpty()) {
foreach ($righe as $riga) { foreach ($righe as $riga) {
$info_righe .= tr('_QTA_ _UM_ x _DESC_', [ $info_righe .= tr('_QTA_ _UM_ x _DESC_', [
'_DESC_' => ($riga->isArticolo() ? Modules::link('Articoli', $riga['idarticolo'], $riga['descrizione']) : $riga['descrizione']), '_DESC_' => ($riga->isArticolo() ? Modules::link('Articoli', $riga['idarticolo'], $riga['descrizione']) : $riga['descrizione']),
'_QTA_' => Translator::numberToLocale($riga['qta']), '_QTA_' => numberFormat($riga['qta']),
'_UM_' => $riga['um'], '_UM_' => $riga['um'],
]).'<br>'; ]).'<br>';
} }
@ -139,7 +139,7 @@ if (!$elenco_promemoria->isEmpty()) {
echo ' echo '
<tr> <tr>
<td>'.Translator::dateToLocale($promemoria['data_richiesta']).'</td> <td>'.dateFormat($promemoria['data_richiesta']).'</td>
<td>'.$promemoria->tipo->descrizione.'</td> <td>'.$promemoria->tipo->descrizione.'</td>
<td>'.nl2br($promemoria['richiesta']).'</td> <td>'.nl2br($promemoria['richiesta']).'</td>
<td>'.$info_intervento.'</td> <td>'.$info_intervento.'</td>

View File

@ -87,7 +87,7 @@ if (!$righe->isEmpty()) {
// Quantità // Quantità
echo ' echo '
<td class="text-right"> <td class="text-right">
'.Translator::numberToLocale($riga->qta, 'qta').' '.$riga->um.' '.numberFormat($riga->qta, 'qta').' '.$riga->um.'
</td>'; </td>';
if ($show_prezzi) { if ($show_prezzi) {

View File

@ -85,8 +85,8 @@ while (!empty($id_contratto_precedente) && $counter < 50) {
]).'<br><small class="text-muted">'.$rs[0]['nome'].'</small>').' ]).'<br><small class="text-muted">'.$rs[0]['nome'].'</small>').'
</td> </td>
<td class="text-right">'.moneyFormat($rs[0]['budget']).'</td> <td class="text-right">'.moneyFormat($rs[0]['budget']).'</td>
<td align="center">'.Translator::dateToLocale($rs[0]['data_accettazione']).'</td> <td align="center">'.dateFormat($rs[0]['data_accettazione']).'</td>
<td align="center">'.Translator::dateToLocale($rs[0]['data_conclusione']).'</td> <td align="center">'.dateFormat($rs[0]['data_conclusione']).'</td>
</tr>'; </tr>';
$id_contratto_precedente = $rs[0]['idcontratto_prev']; $id_contratto_precedente = $rs[0]['idcontratto_prev'];

View File

@ -52,6 +52,6 @@ echo '
<td class="text-right">'.moneyFormat($prezzo_medio).'</td> <td class="text-right">'.moneyFormat($prezzo_medio).'</td>
<td class="text-right">'.moneyFormat($prezzo_max['prezzo']).'</td> <td class="text-right">'.moneyFormat($prezzo_max['prezzo']).'</td>
<td class="text-right">'.moneyFormat($oscillazione).'</td> <td class="text-right">'.moneyFormat($oscillazione).'</td>
<td class="text-right">'.Translator::numberToLocale($oscillazione_percentuale, '2').' %</td> <td class="text-right">'.numberFormat($oscillazione_percentuale, '2').' %</td>
<td>'.$andamento.'</td> <td>'.$andamento.'</td>
</tr>'; </tr>';

View File

@ -1,350 +0,0 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Util\Messages;
/**
* Classe per la gestione delle utenze.
*
* @since 2.4
*/
class App
{
public static $docroot;
public static $rootdir;
public static $baseurl;
/** @var array Identificativo del modulo corrente */
protected static $current_module;
/** @var int Identificativo dell'elemento corrente */
protected static $current_element;
/** @var Messages Gestione dei messaggi flash */
protected static $flash = null;
/** @var bool Stato di debug */
protected static $config = [];
/** @var array Elenco degli assets del progetto */
protected static $assets = [
// CSS
'css' => [
'app.min.css',
'style.min.css',
'themes.min.css',
],
// Print CSS
'print' => [
'print.min.css',
],
// JS
'js' => [
'app.min.js',
'functions.min.js',
'custom.min.js',
'i18n/parsleyjs/|lang|.min.js',
'i18n/select2/|lang|.min.js',
'i18n/moment/|lang|.min.js',
'i18n/fullcalendar/|lang|.min.js',
],
];
/**
* Restituisce la configurazione dell'installazione in utilizzo del progetto.
*
* @return array
*/
public static function getConfig()
{
if (empty(self::$config['db_host'])) {
if (file_exists(base_dir().'/config.inc.php')) {
include base_dir().'/config.inc.php';
$config = get_defined_vars();
} else {
$config = [];
}
$defaultConfig = self::getDefaultConfig();
$result = array_merge($defaultConfig, $config);
// Operazioni di normalizzazione sulla configurazione
$result['debug'] = isset(self::$config['debug']) ? self::$config['debug'] : !empty($result['debug']);
$result['lang'] = $result['lang'] == 'it' ? 'it_IT' : $result['lang'];
self::$config = $result;
}
return self::$config;
}
/**
* Imposta e restituisce lo stato di debug del progetto.
*
* @param bool $value
*
* @return bool
*/
public static function debug($value = null)
{
if (is_bool($value)) {
self::$config['debug'] = $value;
}
if (!isset(self::$config['debug'])) {
App::getConfig();
}
return self::$config['debug'];
}
/**
* Restituisce l'oggetto dedicato alla gestione dei messaggi per l'utente.
*
* @return Messages
*/
public static function flash()
{
if (empty(self::$flash)) {
$storage = null;
self::$flash = new Messages($storage, 'messages');
}
return self::$flash;
}
/**
* Individua i percorsi di base necessari per il funzionamento del gestionale.
* <b>Attenzione<b>: questo metodo deve essere eseguito all'interno di un file nella cartella principale del progetto per permettere il corretto funzionamento degli URL.
*/
public static function definePaths($docroot)
{
if (!defined('DOCROOT')) {
// Individuazione di $rootdir
$rootdir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')).'/';
if (strrpos($rootdir, '/'.basename($docroot).'/') !== false) {
$rootdir = substr($rootdir, 0, strrpos($rootdir, '/'.basename($docroot).'/')).'/'.basename($docroot);
} else {
$rootdir = '/';
}
$rootdir = rtrim($rootdir, '/');
$rootdir = str_replace('%2F', '/', rawurlencode($rootdir));
// Individuazione di $baseurl
$baseurl = (isHTTPS(true) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$rootdir;
// Impostazione delle variabili globali
define('DOCROOT', $docroot);
define('ROOTDIR', $rootdir);
define('BASEURL', $baseurl);
self::$docroot = $docroot;
self::$rootdir = $rootdir;
self::$baseurl = $baseurl;
}
}
/**
* Individua i percorsi principali del progetto.
*
* @return array
*/
public static function getPaths()
{
$assets = base_url().'/assets/dist';
return [
'assets' => $assets,
'css' => $assets.'/css',
'js' => $assets.'/js',
'img' => $assets.'/img',
];
}
/**
* Restituisce l'elenco degli assets del progetto.
*
* @return array
*/
public static function getAssets()
{
// Assets aggiuntivi
$config = self::getConfig();
$version = Update::getVersion();
// Impostazione dei percorsi
$paths = self::getPaths();
$lang = trans()->getCurrentLocale();
// Sezioni: nome - percorso
$sections = [
'css' => 'css',
'print' => 'css',
'js' => 'js',
];
$first_lang = explode('_', $lang);
$lang_replace = [
$lang,
strtolower($lang),
strtolower($first_lang[0]),
strtoupper($first_lang[0]),
str_replace('_', '-', $lang),
str_replace('_', '-', strtolower($lang)),
];
$assets = [];
foreach ($sections as $section => $dir) {
$result = array_unique(array_merge(self::$assets[$section], $config['assets'][$section]));
foreach ($result as $key => $element) {
$element = string_starts_with($element, 'http') ? $element : $paths[$dir].'/'.$element;
if (string_contains($element, '|lang|')) {
foreach ($lang_replace as $replace) {
$name = str_replace('|lang|', $replace, $element);
if (file_exists(base_dir().str_replace(base_url(), '', $name))) {
$element = $name;
break;
}
}
}
$result[$key] = $element.'?v='.$version;
}
$assets[$section] = $result;
}
return $assets;
}
/**
* Restituisce il codice HTML per il form contenente il file indicato.
*
* @param string $file
* @param array $result
* @param array $options
* @param bool $disableForm
*
* @return string
*/
public static function load($file, $result, $options, $disableForm = false)
{
$form = $disableForm ? '|response|' : self::internalLoad('form.php', $result, $options);
$response = self::internalLoad($file, $result, $options);
$form = str_replace('|response|', $response, $form);
return $form;
}
/**
* Restituisce il codice HTML generato del file indicato.
*
* @param string $file
* @param array $result
* @param array $options
* @param string $directory
*
* @return string
*/
public static function internalLoad($file, $result, $options, $directory = null)
{
$module = Modules::getCurrent();
$database = $dbo = database();
$id_module = $module['id'];
$id_record = filter('id_record');
$id_plugin = $options['id_plugin'];
$directory = empty($directory) ? 'include|custom|/common/' : $directory;
ob_start();
include self::filepath($directory, $file);
$response = ob_get_clean();
return $response;
}
/**
* Individua il percorso per il file da includere considerando gli eventuali custom.
*
* @param string $path
* @param string $file
*
* @return string|null
*/
public static function filepath($path, $file = null)
{
$path = string_contains($path, base_dir()) ? $path : base_dir().'/'.ltrim($path, '/');
$path = empty($file) ? $path : rtrim($path, '/').'/'.$file;
$original_file = str_replace('|custom|', '', $path);
$custom_file = str_replace('|custom|', '/custom', $path);
$result = '';
if (file_exists($custom_file)) {
$result = $custom_file;
} elseif (file_exists($original_file)) {
$result = $original_file;
}
return slashes($result);
}
/**
* Restituisce la configurazione di default del progetto.
*
* @return array
*/
protected static function getDefaultConfig()
{
if (file_exists(base_dir().'/config.example.php')) {
include base_dir().'/config.example.php';
}
$db_host = '';
$db_username = '';
$db_password = '';
$db_name = '';
$port = '';
$lang = '';
$formatter = [
'timestamp' => 'd/m/Y H:i',
'date' => 'd/m/Y',
'time' => 'H:i',
'number' => [
'decimals' => ',',
'thousands' => '.',
],
];
return get_defined_vars();
}
}

View File

@ -27,14 +27,8 @@ use Util\Messages;
*/ */
class AppLegacy class AppLegacy
{ {
public static $docroot; /** @var string Simbolo della valuta corrente */
public static $rootdir; protected static $currency;
public static $baseurl;
/** @var array Identificativo del modulo corrente */
protected static $current_module;
/** @var int Identificativo dell'elemento corrente */
protected static $current_element;
/** @var Messages Gestione dei messaggi flash */ /** @var Messages Gestione dei messaggi flash */
protected static $flash = null; protected static $flash = null;
@ -139,37 +133,6 @@ class AppLegacy
return self::$flash; return self::$flash;
} }
/**
* Individua i percorsi di base necessari per il funzionamento del gestionale.
* <b>Attenzione<b>: questo metodo deve essere eseguito all'interno di un file nella cartella principale del progetto per permettere il corretto funzionamento degli URL.
*/
public static function definePaths($docroot)
{
if (!defined('DOCROOT')) {
// Individuazione di $rootdir
$rootdir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')).'/';
if (strrpos($rootdir, '/'.basename($docroot).'/') !== false) {
$rootdir = substr($rootdir, 0, strrpos($rootdir, '/'.basename($docroot).'/')).'/'.basename($docroot);
} else {
$rootdir = '/';
}
$rootdir = rtrim($rootdir, '/');
$rootdir = str_replace('%2F', '/', rawurlencode($rootdir));
// Individuazione di $baseurl
$baseurl = (isHTTPS(true) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$rootdir;
// Impostazione delle variabili globali
define('DOCROOT', $docroot);
define('ROOTDIR', $rootdir);
define('BASEURL', $baseurl);
self::$docroot = $docroot;
self::$rootdir = $rootdir;
self::$baseurl = $baseurl;
}
}
/** /**
* Individua i percorsi principali del progetto. * Individua i percorsi principali del progetto.
* *
@ -187,25 +150,6 @@ class AppLegacy
]; ];
} }
/**
* Imposta l'oggetto responsabile della localizzazione di date e numeri.
*/
public static function setFormatter($locale, $options)
{
self::$formatter = new Intl\Formatter(
$locale,
empty($options['timestamp']) ? 'd/m/Y H:i' : $options['timestamp'],
empty($options['date']) ? 'd/m/Y' : $options['date'],
empty($options['time']) ? 'H:i' : $options['time'],
empty($options['number']) ? [
'decimals' => ',',
'thousands' => '.',
] : $options['number']
);
self::$formatter->setPrecision(auth()->check() ? setting('Cifre decimali per importi') : 2);
}
/** /**
* Restituisce l'elenco degli assets del progetto. * Restituisce l'elenco degli assets del progetto.
* *
@ -372,4 +316,24 @@ class AppLegacy
return get_defined_vars(); return get_defined_vars();
} }
/**
* Restituisce il simbolo della valuta del gestione.
*
* @since 2.4.9
*
* @return string
*/
public static function getCurrency()
{
if (!isset(self::$currency)) {
$id = setting('Valuta');
$valuta = database()->fetchOne('SELECT symbol FROM zz_currencies WHERE id = '.prepare($id));
self::$currency = $valuta['symbol'];
}
return self::$currency;
}
} }

View File

@ -121,6 +121,10 @@ class HTMLBuilder
foreach ($managers[0] as $value) { foreach ($managers[0] as $value) {
$json = self::decode($value, 'manager'); $json = self::decode($value, 'manager');
if (empty($json)){
continue;
}
$class = self::getManager($json['name']); $class = self::getManager($json['name']);
$result = ''; $result = '';

View File

@ -45,17 +45,17 @@ class DateHandler implements HandlerInterface
// Restrizione dei valori permessi // Restrizione dei valori permessi
// Timestamp // Timestamp
if ($values['type'] == 'timestamp' && formatter()->isStandardTimestamp($values['value'])) { if ($values['type'] == 'timestamp' && formatter()->isStandardTimestamp($values['value'])) {
$values['value'] = \Translator::timestampToLocale($values['value']); $values['value'] = timestampFormat($values['value']);
} }
// Data // Data
elseif ($values['type'] == 'date' && formatter()->isStandardDate($values['value'])) { elseif ($values['type'] == 'date' && formatter()->isStandardDate($values['value'])) {
$values['value'] = \Translator::dateToLocale($values['value']); $values['value'] = dateFormat($values['value']);
} }
// Orario // Orario
elseif ($values['type'] == 'time' && formatter()->isStandardTime($values['value'])) { elseif ($values['type'] == 'time' && formatter()->isStandardTime($values['value'])) {
$values['value'] = \Translator::timeToLocale($values['value']); $values['value'] = timeFormat($values['value']);
} }
// Controllo sulla correttezza sintattica del valore impostato // Controllo sulla correttezza sintattica del valore impostato

View File

@ -1,70 +0,0 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Intl;
/**
* Classe dedicata al caricamento delle risorse per le traduzioni.
*
* @since 2.3
*/
class FileLoader extends \Symfony\Component\Translation\Loader\FileLoader
{
protected static $loaders = [];
protected $include_filename;
public function __construct($include_filename = false)
{
$this->include_filename = $include_filename;
}
protected function loadResource($resource)
{
$result = [];
$extension = strtolower(pathinfo($resource, PATHINFO_EXTENSION));
$loader = $this->getLoader($extension);
if (!empty($extension) && $extension != 'po' && !empty($loader)) {
$result = $loader->loadResource($resource);
if (!empty($this->include_filename)) {
$result = array_combine(
array_map(function ($k) use ($resource, $extension) {
return basename($resource, '.'.$extension).'.'.$k;
}, array_keys($result)),
$result
);
}
}
return $result;
}
protected function getLoader($name)
{
if (empty(self::$loaders[$name])) {
$class = '\Symfony\Component\Translation\Loader\\'.ucfirst($name).'FileLoader';
if (class_exists($class)) {
self::$loaders[$name] = new $class();
}
}
return !empty(self::$loaders[$name]) ? self::$loaders[$name] : null;
}
}

View File

@ -76,8 +76,8 @@ trait LocalPoolTrait
} }
// Consultazione Database // Consultazione Database
$result = self::where(self::$id, $identifier) $result = self::where(self::$id, '=', $identifier)
->orWhere(self::$name, $identifier) ->orWhere(self::$name, '=', $identifier)
->first(); ->first();
if (!empty($result)) { if (!empty($result)) {

View File

@ -1,382 +0,0 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Carbon\Carbon;
use Carbon\CarbonInterval;
/**
* Classe per gestire le traduzioni del progetto.
*
* @since 2.3
*/
class Translator extends Util\Singleton
{
/** @var Intl\Formatter Oggetto per la conversione di date e numeri nella lingua selezionata */
protected static $formatter;
/** @var string Simbolo della valuta corrente */
protected static $currency;
/** @var Symfony\Component\Translation\Translator Oggetto dedicato alle traduzioni */
protected $translator;
/** @var array Lingue disponibili */
protected $locales = [];
/** @var string Lingua selezionata */
protected $locale;
public function __construct($default_locale = 'it_IT', $fallback_locales = ['it_IT'])
{
$translator = new Symfony\Component\Translation\Translator($default_locale);
$translator->setFallbackLocales($fallback_locales);
// Imposta la classe per il caricamento
$translator->addLoader('default', new Intl\FileLoader());
$this->translator = $translator;
$this->locale = $default_locale;
self::setFormatter($default_locale, []);
}
/**
* Ricerca e aggiunge le traduzioni presenti nei percorsi predefiniti (cartella locale sia nella root che nei diversi moduli).
*
* @param string $string
*/
public function addLocalePath($string)
{
$paths = glob($string);
foreach ($paths as $path) {
$this->addLocales($path);
}
}
/**
* Restituisce l'elenco dei linguaggi disponibili.
*
* @return array
*/
public function getAvailableLocales()
{
return $this->locales;
}
/**
* Controlla se il linguaggio indicato è disponibile.
*
* @param string $language
*
* @return bool
*/
public function isLocaleAvailable($language)
{
return in_array($language, $this->getAvailableLocales());
}
/**
* Imposta il linguaggio in utilizzo.
*
* @param string $locale
*/
public function setLocale($locale, $formatter = [])
{
if (!empty($locale) && $this->isLocaleAvailable($locale)) {
$this->translator->setLocale($locale);
$this->locale = $locale;
$result = setlocale(LC_TIME, $locale);
Carbon::setLocale($locale);
if (empty($result)) {
$result = setlocale(LC_TIME, $locale.'.UTF-8');
} else {
Carbon::setUtf8(true);
}
$reduced = explode('_', $locale)[0];
CarbonInterval::setLocale($reduced);
if (empty($result)) {
$result = setlocale(LC_TIME, $reduced);
}
self::setFormatter($locale, $formatter);
}
}
/**
* Restituisce il linguaggio attualmente in utilizzo.
*
* @return string
*/
public function getCurrentLocale()
{
return $this->locale;
}
/**
* Restituisce l'oggetto responsabile della gestione delle traduzioni.
*
* @return Symfony\Component\Translation\Translator
*/
public function getTranslator()
{
return $this->translator;
}
/**
* Restituisce la traduzione richiesta.
*
* @param string $string
* @param array $parameters
* @param array $operations
*
* @return string
*/
public static function translate($string, $parameters = [], $operations = [])
{
$result = self::getInstance()->getTranslator()->trans($string, $parameters);
// Operazioni aggiuntive sul risultato
if (!empty($operations)) {
$result = new Stringy\Stringy($result);
if (!empty($operations['upper'])) {
$result = $result->toUpperCase();
} elseif (!empty($operations['lower'])) {
$result = $result->toLowerCase();
}
}
return (string) $result;
}
/**
* Restituisce l'oggetto responsabile della localizzazione di date e numeri.
*
* @return Intl\Formatter
*/
public static function getFormatter()
{
return formatter();
}
/**
* Restituisce il simbolo della valuta del gestione.
*
* @since 2.4.9
*
* @return string
*/
public static function getCurrency()
{
if (!isset(self::$currency)) {
$id = setting('Valuta');
$valuta = database()->fetchOne('SELECT symbol FROM zz_currencies WHERE id = '.prepare($id));
self::$currency = $valuta['symbol'];
}
return self::$currency;
}
/**
* Converte il numero dalla formattazione locale a quella inglese.
*
* @param string $string
*
* @return string
*/
public static function numberToEnglish($string)
{
return self::getFormatter()->parseNumber($string);
}
/**
* Converte il numero dalla formattazione inglese a quella locale.
*
* @param string $string
* @param string|int $decimals
*
* @return string
*/
public static function numberToLocale($string, $decimals = null)
{
$string = !isset($string) ? 0 : $string;
if (!empty($decimals) && is_string($decimals)) {
$decimals = ($decimals == 'qta') ? setting('Cifre decimali per quantità') : null;
}
return self::getFormatter()->formatNumber($string, $decimals);
}
/**
* Converte la data dalla formattazione locale a quella inglese.
*
* @param string $string
*
* @return string
*/
public static function dateToEnglish($string)
{
return self::getFormatter()->parseDate($string);
}
/**
* Converte la data dalla formattazione inglese a quella locale.
*
* @param string $string
* @param string $fail
*
* @return string
*/
public static function dateToLocale($string)
{
return self::getFormatter()->formatDate($string);
}
/**
* Converte la data dalla formattazione locale a quella inglese.
*
* @param string $string
*
* @return string
*/
public static function timeToEnglish($string)
{
return self::getFormatter()->parseTime($string);
}
/**
* Converte la data dalla formattazione inglese a quella locale.
*
* @param string $string
* @param string $fail
*
* @return string
*/
public static function timeToLocale($string)
{
return self::getFormatter()->formatTime($string);
}
/**
* Converte un timestamp dalla formattazione locale a quella inglese.
*
* @param string $timestamp
*
* @return string
*/
public static function timestampToEnglish($string)
{
return self::getFormatter()->parseTimestamp($string);
}
/**
* Converte un timestamp dalla formattazione inglese a quella locale.
*
* @param string $timestamp
* @param string $fail
*
* @return string
*/
public static function timestampToLocale($string)
{
return self::getFormatter()->formatTimestamp($string);
}
/**
* Converte il numero in ore.
*
* @param string $string
*
* @return string
*/
public static function numberToHours($string)
{
$string = !isset($string) ? 0 : $string;
$ore = number_format($string, 2);
$splitted_hour = explode('.', $ore);
$hour = $splitted_hour[0];
$minutes = ($splitted_hour[1] / 100) * 60;
$time = $hour.':'.sprintf('%02d', $minutes);
return $time;
}
/**
* Aggiunge i contenuti della cartella specificata alle traduzioni disponibili.
*
* @param string $path
*/
protected function addLocales($path)
{
// Individua i linguaggi disponibili
$dirs = glob($path.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR);
foreach ($dirs as $dir) {
$this->addLocale(basename($dir));
}
// Aggiunge le singole traduzioni
foreach ($this->locales as $lang) {
$done = [];
$files = glob($path.DIRECTORY_SEPARATOR.$lang.DIRECTORY_SEPARATOR.'*.*');
foreach ($files as $file) {
if (!in_array(basename($file), $done)) {
$this->translator->addResource('default', $file, $lang);
$done[] = basename($file);
}
}
}
}
/**
* Aggiunge il linguaggio indicato all'elenco di quelli disponibili.
*
* @param string $language
*/
protected function addLocale($language)
{
if (!$this->isLocaleAvailable($language)) {
$this->locales[] = $language;
}
}
/**
* Imposta l'oggetto responsabile della localizzazione di date e numeri.
*/
protected static function setFormatter($locale, $options)
{
self::$formatter = new Intl\Formatter(
$locale,
empty($options['timestamp']) ? 'd/m/Y H:i' : $options['timestamp'],
empty($options['date']) ? 'd/m/Y' : $options['date'],
empty($options['time']) ? 'H:i' : $options['time'],
empty($options['number']) ? [
'decimals' => ',',
'thousands' => '.',
] : $options['number']
);
self::$formatter->setPrecision(auth()->check() ? setting('Cifre decimali per importi') : 2);
}
}

View File

@ -21,7 +21,6 @@ namespace Util;
use Auth; use Auth;
use Modules; use Modules;
use Translator;
/** /**
* Classe per la gestione delle interazione di base per le query dinamiche. * Classe per la gestione delle interazione di base per le query dinamiche.
@ -315,7 +314,7 @@ class Query
if (!empty($sums)) { if (!empty($sums)) {
foreach ($sums as $key => $sum) { foreach ($sums as $key => $sum) {
if (string_contains($key, 'sum_')) { if (string_contains($key, 'sum_')) {
$results[str_replace('sum_', '', $key)] = Translator::numberToLocale($sum); $results[str_replace('sum_', '', $key)] = numberFormat($sum);
} }
} }
} }

View File

@ -115,7 +115,7 @@ if (!empty($impianti)) {
echo ' echo '
<tr> <tr>
<td colspan="2" class="text-left" >'.tr('Matricola').': <b>'.$impianti[$i]['matricola'].'</b></td> <td colspan="2" class="text-left" >'.tr('Matricola').': <b>'.$impianti[$i]['matricola'].'</b></td>
<td colspan="2" class="text-left" >'.tr('Data').': <b>'.Translator::dateToLocale($impianti[$i]['data']).'</b></td> <td colspan="2" class="text-left" >'.tr('Data').': <b>'.dateFormat($impianti[$i]['data']).'</b></td>
</tr> </tr>
<tr> <tr>
<td colspan="4" class="text-left" >'.tr('Nome').': <b>'.$impianti[$i]['nome'].'</b></td> <td colspan="4" class="text-left" >'.tr('Nome').': <b>'.$impianti[$i]['nome'].'</b></td>
@ -151,9 +151,9 @@ if (!empty($interventi)) {
$intervento = Intervento::find($interventi[$i]['id']); $intervento = Intervento::find($interventi[$i]['id']);
echo ' echo '
<tr> <tr>
<td class="text-left">'.tr('Data richiesta').': <b>'.Translator::dateToLocale($intervento->data_richiesta).'</b></td> <td class="text-left">'.tr('Data richiesta').': <b>'.dateFormat($intervento->data_richiesta).'</b></td>
<td class="text-left" colspan="2" >'.tr('Data scadenza').': <b>'.Translator::dateToLocale($intervento->data_scadenza).'</b></td> <td class="text-left" colspan="2" >'.tr('Data scadenza').': <b>'.dateFormat($intervento->data_scadenza).'</b></td>
<td class="text-left" >'.tr('Data inizio').': <b>'.Translator::dateToLocale($interventi[$i]['inizio']).'</b></td> <td class="text-left" >'.tr('Data inizio').': <b>'.dateFormat($interventi[$i]['inizio']).'</b></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="text-left" >'.tr('Tipo').': <b>'.$intervento->tipo->descrizione.'</b></td> <td colspan="2" class="text-left" >'.tr('Tipo').': <b>'.$intervento->tipo->descrizione.'</b></td>

View File

@ -32,7 +32,7 @@ echo '
<br><br> <br><br>
<b>'.tr('Contratto num. _NUM_ del _DATE_', [ <b>'.tr('Contratto num. _NUM_ del _DATE_', [
'_NUM_' => $documento['numero'], '_NUM_' => $documento['numero'],
'_DATE_' => Translator::dateToLocale($documento['data_bozza']), '_DATE_' => dateFormat($documento['data_bozza']),
], ['upper' => true]).'</b> ], ['upper' => true]).'</b>
</div>'; </div>';
@ -152,7 +152,7 @@ foreach ($righe as $riga) {
if (!$riga->isDescrizione()) { if (!$riga->isDescrizione()) {
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::numberToLocale(abs($riga->qta), 'qta').' '.$r['um'].' '.numberFormat(abs($riga->qta), 'qta').' '.$r['um'].'
</td>'; </td>';
if ($options['pricing']) { if ($options['pricing']) {
@ -355,8 +355,8 @@ echo '
if (!empty($documento['data_accettazione']) && !empty($documento['data_conclusione'])) { if (!empty($documento['data_accettazione']) && !empty($documento['data_conclusione'])) {
echo ' echo '
'.tr('dal _START_ al _END_', [ '.tr('dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($documento['data_accettazione']), '_START_' => dateFormat($documento['data_accettazione']),
'_END_' => Translator::dateToLocale($documento['data_conclusione']), '_END_' => dateFormat($documento['data_conclusione']),
]); ]);
} else { } else {
echo '-'; echo '-';

View File

@ -74,9 +74,9 @@ if ($pricing || !empty($totale_ore)) {
<b>'.tr('Ore residue', [], ['upper' => true]).':</b> <b>'.tr('Ore residue', [], ['upper' => true]).':</b>
</td> </td>
<th colspan="2" class="text-center"> <th colspan="2" class="text-center">
<b>'.Translator::numberToLocale($totale_ore - $totale_ore_impiegate).'</b><br> <b>'.numberFormat($totale_ore - $totale_ore_impiegate).'</b><br>
<p>'.tr('Ore erogate').': '.Translator::numberToLocale($totale_ore_impiegate).'</p> <p>'.tr('Ore erogate').': '.numberFormat($totale_ore_impiegate).'</p>
<p>'.tr('Ore a contratto').': '.Translator::numberToLocale($totale_ore).'</p> <p>'.tr('Ore a contratto').': '.numberFormat($totale_ore).'</p>
</th> </th>
</tr>'; </tr>';
} }

View File

@ -26,7 +26,7 @@ echo '
<h4 class="text-bold">'.tr('Consuntivo', [], ['upper' => true]).'</h4> <h4 class="text-bold">'.tr('Consuntivo', [], ['upper' => true]).'</h4>
<b>'.tr('Contratto num. _NUM_ del _DATE_', [ <b>'.tr('Contratto num. _NUM_ del _DATE_', [
'_NUM_' => $documento['numero'], '_NUM_' => $documento['numero'],
'_DATE_' => Translator::dateToLocale($documento['data_bozza']), '_DATE_' => dateFormat($documento['data_bozza']),
], ['upper' => true]).'</b> ], ['upper' => true]).'</b>
</div> </div>
</div> </div>

View File

@ -135,7 +135,7 @@ foreach ($righe as $riga) {
if (!$riga->isDescrizione()) { if (!$riga->isDescrizione()) {
echo ' echo '
<td class="text-center" nowrap="nowrap"> <td class="text-center" nowrap="nowrap">
'.Translator::numberToLocale(abs($riga->qta), 'qta').' '.$r['um'].' '.numberFormat(abs($riga->qta), 'qta').' '.$r['um'].'
</td>'; </td>';
if ($options['pricing']) { if ($options['pricing']) {
@ -165,7 +165,7 @@ foreach ($righe as $riga) {
// Iva // Iva
echo ' echo '
<td class="text-center" nowrap="nowrap"> <td class="text-center" nowrap="nowrap">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).' '.numberFormat($riga->aliquota->percentuale, 0).'
</td>'; </td>';
} }
} else { } else {

View File

@ -164,7 +164,7 @@ echo '
</td> </td>
<td class="cell-padded"> <td class="cell-padded">
'.Translator::TimestampToLocale($documento['data_ora_trasporto']).' &nbsp; '.timestampFormat($documento['data_ora_trasporto']).' &nbsp;
</td> </td>
<td class="cell-padded"> <td class="cell-padded">
@ -196,11 +196,11 @@ echo '
<tr> <tr>
<td class="cell-padded"> <td class="cell-padded">
'.(!empty($peso_lordo) ? Translator::numberToLocale($peso_lordo).'&nbsp;KG' : '').' '.(!empty($peso_lordo) ? numberFormat($peso_lordo).'&nbsp;KG' : '').'
</td> </td>
<td class="cell-padded"> <td class="cell-padded">
'.(!empty($volume) ? Translator::numberToLocale($volume).'&nbsp;M<sup>3</sup>' : '').' '.(!empty($volume) ? numberFormat($volume).'&nbsp;M<sup>3</sup>' : '').'
</td> </td>
<td class="cell-padded"> <td class="cell-padded">

View File

@ -83,7 +83,7 @@ if (!empty($documento['idsede_destinazione'])) {
$custom = [ $custom = [
'tipo_doc' => $tipo_doc, 'tipo_doc' => $tipo_doc,
'numero' => $numero, 'numero' => $numero,
'data' => Translator::dateToLocale($documento['data']), 'data' => dateFormat($documento['data']),
'pagamento' => $pagamento['descrizione'], 'pagamento' => $pagamento['descrizione'],
'c_destinazione' => $destinazione, 'c_destinazione' => $destinazione,
'aspettobeni' => $aspetto_beni['descrizione'], 'aspettobeni' => $aspetto_beni['descrizione'],

View File

@ -21,13 +21,13 @@ include_once __DIR__.'/../../core.php';
if ($dir == 'entrata') { if ($dir == 'entrata') {
$title = tr('Fatturato mensile dal _START_ al _END_', [ $title = tr('Fatturato mensile dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start), '_START_' => dateFormat($date_start),
'_END_' => Translator::dateToLocale($date_end), '_END_' => dateFormat($date_end),
], ['upper' => true]); ], ['upper' => true]);
} else { } else {
$title = tr('Acquisti mensili dal _START_ al _END_', [ $title = tr('Acquisti mensili dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start), '_START_' => dateFormat($date_start),
'_END_' => Translator::dateToLocale($date_end), '_END_' => dateFormat($date_end),
], ['upper' => true]); ], ['upper' => true]);
} }

View File

@ -116,7 +116,7 @@ foreach ($righe as $riga) {
$text = tr('Rif. fattura _NUM_ del _DATE_', [ $text = tr('Rif. fattura _NUM_ del _DATE_', [
'_NUM_' => $data[0]['numero'], '_NUM_' => $data[0]['numero'],
'_DATE_' => Translator::dateToLocale($data[0]['data']), '_DATE_' => dateFormat($data[0]['data']),
]); ]);
echo ' echo '
@ -172,7 +172,7 @@ foreach ($righe as $riga) {
if (!$riga->isDescrizione()) { if (!$riga->isDescrizione()) {
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::numberToLocale(abs($riga->qta), 'qta').' '.$r['um'].' '.numberFormat(abs($riga->qta), 'qta').' '.$r['um'].'
</td>'; </td>';
// Prezzo unitario // Prezzo unitario
@ -201,7 +201,7 @@ foreach ($righe as $riga) {
// Iva // Iva
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).' '.numberFormat($riga->aliquota->percentuale, 0).'
</td>'; </td>';
} else { } else {
echo ' echo '

View File

@ -76,7 +76,7 @@ if (!empty($rs2)) {
echo " echo "
<tr> <tr>
<td style='width:50%;'> <td style='width:50%;'>
<small>".Translator::dateToLocale($rs2[$i]['scadenza'])."</small> <small>".dateFormat($rs2[$i]['scadenza'])."</small>
</td> </td>
<td style='width:50%;' class='text-right'> <td style='width:50%;' class='text-right'>
<small>".moneyFormat($rs2[$i]['da_pagare'], 2).'</small> <small>".moneyFormat($rs2[$i]['da_pagare'], 2).'</small>
@ -227,7 +227,7 @@ if ($has_rivalsa) {
<tr> <tr>
<th class="text-center small" colspan="'.$first_colspan.'"> <th class="text-center small" colspan="'.$first_colspan.'">
'.tr('Rivalsa _PRC_%', [ '.tr('Rivalsa _PRC_%', [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0), '_PRC_' => numberFormat($rs2[0]['percentuale'], 0),
], ['upper' => true]).' ], ['upper' => true]).'
</th>'; </th>';
@ -268,10 +268,10 @@ if ($has_ritenuta) {
} }
$contributi = (!empty($record['ritenutaacconto']) ? ' - ' : '').tr('contributi: _PRC_%', [ $contributi = (!empty($record['ritenutaacconto']) ? ' - ' : '').tr('contributi: _PRC_%', [
'_PRC_' => Translator::numberToLocale($documento->ritenutaContributi->percentuale, 2), '_PRC_' => numberFormat($documento->ritenutaContributi->percentuale, 2),
]); ]);
$acconto = tr('acconto: _PRC_%', [ $acconto = tr('acconto: _PRC_%', [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0), '_PRC_' => numberFormat($rs2[0]['percentuale'], 0),
]); ]);
$ritenuta_totale = abs($documento->ritenuta_acconto) + abs($documento->totale_ritenuta_contributi); $ritenuta_totale = abs($documento->ritenuta_acconto) + abs($documento->totale_ritenuta_contributi);
@ -405,11 +405,11 @@ if ($fattura_accompagnatoria) {
<tr> <tr>
<td class="cell-padded"> <td class="cell-padded">
'.(!empty($peso_lordo) ? Translator::numberToLocale($peso_lordo).'&nbsp;KG' : '').' '.(!empty($peso_lordo) ? numberFormat($peso_lordo).'&nbsp;KG' : '').'
</td> </td>
<td class="cell-padded"> <td class="cell-padded">
'.(!empty($volume) ? Translator::numberToLocale($volume).'&nbsp;M<sup>3</sup>' : '').' '.(!empty($volume) ? numberFormat($volume).'&nbsp;M<sup>3</sup>' : '').'
</td> </td>
<td class="cell-padded"> <td class="cell-padded">

View File

@ -100,7 +100,7 @@ $custom = [
'tipo_doc' => Stringy\Stringy::create($tipo_doc)->toUpperCase(), 'tipo_doc' => Stringy\Stringy::create($tipo_doc)->toUpperCase(),
'numero' => $numero, 'numero' => $numero,
'tipo_documento' => $tipo_doc, 'tipo_documento' => $tipo_doc,
'data' => Translator::dateToLocale($record['data']), 'data' => dateFormat($record['data']),
'pagamento' => $record['tipo_pagamento'], 'pagamento' => $record['tipo_pagamento'],
'c_destinazione' => $destinazione, 'c_destinazione' => $destinazione,
'aspettobeni' => $record['aspettobeni'], 'aspettobeni' => $record['aspettobeni'],

View File

@ -32,13 +32,13 @@ echo '
<tr> <tr>
<td class="text-left" style="width:30%">'.tr('Intervento n.').': <b>'.$documento['codice'].'</b></td> <td class="text-left" style="width:30%">'.tr('Intervento n.').': <b>'.$documento['codice'].'</b></td>
<td class="text-left" colspan="'.(empty($preventivo) && empty($contratto) ? '3' : '1').'" style="width:30%">'.tr('Data richiesta').': <b>'.Translator::dateToLocale($documento['data_richiesta']).'</b></td>'; <td class="text-left" colspan="'.(empty($preventivo) && empty($contratto) ? '3' : '1').'" style="width:30%">'.tr('Data richiesta').': <b>'.dateFormat($documento['data_richiesta']).'</b></td>';
if (!empty($preventivo)) { if (!empty($preventivo)) {
echo ' echo '
<td class="text-left" colspan="2" style="width:20%">'.tr('Preventivo n.').': <b>'.(!empty($preventivo) ? $preventivo['numero'].' del '.Translator::dateToLocale($preventivo['data_bozza']) : '').'</b></td>'; <td class="text-left" colspan="2" style="width:20%">'.tr('Preventivo n.').': <b>'.(!empty($preventivo) ? $preventivo['numero'].' del '.dateFormat($preventivo['data_bozza']) : '').'</b></td>';
} elseif (!empty($contratto)) { } elseif (!empty($contratto)) {
echo ' echo '
<td class="text-left" colspan="2" style="width:20%">'.tr('Contratto n.').': <b>'.(!empty($contratto) ? $contratto['numero'].' del '.Translator::dateToLocale($contratto['data_bozza']) : '').'</b></td>'; <td class="text-left" colspan="2" style="width:20%">'.tr('Contratto n.').': <b>'.(!empty($contratto) ? $contratto['numero'].' del '.dateFormat($contratto['data_bozza']) : '').'</b></td>';
} }
echo ' echo '
</tr>'; </tr>';
@ -183,10 +183,10 @@ if (!$righe->isEmpty()) {
if ($riga->um == 'ore') { if ($riga->um == 'ore') {
$qta = Translator::numberToHours($riga->qta); $qta = Translator::numberToHours($riga->qta);
} else { } else {
$qta = Translator::numberToLocale($riga->qta, 'qta'); $qta = numberFormat($riga->qta, 'qta');
} }
} else { } else {
$qta = Translator::numberToLocale($riga->qta, 'qta'); $qta = numberFormat($riga->qta, 'qta');
} }
// Articolo // Articolo
echo ' echo '
@ -217,7 +217,7 @@ if (!$righe->isEmpty()) {
// Quantità // Quantità
echo ' echo '
<td class="text-center"> <td class="text-center">
'.$qta.' '.$riga->um.' '.numberFormat($riga->qta, 'qta').' '.$riga->um.'
</td>'; </td>';
// Prezzo unitario // Prezzo unitario
@ -238,7 +238,7 @@ if (!$righe->isEmpty()) {
// Prezzo totale // Prezzo totale
echo ' echo '
<td class="text-center"> <td class="text-center">
'.($options['pricing'] ? Translator::numberToLocale($riga->importo) : '-').' '.($options['pricing'] ? numberFormat($riga->importo) : '-').'
</td> </td>
</tr>'; </tr>';
} }
@ -335,13 +335,13 @@ foreach ($sessioni as $i => $sessione) {
if (setting('Formato ore in stampa') == 'Sessantesimi') { if (setting('Formato ore in stampa') == 'Sessantesimi') {
$ore_totali = Translator::numberToHours($documento->ore_totali); $ore_totali = Translator::numberToHours($documento->ore_totali);
} else { } else {
$ore_totali = Translator::numberToLocale($documento->ore_totali, 2); $ore_totali = numberFormat($documento->ore_totali, 2);
} }
echo ' echo '
<tr> <tr>
<td class="text-center"> <td class="text-center">
<small>'.tr('Ore lavorate').':</small><br/><b>'.$ore_totali.'</b> <small>'.tr('Ore lavorate').':</small><br/><b>'.numberFormat($documento->ore_totali, 2).'</b>
</td>'; </td>';
// Costo totale manodopera // Costo totale manodopera
@ -376,7 +376,7 @@ echo '
echo ' echo '
<tr> <tr>
<td class="text-center"> <td class="text-center">
<small>'.tr('Km percorsi').':</small><br/><b>'.Translator::numberToLocale($documento->km_totali, 2).'</b> <small>'.tr('Km percorsi').':</small><br/><b>'.numberFormat($documento->km_totali, 2).'</b>
</td>'; </td>';
// Costo trasferta // Costo trasferta

View File

@ -27,6 +27,6 @@
*/ */
echo ' echo '
<h5 style="border-bottom:1px solid #777; display:block;"> <h5 style="border-bottom:1px solid #777; display:block;">
<div class="col-md-7">STAMPA LIBRO GIORNALE <small>'.Translator::dateToLocale($date_start).' - '.Translator::dateTolocale($date_end).'</small></div> <div class="col-md-7">STAMPA LIBRO GIORNALE <small>'.dateFormat($date_start).' - '.dateFormat($date_end).'</small></div>
<div class="col-md-5 text-right">'.$azienda['ragione_sociale'].'</div> <div class="col-md-5 text-right">'.$azienda['ragione_sociale'].'</div>
</h5>'; </h5>';

View File

@ -35,7 +35,7 @@ if ($record['data']!=$last_data && !empty($last_data)) {
echo ' echo '
<tr> <tr>
<td class="text-center">'.Translator::dateToLocale($record['data']).'</td> <td class="text-center">'.dateFormat($record['data']).'</td>
<td class="text-center">'.$record['numero2'].'.'.$record['numero'].'</td> <td class="text-center">'.$record['numero2'].'.'.$record['numero'].'</td>
<td>'.$record['conto'].'</td> <td>'.$record['conto'].'</td>
<td>'.$record['descrizione'].'</td>'; <td>'.$record['descrizione'].'</td>';

View File

@ -33,8 +33,8 @@ $esercizio = $year_start == $year_end ? ' - '.tr('Esercizio _YEAR_', [
]) : ''; ]) : '';
$titolo = tr('PROSPETTO LIQUIDAZIONE IVA DAL _START_ al _END_', [ $titolo = tr('PROSPETTO LIQUIDAZIONE IVA DAL _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start), '_START_' => dateFormat($date_start),
'_END_' => Translator::dateToLocale($date_end), '_END_' => dateFormat($date_end),
], ['upper' => true]); ], ['upper' => true]);
echo '<h6>'.$titolo.'</h6>'; echo '<h6>'.$titolo.'</h6>';

View File

@ -71,7 +71,7 @@ $data = Query::executeAndCount($query);
echo ' echo '
<h3>'.tr('Inventario al _DATE_', [ <h3>'.tr('Inventario al _DATE_', [
'_DATE_' => Translator::dateToLocale($period_end), '_DATE_' => dateFormat($period_end),
], ['upper' => true]).'</h3> ], ['upper' => true]).'</h3>
<p style="color:#aaa; font-size:10px;" class="text-right"> <p style="color:#aaa; font-size:10px;" class="text-right">
@ -107,7 +107,7 @@ foreach ($data['results'] as $r) {
<td>'.$r['Categoria'].'</td> <td>'.$r['Categoria'].'</td>
<td>'.$r['Descrizione'].'</td> <td>'.$r['Descrizione'].'</td>
<td class="text-right">'.moneyFormat($r['prezzo_vendita']).'</td> <td class="text-right">'.moneyFormat($r['prezzo_vendita']).'</td>
<td class="text-right">'.Translator::numberToLocale($r['qta_totale']).' '.$r['um'].'</td> <td class="text-right">'.numberFormat($r['qta_totale']).' '.$r['um'].'</td>
<td class="text-right">'.moneyFormat($r['acquisto']).'</td> <td class="text-right">'.moneyFormat($r['acquisto']).'</td>
<td class="text-right">'.moneyFormat($valore_magazzino).'</td> <td class="text-right">'.moneyFormat($valore_magazzino).'</td>
</tr>'; </tr>';
@ -124,7 +124,7 @@ echo '
<tr> <tr>
<td colspan="3" class="text-right border-top"><b>'.tr('Totale', [], ['upper' => true]).':</b></td> <td colspan="3" class="text-right border-top"><b>'.tr('Totale', [], ['upper' => true]).':</b></td>
<td class="border-top"></td> <td class="border-top"></td>
<td class="text-right border-top"><b>'.Translator::numberToLocale($totale_qta).'</b></td> <td class="text-right border-top"><b>'.numberFormat($totale_qta).'</b></td>
<td class="border-top"></td> <td class="border-top"></td>
<td class="text-right border-top"><b>'.moneyFormat($totale_acquisto).'</b></td> <td class="text-right border-top"><b>'.moneyFormat($totale_acquisto).'</b></td>
</tr> </tr>

View File

@ -163,7 +163,7 @@ foreach ($righe as $riga) {
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::numberToLocale(abs($qta), 'qta').' '.$um.' '.numberFormat(abs($qta), 'qta').' '.$um.'
</td>'; </td>';
if ($options['pricing']) { if ($options['pricing']) {
@ -193,13 +193,13 @@ foreach ($righe as $riga) {
// Iva // Iva
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::numberToLocale($riga->aliquota->percentuale, 0).' '.numberFormat($riga->aliquota->percentuale, 0).'
</td>'; </td>';
} }
echo ' echo '
<td class="text-center"> <td class="text-center">
'.Translator::dateToLocale($riga->data_evasione).($riga->ora_evasione ? '<br>'.Translator::timeToLocale($riga->ora_evasione).'' : '').' '.dateFormat($riga->data_evasione).($riga->ora_evasione ? '<br>'.timeFormat($riga->ora_evasione).'' : '').'
</td>'; </td>';
} else { } else {
echo ' echo '

View File

@ -63,6 +63,6 @@ $pagamento = $dbo->fetchOne('SELECT * FROM co_pagamenti WHERE id = '.prepare($do
$custom = [ $custom = [
'tipo_doc' => Stringy\Stringy::create($documento->tipo->descrizione)->toUpperCase(), 'tipo_doc' => Stringy\Stringy::create($documento->tipo->descrizione)->toUpperCase(),
'numero' => $numero, 'numero' => $numero,
'data' => Translator::dateToLocale($documento['data']), 'data' => dateFormat($documento['data']),
'pagamento' => $pagamento['descrizione'], 'pagamento' => $pagamento['descrizione'],
]; ];

View File

@ -26,7 +26,7 @@ echo '
<h4 class="text-bold">'.tr('Consuntivo', [], ['upper' => true]).'</h4> <h4 class="text-bold">'.tr('Consuntivo', [], ['upper' => true]).'</h4>
<b>'.tr('Ordine num. _NUM_ del _DATE_', [ <b>'.tr('Ordine num. _NUM_ del _DATE_', [
'_NUM_' => (!empty($documento['numero_esterno']) ? $documento['numero_esterno'] : $documento['numero']), '_NUM_' => (!empty($documento['numero_esterno']) ? $documento['numero_esterno'] : $documento['numero']),
'_DATE_' => Translator::dateToLocale($documento['data']), '_DATE_' => dateFormat($documento['data']),
], ['upper' => true]).'</b> ], ['upper' => true]).'</b>
</div> </div>
</div> </div>

View File

@ -27,7 +27,7 @@
*/ */
echo ' echo '
<h5 style="border-bottom:1px solid #777; display:block;"> <h5 style="border-bottom:1px solid #777; display:block;">
<div class="col-xs-5">STAMPA MASTRINO <small>'.Translator::dateToLocale($date_start).' - '.Translator::dateTolocale($date_end).'</small></div> <div class="col-xs-5">STAMPA MASTRINO <small>'.dateFormat($date_start).' - '.dateFormat($date_end).'</small></div>
<div class="col-xs-7 text-right">'.$azienda['ragione_sociale'].'</div> <div class="col-xs-7 text-right">'.$azienda['ragione_sociale'].'</div>
</h5> </h5>
'.$conto1['descrizione'].'<br>'; '.$conto1['descrizione'].'<br>';

Some files were not shown because too many files have changed in this diff Show More