mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-01 01:37:59 +01:00
Fix minori
This commit is contained in:
parent
6722e59de4
commit
66305b3657
@ -30,7 +30,7 @@ $microsoft = null;
|
|||||||
if ($dbo->isConnected()) {
|
if ($dbo->isConnected()) {
|
||||||
try {
|
try {
|
||||||
$microsoft = $dbo->selectOne('zz_oauth2', '*', ['nome' => 'Microsoft', 'enabled' => 1, 'is_login' => 1]);
|
$microsoft = $dbo->selectOne('zz_oauth2', '*', ['nome' => 'Microsoft', 'enabled' => 1, 'is_login' => 1]);
|
||||||
} catch ( QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,9 +193,8 @@ class Anagrafica extends Model
|
|||||||
public function isTipo($type)
|
public function isTipo($type)
|
||||||
{
|
{
|
||||||
return $this->tipi()->get()->search(function ($item, $key) use ($type) {
|
return $this->tipi()->get()->search(function ($item, $key) use ($type) {
|
||||||
return (TipoAnagrafica::find($item->id))->name == $type;
|
return TipoAnagrafica::find($item->id)->name == $type;
|
||||||
}) !== false;
|
}) !== false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
@ -21,8 +21,8 @@ namespace Modules\Anagrafiche\Import;
|
|||||||
|
|
||||||
use Importer\CSVImporter;
|
use Importer\CSVImporter;
|
||||||
use Modules\Anagrafiche\Anagrafica;
|
use Modules\Anagrafiche\Anagrafica;
|
||||||
use Modules\Anagrafiche\Tipo;
|
|
||||||
use Modules\Anagrafiche\Nazione;
|
use Modules\Anagrafiche\Nazione;
|
||||||
|
use Modules\Anagrafiche\Tipo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Struttura per la gestione delle operazioni di importazione (da CSV) delle Anagrafiche.
|
* Struttura per la gestione delle operazioni di importazione (da CSV) delle Anagrafiche.
|
||||||
@ -253,7 +253,7 @@ class CSV extends CSVImporter
|
|||||||
$tipi_selezionati = explode(',', $record['tipologia']);
|
$tipi_selezionati = explode(',', $record['tipologia']);
|
||||||
|
|
||||||
foreach ($tipi_selezionati as $tipo) {
|
foreach ($tipi_selezionati as $tipo) {
|
||||||
$id_tipo = (new Tipo)->getByName($tipo)->id_record;
|
$id_tipo = (new Tipo())->getByName($tipo)->id_record;
|
||||||
|
|
||||||
// Creo il tipo anagrafica se non esiste
|
// Creo il tipo anagrafica se non esiste
|
||||||
if (empty($id_tipo)) {
|
if (empty($id_tipo)) {
|
||||||
@ -264,7 +264,7 @@ class CSV extends CSVImporter
|
|||||||
'name' => $tipo,
|
'name' => $tipo,
|
||||||
])['id'];
|
])['id'];
|
||||||
|
|
||||||
$id_tipo = (new Tipo)->getByName($tipo)->id_record;
|
$id_tipo = (new Tipo())->getByName($tipo)->id_record;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tipologie[] = $id_tipo;
|
$tipologie[] = $id_tipo;
|
||||||
|
@ -465,7 +465,7 @@ class CSV extends CSVImporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($dettagli['dir']) {
|
if ($dettagli['dir']) {
|
||||||
$tipo = (new Tipo)->getByName($dettagli['dir'])->id_record;
|
$tipo = (new Tipo())->getByName($dettagli['dir'])->id_record;
|
||||||
$tipi = $anagrafica->tipi->pluck('id')->toArray();
|
$tipi = $anagrafica->tipi->pluck('id')->toArray();
|
||||||
$tipi[] = $tipo;
|
$tipi[] = $tipo;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class CSV extends CSVImporter
|
|||||||
|
|
||||||
if (empty($anagrafica)) {
|
if (empty($anagrafica)) {
|
||||||
$anagrafica = Anagrafica::build($record['ragione_sociale']);
|
$anagrafica = Anagrafica::build($record['ragione_sociale']);
|
||||||
$tipo_cliente = (new TipoAnagrafica)->getByName('Cliente')->id_record;
|
$tipo_cliente = (new TipoAnagrafica())->getByName('Cliente')->id_record;
|
||||||
$anagrafica->tipologie = [$tipo_cliente];
|
$anagrafica->tipologie = [$tipo_cliente];
|
||||||
$anagrafica->save();
|
$anagrafica->save();
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ class FatturaElettronica
|
|||||||
// Se non trovo l'anagrafica tra i fornitori, provo a ricercarla anche tra i clienti
|
// Se non trovo l'anagrafica tra i fornitori, provo a ricercarla anche tra i clienti
|
||||||
if (empty($anagrafica)) {
|
if (empty($anagrafica)) {
|
||||||
$type = 'Cliente';
|
$type = 'Cliente';
|
||||||
|
|
||||||
$anagrafica = Anagrafica::where('tipo', $type);
|
$anagrafica = Anagrafica::where('tipo', $type);
|
||||||
|
|
||||||
if (!empty($info['partita_iva']) && !empty($info['codice_fiscale'])) {
|
if (!empty($info['partita_iva']) && !empty($info['codice_fiscale'])) {
|
||||||
@ -261,7 +261,7 @@ class FatturaElettronica
|
|||||||
$info = $this->getAnagrafe();
|
$info = $this->getAnagrafe();
|
||||||
|
|
||||||
$anagrafica = Anagrafica::build($info['ragione_sociale'], $info['nome'], $info['cognome'], [
|
$anagrafica = Anagrafica::build($info['ragione_sociale'], $info['nome'], $info['cognome'], [
|
||||||
(new TipoAnagrafica)->getByName($type)->id_record
|
(new TipoAnagrafica())->getByName($type)->id_record,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($info['partita_iva'])) {
|
if (!empty($info['partita_iva'])) {
|
||||||
|
@ -293,7 +293,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||||||
$obj->ritenuta_contributi = $ritenuta_contributi;
|
$obj->ritenuta_contributi = $ritenuta_contributi;
|
||||||
|
|
||||||
// Inserisco la ritenuta se è specificata nella riga o se non è specificata nella riga ma è presente in Dati ritenuta (quindi comprende tutte le righe)
|
// Inserisco la ritenuta se è specificata nella riga o se non è specificata nella riga ma è presente in Dati ritenuta (quindi comprende tutte le righe)
|
||||||
if (!empty($riga['Ritenuta']) || $info['ritenuta_norighe'] == true || $info['rivalsa_norighe'] == true ) {
|
if (!empty($riga['Ritenuta']) || $info['ritenuta_norighe'] == true || $info['rivalsa_norighe'] == true) {
|
||||||
$obj->id_ritenuta_acconto = $id_ritenuta_acconto;
|
$obj->id_ritenuta_acconto = $id_ritenuta_acconto;
|
||||||
$obj->calcolo_ritenuta_acconto = $calcolo_ritenuta_acconto;
|
$obj->calcolo_ritenuta_acconto = $calcolo_ritenuta_acconto;
|
||||||
$obj->id_rivalsa_inps = $id_rivalsa;
|
$obj->id_rivalsa_inps = $id_rivalsa;
|
||||||
@ -453,7 +453,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||||||
$diff = round(abs($fattura->totale_imponibile) - abs($totale_righe + $tot_arr), 2);
|
$diff = round(abs($fattura->totale_imponibile) - abs($totale_righe + $tot_arr), 2);
|
||||||
$diff_tot = round($fattura->totale_imponibile + $fattura->rivalsa_inps - $totale_imp + $tot_arr, 2);
|
$diff_tot = round($fattura->totale_imponibile + $fattura->rivalsa_inps - $totale_imp + $tot_arr, 2);
|
||||||
|
|
||||||
$iva_arrotondamento = database()->fetchOne('SELECT * FROM co_iva WHERE percentuale=0 AND deleted_at IS NULL');
|
$iva_arrotondamento = database()->fetchOne('SELECT * FROM `co_iva` LEFT JOIN `co_iva_lang` ON (`co_iva`.`id` = `co_iva_lang`.`id_record` AND `co_iva_lang` = '.prepare(setting('Lingua')).') WHERE `percentuale`=0 AND `deleted_at` IS NULL');
|
||||||
|
|
||||||
if (($diff != 0 && $diff != $diff_tot) || (($diff_tot != $diff) && !$diff_iva) || $diff_iva) {
|
if (($diff != 0 && $diff != $diff_tot) || (($diff_tot != $diff) && !$diff_iva) || $diff_iva) {
|
||||||
if ($diff != 0 && $diff != $diff_tot) {
|
if ($diff != 0 && $diff != $diff_tot) {
|
||||||
|
@ -74,7 +74,7 @@ elseif ($anagrafica->isTipo('Tecnico')) {
|
|||||||
$interventi = Intervento::whereIn('id', array_column($interventi, 'id'))->get();
|
$interventi = Intervento::whereIn('id', array_column($interventi, 'id'))->get();
|
||||||
$totale_interventi = $interventi->sum('totale_imponibile');
|
$totale_interventi = $interventi->sum('totale_imponibile');
|
||||||
|
|
||||||
if ($sessioni){
|
if ($sessioni) {
|
||||||
$sessioni = Sessione::whereIn('id', array_column($sessioni, 'id'))->get();
|
$sessioni = Sessione::whereIn('id', array_column($sessioni, 'id'))->get();
|
||||||
$totale_ore_lavorate = $sessioni->sum('ore');
|
$totale_ore_lavorate = $sessioni->sum('ore');
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class ControlloClienti extends Resource implements RetrieveInterface
|
|||||||
|
|
||||||
// Aggiunta tipologia Cliente se non presente nell'anagrafica trovata
|
// Aggiunta tipologia Cliente se non presente nell'anagrafica trovata
|
||||||
if (!empty($cliente) && !$cliente->isTipo('Cliente')) {
|
if (!empty($cliente) && !$cliente->isTipo('Cliente')) {
|
||||||
$tipo_cliente = (new Tipo)->getByName('Cliente')->id_record;
|
$tipo_cliente = (new Tipo())->getByName('Cliente')->id_record;
|
||||||
$tipi = $cliente->tipi->pluck('id')->toArray();
|
$tipi = $cliente->tipi->pluck('id')->toArray();
|
||||||
|
|
||||||
$tipi[] = $tipo_cliente;
|
$tipi[] = $tipo_cliente;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user