mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
@ -5,6 +5,7 @@ return [
|
||||
'modules/anagrafiche' => 'Modules\Anagrafiche',
|
||||
'modules/articoli' => 'Modules\Articoli',
|
||||
'modules/ritenute' => 'Modules\Ritenute',
|
||||
'modules/rivalse' => 'Modules\Rivalse',
|
||||
'modules/iva' => 'Modules\Iva',
|
||||
'modules/ddt' => 'Modules\DDT',
|
||||
'modules/fatture' => 'Modules\Fatture',
|
||||
|
2
core.php
2
core.php
@ -111,7 +111,7 @@ Monolog\ErrorHandler::register($logger, [], Monolog\Logger::ERROR, Monolog\Logge
|
||||
|
||||
// Aggiunta di Monolog a Whoops
|
||||
if (App::debug()) {
|
||||
$whoops->pushHandler(function (\Whoops\Exception\ErrorException $exception, $inspector, $run) use ($logger) {
|
||||
$whoops->pushHandler(function ($exception, $inspector, $run) use ($logger) {
|
||||
$logger->addError($exception->getMessage(), [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
|
@ -96,32 +96,6 @@ abstract class Article extends Row
|
||||
return $this->belongsTo(Original::class, 'idarticolo');
|
||||
}
|
||||
|
||||
public function copiaIn(Document $document)
|
||||
{
|
||||
$class = get_class($document);
|
||||
$namespace = implode('\\', explode('\\', $class, -1));
|
||||
|
||||
$current = get_class($this);
|
||||
$pieces = explode('\\', $current);
|
||||
$type = end($pieces);
|
||||
|
||||
$object = $namespace.'\\Components\\'.$type;
|
||||
|
||||
$attributes = $this->getAttributes();
|
||||
unset($attributes['id']);
|
||||
|
||||
$model = $object::build($document, $this->articolo);
|
||||
$model->save();
|
||||
|
||||
$model = $object::find($model->id);
|
||||
$accepted = $model->getAttributes();
|
||||
|
||||
$attributes = array_intersect_key($attributes, $accepted);
|
||||
$model->fill($attributes);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot(true);
|
||||
@ -169,4 +143,9 @@ abstract class Article extends Row
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function customCopiaIn($original)
|
||||
{
|
||||
$this->articolo()->associate($original->articolo);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,11 @@ abstract class Description extends Model
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il proprietario dell'oggetto e l'ordine relativo all'interno delle righe.
|
||||
*
|
||||
* @param Document $document
|
||||
*/
|
||||
public function setParent(Document $document)
|
||||
{
|
||||
$this->parent()->associate($document);
|
||||
@ -35,8 +40,17 @@ abstract class Description extends Model
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function copiaIn(Document $document)
|
||||
/**
|
||||
* Copia l'oggetto (articolo, riga, descrizione) nel corrispettivo per il documento indicato.
|
||||
*
|
||||
* @param Document $document
|
||||
* @param float|null $qta
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function copiaIn(Document $document, $qta = null)
|
||||
{
|
||||
// Individuazione classe di destinazione
|
||||
$class = get_class($document);
|
||||
$namespace = implode('\\', explode('\\', $class, -1));
|
||||
|
||||
@ -46,18 +60,34 @@ abstract class Description extends Model
|
||||
|
||||
$object = $namespace.'\\Components\\'.$type;
|
||||
|
||||
// Attributi dell'oggetto da copiare
|
||||
$attributes = $this->getAttributes();
|
||||
unset($attributes['id']);
|
||||
|
||||
$model = $object::build($document);
|
||||
if ($qta !== null) {
|
||||
$attributes['qta'] = $qta;
|
||||
}
|
||||
|
||||
// Creazione del nuovo oggetto
|
||||
$model = new $object();
|
||||
$model->setParent($document);
|
||||
|
||||
$model->customCopiaIn($this);
|
||||
|
||||
$model->save();
|
||||
|
||||
// Impostazione degli attributi
|
||||
$model = $object::find($model->id);
|
||||
$accepted = $model->getAttributes();
|
||||
|
||||
$attributes = array_intersect_key($attributes, $accepted);
|
||||
$model->fill($attributes);
|
||||
|
||||
$model->save();
|
||||
|
||||
// Rimozione quantità evasa
|
||||
$this->qta_evasa = $this->qta_evasa + $attributes['qta'];
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
@ -65,6 +95,15 @@ abstract class Description extends Model
|
||||
|
||||
abstract public function getParentID();
|
||||
|
||||
/**
|
||||
* Azione personalizzata per la copia dell'oggetto.
|
||||
*
|
||||
* @param $original
|
||||
*/
|
||||
protected function customCopiaIn($original)
|
||||
{
|
||||
}
|
||||
|
||||
protected static function boot($bypass = false)
|
||||
{
|
||||
parent::boot();
|
||||
|
@ -6,7 +6,7 @@ use Common\Document;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Modules\Iva\Aliquota;
|
||||
use Modules\Ritenute\RitenutaAcconto;
|
||||
use Modules\Ritenute\RivalsaINPS;
|
||||
use Modules\Rivalse\RivalsaINPS;
|
||||
|
||||
abstract class Row extends Description
|
||||
{
|
||||
|
@ -63,7 +63,6 @@ switch (post('op')) {
|
||||
$codice_cig = post('codice_cig');
|
||||
$codice_cup = post('codice_cup');
|
||||
|
||||
|
||||
$query = 'UPDATE co_contratti SET idanagrafica='.prepare($idanagrafica).',
|
||||
idsede='.prepare($idsede).',
|
||||
idstato='.prepare($idstato).',
|
||||
|
@ -444,7 +444,7 @@ switch (post('op')) {
|
||||
|
||||
if (!empty(post('import'))) {
|
||||
// Replicazione delle righe del contratto sul documento
|
||||
$righe = $dbo->fetchArray('SELECT idarticolo, idiva, desc_iva, iva, iva_indetraibile, descrizione, subtotale, um, qta, sconto, sconto_unitario, tipo_sconto, IFNULL( (SELECT mg_articoli.abilita_serial FROM mg_articoli WHERE mg_articoli.id=co_righe_contratti.idarticolo), 0 ) AS abilita_serial FROM co_righe_contratti WHERE idcontratto='.prepare($idcontratto));
|
||||
$righe = $dbo->fetchArray('SELECT *, IFNULL( (SELECT mg_articoli.abilita_serial FROM mg_articoli WHERE mg_articoli.id=co_righe_contratti.idarticolo), 0 ) AS abilita_serial FROM co_righe_contratti WHERE idcontratto='.prepare($idcontratto));
|
||||
|
||||
foreach ($righe as $key => $riga) {
|
||||
$subtot = $riga['subtotale'];
|
||||
|
@ -555,15 +555,13 @@ function ricalcola_costiagg_fattura($iddocumento, $idrivalsainps = '', $idritenu
|
||||
|
||||
$marca_da_bollo = 0;
|
||||
if (abs($bolli) > 0 && abs($netto_a_pagare > setting("Soglia minima per l'applicazione della marca da bollo"))) {
|
||||
|
||||
//Controllo che tra le iva ce ne sia almeno una con natura N1, N2, N3 o N4
|
||||
$check_natura = $dbo->fetchArray("SELECT codice_natura_fe FROM co_righe_documenti INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE iddocumento=".prepare($iddocumento)." AND codice_natura_fe IN('N1','N2','N3','N4') GROUP BY codice_natura_fe");
|
||||
$check_natura = $dbo->fetchArray('SELECT codice_natura_fe FROM co_righe_documenti INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id WHERE iddocumento='.prepare($iddocumento)." AND codice_natura_fe IN('N1','N2','N3','N4') GROUP BY codice_natura_fe");
|
||||
if (($dir == 'entrata' && sizeof($check_natura) > 0) || $dir == 'uscita') {
|
||||
$marca_da_bollo = $bolli;
|
||||
} else {
|
||||
$marca_da_bollo = 0.00;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Se l'importo è negativo può essere una nota di credito, quindi cambio segno alla marca da bollo
|
||||
|
@ -64,7 +64,6 @@ switch (post('op')) {
|
||||
$codice_cig = post('codice_cig');
|
||||
$codice_cup = post('codice_cup');
|
||||
|
||||
|
||||
$query = 'UPDATE co_preventivi SET idstato='.prepare($idstato).','.
|
||||
' nome='.prepare($nome).','.
|
||||
' idanagrafica='.prepare($idanagrafica).','.
|
||||
|
@ -13,7 +13,6 @@ if (!in_array($record['stato'], ['Bozza', 'Rifiutato', 'In attesa di conferma'])
|
||||
$disabled = 'disabled';
|
||||
}
|
||||
|
||||
|
||||
// crea ordine
|
||||
echo '
|
||||
<div style="margin-left:4px;" class="dropdown pull-right" >
|
||||
@ -31,7 +30,6 @@ echo '
|
||||
</ul>
|
||||
</div>';
|
||||
|
||||
|
||||
//duplica preventivo
|
||||
echo '
|
||||
<form action="" method="post" id="form-copy">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ritenute;
|
||||
namespace Modules\Rivalse;
|
||||
|
||||
use Common\Model;
|
||||
|
@ -633,11 +633,13 @@ class FatturaElettronica
|
||||
];
|
||||
|
||||
$ritenuta_predefinita = setting("Percentuale ritenuta d'acconto");
|
||||
if (!empty($ritenuta_predefinita))
|
||||
if (!empty($ritenuta_predefinita)) {
|
||||
$dati_cassa['Ritenuta'] = 'SI';
|
||||
}
|
||||
|
||||
if (!empty($iva['codice_natura_fe']))
|
||||
if (!empty($iva['codice_natura_fe'])) {
|
||||
$dati_cassa['Natura'] = $iva['codice_natura_fe'];
|
||||
}
|
||||
|
||||
//$dati_cassa['RiferimentoAmministrazione'] = '';
|
||||
|
||||
@ -882,7 +884,6 @@ class FatturaElettronica
|
||||
|
||||
//2.2.1.3
|
||||
if (!empty($riga['idarticolo'])) {
|
||||
|
||||
$tipo_codice = $database->fetchOne('SELECT `mg_categorie`.`nome` FROM `mg_categorie` INNER JOIN `mg_articoli` ON `mg_categorie`.`id` = `mg_articoli`.`id_categoria` WHERE `mg_articoli`.`id` = '.prepare($riga['idarticolo']))['nome'];
|
||||
|
||||
$codice_articolo = [
|
||||
@ -895,10 +896,10 @@ class FatturaElettronica
|
||||
|
||||
//Non ammesso ’
|
||||
//$descrizione = html_entity_decode($riga['descrizione'], ENT_HTML5, 'UTF-8');
|
||||
$descrizione = str_replace(">", " ", $riga['descrizione']);
|
||||
$descrizione = str_replace("…", "...", $descrizione);
|
||||
$descrizione = str_replace('>', ' ', $riga['descrizione']);
|
||||
$descrizione = str_replace('…', '...', $descrizione);
|
||||
|
||||
$dettaglio['Descrizione'] = str_replace("’", " ", $descrizione);
|
||||
$dettaglio['Descrizione'] = str_replace('’', ' ', $descrizione);
|
||||
$dettaglio['Quantita'] = $riga['qta'];
|
||||
|
||||
if (!empty($riga['um'])) {
|
||||
|
@ -222,7 +222,6 @@ class FatturaElettronica
|
||||
|
||||
$sconti = $riga['ScontoMaggiorazione'];
|
||||
if (!empty($sconti)) {
|
||||
|
||||
foreach ($sconti as $key => $sconto) {
|
||||
$tipo = !empty($sconto['Percentuale']) ? 'PRC' : 'EUR';
|
||||
$unitario = $sconto['Percentuale'] ?: $sconto['Importo'];
|
||||
@ -235,10 +234,8 @@ class FatturaElettronica
|
||||
$obj->tipo_sconto = $tipo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$obj->save();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class Interaction extends Connection
|
||||
$files = $body['results'];
|
||||
|
||||
foreach ($files as $file) {
|
||||
/**
|
||||
/*
|
||||
* Verifico che l'XML non sia già stato importato nel db
|
||||
*/
|
||||
|
||||
@ -69,9 +69,9 @@ class Interaction extends Connection
|
||||
$body = static::responseBody($response);
|
||||
|
||||
if ($body['processed'] == '0') {
|
||||
$message = $body['code']." - ".$body['message'];
|
||||
$message = $body['code'].' - '.$body['message'];
|
||||
} else {
|
||||
$message = "";
|
||||
$message = '';
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
@ -157,7 +157,7 @@ class AJAX
|
||||
if (!empty($permissions)) {
|
||||
$modules = Modules::getAvailableModules();
|
||||
} else {
|
||||
$modules = Modules::getModules();
|
||||
$modules = Models\Module::withoutGlobalScope('enabled')->get();
|
||||
}
|
||||
|
||||
$modules = $modules->toArray();
|
||||
|
Reference in New Issue
Block a user