mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 03:51:06 +01:00
Compare commits
2 Commits
86abaf3276
...
1fe70c02d9
Author | SHA1 | Date | |
---|---|---|---|
|
1fe70c02d9 | ||
|
4e4526bcb4 |
@ -167,17 +167,22 @@ class Ordine extends Document
|
||||
$parziale = $qta != $qta_evasa;
|
||||
|
||||
$stato_attuale = $this->stato;
|
||||
$nome_stato = (database()->isConnected() && database()->tableExists('or_statiordine_lang') ? $stato_attuale->getTranslation('title', \Models\Locale::getPredefined()->id) : $stato_attuale->descrizione);
|
||||
|
||||
// Impostazione del nuovo stato
|
||||
if ($qta_evasa == 0) {
|
||||
$descrizione = 'Accettato';
|
||||
} elseif (!in_array($stato_attuale->getTranslation('title', \Models\Locale::getPredefined()->id), ['Parzialmente fatturato', 'Fatturato']) && $trigger->getDocument() instanceof DDT) {
|
||||
} elseif (!in_array($nome_stato, ['Parzialmente fatturato', 'Fatturato']) && $trigger->getDocument() instanceof DDT) {
|
||||
$descrizione = $parziale ? 'Parzialmente evaso' : 'Evaso';
|
||||
} else {
|
||||
$descrizione = $parziale ? 'Parzialmente fatturato' : 'Fatturato';
|
||||
}
|
||||
|
||||
$stato = Stato::where('name', $descrizione)->first()->id;
|
||||
if(database()->isConnected() && database()->tableExists('or_statiordine_lang')){
|
||||
$stato = Stato::where('name', $descrizione)->first()->id;
|
||||
} else {
|
||||
$stato = Stato::where('descrizione', $descrizione)->first()->id;
|
||||
}
|
||||
$this->stato()->associate($stato);
|
||||
$this->save();
|
||||
}
|
||||
|
@ -424,10 +424,8 @@ abstract class Accounting extends Component
|
||||
$this->attributes['iva'] = $this->iva;
|
||||
|
||||
$iva = Aliquota::Find($this->idiva);
|
||||
$descrizione = $iva ? $iva->getTranslation('title') : '';
|
||||
|
||||
if (!empty($descrizione)) {
|
||||
$this->attributes['desc_iva'] = $descrizione;
|
||||
if (database()->isConnected() && database()->tableExists('co_iva_lang')) {
|
||||
$this->attributes['desc_iva'] = $iva ? $iva->getTranslation('title') : '';
|
||||
}
|
||||
|
||||
$this->fixIvaIndetraibile();
|
||||
|
Loading…
x
Reference in New Issue
Block a user