Aggiunta header.php in ordini

This commit is contained in:
pek5892 2024-05-23 12:25:09 +02:00
parent 42312e5501
commit bf305d0e4b
6 changed files with 478 additions and 133 deletions

View File

@ -44,75 +44,56 @@ if ($righe_vuote) {
</div>';
}
?><form action="" method="post" id="edit-form">
echo'
<form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<input type="hidden" name="id_record" value="<?php echo $id_record; ?>">
<!-- INTESTAZIONE -->
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title"><?php echo tr('Intestazione'); ?></h3>
</div>
<div class="card-body">
<div class="row">
<div class="row">
<div class="col-md-2 offset-md-10">';
if (setting('Cambia automaticamente stato ordini fatturati')) {
$id_stato_evaso = (new Stato())->getByField('title', 'Evaso', Models\Locale::getPredefined()->id);
$id_stato_parz_evaso = (new Stato())->getByField('title', 'Parzialmente evaso', Models\Locale::getPredefined()->id);
$id_stato_fatt = (new Stato())->getByField('title', 'Fatturato', Models\Locale::getPredefined()->id);
$id_stato_parz_fatt = (new Stato())->getByField('title', 'Parzialmente fatturato', Models\Locale::getPredefined()->id);
$id_stato_accettato = (new Stato())->getByField('title', 'Accettato', Models\Locale::getPredefined()->id);
<div class="col-md-3" <?php echo ($dir == 'entrata') ? 'hidden' : ''; ?>>
{[ "type": "text", "label": "<?php echo tr('Numero ordine'); ?>", "name": "numero", "required": 1, "class": "text-center", "value": "$numero$" ]}
</div>
<div class="col-md-3">
{[ "type": "text", "label": "<?php echo ($dir == 'entrata') ? tr('Numero ordine') : tr('Numero ordine fornitore'); ?>", "name": "numero_esterno", "class": "text-center", "value": "$numero_esterno$" ]}
</div>
<div class="col-md-3">
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "$data$" ]}
</div>
<div class="col-md-3">
<?php
if (setting('Cambia automaticamente stato ordini fatturati')) {
$id_stato_evaso = (new Stato())->getByField('title', 'Evaso', Models\Locale::getPredefined()->id);
$id_stato_parz_evaso = (new Stato())->getByField('title', 'Parzialmente evaso', Models\Locale::getPredefined()->id);
$id_stato_fatt = (new Stato())->getByField('title', 'Fatturato', Models\Locale::getPredefined()->id);
$id_stato_parz_fatt = (new Stato())->getByField('title', 'Parzialmente fatturato', Models\Locale::getPredefined()->id);
$id_stato_accettato = (new Stato())->getByField('title', 'Accettato', Models\Locale::getPredefined()->id);
if ($ordine->stato->id == $id_stato_fatt || $ordine->stato->id == $id_stato_parz_fatt || $ordine->stato->id == $id_stato_evaso || $ordine->stato->id == $id_stato_parz_evaso) {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`title` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title`", "value": "$idstatoordine$", "extra": "readonly", "class": "unblockable" ]}
<?php
} else {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`title` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) WHERE (`is_fatturabile` = 0 AND `or_statiordine`.`id` != <?php echo $id_stato_fatt; ?> || `or_statiordine`.`id` = <?php echo $id_stato_accettato; ?>) ORDER BY `title`", "value": "$idstatoordine$", "class": "unblockable" ]}
<?php
}
} else {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `colore` AS _bgcolor_, `or_statiordine_lang`.`title` as descrizione FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title`", "value": "$idstatoordine$", "class": "unblockable" ]}
<?php
}
?>
</div>
<?php
if ($dir == 'entrata') {
echo '
<div class="col-md-3">';
if ($record['idagente'] != 0) {
echo Modules::link('Anagrafiche', $record['idagente'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Agente').'", "name": "idagente", "ajax-source": "agenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "$idagente$" ]}
</div>';
if ($ordine->stato->id == $id_stato_fatt || $ordine->stato->id == $id_stato_parz_fatt || $ordine->stato->id == $id_stato_evaso || $ordine->stato->id == $id_stato_parz_evaso) {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`title` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title`", "value": "$idstatoordine$", "extra": "readonly", "class": "unblockable" ]}
<?php
} else {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`title` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) WHERE (`is_fatturabile` = 0 AND `or_statiordine`.`id` != <?php echo $id_stato_fatt; ?> || `or_statiordine`.`id` = <?php echo $id_stato_accettato; ?>) ORDER BY `title`", "value": "$idstatoordine$", "class": "unblockable" ]}
<?php
}
?>
</div>
} else {
?>
{[ "type": "select", "label": "<?php echo tr('Stato'); ?>", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `colore` AS _bgcolor_, `or_statiordine_lang`.`title` as descrizione FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) ORDER BY `title`", "value": "$idstatoordine$", "class": "unblockable" ]}
<?php
}
<div class="row">
<div class="col-md-3">
<?php
echo '
</div>
</div>
<!-- DATI INTESTAZIONE -->
<div class="card card-primary collapsable '.(empty($espandi_dettagli) ? 'collapsed-card' : '').'">
<div class="card-header with-border">
<h3 class="card-title">'.tr('Dati cliente').'</h3>
<div class="card-tools pull-right">
<button type="button" class="btn btn-card-tool" data-card-widget="collapse">
<i class="fa fa-'.(empty($espandi_dettagli) ? 'plus' : 'minus').'"></i>
</button>
</div>
</div>
<div class="card-body">
<div class="card-body">
<!-- RIGA 1 -->
<div class="row">
<div class="col-md-3">';
echo Modules::link('Anagrafiche', $record['idanagrafica'], null, null, 'class="pull-right"');
if ($dir == 'entrata') {
@ -124,40 +105,81 @@ if ($dir == 'entrata') {
{[ "type": "select", "label": "<?php echo tr('Fornitore'); ?>", "name": "idanagrafica", "required": 1, "ajax-source": "fornitori", "value": "$idanagrafica$" ]}
<?php
}
echo '
</div>
echo'
</div>
<div class="col-md-3">';
if (!empty($record['idreferente'])) {
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede'].'} ]}
</div>
<div class="col-md-3">';
if (!empty($record['idreferente'])) {
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede'].'} ]}
</div>
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Sede').'", "name": "idsede", "required": 1, "ajax-source": "sedi", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "'.$record['idsede'].'" ]}
</div>';
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Sede').'", "name": "idsede", "required": 1, "ajax-source": "sedi", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "'.$record['idsede'].'" ]}
if ($dir == 'entrata') {
echo '
<div class="col-md-3">';
if ($record['idagente'] != 0) {
echo Modules::link('Anagrafiche', $record['idagente'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Agente').'", "name": "idagente", "ajax-source": "agenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "$idagente$" ]}
</div>';
}
echo'
</div>
</div>
</div>
</div>';
?>
<!-- INTESTAZIONE -->
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title"><?php echo tr('Intestazione'); ?></h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-2" <?php echo ($dir == 'entrata') ? 'hidden' : ''; ?>>
{[ "type": "text", "label": "<?php echo tr('Numero ordine'); ?>", "name": "numero", "required": 1, "class": "text-center", "value": "$numero$" ]}
</div>
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Pagamento').'", "name": "idpagamento", "required": 0, "ajax-source": "pagamenti", "value": "$idpagamento$" ]}
<div class="col-md-2">
{[ "type": "text", "label": "<?php echo ($dir == 'entrata') ? tr('Numero ordine') : tr('Numero ordine fornitore'); ?>", "name": "numero_esterno", "class": "text-center", "value": "$numero_esterno$" ]}
</div>
</div>';
<div class="col-md-2">
{[ "type": "date", "label": "<?php echo tr('Data'); ?>", "name": "data", "required": 1, "value": "$data$" ]}
</div>
<div class="col-md-4">
{[ "type": "select", "label": "<?php echo tr('Pagamento'); ?>", "name": "idpagamento", "required": 0, "ajax-source": "pagamenti", "value": "$idpagamento$" ]}
</div>
<div class="col-md-2">
{[ "type": "number", "label": "<?php echo 'Sconto in fattura'; ?>", "name": "sconto_finale", "value": "<?php echo $ordine->sconto_finale_percentuale ?: $ordine->sconto_finale; ?>", "icon-after": "choice|untprc|<?php echo empty($ordine->sconto_finale) ? 'PRC' : 'UNT'; ?>", "help": "<?php echo tr('Sconto in fattura, utilizzabile per applicare sconti sul netto a pagare del documento'); ?>." ]}
</div>
</div>
<?php
if ($dir == 'entrata') {
?>
<div class="row">
<div class="col-md-6">
<div class="col-md-2">
{[ "type": "text", "label": "<?php echo tr('Numero ordine cliente'); ?>", "name": "numero_cliente", "required":0, "value": "<?php echo $record['numero_cliente']; ?>", "help": "<?php echo tr('<span>Obbligatorio per valorizzare CIG/CUP. &Egrave; possible inserire: </span><ul><li>N. determina</li><li>RDO</li><li>Ordine MEPA</li></ul>'); ?>" ]}
</div>
<div class="col-md-3">
<div class="col-md-2">
{[ "type": "date", "label": "<?php echo tr('Data ordine cliente'); ?>", "name": "data_cliente", "value": "<?php echo $record['data_cliente']; ?>" ]}
</div>
<div class="col-md-3">
{[ "type": "number", "label": "<?php echo 'Sconto in fattura'; ?>", "name": "sconto_finale", "value": "<?php echo $ordine->sconto_finale_percentuale ?: $ordine->sconto_finale; ?>", "icon-after": "choice|untprc|<?php echo empty($ordine->sconto_finale) ? 'PRC' : 'UNT'; ?>", "help": "<?php echo tr('Sconto in fattura, utilizzabile per applicare sconti sul netto a pagare del documento'); ?>." ]}
</div>
</div>
<?php
}

336
modules/ordini/header.php Normal file
View File

@ -0,0 +1,336 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
use Carbon\Carbon;
use Models\Module;
use Models\Upload;
use Modules\Anagrafiche\Anagrafica;
use Modules\Anagrafiche\Sede;
use Modules\Contratti\Contratto;
use Modules\Interventi\Intervento;
use Modules\Preventivi\Preventivo;
use Modules\Scadenzario\Scadenza;
// Anagrafica
$anagrafica = $ordine->anagrafica;
// Sede
if ($ordine->idsede_destinazione) {
$sede = $dbo->selectOne('an_sedi', '*', ['id' => $ordine->idsede_destinazione]);
} else {
$sede = $anagrafica->toArray();
}
// Referente
$referente = null;
if ($ordine->idreferente) {
$referente = $dbo->selectOne('an_referenti', '*', ['id' => $ordine->idreferente]);
}
// Contratto
$contratto = null;
$ore_erogate = 0;
$ore_previste = 0;
$perc_ore = 0;
$color = 'danger';
if ($ordine->id_contratto) {
$contratto = Contratto::find($ordine->id_contratto);
$ore_erogate = $contratto->interventi->sum('ore_totali');
$ore_previste = $contratto->getRighe()->where('um', 'ore')->sum('qta');
$perc_ore = $ore_previste != 0 ? ($ore_erogate * 100) / $ore_previste : 0;
if ($perc_ore < 75) {
$color = 'success';
} elseif ($perc_ore <= 100) {
$color = 'warning';
}
}
// Preventivo
$preventivo = null;
if ($ordine->id_preventivo) {
$preventivo = Preventivo::find($ordine->id_preventivo);
}
// Altre attività
$interventi_programmati = Intervento::select('in_interventi.*')
->join('in_statiintervento', 'in_interventi.idstatointervento', '=', 'in_statiintervento.id')
->where('idanagrafica', $intervento->idanagrafica)
->where('idsede_destinazione', $intervento->idsede_destinazione)
->where('is_completato', '!=', 1)
->where('in_interventi.id', '!=', $id_record)
->get();
// Insoluti
$insoluti = Scadenza::where('idanagrafica', $ordine->idanagrafica)
->whereRaw('co_scadenziario.da_pagare > co_scadenziario.pagato')
->whereRaw('co_scadenziario.scadenza < NOW()')
->count();
// Logo
$logo = Upload::where('id_module', (new Module())->getByField('title', 'Anagrafiche'))->where('id_record', $ordine->idanagrafica)->where('name', 'Logo azienda')->first()->filename;
$logo = $logo ? base_path().'/files/anagrafiche/'.$logo : App::getPaths()['img'].'/logo_header.png';
echo '
<hr>
<div class="row">
<div class="col-md-1">
<img src="'.$logo.'" class="img-fluid">
</div>';
// Cliente
echo '
<div class="col-md-3">
<h4 style="margin:4px 0;"><b>'.$anagrafica->ragione_sociale.'</b></h4>
<p style="margin:3px 0;">
'.($sede['nomesede'] ? $sede['nomesede'].'<br>' : '').'
'.$sede['indirizzo'].'<br>
'.$sede['cap'].' - '.$sede['citta'].' ('.$sede['provincia'].')
</p>
<p style="margin:3px 0;">
'.($sede['telefono'] ? '<a class="btn btn-default btn-xs" href="tel:'.$sede['telefono'].'" target="_blank"><i class="fa fa-phone text-maroon"></i> '.$sede['telefono'].'</a>' : '').'
'.($sede['email'] ? '<a class="btn btn-default btn-xs" href="mailto:'.$sede['email'].'"><i class="fa fa-envelope text-maroon"></i> '.$sede['email'].'</a>' : '').'
'.($referente['nome'] ? '<p></p><i class="fa fa-user-o text-muted"></i> '.$referente['nome'].'<br>' : '').'
'.($referente['telefono'] ? '<a class="btn btn-default btn-xs" href="tel:'.$referente['telefono'].'" target="_blank"><i class="fa fa-phone text-maroon"></i> '.$referente['telefono'].'</a>' : '').'
'.($referente['email'] ? '<a class="btn btn-default btn-xs" href="mailto:'.$referente['email'].'"><i class="fa fa-envelope text-maroon"></i> '.$referente['email'].'</a>' : '').'
</p>
</div>';
// Panoramica
echo '
<div class="col-md-4">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><i class="fa fa-map"></i> '.tr('Panoramica ordine num. ').$ordine->numero.'</h3>
</div>
<div class="card-body">
<p style="margin:3px 0;"><i class="fa fa-'.($insoluti ? 'warning text-danger' : 'check text-success').'"></i>
'.($insoluti ? tr('Sono presenti insoluti') : tr('Non sono presenti insoluti')).'
</p>
<p style="margin:3px 0;"><i class="fa '.(count($interventi_programmati) == 0 ? 'fa-clock-o text-success' : 'fa-clock-o text-warning').'"></i> '.(count($interventi_programmati) == 0 ? tr('Non sono presenti altre attività programmate') : 'Attività aperte:');
if (count($interventi_programmati) != 0) {
foreach ($interventi_programmati as $ordine_programmato) {
echo ' <a class="btn btn-default btn-xs" href="'.base_path().'/editor.php?id_module='.Modules::get('Interventi')['id'].'&id_record='.$ordine_programmato->id.'" target="_blank">'.$ordine_programmato->codice.' ('.(new Carbon($ordine_programmato->data_richiesta))->diffForHumans().')</a>';
}
}
echo '
</p>';
// Contratto
if ($contratto) {
echo '
<p style="margin:3px 0;"><i class="fa fa-book text-info"></i>
'.Modules::link('Contratti', $contratto->id, tr('Contratto num. _NUM_ del _DATA_', ['_NUM_' => $contratto->numero, '_DATA_' => Translator::dateToLocale($contratto->data_bozza)]));
if ($ore_previste > 0) {
echo '
- '.$ore_erogate.'/'.$ore_previste.' '.tr('ore').'<br>
<div class="progress" style="margin:0; height:8px;">
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ore.'%"></div>
</div>';
}
echo '
</p>';
}
// Preventivo
if ($preventivo) {
echo '
<p style="margin:3px 0;"><i class="fa fa-book text-info"></i>
'.Modules::link('Preventivi', $preventivo->id, tr('Preventivo num. _NUM_ del _DATA_', ['_NUM_' => $preventivo->numero, '_DATA_' => Translator::dateToLocale($preventivo->data_bozza)])).'
</p>';
}
echo '
</div>
</div>
</div>';
// Geolocalizzazione
$anagrafica_cliente = $ordine->anagrafica;
$sede_cliente = $anagrafica_cliente->sedeLegale;
if (!empty($ordine->idsede_destinazione)) {
$sede_cliente = Sede::find($ordine->idsede_destinazione);
}
$anagrafica_azienda = Anagrafica::find(setting('Azienda predefinita'));
$sede_azienda = $anagrafica_azienda->sedeLegale;
echo '
<div class="col-md-4">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><i class="fa fa-map"></i> '.tr('Geolocalizzazione').'</h3>
</div>
<div class="card-body">';
if (!empty($sede_cliente->gaddress) || (!empty($sede_cliente->lat) && !empty($sede_cliente->lng))) {
echo '
<div id="map-edit" style="width: 100%;"></div>
<div class="clearfix"></div>
<br>
<div class="row">
<div class="col-md-6">';
// Navigazione diretta verso l'indirizzo
echo '
<a class="btn btn-xs btn-default btn-block" onclick="$(\'#map-edit\').height(180); caricaMappa(); $(this).hide();">
<i class="fa fa-compass"></i> '.tr('Carica mappa').'
</a>
</div>
<div class="col-md-6">';
// Navigazione diretta verso l'indirizzo
echo '
<a class="btn btn-xs btn-default btn-block" onclick="calcolaPercorso()">
<i class="fa fa-map-signs"></i> '.tr('Calcola percorso').'
</a>
</div>
</div>';
} else {
echo '
<div class="row">
<div class="col-md-6">';
// Navigazione diretta verso l'indirizzo
echo '
<a class="btn btn-xs btn-default btn-block" onclick="calcolaPercorso()">
<i class="fa fa-map-signs"></i> '.tr('Calcola percorso').'
</a>
</div>
<div class="col-md-6">';
// Ricerca diretta su Mappa
echo '
<a class="btn btn-xs btn-default btn-block" onclick="cercaOpenStreetMap()">
<i class="fa fa-map-marker"></i> '.tr('Cerca su Mappa').'
</a>
</div>
</div>';
}
echo '
</div>
</div>
</div>
</div>
<script>
function modificaPosizione() {
openModal("'.tr('Modifica posizione').'", "'.$module->fileurl('modals/posizione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");
}
function cercaOpenStreetMap() {
const indirizzo = getIndirizzoAnagrafica();
const destinazione = (!isNaN(indirizzo[0]) && !isNaN(indirizzo[1])) ? indirizzo[0] + ","+ indirizzo[1] : indirizzo[2];
if (isMobile.any) {
window.open("geo:" + destinazione + "?z=16&q=" + destinazione);
} else {
if (!isNaN(indirizzo[0]) && !isNaN(indirizzo[1])) {
window.open("https://www.openstreetmap.org/?mlat=" + indirizzo[0] + "&mlon=" + indirizzo[1] + "#map=12/" + destinazione + "/" + indirizzo[1]);
} else {
window.open("https://www.openstreetmap.org/search?query=" + indirizzo[2] + "#map=12");
}
}
}
function calcolaPercorso() {
const indirizzo_partenza = getIndirizzoAzienda();
const indirizzo_destinazione = getIndirizzoAnagrafica();
const destinazione = (!isNaN(indirizzo_destinazione[0]) && !isNaN(indirizzo_destinazione[1])) ? indirizzo_destinazione[0] + ","+ indirizzo_destinazione[1] : indirizzo_destinazione[2];
if (isMobile.any) {
window.open("geo:" + destinazione + "?z=16&q=" + destinazione);
} else {
window.open("https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=" + indirizzo_partenza + ";" + destinazione);
}
}
function getIndirizzoAzienda() {
const indirizzo = "'.$sede_azienda->indirizzo.'";
const citta = "'.$sede_azienda->citta.'";
const lat = parseFloat("'.$sede_azienda->lat.'");
const lng = parseFloat("'.$sede_azienda->lng.'");
if (lat && lng){
return lat + ","+ lng;
} else {
return "";
}
}
function getIndirizzoAnagrafica() {
const indirizzo = "'.$sede_cliente->indirizzo.'";
const citta = "'.$sede_cliente->citta.'";
const lat = parseFloat("'.$sede_cliente->lat.'");
const lng = parseFloat("'.$sede_cliente->lng.'");
const indirizzo_default = encodeURI(indirizzo) + "," + encodeURI(citta);
return [lat, lng, indirizzo_default];
}
var map = null;
function caricaMappa() {
const lat = parseFloat("'.$sede_cliente->lat.'");
const lng = parseFloat("'.$sede_cliente->lng.'");
var container = L.DomUtil.get("map-edit");
if(container._leaflet_id != null){
map.eachLayer(function (layer) {
if(layer instanceof L.Marker) {
map.removeLayer(layer);
}
});
} else {
map = L.map("map-edit", {
gestureHandling: true
});
L.tileLayer("'.setting('Tile server OpenStreetMap').'", {
maxZoom: 17,
attribution: "© OpenStreetMap"
}).addTo(map);
}
var icon = new L.Icon({
iconUrl: globals.rootdir + "/assets/dist/img/marker-icon.png",
shadowUrl:globals.rootdir + "/assets/dist/img/leaflet/marker-shadow.png",
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var marker = L.marker([lat, lng], {
icon: icon
}).addTo(map);
map.setView([lat, lng], 10);
}
</script>';

View File

@ -44,14 +44,14 @@ echo '
<th width="35" class="text-center" >'.tr('#').'</th>
<th>'.tr('Descrizione').'</th>
<th width="105">'.tr('Prev. evasione').'</th>
<th class="text-center tip" width="190">'.tr('Q.').'</th>';
<th class="text-center tip" width="130">'.tr('Q.').'</th>';
if ($dir == 'entrata') {
echo '<th class="text-center" width="150">'.tr('Costo unitario').'</th>';
echo '<th class="text-center" width="130">'.tr('Costo unitario').'</th>';
}
echo '
<th class="text-center" width="180">'.tr('Prezzo unitario').'</th>
<th class="text-center" width="140">'.tr('Sconto unitario').'</th>
<th class="text-center" width="130">'.tr('Importo').'</th>
<th class="text-center" width="130">'.tr('Prezzo unitario').'</th>
<th class="text-center" width="130">'.tr('Sconto unitario').'</th>
<th class="text-center" width="100">'.tr('Importo').'</th>
<th width="80"></th>
</tr>
</thead>

View File

@ -53,11 +53,11 @@ echo '
<div class="btn-group tip" data-widget="tooltip" title="'.tr('Per creare un documento deve essere inserita almeno una riga e lo stato del preventivo deve essere tra: _STATE_LIST_', [
'_STATE_LIST_' => implode(', ', $stati),
]).'">
<button class="btn btn-info dropdown-toggle '.($disabled ? '' : 'disabled').'" type="button" data-widget="dropdown" aria-haspopup="true" aria-expanded="true">
<button class="btn btn-info dropdown-toggle '.($disabled ? '' : 'disabled').'" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-magic"></i>&nbsp;'.tr('Crea').'...
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<div class="dropdown-menu dropdown-menu-right">
<a class="'.($disabled ? '' : 'disabled').' dropdown-item" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=contratto" data-widget="modal" data-title="'.tr('Crea contratto').'">
<i class="fa fa-file-o"></i> '.tr('Contratto').'
</a>
@ -81,7 +81,7 @@ echo '
<a class="'.($disabled ? '' : 'disabled').' dropdown-item" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-widget="modal" data-title="'.tr('Crea fattura').'">
<i class="fa fa-file"></i> '.tr('Fattura').'
</a>
</ul>
</div>
</div>';
// Duplica preventivo

View File

@ -61,42 +61,42 @@ if ($documento->direzione == 'uscita') {
$columns = $options['pricing'] ? $columns : $columns - 3;
// Creazione righe fantasma
$autofill = new Util\Autofill($columns, $char_number);
$autofill->setRows(30);
$autofill = new Util\Autofill($columns);
$autofill->setRows(20, 10);
// Intestazione tabella per righe
echo "
<table class='table table-striped table-bordered' id='contents'>
<table class='table table-striped' id='contents'>
<thead>
<tr>
<th class='text-center' style='width:4%'>".tr('#', [], ['upper' => true]).'</th>';
<th class='text-center text-muted' style='width:4%'>".tr('#', [], ['upper' => true]).'</th>';
if ($has_image) {
echo "
<th class='text-center' style='width:20%'>".tr('Immagine', [], ['upper' => true]).'</th>';
<th class='text-center text-muted' style='width:20%'>".tr('Immagine', [], ['upper' => true]).'</th>';
}
echo "
<th class='text-center'>".tr('Descrizione', [], ['upper' => true]).'</th>
<th class='text-center text-muted'>".tr('Descrizione', [], ['upper' => true]).'</th>
';
if ($documento->direzione == 'uscita') {
echo "
<th class='text-center' style='width:11%'>".tr('Codice', [], ['upper' => true])."</th>
<th class='text-center' style='width:11%'>".tr('Codice fornitore', [], ['upper' => true]).'</th>';
<th class='text-center text-muted' style='width:10%'>".tr('Codice', [], ['upper' => true])."</th>
<th class='text-center text-muted' style='width:10%'>".tr('Codice fornitore', [], ['upper' => true]).'</th>';
}
echo "
<th class='text-center' style='width:9%'>".tr('Q.tà', [], ['upper' => true]).'</th>';
<th class='text-center text-muted' style='width:9%'>".tr('Q.tà', [], ['upper' => true]).'</th>';
if ($options['pricing']) {
echo "
<th class='text-center' style='width:11%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center' style='width:11%'>".tr('Imponibile', [], ['upper' => true])."</th>
<th class='text-center' style='width:5%'>".tr('IVA', [], ['upper' => true]).' (%)</th>';
<th class='text-center text-muted' style='width:10%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center text-muted' style='width:10%'>".tr('Imponibile', [], ['upper' => true])."</th>
<th class='text-center text-muted' style='width:5%'>".tr('IVA', [], ['upper' => true]).' (%)</th>';
}
echo "
<th class='text-center' style='width:10%'>".tr('Data evasione', [], ['upper' => true]).'</th>
<th class='text-center text-muted' style='width:10%'>".tr('Data evasione', [], ['upper' => true]).'</th>
</tr>
</thead>
@ -315,7 +315,7 @@ if ($options['pricing']) {
// Totale imponibile
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted">
<b>'.tr('Imponibile', [], ['upper' => true]).':</b>
</td>
@ -328,7 +328,7 @@ if ($options['pricing']) {
if ($show_sconto) {
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted">
<b>'.tr('Sconto', [], ['upper' => true]).':</b>
</td>
@ -340,7 +340,7 @@ if ($options['pricing']) {
// Totale imponibile
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted">
<b>'.tr('Totale imponibile', [], ['upper' => true]).':</b>
</td>
@ -353,7 +353,7 @@ if ($options['pricing']) {
// IVA
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted">
<b>'.tr('Totale IVA', [], ['upper' => true]).':</b>
</td>
@ -365,7 +365,7 @@ if ($options['pricing']) {
// TOTALE
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted" >
<b>'.tr('Totale documento', [], ['upper' => true]).':</b>
</td>
<th colspan="2" class="text-right">
@ -377,7 +377,7 @@ if ($options['pricing']) {
// SCONTO IN FATTURA
echo '
<tr>
<td colspan="'.$colspan.'" class="text-right border-top">
<td colspan="'.$colspan.'" class="text-right text-muted">
<b>'.tr('Sconto in fattura', [], ['upper' => true]).':</b>
</td>
<th colspan="2" class="text-right">
@ -408,6 +408,6 @@ if (!empty($documento->condizioni_fornitura)) {
if (!empty($documento['note'])) {
echo '
<br>
<p class="small-bold">'.tr('Note', [], ['upper' => true]).':</p>
<p class="small-bold text-muted">'.tr('Note', [], ['upper' => true]).':</p>
<p>'.nl2br((string) $documento['note']).'</p>';
}

View File

@ -27,45 +27,34 @@ $default_header$
<div class="text-center" style="height:5mm;">
<b>$tipo_doc$</b>
</div>
<br>
<table class="table">
<tr>
<td class="border-full text-center">
<p class="small-bold">'.tr('Nr. documento', [], ['upper' => true]).'</p>
<td valign="top" class="border-bottom border-top text-center">
<p class="small-bold text-muted">'.tr('Nr. documento', [], ['upper' => true]).'</p>
<p>$numero$</p>
</td>
<td class="border-right border-bottom border-top text-center">
<p class="small-bold">'.tr('Data documento', [], ['upper' => true]).'</p>
<td class="border-bottom border-top text-center">
<p class="small-bold text-muted">'.tr('Data documento', [], ['upper' => true]).'</p>
<p>$data$</p>
</td>
<td class="border-right border-bottom border-top text-center">
<p class="small-bold">'.($documento->direzione == 'entrata' ? tr('Cliente', [], ['upper' => true]) : tr('Fornitore', [], ['upper' => true])).'</p>
<p>$c_codice$</p>
</td>
<td class="border-right border-bottom border-top center text-center">
<p class="small-bold">'.tr('Foglio', [], ['upper' => true]).'</p>
<td class="border-bottom border-top center text-center">
<p class="small-bold text-muted">'.tr('Foglio', [], ['upper' => true]).'</p>
<p>{PAGENO}/{nb}</p>
</td>
</tr>
<tr>
<td colspan="4" style="height:10mm;padding-top:2mm;">
<p class="small-bold">'.tr('Pagamento', [], ['upper' => true]).'</p>
<p>$pagamento$</p>
</td>
</tr>
</table>
</div>
<!-- Dati Cliente/Fornitore -->
<div class="col-xs-6" style="margin-left: 10px">
<table class="table" style="width:100%;margin-top:5mm;">
<table class="table border-bottom" >
<tr>
<td class="border-full" style="height:20mm;">
<p class="small-bold">'.tr('Spett.le', [], ['upper' => true]).'</p>
<td colspan="2" style="height:20mm;">
<p class="small-bold text-muted">'.tr('Spett.le', [], ['upper' => true]).'</p>
<p>$c_ragionesociale$</p>
<p>$c_indirizzo$<br> $c_citta_full$</p>
<p>$c_telefono$ $c_cellulare$</p>
@ -74,8 +63,8 @@ $default_header$
if (!empty($destinazione)) {
echo '
<tr>
<td class="border-full" style="height:16mm;">
<p class="small-bold">'.tr('Destinazione diversa', [], ['upper' => true]).'</p>
<td colspan=2 class="border-full" style="height:16mm;">
<p class="small-bold text-muted">'.tr('Destinazione diversa', [], ['upper' => true]).'</p>
'.$destinazione.'
</td>
</tr>';
@ -83,6 +72,4 @@ if (!empty($destinazione)) {
echo '
</table>
</div>
</div>';