mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 04:20:50 +01:00
Miglioramenti importazione FE
This commit is contained in:
parent
c9213f71d9
commit
066c4ae714
@ -117,9 +117,22 @@ if (empty($record['is_fiscale'])) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
{[ "type": "date", "label": "<?php echo tr('Data competenza'); ?>", "name": "data_competenza", "required": 0, "value": "$data_competenza$" ]}
|
{[ "type": "date", "label": "<?php echo tr('Data competenza'); ?>", "name": "data_competenza", "required": 0, "value": "$data_competenza$", "min-date": "$data_registrazione$" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#data_registrazione").on("dp.change", function (e) {
|
||||||
|
var data = $("#data_competenza");
|
||||||
|
data.data("DateTimePicker").minDate(e.date);
|
||||||
|
|
||||||
|
if(data.data("DateTimePicker").date() < e.date){
|
||||||
|
data.data("DateTimePicker").date(e.date);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ include_once __DIR__.'/../../core.php';
|
|||||||
use Plugins\ImportFE\FatturaElettronica;
|
use Plugins\ImportFE\FatturaElettronica;
|
||||||
use Plugins\ImportFE\Interaction;
|
use Plugins\ImportFE\Interaction;
|
||||||
|
|
||||||
|
$file = null;
|
||||||
switch (filter('op')) {
|
switch (filter('op')) {
|
||||||
case 'save':
|
case 'save':
|
||||||
$content = file_get_contents($_FILES['blob']['tmp_name']);
|
$content = file_get_contents($_FILES['blob']['tmp_name']);
|
||||||
@ -13,7 +14,7 @@ switch (filter('op')) {
|
|||||||
// no break
|
// no break
|
||||||
case 'prepare':
|
case 'prepare':
|
||||||
if (!isset($file)) {
|
if (!isset($file)) {
|
||||||
$name = get('name');
|
$name = filter('name');
|
||||||
$file = Interaction::getImportXML($name);
|
$file = Interaction::getImportXML($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ if (!empty($list)) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Descrizione').'</th>
|
<th>'.tr('Descrizione').'</th>
|
||||||
<th class="text-center">'.tr('Fornitore').'</th>
|
<th class="text-center">'.tr('Fornitore').'</th>
|
||||||
|
<th class="text-center">'.tr('Data di registrazione').'</th>
|
||||||
<th class="text-center">'.tr('Totale imponibile').'</th>
|
<th class="text-center">'.tr('Totale imponibile').'</th>
|
||||||
<th width="20%" class="text-center">#</th>
|
<th width="20%" class="text-center">#</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -27,15 +28,18 @@ if (!empty($list)) {
|
|||||||
|
|
||||||
foreach ($list as $element) {
|
foreach ($list as $element) {
|
||||||
$name = $element['name'];
|
$name = $element['name'];
|
||||||
|
$data = $element['date_sent'] ?: '';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>';
|
<tr>';
|
||||||
|
|
||||||
if (file_exists($directory.'/'.$name)) {
|
if (file_exists($directory.'/'.$name)) {
|
||||||
echo '
|
echo '
|
||||||
<td>
|
<td>
|
||||||
<p>'.$name.'</p>
|
<p>'.$name.'</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td class="text-center">-</td>
|
||||||
<td class="text-center">-</td>
|
<td class="text-center">-</td>
|
||||||
<td class="text-center">-</td>
|
<td class="text-center">-</td>
|
||||||
|
|
||||||
@ -76,6 +80,7 @@ if (!empty($list)) {
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>'.$element['sender'].'</td>
|
<td>'.$element['sender'].'</td>
|
||||||
|
<td>'.dateFormat($element['date_sent']).'</td>
|
||||||
<td class="text-right">'.moneyFormat($element['amount']).'</td>
|
<td class="text-right">'.moneyFormat($element['amount']).'</td>
|
||||||
|
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@ -86,7 +91,7 @@ if (!empty($list)) {
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
<button type="button" class="btn btn-warning" '.((!extension_loaded('openssl') && substr(strtolower($name), -4) == '.p7m') ? 'disabled' : '').' onclick="download(this, \''.$name.'\')">
|
<button type="button" class="btn btn-warning" '.((!extension_loaded('openssl') && substr(strtolower($name), -4) == '.p7m') ? 'disabled' : '').' onclick="download(this, \''.$name.'\', \''.$data.'\')">
|
||||||
<i class="fa fa-download"></i> '.tr('Importa').'
|
<i class="fa fa-download"></i> '.tr('Importa').'
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@ -103,7 +108,7 @@ if (!empty($list)) {
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
function download(button, file) {
|
function download(button, file, data_registrazione) {
|
||||||
var restore = buttonLoading(button);
|
var restore = buttonLoading(button);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -119,7 +124,7 @@ function download(button, file) {
|
|||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
if (!data.already) {
|
if (!data.already) {
|
||||||
launch_modal("'.tr('Righe fattura').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_plugin=" + '.$id_plugin.' + "&op=list&filename=" + data.filename);
|
launch_modal("'.tr('Righe fattura').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_plugin=" + '.$id_plugin.' + "&op=list&filename=" + data.filename +"&data_registrazione=" + data_registrazione);
|
||||||
buttonRestore(button, restore);
|
buttonRestore(button, restore);
|
||||||
} else {
|
} else {
|
||||||
swal({
|
swal({
|
||||||
|
@ -86,7 +86,7 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<div class="row" >
|
<div class="row" >
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{[ "type": "date", "label": "'.tr('Data ricezione').'", "name": "data_registrazione", "required": 0, "value": "" ]}
|
{[ "type": "date", "label": "'.tr('Data di registrazione').'", "name": "data_registrazione", "required": 1, "value": "'.get('data_registrazione').'", "max-date": "-now-", "min-date": "'.$dati_generali['Data'].'", "readonly": "'.(intval(get('data_registrazione') != null)).'" ]}
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
// Riferimenti ad altre fatture
|
// Riferimenti ad altre fatture
|
||||||
@ -100,7 +100,7 @@ if (in_array($dati_generali['TipoDocumento'], ['TD04', 'TD05'])) {
|
|||||||
WHERE
|
WHERE
|
||||||
co_tipidocumento.dir = 'uscita' AND
|
co_tipidocumento.dir = 'uscita' AND
|
||||||
(co_documenti.data BETWEEN NOW() - INTERVAL 1 YEAR AND NOW()) AND
|
(co_documenti.data BETWEEN NOW() - INTERVAL 1 YEAR AND NOW()) AND
|
||||||
co_documenti.idstatodocumento IN (SELECT id FROM co_statidocumento WHERE co_tipidocumento.descrizione != 'Bozza') AND
|
co_documenti.idstatodocumento IN (SELECT id FROM co_statidocumento WHERE descrizione != 'Bozza') AND
|
||||||
co_documenti.idanagrafica = ".prepare($anagrafica->id);
|
co_documenti.idanagrafica = ".prepare($anagrafica->id);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
@ -117,7 +117,7 @@ if (in_array($dati_generali['TipoDocumento'], ['TD04', 'TD05'])) {
|
|||||||
WHERE
|
WHERE
|
||||||
co_tipidocumento.dir = 'uscita' AND
|
co_tipidocumento.dir = 'uscita' AND
|
||||||
(co_documenti.data BETWEEN NOW() - INTERVAL 1 YEAR AND NOW()) AND
|
(co_documenti.data BETWEEN NOW() - INTERVAL 1 YEAR AND NOW()) AND
|
||||||
co_documenti.idstatodocumento IN (SELECT id FROM co_statidocumento WHERE co_tipidocumento.descrizione != 'Bozza') AND
|
co_documenti.idstatodocumento IN (SELECT id FROM co_statidocumento WHERE descrizione != 'Bozza') AND
|
||||||
co_documenti.id_segment = (SELECT id FROM zz_segments WHERE name = 'Fatture pro-forma' AND id_module = ".prepare($id_module).') AND
|
co_documenti.id_segment = (SELECT id FROM zz_segments WHERE name = 'Fatture pro-forma' AND id_module = ".prepare($id_module).') AND
|
||||||
co_documenti.idanagrafica = '.prepare($anagrafica->id);
|
co_documenti.idanagrafica = '.prepare($anagrafica->id);
|
||||||
|
|
||||||
|
@ -303,13 +303,9 @@ class FatturaElettronica
|
|||||||
// Riferimento per nota di credito e debito
|
// Riferimento per nota di credito e debito
|
||||||
$fattura->ref_documento = $ref_fattura ?: null;
|
$fattura->ref_documento = $ref_fattura ?: null;
|
||||||
|
|
||||||
// Per il destinatario, la data di ricezione della fattura assume grande rilievo ai fini IVA, poiché determina la decorrenza dei termini per poter esercitare il diritto alla detrazione.
|
// Per il destinatario, la data di registrazione della fattura assume grande rilievo ai fini IVA, poiché determina la decorrenza dei termini per poter esercitare il diritto alla detrazione.
|
||||||
// La data di ricezione della fattura è contenuta all’interno della “ricevuta di consegna” visibile al trasmittente della stessa.
|
// La data di ricezione della fattura è contenuta all’interno della “ricevuta di consegna” visibile al trasmittente della stessa.
|
||||||
if (empty($data_registrazione)) {
|
|
||||||
$fattura->data_registrazione = $dati_generali['Data'];
|
|
||||||
} else {
|
|
||||||
$fattura->data_registrazione = $data_registrazione;
|
$fattura->data_registrazione = $data_registrazione;
|
||||||
}
|
|
||||||
$fattura->data_competenza = $fattura->data_registrazione;
|
$fattura->data_competenza = $fattura->data_registrazione;
|
||||||
|
|
||||||
$stato_documento = StatoFattura::where('descrizione', 'Emessa')->first();
|
$stato_documento = StatoFattura::where('descrizione', 'Emessa')->first();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user