Stile del codice

This commit is contained in:
Dasc3er 2020-11-12 17:11:09 +01:00
parent f9cbf2cbae
commit 7fb0cff9c8
12 changed files with 64 additions and 70 deletions

View File

@ -331,10 +331,9 @@ switch (post('op')) {
// Operazioni aggiuntive per il logo e filigrana stampe
if (filter('op') == 'link_file') {
$nome = filter('nome_allegato');
$logo_stampe = array("logo stampe", "logo_stampe", "logo stampe.jpg", "logo stampe.png");
$logo_stampe = ['logo stampe', 'logo_stampe', 'logo stampe.jpg', 'logo stampe.png'];
if (in_array(strtolower($nome), $logo_stampe)) {
$nome = 'Logo stampe';
$uploads = $structure->uploads($id_record)->where('filename', $upload);
@ -344,7 +343,7 @@ if (filter('op') == 'link_file') {
}
}
$filigrana_stampe = array("filigrana stampe", "filigrana_stampe", "filigrana stampe.jpg", "filigrana stampe.png");
$filigrana_stampe = ['filigrana stampe', 'filigrana_stampe', 'filigrana stampe.jpg', 'filigrana stampe.png'];
if (in_array(strtolower($nome), $filigrana_stampe)) {
$nome = 'Filigrana stampe';
$uploads = $structure->uploads($id_record)->where('filename', $upload);
@ -354,8 +353,7 @@ if (filter('op') == 'link_file') {
}
}
if (($nome == 'Logo stampe' || $nome = 'Filigrana stampe' ) && (setting('Azienda predefinita') == $id_record)) {
if (($nome == 'Logo stampe' || $nome = 'Filigrana stampe') && (setting('Azienda predefinita') == $id_record)) {
Settings::setValue($nome, $upload);
}
}

View File

@ -17,10 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Carbon\Carbon;
use Modules\Articoli\Articolo;
use Modules\Articoli\Categoria;
use Util\Ini;
use Carbon\Carbon;
include_once __DIR__.'/../../core.php';

View File

@ -72,7 +72,7 @@ class Articolo extends Model
*/
public function movimenta($qta, $descrizone = null, $data = null, $manuale = false, $array = [])
{
$data = ($data ?: date("Y-m-d H:i:s"));
$data = ($data ?: date('Y-m-d H:i:s'));
$id = $this->registra($qta, $descrizone, $data, $manuale, $array);
if ($this->servizio == 0) {

View File

@ -116,9 +116,9 @@ switch (post('op')) {
}
$operations['crea_fattura'] = [
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', [ '_TYPE_' => strtolower($module['name'])]),
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', ['_TYPE_' => strtolower($module['name'])]),
'data' => [
'title' => tr('Fatturare i _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]),
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]),
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture esistenti non ancora emesse?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',

View File

@ -148,10 +148,10 @@ if (App::debug()) {
}
$operations['crea_fattura'] = [
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', [ '_TYPE_' => strtolower($module['name'])]),
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', ['_TYPE_' => strtolower($module['name'])]),
'data' => [
'title' => tr('Fatturare i _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]),
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle _TYPE_ non ancora emesse?', [ '_TYPE_' => strtolower($module_fatture) ]).'", "placeholder": "'.tr('Aggiungere alle _TYPE_ nello stato bozza?', [ '_TYPE_' => strtolower($module_fatture) ]).'</small>", "name": "accodare" ]}
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]),
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle _TYPE_ non ancora emesse?', ['_TYPE_' => strtolower($module_fatture)]).'", "placeholder": "'.tr('Aggiungere alle _TYPE_ nello stato bozza?', ['_TYPE_' => strtolower($module_fatture)]).'</small>", "name": "accodare" ]}
<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',

View File

@ -238,10 +238,10 @@ return [
],
'crea_fattura' => [
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', [ '_TYPE_' => strtolower($module['name'])]),
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', ['_TYPE_' => strtolower($module['name'])]),
'data' => [
'title' => tr('Fatturare gli _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]).' <small><i class="fa fa-question-circle-o tip" title="'.tr("Verranno fatturati solo gli interventi completati non collegati a contratti o preventivi").'."></i></small>',
'msg' =>'{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>
'title' => tr('Fatturare gli _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]).' <small><i class="fa fa-question-circle-o tip" title="'.tr('Verranno fatturati solo gli interventi completati non collegati a contratti o preventivi').'."></i></small>',
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',

View File

@ -43,7 +43,7 @@ switch (filter('op')) {
], ['id' => $id_record]);
// Messaggio di avvertenza
if ((stripos("N6", $codice_natura) === 0) && $esigibilita == 'S') {
if ((stripos('N6', $codice_natura) === 0) && $esigibilita == 'S') {
flash()->warning(tr('Combinazione di natura IVA _TYPE_ ed esigibilità non compatibile', [
'_TYPE_' => $codice_natura,
]));

View File

@ -29,7 +29,7 @@ include_once __DIR__.'/../../core.php';
<div class="row">
<div class="col-md-offset-4 col-md-4">
{["type": "text", "label": "<?php echo tr('Ricerca con lettore');?>", "name": "barcode", "icon-before": "<i class=\"fa fa-barcode\"></i>" ]}
{["type": "text", "label": "<?php echo tr('Ricerca con lettore'); ?>", "name": "barcode", "icon-before": "<i class=\"fa fa-barcode\"></i>" ]}
</div>
</div>

View File

@ -116,9 +116,9 @@ switch (post('op')) {
}
$operations['crea_fattura'] = [
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', [ '_TYPE_' => strtolower($module['name'])]),
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', ['_TYPE_' => strtolower($module['name'])]),
'data' => [
'title' => tr('Fatturare i _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]),
'title' => tr('Fatturare i _TYPE_ selezionati?', ['_TYPE_' => strtolower($module['name'])]),
'msg' => '{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',

View File

@ -32,14 +32,13 @@ if (Interaction::isEnabled()) {
'_BTN_' => '<i class="fa fa-refresh"></i> <b>'.tr('Ricerca ricevute').'</b>',
]).'.</p>';
$fatture_generate_errore = Fattura::vendita()
->whereIn('codice_stato_fe', ['NS','ERR'])
->whereIn('codice_stato_fe', ['NS', 'ERR'])
->where('data_stato_fe', '>=', $_SESSION['period_start'])
->orderBy('data_stato_fe')
->get();
if (!empty($fatture_generate_errore->count())) {
if (!empty($fatture_generate_errore->count())) {
echo '
<div class="alert alert-warning alert-dismissible" role="alert"><button class="close" type="button" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">×</span><span class="sr-only">'.tr('Chiudi').'</span></button>
<p><i class="fa fa-warning"></i> '.tr('Attenzione: le seguenti fatture hanno ricevuto uno scartato o hanno presentano errori in fase di trasmissione').'.</p>
@ -54,7 +53,6 @@ if (Interaction::isEnabled()) {
</div>';
}
// Controllo se ci sono fatture in elaborazione da più di 7 giorni per le quali non ho ancora una ricevuta
$data_limite = (new Carbon())->subDays(7);
$fatture_generate = Fattura::vendita()
@ -77,8 +75,7 @@ if (Interaction::isEnabled()) {
echo '
</ul>
</div>';
}
}
}
echo '

View File

@ -32,12 +32,12 @@ echo '
<tr>
<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>';
if (!empty($preventivo)){
echo '
<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>';
if (!empty($preventivo)) {
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>';
}else if (!empty($contratto)){
echo '
} elseif (!empty($contratto)) {
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>';
}
echo '

View File

@ -1,33 +1,32 @@
<?php
use Modules\Contratti\Components\Riga AS RigaContratto;
use Modules\Contratti\Components\Articolo AS ArticoloContratto;
use Modules\Preventivi\Components\Riga AS RigaPreventivo;
use Modules\Preventivi\Components\Articolo AS ArticoloPreventivo;
use Modules\Ordini\Components\Riga AS RigaOrdine;
use Modules\Ordini\Components\Articolo AS ArticoloOrdine;
use Modules\DDT\Components\Riga AS RigaDDT;
use Modules\DDT\Components\Articolo AS ArticoloDDT;
use Modules\Contratti\Components\Articolo as ArticoloContratto;
use Modules\Contratti\Components\Riga as RigaContratto;
use Modules\DDT\Components\Articolo as ArticoloDDT;
use Modules\DDT\Components\Riga as RigaDDT;
use Modules\Ordini\Components\Articolo as ArticoloOrdine;
use Modules\Ordini\Components\Riga as RigaOrdine;
use Modules\Preventivi\Components\Articolo as ArticoloPreventivo;
use Modules\Preventivi\Components\Riga as RigaPreventivo;
/**
* Procedura per aggiustare alcuni campi di sconto ivato nei documenti prima della fattura
* in quanto veniva calcolato lo sconto ivato erroneamente
* in quanto veniva calcolato lo sconto ivato erroneamente.
*/
// Fix sconti contratti
$righe = $dbo->fetchArray('SELECT id, idiva, sconto_percentuale, prezzo_unitario FROM co_righe_contratti WHERE sconto_percentuale != 0 AND tipo_sconto="PRC"');
foreach( $righe as $riga ){
if( empty($riga['idarticolo']) ){
$this_riga = RigaContratto::find( $riga['id'] );
foreach ($righe as $riga) {
if (empty($riga['idarticolo'])) {
$this_riga = RigaContratto::find($riga['id']);
} else {
$this_riga = ArticoloContratto::find( $riga['id'] );
$this_riga = ArticoloContratto::find($riga['id']);
}
if( $this_riga !== null ){
$this_riga->setPrezzoUnitario( $riga['prezzo_unitario'], $riga['idiva'] );
$this_riga->setSconto( $riga['sconto_percentuale'], 'PRC' );
if ($this_riga !== null) {
$this_riga->setPrezzoUnitario($riga['prezzo_unitario'], $riga['idiva']);
$this_riga->setSconto($riga['sconto_percentuale'], 'PRC');
$this_riga->save();
}
}
@ -35,16 +34,16 @@ foreach( $righe as $riga ){
// Fix sconti preventivi
$righe = $dbo->fetchArray('SELECT id, idiva, sconto_percentuale, prezzo_unitario FROM co_righe_preventivi WHERE sconto_percentuale != 0 AND tipo_sconto="PRC"');
foreach( $righe as $riga ){
if( empty($riga['idarticolo']) ){
$this_riga = RigaPreventivo::find( $riga['id'] );
foreach ($righe as $riga) {
if (empty($riga['idarticolo'])) {
$this_riga = RigaPreventivo::find($riga['id']);
} else {
$this_riga = ArticoloPreventivo::find( $riga['id'] );
$this_riga = ArticoloPreventivo::find($riga['id']);
}
if( $this_riga !== null ){
$this_riga->setPrezzoUnitario( $riga['prezzo_unitario'], $riga['idiva'] );
$this_riga->setSconto( $riga['sconto_percentuale'], 'PRC' );
if ($this_riga !== null) {
$this_riga->setPrezzoUnitario($riga['prezzo_unitario'], $riga['idiva']);
$this_riga->setSconto($riga['sconto_percentuale'], 'PRC');
$this_riga->save();
}
}
@ -52,16 +51,16 @@ foreach( $righe as $riga ){
// Fix sconti ordini
$righe = $dbo->fetchArray('SELECT id, idiva, sconto_percentuale, prezzo_unitario FROM or_righe_ordini WHERE sconto_percentuale != 0 AND tipo_sconto="PRC"');
foreach( $righe as $riga ){
if( empty($riga['idarticolo']) ){
$this_riga = RigaOrdine::find( $riga['id'] );
foreach ($righe as $riga) {
if (empty($riga['idarticolo'])) {
$this_riga = RigaOrdine::find($riga['id']);
} else {
$this_riga = ArticoloOrdine::find( $riga['id'] );
$this_riga = ArticoloOrdine::find($riga['id']);
}
if( $this_riga !== null ){
$this_riga->setPrezzoUnitario( $riga['prezzo_unitario'], $riga['idiva'] );
$this_riga->setSconto( $riga['sconto_percentuale'], 'PRC' );
if ($this_riga !== null) {
$this_riga->setPrezzoUnitario($riga['prezzo_unitario'], $riga['idiva']);
$this_riga->setSconto($riga['sconto_percentuale'], 'PRC');
$this_riga->save();
}
}
@ -69,16 +68,16 @@ foreach( $righe as $riga ){
// Fix sconti ddt
$righe = $dbo->fetchArray('SELECT id, idiva, sconto_percentuale, prezzo_unitario FROM dt_righe_ddt WHERE sconto_percentuale != 0 AND tipo_sconto="PRC"');
foreach( $righe as $riga ){
if( empty($riga['idarticolo']) ){
$this_riga = RigaDDT::find( $riga['id'] );
foreach ($righe as $riga) {
if (empty($riga['idarticolo'])) {
$this_riga = RigaDDT::find($riga['id']);
} else {
$this_riga = ArticoloDDT::find( $riga['id'] );
$this_riga = ArticoloDDT::find($riga['id']);
}
if( $this_riga !== null ){
$this_riga->setPrezzoUnitario( $riga['prezzo_unitario'], $riga['idiva'] );
$this_riga->setSconto( $riga['sconto_percentuale'], 'PRC' );
if ($this_riga !== null) {
$this_riga->setPrezzoUnitario($riga['prezzo_unitario'], $riga['idiva']);
$this_riga->setSconto($riga['sconto_percentuale'], 'PRC');
$this_riga->save();
}
}
}