mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 03:51:06 +01:00
Aggiunto il riferimento delle righe in generazione fattura elettronica
This commit is contained in:
parent
e2d451e0f0
commit
147d13f9d2
@ -483,17 +483,17 @@ class FatturaElettronica
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected static function getCedentePrestatore($fattura)
|
protected static function getCedentePrestatore($fattura)
|
||||||
{
|
{
|
||||||
|
|
||||||
$documento = $fattura->getDocumento();
|
$documento = $fattura->getDocumento();
|
||||||
|
|
||||||
//Fattura per conto terzi
|
//Fattura per conto terzi
|
||||||
if ($documento['is_fattura_conto_terzi']){
|
if ($documento['is_fattura_conto_terzi']){
|
||||||
$azienda = $fattura->getCliente();
|
$azienda = $fattura->getCliente();
|
||||||
}else{
|
}else{
|
||||||
$azienda = static::getAzienda();
|
$azienda = static::getAzienda();
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'DatiAnagrafici' => static::getDatiAnagrafici($azienda, true),
|
'DatiAnagrafici' => static::getDatiAnagrafici($azienda, true),
|
||||||
'Sede' => static::getSede($azienda),
|
'Sede' => static::getSede($azienda),
|
||||||
@ -908,6 +908,38 @@ class FatturaElettronica
|
|||||||
$descrizione = str_replace('…', '...', $descrizione);
|
$descrizione = str_replace('…', '...', $descrizione);
|
||||||
|
|
||||||
$dettaglio['Descrizione'] = str_replace('’', ' ', $descrizione);
|
$dettaglio['Descrizione'] = str_replace('’', ' ', $descrizione);
|
||||||
|
|
||||||
|
//Aggiungo il riferimento della riga alla descrizione
|
||||||
|
$rif = '';
|
||||||
|
if (!empty($riga['idordine'])) {
|
||||||
|
$data = $database->fetchArray("SELECT IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM or_ordini WHERE id=".prepare($riga['idordine']));
|
||||||
|
$rif = 'ordine';
|
||||||
|
}
|
||||||
|
// DDT
|
||||||
|
elseif (!empty($riga['idddt'])) {
|
||||||
|
$data = $database->fetchArray("SELECT IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM dt_ddt WHERE id=".prepare($riga['idddt']));
|
||||||
|
$rif = 'ddt';
|
||||||
|
}
|
||||||
|
// Preventivo
|
||||||
|
elseif (!empty($riga['idpreventivo'])) {
|
||||||
|
$data = $database->fetchArray('SELECT numero, data_bozza AS data FROM co_preventivi WHERE id='.prepare($riga['idpreventivo']));
|
||||||
|
$rif = 'preventivo';
|
||||||
|
}
|
||||||
|
// Contratto
|
||||||
|
elseif (!empty($riga['idcontratto'])) {
|
||||||
|
$data = $database->fetchArray('SELECT numero, data_bozza AS data FROM co_contratti WHERE id='.prepare($riga['idcontratto']));
|
||||||
|
$rif = 'contratto';
|
||||||
|
}
|
||||||
|
// Intervento
|
||||||
|
elseif (!empty($riga['idintervento'])) {
|
||||||
|
$data = $database->fetchArray('SELECT codice AS numero, IFNULL( (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento=in_interventi.id), data_richiesta) AS data FROM in_interventi WHERE id='.prepare($riga['idintervento']));
|
||||||
|
$rif = 'intervento';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($rif)){
|
||||||
|
$dettaglio['Descrizione'] .= "\nRif. ".$rif." n.".$data[0]['numero']." del ".date('d/m/Y', strtotime($data[0]['data']));
|
||||||
|
}
|
||||||
|
|
||||||
$dettaglio['Quantita'] = $riga['qta'];
|
$dettaglio['Quantita'] = $riga['qta'];
|
||||||
|
|
||||||
if (!empty($riga['um'])) {
|
if (!empty($riga['um'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user