diff --git a/composer.json b/composer.json index 1ce70ed3c..d81930825 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "ircmaxell/password-compat": "^1.0", "maximebf/debugbar": "^1.13", "monolog/monolog": "^1.22", + "mpdf/mpdf": "^6.1", "paragonie/random_compat": "^2.0", "phpmailer/phpmailer": "^5.2", "spipu/html2pdf": "^4.6", diff --git a/controller.php b/controller.php index 26fb52eb1..a6322bc79 100644 --- a/controller.php +++ b/controller.php @@ -79,7 +79,9 @@ foreach ($plugins as $plugin) { echo ' - '; + '; + +redirectOperation(); /** * Widget laterali. diff --git a/core.php b/core.php index ce7e5df99..e359adf38 100644 --- a/core.php +++ b/core.php @@ -2,17 +2,7 @@ // Impostazioni per la corretta interpretazione di UTF-8 header('Content-Type: text/html; charset=UTF-8'); - -$handler = null; -if (extension_loaded('mbstring')) { - mb_internal_encoding('UTF-8'); - mb_http_output('UTF-8'); - mb_http_input('UTF-8'); - mb_language('uni'); - mb_regex_encoding('UTF-8'); - $handler = 'mb_output_handler'; -} -ob_start($handler); +ob_start(); // Impostazioni di configurazione PHP date_default_timezone_set('Europe/Rome'); diff --git a/editor.php b/editor.php index da65cf1c9..2523983a4 100755 --- a/editor.php +++ b/editor.php @@ -118,19 +118,7 @@ if (file_exists($docroot.'/modules/'.$module_dir.'/add.php') && $module['permess '; } -$backto = filter('backto'); -// Scelta del redirect dopo un submit -if (!empty($backto)) { - $hash = filter('hash'); - $hash = !starts_with($hash, '#') ? '#'.$hash : $hash; - if ($backto == 'record-edit') { - redirect(ROOTDIR.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.$hash); - exit(); - } elseif ($backto == 'record-list') { - redirect(ROOTDIR.'/controller.php?id_module='.$id_module.$hash); - exit(); - } -} +redirectOperation(); echo '
diff --git a/include/manager.php b/include/manager.php index dcff2a432..ba0cd31dc 100644 --- a/include/manager.php +++ b/include/manager.php @@ -150,7 +150,7 @@ if (!empty($module_options) && $module_options != 'menu' && $module_options != ' } echo ' -
  • '.$text.'
  • '; +
  • '.$text.'
  • '; } echo ' diff --git a/lib/functions.js b/lib/functions.js index 7c0e6d88d..f0e64da5e 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -1219,14 +1219,17 @@ function message(element) { delete data.method; } - redirect(href, data, method); + blank = data.blank != undefined && data.blank; + delete data.blank; + + redirect(href, data, method, blank); }, function (dismiss) {} ); } -function redirect(href, data, method = "get") { - var text = (method == "post") ? '
    ' : []; +function redirect(href, data, method = "get", blank = false) { + var text = (method == "post") ? '' : []; for (var name in data) { if (method == "post") { @@ -1246,6 +1249,6 @@ function redirect(href, data, method = "get") { form.submit(); } else { - location.href = href + (href.indexOf('?') !== -1 ? '&' : '?') + text.join('&') + window.location.hash; + window.open(href + (href.indexOf('?') !== -1 ? '&' : '?') + text.join('&') + window.location.hash, blank ? "_blank" : "_self") } } diff --git a/lib/functions.php b/lib/functions.php index a47d6c62a..a9b6cf989 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -77,14 +77,15 @@ function deltree($path) * Source path * @param string $dest * Destination path - * @param string $exclude - * Path to exclude + * @param array|string $ignores + * Paths to ingore * * @return bool Returns TRUE on success, FALSE on failure */ function copyr($source, $dest, $ignores = []) { $path = realpath($source); + $ignores = (array) $ignores; $exclude = !empty(array_intersect([slashes($path), slashes($path.'/'), $entry], $ignores)); // Simple copy for a file @@ -143,6 +144,8 @@ function create_zip($source, $destination) return false; } + $destination = slashes($destination); + $zip = new ZipArchive(); $result = $zip->open($destination, ZIPARCHIVE::CREATE); if ($result === true && is_writable(dirname($destination))) { @@ -157,11 +160,11 @@ function create_zip($source, $destination) if (is_dir($file) === true) { $zip->addEmptyDir($filename); - } elseif (is_file($file) === true) { + } elseif (is_file($file) === true && $destination != $file) { $zip->addFromString($filename, file_get_contents($file)); } } - } elseif (is_file($source) === true) { + } elseif (is_file($source) === true && $destination != $source) { $zip->addFromString(basename($source), file_get_contents($source)); } @@ -866,3 +869,19 @@ function sum($first, $second = null, $decimals = null) return $result; } + +function redirectOperation(){ + $backto = filter('backto'); + // Scelta del redirect dopo un submit + if (!empty($backto)) { + $hash = filter('hash'); + $hash = !starts_with($hash, '#') ? '#'.$hash : $hash; + if ($backto == 'record-edit') { + redirect(ROOTDIR.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.$hash); + exit(); + } elseif ($backto == 'record-list') { + redirect(ROOTDIR.'/controller.php?id_module='.$id_module.$hash); + exit(); + } + } +} diff --git a/lib/util.php b/lib/util.php index d1802229b..85d1bc632 100644 --- a/lib/util.php +++ b/lib/util.php @@ -226,12 +226,12 @@ if (!function_exists('force_download')) { header('Content-Type: application/force-download'); header('Content-Transfer-Encoding: binary'); - if ($content) { - if (is_file($content)) { - $content = file_get_contents($content); - } + if (empty($content) && is_file($filename)) { + $content = $filename; + } - header('Content-Length: '.strlen($content)); + if (is_file($content)) { + $content = file_get_contents($content); } ob_clean(); diff --git a/modules/articoli/plugins/articoli.lotti.php b/modules/articoli/plugins/articoli.lotti.php index a8f3f0eec..976936e48 100644 --- a/modules/articoli/plugins/articoli.lotti.php +++ b/modules/articoli/plugins/articoli.lotti.php @@ -155,7 +155,7 @@ $rs = $dbo->fetchArray('SELECT COUNT(id) AS tot FROM mg_prodotti WHERE id_artico $tot_prodotti = $rs[0]['tot']; // Visualizzazione di tutti i prodotti -$query = 'SELECT * FROM mg_prodotti WHERE id_articolo='.prepare($id_record).(!empty($search_serial) ? ' AND serial LIKE '.prepare('%'.$search_serial.'%') : '').' ORDER BY created_at DESC, lotto DESC, serial DESC, altro DESC'; +$query = 'SELECT serial, created_at FROM mg_prodotti WHERE serial IS NOT NULL AND id_articolo='.prepare($id_record).(!empty($search_serial) ? ' AND serial LIKE '.prepare('%'.$search_serial.'%') : '').' GROUP BY serial ORDER BY created_at DESC, serial DESC, lotto DESC, altro DESC'; $rs2 = $dbo->fetchArray($query); echo ' diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 8b10320f0..b9684af0a 100644 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -6,6 +6,12 @@ switch (post('op')) { case 'export-bulk': $dir = DOCROOT.'/files/export_fatture/'; + // Rimozione dei contenuti precedenti + $files = glob($dir.'/*.zip'); + foreach ($files as $file) { + unlink($file); + } + // Selezione delle fatture da stampare $records = $dbo->fetchArray('SELECT co_documenti.id, numero_esterno, data, ragione_sociale, co_tipidocumento.descrizione FROM co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_documenti.id IN('.implode(',', $id_records).')'); @@ -15,7 +21,7 @@ switch (post('op')) { // Gestione della stampa $rapportino_nome = sanitizeFilename($numero.' '.$r['data'].' '.$r['ragione_sociale'].'.pdf'); - $filename = slashes($dir.$rapportino_nome); + $filename = slashes($dir.'tmp/'.$rapportino_nome); $_GET['iddocumento'] = $r['id']; // Fix temporaneo per la stampa $iddocumento = $r['id']; // Fix temporaneo per la stampa @@ -25,17 +31,17 @@ switch (post('op')) { } $dir = slashes($dir); - $file = slashes($dir.'fatture.zip'); + $file = slashes($dir.'fatture_'.time().'.zip'); // Creazione zip if (extension_loaded('zip')) { - create_zip($dir, $file); + create_zip($dir.'tmp/', $file); // Invio al browser dello zip force_download($file); // Rimozione dei contenuti - deltree($dir); + deltree($dir.'tmp/'); } break; @@ -48,6 +54,7 @@ return [ 'msg' => tr('Vuoi davvero esportare tutte le stampe in un archivio?'), 'button' => tr('Procedi'), 'class' => 'btn btn-lg btn-warning', + 'blank' => true, ], ], ]; diff --git a/modules/preventivi/actions.php b/modules/preventivi/actions.php index 4a5e1387c..7023ed141 100644 --- a/modules/preventivi/actions.php +++ b/modules/preventivi/actions.php @@ -49,6 +49,23 @@ switch (post('op')) { $dbo->query('INSERT INTO co_preventivi(idanagrafica, nome, numero, idagente, idstato, idtipointervento, data_bozza, data_conclusione, idiva, idpagamento) VALUES ('.prepare($idanagrafica).', '.prepare($nome).', '.prepare($numero).', '.prepare($idagente).", (SELECT `id` FROM `co_statipreventivi` WHERE `descrizione`='Bozza'), ".prepare($idtipointervento).', NOW(), DATE_ADD(NOW(), INTERVAL +1 MONTH), '.prepare($idiva).', '.prepare($idpagamento).')'); $id_record = $dbo->lastInsertedID(); + $listino = $dbo->fetchArray('SELECT prc_guadagno FROM mg_listini WHERE id = (SELECT idlistino FROM an_anagrafiche WHERE idanagrafica = '.prepare($idanagrafica).')'); + + if (!empty($listino)) { + $dbo->update('co_preventivi', [ + 'tipo_sconto_globale' => 'PRC', + 'sconto_globale' => abs($listino[0]['prc_guadagno']), + ], ['id' => $id_record]); + + aggiorna_sconto([ + 'parent' => 'co_preventivi', + 'row' => 'co_righe_preventivi', + ], [ + 'parent' => 'id', + 'row' => 'idpreventivo', + ], $id_record); + } + /* // inserisco righe standard preventivo // ore lavoro @@ -216,8 +233,6 @@ switch (post('op')) { $subtot = $prezzo * $qta; - $prc_guadagno = post('prc_guadagno'); - $um = post('um'); // Lettura iva dell'articolo @@ -225,7 +240,7 @@ switch (post('op')) { $iva = ($subtot - $sconto) / 100 * $rs2[0]['percentuale']; $iva_indetraibile = $iva / 100 * $rs2[0]['indetraibile']; - $dbo->query('INSERT INTO co_righe_preventivi(idpreventivo, idarticolo, idiva, desc_iva, iva, iva_indetraibile, descrizione, subtotale, um, qta, sconto, sconto_unitario, tipo_sconto, prc_guadagno, `order`) VALUES ('.prepare($id_record).', '.prepare($idarticolo).', '.prepare($idiva).', '.prepare($rs2[0]['descrizione']).', '.prepare($iva).', '.prepare($iva_indetraibile).', '.prepare($descrizione).', '.prepare($subtot).', '.prepare($um).', '.prepare($qta).', '.prepare($sconto).', '.prepare($sconto_unitario).', '.prepare($tipo_sconto).', '.prepare($prc_guadagno).', (SELECT IFNULL(MAX(`order`) + 1, 0) FROM co_righe_preventivi AS t WHERE idpreventivo='.prepare($id_record).'))'); + $dbo->query('INSERT INTO co_righe_preventivi(idpreventivo, idarticolo, idiva, desc_iva, iva, iva_indetraibile, descrizione, subtotale, um, qta, sconto, sconto_unitario, tipo_sconto, `order`) VALUES ('.prepare($id_record).', '.prepare($idarticolo).', '.prepare($idiva).', '.prepare($rs2[0]['descrizione']).', '.prepare($iva).', '.prepare($iva_indetraibile).', '.prepare($descrizione).', '.prepare($subtot).', '.prepare($um).', '.prepare($qta).', '.prepare($sconto).', '.prepare($sconto_unitario).', '.prepare($tipo_sconto).', (SELECT IFNULL(MAX(`order`) + 1, 0) FROM co_righe_preventivi AS t WHERE idpreventivo='.prepare($id_record).'))'); $_SESSION['infos'][] = tr('Articolo aggiunto!'); @@ -245,8 +260,6 @@ switch (post('op')) { $sconto = ($tipo_sconto == 'PRC') ? ($prezzo * $sconto_unitario) / 100 : $sconto_unitario; $sconto = $sconto * $qta; - $prc_guadagno = post('prc_guadagno'); - $idiva = post('idiva'); $um = post('um'); @@ -256,7 +269,7 @@ switch (post('op')) { $iva_indetraibile = $iva / 100 * $rs2[0]['indetraibile']; // Modifica riga generica sul documento - $query = 'UPDATE co_righe_preventivi SET idiva='.prepare($idiva).', iva='.prepare($iva).', iva_indetraibile='.prepare($iva_indetraibile).', descrizione='.prepare($descrizione).', subtotale='.prepare($subtot).', sconto='.prepare($sconto).', sconto_unitario='.prepare($sconto_unitario).', tipo_sconto='.prepare($tipo_sconto).', prc_guadagno='.prepare($prc_guadagno).', um='.prepare($um).', qta='.prepare($qta).' WHERE id='.prepare($idriga); + $query = 'UPDATE co_righe_preventivi SET idiva='.prepare($idiva).', iva='.prepare($iva).', iva_indetraibile='.prepare($iva_indetraibile).', descrizione='.prepare($descrizione).', subtotale='.prepare($subtot).', sconto='.prepare($sconto).', sconto_unitario='.prepare($sconto_unitario).', tipo_sconto='.prepare($tipo_sconto).', um='.prepare($um).', qta='.prepare($qta).' WHERE id='.prepare($idriga); $dbo->query($query); $_SESSION['infos'][] = 'Riga modificata!'; diff --git a/modules/preventivi/edit_riga.php b/modules/preventivi/edit_riga.php index f4ffccbad..434b45c5a 100644 --- a/modules/preventivi/edit_riga.php +++ b/modules/preventivi/edit_riga.php @@ -38,11 +38,6 @@ if (empty($idriga)) { $subtot = $rsr[0]['subtotale'] / $rsr[0]['qta']; $sconto = $rsr[0]['sconto_unitario']; $tipo_sconto = $rsr[0]['tipo_sconto']; - - $prc_guadagno = $rsr[0]['prc_guadagno']; - if ($prc_guadagno > 0) { - $prc_guadagno = '+'.$prc_guadagno; - } } /* @@ -74,20 +69,20 @@ echo ' // Quantità echo '
    -
    +
    {[ "type": "number", "label": "'.tr('Q.tà').'", "name": "qta", "value": "'.$qta.'", "required": 1, "decimals": "qta" ]}
    '; // Unità di misura echo ' -
    +
    {[ "type": "select", "label": "'.tr('Unità di misura').'", "icon-after": "add|'.Modules::getModule('Unità di misura')['id'].'", "name": "um", "value": "'.$um.'", "ajax-source": "misure" ]}
    '; -// Sconto +// Iva echo ' -
    - {[ "type": "number", "label": "'.tr('Sconto/rincaro articoli per questo cliente').'", "icon-after": "%", "name": "prc_guadagno", "value": "'.$prc_guadagno.'" ]} +
    + {[ "type": "select", "label": "'.tr('Iva').'", "name": "idiva", "required": 1, "value": "'.$idiva.'", "values": "query=SELECT * FROM co_iva ORDER BY descrizione ASC" ]}
    '; @@ -118,22 +113,16 @@ if (get_var('Percentuale rivalsa INPS') != '' || get_var("Percentuale ritenuta d */ -// Iva +// Costo unitario echo '
    - {[ "type": "select", "label": "'.tr('Iva').'", "name": "idiva", "required": 1, "value": "'.$idiva.'", "values": "query=SELECT * FROM co_iva ORDER BY descrizione ASC" ]} -
    '; - -// Costo unitario -echo ' -
    {[ "type": "number", "label": "'.tr('Costo unitario').'", "name": "prezzo", "required": 1, "value": "'.$subtot.'", "icon-after": "€" ]}
    '; // Sconto unitario echo ' -
    +
    {[ "type": "number", "label": "'.tr('Sconto unitario').'", "name": "sconto", "value": "'.$sconto.'", "icon-after": "choice|untprc|'.$tipo_sconto.'" ]}
    '; diff --git a/pdfgen.php b/pdfgen.php index b8206158f..7b7c1c9cc 100644 --- a/pdfgen.php +++ b/pdfgen.php @@ -2,8 +2,11 @@ include_once __DIR__.'/core.php'; +ob_end_clean(); + $orientation = 'P'; $body_table_params = "style='width:210mm;'"; +$table = 'margin-left:1.7mm'; $font_size = '10pt'; // Assegnazione di tutte le variabile GET @@ -16,13 +19,21 @@ $visualizza_costi = get_var('Visualizza i costi sulle stampe degli interventi'); // Nuovo sistema di generazione stampe if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { - // Impostazione della stampa - if (file_exists($docroot.'/templates/'.$ptype.'/custom/layout.html')) { - $report = file_get_contents($docroot.'/templates/'.$ptype.'/custom/layout.html'); + // Impostazioni della stampa + if (file_exists($docroot.'/templates/base/custom/settings.php')) { + $default = include $docroot.'/templates/base/custom/settings.php'; } else { - $report = file_get_contents($docroot.'/templates/'.$ptype.'/layout.html'); + $default = include $docroot.'/templates/base/settings.php'; } + if (file_exists($docroot.'/templates/'.$ptype.'/custom/settings.php')) { + $custom = include $docroot.'/templates/'.$ptype.'/custom/settings.php'; + } elseif (file_exists($docroot.'/templates/'.$ptype.'/settings.php')) { + $custom = include $docroot.'/templates/'.$ptype.'/settings.php'; + } + + $settings = array_merge($default, (array) $custom); + // Individuazione delle variabili fondamentali per la sostituzione dei contenuti if (file_exists($docroot.'/templates/'.$ptype.'/custom/init.php')) { include $docroot.'/templates/'.$ptype.'/custom/init.php'; @@ -35,14 +46,35 @@ if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { } Permissions::check(); - // Operazioni di sostituzione - include $docroot.'/templates/pdfgen_variables.php'; - - // Azioni sui contenuti della stampa - if (file_exists($docroot.'/templates/'.$ptype.'/custom/actions.php')) { - include $docroot.'/templates/'.$ptype.'/custom/actions.php'; + // Generazione dei contenuti della stampa + ob_start(); + if (file_exists($docroot.'/templates/'.$ptype.'/custom/body.php')) { + include $docroot.'/templates/'.$ptype.'/custom/body.php'; } else { - include $docroot.'/templates/'.$ptype.'/actions.php'; + include $docroot.'/templates/'.$ptype.'/body.php'; + } + $report = ob_get_clean(); + + // Generazione dei contenuti dell'header + ob_start(); + if (file_exists($docroot.'/templates/'.$ptype.'/custom/header.php')) { + include $docroot.'/templates/'.$ptype.'/custom/header.php'; + } elseif (file_exists($docroot.'/templates/'.$ptype.'/header.php')) { + include $docroot.'/templates/'.$ptype.'/header.php'; + } + $head = ob_get_clean(); + + // Generazione dei contenuti del footer + ob_start(); + if (file_exists($docroot.'/templates/'.$ptype.'/custom/footer.php')) { + include $docroot.'/templates/'.$ptype.'/custom/footer.php'; + } elseif (file_exists($docroot.'/templates/'.$ptype.'/footer.php')) { + include $docroot.'/templates/'.$ptype.'/footer.php'; + } + $foot = ob_get_clean(); + + if (empty($foot)) { + $foot = '$pagination$'; } } else { // Decido se usare la stampa personalizzata (se esiste) oppure quella standard @@ -52,16 +84,17 @@ if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { include $docroot.'/templates/'.$ptype.'/pdfgen.'.$ptype.'.php'; } - // Operazioni di sostituzione - include $docroot.'/templates/pdfgen_variables.php'; + // Sostituzione di variabili generiche + $report = str_replace('$body$', $body, $report); + $report = str_replace('$footer$', $footer, $report); + + $report = str_replace('$font_size$', $font_size, $report); + $report = str_replace('$body_table_params$', $body_table_params, $report); + $report = str_replace('$table$', $table, $report); } -// Sostituzione di variabili generiche -$report = str_replace('$body$', $body, $report); -$report = str_replace('$footer$', $footer, $report); - -$report = str_replace('$font_size$', $font_size, $report); -$report = str_replace('$body_table_params$', $body_table_params, $report); +// Operazioni di sostituzione +include $docroot.'/templates/pdfgen_variables.php'; $report = str_replace('$docroot$', $docroot, $report); $report = str_replace('$rootdir$', $rootdir, $report); @@ -84,18 +117,38 @@ $mode = !empty($filename) ? 'F' : 'I'; $filename = !empty($filename) ? $filename : sanitizeFilename($report_name); $title = basename($filename); -// HTML -$html = (get_var('Formato report') == 'html'); +if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { + $styles = [ + 'templates/base/bootstrap.css', + 'templates/base/style.css', + ]; -try { - ob_end_clean(); - $html2pdf = new HTML2PDF($orientation, 'A4', 'it', true, 'UTF-8'); + $mpdf = new mPDF('utf-8', $settings['dimension'], $settings['font-size'], '', 12, 12, $settings['header'], $settings['footer'], 9, 9, $settings['orientation']); + $mpdf->SetHTMLFooter($foot); + $mpdf->SetHTMLHeader($head); - $html2pdf->writeHTML($report, $html); - $html2pdf->pdf->setTitle($title); + $mpdf->SetTitle($title); - $html2pdf->output($filename, $mode); -} catch (HTML2PDF_exception $e) { - echo $e; - exit(); + foreach ($styles as $value) { + $mpdf->WriteHTML(file_get_contents(__DIR__.'/'.$value), 1); + } + $mpdf->WriteHTML($report); + + $mpdf->Output($filename, $mode); +} else { + // HTML + $html = (get_var('Formato report') == 'html'); + + try { + ob_end_clean(); + $html2pdf = new HTML2PDF($orientation, 'A4', 'it', true, 'UTF-8'); + + $html2pdf->writeHTML($report, $html); + $html2pdf->pdf->setTitle($title); + + $html2pdf->output($filename, $mode); + } catch (HTML2PDF_exception $e) { + echo $e; + exit(); + } } diff --git a/plugin_editor.php b/plugin_editor.php index b9713c122..a58f61f43 100644 --- a/plugin_editor.php +++ b/plugin_editor.php @@ -56,19 +56,7 @@ if (!empty($info['script'])) { } } - $backto = filter('backto'); - // Scelta del redirect dopo un submit - if (!empty($backto)) { - $hash = filter('hash'); - $hash = !starts_with($hash, '#') ? '#'.$hash : $hash; - if ($backto == 'record-edit') { - redirect($rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_parent.$hash); - exit(); - } elseif ($backto == 'record-list') { - redirect($rootdir.'/controller.php?id_module='.$id_module.$hash); - exit(); - } - } + redirectOperation(); $module = Modules::getModule($info['idmodule_to']); diff --git a/templates/base/bootstrap.css b/templates/base/bootstrap.css new file mode 100644 index 000000000..251961e5a --- /dev/null +++ b/templates/base/bootstrap.css @@ -0,0 +1,1826 @@ +/*! + * Bootstrap v3.3.7 (http://getbootstrap.com) + * Copyright 2011-2017 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +/*! + * Generated using the Bootstrap Customizer (https://getbootstrap.com/docs/3.3/customize/?id=958fac01c3610bf1e17a88242fb98ad9) + * Config saved to config.json and https://gist.github.com/958fac01c3610bf1e17a88242fb98ad9 + */ +/*! + * Bootstrap v3.3.7 (http://getbootstrap.com) + * Copyright 2011-2016 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + } + body { + margin: 0; + } + article, + aside, + details, + figcaption, + figure, + footer, + header, + hgroup, + main, + menu, + nav, + section, + summary { + display: block; + } + audio, + canvas, + progress, + video { + display: inline-block; + vertical-align: baseline; + } + audio:not([controls]) { + display: none; + height: 0; + } + [hidden], + template { + display: none; + } + a { + background-color: transparent; + } + a:active, + a:hover { + outline: 0; + } + abbr[title] { + border-bottom: 1px dotted; + } + b, + strong { + font-weight: bold; + } + dfn { + font-style: italic; + } + h1 { + font-size: 2em; + margin: 0.67em 0; + } + mark { + background: #ff0; + color: #000; + } + small { + font-size: 80%; + } + sub, + sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + sup { + top: -0.5em; + } + sub { + bottom: -0.25em; + } + img { + border: 0; + } + svg:not(:root) { + overflow: hidden; + } + figure { + margin: 1em 40px; + } + hr { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; + } + pre { + overflow: auto; + } + code, + kbd, + pre, + samp { + font-family: monospace, monospace; + font-size: 1em; + } + button, + input, + optgroup, + select, + textarea { + color: inherit; + font: inherit; + margin: 0; + } + button { + overflow: visible; + } + button, + select { + text-transform: none; + } + button, + html input[type="button"], + input[type="reset"], + input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; + } + button[disabled], + html input[disabled] { + cursor: default; + } + button::-moz-focus-inner, + input::-moz-focus-inner { + border: 0; + padding: 0; + } + input { + line-height: normal; + } + input[type="checkbox"], + input[type="radio"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; + } + input[type="number"]::-webkit-inner-spin-button, + input[type="number"]::-webkit-outer-spin-button { + height: auto; + } + input[type="search"] { + -webkit-appearance: textfield; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + } + input[type="search"]::-webkit-search-cancel-button, + input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; + } + fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; + } + legend { + border: 0; + padding: 0; + } + textarea { + overflow: auto; + } + optgroup { + font-weight: bold; + } + table { + border-collapse: collapse; + border-spacing: 0; + } + td, + th { + padding: 0; + } + * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + *:before, + *:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + html { + font-size: 10px; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + } + body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333333; + background-color: #ffffff; + } + input, + button, + select, + textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; + } + a { + color: #337ab7; + text-decoration: none; + } + a:hover, + a:focus { + color: #23527c; + text-decoration: underline; + } + a:focus { + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + } + figure { + margin: 0; + } + img { + vertical-align: middle; + } + .img-responsive { + display: block; + max-width: 100%; + height: auto; + } + .img-rounded { + border-radius: 6px; + } + .img-thumbnail { + padding: 4px; + line-height: 1.42857143; + background-color: #ffffff; + border: 1px solid #dddddd; + border-radius: 4px; + -webkit-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; + display: inline-block; + max-width: 100%; + height: auto; + } + .img-circle { + border-radius: 50%; + } + hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eeeeee; + } + .sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; + } + .sr-only-focusable:active, + .sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; + } + [role="button"] { + cursor: pointer; + } + h1, + h2, + h3, + h4, + h5, + h6, + .h1, + .h2, + .h3, + .h4, + .h5, + .h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; + } + h1 small, + h2 small, + h3 small, + h4 small, + h5 small, + h6 small, + .h1 small, + .h2 small, + .h3 small, + .h4 small, + .h5 small, + .h6 small, + h1 .small, + h2 .small, + h3 .small, + h4 .small, + h5 .small, + h6 .small, + .h1 .small, + .h2 .small, + .h3 .small, + .h4 .small, + .h5 .small, + .h6 .small { + font-weight: normal; + line-height: 1; + color: #777777; + } + h1, + .h1, + h2, + .h2, + h3, + .h3 { + margin-top: 20px; + margin-bottom: 10px; + } + h1 small, + .h1 small, + h2 small, + .h2 small, + h3 small, + .h3 small, + h1 .small, + .h1 .small, + h2 .small, + .h2 .small, + h3 .small, + .h3 .small { + font-size: 65%; + } + h4, + .h4, + h5, + .h5, + h6, + .h6 { + margin-top: 10px; + margin-bottom: 10px; + } + h4 small, + .h4 small, + h5 small, + .h5 small, + h6 small, + .h6 small, + h4 .small, + .h4 .small, + h5 .small, + .h5 .small, + h6 .small, + .h6 .small { + font-size: 75%; + } + h1, + .h1 { + font-size: 36px; + } + h2, + .h2 { + font-size: 30px; + } + h3, + .h3 { + font-size: 24px; + } + h4, + .h4 { + font-size: 18px; + } + h5, + .h5 { + font-size: 14px; + } + h6, + .h6 { + font-size: 12px; + } + p { + margin: 0 0 10px; + } + .lead { + margin-bottom: 20px; + font-size: 16px; + font-weight: 300; + line-height: 1.4; + } + @media (min-width: 768px) { + .lead { + font-size: 21px; + } + } + small, + .small { + font-size: 85%; + } + mark, + .mark { + background-color: #fcf8e3; + padding: .2em; + } + .text-left { + text-align: left; + } + .text-right { + text-align: right; + } + .text-center { + text-align: center; + } + .text-justify { + text-align: justify; + } + .text-nowrap { + white-space: nowrap; + } + .text-lowercase { + text-transform: lowercase; + } + .text-uppercase { + text-transform: uppercase; + } + .text-capitalize { + text-transform: capitalize; + } + .text-muted { + color: #777777; + } + .text-primary { + color: #337ab7; + } + a.text-primary:hover, + a.text-primary:focus { + color: #286090; + } + .text-success { + color: #3c763d; + } + a.text-success:hover, + a.text-success:focus { + color: #2b542c; + } + .text-info { + color: #31708f; + } + a.text-info:hover, + a.text-info:focus { + color: #245269; + } + .text-warning { + color: #8a6d3b; + } + a.text-warning:hover, + a.text-warning:focus { + color: #66512c; + } + .text-danger { + color: #a94442; + } + a.text-danger:hover, + a.text-danger:focus { + color: #843534; + } + .bg-primary { + color: #fff; + background-color: #337ab7; + } + a.bg-primary:hover, + a.bg-primary:focus { + background-color: #286090; + } + .bg-success { + background-color: #dff0d8; + } + a.bg-success:hover, + a.bg-success:focus { + background-color: #c1e2b3; + } + .bg-info { + background-color: #d9edf7; + } + a.bg-info:hover, + a.bg-info:focus { + background-color: #afd9ee; + } + .bg-warning { + background-color: #fcf8e3; + } + a.bg-warning:hover, + a.bg-warning:focus { + background-color: #f7ecb5; + } + .bg-danger { + background-color: #f2dede; + } + a.bg-danger:hover, + a.bg-danger:focus { + background-color: #e4b9b9; + } + .page-header { + padding-bottom: 9px; + margin: 40px 0 20px; + border-bottom: 1px solid #eeeeee; + } + ul, + ol { + margin-top: 0; + margin-bottom: 10px; + } + ul ul, + ol ul, + ul ol, + ol ol { + margin-bottom: 0; + } + .list-unstyled { + padding-left: 0; + list-style: none; + } + .list-inline { + padding-left: 0; + list-style: none; + margin-left: -5px; + } + .list-inline > li { + display: inline-block; + padding-left: 5px; + padding-right: 5px; + } + dl { + margin-top: 0; + margin-bottom: 20px; + } + dt, + dd { + line-height: 1.42857143; + } + dt { + font-weight: bold; + } + dd { + margin-left: 0; + } + @media (min-width: 768px) { + .dl-horizontal dt { + float: left; + width: 160px; + clear: left; + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .dl-horizontal dd { + margin-left: 180px; + } + } + abbr[title], + abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted #777777; + } + .initialism { + font-size: 90%; + text-transform: uppercase; + } + blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eeeeee; + } + blockquote p:last-child, + blockquote ul:last-child, + blockquote ol:last-child { + margin-bottom: 0; + } + blockquote footer, + blockquote small, + blockquote .small { + display: block; + font-size: 80%; + line-height: 1.42857143; + color: #777777; + } + blockquote footer:before, + blockquote small:before, + blockquote .small:before { + content: '\2014 \00A0'; + } + .blockquote-reverse, + blockquote.pull-right { + padding-right: 15px; + padding-left: 0; + border-right: 5px solid #eeeeee; + border-left: 0; + text-align: right; + } + .blockquote-reverse footer:before, + blockquote.pull-right footer:before, + .blockquote-reverse small:before, + blockquote.pull-right small:before, + .blockquote-reverse .small:before, + blockquote.pull-right .small:before { + content: ''; + } + .blockquote-reverse footer:after, + blockquote.pull-right footer:after, + .blockquote-reverse small:after, + blockquote.pull-right small:after, + .blockquote-reverse .small:after, + blockquote.pull-right .small:after { + content: '\00A0 \2014'; + } + address { + margin-bottom: 20px; + font-style: normal; + line-height: 1.42857143; + } + .container { + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; + } + @media (min-width: 768px) { + .container { + width: 750px; + } + } + @media (min-width: 992px) { + .container { + width: 970px; + } + } + @media (min-width: 1200px) { + .container { + width: 1170px; + } + } + .container-fluid { + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; + } + .row { + margin-left: -15px; + margin-right: -15px; + } + .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-left: 15px; + padding-right: 15px; + } + .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: left; + } + .col-xs-12 { + width: 100%; + } + .col-xs-11 { + width: 91.66666667%; + } + .col-xs-10 { + width: 83.33333333%; + } + .col-xs-9 { + width: 75%; + } + .col-xs-8 { + width: 66.66666667%; + } + .col-xs-7 { + width: 58.33333333%; + } + .col-xs-6 { + width: 50%; + } + .col-xs-5 { + width: 41.66666667%; + } + .col-xs-4 { + width: 33.33333333%; + } + .col-xs-3 { + width: 25%; + } + .col-xs-2 { + width: 16.66666667%; + } + .col-xs-1 { + width: 8.33333333%; + } + .col-xs-pull-12 { + right: 100%; + } + .col-xs-pull-11 { + right: 91.66666667%; + } + .col-xs-pull-10 { + right: 83.33333333%; + } + .col-xs-pull-9 { + right: 75%; + } + .col-xs-pull-8 { + right: 66.66666667%; + } + .col-xs-pull-7 { + right: 58.33333333%; + } + .col-xs-pull-6 { + right: 50%; + } + .col-xs-pull-5 { + right: 41.66666667%; + } + .col-xs-pull-4 { + right: 33.33333333%; + } + .col-xs-pull-3 { + right: 25%; + } + .col-xs-pull-2 { + right: 16.66666667%; + } + .col-xs-pull-1 { + right: 8.33333333%; + } + .col-xs-pull-0 { + right: auto; + } + .col-xs-push-12 { + left: 100%; + } + .col-xs-push-11 { + left: 91.66666667%; + } + .col-xs-push-10 { + left: 83.33333333%; + } + .col-xs-push-9 { + left: 75%; + } + .col-xs-push-8 { + left: 66.66666667%; + } + .col-xs-push-7 { + left: 58.33333333%; + } + .col-xs-push-6 { + left: 50%; + } + .col-xs-push-5 { + left: 41.66666667%; + } + .col-xs-push-4 { + left: 33.33333333%; + } + .col-xs-push-3 { + left: 25%; + } + .col-xs-push-2 { + left: 16.66666667%; + } + .col-xs-push-1 { + left: 8.33333333%; + } + .col-xs-push-0 { + left: auto; + } + .col-xs-offset-12 { + margin-left: 100%; + } + .col-xs-offset-11 { + margin-left: 91.66666667%; + } + .col-xs-offset-10 { + margin-left: 83.33333333%; + } + .col-xs-offset-9 { + margin-left: 75%; + } + .col-xs-offset-8 { + margin-left: 66.66666667%; + } + .col-xs-offset-7 { + margin-left: 58.33333333%; + } + .col-xs-offset-6 { + margin-left: 50%; + } + .col-xs-offset-5 { + margin-left: 41.66666667%; + } + .col-xs-offset-4 { + margin-left: 33.33333333%; + } + .col-xs-offset-3 { + margin-left: 25%; + } + .col-xs-offset-2 { + margin-left: 16.66666667%; + } + .col-xs-offset-1 { + margin-left: 8.33333333%; + } + .col-xs-offset-0 { + margin-left: 0%; + } + @media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: left; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666667%; + } + .col-sm-10 { + width: 83.33333333%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666667%; + } + .col-sm-7 { + width: 58.33333333%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666667%; + } + .col-sm-4 { + width: 33.33333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.66666667%; + } + .col-sm-1 { + width: 8.33333333%; + } + .col-sm-pull-12 { + right: 100%; + } + .col-sm-pull-11 { + right: 91.66666667%; + } + .col-sm-pull-10 { + right: 83.33333333%; + } + .col-sm-pull-9 { + right: 75%; + } + .col-sm-pull-8 { + right: 66.66666667%; + } + .col-sm-pull-7 { + right: 58.33333333%; + } + .col-sm-pull-6 { + right: 50%; + } + .col-sm-pull-5 { + right: 41.66666667%; + } + .col-sm-pull-4 { + right: 33.33333333%; + } + .col-sm-pull-3 { + right: 25%; + } + .col-sm-pull-2 { + right: 16.66666667%; + } + .col-sm-pull-1 { + right: 8.33333333%; + } + .col-sm-pull-0 { + right: auto; + } + .col-sm-push-12 { + left: 100%; + } + .col-sm-push-11 { + left: 91.66666667%; + } + .col-sm-push-10 { + left: 83.33333333%; + } + .col-sm-push-9 { + left: 75%; + } + .col-sm-push-8 { + left: 66.66666667%; + } + .col-sm-push-7 { + left: 58.33333333%; + } + .col-sm-push-6 { + left: 50%; + } + .col-sm-push-5 { + left: 41.66666667%; + } + .col-sm-push-4 { + left: 33.33333333%; + } + .col-sm-push-3 { + left: 25%; + } + .col-sm-push-2 { + left: 16.66666667%; + } + .col-sm-push-1 { + left: 8.33333333%; + } + .col-sm-push-0 { + left: auto; + } + .col-sm-offset-12 { + margin-left: 100%; + } + .col-sm-offset-11 { + margin-left: 91.66666667%; + } + .col-sm-offset-10 { + margin-left: 83.33333333%; + } + .col-sm-offset-9 { + margin-left: 75%; + } + .col-sm-offset-8 { + margin-left: 66.66666667%; + } + .col-sm-offset-7 { + margin-left: 58.33333333%; + } + .col-sm-offset-6 { + margin-left: 50%; + } + .col-sm-offset-5 { + margin-left: 41.66666667%; + } + .col-sm-offset-4 { + margin-left: 33.33333333%; + } + .col-sm-offset-3 { + margin-left: 25%; + } + .col-sm-offset-2 { + margin-left: 16.66666667%; + } + .col-sm-offset-1 { + margin-left: 8.33333333%; + } + .col-sm-offset-0 { + margin-left: 0%; + } + } + @media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: left; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666667%; + } + .col-md-10 { + width: 83.33333333%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666667%; + } + .col-md-7 { + width: 58.33333333%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666667%; + } + .col-md-4 { + width: 33.33333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.66666667%; + } + .col-md-1 { + width: 8.33333333%; + } + .col-md-pull-12 { + right: 100%; + } + .col-md-pull-11 { + right: 91.66666667%; + } + .col-md-pull-10 { + right: 83.33333333%; + } + .col-md-pull-9 { + right: 75%; + } + .col-md-pull-8 { + right: 66.66666667%; + } + .col-md-pull-7 { + right: 58.33333333%; + } + .col-md-pull-6 { + right: 50%; + } + .col-md-pull-5 { + right: 41.66666667%; + } + .col-md-pull-4 { + right: 33.33333333%; + } + .col-md-pull-3 { + right: 25%; + } + .col-md-pull-2 { + right: 16.66666667%; + } + .col-md-pull-1 { + right: 8.33333333%; + } + .col-md-pull-0 { + right: auto; + } + .col-md-push-12 { + left: 100%; + } + .col-md-push-11 { + left: 91.66666667%; + } + .col-md-push-10 { + left: 83.33333333%; + } + .col-md-push-9 { + left: 75%; + } + .col-md-push-8 { + left: 66.66666667%; + } + .col-md-push-7 { + left: 58.33333333%; + } + .col-md-push-6 { + left: 50%; + } + .col-md-push-5 { + left: 41.66666667%; + } + .col-md-push-4 { + left: 33.33333333%; + } + .col-md-push-3 { + left: 25%; + } + .col-md-push-2 { + left: 16.66666667%; + } + .col-md-push-1 { + left: 8.33333333%; + } + .col-md-push-0 { + left: auto; + } + .col-md-offset-12 { + margin-left: 100%; + } + .col-md-offset-11 { + margin-left: 91.66666667%; + } + .col-md-offset-10 { + margin-left: 83.33333333%; + } + .col-md-offset-9 { + margin-left: 75%; + } + .col-md-offset-8 { + margin-left: 66.66666667%; + } + .col-md-offset-7 { + margin-left: 58.33333333%; + } + .col-md-offset-6 { + margin-left: 50%; + } + .col-md-offset-5 { + margin-left: 41.66666667%; + } + .col-md-offset-4 { + margin-left: 33.33333333%; + } + .col-md-offset-3 { + margin-left: 25%; + } + .col-md-offset-2 { + margin-left: 16.66666667%; + } + .col-md-offset-1 { + margin-left: 8.33333333%; + } + .col-md-offset-0 { + margin-left: 0%; + } + } + @media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: left; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666667%; + } + .col-lg-10 { + width: 83.33333333%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666667%; + } + .col-lg-7 { + width: 58.33333333%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666667%; + } + .col-lg-4 { + width: 33.33333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.66666667%; + } + .col-lg-1 { + width: 8.33333333%; + } + .col-lg-pull-12 { + right: 100%; + } + .col-lg-pull-11 { + right: 91.66666667%; + } + .col-lg-pull-10 { + right: 83.33333333%; + } + .col-lg-pull-9 { + right: 75%; + } + .col-lg-pull-8 { + right: 66.66666667%; + } + .col-lg-pull-7 { + right: 58.33333333%; + } + .col-lg-pull-6 { + right: 50%; + } + .col-lg-pull-5 { + right: 41.66666667%; + } + .col-lg-pull-4 { + right: 33.33333333%; + } + .col-lg-pull-3 { + right: 25%; + } + .col-lg-pull-2 { + right: 16.66666667%; + } + .col-lg-pull-1 { + right: 8.33333333%; + } + .col-lg-pull-0 { + right: auto; + } + .col-lg-push-12 { + left: 100%; + } + .col-lg-push-11 { + left: 91.66666667%; + } + .col-lg-push-10 { + left: 83.33333333%; + } + .col-lg-push-9 { + left: 75%; + } + .col-lg-push-8 { + left: 66.66666667%; + } + .col-lg-push-7 { + left: 58.33333333%; + } + .col-lg-push-6 { + left: 50%; + } + .col-lg-push-5 { + left: 41.66666667%; + } + .col-lg-push-4 { + left: 33.33333333%; + } + .col-lg-push-3 { + left: 25%; + } + .col-lg-push-2 { + left: 16.66666667%; + } + .col-lg-push-1 { + left: 8.33333333%; + } + .col-lg-push-0 { + left: auto; + } + .col-lg-offset-12 { + margin-left: 100%; + } + .col-lg-offset-11 { + margin-left: 91.66666667%; + } + .col-lg-offset-10 { + margin-left: 83.33333333%; + } + .col-lg-offset-9 { + margin-left: 75%; + } + .col-lg-offset-8 { + margin-left: 66.66666667%; + } + .col-lg-offset-7 { + margin-left: 58.33333333%; + } + .col-lg-offset-6 { + margin-left: 50%; + } + .col-lg-offset-5 { + margin-left: 41.66666667%; + } + .col-lg-offset-4 { + margin-left: 33.33333333%; + } + .col-lg-offset-3 { + margin-left: 25%; + } + .col-lg-offset-2 { + margin-left: 16.66666667%; + } + .col-lg-offset-1 { + margin-left: 8.33333333%; + } + .col-lg-offset-0 { + margin-left: 0%; + } + } + table { + background-color: transparent; + } + caption { + padding-top: 8px; + padding-bottom: 8px; + color: #777777; + text-align: left; + } + th { + text-align: left; + } + .table { + width: 100%; + max-width: 100%; + margin-bottom: 20px; + } + .table > thead > tr > th, + .table > tbody > tr > th, + .table > tfoot > tr > th, + .table > thead > tr > td, + .table > tbody > tr > td, + .table > tfoot > tr > td { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #dddddd; + } + .table > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #dddddd; + } + .table > caption + thead > tr:first-child > th, + .table > colgroup + thead > tr:first-child > th, + .table > thead:first-child > tr:first-child > th, + .table > caption + thead > tr:first-child > td, + .table > colgroup + thead > tr:first-child > td, + .table > thead:first-child > tr:first-child > td { + border-top: 0; + } + .table > tbody + tbody { + border-top: 2px solid #dddddd; + } + .table .table { + background-color: #ffffff; + } + .table-condensed > thead > tr > th, + .table-condensed > tbody > tr > th, + .table-condensed > tfoot > tr > th, + .table-condensed > thead > tr > td, + .table-condensed > tbody > tr > td, + .table-condensed > tfoot > tr > td { + padding: 5px; + } + .table-bordered { + border: 1px solid #dddddd; + } + .table-bordered > thead > tr > th, + .table-bordered > tbody > tr > th, + .table-bordered > tfoot > tr > th, + .table-bordered > thead > tr > td, + .table-bordered > tbody > tr > td, + .table-bordered > tfoot > tr > td { + border: 1px solid #dddddd; + } + .table-bordered > thead > tr > th, + .table-bordered > thead > tr > td { + border-bottom-width: 2px; + } + .table-striped > tbody > tr:nth-of-type(odd) { + background-color: #f9f9f9; + } + .table-hover > tbody > tr:hover { + background-color: #f5f5f5; + } + table col[class*="col-"] { + position: static; + float: none; + display: table-column; + } + table td[class*="col-"], + table th[class*="col-"] { + position: static; + float: none; + display: table-cell; + } + .table > thead > tr > td.active, + .table > tbody > tr > td.active, + .table > tfoot > tr > td.active, + .table > thead > tr > th.active, + .table > tbody > tr > th.active, + .table > tfoot > tr > th.active, + .table > thead > tr.active > td, + .table > tbody > tr.active > td, + .table > tfoot > tr.active > td, + .table > thead > tr.active > th, + .table > tbody > tr.active > th, + .table > tfoot > tr.active > th { + background-color: #f5f5f5; + } + .table-hover > tbody > tr > td.active:hover, + .table-hover > tbody > tr > th.active:hover, + .table-hover > tbody > tr.active:hover > td, + .table-hover > tbody > tr:hover > .active, + .table-hover > tbody > tr.active:hover > th { + background-color: #e8e8e8; + } + .table > thead > tr > td.success, + .table > tbody > tr > td.success, + .table > tfoot > tr > td.success, + .table > thead > tr > th.success, + .table > tbody > tr > th.success, + .table > tfoot > tr > th.success, + .table > thead > tr.success > td, + .table > tbody > tr.success > td, + .table > tfoot > tr.success > td, + .table > thead > tr.success > th, + .table > tbody > tr.success > th, + .table > tfoot > tr.success > th { + background-color: #dff0d8; + } + .table-hover > tbody > tr > td.success:hover, + .table-hover > tbody > tr > th.success:hover, + .table-hover > tbody > tr.success:hover > td, + .table-hover > tbody > tr:hover > .success, + .table-hover > tbody > tr.success:hover > th { + background-color: #d0e9c6; + } + .table > thead > tr > td.info, + .table > tbody > tr > td.info, + .table > tfoot > tr > td.info, + .table > thead > tr > th.info, + .table > tbody > tr > th.info, + .table > tfoot > tr > th.info, + .table > thead > tr.info > td, + .table > tbody > tr.info > td, + .table > tfoot > tr.info > td, + .table > thead > tr.info > th, + .table > tbody > tr.info > th, + .table > tfoot > tr.info > th { + background-color: #d9edf7; + } + .table-hover > tbody > tr > td.info:hover, + .table-hover > tbody > tr > th.info:hover, + .table-hover > tbody > tr.info:hover > td, + .table-hover > tbody > tr:hover > .info, + .table-hover > tbody > tr.info:hover > th { + background-color: #c4e3f3; + } + .table > thead > tr > td.warning, + .table > tbody > tr > td.warning, + .table > tfoot > tr > td.warning, + .table > thead > tr > th.warning, + .table > tbody > tr > th.warning, + .table > tfoot > tr > th.warning, + .table > thead > tr.warning > td, + .table > tbody > tr.warning > td, + .table > tfoot > tr.warning > td, + .table > thead > tr.warning > th, + .table > tbody > tr.warning > th, + .table > tfoot > tr.warning > th { + background-color: #fcf8e3; + } + .table-hover > tbody > tr > td.warning:hover, + .table-hover > tbody > tr > th.warning:hover, + .table-hover > tbody > tr.warning:hover > td, + .table-hover > tbody > tr:hover > .warning, + .table-hover > tbody > tr.warning:hover > th { + background-color: #faf2cc; + } + .table > thead > tr > td.danger, + .table > tbody > tr > td.danger, + .table > tfoot > tr > td.danger, + .table > thead > tr > th.danger, + .table > tbody > tr > th.danger, + .table > tfoot > tr > th.danger, + .table > thead > tr.danger > td, + .table > tbody > tr.danger > td, + .table > tfoot > tr.danger > td, + .table > thead > tr.danger > th, + .table > tbody > tr.danger > th, + .table > tfoot > tr.danger > th { + background-color: #f2dede; + } + .table-hover > tbody > tr > td.danger:hover, + .table-hover > tbody > tr > th.danger:hover, + .table-hover > tbody > tr.danger:hover > td, + .table-hover > tbody > tr:hover > .danger, + .table-hover > tbody > tr.danger:hover > th { + background-color: #ebcccc; + } + .table-responsive { + overflow-x: auto; + min-height: 0.01%; + } + @media screen and (max-width: 767px) { + .table-responsive { + width: 100%; + margin-bottom: 15px; + overflow-y: hidden; + -ms-overflow-style: -ms-autohiding-scrollbar; + border: 1px solid #dddddd; + } + .table-responsive > .table { + margin-bottom: 0; + } + .table-responsive > .table > thead > tr > th, + .table-responsive > .table > tbody > tr > th, + .table-responsive > .table > tfoot > tr > th, + .table-responsive > .table > thead > tr > td, + .table-responsive > .table > tbody > tr > td, + .table-responsive > .table > tfoot > tr > td { + white-space: nowrap; + } + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; + } + .table-responsive > .table-bordered > tbody > tr:last-child > th, + .table-responsive > .table-bordered > tfoot > tr:last-child > th, + .table-responsive > .table-bordered > tbody > tr:last-child > td, + .table-responsive > .table-bordered > tfoot > tr:last-child > td { + border-bottom: 0; + } + } + .clearfix:before, + .clearfix:after, + .dl-horizontal dd:before, + .dl-horizontal dd:after, + .container:before, + .container:after, + .container-fluid:before, + .container-fluid:after, + .row:before, + .row:after { + content: " "; + display: table; + } + .clearfix:after, + .dl-horizontal dd:after, + .container:after, + .container-fluid:after, + .row:after { + clear: both; + } + .center-block { + display: block; + margin-left: auto; + margin-right: auto; + } + .pull-right { + float: right !important; + } + .pull-left { + float: left !important; + } + .hide { + display: none !important; + } + .show { + display: block !important; + } + .invisible { + visibility: hidden; + } + .text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; + } + .hidden { + display: none !important; + } + .affix { + position: fixed; + } + @-ms-viewport { + width: device-width; + } + .visible-xs, + .visible-sm, + .visible-md, + .visible-lg { + display: none !important; + } + .visible-xs-block, + .visible-xs-inline, + .visible-xs-inline-block, + .visible-sm-block, + .visible-sm-inline, + .visible-sm-inline-block, + .visible-md-block, + .visible-md-inline, + .visible-md-inline-block, + .visible-lg-block, + .visible-lg-inline, + .visible-lg-inline-block { + display: none !important; + } + @media (max-width: 767px) { + .visible-xs { + display: block !important; + } + table.visible-xs { + display: table !important; + } + tr.visible-xs { + display: table-row !important; + } + th.visible-xs, + td.visible-xs { + display: table-cell !important; + } + } + @media (max-width: 767px) { + .visible-xs-block { + display: block !important; + } + } + @media (max-width: 767px) { + .visible-xs-inline { + display: inline !important; + } + } + @media (max-width: 767px) { + .visible-xs-inline-block { + display: inline-block !important; + } + } + @media (min-width: 768px) and (max-width: 991px) { + .visible-sm { + display: block !important; + } + table.visible-sm { + display: table !important; + } + tr.visible-sm { + display: table-row !important; + } + th.visible-sm, + td.visible-sm { + display: table-cell !important; + } + } + @media (min-width: 768px) and (max-width: 991px) { + .visible-sm-block { + display: block !important; + } + } + @media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline { + display: inline !important; + } + } + @media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline-block { + display: inline-block !important; + } + } + @media (min-width: 992px) and (max-width: 1199px) { + .visible-md { + display: block !important; + } + table.visible-md { + display: table !important; + } + tr.visible-md { + display: table-row !important; + } + th.visible-md, + td.visible-md { + display: table-cell !important; + } + } + @media (min-width: 992px) and (max-width: 1199px) { + .visible-md-block { + display: block !important; + } + } + @media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline { + display: inline !important; + } + } + @media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline-block { + display: inline-block !important; + } + } + @media (min-width: 1200px) { + .visible-lg { + display: block !important; + } + table.visible-lg { + display: table !important; + } + tr.visible-lg { + display: table-row !important; + } + th.visible-lg, + td.visible-lg { + display: table-cell !important; + } + } + @media (min-width: 1200px) { + .visible-lg-block { + display: block !important; + } + } + @media (min-width: 1200px) { + .visible-lg-inline { + display: inline !important; + } + } + @media (min-width: 1200px) { + .visible-lg-inline-block { + display: inline-block !important; + } + } + @media (max-width: 767px) { + .hidden-xs { + display: none !important; + } + } + @media (min-width: 768px) and (max-width: 991px) { + .hidden-sm { + display: none !important; + } + } + @media (min-width: 992px) and (max-width: 1199px) { + .hidden-md { + display: none !important; + } + } + @media (min-width: 1200px) { + .hidden-lg { + display: none !important; + } + } + .visible-print { + display: none !important; + } + @media print { + .visible-print { + display: block !important; + } + table.visible-print { + display: table !important; + } + tr.visible-print { + display: table-row !important; + } + th.visible-print, + td.visible-print { + display: table-cell !important; + } + } + .visible-print-block { + display: none !important; + } + @media print { + .visible-print-block { + display: block !important; + } + } + .visible-print-inline { + display: none !important; + } + @media print { + .visible-print-inline { + display: inline !important; + } + } + .visible-print-inline-block { + display: none !important; + } + @media print { + .visible-print-inline-block { + display: inline-block !important; + } + } + @media print { + .hidden-print { + display: none !important; + } + } diff --git a/templates/base/settings.php b/templates/base/settings.php new file mode 100644 index 000000000..68e1c8301 --- /dev/null +++ b/templates/base/settings.php @@ -0,0 +1,9 @@ + 'portrait', + 'dimension' => 'A4', + 'font-size' => '11pt', + 'header' => '40', + 'footer' => '5', +]; diff --git a/templates/base/style.css b/templates/base/style.css new file mode 100644 index 000000000..f3cdf551c --- /dev/null +++ b/templates/base/style.css @@ -0,0 +1,117 @@ +body { + background-color: white; + color: black; +} + +.small-bold { + font-weight: bold; + font-size: 70%; +} + +.row, +.col-xs-1, +.col-sm-1, +.col-md-1, +.col-lg-1, +.col-xs-2, +.col-sm-2, +.col-md-2, +.col-lg-2, +.col-xs-3, +.col-sm-3, +.col-md-3, +.col-lg-3, +.col-xs-4, +.col-sm-4, +.col-md-4, +.col-lg-4, +.col-xs-5, +.col-sm-5, +.col-md-5, +.col-lg-5, +.col-xs-6, +.col-sm-6, +.col-md-6, +.col-lg-6, +.col-xs-7, +.col-sm-7, +.col-md-7, +.col-lg-7, +.col-xs-8, +.col-sm-8, +.col-md-8, +.col-lg-8, +.col-xs-9, +.col-sm-9, +.col-md-9, +.col-lg-9, +.col-xs-10, +.col-sm-10, +.col-md-10, +.col-lg-10, +.col-xs-11, +.col-sm-11, +.col-md-11, +.col-lg-11, +.col-xs-12, +.col-sm-12, +.col-md-12, +.col-lg-12 { + margin: 0px !important; + padding: 0px !important; +} + +p { + padding: 0px; + margin: 0px; +} + +.border-left { + border-left: 1px solid #aaa; +} + +.border-right { + border-right: 1px solid #aaa; +} + +.border-top { + border-top: 1px solid #aaa; +} + +.border-bottom { + border-bottom: 1px solid #aaa; +} + +.border-full { + border: 1px solid #aaa; +} + +table { + width: 100%; +} + +table td { + vertical-align: top; + padding: 4px; +} + +#contents td { + padding: 4px; + white-space: normal; +} + +#contents th { + border-bottom: 1px solid #aaa; + border-right: 1px solid #aaa; + background: #ddd; + padding: 3px; + font-size: 90%; +} + +.cell-padded { + padding: 4px; +} + +.bg-default{ + background-color: #eee; +} diff --git a/templates/contratti_cons/pdfgen.contratti_cons.php b/templates/contratti_cons/pdfgen.contratti_cons.php index 4610d995e..e1179e981 100644 --- a/templates/contratti_cons/pdfgen.contratti_cons.php +++ b/templates/contratti_cons/pdfgen.contratti_cons.php @@ -162,7 +162,7 @@ if (sizeof($contratti) > 0) { $body .= "
    \n"; // Conteggio articoli utilizzati -$query = "SELECT *, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=mg_articoli_interventi.idintervento) AS data_intervento, (SELECT percentuale FROM co_iva WHERE id=mg_articoli_interventi.idiva_vendita) AS prciva_vendita, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, GROUP_CONCAT( CONCAT_WS(lotto, 'Lotto: ', ', '), CONCAT_WS(serial, 'SN: ', ', '), CONCAT_WS(altro, 'Altro: ', '') SEPARATOR '
    ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` GROUP BY idarticolo, idintervento, lotto HAVING idintervento IN(".implode(',', $idinterventi).") AND NOT idarticolo='0' ORDER BY idarticolo ASC"; +$query = "SELECT *, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=mg_articoli_interventi.idintervento) AS data_intervento, (SELECT percentuale FROM co_iva WHERE id=mg_articoli_interventi.idiva_vendita) AS prciva_vendita, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino FROM an_anagrafiche WHERE idanagrafica=(SELECT idanagrafica FROM in_interventi WHERE id=mg_articoli_interventi.idintervento) ) ) AS prc_guadagno, CONCAT_WS(serial, 'SN: ', ', ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` JOIN mg_prodotti ON mg_articoli_interventi.idarticolo = mg_prodotti.id_articolo GROUP BY idarticolo, idintervento, lotto HAVING idintervento IN(".implode(',', $idinterventi).") AND NOT idarticolo='0' ORDER BY idarticolo ASC"; $rs2 = $dbo->fetchArray($query); if (sizeof($rs2) > 0) { diff --git a/templates/ddt/pdfgen.ddt.php b/templates/ddt/pdfgen.ddt.php index 1f9d9fcf2..1276be5e9 100644 --- a/templates/ddt/pdfgen.ddt.php +++ b/templates/ddt/pdfgen.ddt.php @@ -114,7 +114,7 @@ $sconto = 0.00; /* Articoli */ -$q_art = "SELECT *, GROUP_CONCAT( CONCAT_WS(lotto, 'Lotto: ', ', '), CONCAT_WS(serial, 'SN: ', ', '), CONCAT_WS(altro, 'Altro: ', '') SEPARATOR '
    ') AS codice, SUM(qta) AS sumqta FROM `dt_righe_ddt` GROUP BY idarticolo, idddt, lotto HAVING idddt='$idddt' AND NOT idarticolo='0' ORDER BY idarticolo ASC"; +$q_art = "SELECT *, CONCAT_WS(serial, 'SN: ', ', ') AS codice, SUM(qta) AS sumqta FROM `dt_righe_ddt` JOIN mg_prodotti ON dt_righe_ddt.idarticolo = mg_prodotti.id_articolo GROUP BY idarticolo, idddt, lotto HAVING idddt='$idddt' AND NOT idarticolo='0' ORDER BY idarticolo ASC"; $rs_art = $dbo->fetchArray($q_art); $tot_art = sizeof($rs_art); $imponibile_art = 0.0; diff --git a/templates/ddt_new/bg_ddt.jpg b/templates/ddt_new/bg_ddt.jpg new file mode 100644 index 000000000..f30d0c4a0 Binary files /dev/null and b/templates/ddt_new/bg_ddt.jpg differ diff --git a/templates/ddt_new/bg_ddt_noprezzi.jpg b/templates/ddt_new/bg_ddt_noprezzi.jpg new file mode 100644 index 000000000..bd6703b97 Binary files /dev/null and b/templates/ddt_new/bg_ddt_noprezzi.jpg differ diff --git a/templates/ddt_new/ddt.html b/templates/ddt_new/ddt.html new file mode 100644 index 000000000..b93a8f0c0 --- /dev/null +++ b/templates/ddt_new/ddt.html @@ -0,0 +1,54 @@ + + + + $body$ + diff --git a/templates/ddt_new/ddt_body.html b/templates/ddt_new/ddt_body.html new file mode 100644 index 000000000..a9b94d69c --- /dev/null +++ b/templates/ddt_new/ddt_body.html @@ -0,0 +1,227 @@ + + +
    + + + + + +
    + Logo + +

    + $f_ragionesociale$
    + $f_indirizzo$ + $f_citta$ + $f_piva$ + $f_codicefiscale$ + $f_capsoc$ + $f_telefono$ +

    +
    +

    + + + + + + + + + + + +
    + +
    + $tipo_doc$
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + NR. DOCUMENTO
    + $numero_doc$ +
    + DATA DOCUMENTO
    + $data$ +
    + CLIENTE
    + $c_codice$ +
    + FOGLIO
    +     [[page_cu]]/[[page_nb]] +
    +
    + + + + +
    + PARTITA IVA
    + $c_piva$ +
    + CODICE FISCALE
    + $c_codicefiscale$ +
    +
    +
    +
    + PAGAMENTO
    + $pagamento$ +
    +
    +
    +  
    +   +
    +
    +
    +
    +  
    +
    + + + + + + + + + + + + + +
    + SPETT.LE
    +
    + $c_ragionesociale$ + $c_indirizzo$ + $c_citta$ +
    +
    + DESTINAZIONE DIVERSA
    +
    + $c_destinazione$ +
    +
    +
    +
    +
    + + + + + + $footer$ +
    + + + + + + + + + + + + + + + + +
    + ASPETTO BENI + + CAUSALE TRASPORTO + + PORTO +
    + $aspettobeni$  + + $causalet$  + + $porto$  +
    + + + + + + + + + + + + + + + + + +
    + No COLLI + + TIPO DI SPEDIZIONE + + VETTORE +
    + $n_colli$  + + $spedizione$  + + $vettore$  +
    + + + + + + + + + + + + + + + + + + +
    + FIRMA CONDUCENTE + + FIRMA VETTORE + + FIRMA DESTINATARIO +
    +  
     
      +
    +  
     
      +
    +  
     
      +
    +
    diff --git a/templates/ddt_new/logo_azienda.jpg b/templates/ddt_new/logo_azienda.jpg new file mode 100644 index 000000000..b71adcf84 Binary files /dev/null and b/templates/ddt_new/logo_azienda.jpg differ diff --git a/templates/ddt_new/pdfgen.ddt.php b/templates/ddt_new/pdfgen.ddt.php new file mode 100644 index 000000000..2620f37c4 --- /dev/null +++ b/templates/ddt_new/pdfgen.ddt.php @@ -0,0 +1,385 @@ +fetchArray($q); + $aspettobeni = $rs[0]['aspettobeni']; + $causalet = $rs[0]['causalet']; + $porto = $rs[0]['porto']; + $n_colli = $rs[0]['n_colli']; + if($n_colli=="0") $n_colli = ""; + $spedizione = $rs[0]['spedizione']; + $vettore = $rs[0]['vettore']; + + if( $rs[0]['dir']=='entrata' ) + $nome_modulo = "Ddt di vendita"; + else + $nome_modulo = "Ddt di acquisto"; + include_once( $docroot."/lib/permissions_check.php" ); + include_once( $docroot."/modules/ddt/modutil.php" ); + + $additional_where[$nome_modulo] = str_replace( "|idanagrafica|", "'".$user_idanagrafica."'", $additional_where[$nome_modulo] ); + + $mostra_prezzi = get_var("Stampa i prezzi sui ddt"); + + + //Lettura info fattura + $q = "SELECT *, (SELECT descrizione FROM dt_tipiddt WHERE id=idtipoddt) AS tipo_doc, (SELECT dir FROM dt_tipiddt WHERE id=idtipoddt) AS dir FROM dt_ddt WHERE id=\"".$idddt."\" ".$additional_where[$nome_modulo]; + $rs = $dbo->fetchArray($q); + $tipo_doc = $rs[0]['tipo_doc']; + $idcliente = $rs[0]['idanagrafica']; + //$idsede = $rs[0]['idsede']; + ( $rs[0]['numero_esterno']!='' ) ? $numero=$rs[0]['numero_esterno'] : $numero=$rs[0]['numero']; + + if( $rs[0]['numero_esterno']=='' ){ + $numero = "pro-forma ".$numero; + $tipo_doc = "DDT PRO-FORMA"; + } + + //Lettura righe ddt + $q2 = "SELECT * FROM dt_righe_ddt INNER JOIN dt_ddt ON dt_righe_ddt.idddt=dt_ddt.id WHERE idddt='$idddt' ".$additional_where[$nome_modulo]; + $righe = $dbo->fetchArray( $q2 ); + + //carica report html + $report = file_get_contents ($docroot."/templates/ddt/ddt.html"); + $body = file_get_contents ($docroot."/templates/ddt/ddt_body.html"); + + if( !($idcliente == $user_idanagrafica || $_SESSION['is_admin']) ) + die("Non hai i permessi per questa stampa!"); + + include_once( "pdfgen_variables.php" ); + // $body = str_replace( "P.Iva: ".$c_piva, $c_piva, $body ); + // $body = str_replace( "P.Iva/C.F.: ".$c_piva, $c_piva, $body ); + + $body = str_replace( '$tipo_doc$', strtoupper($tipo_doc), $body ); + $body = str_replace( '$numero_doc$', $numero, $body ); + $body = str_replace( '$data$', date( "d/m/Y", strtotime($rs[0]['data']) ), $body ); + $body = str_replace( '$pagamento$', $rs[0]['tipo_pagamento'], $body ); + $body = str_replace( '$c_banca_appoggio$', " ", $body ); + + if($mostra_prezzi): + $report = str_replace( '$img_sfondo$', "bg_ddt.jpg", $report ); + else: + $report = str_replace( '$img_sfondo$', "bg_ddt_noprezzi.jpg", $report ); + endif; + + //Leggo i dati della destinazione (se 0=sede legale, se!=altra sede da leggere da tabella an_sedi) + $destinazione = ''; + if( $rs[0]['idsede']==0 ){ + + $destinazione = ''; + + } else { + $queryd = "SELECT (SELECT codice FROM an_anagrafiche WHERE idanagrafica=an_sedi.idanagrafica) AS codice, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=an_sedi.idanagrafica) AS ragione_sociale, indirizzo, indirizzo2, cap, citta, provincia, piva, codice_fiscale FROM an_sedi WHERE idanagrafica='".$idcliente."' AND id='".$rs[0]['idsede']."'"; + $rsd = $dbo->fetchArray($queryd); + + if( $rsd[0]['indirizzo']!='' ) + $destinazione .= $rsd[0]['indirizzo']."
    \n"; + if( $rsd[0]['indirizzo2']!='' ) + $destinazione .= $rsd[0]['indirizzo2']."
    \n"; + if( $rsd[0]['cap']!='' ) + $destinazione .= $rsd[0]['cap']." "; + if( $rsd[0]['citta']!='' ) + $destinazione .= $rsd[0]['citta']; + if( $rsd[0]['provincia']!='' ) + $destinazione .= " (".$rsd[0]['provincia'].")\n"; + } + + $body = str_replace( '$c_destinazione$', $destinazione, $body ); + + //Campi finali + $body = str_replace( '$aspettobeni$', $aspettobeni, $body ); + $body = str_replace( '$causalet$', $causalet, $body ); + $body = str_replace( '$porto$', $porto, $body ); + $body = str_replace( '$n_colli$', $n_colli, $body ); + $body = str_replace( '$spedizione$', $spedizione, $body ); + $body = str_replace( '$vettore$', $vettore, $body ); + + $v_iva = ''; + $v_totale = ''; + + + + //Intestazione tabella per righe + $body .= "\n"; + + if($mostra_prezzi): + $body .= "\n"; + else: + $body .= "\n"; + endif; + + $body .= "\n"; + $body .= "\n"; + $body .= "\n"; + $body .= "\n"; + if($mostra_prezzi): + $body .= "\n"; + $body .= "\n"; + $body .= "\n"; + $body .= "\n"; + endif; + $body .= "\n"; + $body .= "\n"; + + $body .= "\n"; + + //Mostro le righe del ddt + $totale_ddt = 0.00; + $totale_imponibile = 0.00; + $totale_iva = 0.00; + $sconto = 0.00; + $sconto_generico = 0.00; + + + /* + Righe + */ + $q_gen = "SELECT *, (SELECT percentuale FROM co_iva WHERE id=idiva) AS perc_iva FROM `dt_righe_ddt` WHERE idddt='$idddt'"; + $rs_gen = $dbo->fetchArray( $q_gen ); + $tot_gen = sizeof($rs_gen); + $imponibile_gen = 0.0; + $iva_gen = 0.0; + + if( $tot_gen>0 ){ + for( $i=0; $ifetchArray("SELECT numero, numero_esterno, data FROM or_ordini WHERE id=\"".$rs_gen[$i]['idordine']."\""); + ( $rso[0]['numero_esterno']!='' ) ? $numero=$rso[0]['numero_esterno'] : $numero=$rso[0]['numero']; + $body .= "
    Rif. ordine no".$numero." del ".date("d/m/Y", strtotime($rso[0]['data']) ).""; + } + + $body .= "\n"; + + $body .= "
    \n"; + + /* + $body .= "\n"; + */ + + if($mostra_prezzi): + $body .= "\n"; + + //Imponibile + $body .= "\n"; + + + //Sconto + $body .= "\n"; + + + //Iva + $body .= "\n"; + endif; + $body .= "\n"; + + + + $imponibile_gen += $subtotale; + $iva_gen += $iva; + $sconto += $sconto; + + if( $rs_gen[$i]['perc_iva'] > 0 ){ + $iva_generica = $rs_gen[$i]['perc_iva']; + } + } + } + $imponibile_ddt += $imponibile_gen; + $totale_iva += $iva_gen; + $totale_ddt += $imponibile_gen; + } + + + $body .= "\n"; + $body .= "
    DESCRIZIONEQ.TÀPREZZO U.IMPORTOSCONTOIVA
    \n"; + $body .= number_format($qta, 2, ",", "")."\n"; + $body .= "\n"; + $body .= $rs_gen[$i]['um']."\n"; + $body .= "\n"; + $body .= number_format( $subtotale/$qta, 2, ",", "" )." €\n"; + $body .= "\n"; + $subtot = $subtotale; + $body .= number_format( $subtot, 2, ",", "." )." €\n"; + + /* + if( $rs_gen[$i]['sconto']>0 ){ + $body .= "
    \n- sconto ".number_format( $rs_gen[$i]['sconto'], 2, ",", "." )." €\n"; + $tot_gen++; + }*/ + + $body .= "
    \n"; + if( $rs_gen[$i]['scontoperc'] > 0 ){ + $body .= "(".$rs_gen[$i]['scontoperc']."%) "; + } + if( $rs_gen[$i]['sconto'] > 0 ){ + $body .= " ".number_format( $rs_gen[$i]['sconto'], 2, ",", "." )." €\n"; + } + + $body .= "\n"; + + if( $rs_gen[$i]['perc_iva'] > 0 ){ + $body .= " ".intval($rs_gen[$i]['perc_iva'])."%\n"; + } + + $body .= "

    \n"; + + + + /* + NOTE + */ + /* + $body .= "\n"; + $body .= " \n"; + $body .= "
    \n"; + $body .= " NOTE
    \n"; + $body .= "
    \n"; + $body .= " ".nl2br( $rs[0]['note'] )."\n"; + $body .= "
    \n"; + $body .= "
    \n"; + */ + + $imponibile_ddt -= $sconto; + $totale_ddt = $totale_ddt - $sconto + $totale_iva; + + + + /* + SCADENZE | TOTALI + */ + //TABELLA PRINCIPALE + +if($mostra_prezzi): + //Riga 1 + $footer = " \n"; + + $footer .= " NOTE
    \n"; + $footer .= " ".nl2br( $rs[0]['note'] )."\n"; + + $footer .= " \n"; + $footer .= " \n"; + $footer .= " TOTALE IMPONIBILE\n"; + $footer .= " \n"; + + //Dati riga 1 + $footer .= " \n"; + + $footer .= " \n"; + $footer .= " ".number_format( $imponibile_ddt, 2, ",", "." )." €\n"; + $footer .= " \n"; + + //Riga 2 + $footer .= " \n"; + $footer .= " TOTALE IMPOSTE\n"; + $footer .= " \n"; + + $footer .= " \n"; + $footer .= " ".number_format( $totale_iva, 2, ",", "." )." €\n"; + $footer .= " \n"; + + //Riga 3 + $footer .= " \n"; + $footer .= " TOTALE DOCUMENTO\n"; + $footer .= " \n"; + + $footer .= " \n"; + $footer .= " ".number_format( $totale_ddt, 2, ",", "." )." €\n"; + $footer .= " \n"; + + //Riga 4 (opzionale, solo se c'è la ritenuta d'acconto) + if( $rs[0]['ritenutaacconto'] > 0 ): + $rs2 = $dbo->fetchArray("SELECT percentuale FROM co_ritenutaacconto WHERE id='".$rs[0]['idritenutaacconto']."'"); + + $footer .= " \n"; + $footer .= " RITENUTA D'ACCONTO ".intval( $rs2[0]['percentuale'] )."%\n"; + $footer .= " \n"; + + $footer .= " \n"; + $footer .= " ".number_format( $rs[0]['ritenutaacconto'], 2, ",", "." )." €\n"; + $footer .= " \n"; + + + + $footer .= " \n"; + $footer .= " NETTO A PAGARE\n"; + $footer .= " \n"; + + $footer .= " \n"; + $footer .= " ".number_format( $totale_ddt - $rs[0]['ritenutaacconto'], 2, ",", "." )." €\n"; + $footer .= " \n"; + endif; + +else: + //Riga 1 + $footer = " \n"; + + $footer .= " NOTE
    \n"; + $footer .= " ".nl2br( $rs[0]['note'] )."\n"; + + $footer .= " \n"; + + +endif; + + + + + $report_name = "ddt_".$numero.".pdf"; +?> diff --git a/templates/fatture/body.php b/templates/fatture/body.php new file mode 100644 index 000000000..801fce937 --- /dev/null +++ b/templates/fatture/body.php @@ -0,0 +1,180 @@ + + + + ".strtoupper(tr('Descrizione'))." + ".strtoupper(tr('Q.TÀ'))." + ".strtoupper(tr('Um'))." + ".strtoupper(tr('Costo unitario'))." + ".strtoupper(tr('Importo'))." + ".strtoupper(tr('IVA')).' + + + + '; + +// RIGHE FATTURA CON ORDINAMENTO UNICO +$righe = $dbo->fetchArray("SELECT *, IFNULL((SELECT codice FROM mg_articoli WHERE id=idarticolo),'') AS codice_articolo, (SELECT percentuale FROM co_iva WHERE id=idiva) AS perc_iva FROM `co_righe_documenti` WHERE iddocumento=".prepare($iddocumento).' ORDER BY `order`'); +$tot_righe = sizeof($righe); + +foreach ($righe as $i => $riga) { + $n_rows += ceil(strlen($riga['descrizione']) / $words4row); + + echo " + + + ".nl2br($riga['descrizione']); + + if (!empty($riga['codice_articolo'])) { + echo ' +
    '.str_replace('_COD_', $riga['codice_articolo'], tr('COD. _COD_')).''; + $n_rows += 0.4; + } + + // Aggiunta riferimento a ordine + if (!empty($riga['idordine'])) { + $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM or_ordini WHERE id='.prepare($riga['idordine'])); + $numero = !empty($rso[0]['numero_esterno']) ? $rso[0]['numero_esterno'] : $rso[0]['numero']; + + echo ' +
    '.str_replace(['_NUM_', '_DATE_'], [$numero, Translator::dateToLocale($rso[0]['data'])], tr('Rif. ordine no_NUM_ del _DATE_')).''; + $n_rows += 0.4; + } + + // Aggiunta riferimento a ddt + elseif (!empty($riga['idddt'])) { + $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM dt_ddt WHERE id='.prepare($riga['idddt'])); + $numero = !empty($rso[0]['numero_esterno']) ? $rso[0]['numero_esterno'] : $rso[0]['numero']; + + echo ' +
    '.str_replace(['_NUM_', '_DATE_'], [$numero, Translator::dateToLocale($rso[0]['data'])], tr('Rif. ddt no_NUM_ del _DATE_')).''; + $n_rows += 0.4; + } + echo ' + '; + + echo " + + ".(empty($riga['qta']) ? '' : Translator::numberToLocale($riga['qta'], 2)).' + '; + + // Unità di miusura + echo " + + ".nl2br(strtoupper($riga['um'])).' + '; + + // Costo unitario + echo " + + ".(empty($riga['qta']) || empty($riga['subtotale']) ? '' : Translator::numberToLocale($riga['subtotale'] / $riga['qta'], 2)).' € + '; + + // Imponibile + echo " + + ".(empty($riga['subtotale']) ? '' : Translator::numberToLocale($riga['subtotale'], 2)).' €'; + + if ($riga['sconto'] > 0) { + $n_rows += 0.4; + echo " +
    - sconto ".Translator::numberToLocale($riga['sconto_unitario']).($riga['tipo_sconto'] == 'PRC' ? '%' : ' €').''; + } + + echo ' + '; + + // Iva + echo " + "; + if (!empty($riga['idiva'])) { + echo ' + '.intval($riga['perc_iva']).'%'; + } + echo ' + + '; + + $imponibile += $riga['subtotale']; + $iva += $riga['iva']; + $sconto += $riga['sconto']; + + $v_iva[$riga['desc_iva']] += $riga['iva']; + $v_totale[$riga['desc_iva']] += $riga['subtotale'] - $riga['sconto']; +} + +$imponibile_documento += $imponibile; +$totale_iva += $iva; +$totale_documento += $imponibile; + +// Aggiungo diciture per condizioni iva particolari +if (!empty($v_iva)) { + $elenco = [ + 'Reverse charge ex art. 17, comma 6, DPR 633/72' => tr('Operazione soggetta a reverse charge ex art. 17, comma 6, DPR 633/72'), + 'Esente ex art. 74' => tr('Senza addebito iva ex art. 74 comma 8-9 del DPR 633/72'), + ]; + + $keys = array_keys($v_iva); + + // Controllo se è stata applicata questa tipologia di iva + foreach ($elenco as $e => $testo) { + if (in_array($e, $keys)) { + $n_rows += nl2br($testo) / $words4row; + + echo " + + + ".nl2br($testo)." + + + + + + "; + } + } +} + +for ($i = (floor($n_rows) % 20); $i < 15; ++$i) { + echo ' + +   + + + + + + '; +} +echo ' + +'; + +$imponibile_documento -= $sconto; +$totale_documento = $totale_documento - $sconto + $totale_iva; + +if (!empty($rs[0]['note'])) { + echo ' +
    +

    '.strtoupper(tr('Note')).':

    +

    '.$rs[0]['note'].'

    '; +} diff --git a/templates/fatture/fattura.html b/templates/fatture/fattura.html deleted file mode 100644 index 537e38684..000000000 --- a/templates/fatture/fattura.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - $body$ - diff --git a/templates/fatture/fattura_body.html b/templates/fatture/fattura_body.html deleted file mode 100644 index 1482277e7..000000000 --- a/templates/fatture/fattura_body.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - -
    - Logo
    - $f_ragionesociale$ - $f_indirizzo$ - $f_citta$ - $f_piva$ - $f_codicefiscale$ - $f_capsoc$ - $f_telefono$ - $f_sitoweb$ - $f_email$ - -
    - Spett.le $c_ragionesociale$ - $c_indirizzo$ - $c_citta$ - $c_piva$ - $c_codicefiscale$ - $riferimentosede$ -
    -
    -
    - - - - - - -
    - $dicitura_fissa_fattura$ -
    - -
    - - $pagination$ -
    diff --git a/templates/fatture/footer.php b/templates/fatture/footer.php new file mode 100644 index 000000000..a1889141f --- /dev/null +++ b/templates/fatture/footer.php @@ -0,0 +1,194 @@ + + + + +

    ".strtoupper(tr('Totale imponibile'))."

    + + + + "; + +// Tabella (scadenze + iva) +echo " + + + '; +// Fine elenco scadenze + +// Separatore +echo " + "; + +// Tabella iva +echo " + + + "; + '; +// Fine tabelle iva +echo ' +
    + + + + '; + +// Elenco scadenze +$rs2 = $dbo->fetchArray('SELECT * FROM co_scadenziario WHERE iddocumento='.prepare($iddocumento).' ORDER BY `data_emissione` ASC'); +if (!empty($rs2)) { + for ($i = 0; $i < sizeof($rs2); ++$i) { + echo " + + + + '; + } +} else { + echo " + + + + "; +} +echo ' +
    +

    ".strtoupper(tr('Scadenze pagamenti')).'

    +
    + ".Translator::dateToLocale($rs2[$i]['scadenza'])." + + ".Translator::numberToLocale($rs2[$i]['da_pagare'], 2).' € +
    +   + +   +
    +
     "; +if (!empty($v_iva)) { + echo " + + + + + + + + '; + + foreach ($v_iva as $desc_iva => $tot_iva) { + if (!empty($desc_iva)) { + echo " + + + + + + + '; + } + } + + echo ' +
    +

    ".strtoupper(tr('Aliquota IVA'))."

    +
    +

    ".strtoupper(tr('Importo'))."

    +
    +

    ".strtoupper(tr('Importo IVA')).'

    +
    + ".$desc_iva." + + ".Translator::numberToLocale($v_totale[$desc_iva], 2)." € + + ".Translator::numberToLocale($v_iva[$desc_iva], 2).' € +
    '; +} + +echo ' +
     
    '; +// Fine tabella (scadenze + iva) +echo ' + '; + +// TOTALE IMPONIBILE +echo " + + ".Translator::numberToLocale($imponibile_documento, 2).' € + + '; + +// Riga 2 +echo " + + +

    ".strtoupper(tr('Totale IVA'))."

    + + + + + + ".Translator::numberToLocale($totale_iva, 2)." € + + + + + +

    ".strtoupper(tr('Totale documento'))."

    + + + + + + ".Translator::numberToLocale($totale_documento, 2).' € + + '; + +// Riga 4 (opzionale, solo se c'è la ritenuta d'acconto) +if ($rs[0]['ritenutaacconto'] != 0) { + $rs2 = $dbo->fetchArray('SELECT percentuale FROM co_ritenutaacconto WHERE id=(SELECT idritenutaacconto FROM co_righe_documenti WHERE iddocumento='.prepare($iddocumento).' AND idritenutaacconto!=0 LIMIT 0,1)'); + + echo " + + +

    ".strtoupper(str_replace('_PRC_', $rs2[0]['percentuale'], tr("Ritenuta d'acconto _PRC_%")))."

    + + + + + + ".Translator::numberToLocale($rs[0]['ritenutaacconto'], 2)." € + + + + + +

    ".strtoupper(tr('Netto a pagare'))."

    + + + + + + ".Translator::numberToLocale($totale_documento - $rs[0]['ritenutaacconto'], 2).' € + + '; +} + +echo ' +'; + +echo ' +
    + + +
    + $dicitura_fissa_fattura$ +
    + +
    + +$pagination$'; diff --git a/templates/fatture/header.php b/templates/fatture/header.php new file mode 100644 index 000000000..64916cd8f --- /dev/null +++ b/templates/fatture/header.php @@ -0,0 +1,92 @@ + +
    +
    + Logo +
    +
    +

    $f_ragionesociale$

    +

    $f_indirizzo$ $f_citta$

    +

    $f_telefono$

    +

    $f_piva$

    +
    +
    + +
    + +
    + +
    +
    + $tipo_doc$ +
    + + + + + + + + + + + + + + + + +
    +

    '.strtoupper(tr('Nr. documento')).'

    +

    $numero_doc$

    +
    +

    '.strtoupper(tr('Data documento')).'

    +

    $data$

    +
    +

    '.strtoupper(tr('Cliente')).'

    +

    $c_codice$

    +
    +

    '.strtoupper(tr('Foglio')).'

    +

    {PAGENO}/{nb}

    +
    +

    '.strtoupper(tr('Pagamento')).'

    +

    $pagamento$

    + +
    + +

    '.tr('IBAN').'

    +

    $f_codiceiban$

    +
    +

    '.strtoupper(tr('Banca di appoggio')).'

    +

    $f_appoggiobancario$

    +
    +
    + +
    + + + + + + + + + + + + +
    +

    '.strtoupper(tr('Spett.le')).'

    +

    $c_ragionesociale$

    +

    $c_indirizzo$ $c_citta$

    +
    +

    '.strtoupper(tr('Partita IVA')).'

    +

    $c_piva$

    +
    +

    '.strtoupper(tr('Codice fiscale')).'

    +

    $c_codicefiscale$

    +
    +
    +
    '; diff --git a/templates/fatture/init.php b/templates/fatture/init.php new file mode 100644 index 000000000..611b6e8b3 --- /dev/null +++ b/templates/fatture/init.php @@ -0,0 +1,60 @@ +fetchArray('SELECT *, + (SELECT descrizione FROM co_statidocumento WHERE id=idstatodocumento) AS stato_doc, + (SELECT descrizione FROM co_tipidocumento WHERE id=idtipodocumento) AS tipo_doc, + (SELECT descrizione FROM co_pagamenti WHERE id=idpagamento) AS tipo_pagamento, + (SELECT dir FROM co_tipidocumento WHERE id=idtipodocumento) AS dir +FROM co_documenti WHERE id='.prepare($iddocumento)); + +$module_name = ($rs[0]['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto'; + +$idcliente = $rs[0]['idanagrafica']; +$idsede = $rs[0]['idsede']; + +$tipo_doc = $rs[0]['tipo_doc']; +if ($rs[0]['stato_doc'] != 'Bozza') { + $numero = !empty($rs[0]['numero_esterno']) ? $rs[0]['numero_esterno'] : $rs[0]['numero']; +} else { + $tipo_doc = 'Fattura pro forma'; + $numero = 'PRO-'.$rs[0]['numero']; +} + +// Leggo i dati della destinazione (se 0=sede legale, se!=altra sede da leggere da tabella an_sedi) +$destinazione = ''; +if (!empty($rs[0]['idsede'])) { + $rsd = $dbo->fetchArray('SELECT (SELECT codice FROM an_anagrafiche WHERE idanagrafica=an_sedi.idanagrafica) AS codice, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=an_sedi.idanagrafica) AS ragione_sociale, indirizzo, indirizzo2, cap, citta, provincia, piva, codice_fiscale FROM an_sedi WHERE idanagrafica='.prepare($id_cliente).' AND id='.prepare($rs[0]['idsede'])); + + if (!empty($rsd[0]['indirizzo'])) { + $destinazione .= $rsd[0]['indirizzo'].'
    '; + } + if (!empty($rsd[0]['indirizzo2'])) { + $destinazione .= $rsd[0]['indirizzo2'].'
    '; + } + if (!empty($rsd[0]['cap'])) { + $destinazione .= $rsd[0]['cap'].' '; + } + if (!empty($rsd[0]['citta'])) { + $destinazione .= $rsd[0]['citta']; + } + if (!empty($rsd[0]['provincia'])) { + $destinazione .= ' ('.$rsd[0]['provincia'].')'; + } +} + +// Sostituzioni specifiche +$replaces = [ + 'tipo_doc' => strtoupper($tipo_doc), + 'numero_doc' => $numero, + 'data' => Translator::numberToLocale($rs[0]['data']), + 'pagamento' => $rs[0]['tipo_pagamento'], + 'c_destinazione' => $destinazione, +]; + +// Controllo sui permessi +if ($id_cliente != Auth::user()['idanagrafica'] && !Auth::admin()) { + die(tr('Non hai i permessi per questa stampa!')); +} diff --git a/templates/fatture/pdfgen.fatture.php b/templates/fatture/pdfgen.fatture.php deleted file mode 100644 index 1babcaa3b..000000000 --- a/templates/fatture/pdfgen.fatture.php +++ /dev/null @@ -1,466 +0,0 @@ -fetchArray($q); - -if ($rs[0]['dir'] == 'entrata') { - $module_name = 'Fatture di vendita'; -} else { - $module_name = 'Fatture di acquisto'; -} - -$additional_where[$module_name] = str_replace('|idanagrafica|', "'".$user['idanagrafica']."'", $additional_where[$module_name]); - -// Lettura info fattura -$q = 'SELECT *, (SELECT descrizione FROM co_tipidocumento WHERE id=idtipodocumento) AS tipo_doc, (SELECT descrizione FROM co_pagamenti WHERE id=idpagamento) AS tipo_pagamento, (SELECT dir FROM co_tipidocumento WHERE id=idtipodocumento) AS dir FROM co_documenti WHERE id="'.$iddocumento.'" '.$additional_where[$module_name]; -$rs = $dbo->fetchArray($q); -$numero_doc = $rs[0]['numero']; -$idcliente = $rs[0]['idanagrafica']; -(!empty($rs[0]['numero_esterno'])) ? $numero = $rs[0]['numero_esterno'] : $numero = $rs[0]['numero']; - -// Lettura righe documento -$q2 = "SELECT * FROM co_righe_documenti INNER JOIN co_documenti ON co_righe_documenti.iddocumento=co_documenti.id WHERE iddocumento='$iddocumento' ".$additional_where[$module_name]; -$righe = $dbo->fetchArray($q2); - -// carica report html -$report = file_get_contents($docroot.'/templates/fatture/fattura.html'); -$body = file_get_contents($docroot.'/templates/fatture/fattura_body.html'); - -include_once $docroot.'/templates/pdfgen_variables.php'; - -if (empty($rs[0]['idsede'])) { - $body = str_replace('$riferimentosede$', '', $body); -} else { - $q3 = "SELECT * FROM an_sedi WHERE id='".$rs[0]['idsede']."'"; - $sede = $dbo->fetchArray($q3); - - $riferimentosede = '
    Rif. sede cliente:
    '.$sede[0]['nomesede'].'
    '.$sede[0]['indirizzo'].'
    '.$sede[0]['cap'].' '.$sede[0]['citta'].' ('.$sede[0]['provincia'].')'; - - $body = str_replace('$riferimentosede$', $riferimentosede, $body); -} - -// Dati generici fattura -if ($rs[0]['buono_ordine'] != '') { - $width = '165'; -} else { - $width = '228'; -} - -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; - -if ($rs[0]['buono_ordine']) { - $body .= "\n"; -} - -$body .= "\n"; -$body .= "
    ".$rs[0]['tipo_doc']."
    no $numero
    Data:
    ".Translator::dateToLocale($rs[0]['data'])."
    Pagamento:
    ".$rs[0]['tipo_pagamento']."
    Buono d'ordine:
    ".$rs[0]['buono_ordine']."


    \n"; - -// Intestazione tabella per righe -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; -$body .= "\n"; - -$body .= "\n"; - -// Mostro le righe del documento -$totale_documento = 0.00; -$totale_imponibile = 0.00; -$totale_iva = 0.00; -$sconto = 0.00; - -/* - Righe fattura -*/ -$qr = "SELECT * FROM `co_righe_documenti` WHERE iddocumento='$iddocumento' ORDER BY `order`"; -$rsr = $dbo->fetchArray($qr); -$tot = sizeof($rsr); -$imponibile_int = 0.00; -$iva_int = 0.00; - -if ($tot > 0) { - for ($i = 0; $i < $tot; ++$i) { - // Intervento - if (!empty($rsr[$i]['idintervento']) && empty($rsr[$i]['idarticolo'])) { - $body .= "\n"; - - $qta = $rsr[$i]['qta']; - ($qta == 0) ? $qta = '-' : $qta = Translator::numberToLocale($qta, 2); - $body .= "\n"; - - ($qta == 0) ? $um = '-' : $um = $rsr[$i]['um']; - $body .= "\n"; - - // costo unitario - $subtotale = $rsr[$i]['subtotale'] / $rsr[$i]['qta']; - ($subtotale == 0) ? $subtotale = '-' : $subtotale = Translator::numberToLocale($subtotale, 2).' €'; - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - $imponibile_int += $rsr[$i]['subtotale']; - $iva_int += $iva; - $sconto += $rsr[$i]['sconto']; - } - - // Preventivi - elseif ($rsr[$i]['idpreventivo'] != 0) { - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - // Iva - $body .= "\n"; - - // Imponibile - $body .= "\n"; - - $imponibile_pre += $rsr[$i]['subtotale']; - $iva_pre += $iva; - $sconto += $rsr[$i]['sconto']; - } - - // Contratti - elseif ($rsr[$i]['idcontratto'] != 0) { - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - // Iva - $body .= "\n"; - - // Imponibile - $body .= "\n"; - - $imponibile_con += $rsr[$i]['subtotale']; - $iva_con += $iva; - $sconto += $rsr[$i]['sconto']; - } - - // Articoli - elseif ($rsr[$i]['idarticolo'] != 0) { - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - // costo unitario - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - $imponibile_art += $rsr[$i]['subtotale']; - $iva_art += $iva; - $sconto += $rsr[$i]['sconto']; - } - - // Righe generiche - else { - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - $body .= "\n"; - - // Iva - $body .= "\n"; - - // Imponibile - $body .= "\n"; - - $imponibile_gen += $rsr[$i]['subtotale']; - $iva_gen += $iva; - $sconto += $rsr[$i]['sconto']; - } - } - - $imponibile_documento += $imponibile_int; - $totale_iva += $iva_int; - $totale_documento += $imponibile_int; - - $imponibile_documento += $imponibile_pre; - $totale_iva += $iva_pre; - $totale_documento += $imponibile_pre; - - $imponibile_documento += $imponibile_con; - $totale_iva += $iva_con; - $totale_documento += $imponibile_con; - - $imponibile_documento += $imponibile_art; - $totale_iva += $iva_art; - $totale_documento += $imponibile_art; - - $imponibile_documento += $imponibile_gen; - $totale_iva += $iva_gen; - $totale_documento += $imponibile_gen; -} - -// Totale documento -$body .= "\n"; - -// Imponibile -$body .= "\n"; - -// Mostra sconto se c'è -if (abs($sconto) > 0) { - $body .= "\n"; - - // Sconto - $body .= "'; - - // Totale scontato - $body .= "\n"; - - // Sconto - $body .= "\n"; -} - -// Mostra INPS se c'è -if (abs($rs[0]['rivalsainps']) > 0) { - $body .= "\n"; - - // Rivalsa INPS - $body .= "\n"; - $totale_documento += $rs[0]['rivalsainps']; -} - -// Mostra iva se c'è -$totale_iva += $rs[0]['iva_rivalsainps']; -if (abs($totale_iva) > 0) { - $body .= "\n"; - - // Iva - $body .= "\n"; - $totale_documento += $totale_iva; -} - -/* - Totale documento -*/ -$body .= "\n"; - -$body .= "\n"; -$netto_a_pagare = $totale_documento; - -// Mostra marca da bollo se c'è -if (abs($rs[0]['bollo']) > 0) { - $body .= "\n"; - - // Marca da bollo - $body .= "\n"; - $netto_a_pagare += $marca_da_bollo; -} - -// Mostra ritenuta d'acconto se c'è -if (abs($rs[0]['ritenutaacconto']) > 0) { - $body .= "\n"; - - // Ritenuta d'acconto - $body .= "\n"; - $netto_a_pagare -= $rs[0]['ritenutaacconto']; -} - -/* - Netto a pagare (se diverso dal totale) -*/ -if ($totale_documento != $netto_a_pagare) { - $body .= "\n"; - - $body .= "\n"; -} -$body .= "\n"; -$body .= "
    DescrizioneQ.tàu.m.Costo unitarioIvaImponibile
    \n"; - $body .= nl2br($rsr[$i]['descrizione'])."\n"; - $body .= "\n"; - $body .= $qta; - $body .= "\n"; - $body .= $um; - $body .= "\n"; - $body .= $subtotale."\n"; - $body .= "\n"; - $iva = $rsr[$i]['iva']; - $body .= '
    '.Translator::numberToLocale($iva, 2)." €
    ".$rsr[$i]['desc_iva']."\n"; - $body .= "
    \n"; - $subtot = $rsr[$i]['subtotale']; - $body .= Translator::numberToLocale($subtot, 2)." €\n"; - if ($rsr[$i]['sconto'] > 0) { - $body .= "
    \n- sconto ".Translator::numberToLocale($rsr[$i]['sconto'], 2)." €\n"; - } - $body .= "
    \n"; - $body .= nl2br($rsr[$i]['descrizione'])."\n"; - $body .= "\n"; - $body .= "1\n"; - $body .= "\n"; - $body .= '-'; - $body .= "\n"; - $body .= "-\n"; - $body .= "\n"; - $iva = $rsr[$i]['iva']; - $body .= '
    '.Translator::numberToLocale($iva, 2)." €
    ".$rsr[$i]['desc_iva']."\n"; - $body .= "
    \n"; - $subtot = $rsr[$i]['subtotale']; - $body .= Translator::numberToLocale($subtot, 2)." €\n"; - if ($rsr[$i]['sconto'] > 0) { - $body .= "
    \n- sconto ".Translator::numberToLocale($rsr[$i]['sconto'], 2)." €\n"; - } - $body .= "
    \n"; - $body .= nl2br($rsr[$i]['descrizione'])."\n"; - $body .= "\n"; - $body .= "1\n"; - $body .= "\n"; - $body .= '-'; - $body .= "\n"; - $body .= "-\n"; - $body .= "\n"; - $iva = $rsr[$i]['iva']; - $body .= '
    '.Translator::numberToLocale($iva, 2)." €
    ".$rsr[$i]['desc_iva']."\n"; - $body .= "
    \n"; - $subtot = $rsr[$i]['subtotale']; - $body .= Translator::numberToLocale($subtot, 2)." €\n"; - if ($rsr[$i]['sconto'] > 0) { - $body .= "
    \n- sconto ".Translator::numberToLocale($rsr[$i]['sconto'], 2)." €\n"; - } - $body .= "
    \n"; - - // Immagine articolo - $f = pathinfo($rsr[$i]['immagine01']); - $img = $docroot.'/modules/magazzino/articoli/images/'.$f['filename'].'_thumb100.'.$f['extension']; - if (file_exists($img)) { - $body .= '\"\"\n"; - } - - $body .= nl2br($rsr[$i]['descrizione']); - - // Aggiunta riferimento a ordine - if (!empty($rsr[$i]['idordine'])) { - $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM or_ordini WHERE id="'.$rsr[$i]['idordine'].'"'); - ($rso[0]['numero_esterno'] != '') ? $numero = $rso[0]['numero_esterno'] : $numero = $rso[0]['numero']; - $body .= '
    Rif. ordine '.$numero.' del '.Translator::dateToLocale($rso[0]['data']).''; - } - - // Aggiunta riferimento a ddt - elseif (!empty($rsr[$i]['idddt'])) { - $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM dt_ddt WHERE id="'.$rsr[$i]['idddt'].'"'); - ($rso[0]['numero_esterno'] != '') ? $numero = $rso[0]['numero_esterno'] : $numero = $rso[0]['numero']; - $body .= '
    Rif. ddt '.$numero.' del '.Translator::dateToLocale($rso[0]['data']).''; - } - $body .= "
    \n"; - $body .= Translator::numberToLocale($rsr[$i]['qta'], 2); - $body .= "\n"; - $body .= $rsr[$i]['um']; - $body .= "\n"; - $body .= Translator::numberToLocale($rsr[$i]['subtotale'] / $rsr[$i]['qta'], 2)." €\n"; - $body .= "\n"; - $iva = $rsr[$i]['iva']; - $body .= '
    '.Translator::numberToLocale($iva, 2)." €
    ".$rsr[$i]['desc_iva']."\n"; - $body .= "
    \n"; - $subtot = $rsr[$i]['subtotale']; - $body .= Translator::numberToLocale($subtot, 2)." €\n"; - if ($rsr[$i]['sconto'] > 0) { - $body .= "
    \n- sconto ".Translator::numberToLocale($rsr[$i]['sconto'], 2)." €\n"; - } - $body .= "
    \n"; - $body .= nl2br($rsr[$i]['descrizione']); - - // Aggiunta riferimento a ordine - if (!empty($rsr[$i]['idordine'])) { - $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM or_ordini WHERE id="'.$rsr[$i]['idordine'].'"'); - ($rso[0]['numero_esterno'] != '') ? $numero = $rso[0]['numero_esterno'] : $numero = $rso[0]['numero']; - $body .= '
    Rif. ordine no'.$numero.' del '.Translator::dateToLocale($rso[0]['data']).''; - } - - // Aggiunta riferimento a ddt - elseif (!empty($rsr[$i]['idddt'])) { - $rso = $dbo->fetchArray('SELECT numero, numero_esterno, data FROM dt_ddt WHERE id="'.$rsr[$i]['idddt'].'"'); - ($rso[0]['numero_esterno'] != '') ? $numero = $rso[0]['numero_esterno'] : $numero = $rso[0]['numero']; - $body .= '
    Rif. ddt no'.$numero.' del '.Translator::dateToLocale($rso[0]['data']).''; - } - $body .= "
    \n"; - $body .= Translator::numberToLocale($rsr[$i]['qta'], 2)."\n"; - $body .= "\n"; - $body .= $rsr[$i]['um']."\n"; - $body .= "\n"; - $body .= Translator::numberToLocale($rsr[$i]['subtotale'] / $rsr[$i]['qta'], 2)." €\n"; - $body .= "\n"; - $iva = $rsr[$i]['iva']; - $body .= '
    '.Translator::numberToLocale($iva, 2)." €
    ".$rsr[$i]['desc_iva']."\n"; - $body .= "
    \n"; - $subtot = $rsr[$i]['subtotale']; - $body .= Translator::numberToLocale($subtot, 2)." €\n"; - if ($rsr[$i]['sconto'] > 0) { - $body .= "
    \n- sconto ".Translator::numberToLocale($rsr[$i]['sconto'], 2)." €\n"; - } - $body .= "
    \n"; -$body .= 'Subtot.:'; -$body .= "\n"; -$totale_documento = $imponibile_documento; -$body .= Translator::numberToLocale($totale_documento, 2)." €\n"; -$body .= "
    \n"; - $body .= 'Sconto:'; - $body .= "\n"; - $body .= Translator::numberToLocale($sconto, 2)." €\n"; - $body .= '
    \n"; - $body .= 'Totale scontato:'; - $body .= "\n"; - $totale_documento -= $sconto; - $body .= Translator::numberToLocale($totale_documento, 2)." €\n"; - $body .= "
    \n"; - $body .= 'Rivalsa INPS:'; - $body .= "\n"; - $body .= Translator::numberToLocale($rs[0]['rivalsainps'], 2)." €\n"; - $body .= "
    \n"; - $body .= 'Iva:'; - $body .= "\n"; - $body .= Translator::numberToLocale($totale_iva, 2)." €\n"; - $body .= "
    \n"; -$body .= 'Totale documento:'; -$body .= "\n"; -$body .= ''.Translator::numberToLocale($totale_documento, 2)." €\n"; -$body .= "
    \n"; - $body .= 'Marca da bollo:'; - $body .= "\n"; - $marca_da_bollo = str_replace(',', '.', $rs[0]['bollo']); - $body .= Translator::numberToLocale($marca_da_bollo, 2).' €'; - $body .= "
    \n"; - $body .= "Ritenuta d'acconto:"; - $body .= "\n"; - $body .= Translator::numberToLocale($rs[0]['ritenutaacconto'], 2).' €'; - $body .= "
    \n"; - $body .= 'Netto a pagare:'; - $body .= "\n"; - $body .= ''.Translator::numberToLocale($netto_a_pagare, 2)." €\n"; - $body .= "
    \n"; - -$body .= '

    '.nl2br($rs[0]['note'])."

    \n"; - -$report_name = 'fattura_'.$numero_doc.'.pdf'; diff --git a/templates/fatture/settings.php b/templates/fatture/settings.php new file mode 100644 index 000000000..9f512237e --- /dev/null +++ b/templates/fatture/settings.php @@ -0,0 +1,6 @@ + '90', + 'footer' => '70', +]; diff --git a/templates/interventi/actions.php b/templates/interventi/body.php similarity index 95% rename from templates/interventi/actions.php rename to templates/interventi/body.php index 6e9c95af9..9cdef35c4 100644 --- a/templates/interventi/actions.php +++ b/templates/interventi/body.php @@ -4,10 +4,12 @@ include_once __DIR__.'/../../core.php'; include_once $docroot.'/modules/interventi/modutil.php'; +$report_name = 'intervento_'.$idintervento.'.pdf'; + /* Dati intervento */ -$body .= ' +echo ' @@ -19,19 +21,19 @@ $body .= ' '; // Richiesta -$body .= ' +echo ' @@ -41,7 +43,7 @@ $body .= ' // Descrizione if ($records[0]['descrizione_intervento'] != '') { - $body .= ' + echo ' @@ -49,7 +51,7 @@ if ($records[0]['descrizione_intervento'] != '') { '; } -$body .= ' +echo '
    '.tr('Referente').': '.$referente.''; if ($c_telefono != '') { - $body .= ' + echo '
    '.tr('Telefono azienda').': '.$c_telefono.''; } if ($c_email != '') { - $body .= ' + echo '
    '.tr('Email').': '.$c_email.''; } - $body .= ' + echo '
    '.tr('Richiesta').':
    '.tr('Descrizione').':
    '.nl2br($records[0]['descrizione_intervento']).'
    '; $totale = []; @@ -59,7 +61,7 @@ $totale = []; // Conteggio articoli utilizzati $rs2 = $dbo->fetchArray('SELECT *, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, SUM(qta) AS sumqta FROM `mg_articoli_interventi` HAVING idintervento='.prepare($idintervento)." AND NOT idarticolo='0' ORDER BY idarticolo ASC"); if (!empty($rs2)) { - $body .= ' + echo ' @@ -98,29 +100,29 @@ if (!empty($rs2)) { $totale_articoli = []; foreach ($rs2 as $r) { - $body .= ' + echo ' '; // Codice - $body .= ' + echo ' '; // Descrizione - $body .= ' + echo ' '; // Quantità - $body .= ' + echo ' '; // Prezzo unitario - $body .= ' + echo ' '; @@ -132,7 +134,7 @@ if (!empty($rs2)) { $sconto = '-'; } - $body .= ' + echo ' '; @@ -140,7 +142,7 @@ if (!empty($rs2)) { // Netto $netto = ($r['prezzo_vendita'] - $r['sconto']) * $r['sumqta']; - $body .= ' + echo ' @@ -155,7 +157,7 @@ if (!empty($rs2)) { // Totale spesa articoli if ($visualizza_costi) { - $body .= ' + echo ' '; } - $body .= ' + echo '
    '.$r['codice_art'].' '.$r['descrizione'].' '.Translator::numberToLocale($r['sumqta'], 2).' '.$r['um'].' '.($visualizza_costi ? Translator::numberToLocale($r['prezzo_vendita'], 2).' €' : '-').' '.($visualizza_costi ? $sconto : '-').' '.($visualizza_costi ? Translator::numberToLocale($netto, 2) : '-').'
    '.strtoupper(tr('Totale materiale utilizzato')).': @@ -167,7 +169,7 @@ if (!empty($rs2)) {
    '; } @@ -176,7 +178,7 @@ if (!empty($rs2)) { // Conteggio SPESE AGGIUNTIVE $rs2 = $dbo->fetchArray('SELECT * FROM in_righe_interventi WHERE idintervento='.prepare($idintervento).' ORDER BY id ASC'); if (!empty($rs2)) { - $body .= ' + echo ' @@ -216,7 +218,7 @@ if (!empty($rs2)) { foreach ($rs2 as $r) { // Articolo - $body .= ' + echo ' @@ -225,14 +227,14 @@ if (!empty($rs2)) { '; // Quantità - $body .= ' + echo ' '; // Prezzo unitario - $body .= ' + echo ' '; @@ -244,7 +246,7 @@ if (!empty($rs2)) { $sconto = '-'; } - $body .= ' + echo ' '; @@ -252,7 +254,7 @@ if (!empty($rs2)) { // Prezzo totale $netto = ($r['prezzo_vendita'] - $r['sconto']) * $r['qta']; - $body .= ' + echo ' @@ -267,7 +269,7 @@ if (!empty($rs2)) { if ($visualizza_costi) { // Totale spese aggiuntive - $body .= ' + echo ' '; } - $body .= ' + echo '
    '.Translator::numberToLocale($r['qta'], 2).' '.($visualizza_costi ? Translator::numberToLocale($r['prezzo_vendita'], 2).' €' : '-').' '.($visualizza_costi ? $sconto : '-').' '.($visualizza_costi ? Translator::numberToLocale($netto, 2) : '-').'
    '.strtoupper(tr('Totale spese aggiuntive')).': @@ -279,14 +281,14 @@ if (!empty($rs2)) {
    '; } // FINE SPESE AGGIUNTIVE // ORE TECNICI + FIRMA -$body .= ' +echo ' @@ -297,7 +299,7 @@ $body .= ' '; // INTESTAZIONE ELENCO TECNICI -$body .= ' +echo ' '; // nome tecnico - $body .= ' + echo ' '; // data - $body .= ' + echo ' '; // ora inizio - $body .= ' + echo ' '; // ora fine - $body .= ' + echo ' '; // Sconto - $body .= ' + echo ' @@ -383,11 +385,11 @@ $totale_intervento = sum($totale_manodopera, $totale_viaggio); $totale[] = $totale_intervento; -$body .= ' +echo '
    '.tr('Tecnico').' @@ -332,35 +334,35 @@ $totale_manodopera = 0; $totale_viaggio = 0; foreach ($rst as $r) { - $body .= ' + echo '
    '.$r['ragione_sociale'].' '.Translator::dateToLocale($r['orario_inizio'], '-').' '.Translator::timeToLocale($r['orario_inizio'], '-').' '.Translator::timeToLocale($r['orario_fine'], '-').' '.($r['sconto_unitario'] > 0 ? Translator::numberToLocale($r['sconto_unitario']).($r['tipo_sconto'] == 'PRC' ? '%' : ' €') : '-').'
    '; // ore lavorate -$body .= ' +echo ' @@ -412,7 +414,7 @@ $body .= ' '; // Ore lavoro -$body .= ' +echo ' @@ -425,7 +427,7 @@ $body .= ' '; if ($visualizza_costi) { - $body .= ' + echo ' @@ -434,17 +436,17 @@ if ($visualizza_costi) { '.Translator::numberToLocale($totale_manodopera, 2).' € '; } else { - $body .= ' + echo ' '; } -$body .= ' +echo ' '; // Ore di viaggio if ($totale_km > 0) { - $body .= ' + echo ' @@ -457,7 +459,7 @@ if ($totale_km > 0) { '; if ($visualizza_costi) { - $body .= ' + echo ' @@ -466,17 +468,17 @@ if ($totale_km > 0) { '.Translator::numberToLocale($totale_viaggio, 2).' € '; } else { - $body .= ' + echo ' '; } - $body .= ' + echo ' '; } // Subtotale manodopera + viaggio if ($visualizza_costi) { - $body .= ' + echo ' '; } -$body .= ' +echo '
    '.Translator::numberToLocale($totale_costo_ore, 2).' € - -
    '.Translator::numberToLocale($totale_costo_km, 2).' € - -
    '.strtoupper(tr('Totale intervento')).': @@ -488,14 +490,14 @@ if ($visualizza_costi) {
    '; $totale = sum($totale); // TOTALE COSTI FINALI if ($visualizza_costi) { - $body .= ' + echo '
    @@ -503,7 +505,7 @@ if ($visualizza_costi) { '; // Totale imponibile - $body .= ' + echo ' '.strtoupper(tr('Imponibile')).': @@ -523,7 +525,7 @@ if ($visualizza_costi) { $totale = sum($totale, -$records[0]['sconto_globale']); - $body .= ' + echo ' '.strtoupper(tr('Sconto incondizionato')).': @@ -535,7 +537,7 @@ if ($visualizza_costi) { '; // Imponibile scontato - $body .= ' + echo ' '.strtoupper(tr('Imponibile scontato')).': @@ -556,7 +558,7 @@ if ($visualizza_costi) { // IVA // Totale intervento - $body .= ' + echo ' '.strtoupper(tr('Iva')).' ('.Translator::numberToLocale($percentuale_iva, 0).'%): @@ -570,7 +572,7 @@ if ($visualizza_costi) { $totale = sum($totale, $iva); // TOTALE INTERVENTO - $body .= ' + echo ' '.strtoupper(tr('Totale intervento')).': @@ -590,7 +592,7 @@ if ($records[0]['firma_file'] != '') { $firma = ''; } -$body .= ' +echo '
    @@ -606,5 +608,3 @@ $body .= '
    '; - -$report_name = 'intervento_'.$idintervento.'.pdf'; diff --git a/templates/interventi/header.php b/templates/interventi/header.php new file mode 100644 index 000000000..d85bee517 --- /dev/null +++ b/templates/interventi/header.php @@ -0,0 +1,18 @@ + +
    + Logo +
    +
    +

    $f_ragionesociale$

    +

    $f_indirizzo$ $f_citta$

    +

    $f_piva$

    +

    $f_codicefiscale$

    +

    $f_capsoc$

    +

    $f_telefono$

    +

    $f_sitoweb$

    +

    $f_email$

    +
    +
    '; diff --git a/templates/interventi/init.php b/templates/interventi/init.php index 011a6bcf3..0c49bf92e 100644 --- a/templates/interventi/init.php +++ b/templates/interventi/init.php @@ -10,7 +10,6 @@ $module_name = 'Interventi'; $query = 'SELECT in_interventi.*, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=idclientefinale) AS clientefinale, (SELECT numero FROM co_preventivi WHERE id=(SELECT idpreventivo FROM co_preventivi_interventi WHERE idintervento=in_interventi.id ORDER BY idpreventivo DESC LIMIT 0,1)) AS numero_preventivo, (SELECT SUM(prezzo_dirittochiamata) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_dirittochiamata`, (SELECT SUM(km) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_km`, (SELECT SUM(ore*prezzo_ore_unitario) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_ore_consuntivo`, (SELECT SUM(prezzo_km_consuntivo) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_km_consuntivo`, in_interventi.descrizione AS `descrizione_intervento`, richiesta FROM in_interventi INNER JOIN in_tipiintervento ON in_interventi.idtipointervento=in_tipiintervento.idtipointervento WHERE id='.prepare($idintervento).' '.Modules::getAdditionalsQuery('Interventi'); $records = $dbo->fetchArray($query); -$id_anagrafica = $records[0]['idanagrafica']; $id_cliente = $records[0]['idanagrafica']; $id_sede = $records[0]['idsede']; @@ -24,11 +23,8 @@ if (!empty($records[0]['idreferente'])) { // Sostituzioni specifiche // Imposta numerointervento-data-numerocommessa su intestazione -$report = str_replace('$intervento_numero$', $records[0]['codice'], $report); -$report = str_replace('$intervento_data$', Translator::dateToLocale($records[0]['data_richiesta']), $report); - -if ($records[0]['numero_preventivo']) { - $report = str_replace('$commessa_numero$', $records[0]['codice'], $report); -} else { - $report = str_replace('$commessa_numero$', ' ', $report); -} +$replaces = [ + 'intervento_numero' => $records[0]['codice'], + 'intervento_data' => Translator::dateToLocale($records[0]['data_richiesta']), + 'commessa_numero' => !empty($records[0]['numero_preventivo']) ? $records[0]['codice'] : ' ', +]; diff --git a/templates/interventi/layout.html b/templates/interventi/layout.html index d2f361cbd..77184900f 100644 --- a/templates/interventi/layout.html +++ b/templates/interventi/layout.html @@ -1,65 +1,59 @@ - $body$ + $body$ - - - +
    - Logo -
    + + - - -
    + Logo + - $f_ragionesociale$ - $f_indirizzo$ - $f_citta$ - $f_piva$ - $f_codicefiscale$ - $f_capsoc$ - $f_telefono$ - $f_sitoweb$ - $f_email$ -
    + + $f_ragionesociale$ $f_indirizzo$ $f_citta$ $f_piva$ $f_codicefiscale$ $f_capsoc$ $f_telefono$ $f_sitoweb$ + $f_email$ + + +
    diff --git a/templates/ordini/pdfgen.ordini.php b/templates/ordini/pdfgen.ordini.php index 8a6ca7ca2..bfc6b602a 100644 --- a/templates/ordini/pdfgen.ordini.php +++ b/templates/ordini/pdfgen.ordini.php @@ -53,7 +53,7 @@ $sconto = 0.00; /* Articoli */ -$q_art = "SELECT *, GROUP_CONCAT( CONCAT_WS(lotto, 'Lotto: ', ', '), CONCAT_WS(serial, 'SN: ', ', '), CONCAT_WS(altro, 'Altro: ', '') SEPARATOR '
    ') AS codice, SUM(qta) AS sumqta FROM `or_righe_ordini` GROUP BY idarticolo, idordine, lotto HAVING idordine='$idordine' AND NOT idarticolo='0' ORDER BY idarticolo ASC"; +$q_art = "SELECT *, CONCAT_WS(serial, 'SN: ', ', ') AS codice, SUM(qta) AS sumqta FROM `or_righe_ordini` JOIN mg_prodotti ON or_righe_ordini.idarticolo = mg_prodotti.id_articolo GROUP BY idarticolo, idordine, lotto HAVING idordine='$idordine' AND NOT idarticolo='0' ORDER BY idarticolo ASC"; $rs_art = $dbo->fetchArray($q_art); $tot_art = sizeof($rs_art); $imponibile_art = 0.0; diff --git a/templates/pdfgen_variables.php b/templates/pdfgen_variables.php index a92267af9..53c28b89e 100644 --- a/templates/pdfgen_variables.php +++ b/templates/pdfgen_variables.php @@ -5,6 +5,36 @@ */ include_once __DIR__.'/../core.php'; +// Valori aggiuntivi per la sostituzione +$values = [ + 'footer' => !empty($footer) ? $footer : '', + 'dicitura_fissa_fattura' => get_var('Dicitura fissa fattura'), + 'pagination' => ' + + + + + + +
    + '.tr('Stampato con OpenSTAManager').' + + '.str_replace(['_PAGE_', '_TOTAL_'], ['{PAGENO}', '{nb}'], tr('Pagina _PAGE_ di _TOTAL_')).' +
    ', +]; + +$values = array_merge($values, (array) $replaces); + +foreach ($values as $key => $value) { + $values['$'.$key.'$'] = $value; + unset($values[$key]); +} + +// Sostituisce alle variabili del template i valori +$head = str_replace(array_keys($values), array_values($values), $head); +$foot = str_replace(array_keys($values), array_values($values), $foot); +$report = str_replace(array_keys($values), array_values($values), $report); + // Retrocompatibilità $id_cliente = $id_cliente ?: $idcliente; @@ -57,7 +87,6 @@ foreach ($replace as $prefix => $values) { } $values['codice'] = !empty($values['codice']) ? $values['codice'].',' : ''; - $values['ragionesociale'] = !empty($values['ragionesociale']) ? $values['ragionesociale'].',' : ''; $values['provincia'] = !empty($values['provincia']) ? '('.$values['provincia'].')' : ''; $citta = ''; @@ -71,7 +100,7 @@ foreach ($replace as $prefix => $values) { if ($values['provincia'] != '') { $citta .= ' '.$values['provincia']; } - $citta .= '
    '; + //$citta .= '
    '; $values['citta'] = $citta; @@ -96,46 +125,12 @@ foreach ($replace as $prefix => $values) { } foreach ($values as $key => $value) { - $values['$'.$prefix.$key.'$'] = empty($value) ? $value : $value.'
    '; + $values['$'.$prefix.$key.'$'] = empty($value) ? $value : $value; // .'
    ' unset($values[$key]); } // Sostituisce alle variabili del template i valori - $body = str_replace(array_keys($values), array_values($values), $body); + $head = str_replace(array_keys($values), array_values($values), $head); + $foot = str_replace(array_keys($values), array_values($values), $foot); $report = str_replace(array_keys($values), array_values($values), $report); } - -// Aggiunta del footer standard -if (!str_contains($body, '') && !str_contains($report, '')) { - $report .= ' - - - $pagination$ -'; -} - -// Valori aggiuntivi per la sostituzione -$values = [ - 'dicitura_fissa_fattura' => get_var('Dicitura fissa fattura'), - 'pagination' => ' - - - - - - -
    - '.tr('Stampato con OpenSTAManager').' - - '.str_replace(['_PAGE_', '_TOTAL_'], ['[[page_cu]]', '[[page_nb]]'], tr('Pagina _PAGE_ di _TOTAL_')).' -
    ', -]; - -foreach ($values as $key => $value) { - $values['$'.$key.'$'] = empty($value) ? $value : $value.'
    '; - unset($values[$key]); -} - -// Sostituisce alle variabili del template i valori -$body = str_replace(array_keys($values), array_values($values), $body); -$report = str_replace(array_keys($values), array_values($values), $report); diff --git a/templates/preventivi_cons/pdfgen.preventivi_cons.php b/templates/preventivi_cons/pdfgen.preventivi_cons.php index ac54d092a..ecfe8e960 100644 --- a/templates/preventivi_cons/pdfgen.preventivi_cons.php +++ b/templates/preventivi_cons/pdfgen.preventivi_cons.php @@ -192,7 +192,7 @@ if (sizeof($preventivi) > 0) { $body .= "
    \n"; // Conteggio articoli utilizzati -$query = "SELECT *, (SELECT orario_inizio FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento = mg_articoli_interventi.idintervento) AS data_intervento, (SELECT percentuale FROM co_iva WHERE id=mg_articoli_interventi.idiva_vendita) AS prciva_vendita, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, GROUP_CONCAT( CONCAT_WS(lotto, 'Lotto: ', ', '), CONCAT_WS(serial, 'SN: ', ', '), CONCAT_WS(altro, 'Altro: ', '') SEPARATOR '
    ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` GROUP BY idarticolo, idintervento, lotto HAVING ".(!empty($idinterventi) ? 'idintervento IN('.implode(',', $idinterventi).') AND ' : '')." NOT idarticolo='0' ORDER BY idarticolo ASC"; +$query = "SELECT *, (SELECT orario_inizio FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento = mg_articoli_interventi.idintervento) AS data_intervento, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino FROM an_anagrafiche WHERE idanagrafica=(SELECT idanagrafica FROM in_interventi WHERE id=mg_articoli_interventi.idintervento) ) ) AS prc_guadagno,(SELECT percentuale FROM co_iva WHERE id=mg_articoli_interventi.idiva_vendita) AS prciva_vendita, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, CONCAT_WS(serial, 'SN: ', ', ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` JOIN mg_prodotti ON mg_articoli_interventi.idarticolo = mg_prodotti.id_articolo GROUP BY idarticolo, idintervento, lotto HAVING ".(!empty($idinterventi) ? 'idintervento IN('.implode(',', $idinterventi).') AND ' : '')." NOT idarticolo='0' ORDER BY idarticolo ASC"; $rs2 = $dbo->fetchArray($query); if (sizeof($rs2) > 0) { diff --git a/templates/riepilogo_interventi/pdfgen.riepilogo_interventi.php b/templates/riepilogo_interventi/pdfgen.riepilogo_interventi.php index fa58080ac..a72e5f3ac 100644 --- a/templates/riepilogo_interventi/pdfgen.riepilogo_interventi.php +++ b/templates/riepilogo_interventi/pdfgen.riepilogo_interventi.php @@ -275,7 +275,7 @@ if (sizeof($info_intervento) > 0) { } // Conteggio articoli utilizzati -$query = "SELECT *, (SELECT percentuale FROM co_iva WHERE id=(SELECT idiva_vendita FROM mg_articoli WHERE id=idarticolo)) AS prciva_vendita, (SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=mg_articoli_interventi.idintervento GROUP BY idintervento HAVING idintervento=mg_articoli_interventi.idintervento) AS data_intervento, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino FROM an_anagrafiche WHERE idanagrafica=(SELECT idanagrafica FROM in_interventi WHERE id=mg_articoli_interventi.idintervento) ) ) AS prc_guadagno, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, GROUP_CONCAT( CONCAT_WS(lotto, 'Lotto: ', ', '), CONCAT_WS(serial, 'SN: ', ', '), CONCAT_WS(altro, 'Altro: ', '') SEPARATOR '
    ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` GROUP BY idarticolo, idintervento, lotto HAVING idintervento IN(".implode(',', $idinterventi).") AND NOT idarticolo='0' ORDER BY idarticolo ASC"; +$query = "SELECT *, (SELECT percentuale FROM co_iva WHERE id=(SELECT idiva_vendita FROM mg_articoli WHERE id=idarticolo)) AS prciva_vendita, (SELECT orario_inizio FROM in_interventi_tecnici WHERE idintervento=mg_articoli_interventi.idintervento GROUP BY idintervento HAVING idintervento=mg_articoli_interventi.idintervento) AS data_intervento, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino FROM an_anagrafiche WHERE idanagrafica=(SELECT idanagrafica FROM in_interventi WHERE id=mg_articoli_interventi.idintervento) ) ) AS prc_guadagno, (SELECT codice FROM mg_articoli WHERE id=idarticolo) AS codice_art, CONCAT_WS(serial, 'SN: ', ', ') AS codice, SUM(qta) AS sumqta FROM `mg_articoli_interventi` JOIN mg_prodotti ON mg_articoli_interventi.idarticolo = mg_prodotti.id_articolo GROUP BY idarticolo, idintervento, lotto HAVING idintervento IN(".implode(',', $idinterventi).") AND NOT idarticolo='0' ORDER BY idarticolo ASC"; $rs2 = $dbo->fetchArray($query); if (sizeof($rs2) > 0) { $body .= "\n"; diff --git a/update/2_3.sql b/update/2_3.sql index 6c71a724c..10727ed65 100644 --- a/update/2_3.sql +++ b/update/2_3.sql @@ -906,3 +906,7 @@ UPDATE `co_righe_documenti` SET `abilita_serial` = 1 WHERE `idarticolo` IN (SELE UPDATE `dt_righe_ddt` SET `abilita_serial` = 1 WHERE `idarticolo` IN (SELECT `id_articolo` FROM `mg_prodotti`); UPDATE `mg_articoli_interventi` SET `abilita_serial` = 1 WHERE `idarticolo` IN (SELECT `id_articolo` FROM `mg_prodotti`); UPDATE `or_righe_ordini` SET `abilita_serial` = 1 WHERE `idarticolo` IN (SELECT `id_articolo` FROM `mg_prodotti`); + +-- Rimozione sconto/rincaro per i preventivi +UPDATE `co_righe_preventivi` SET `sconto_unitario` = `prc_guadagno`, `tipo_sconto` = 'PRC', `sconto` = `prc_guadagno` * `qta` WHERE `prc_guadagno` != 0; +ALTER TABLE `co_righe_preventivi ` DROP `prc_guadagno `;