mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Miglioramento informativa numerazioni
Aggiunto controllo su numerazioni di Fatture di acquisto e DDT in entrata, miglioramento delle informazioni sulla numerazione delle Fatture di vendita.
This commit is contained in:
parent
a78b0f81dc
commit
5be7d7566e
@ -38,7 +38,7 @@ switch (post('op')) {
|
||||
$anagrafica = $documento_import->anagrafica;
|
||||
$id_anagrafica = $anagrafica->id;
|
||||
|
||||
if(!$documento_import->stato->is_pianificabile){
|
||||
if (!$documento_import->stato->is_pianificabile) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,17 @@ switch (post('op')) {
|
||||
aggiorna_sedi_movimenti('ddt', $id_record);
|
||||
|
||||
// Controllo sulla presenza di DDT con lo stesso numero secondario
|
||||
$count = DDT::where('numero_esterno', $numero_esterno)
|
||||
->where('id', '!=', $id_record)
|
||||
->where('idanagrafica', '=', $id_anagrafica)
|
||||
->whereHas('tipo', function ($query) use ($dir) {
|
||||
$query->where('dt_tipiddt.dir', '=', $dir);
|
||||
})->count();
|
||||
if (!empty($count)) {
|
||||
flash()->warning(tr('Esiste già un DDT con lo stesso numero secondario e la stessa anagrafica collegata!'));
|
||||
$direzione = $ddt->direzione;
|
||||
if ($direzione == 'uscita') {
|
||||
$count = DDT::where('numero_esterno', $numero_esterno)
|
||||
->where('id', '!=', $id_record)
|
||||
->where('idanagrafica', '=', $id_anagrafica)
|
||||
->whereHas('tipo', function ($query) use ($direzione) {
|
||||
$query->where('dir', '=', $direzione);
|
||||
})->count();
|
||||
if (!empty($count)) {
|
||||
flash()->warning(tr('Esiste già un DDT con lo stesso numero secondario e la stessa anagrafica collegata!'));
|
||||
}
|
||||
}
|
||||
|
||||
flash()->info(tr('Ddt modificato correttamente!'));
|
||||
|
@ -41,124 +41,138 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
if (post('id_record') !== null) {
|
||||
$stato_precedente = $fattura->stato;
|
||||
$stato_precedente = $fattura->stato;
|
||||
|
||||
$stato = Stato::find(post('idstatodocumento'));
|
||||
$fattura->stato()->associate($stato);
|
||||
$stato = Stato::find(post('idstatodocumento'));
|
||||
$fattura->stato()->associate($stato);
|
||||
|
||||
$tipo = Tipo::find(post('idtipodocumento'));
|
||||
$fattura->tipo()->associate($tipo);
|
||||
$tipo = Tipo::find(post('idtipodocumento'));
|
||||
$fattura->tipo()->associate($tipo);
|
||||
|
||||
$fattura->data = post('data');
|
||||
$fattura->data = post('data');
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
$fattura->data_registrazione = post('data');
|
||||
} else {
|
||||
$fattura->data_registrazione = post('data_registrazione');
|
||||
}
|
||||
if ($dir == 'entrata') {
|
||||
$fattura->data_registrazione = post('data');
|
||||
} else {
|
||||
$fattura->data_registrazione = post('data_registrazione');
|
||||
}
|
||||
|
||||
$fattura->data_competenza = post('data_competenza');
|
||||
$fattura->data_competenza = post('data_competenza');
|
||||
|
||||
$fattura->numero_esterno = post('numero_esterno');
|
||||
$fattura->note = post('note');
|
||||
$fattura->note_aggiuntive = post('note_aggiuntive');
|
||||
|
||||
$fattura->idanagrafica = post('idanagrafica');
|
||||
$fattura->idagente = post('idagente');
|
||||
$fattura->idpagamento = post('idpagamento');
|
||||
$fattura->idbanca = post('idbanca');
|
||||
$fattura->idcausalet = post('idcausalet');
|
||||
$fattura->idspedizione = post('idspedizione');
|
||||
$fattura->idporto = post('idporto');
|
||||
$fattura->idaspettobeni = post('idaspettobeni');
|
||||
$fattura->idvettore = post('idvettore');
|
||||
$fattura->idsede_partenza = post('idsede_partenza');
|
||||
$fattura->idsede_destinazione = post('idsede_destinazione');
|
||||
$fattura->idconto = post('idconto');
|
||||
$fattura->split_payment = post('split_payment') ?: 0;
|
||||
$fattura->is_fattura_conto_terzi = post('is_fattura_conto_terzi') ?: 0;
|
||||
$fattura->n_colli = post('n_colli');
|
||||
$fattura->tipo_resa = post('tipo_resa');
|
||||
|
||||
$fattura->rivalsainps = 0;
|
||||
$fattura->ritenutaacconto = 0;
|
||||
$fattura->iva_rivalsainps = 0;
|
||||
$fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null;
|
||||
|
||||
$fattura->codice_stato_fe = post('codice_stato_fe') ?: null;
|
||||
|
||||
// Informazioni per le fatture di acquisto
|
||||
if ($dir == 'uscita') {
|
||||
$fattura->numero = post('numero');
|
||||
$fattura->numero_esterno = post('numero_esterno');
|
||||
$fattura->note = post('note');
|
||||
$fattura->note_aggiuntive = post('note_aggiuntive');
|
||||
$fattura->idrivalsainps = post('id_rivalsa_inps');
|
||||
$fattura->idritenutaacconto = post('id_ritenuta_acconto');
|
||||
}
|
||||
|
||||
$fattura->idanagrafica = post('idanagrafica');
|
||||
$fattura->idagente = post('idagente');
|
||||
$fattura->idpagamento = post('idpagamento');
|
||||
$fattura->idbanca = post('idbanca');
|
||||
$fattura->idcausalet = post('idcausalet');
|
||||
$fattura->idspedizione = post('idspedizione');
|
||||
$fattura->idporto = post('idporto');
|
||||
$fattura->idaspettobeni = post('idaspettobeni');
|
||||
$fattura->idvettore = post('idvettore');
|
||||
$fattura->idsede_partenza = post('idsede_partenza');
|
||||
$fattura->idsede_destinazione = post('idsede_destinazione');
|
||||
$fattura->idconto = post('idconto');
|
||||
$fattura->split_payment = post('split_payment') ?: 0;
|
||||
$fattura->is_fattura_conto_terzi = post('is_fattura_conto_terzi') ?: 0;
|
||||
$fattura->n_colli = post('n_colli');
|
||||
$fattura->tipo_resa = post('tipo_resa');
|
||||
// Operazioni sul bollo
|
||||
$fattura->addebita_bollo = post('addebita_bollo');
|
||||
$bollo_automatico = post('bollo_automatico');
|
||||
if (empty($bollo_automatico)) {
|
||||
$fattura->bollo = post('bollo');
|
||||
} else {
|
||||
$fattura->bollo = null;
|
||||
}
|
||||
|
||||
$fattura->rivalsainps = 0;
|
||||
$fattura->ritenutaacconto = 0;
|
||||
$fattura->iva_rivalsainps = 0;
|
||||
$fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null;
|
||||
// Operazioni sulla dichiarazione d'intento
|
||||
$dichiarazione_precedente = $fattura->dichiarazione;
|
||||
$fattura->id_dichiarazione_intento = post('id_dichiarazione_intento') ?: null;
|
||||
|
||||
$fattura->codice_stato_fe = post('codice_stato_fe') ?: null;
|
||||
$fattura->save();
|
||||
|
||||
// Informazioni per le fatture di acquisto
|
||||
if ($dir == 'uscita') {
|
||||
$fattura->numero = post('numero');
|
||||
$fattura->numero_esterno = post('numero_esterno');
|
||||
$fattura->idrivalsainps = post('id_rivalsa_inps');
|
||||
$fattura->idritenutaacconto = post('id_ritenuta_acconto');
|
||||
}
|
||||
if ($fattura->direzione == 'entrata' && $stato_precedente->descrizione == 'Bozza' && $stato['descrizione'] == 'Emessa') {
|
||||
// Generazione automatica della Fattura Elettronica
|
||||
$stato_fe = empty($fattura->codice_stato_fe) || in_array($fattura->codice_stato_fe, ['GEN', 'NS', 'EC02']);
|
||||
$checks = FatturaElettronica::controllaFattura($fattura);
|
||||
if ($stato_fe && empty($checks)) {
|
||||
try {
|
||||
$fattura_pa = new FatturaElettronica($id_record);
|
||||
$file = $fattura_pa->save(DOCROOT.'/'.FatturaElettronica::getDirectory());
|
||||
|
||||
// Operazioni sul bollo
|
||||
$fattura->addebita_bollo = post('addebita_bollo');
|
||||
$bollo_automatico = post('bollo_automatico');
|
||||
if (empty($bollo_automatico)) {
|
||||
$fattura->bollo = post('bollo');
|
||||
} else {
|
||||
$fattura->bollo = null;
|
||||
}
|
||||
flash()->info(tr('Fattura elettronica generata correttamente!'));
|
||||
|
||||
// Operazioni sulla dichiarazione d'intento
|
||||
$dichiarazione_precedente = $fattura->dichiarazione;
|
||||
$fattura->id_dichiarazione_intento = post('id_dichiarazione_intento') ?: null;
|
||||
if (!$fattura_pa->isValid()) {
|
||||
$errors = $fattura_pa->getErrors();
|
||||
|
||||
$fattura->save();
|
||||
|
||||
if ($fattura->direzione == 'entrata' && $stato_precedente->descrizione == 'Bozza' && $stato['descrizione'] == 'Emessa') {
|
||||
// Generazione automatica della Fattura Elettronica
|
||||
$stato_fe = empty($fattura->codice_stato_fe) || in_array($fattura->codice_stato_fe, ['GEN', 'NS', 'EC02']);
|
||||
$checks = FatturaElettronica::controllaFattura($fattura);
|
||||
if ($stato_fe && empty($checks)) {
|
||||
try {
|
||||
$fattura_pa = new FatturaElettronica($id_record);
|
||||
$file = $fattura_pa->save(DOCROOT.'/'.FatturaElettronica::getDirectory());
|
||||
|
||||
flash()->info(tr('Fattura elettronica generata correttamente!'));
|
||||
|
||||
if (!$fattura_pa->isValid()) {
|
||||
$errors = $fattura_pa->getErrors();
|
||||
|
||||
flash()->warning(tr('La fattura elettronica potrebbe avere delle irregolarità!').' '.tr('Controllare i seguenti campi: _LIST_', [
|
||||
'_LIST_' => implode(', ', $errors),
|
||||
]).'.');
|
||||
}
|
||||
} catch (UnexpectedValueException $e) {
|
||||
flash()->warning(tr('La fattura elettronica potrebbe avere delle irregolarità!').' '.tr('Controllare i seguenti campi: _LIST_', [
|
||||
'_LIST_' => implode(', ', $errors),
|
||||
]).'.');
|
||||
}
|
||||
} elseif (!empty($checks)) {
|
||||
$message = tr('La fattura elettronica non è stata generata a causa di alcune informazioni mancanti').':';
|
||||
} catch (UnexpectedValueException $e) {
|
||||
}
|
||||
} elseif (!empty($checks)) {
|
||||
$message = tr('La fattura elettronica non è stata generata a causa di alcune informazioni mancanti').':';
|
||||
|
||||
foreach ($checks as $check) {
|
||||
$message .= '
|
||||
foreach ($checks as $check) {
|
||||
$message .= '
|
||||
<p><b>'.$check['name'].' '.$check['link'].'</b></p>
|
||||
<ul>';
|
||||
|
||||
foreach ($check['errors'] as $error) {
|
||||
if (!empty($error)) {
|
||||
$message .= '
|
||||
<li>'.$error.'</li>';
|
||||
}
|
||||
foreach ($check['errors'] as $error) {
|
||||
if (!empty($error)) {
|
||||
$message .= '
|
||||
<li>'.$error.'</li>';
|
||||
}
|
||||
|
||||
$message .= '
|
||||
</ul>';
|
||||
}
|
||||
|
||||
flash()->warning($message);
|
||||
$message .= '
|
||||
</ul>';
|
||||
}
|
||||
|
||||
flash()->warning($message);
|
||||
}
|
||||
|
||||
aggiorna_sedi_movimenti('documenti', $id_record);
|
||||
|
||||
flash()->info(tr('Fattura modificata correttamente!'));
|
||||
}
|
||||
|
||||
aggiorna_sedi_movimenti('documenti', $id_record);
|
||||
|
||||
// Controllo sulla presenza di fattura di acquisto con lo stesso numero secondario nello stesso periodo
|
||||
$direzione = $fattura->direzione;
|
||||
if ($direzione == 'uscita') {
|
||||
$count = Fattura::where('numero_esterno', $fattura->numero_esterno)
|
||||
->where('id', '!=', $id_record)
|
||||
->where('idanagrafica', '=', $fattura->anagrafica->id)
|
||||
->where('data', '>=', $_SESSION['period_start'])
|
||||
->where('data', '<=', $_SESSION['period_end'])
|
||||
->whereHas('tipo', function ($query) use ($direzione) {
|
||||
$query->where('dir', '=', $direzione);
|
||||
})->count();
|
||||
if (!empty($count)) {
|
||||
flash()->warning(tr('Esiste già una fattura con lo stesso numero secondario e la stessa anagrafica collegata!'));
|
||||
}
|
||||
}
|
||||
|
||||
flash()->info(tr('Fattura modificata correttamente!'));
|
||||
|
||||
break;
|
||||
|
||||
// Ricalcolo scadenze
|
||||
|
@ -35,31 +35,43 @@ if ($dir == 'entrata' && !empty($fattura->dichiarazione) && $fattura->stato->des
|
||||
|
||||
if ($diff > 0) {
|
||||
echo '
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-warning"></i> '.tr("La fattura è collegata a una dichiarazione d'intento con diponibilità di _MONEY_: per collegare una riga alla dichiarazione è sufficiente inserire come IVA _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($diff)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'</b>
|
||||
</div>';
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-warning"></i> '.tr("La fattura è collegata a una dichiarazione d'intento con diponibilità di _MONEY_: per collegare una riga alla dichiarazione è sufficiente inserire come IVA _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($diff)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'.</b>
|
||||
</div>';
|
||||
} elseif ($diff == 0) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<i class="fa fa-warning"></i> '.tr("La dichiarazione d'intento ha raggiunto il massimale previsto di _MONEY_: le nuove righe della fattura devono presentare IVA diversa da _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($fattura->dichiarazione->massimale)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'</b>
|
||||
</div>';
|
||||
<div class="alert alert-warning">
|
||||
<i class="fa fa-warning"></i> '.tr("La dichiarazione d'intento ha raggiunto il massimale previsto di _MONEY_: le nuove righe della fattura devono presentare IVA diversa da _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($fattura->dichiarazione->massimale)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'.</b>
|
||||
</div>';
|
||||
} else {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
<i class="fa fa-warning"></i> '.tr("La dichiarazione d'intento ha superato il massimale previsto di _MONEY_: per rimuovere righe della fattura dalla dichiarazione è sufficiente modificare l'IVA in qualcosa di diverso da _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($diff)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'</b>
|
||||
</div>';
|
||||
<div class="alert alert-danger">
|
||||
<i class="fa fa-warning"></i> '.tr("La dichiarazione d'intento ha superato il massimale previsto di _MONEY_: per rimuovere righe della fattura dalla dichiarazione è sufficiente modificare l'IVA in qualcosa di diverso da _IVA_", [
|
||||
'_MONEY_' => moneyFormat(abs($diff)),
|
||||
'_IVA_' => '"'.$iva->descrizione.'"',
|
||||
]).'.</b>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
$numero_previsto = verifica_numero($fattura);
|
||||
if (!empty($numero_previsto)) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<i class="fa fa-warning"></i> '.tr("E' assente una fattura di vendita di numero _NUM_ in data precedente o corrispondente a _DATE_: si potrebbero verificare dei problemi con la numerazione corrente delle fatture", [
|
||||
'_DATE_' => dateFormat($fattura->data),
|
||||
'_NUM_' => '"'.$numero_previsto.'"',
|
||||
]).'.</b>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form action="" method="post" id="edit-form">
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
@ -196,14 +208,14 @@ if (empty($record['is_fiscale'])) {
|
||||
<?php
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if ($dir == 'entrata') { ?>
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "<?php echo tr('Agente di riferimento'); ?>", "name": "idagente", "ajax-source": "agenti", "value": "$idagente_fattura$" ]}
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
// Conteggio numero articoli fatture
|
||||
@ -211,7 +223,7 @@ if (empty($record['is_fiscale'])) {
|
||||
if ($dir == 'uscita') {
|
||||
?>
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<?php
|
||||
echo Plugins::link('Sedi', $record['idsede_partenza'], null, null, 'class="pull-right"'); ?>
|
||||
|
||||
@ -229,7 +241,7 @@ if (empty($record['is_fiscale'])) {
|
||||
} else {
|
||||
?>
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<?php
|
||||
echo Plugins::link('Sedi', $record['idsede_partenza'], null, null, 'class="pull-right"'); ?>
|
||||
|
||||
@ -237,7 +249,7 @@ if (empty($record['is_fiscale'])) {
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
|
||||
<?php
|
||||
echo Plugins::link('Sedi', $record['idsede_destinazione'], null, null, 'class="pull-right"'); ?>
|
||||
|
||||
@ -384,11 +396,11 @@ echo '
|
||||
'_MONEY_' => moneyFormat(setting("Soglia minima per l'applicazione della marca da bollo")),
|
||||
]).'.", "placeholder": "'.tr('Bollo automatico').'" ]}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "number", "label": "'.tr('Importo marca da bollo').'", "name": "bollo", "value": "$bollo$", "disabled": '.intval(!isset($record['bollo'])).' ]}
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#bollo_automatico").click(function(){
|
||||
@ -665,7 +677,7 @@ if ($dir == 'uscita' && $fattura->isFE()) {
|
||||
<div class="alert alert-info text-center" id="controlla_totali"><i class="fa fa-spinner fa-spin"></i> '.tr('Controllo sui totali del documento e della fattura elettronica in corso').'...</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
type: "post",
|
||||
@ -676,7 +688,7 @@ if ($dir == 'uscita' && $fattura->isFE()) {
|
||||
},
|
||||
success: function(data){
|
||||
data = JSON.parse(data);
|
||||
|
||||
|
||||
var div = $("#controlla_totali");
|
||||
div.removeClass("alert-info");
|
||||
|
||||
@ -690,7 +702,7 @@ if ($dir == 'uscita' && $fattura->isFE()) {
|
||||
'_CALC_' => '" + data.calculated + " " + globals.currency + "',
|
||||
]).'.")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
@ -710,7 +722,7 @@ echo '
|
||||
<script type="text/javascript">
|
||||
$("#idanagrafica").change(function(){
|
||||
session_set("superselect,idanagrafica", $(this).val(), 0);
|
||||
|
||||
|
||||
$("#id_dichiarazione_intento").selectReset();';
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
@ -785,7 +797,7 @@ $(".btn-sm[data-toggle=\"tooltip\"]").each(function() {
|
||||
}, function() {
|
||||
buttonRestore(btn, restore);
|
||||
});
|
||||
|
||||
|
||||
// Procedo al salvataggio solo se tutti i campi obbligatori sono compilati, altrimenti mostro avviso
|
||||
//form.find("input:disabled, select:disabled").removeAttr("disabled");
|
||||
|
||||
@ -795,14 +807,14 @@ $(".btn-sm[data-toggle=\"tooltip\"]").each(function() {
|
||||
title: "'.tr('Errore').'",
|
||||
text: "'.tr('Alcuni campi obbligatori non sono stati compilati correttamente').'.",
|
||||
});
|
||||
|
||||
$(document).one("show.bs.modal","#modals > div", function (e) {
|
||||
|
||||
$(document).one("show.bs.modal","#modals > div", function (e) {
|
||||
return e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).one("show.bs.modal","#modals > div", function () {
|
||||
buttonRestore(btn, restore);
|
||||
buttonRestore(btn, restore);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Modules\Fatture\Fattura;
|
||||
use Util\Generator;
|
||||
|
||||
/**
|
||||
* Funzione per generare un nuovo numero per la fattura.
|
||||
@ -461,3 +462,49 @@ function add_articolo_infattura($iddocumento, $idarticolo, $descrizione, $idiva,
|
||||
|
||||
return $idriga;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica che il numero_esterno della fattura indicata sia correttamente impostato, a partire dai valori delle fatture ai giorni precedenti.
|
||||
* Restituisce il numero_esterno mancante in caso di numero errato.
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function verifica_numero(Fattura $fattura)
|
||||
{
|
||||
if (empty($fattura->numero_esterno)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$id_segment = $fattura->id_segment;
|
||||
$data = $fattura->data;
|
||||
|
||||
$documenti = Fattura::where('id_segment', $id_segment)
|
||||
->where('data', $data)
|
||||
->get();
|
||||
|
||||
// Recupero maschera per questo segmento
|
||||
$maschera = Generator::getMaschera($id_segment);
|
||||
|
||||
$ultimo = Generator::getPreviousFrom($maschera, 'co_documenti', 'numero_esterno', [
|
||||
'data < '.prepare(date('Y-m-d', strtotime($data))),
|
||||
'YEAR(data) = '.prepare(date('Y', strtotime($data))),
|
||||
'id_segment = '.prepare($id_segment),
|
||||
]);
|
||||
|
||||
do {
|
||||
$numero = Generator::generate($maschera, $ultimo, 1, Generator::dateToPattern($data));
|
||||
|
||||
$filtered = $documenti->reject(function ($item, $key) use ($numero) {
|
||||
return $item->numero_esterno == $numero;
|
||||
});
|
||||
|
||||
if ($documenti->count() == $filtered->count()) {
|
||||
return $numero;
|
||||
}
|
||||
|
||||
$documenti = $filtered;
|
||||
$ultimo = $numero;
|
||||
} while ($numero != $fattura->numero_esterno);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ switch (post('op')) {
|
||||
$anagrafica = $documento_import->anagrafica;
|
||||
$id_anagrafica = $anagrafica->id;
|
||||
|
||||
if(!$documento_import->stato->is_pianificabile){
|
||||
if (!$documento_import->stato->is_pianificabile) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user