This commit is contained in:
MatteoPistorello 2022-03-07 17:37:53 +01:00
commit 60d910b54e
6 changed files with 190 additions and 1 deletions

48
modules/primanota/bulk.php Executable file
View File

@ -0,0 +1,48 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
include_once __DIR__.'/../../core.php';
use Modules\PrimaNota\Mastrino;
use Util\Zip;
switch (post('op')) {
case 'export-bulk':
$_SESSION['superselect']['mastrini'] = $id_records;
$print = Prints::getModulePredefinedPrint($id_module);
header("location: ".$rootdir."/pdfgen.php?id_print=".$print['id']."&id_record=".$id_records[0]);
exit;
break;
}
return [
'export-bulk' => [
'text' => '<span><i class="fa fa-file-o"></i> '.tr('Esporta PDF'),
'data' => [
'title' => tr('Vuoi davvero esportare il PDF?'),
'msg' => '',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',
'blank' => true,
],
],
];

64
templates/prima_nota/body.php Executable file
View File

@ -0,0 +1,64 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
include_once __DIR__.'/../../core.php';
echo '
<div class="row">
<div class="col-md-12 text-center">
<h3><b>'.tr('Prima nota').'</b></h3>
</div>
</div>';
echo '
<table class="table table-bordered table-striped">
<tr>
<th>#</th>';
foreach($campi as $campo){
echo '
<th>'.$campo.'</th>';
}
echo '
</tr>';
$index = 0;
foreach($records['results'] as $record){
$record['Data'] = Translator::dateToLocale($record['Data']);
$record['Dare'] = Translator::numberToLocale($record['Dare'],'qta');
$record['Avere'] = Translator::numberToLocale($record['Avere'],'qta');
++$index;
echo '
<tr>
<td>'.$index.'</td>';
foreach($campi as $campo){
echo '
<td>'.$record[$campo].'</td>';
}
echo '
</tr>';
}
echo '
</table>';

View File

@ -0,0 +1,3 @@
<?php
echo '<div></div>';

48
templates/prima_nota/init.php Executable file
View File

@ -0,0 +1,48 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
use Util\Query;
include_once __DIR__.'/../../core.php';
$id_module = Modules::get('Prima nota')['id'];
$structure = Modules::get($id_module);
if( !empty($_SESSION['superselect']['mastrini']) ){
$id_record = $_SESSION['superselect']['mastrini'];
$where = "co_movimenti.idmastrino IN (".implode(",",$id_record).")";
$id_record = json_decode($righe);
unset($_SESSION['superselect']['mastrini']);
}else{
$where = "co_movimenti.idmastrino=".prepare($id_record);
}
// RISULTATI VISIBILI
Util\Query::setSegments(false);
$query = Query::getQuery($structure, $where, 0, []);
$query = Modules::replaceAdditionals($id_module, $query);
$query = str_replace("1=1","1=1 AND ".$where,$query);
$records = Query::executeAndCount($query);
$campi = [];
foreach($records['results'][0] as $key=>$value){
$campi[] = $key;
}
unset($campi[0]);

View File

@ -0,0 +1,23 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
return [
'orientation' => 'L',
'font-size' => '11pt',
];

View File

@ -95,3 +95,6 @@ INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`,
-- Rimozione widget Stampa riepilogo
DELETE FROM `zz_widgets` WHERE `zz_widgets`.`name` = 'Stampa riepilogo';
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name` = 'Prima nota'), (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name` = 'Prima nota'), 'Prima nota', 'Prima nota', 'Prima nota del {data}', 'prima_nota', 'idmastrino', '', 'fa fa-print', '', '', '0', '1', '1', '1');