2021-12-01 12:27:56 +01:00
< ? php
2022-02-21 10:30:19 +01:00
use Plugins\PresentazioniBancarie\Gestore ;
use Modules\Banche\Banca ;
2021-12-01 12:27:56 +01:00
include_once __DIR__ . '/init.php' ;
if ( ! empty ( $records )) {
2022-02-21 10:30:19 +01:00
2021-12-01 12:27:56 +01:00
include $structure -> filepath ( 'generate.php' );
return ;
2022-02-21 10:30:19 +01:00
} else {
$banca_azienda = Banca :: where ( 'id_anagrafica' , Gestore :: getAzienda () -> id )
-> where ( 'predefined' , 1 )
-> first ();
try {
if ( empty ( $banca_azienda )) {
echo '
2022-02-21 09:32:56 +01:00
< div class = " alert alert-warning " >
< i class = " fa fa-warning " ></ i >
'.tr("La banca dell' azienda non è definita o non ha impostati i campi Codice IBAN e BIC " ).'.
2022-02-21 10:30:19 +01:00
'.Modules::link(' Banche ', null, tr(' Imposta '), null, null).'
2022-02-21 09:32:56 +01:00
</ div > ' ;
2022-02-21 10:30:19 +01:00
}
}
catch ( Exception $e ) {
}
2022-02-21 09:32:56 +01:00
}
2021-12-01 12:27:56 +01:00
echo '
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Esporta già pagati').' " , " name " : " pagati " , " help " : " '.tr('Seleziona per esportare le scadenze già pagate tra quelle selezionate').' " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Esporta già processati').' " , " name " : " processati " , " help " : " '.tr('Seleziona per esportare nuovamente le scadenze esportate in precedenze tra quelle selezionate').' " ]}
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 text-right " >
2022-02-21 09:32:56 +01:00
< button type = " button " class = " btn btn-primary '.(!empty( $banca_azienda ) ? '' : 'disabled').' " onclick = " esporta(this) " >
2021-12-01 12:27:56 +01:00
< i class = " fa fa-download " ></ i > '.tr(' Esporta ').'
</ button >
</ div >
</ div >
< script >
function getRecords () {
let table = $ ( " .main-records[id^=main] " ) . first ();
let datatable = getTable ( " # " + table . attr ( " id " ));
return datatable . getSelectedRows ();
}
function esporta ( button ) {
let records = getRecords ();
if ( ! records . length ) {
2022-02-21 09:32:56 +01:00
swal ( " '.tr('Errore').' " , " '.tr('Selezionare almeno una scadenza.').' " , " error " );
2021-12-01 12:27:56 +01:00
return ;
}
let pagati = input ( " pagati " ) . get ();
let processati = input ( " processati " ) . get ();
2021-10-23 16:37:21 +02:00
redirect ( " '.base_path().'/editor.php?id_module='. $id_module .'&id_plugin='. $id_plugin .'&records= " + records + " &pagati= " + pagati + " &processati= " + processati );
2021-12-01 12:27:56 +01:00
}
</ script > ' ;