Stile del codice

This commit is contained in:
Thomas Zilio 2020-01-17 17:31:46 +01:00
parent 17abd0fc49
commit b7aa2bfb4a
8 changed files with 153 additions and 161 deletions

View File

@ -30,8 +30,8 @@ abstract class Document extends Model
{
$righe = $this->getRighe();
return $righe->first(function ($item) use ($type, $id){
return $item instanceof $type && $item->id == $id ;
return $righe->first(function ($item) use ($type, $id) {
return $item instanceof $type && $item->id == $id;
});
}

View File

@ -254,8 +254,9 @@ switch ($resource) {
$where[] = 'idanagrafica='.prepare($id_azienda);
//admin o utente senza una sede prefissata, avrà accesso a tutte le sedi
if (!empty($user->sedi) and !$user->is_admin)
if (!empty($user->sedi) and !$user->is_admin) {
$where[] = 'id IN('.implode(',', $user->sedi).')';
}
if (!empty($search)) {
$search_fields[] = 'nomesede LIKE '.prepare('%'.$search.'%');

View File

@ -185,34 +185,32 @@ switch (post('op')) {
}
break;
case 'copy-bulk':
foreach ($id_records as $id_record) {
// Lettura dati fattura attuale
$rs = $dbo->fetchOne('SELECT * FROM co_documenti WHERE id='.prepare($id_record));
$dir = $dbo->fetchOne("SELECT dir FROM co_tipidocumento WHERE id=".prepare($rs['idtipodocumento']))['dir'];
$dir = $dbo->fetchOne('SELECT dir FROM co_tipidocumento WHERE id='.prepare($rs['idtipodocumento']))['dir'];
//+ 1 settimana
if(post('skip_time')=='Giorno'){
$data = date("Y-m-d", strtotime( '+1 day' , strtotime ( $rs['data'] )) );
if (post('skip_time') == 'Giorno') {
$data = date('Y-m-d', strtotime('+1 day', strtotime($rs['data'])));
}
//+ 1 settimana
if(post('skip_time')=='Settimana'){
$data = date("Y-m-d", strtotime( '+1 week' , strtotime ( $rs['data'] )) );
if (post('skip_time') == 'Settimana') {
$data = date('Y-m-d', strtotime('+1 week', strtotime($rs['data'])));
}
//+ 1 mese
if(post('skip_time')=='Mese'){
$data = date("Y-m-d", strtotime( '+1 month' , strtotime ( $rs['data'] )) );
if (post('skip_time') == 'Mese') {
$data = date('Y-m-d', strtotime('+1 month', strtotime($rs['data'])));
}
//+ 1 anno
if(post('skip_time')=='Anno'){
$data = date("Y-m-d", strtotime( '+1 year' , strtotime ( $rs['data'] )) );
if (post('skip_time') == 'Anno') {
$data = date('Y-m-d', strtotime('+1 year', strtotime($rs['data'])));
}
// Duplicazione righe
@ -235,8 +233,7 @@ switch (post('op')) {
// TODO: sistemare la duplicazione delle righe generiche e degli articoli, ignorando interventi, ddt, ordini, preventivi
foreach ($righe as $riga) {
if( !post('riferimenti') ){
if (!post('riferimenti')) {
$riga['idpreventivo'] = 0;
$riga['idcontratto'] = 0;
$riga['idintervento'] = 0;
@ -254,8 +251,6 @@ switch (post('op')) {
// Ricalcolo inps, ritenuta e bollo (se la fattura non è stata pagata)
ricalcola_costiagg_fattura($id_record);
aggiorna_sedi_movimenti('documenti', $id_record);
}
flash()->info(tr('Fatture duplicate correttamente!'));

View File

@ -283,7 +283,7 @@ if (empty($record['is_fiscale'])) {
<strike>';
}
echo (empty($scadenza['da_pagare']) ? '<i class="fa fa-exclamation-triangle"></i> ' : '').moneyFormat($scadenza['da_pagare']);
echo(empty($scadenza['da_pagare']) ? '<i class="fa fa-exclamation-triangle"></i> ' : '').moneyFormat($scadenza['da_pagare']);
if ($scadenza['pagato'] == $scadenza['da_pagare']) {
echo '

View File

@ -173,7 +173,7 @@ foreach ($righe as $riga) {
</td>
</tr>';
}
}
echo '
</tbody>';

View File

@ -52,9 +52,7 @@ echo '
'.((!empty($s_provincia)) ? tr('Provincia').': <b>'.strtoupper($s_provincia).'</b>' : '').'
</td>
</tr>';
}
else if (!empty($c_indirizzo) or !empty($c_cap) or !empty($c_citta) or !empty($c_provincia)) {
} elseif (!empty($c_indirizzo) or !empty($c_cap) or !empty($c_citta) or !empty($c_provincia)) {
echo '
<tr>
<td colspan="4">

View File

@ -12,15 +12,13 @@ $contratto = $dbo->fetchOne('SELECT nome, numero FROM co_contratti WHERE id = '.
$id_cliente = $documento['idanagrafica'];
$id_sede = $documento['idsede'];
if (!empty($documento['idsede_destinazione'])){
if (!empty($documento['idsede_destinazione'])) {
$sedi = $dbo->fetchOne('SELECT nomesede, cap, citta, indirizzo, provincia FROM an_sedi WHERE id = '.prepare($documento['idsede_destinazione']));
$s_citta = $sedi['citta'];
$s_indirizzo = $sedi['indirizzo'];
$s_cap = $sedi['cap'];
$s_provincia = $sedi['provincia'];
}
//Se ho deciso di NON mostrare i prezzi al tencico mi assicuro che non li possa vedere dalla stampa