mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 20:10:50 +01:00
refactor: formattazione codice
This commit is contained in:
parent
ea4aa2c356
commit
fb9111be94
@ -73,7 +73,7 @@ use Modules\Iva\Aliquota;
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<?php echo ( !empty($record['id_marchio']) ? Modules::link('Marchi', $record['id_marchio'], null, null, 'class="pull-right"') : '' ) ?>
|
||||
<?php echo !empty($record['id_marchio']) ? Modules::link('Marchi', $record['id_marchio'], null, null, 'class="pull-right"') : ''; ?>
|
||||
{[ "type": "select", "label": "<?php echo tr('Marchio'); ?>", "name": "id_marchio", "value":"$id_marchio$", "values": "query=SELECT id, name AS descrizione FROM mg_marchi ORDER BY descrizione ASC" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,7 +20,6 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Modules\Articoli\Categoria;
|
||||
use Modules\Anagrafiche\Sede;
|
||||
|
||||
$immagine_articolo = $articolo->immagine ? base_path().'/files/articoli/'.$articolo->immagine : App::getPaths()['img'].'/logo_header.png';
|
||||
|
||||
|
@ -339,7 +339,7 @@ switch ($op) {
|
||||
|
||||
$fatture = Fattura::vendita()
|
||||
->select('*', 'co_documenti.id AS id', 'co_documenti.data AS data')
|
||||
->where('co_documenti.idanagrafica', "=", $id_anagrafica)
|
||||
->where('co_documenti.idanagrafica', '=', $id_anagrafica)
|
||||
->whereIn('idstatodocumento', [$stato1->id, $stato2->id])
|
||||
->join('co_scadenziario', 'co_documenti.id', '=', 'co_scadenziario.iddocumento')
|
||||
->join('co_tipidocumento', 'co_tipidocumento.id', '=', 'co_documenti.idtipodocumento')
|
||||
|
@ -55,7 +55,6 @@ if ($module->getTranslation('title') == 'Fatture di vendita' && $services_enable
|
||||
if ($documento->codice_stato_fe == 'NS' && ($documento->stato != Stato::where('name', 'Bozza')->first()->id) && ($documento->stato != Stato::where('name', 'Non valida')->first()->id)) {
|
||||
$ricevuta_principale = $documento->getRicevutaPrincipale();
|
||||
|
||||
|
||||
if (!empty($ricevuta_principale)) {
|
||||
$contenuto_ricevuta = XML::readFile(base_dir().'/files/fatture/'.$ricevuta_principale->filename);
|
||||
$lista_errori = $contenuto_ricevuta['ListaErrori'];
|
||||
|
@ -22,7 +22,6 @@ include_once __DIR__.'/../../core.php';
|
||||
switch (post('op')) {
|
||||
// Aggiorno informazioni di base impianto
|
||||
case 'update':
|
||||
|
||||
$dbo->update('mg_marchi', [
|
||||
'name' => post('name'),
|
||||
], ['id' => $id_record]);
|
||||
@ -33,7 +32,6 @@ switch (post('op')) {
|
||||
|
||||
// Aggiungo impianto
|
||||
case 'add':
|
||||
|
||||
$dbo->insert('mg_marchi', [
|
||||
'name' => post('name'),
|
||||
]);
|
||||
@ -43,7 +41,6 @@ switch (post('op')) {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
// Rimuovo impianto e scollego tutti i suoi componenti
|
||||
case 'delete':
|
||||
$dbo->query('DELETE FROM mg_marchi WHERE id='.prepare($id_record));
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
|
||||
?><form action="" method="post" id="edit-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="op" value="update">
|
||||
|
@ -701,12 +701,12 @@ class FatturaElettronica implements \Stringable
|
||||
// Codice fiscale
|
||||
// TODO: Nella fattura elettronica, emessa nei confronti di soggetti titolari di partita IVA (nodo CessionarioCommittente), non va indicato il codice fiscale se è già presente la partita iva.
|
||||
if (!empty($anagrafica['codice_fiscale'])) {
|
||||
$result['CodiceFiscale'] = preg_replace('/\s+/', '', $anagrafica['codice_fiscale']);
|
||||
$result['CodiceFiscale'] = preg_replace('/\s+/', '', (string) $anagrafica['codice_fiscale']);
|
||||
|
||||
// $result['CodiceFiscale'] = str_replace($anagrafica->nazione->iso2, '', $result['CodiceFiscale']);
|
||||
|
||||
// Rimuovo eventuali idicazioni relative all'iso2 della nazione, solo se la stringa inizia con quest'ultima.
|
||||
$result['CodiceFiscale'] = preg_replace('/^'.preg_quote($anagrafica->nazione->iso2, '/').'/', '', $anagrafica['codice_fiscale']);
|
||||
$result['CodiceFiscale'] = preg_replace('/^'.preg_quote($anagrafica->nazione->iso2, '/').'/', '', (string) $anagrafica['codice_fiscale']);
|
||||
}
|
||||
|
||||
// Partita IVA: se privato estero non va considerato il codice fiscale ma la partita iva con 9 zeri
|
||||
|
@ -123,16 +123,24 @@ class Pianificazione extends Document
|
||||
return $this->contratto->descrizioni();
|
||||
}
|
||||
|
||||
public function getReferenceName() {}
|
||||
public function getReferenceName()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceNumber() {}
|
||||
public function getReferenceNumber()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceDate() {}
|
||||
public function getReferenceDate()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceRagioneSociale()
|
||||
{
|
||||
return $this->anagrafica->ragione_sociale;
|
||||
}
|
||||
|
||||
public function getReference() {}
|
||||
public function getReference()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -152,20 +152,28 @@ class Promemoria extends Document
|
||||
return $this->hasMany(Components\Descrizione::class, 'id_promemoria');
|
||||
}
|
||||
|
||||
public function getModuleAttribute() {}
|
||||
public function getModuleAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceName() {}
|
||||
public function getReferenceName()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceNumber()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceDate() {}
|
||||
public function getReferenceDate()
|
||||
{
|
||||
}
|
||||
|
||||
public function getReferenceRagioneSociale()
|
||||
{
|
||||
return $this->anagrafica->ragione_sociale;
|
||||
}
|
||||
|
||||
public function getReference() {}
|
||||
public function getReference()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class Generator
|
||||
|
||||
$values = array_column($replaces, 'regex');
|
||||
|
||||
$pattern = preg_replace('/#{1,}/', '#', $pattern);
|
||||
$pattern = preg_replace('/#{1,}/', '#', (string) $pattern);
|
||||
$pattern = str_replace('\\#', '#', preg_quote($pattern, '/'));
|
||||
$pattern = str_replace(array_keys($replaces), array_values($values), $pattern);
|
||||
|
||||
|
@ -157,7 +157,7 @@ class XML
|
||||
protected static function removeBOM($text)
|
||||
{
|
||||
$bom = pack('H*', 'EFBBBF');
|
||||
$text = preg_replace("/^$bom/", '', $text);
|
||||
$text = preg_replace("/^$bom/", '', (string) $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ foreach ($righe as $riga) {
|
||||
'.nl2br($text);
|
||||
}
|
||||
}
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", '', $r['descrizione']);
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", '', (string) $r['descrizione']);
|
||||
$autofill->count($r['descrizione']);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ foreach ($righe as $riga) {
|
||||
'.nl2br($text);
|
||||
}
|
||||
}
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", ' ', $r['descrizione']);
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", ' ', (string) $r['descrizione']);
|
||||
$autofill->count($r['descrizione']);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ if (!$is_last_page) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$imponibile = 0;
|
||||
foreach ($v_totale as $key => $v) {
|
||||
$totale_scontato += $v;
|
||||
@ -44,7 +43,7 @@ $totale_imponibile = $totale_scontato + $rivalsa;
|
||||
$totale_iva = 0;
|
||||
foreach ($righe as $riga) {
|
||||
$aliquota = $database->fetchOne('SELECT percentuale FROM co_iva WHERE id = '.prepare($riga->idiva))['percentuale'];
|
||||
$totale_iva += $riga['iva'] + $riga['rivalsainps'] * $aliquota / 100;;
|
||||
$totale_iva += $riga['iva'] + $riga['rivalsainps'] * $aliquota / 100;
|
||||
}
|
||||
|
||||
$totale = $totale_iva + $totale_imponibile;
|
||||
@ -212,8 +211,8 @@ if ($has_ritenuta || $show_sconto || $has_rivalsa) {
|
||||
echo "
|
||||
<tr>
|
||||
<th class='text-center small' style='width:".$width."'>
|
||||
".tr('Imponibile', [], ['upper' => true])."
|
||||
</th>";
|
||||
".tr('Imponibile', [], ['upper' => true]).'
|
||||
</th>';
|
||||
} else {
|
||||
echo "
|
||||
<tr>
|
||||
@ -233,8 +232,8 @@ if ($show_sconto) {
|
||||
if ($has_rivalsa) {
|
||||
echo "
|
||||
<th class='text-center small' style='width:".$width."'>
|
||||
".tr('Cassa Previdenziale', [], ['upper' => true])."
|
||||
</th>";
|
||||
".tr('Cassa Previdenziale', [], ['upper' => true]).'
|
||||
</th>';
|
||||
} else {
|
||||
echo "
|
||||
<th class='text-center small' style='width:".$width."'>
|
||||
@ -242,9 +241,9 @@ echo "
|
||||
}
|
||||
echo "
|
||||
<th class='text-center small' style='width:".$width."'>
|
||||
".(($show_sconto) ? $etichette['totale_parziale'] : $etichette['totale'])."
|
||||
".(($show_sconto) ? $etichette['totale_parziale'] : $etichette['totale']).'
|
||||
</th>
|
||||
</tr>";
|
||||
</tr>';
|
||||
|
||||
if ($has_ritenuta || $show_sconto || $has_rivalsa) {
|
||||
echo "
|
||||
@ -293,7 +292,6 @@ if ($has_rivalsa) {
|
||||
'.moneyFormat($totale_imponibile, $d_totali).'
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
} elseif ($show_sconto) {
|
||||
echo '
|
||||
<td class="cell-padded text-center">
|
||||
@ -344,7 +342,6 @@ echo '
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
|
||||
/*
|
||||
* Riga di riepilogo di Ritenuta d'acconto e Ritenuta contributi.
|
||||
* Ritenuta | Totale (+ Rivalsa INPS - Ritenuta)
|
||||
|
@ -40,7 +40,7 @@ $query = Query::getQuery($structure, $where, 0, []);
|
||||
$query = Modules::replaceAdditionals($structure->id, $query);
|
||||
|
||||
// Modifiche alla query principale
|
||||
$query = preg_replace('/FROM[\s\t\n]+`mg_articoli`/s', 'FROM `mg_articoli` LEFT JOIN (SELECT `idarticolo`, SUM(`qta`) AS qta_totale FROM `mg_movimenti` WHERE `data` <='.prepare($period_end).' GROUP BY `idarticolo`) movimenti ON `movimenti`.`idarticolo`=`mg_articoli`.`id` ', $query);
|
||||
$query = preg_replace('/FROM[\s\t\n]+`mg_articoli`/s', 'FROM `mg_articoli` LEFT JOIN (SELECT `idarticolo`, SUM(`qta`) AS qta_totale FROM `mg_movimenti` WHERE `data` <='.prepare($period_end).' GROUP BY `idarticolo`) movimenti ON `movimenti`.`idarticolo`=`mg_articoli`.`id` ', (string) $query);
|
||||
$query = preg_replace('/^SELECT/', 'SELECT `movimenti`.`qta_totale`, ', $query);
|
||||
|
||||
if (post('acquisto') == 'standard') {
|
||||
|
@ -151,7 +151,7 @@ foreach ($righe as $riga) {
|
||||
'.nl2br($text);
|
||||
}
|
||||
}
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", '', $r['descrizione']);
|
||||
$r['descrizione'] = preg_replace("/Rif\.(.*)/s", '', (string) $r['descrizione']);
|
||||
$autofill->count($r['descrizione']);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user