mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Bugfix
This commit is contained in:
@@ -5,6 +5,6 @@ return [
|
|||||||
'modules/articoli' => 'Modules\\Articoli\\',
|
'modules/articoli' => 'Modules\\Articoli\\',
|
||||||
'modules/fatture' => 'Modules\\Fatture\\',
|
'modules/fatture' => 'Modules\\Fatture\\',
|
||||||
'modules/interventi' => 'Modules\\Interventi\\',
|
'modules/interventi' => 'Modules\\Interventi\\',
|
||||||
'plugins/exportPA' => 'Modules\\ExportPA\\',
|
'plugins/exportPA' => 'Plugins\\ExportPA\\',
|
||||||
'plugins/importPA' => 'Modules\\ImportPA\\',
|
'plugins/importPA' => 'Plugins\\ImportPA\\',
|
||||||
];
|
];
|
||||||
|
2
core.php
2
core.php
@@ -26,8 +26,8 @@ $loader = require_once __DIR__.'/vendor/autoload.php';
|
|||||||
|
|
||||||
$namespaces = require_once __DIR__.'/config/namespaces.php';
|
$namespaces = require_once __DIR__.'/config/namespaces.php';
|
||||||
foreach ($namespaces as $path => $namespace) {
|
foreach ($namespaces as $path => $namespace) {
|
||||||
$loader->addPsr4($namespace, $path.'/src');
|
|
||||||
$loader->addPsr4($namespace, $path.'/custom/src');
|
$loader->addPsr4($namespace, $path.'/custom/src');
|
||||||
|
$loader->addPsr4($namespace, $path.'/src');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individuazione dei percorsi di base
|
// Individuazione dei percorsi di base
|
||||||
|
@@ -55,10 +55,10 @@ switch (post('op')) {
|
|||||||
$anagrafica->colore = post('colore');
|
$anagrafica->colore = post('colore');
|
||||||
$anagrafica->idtipointervento_default = post('idtipointervento_default');
|
$anagrafica->idtipointervento_default = post('idtipointervento_default');
|
||||||
|
|
||||||
$anagrafica->save();
|
|
||||||
|
|
||||||
$anagrafica->updateTipologie((array) post('idtipoanagrafica'));
|
$anagrafica->updateTipologie((array) post('idtipoanagrafica'));
|
||||||
|
|
||||||
|
$anagrafica->save();
|
||||||
|
|
||||||
// Informazioni sulla sede
|
// Informazioni sulla sede
|
||||||
$sede = $anagrafica->sedeLegale();
|
$sede = $anagrafica->sedeLegale();
|
||||||
$sede->partita_iva = post('piva');
|
$sede->partita_iva = post('piva');
|
||||||
@@ -78,6 +78,7 @@ switch (post('op')) {
|
|||||||
$sede->fax = post('fax');
|
$sede->fax = post('fax');
|
||||||
$sede->idzona = post('idzona');
|
$sede->idzona = post('idzona');
|
||||||
$sede->email = post('email');
|
$sede->email = post('email');
|
||||||
|
|
||||||
$sede->save();
|
$sede->save();
|
||||||
|
|
||||||
flash()->info(str_replace('_NAME_', '"'.post('ragione_sociale').'"', "Informazioni per l'anagrafica _NAME_ salvate correttamente!"));
|
flash()->info(str_replace('_NAME_', '"'.post('ragione_sociale').'"', "Informazioni per l'anagrafica _NAME_ salvate correttamente!"));
|
||||||
|
@@ -10,7 +10,6 @@ if ($module['name'] == 'Fatture di vendita') {
|
|||||||
|
|
||||||
if (isset($id_record)) {
|
if (isset($id_record)) {
|
||||||
$fattura = Modules\Fatture\Fattura::with('tipo', 'stato')->find($id_record);
|
$fattura = Modules\Fatture\Fattura::with('tipo', 'stato')->find($id_record);
|
||||||
//$fattura->articoli();
|
|
||||||
|
|
||||||
$record = $dbo->fetchOne('SELECT *, co_tipidocumento.reversed AS is_reversed, co_documenti.idagente AS idagente_fattura, co_documenti.note, co_documenti.note_aggiuntive, co_documenti.idpagamento, co_documenti.id AS iddocumento, co_statidocumento.descrizione AS `stato`, co_tipidocumento.descrizione AS `descrizione_tipodoc`, (SELECT descrizione FROM co_ritenutaacconto WHERE id=idritenutaacconto) AS ritenutaacconto_desc, (SELECT descrizione FROM co_rivalsainps WHERE id=idrivalsainps) AS rivalsainps_desc 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_tipidocumento.dir = '.prepare($dir).' AND co_documenti.id='.prepare($id_record));
|
$record = $dbo->fetchOne('SELECT *, co_tipidocumento.reversed AS is_reversed, co_documenti.idagente AS idagente_fattura, co_documenti.note, co_documenti.note_aggiuntive, co_documenti.idpagamento, co_documenti.id AS iddocumento, co_statidocumento.descrizione AS `stato`, co_tipidocumento.descrizione AS `descrizione_tipodoc`, (SELECT descrizione FROM co_ritenutaacconto WHERE id=idritenutaacconto) AS ritenutaacconto_desc, (SELECT descrizione FROM co_rivalsainps WHERE id=idrivalsainps) AS rivalsainps_desc 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_tipidocumento.dir = '.prepare($dir).' AND co_documenti.id='.prepare($id_record));
|
||||||
|
|
||||||
|
@@ -57,11 +57,6 @@ class Articolo extends Article
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function serialID()
|
|
||||||
{
|
|
||||||
return 'documento';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function fattura()
|
public function fattura()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Fattura::class, 'iddocumento');
|
return $this->belongsTo(Fattura::class, 'iddocumento');
|
||||||
|
@@ -8,7 +8,17 @@ use Base\Article;
|
|||||||
class Articolo extends Article
|
class Articolo extends Article
|
||||||
{
|
{
|
||||||
protected $table = 'mg_articoli_interventi';
|
protected $table = 'mg_articoli_interventi';
|
||||||
|
protected $serialRowID = 'intervento';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crea una nuova riga collegata ad un intervento.
|
||||||
|
*
|
||||||
|
* @param Intervento $intervento
|
||||||
|
* @param Original $articolo
|
||||||
|
* @param int $id_automezzo
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public static function new(Intervento $intervento, Original $articolo, $id_automezzo = null)
|
public static function new(Intervento $intervento, Original $articolo, $id_automezzo = null)
|
||||||
{
|
{
|
||||||
$model = parent::new($articolo);
|
$model = parent::new($articolo);
|
||||||
@@ -67,11 +77,6 @@ class Articolo extends Article
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function serialID()
|
|
||||||
{
|
|
||||||
return 'intervento';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSubtotaleAttribute()
|
public function getSubtotaleAttribute()
|
||||||
{
|
{
|
||||||
return $this->prezzo_vendita * $this->qta;
|
return $this->prezzo_vendita * $this->qta;
|
||||||
|
@@ -2,9 +2,30 @@
|
|||||||
|
|
||||||
namespace Modules\Interventi;
|
namespace Modules\Interventi;
|
||||||
|
|
||||||
use Base\Model;
|
use Base\Row;
|
||||||
|
|
||||||
class Riga extends Model
|
class Riga extends Row
|
||||||
{
|
{
|
||||||
protected $table = 'in_righe_interventi';
|
protected $table = 'in_righe_interventi';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crea una nuova riga collegata ad un intervento.
|
||||||
|
*
|
||||||
|
* @param Intervento $intervento
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public static function new(Intervento $intervento)
|
||||||
|
{
|
||||||
|
$model = parent::new();
|
||||||
|
|
||||||
|
$model->intervento()->associate($intervento);
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function intervento()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Intervento::class, 'idintervento');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Base;
|
namespace Base;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
abstract class Description extends Model
|
abstract class Description extends Model
|
||||||
{
|
{
|
||||||
protected static function boot()
|
protected static function boot()
|
||||||
|
@@ -3,10 +3,11 @@
|
|||||||
namespace Base;
|
namespace Base;
|
||||||
|
|
||||||
use Modules\Articoli\Articolo as Original;
|
use Modules\Articoli\Articolo as Original;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
abstract class Article extends Row
|
abstract class Article extends Row
|
||||||
{
|
{
|
||||||
abstract protected function serialID();
|
protected $serialRowID = 'documento';
|
||||||
|
|
||||||
abstract public function movimenta($qta);
|
abstract public function movimenta($qta);
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ abstract class Article extends Row
|
|||||||
public function setSerials($serials)
|
public function setSerials($serials)
|
||||||
{
|
{
|
||||||
database()->sync('mg_prodotti', [
|
database()->sync('mg_prodotti', [
|
||||||
'id_riga_'.$this->serialID() => $this->id,
|
'id_riga_'.$this->serialRowID => $this->id,
|
||||||
'dir' => 'entrata',
|
'dir' => 'entrata',
|
||||||
'id_articolo' => $this->idarticolo,
|
'id_articolo' => $this->idarticolo,
|
||||||
], [
|
], [
|
||||||
@@ -43,6 +44,17 @@ abstract class Article extends Row
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSerialsAttribute()
|
||||||
|
{
|
||||||
|
if (empty($this->abilita_serial)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Individuazione dei seriali
|
||||||
|
$list = database()->fetchArray('SELECT serial FROM mg_prodotti WHERE serial IS NOT NULL AND id_riga_'.$this->serialRowID.' = '.prepare($this->id));
|
||||||
|
return array_column($list, 'serial');
|
||||||
|
}
|
||||||
|
|
||||||
public function setQtaAttribute($value)
|
public function setQtaAttribute($value)
|
||||||
{
|
{
|
||||||
$previous = $this->qta;
|
$previous = $this->qta;
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Base;
|
namespace Base;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
abstract class Row extends Model
|
abstract class Row extends Model
|
||||||
{
|
{
|
||||||
protected static function boot()
|
protected static function boot()
|
||||||
@@ -45,7 +47,7 @@ abstract class Row extends Model
|
|||||||
$this->attributes['idrivalsainps'] = $value;
|
$this->attributes['idrivalsainps'] = $value;
|
||||||
|
|
||||||
// Calcolo rivalsa inps
|
// Calcolo rivalsa inps
|
||||||
$rivalsa = database()->fetchOne('SELECT * FROM co_rivalsainps WHERE id='.prepare($value));
|
$rivalsa = database()->fetchOne('SELECT * FROM co_rivalsainps WHERE id = '.prepare($value));
|
||||||
$this->rivalsainps = ($this->subtotale - $this->sconto) / 100 * $rivalsa['percentuale'];
|
$this->rivalsainps = ($this->subtotale - $this->sconto) / 100 * $rivalsa['percentuale'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@ abstract class Row extends Model
|
|||||||
$this->attributes['idritenutaacconto'] = $value;
|
$this->attributes['idritenutaacconto'] = $value;
|
||||||
|
|
||||||
// Calcolo ritenuta d'acconto
|
// Calcolo ritenuta d'acconto
|
||||||
$ritenuta = database()->fetchOne('SELECT * FROM co_ritenutaacconto WHERE id='.prepare($value));
|
$ritenuta = database()->fetchOne('SELECT * FROM co_ritenutaacconto WHERE id = '.prepare($value));
|
||||||
$conto = ($this->subtotale - $this->sconto);
|
$conto = ($this->subtotale - $this->sconto);
|
||||||
|
|
||||||
if ($this->calcolo_ritenutaacconto == 'Imponibile + rivalsa inps') {
|
if ($this->calcolo_ritenutaacconto == 'Imponibile + rivalsa inps') {
|
||||||
|
Reference in New Issue
Block a user