2019-07-22 12:52:48 +02: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-07-22 12:52:48 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
|
|
|
|
switch ($resource) {
|
2020-08-14 09:55:05 +02:00
|
|
|
/*
|
|
|
|
* Opzioni utilizzate:
|
|
|
|
* - codice_modalita_pagamento_fe
|
|
|
|
*/
|
2019-07-22 12:52:48 +02:00
|
|
|
case 'pagamenti':
|
2021-03-10 15:38:42 +01:00
|
|
|
$query = "SELECT co_pagamenti.id,
|
2019-07-22 12:52:48 +02:00
|
|
|
CONCAT_WS(' - ', codice_modalita_pagamento_fe, descrizione) AS descrizione,
|
2021-03-10 15:38:42 +01:00
|
|
|
banca_vendite.id AS id_banca_vendite,
|
|
|
|
CONCAT(banca_vendite.nome, ' - ', banca_vendite.iban) AS descrizione_banca_vendite,
|
|
|
|
banca_acquisti.id AS id_banca_acquisti,
|
|
|
|
CONCAT(banca_acquisti.nome, ' - ', banca_acquisti.iban) AS descrizione_banca_acquisti
|
|
|
|
FROM co_pagamenti
|
|
|
|
LEFT JOIN co_banche banca_vendite ON co_pagamenti.idconto_vendite = banca_vendite.id_pianodeiconti3
|
|
|
|
LEFT JOIN co_banche banca_acquisti ON co_pagamenti.idconto_acquisti = banca_acquisti.id_pianodeiconti3
|
|
|
|
|where| GROUP BY co_pagamenti.descrizione ORDER BY co_pagamenti.descrizione ASC";
|
2019-07-22 12:52:48 +02:00
|
|
|
|
2021-09-01 10:20:13 +02:00
|
|
|
// Filtri per banche dell'Azienda
|
|
|
|
$id_azienda = setting('Azienda predefinita');
|
|
|
|
$where[] = 'banca_vendite.id_anagrafica = '.prepare($id_azienda);
|
|
|
|
$where[] = 'banca_acquisti.id_anagrafica = '.prepare($id_azienda);
|
2021-09-08 10:40:18 +02:00
|
|
|
$where[] = 'banca_acquisti.deleted_at IS NULL';
|
|
|
|
$where[] = 'banca_vendite.deleted_at IS NULL';
|
2021-09-01 10:20:13 +02:00
|
|
|
|
2019-07-22 12:52:48 +02:00
|
|
|
foreach ($elements as $element) {
|
|
|
|
$filter[] = 'co_pagamenti.id = '.prepare($element);
|
|
|
|
}
|
2021-09-01 10:30:18 +02:00
|
|
|
|
2019-07-22 12:52:48 +02:00
|
|
|
if (!empty($superselect['codice_modalita_pagamento_fe'])) {
|
|
|
|
$where[] = 'codice_modalita_pagamento_fe = '.prepare($superselect['codice_modalita_pagamento_fe']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($search)) {
|
|
|
|
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|