mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Correzioni sul blocco fattura per Fattura Elettronica
This commit is contained in:
parent
bab428df94
commit
b76c2937fa
@ -21,11 +21,7 @@ use Modules\Iva\Aliquota;
|
|||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
$block_edit = !empty($note_accredito) || $record['stato'] == 'Emessa' || $record['stato'] == 'Pagato' || $record['stato'] == 'Parzialmente pagato';
|
$block_edit = !empty($note_accredito) || in_array($record['stato'], ['Emessa', 'Pagato', 'Parzialmente pagato']) || !$abilita_genera;
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT co_tipidocumento.descrizione, dir FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento WHERE co_documenti.id='.prepare($id_record));
|
|
||||||
$dir = $rs[0]['dir'];
|
|
||||||
$tipodoc = $rs[0]['descrizione'];
|
|
||||||
|
|
||||||
if ($dir == 'entrata') {
|
if ($dir == 'entrata') {
|
||||||
$conto = 'vendite';
|
$conto = 'vendite';
|
||||||
@ -164,7 +160,7 @@ if (empty($record['is_fiscale'])) {
|
|||||||
$plugin = $dbo->fetchArray("SELECT id FROM zz_plugins WHERE name='Fatturazione Elettronica' AND idmodule_to = ".prepare($id_module));
|
$plugin = $dbo->fetchArray("SELECT id FROM zz_plugins WHERE name='Fatturazione Elettronica' AND idmodule_to = ".prepare($id_module));
|
||||||
echo '<script>$("#link-tab_'.$plugin[0]['id'].'").addClass("disabled");</script>';
|
echo '<script>$("#link-tab_'.$plugin[0]['id'].'").addClass("disabled");</script>';
|
||||||
}
|
}
|
||||||
//Forzo il passaggio della fattura da Bozza ad Emessa per il corretto calcolo del numero.
|
// Forzo il passaggio della fattura da Bozza ad Emessa per il corretto calcolo del numero.
|
||||||
elseif ($record['stato'] == 'Bozza') {
|
elseif ($record['stato'] == 'Bozza') {
|
||||||
$query .= " WHERE descrizione IN ('Emessa', 'Bozza')";
|
$query .= " WHERE descrizione IN ('Emessa', 'Bozza')";
|
||||||
}
|
}
|
||||||
@ -195,19 +191,17 @@ elseif ($record['stato'] == 'Bozza') {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="col-md-<?php echo ($is_fiscale) ? 2 : 6; ?>">
|
echo '
|
||||||
<!-- TODO: Rimuovere possibilità di selezionare lo stato pagato obbligando l'utente ad aggiungere il movimento in prima nota -->
|
<div class="col-md-'.($is_fiscale ? 2 : 6).'">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatodocumento", "required": 1, "values": "query=<?php echo $query; ?>", "value": "$idstatodocumento$", "class": "unblockable", "extra": " onchange = \"if ($('#idstatodocumento option:selected').text()=='Pagato' || $('#idstatodocumento option:selected').text()=='Parzialmente pagato' ){if( confirm('<?php echo tr('Sicuro di voler impostare manualmente la fattura come pagata senza aggiungere il movimento in prima nota?'); ?>') ){ return true; }else{ $('#idstatodocumento').selectSet(<?php echo $record['idstatodocumento']; ?>); }}\" " ]}
|
<!-- TODO: Rimuovere possibilità di selezionare lo stato pagato obbligando l\'utente ad aggiungere il movimento in prima nota -->
|
||||||
|
{[ "type": "select", "label": "'.tr('Stato').'", "name": "idstatodocumento", "required": 1, "values": "query='.$query.'", "value": "$idstatodocumento$", "class": "'.(!$abilita_genera ? '' : 'unblockable').'", "extra": "onchange=\"return cambiaStato()\"" ]}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<?php
|
'.Modules::link('Anagrafiche', $record['idanagrafica'], null, null, 'class="pull-right"');
|
||||||
|
|
||||||
echo Modules::link('Anagrafiche', $record['idanagrafica'], null, null, 'class="pull-right"');
|
|
||||||
|
|
||||||
if ($dir == 'entrata') {
|
if ($dir == 'entrata') {
|
||||||
?>
|
?>
|
||||||
@ -337,7 +331,7 @@ elseif ($record['stato'] == 'Bozza') {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
//TODO: Fattura per conto del fornitore (es. cooperative agricole che emettono la fattura per conto dei propri soci produttori agricoli conferenti)
|
// TODO: Fattura per conto del fornitore (es. cooperative agricole che emettono la fattura per conto dei propri soci produttori agricoli conferenti)
|
||||||
if ($dir == 'entrata') {
|
if ($dir == 'entrata') {
|
||||||
?>
|
?>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@ -410,7 +404,7 @@ echo '
|
|||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
if ($tipodoc == 'Fattura accompagnatoria di vendita') {
|
if ($record['descrizione_tipo'] == 'Fattura accompagnatoria di vendita') {
|
||||||
echo '
|
echo '
|
||||||
<div class="box box-info">
|
<div class="box box-info">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
@ -884,4 +878,16 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function cambiaStato() {
|
||||||
|
let testo = $("#idstatodocumento option:selected").text();
|
||||||
|
|
||||||
|
if (testo == "Pagato" || testo == "Parzialmente pagato") {
|
||||||
|
if(confirm("'.tr('Sicuro di voler impostare manualmente la fattura come pagata senza aggiungere il movimento in prima nota?').'")) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$("#idstatodocumento").selectSet('.$record['idstatodocumento'].');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
@ -29,6 +29,7 @@ if ($module['name'] == 'Fatture di vendita') {
|
|||||||
|
|
||||||
if (isset($id_record)) {
|
if (isset($id_record)) {
|
||||||
$fattura = Fattura::with('tipo', 'stato')->find($id_record);
|
$fattura = Fattura::with('tipo', 'stato')->find($id_record);
|
||||||
|
$dir = $fattura->direzione;
|
||||||
|
|
||||||
$is_fiscale = false;
|
$is_fiscale = false;
|
||||||
if (!empty($fattura)) {
|
if (!empty($fattura)) {
|
||||||
@ -44,7 +45,7 @@ if (isset($id_record)) {
|
|||||||
co_documenti.id AS iddocumento,
|
co_documenti.id AS iddocumento,
|
||||||
co_documenti.split_payment AS split_payment,
|
co_documenti.split_payment AS split_payment,
|
||||||
co_statidocumento.descrizione AS `stato`,
|
co_statidocumento.descrizione AS `stato`,
|
||||||
co_tipidocumento.descrizione AS `descrizione_tipodoc`,
|
co_tipidocumento.descrizione AS `descrizione_tipo`,
|
||||||
co_pagamenti.riba AS `riba`,
|
co_pagamenti.riba AS `riba`,
|
||||||
(SELECT is_fiscale FROM zz_segments WHERE id = id_segment) AS is_fiscale,
|
(SELECT is_fiscale FROM zz_segments WHERE id = id_segment) AS is_fiscale,
|
||||||
(SELECT descrizione FROM co_ritenutaacconto WHERE id=idritenutaacconto) AS ritenutaacconto_desc,
|
(SELECT descrizione FROM co_ritenutaacconto WHERE id=idritenutaacconto) AS ritenutaacconto_desc,
|
||||||
@ -57,5 +58,10 @@ if (isset($id_record)) {
|
|||||||
LEFT JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id
|
LEFT JOIN co_pagamenti ON co_documenti.idpagamento=co_pagamenti.id
|
||||||
WHERE co_tipidocumento.dir = '.prepare($dir).' AND co_documenti.id='.prepare($id_record));
|
WHERE co_tipidocumento.dir = '.prepare($dir).' AND co_documenti.id='.prepare($id_record));
|
||||||
|
|
||||||
|
// Note di credito collegate
|
||||||
$note_accredito = $dbo->fetchArray("SELECT co_documenti.id, IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM co_documenti JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE reversed = 1 AND ref_documento=".prepare($id_record));
|
$note_accredito = $dbo->fetchArray("SELECT co_documenti.id, IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM co_documenti JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE reversed = 1 AND ref_documento=".prepare($id_record));
|
||||||
|
|
||||||
|
// Blocco gestito dallo stato della Fattura Elettronica
|
||||||
|
$stato_fe = $database->fetchOne('SELECT * FROM fe_stati_documento WHERE codice = '.prepare($fattura->codice_stato_fe));
|
||||||
|
$abilita_genera = empty($fattura->codice_stato_fe) || intval($stato_fe['is_generabile']);
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lettura info fattura
|
// Lettura info fattura
|
||||||
$query = 'SELECT *, co_documenti.data_competenza, co_documenti.note, co_documenti.idpagamento, co_documenti.id AS iddocumento, co_statidocumento.descrizione AS `stato`, co_tipidocumento.descrizione AS `descrizione_tipodoc` FROM ((co_documenti LEFT OUTER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id) INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_documenti.id='.prepare($iddocumento);
|
$query = 'SELECT *, co_documenti.data_competenza, co_documenti.note, co_documenti.idpagamento, co_documenti.id AS iddocumento, co_statidocumento.descrizione AS `stato`, co_tipidocumento.descrizione AS `descrizione_tipo` FROM ((co_documenti LEFT OUTER JOIN co_statidocumento ON co_documenti.idstatodocumento=co_statidocumento.id) INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica) INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_documenti.id='.prepare($iddocumento);
|
||||||
$rs = $dbo->fetchArray($query);
|
$rs = $dbo->fetchArray($query);
|
||||||
$n = sizeof($rs);
|
$n = sizeof($rs);
|
||||||
$data = $rs[0]['data_competenza'];
|
$data = $rs[0]['data_competenza'];
|
||||||
@ -256,9 +256,9 @@ function aggiungi_movimento($iddocumento, $dir, $primanota = 0)
|
|||||||
|
|
||||||
// Abbreviazioni contabili dei movimenti
|
// Abbreviazioni contabili dei movimenti
|
||||||
$tipodoc = '';
|
$tipodoc = '';
|
||||||
if ($rs[0]['descrizione_tipodoc'] == 'Nota di credito') {
|
if ($rs[0]['descrizione_tipo'] == 'Nota di credito') {
|
||||||
$tipodoc = 'Nota di credito';
|
$tipodoc = 'Nota di credito';
|
||||||
} elseif ($rs[0]['descrizione_tipodoc'] == 'Nota di debito') {
|
} elseif ($rs[0]['descrizione_tipo'] == 'Nota di debito') {
|
||||||
$tipodoc = 'Nota di debito';
|
$tipodoc = 'Nota di debito';
|
||||||
} else {
|
} else {
|
||||||
$tipodoc = 'Fattura';
|
$tipodoc = 'Fattura';
|
||||||
|
@ -25,15 +25,14 @@ use Plugins\ExportFE\Interaction;
|
|||||||
use Util\XML;
|
use Util\XML;
|
||||||
|
|
||||||
/* Per le PA EC02 e EC01 sono dei stati successivi a NE il quale a sua volta è successivo a RC. EC01 e EC02 sono definiti all'interno della ricevuta di NE che di fatto indica il rifiuto o l'accettazione. */
|
/* Per le PA EC02 e EC01 sono dei stati successivi a NE il quale a sua volta è successivo a RC. EC01 e EC02 sono definiti all'interno della ricevuta di NE che di fatto indica il rifiuto o l'accettazione. */
|
||||||
$abilita_genera = empty($fattura->codice_stato_fe) || in_array($fattura->codice_stato_fe, ['GEN', 'NS', 'EC02', 'ERR']);
|
$stato_fe = $database->fetchOne('SELECT * FROM fe_stati_documento WHERE codice = '.prepare($fattura->codice_stato_fe));
|
||||||
|
$abilita_genera = empty($fattura->codice_stato_fe) || intval($stato_fe['is_generabile']);
|
||||||
$ricevuta_principale = $fattura->getRicevutaPrincipale();
|
$ricevuta_principale = $fattura->getRicevutaPrincipale();
|
||||||
|
|
||||||
if (!empty($fattura_pa)) {
|
if (!empty($fattura_pa)) {
|
||||||
$disabled = false;
|
$generata = $fattura_pa->isGenerated();
|
||||||
$generated = $fattura_pa->isGenerated();
|
|
||||||
} else {
|
} else {
|
||||||
$disabled = true;
|
$generata = false;
|
||||||
$generated = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$checks = FatturaElettronica::controllaFattura($fattura);
|
$checks = FatturaElettronica::controllaFattura($fattura);
|
||||||
@ -78,12 +77,12 @@ echo '
|
|||||||
<input type="hidden" name="backto" value="record-edit">
|
<input type="hidden" name="backto" value="record-edit">
|
||||||
<input type="hidden" name="op" value="generate">
|
<input type="hidden" name="op" value="generate">
|
||||||
|
|
||||||
<button id="genera" type="submit" class="btn btn-primary btn-lg '.($disabled || !$abilita_genera ? 'disabled' : '').'" '.($disabled || !$abilita_genera ? ' disabled' : null).'>
|
<button id="genera" type="submit" class="btn btn-primary btn-lg '.(!$abilita_genera ? 'disabled' : '').'" '.(!$abilita_genera ? ' disabled' : null).'>
|
||||||
<i class="fa fa-file"></i> '.tr('Genera').'
|
<i class="fa fa-file"></i> '.tr('Genera').'
|
||||||
</button>
|
</button>
|
||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
$file = $generated ? Upload::where('filename', $fattura_pa->getFilename())
|
$file = $generata ? Upload::where('filename', $fattura_pa->getFilename())
|
||||||
->where('id_record', $id_record)
|
->where('id_record', $id_record)
|
||||||
->first() : null;
|
->first() : null;
|
||||||
|
|
||||||
@ -91,17 +90,17 @@ echo '
|
|||||||
|
|
||||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||||
|
|
||||||
<a href="'.ROOTDIR.'/view.php?file_id='.($file ? $file->id : null).'" class="btn btn-info btn-lg '.($generated ? '' : 'disabled').'" target="_blank" '.($generated ? '' : 'disabled').'>
|
<a href="'.ROOTDIR.'/view.php?file_id='.($file ? $file->id : null).'" class="btn btn-info btn-lg '.($generata ? '' : 'disabled').'" target="_blank" '.($generata ? '' : 'disabled').'>
|
||||||
<i class="fa fa-eye"></i> '.tr('Visualizza').'
|
<i class="fa fa-eye"></i> '.tr('Visualizza').'
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
// Scelgo quando posso inviarla
|
// Scelgo quando posso inviarla
|
||||||
$send = Interaction::isEnabled() && $generated && in_array($record['codice_stato_fe'], ['GEN', 'ERVAL', 'ERR']);
|
$inviabile = Interaction::isEnabled() && $generata && intval($stato_fe['is_inviabile']);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||||
|
|
||||||
<a href="'.$structure->fileurl('download.php').'?id_record='.$id_record.'" class="btn btn-primary btn-lg '.($generated ? '' : 'disabled').'" target="_blank" '.($generated ? '' : 'disabled').'>
|
<a href="'.$structure->fileurl('download.php').'?id_record='.$id_record.'" class="btn btn-primary btn-lg '.($generata ? '' : 'disabled').'" target="_blank" '.($generata ? '' : 'disabled').'>
|
||||||
<i class="fa fa-download"></i> '.tr('Scarica').'
|
<i class="fa fa-download"></i> '.tr('Scarica').'
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
@ -109,11 +108,11 @@ echo '
|
|||||||
|
|
||||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||||
|
|
||||||
<button onclick="if( confirm(\''.tr('Inviare la fattura al SDI?').'\') ){ send(this); }" class="btn btn-success btn-lg '.($send ? '' : 'disabled').'" target="_blank" '.($send ? '' : 'disabled').'>
|
<button onclick="if( confirm(\''.tr('Inviare la fattura al SDI?').'\') ){ send(this); }" class="btn btn-success btn-lg '.($inviabile ? '' : 'disabled').'" target="_blank" '.($inviabile ? '' : 'disabled').'>
|
||||||
<i class="fa fa-paper-plane"></i> '.tr('Invia').'
|
<i class="fa fa-paper-plane"></i> '.tr('Invia').'
|
||||||
</button>';
|
</button>';
|
||||||
|
|
||||||
$verify = Interaction::isEnabled() && $generated;
|
$verify = Interaction::isEnabled() && $generata;
|
||||||
echo '
|
echo '
|
||||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||||
|
|
||||||
@ -125,47 +124,47 @@ echo '
|
|||||||
echo '<br><br>';
|
echo '<br><br>';
|
||||||
|
|
||||||
// Messaggio informativo sulla ricevuta principale impostata
|
// Messaggio informativo sulla ricevuta principale impostata
|
||||||
if (!empty($record['codice_stato_fe'])) {
|
if (!empty($fattura->codice_stato_fe)) {
|
||||||
if ($record['codice_stato_fe'] == 'GEN') {
|
echo '
|
||||||
echo '
|
<div class="alert alert-'.$stato_fe['tipo'].'">
|
||||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> '.tr("La fattura è stata generata ed è pronta per l'invio").'.</div>';
|
|
||||||
} else {
|
|
||||||
$stato_fe = database()->fetchOne('SELECT codice, descrizione, icon FROM fe_stati_documento WHERE codice='.prepare($record['codice_stato_fe']));
|
|
||||||
|
|
||||||
if (in_array($stato_fe['codice'], ['EC01', 'RC'])) {
|
|
||||||
$class = 'success';
|
|
||||||
} elseif (in_array($stato_fe['codice'], ['ERVAL', 'GEN', 'MC', 'WAIT', 'NE'])) {
|
|
||||||
$class = 'warning';
|
|
||||||
} else {
|
|
||||||
$class = 'danger';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="alert alert-'.$class.'">
|
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<i class="fa fa-clock-o tip" title="'.tr('Data e ora ricezione').'"></i> '.Translator::timestampToLocale($record['data_stato_fe']);
|
<i class="fa fa-clock-o tip" title="'.tr('Data e ora').'"></i> '.timestampFormat($record['data_stato_fe']);
|
||||||
|
|
||||||
if (!empty($ricevuta_principale)) {
|
if (!empty($ricevuta_principale)) {
|
||||||
echo '
|
echo '
|
||||||
<a href="'.ROOTDIR.'/view.php?file_id='.$ricevuta_principale->id.'" target="_blank" class="btn btn-info btn-xs">
|
<a href="'.ROOTDIR.'/view.php?file_id='.$ricevuta_principale->id.'" target="_blank" class="btn btn-info btn-xs">
|
||||||
<i class="fa fa-external-link"></i> '.tr('Visualizza ricevuta').'
|
<i class="fa fa-external-link"></i> '.tr('Visualizza ricevuta').'
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<big><i class="'.$stato_fe['icon'].'" style="color:#fff;"></i>
|
<big>
|
||||||
<b>'.$stato_fe['codice'].'</b> - '.$stato_fe['descrizione'].'</big> '.(!empty($record['descrizione_ricevuta_fe']) ? '<br><b>'.tr('Note', [], ['upper' => true]).':</b> '.$record['descrizione_ricevuta_fe'] : '').'
|
<i class="'.$stato_fe['icon'].'" style="color:#fff;"></i>
|
||||||
|
<b>'.$stato_fe['codice'].'</b> - '.$stato_fe['descrizione'].'
|
||||||
|
</big>';
|
||||||
|
|
||||||
|
if (!empty($record['descrizione_ricevuta_fe'])) {
|
||||||
|
echo '
|
||||||
|
<br><b>'.tr('Note', [], ['upper' => true]).':</b> '.$record['descrizione_ricevuta_fe'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($fattura->codice_stato_fe == 'GEN') {
|
||||||
|
echo '
|
||||||
|
<br><i class="fa fa-info-circle"></i> '.tr("La fattura è stata generata ed è pronta per l'invio").'.';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
// Lettura della ricevuta
|
// Lettura della ricevuta
|
||||||
if (!empty($ricevuta_principale)) {
|
if (!empty($ricevuta_principale)) {
|
||||||
$contenuto_ricevuta = XML::readFile($ricevuta_principale->filepath);
|
$contenuto_ricevuta = XML::readFile($ricevuta_principale->filepath);
|
||||||
$lista_errori = $contenuto_ricevuta['ListaErrori'];
|
$lista_errori = $contenuto_ricevuta['ListaErrori'];
|
||||||
|
|
||||||
if (!empty($lista_errori)) {
|
if (!empty($lista_errori)) {
|
||||||
echo '
|
echo '
|
||||||
<h4>'.tr('Elenco degli errori').'</h4>
|
<h4>'.tr('Elenco degli errori').'</h4>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
@ -176,20 +175,19 @@ if (!empty($record['codice_stato_fe'])) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>';
|
<tbody>';
|
||||||
|
|
||||||
$lista_errori = $lista_errori[0] ? $lista_errori : [$lista_errori];
|
$lista_errori = $lista_errori[0] ? $lista_errori : [$lista_errori];
|
||||||
foreach ($lista_errori as $errore) {
|
foreach ($lista_errori as $errore) {
|
||||||
$errore = $errore['Errore'];
|
$errore = $errore['Errore'];
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$errore['Codice'].'</td>
|
<td>'.$errore['Codice'].'</td>
|
||||||
<td>'.$errore['Descrizione'].'</td>
|
<td>'.$errore['Descrizione'].'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>';
|
</table>';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +210,7 @@ echo '
|
|||||||
buttonRestore(btn, restore);
|
buttonRestore(btn, restore);
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
if (data.code == "200") {
|
if (data.code === "200") {
|
||||||
swal("'.tr('Fattura inviata!').'", data.message, "success");
|
swal("'.tr('Fattura inviata!').'", data.message, "success");
|
||||||
|
|
||||||
$(btn).attr("disabled", true).addClass("disabled");
|
$(btn).attr("disabled", true).addClass("disabled");
|
||||||
@ -220,7 +218,7 @@ echo '
|
|||||||
swal("'.tr('Invio fallito').'", data.code + " - " + data.message, "error");
|
swal("'.tr('Invio fallito').'", data.code + " - " + data.message, "error");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function() {
|
||||||
swal("'.tr('Errore').'", "'.tr('Errore durante il salvataggio').'", "error");
|
swal("'.tr('Errore').'", "'.tr('Errore durante il salvataggio').'", "error");
|
||||||
|
|
||||||
buttonRestore(btn, restore);
|
buttonRestore(btn, restore);
|
||||||
@ -269,7 +267,7 @@ echo '
|
|||||||
salvaForm(this, "#edit-form").then(function(valid) {
|
salvaForm(this, "#edit-form").then(function(valid) {
|
||||||
if (valid) {';
|
if (valid) {';
|
||||||
|
|
||||||
if ($generated) {
|
if ($generata) {
|
||||||
echo '
|
echo '
|
||||||
swal({
|
swal({
|
||||||
title: "'.tr('Sei sicuro di rigenerare la fattura?').'",
|
title: "'.tr('Sei sicuro di rigenerare la fattura?').'",
|
||||||
|
@ -301,6 +301,7 @@ class FatturaElettronica
|
|||||||
database()->update('co_documenti', [
|
database()->update('co_documenti', [
|
||||||
'progressivo_invio' => $this->getDocumento()['progressivo_invio'],
|
'progressivo_invio' => $this->getDocumento()['progressivo_invio'],
|
||||||
'codice_stato_fe' => 'GEN',
|
'codice_stato_fe' => 'GEN',
|
||||||
|
'id_ricevuta_principale' => null,
|
||||||
'data_stato_fe' => date('Y-m-d H:i:s'),
|
'data_stato_fe' => date('Y-m-d H:i:s'),
|
||||||
], ['id' => $this->getDocumento()['id']]);
|
], ['id' => $this->getDocumento()['id']]);
|
||||||
|
|
||||||
|
@ -98,3 +98,18 @@ UPDATE `co_documenti` SET `co_documenti`.`id_ricevuta_principale` = (
|
|||||||
ORDER BY `zz_files`.`created_at`
|
ORDER BY `zz_files`.`created_at`
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `fe_stati_documento` ADD `is_generabile` BOOLEAN DEFAULT FALSE,
|
||||||
|
ADD `is_inviabile` BOOLEAN DEFAULT FALSE,
|
||||||
|
ADD `tipo` varchar(255) NOT NULL;
|
||||||
|
|
||||||
|
UPDATE `fe_stati_documento` SET `is_generabile` = '1', `is_inviabile` = '1' WHERE `codice` = 'ERVAL';
|
||||||
|
UPDATE `fe_stati_documento` SET `is_generabile` = '1', `is_inviabile` = '1' WHERE `codice` = 'ERR';
|
||||||
|
UPDATE `fe_stati_documento` SET `is_generabile` = '1', `is_inviabile` = '1' WHERE `codice` = 'GEN';
|
||||||
|
UPDATE `fe_stati_documento` SET `is_generabile` = '1' WHERE `codice` = 'NS';
|
||||||
|
UPDATE `fe_stati_documento` SET `is_generabile` = '1' WHERE `codice` = 'EC02';
|
||||||
|
|
||||||
|
UPDATE `fe_stati_documento` SET `tipo` = 'danger';
|
||||||
|
UPDATE `fe_stati_documento` SET `tipo` = 'warning' WHERE `codice` IN ('ERVAL', 'MC', 'WAIT', 'NE');
|
||||||
|
UPDATE `fe_stati_documento` SET `tipo` = 'success' WHERE `codice` IN ('EC01', 'RC');
|
||||||
|
UPDATE `fe_stati_documento` SET `tipo` = 'info' WHERE `codice` IN ('GEN');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user