2019-02-21 12:24:57 +01:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-02-21 12:24:57 +01:00
|
|
|
|
|
|
|
$r = $dbo->fetchOne('SELECT co_scadenziario.*, co_documenti.*,
|
|
|
|
an_anagrafiche.email,
|
|
|
|
an_anagrafiche.pec,
|
|
|
|
an_anagrafiche.ragione_sociale,
|
2019-02-21 12:38:36 +01:00
|
|
|
co_scadenziario.da_pagare - co_scadenziario.pagato AS totale,
|
2019-08-29 10:25:14 +02:00
|
|
|
(SELECT pec FROM em_accounts WHERE em_accounts.id='.prepare($template['id_account']).') AS is_pec,
|
2019-02-21 12:24:57 +01:00
|
|
|
(SELECT descrizione FROM co_pagamenti WHERE co_pagamenti.id = co_documenti.idpagamento) AS pagamento
|
|
|
|
FROM co_scadenziario
|
|
|
|
INNER JOIN co_documenti ON co_documenti.id = co_scadenziario.iddocumento
|
|
|
|
INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica
|
2019-02-21 12:37:06 +01:00
|
|
|
WHERE co_scadenziario.pagato != co_scadenziario.da_pagare AND co_scadenziario.iddocumento = (SELECT iddocumento FROM co_scadenziario s WHERE id='.prepare($id_record).')');
|
2019-02-21 12:24:57 +01:00
|
|
|
|
2021-10-23 16:37:21 +02:00
|
|
|
$logo_azienda = str_replace(base_dir(), base_path(), AppLegacy::filepath('templates/base|custom|/logo_azienda.jpg'));
|
2019-02-21 12:24:57 +01:00
|
|
|
|
|
|
|
// Variabili da sostituire
|
|
|
|
return [
|
|
|
|
'email' => $r['is_pec'] ? $r['pec'] : $r['email'],
|
|
|
|
'id_anagrafica' => $r['idanagrafica'],
|
|
|
|
'ragione_sociale' => $r['ragione_sociale'],
|
|
|
|
'numero' => empty($r['numero_esterno']) ? $r['numero'] : $r['numero_esterno'],
|
|
|
|
'note' => $r['note'],
|
|
|
|
'pagamento' => $r['pagamento'],
|
2021-01-04 18:54:23 +01:00
|
|
|
'totale' => numberFormat(abs($r['totale'])),
|
|
|
|
'data_scadenza' => dateFormat($r['scadenza']),
|
|
|
|
'data' => dateFormat($r['data']),
|
2019-02-21 12:24:57 +01:00
|
|
|
'logo_azienda' => !empty($logo_azienda) ? '<img src="'.$logo_azienda.'" />' : '',
|
|
|
|
];
|