1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Aggiunto modal per la gestione delle ricevute

This commit is contained in:
Dasc3er
2020-09-08 10:38:27 +02:00
parent d4c8f11d79
commit 954930d7dc
9 changed files with 298 additions and 84 deletions

View File

@@ -20,7 +20,6 @@
include_once __DIR__.'/init.php';
use Plugins\ExportFE\Interaction;
use Plugins\ReceiptFE\Interaction as RecepitInteraction;
use Plugins\ReceiptFE\Ricevuta;
switch (filter('op')) {
@@ -62,23 +61,27 @@ switch (filter('op')) {
}
// Importazione ultima ricevuta individuata
RecepitInteraction::getReceipt($last_recepit);
$fattura = null;
try {
$receipt = new Ricevuta($last_recepit);
$receipt->save();
$fattura = $receipt->getFattura()->numero_esterno;
$receipt->delete();
RecepitInteraction::processReceipt($name);
} catch (UnexpectedValueException $e) {
}
$fattura = Ricevuta::process($last_recepit);
$numero_esterno = $fattura ? $fattura->numero_esterno : null;
echo json_encode([
'file' => $last_recepit,
'fattura' => $numero_esterno,
]);
break;
case 'gestione_ricevuta':
$name = filter('name');
$type = filter('type');
$cambia_stato = $type != 'download';
$fattura = Ricevuta::process($name, false);
$numero_esterno = $fattura ? $fattura->numero_esterno : null;
echo json_encode([
'file' => $name,
'fattura' => $fattura,
]);