mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Introduzione nodo "IndirizzoResa" in fattura elettronica
This commit is contained in:
parent
99293fd91c
commit
ad2b724452
@ -1026,25 +1026,55 @@ class FatturaElettronica
|
||||
$result = [];
|
||||
|
||||
// Se imposto il vettore deve essere indicata anche la p.iva nella sua anagrafica
|
||||
if ($documento['idvettore']) {
|
||||
$vettore = Anagrafica::find($documento['idvettore']);
|
||||
$result['DatiAnagraficiVettore'] = static::getDatiAnagrafici($vettore);
|
||||
if ($documento->tipo->descrizione == 'Fattura accompagnatoria di vendita') {
|
||||
|
||||
if ($documento['idvettore']) {
|
||||
$vettore = Anagrafica::find($documento['idvettore']);
|
||||
$result['DatiAnagraficiVettore'] = static::getDatiAnagrafici($vettore);
|
||||
}
|
||||
|
||||
if (!empty($causale)) {
|
||||
$result['CausaleTrasporto'] = $causale;
|
||||
}
|
||||
|
||||
if (!empty($documento['n_colli'])) {
|
||||
$result['NumeroColli'] = $documento['n_colli'];
|
||||
}
|
||||
|
||||
if (!empty($aspetto)) {
|
||||
$result['Descrizione'] = $aspetto;
|
||||
}
|
||||
|
||||
if ($documento['tipo_resa']) {
|
||||
$result['TipoResa'] = $documento['tipo_resa'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($causale)) {
|
||||
$result['CausaleTrasporto'] = $causale;
|
||||
}
|
||||
if (!empty($documento['idsede_destinazione'])){
|
||||
|
||||
$sede = $database->fetchOne('SELECT * FROM an_sedi WHERE id='.prepare($documento['idsede_destinazione']));
|
||||
|
||||
if (!empty($documento['n_colli'])) {
|
||||
$result['NumeroColli'] = $documento['n_colli'];
|
||||
}
|
||||
if (!empty($sede['indirizzo'])){
|
||||
$result['IndirizzoResa']['Indirizzo'] = $sede['indirizzo'];
|
||||
}
|
||||
|
||||
if (!empty($aspetto)) {
|
||||
$result['Descrizione'] = $aspetto;
|
||||
}
|
||||
if (!empty($sede['cap'])){
|
||||
$result['IndirizzoResa']['CAP'] = $sede['cap'];
|
||||
}
|
||||
|
||||
if ($documento['tipo_resa']) {
|
||||
$result['TipoResa'] = $documento['tipo_resa'];
|
||||
if (!empty($sede['citta'])){
|
||||
$result['IndirizzoResa']['Comune'] = $sede['citta'];
|
||||
}
|
||||
|
||||
if (!empty($sede['provincia'])){
|
||||
$result['IndirizzoResa']['Provincia'] = $sede['provincia'];
|
||||
}
|
||||
|
||||
if (!empty($sede['id_nazione'])){
|
||||
$rs_nazione = $database->fetchOne('SELECT * FROM an_nazioni WHERE id='.prepare($sede['id_nazione']));
|
||||
|
||||
$result['IndirizzoResa']['Nazione'] = $rs_nazione['iso2'];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -1273,7 +1303,7 @@ class FatturaElettronica
|
||||
}
|
||||
}
|
||||
|
||||
if ($documento->tipo->descrizione == 'Fattura accompagnatoria di vendita') {
|
||||
if ($documento->tipo->descrizione == 'Fattura accompagnatoria di vendita' || !empty($documento['idsede_destinazione'])) {
|
||||
$result['DatiTrasporto'] = static::getDatiTrasporto($fattura);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user