This commit is contained in:
MatteoPistorello 2022-04-05 12:00:20 +02:00
commit e328e3c290
4 changed files with 58 additions and 1 deletions

View File

@ -63,3 +63,28 @@ function renderChecklist($check, $level = 0)
return $result;
}
function renderChecklistHtml($check, $level = 0)
{
$user = auth()->getUser();
$enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true;
$width = 10+20*$level;
$result = '
<tr>
<td class="text-center" style="width:30px;">
'.(!empty($check->checked_at)?'<img src="'.ROOTDIR.'/templates/interventi/check.png" style="width:10px;">':'').'
</td>
<td style="padding-left:'.$width.'px;">
<span class="text">'.$check->content.'</span>
</td>
</tr>';
$children = $check->children;
foreach ($children as $child) {
$result .= renderChecklistHtml($child, $level + 1);
}
return $result;
}

View File

@ -493,3 +493,31 @@ if ($options['pricing']) {
echo '
</table>';
if($options['checklist']){
$structure = Modules::get('Interventi');
$checks = $structure->mainChecks($id_record);
if(!empty($checks)){
echo '
<pagebreak class="page-break-after" />
<table class="table table-bordered vertical-middle">
<tr>
<th class="text-center" colspan="2" style="font-size:11pt;">
<b>CHECKLIST</b>
</th>
</tr>';
$structure = Modules::get('Interventi');
$checks = $structure->mainChecks($id_record);
foreach ($checks as $check) {
echo renderChecklistHtml($check);
}
echo '
</table>';
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -86,3 +86,7 @@ UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `co_documenti`\nLEFT J
UPDATE `zz_views` SET `query` = '(righe.totale_imponibile + righe.iva + `co_documenti`.`rivalsainps` + `co_documenti`.`iva_rivalsainps`) * IF(co_tipidocumento.reversed, -1, 1)' WHERE `zz_views`.`name` = 'Totale ivato' AND `zz_views`.`id_module`=(SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto');
UPDATE `zz_views` SET `query` = '(righe.totale_imponibile + IF(righe.split_payment=0, righe.iva, 0) + `co_documenti`.`rivalsainps` + `co_documenti`.`iva_rivalsainps` - `co_documenti`.`ritenutaacconto` - `co_documenti`.`sconto_finale`) * (1 - `co_documenti`.`sconto_finale_percentuale` / 100) * IF(co_tipidocumento.reversed, -1, 1)' WHERE `zz_views`.`name` = 'Netto a pagare' AND `zz_views`.`id_module`=(SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di acquisto');
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 id FROM zz_modules WHERE `name`='Interventi'), 1, 'Intervento & checklist', 'Intervento & checklist', 'Intervento num {numero} del {data}', 'interventi', 'idintervento', '{\"pricing\":true, \"checklist\": true}', 'fa fa-print', '', '', 0, 1, 1, 1),
(NULL, (SELECT id FROM zz_modules WHERE `name`='Interventi'), 1, 'Intervento & checklist (senza costi)', 'Intervento & checklist (senza prezzi)', 'Intervento num {numero} del {data}', 'interventi', 'idintervento', '{\"pricing\":false, \"checklist\": true}', 'fa fa-print', '', '', 0, 1, 1, 1);