Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
9e11715652
|
@ -74,7 +74,13 @@ $(document).ready(function () {
|
|||
numeral.defaultFormat('0,0.' + ('0').repeat(globals.cifre_decimali));
|
||||
|
||||
// Richiamo alla generazione di Datatables
|
||||
start_datatables();
|
||||
start_datatables( $('.main-records') );
|
||||
|
||||
// Avvio datatables dei plugin solo al primo click
|
||||
$('.nav-tabs li').not('.clicked').on('click', function(){
|
||||
$(this).addClass('clicked');
|
||||
start_datatables( $(".tab-pane.active .main-records-plugins") );
|
||||
});
|
||||
|
||||
// Calendario principale
|
||||
start_complete_calendar("#daterange", function (start, end) {
|
||||
|
|
|
@ -34,10 +34,10 @@ function start_local_datatables() {
|
|||
}
|
||||
|
||||
// Datatable
|
||||
function start_datatables() {
|
||||
function start_datatables( $elements ) {
|
||||
start_local_datatables();
|
||||
|
||||
$('.main-records').each(function () {
|
||||
$elements.each(function () {
|
||||
const $this = $(this);
|
||||
|
||||
// Controlla che la tabella non sia già inizializzata
|
||||
|
@ -451,7 +451,7 @@ function getTable(selector) {
|
|||
if (table.hasClass('datatables')) {
|
||||
start_local_datatables();
|
||||
} else {
|
||||
start_datatables();
|
||||
start_datatables( $('.main-records') );
|
||||
}
|
||||
},
|
||||
datatable: table.DataTable(),
|
||||
|
|
|
@ -99,7 +99,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
|||
|
||||
$table_id = 'main_'.rand(0, 99);
|
||||
echo '
|
||||
<table data-idmodule="'.$id_module.'" data-idplugin="'.$id_plugin.'" data-idparent="'.$id_record.'" data-selected="'.implode(';', $selezione).'" id="'.$table_id.'" width="100%" class="main-records table table-condensed table-bordered">
|
||||
<table data-idmodule="'.$id_module.'" data-idplugin="'.$id_plugin.'" data-idparent="'.$id_record.'" data-selected="'.implode(';', $selezione).'" id="'.$table_id.'" width="100%" class="main-records'.(!empty($id_plugin) ? '-plugins' : '').' table table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="th_selector"></th>';
|
||||
|
|
|
@ -71,11 +71,13 @@ switch ($resource) {
|
|||
$where[] = "an_tipianagrafiche.descrizione='Cliente'";
|
||||
if (empty($filter)) {
|
||||
$where[] = 'an_anagrafiche.deleted_at IS NULL';
|
||||
|
||||
if (!empty($filter_agente)) {
|
||||
$where[] = 'idagente = '.Auth::user()['idanagrafica'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty(!$filter_agente)) {
|
||||
$where[] = 'idagente = '.Auth::user()['idanagrafica'];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'ragione_sociale LIKE '.prepare('%'.$search.'%');
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Modules\Checklists\Check;
|
||||
use Modules\Checklists\ChecklistItem;
|
||||
|
||||
|
@ -65,6 +66,18 @@ switch(post('op')){
|
|||
|
||||
break;
|
||||
|
||||
case "save_note":
|
||||
$note = post('note');
|
||||
$id = post('id');
|
||||
|
||||
$record = Check::find($id);
|
||||
$record->note = $note;
|
||||
$record->save();
|
||||
|
||||
flash()->info(tr('Nota salvata correttamente!'));
|
||||
|
||||
break;
|
||||
|
||||
case "remove_checkbox":
|
||||
|
||||
$id = post('id');
|
||||
|
|
|
@ -39,7 +39,16 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
|||
|
||||
$result .= '
|
||||
<td style="border-top:0px;">
|
||||
<span class="text" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>';
|
||||
<span class="text" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>
|
||||
</td>';
|
||||
|
||||
$result .= '
|
||||
<td style="width:500px;border-top:0px;">
|
||||
{[ "type": "textarea", "name": "note_checklist", "id": "'.$check->id.'", "value": "'.$check->note.'" ]}
|
||||
</td>';
|
||||
|
||||
$result .= '
|
||||
<td style="width:250px;border-top:0px;">';
|
||||
|
||||
if (intval($check->assignedUsers->pluck('id')->toArray())>0){
|
||||
$result .= ' <span class="label label-info pull-right" style="padding:6px 8px;" data-toggle="tooltip" title="Assegnato a '. implode(', ', $check->assignedUsers->pluck('username')->toArray()).'"><i class="fa fa-user"></i></span>';
|
||||
|
@ -59,10 +68,11 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
|||
</td>';
|
||||
|
||||
$result .= '
|
||||
<td style="width:40px;text-align:center;border-top:0px;">
|
||||
<td style="width:10px;text-align:center;border-top:0px;">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-warning btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="edit_check(\''.$check->id.'\')"><i class="fa fa-edit"></i></button>
|
||||
<button class="btn btn-danger btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="delete_check(\''.$check->id.'\')"><i class="fa fa-trash"></i></button>
|
||||
<button class="btn btn-xs btn-default handle" title="Modifica ordine delle righe" draggable="true"><i class="fa fa-sort"></i></button>
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
|
@ -74,7 +84,7 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
|||
if(sizeof($check->children)>0){
|
||||
$result .= '
|
||||
<tr>
|
||||
<td colspan="4" style="padding-left:'.$margin.'px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-top:0px;">
|
||||
<td colspan="5" style="padding-left:'.$margin.'px;padding-right:10px;padding-top:0px;padding-bottom:0px;border-top:0px;">
|
||||
<table class="table" style="margin-bottom:0px;">
|
||||
<tbody class="sort" data-sonof="'.$check->id.'">';
|
||||
$children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get();
|
||||
|
@ -91,13 +101,6 @@ function renderChecklist($check, $level = 1, $parent = 0) {
|
|||
$result .= '
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td style="width:40px;text-align:center;border-top:0px;">
|
||||
<button class="btn btn-xs btn-default handle" title="Modifica ordine delle righe" draggable="true">
|
||||
<i class="fa fa-sort"></i>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
</tr>';
|
||||
|
||||
return $result;
|
||||
|
|
|
@ -342,7 +342,7 @@ if (!$block_edit) {
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
|
@ -350,7 +350,7 @@ if (!$block_edit) {
|
|||
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="margin-top: 25px">
|
||||
<div class="col-md-3" style="margin-top: 25px">
|
||||
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
|
@ -379,6 +379,10 @@ if (!$block_edit) {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
@ -623,4 +627,16 @@ $(document).ready(function() {
|
|||
$("#idreferente").selectReset();
|
||||
});
|
||||
});
|
||||
|
||||
input("ordinamento").on("change", function(){
|
||||
if (input(this).get() == "desc") {
|
||||
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
} else {
|
||||
session_set("module_'.$id_module.',order_row_desc").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
include_once __DIR__.'/init.php';
|
||||
|
||||
$block_edit = $record['is_completato'];
|
||||
$righe = $contratto->getRighe();
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe();
|
||||
$direzione = $contratto->direzione;
|
||||
$colspan = ($block_edit ? '5' : '6');
|
||||
|
||||
|
@ -177,7 +178,7 @@ foreach ($righe as $riga) {
|
|||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
|
||||
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<?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;
|
||||
|
||||
// Trovo id_print della stampa
|
||||
$id_print = Prints::getPrints()['Stampa calendario settimanale'];
|
||||
|
||||
echo '
|
||||
<form action="" method="post" onsubmit="if($(this).parsley().validate()) { return stampa_calendario(); }" >
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "'.tr('Settimana').'", "name": "date", "required": "1" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['dashboard']['format'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\"", "value": "'.$_SESSION['dashboard']['orientation'].'" ]}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-2">
|
||||
<p style="line-height:14px;"> </p>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<i class="fa fa-print"></i> '.tr('Stampa').'
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>$(document).ready(init)</script>';
|
||||
|
||||
echo '
|
||||
<script>
|
||||
function stampa_calendario (){
|
||||
window.open(globals.rootdir + "/pdfgen.php?id_print='.$id_print.'");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#format").change(function() {
|
||||
session_set("dashboard,format", $(this).val(), 0, 0);
|
||||
});
|
||||
|
||||
$("#orientation").change(function() {
|
||||
session_set("dashboard,orientation", $(this).val(), 0, 0);
|
||||
});
|
||||
</script>';
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
|
||||
.bootstrap-datetimepicker-widget tr:hover {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
$(function() {
|
||||
|
||||
moment.updateLocale('en', {
|
||||
week: { dow: 1 } // Monday is the first day of the week
|
||||
});
|
||||
|
||||
moment.updateLocale('it', {
|
||||
week: { dow: 1 } // Monday is the first day of the week
|
||||
});
|
||||
|
||||
$("#date").datetimepicker({
|
||||
format: 'DD/MM/YYYY',
|
||||
});
|
||||
|
||||
//Get the value of Start and End of Week
|
||||
$('#date').on('dp.change', function (e) {
|
||||
value = $("#date").val();
|
||||
firstDate = moment(value, "DD/MM/YYYY").day(1).format("DD/MM/YYYY");
|
||||
lastDate = moment(value, "DD/MM/YYYY").day(7).format("DD/MM/YYYY");
|
||||
$("#date").val(firstDate + " - " + lastDate);
|
||||
|
||||
session_set("dashboard,date_week_start", moment(firstDate, "DD/MM/YYYY").format("YYYY-MM-DD"), 0, 0);
|
||||
session_set("dashboard,date_week_end", moment(lastDate, "DD/MM/YYYY").format("YYYY-MM-DD"), 0, 0);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
|
@ -375,7 +375,7 @@ if (!$block_edit) {
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
|
@ -383,7 +383,7 @@ if (!$block_edit) {
|
|||
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($ddt->idsede_partenza).', "idsede_destinazione": '.intval($ddt->idsede_destinazione).', "idanagrafica": '.$ddt->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$ddt->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="margin-top: 25px">
|
||||
<div class="col-md-3" style="margin-top: 25px">
|
||||
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
|
@ -424,6 +424,10 @@ if (!$block_edit) {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
@ -648,10 +652,20 @@ if (in_array($record[$field_name], $user->sedi)) {
|
|||
|
||||
echo '
|
||||
<script>
|
||||
$("#idsede_destinazione").change(function(){
|
||||
updateSelectOption("idsede_destinazione", $(this).val());
|
||||
$("#idreferente").selectReset();
|
||||
});
|
||||
|
||||
$("#idsede_destinazione").change(function(){
|
||||
updateSelectOption("idsede_destinazione", $(this).val());
|
||||
$("#idreferente").selectReset();
|
||||
});
|
||||
|
||||
input("ordinamento").on("change", function(){
|
||||
if (input(this).get() == "desc") {
|
||||
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
} else {
|
||||
session_set("module_'.$id_module.',order_row_desc").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
|
@ -20,7 +20,8 @@
|
|||
include_once __DIR__.'/init.php';
|
||||
|
||||
$block_edit = $record['flag_completato'];
|
||||
$righe = $ddt->getRighe();
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $ddt->getRighe()->sortByDesc('created_at') : $ddt->getRighe();
|
||||
$colspan = ($block_edit ? '5' : '6');
|
||||
$direzione = $ddt->direzione;
|
||||
|
||||
|
@ -223,7 +224,7 @@ foreach ($righe as $riga) {
|
|||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
|
||||
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
|
|
|
@ -40,8 +40,14 @@ $idconto = ($dir == 'entrata') ? setting('Conto predefinito fatture di vendita')
|
|||
|
||||
$where = '';
|
||||
// Lettura interventi non collegati a preventivi, ordini e contratti
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti, ordini e preventivi')) {
|
||||
$where = 'AND in_interventi.id_preventivo IS NULL AND in_interventi.id_contratto IS NULL AND in_interventi.id_ordine IS NULL';
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti')) {
|
||||
$where = ' AND in_interventi.id_contratto IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a ordini')) {
|
||||
$where .= ' AND in_interventi.id_ordine IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a preventivi')) {
|
||||
$where .= ' AND in_interventi.id_preventivo IS NULL';
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -761,8 +761,14 @@ if (!$block_edit) {
|
|||
if ($dir == 'entrata') {
|
||||
$where = '';
|
||||
// Lettura interventi non collegati a preventivi, ordini e contratti
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti, ordini e preventivi')) {
|
||||
$where = 'AND in_interventi.id_preventivo IS NULL AND in_interventi.id_contratto IS NULL AND in_interventi.id_ordine IS NULL';
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti')) {
|
||||
$where = ' AND in_interventi.id_contratto IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a ordini')) {
|
||||
$where .= ' AND in_interventi.id_ordine IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a preventivi')) {
|
||||
$where .= ' AND in_interventi.id_preventivo IS NULL';
|
||||
}
|
||||
|
||||
// Lettura interventi non rifiutati, non fatturati
|
||||
|
@ -809,7 +815,7 @@ if (!$block_edit) {
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
|
@ -817,7 +823,7 @@ if (!$block_edit) {
|
|||
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($fattura->idsede_partenza).', "idsede_destinazione": '.intval($fattura->idsede_destinazione).', "idanagrafica": '.$fattura->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$fattura->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="margin-top: 25px">
|
||||
<div class="col-md-3" style="margin-top: 25px">
|
||||
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
|
@ -881,6 +887,10 @@ if (!$block_edit) {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
@ -1193,4 +1203,16 @@ $("#link_form").bind("keypress", function(e) {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
input("ordinamento").on("change", function(){
|
||||
if (input(this).get() == "desc") {
|
||||
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
} else {
|
||||
session_set("module_'.$id_module.',order_row_desc").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
|
|
@ -23,7 +23,8 @@ include_once __DIR__.'/init.php';
|
|||
|
||||
$direzione = $fattura->direzione;
|
||||
$block_edit = !empty($note_accredito) || in_array($record['stato'], ['Emessa', 'Pagato', 'Parzialmente pagato']) || !$abilita_genera;
|
||||
$righe = $fattura->getRighe();
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $fattura->getRighe()->sortByDesc('created_at') : $fattura->getRighe();
|
||||
|
||||
echo '
|
||||
<div class="table-responsive">
|
||||
|
@ -284,7 +285,7 @@ foreach ($righe as $riga) {
|
|||
}
|
||||
|
||||
echo '
|
||||
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
|
||||
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
|
|
|
@ -95,8 +95,14 @@ switch (post('op')) {
|
|||
|
||||
$where = '';
|
||||
// Lettura interventi non collegati a preventivi, ordini e contratti
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti, ordini e preventivi')) {
|
||||
$where = 'AND in_interventi.id_preventivo IS NULL AND in_interventi.id_contratto IS NULL AND in_interventi.id_ordine IS NULL';
|
||||
if (!setting('Permetti fatturazione delle attività collegate a contratti')) {
|
||||
$where = ' AND in_interventi.id_contratto IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a ordini')) {
|
||||
$where .= ' AND in_interventi.id_ordine IS NULL';
|
||||
}
|
||||
if (!setting('Permetti fatturazione delle attività collegate a preventivi')) {
|
||||
$where .= ' AND in_interventi.id_preventivo IS NULL';
|
||||
}
|
||||
|
||||
$interventi = $dbo->fetchArray('SELECT *, IFNULL((SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento = in_interventi.id), in_interventi.data_richiesta) AS data, in_statiintervento.descrizione AS stato, in_interventi.codice AS codice_intervento FROM in_interventi INNER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento WHERE in_statiintervento.is_completato=1 AND in_statiintervento.is_fatturabile=1 AND in_interventi.id NOT IN (SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND in_interventi.id NOT IN (SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL) AND in_interventi.id IN ('.implode(',', $id_records).') '.$where);
|
||||
|
|
|
@ -237,11 +237,11 @@ if (!$block_edit) {
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
|
||||
</div>
|
||||
|
||||
|
@ -292,6 +292,10 @@ if (!$block_edit) {
|
|||
}
|
||||
echo '
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
@ -444,6 +448,18 @@ $("#link_form").bind("keypress", function(e) {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
input("ordinamento").on("change", function(){
|
||||
if (input(this).get() == "desc") {
|
||||
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
} else {
|
||||
session_set("module_'.$id_module.',order_row_desc").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
||||
// Collegamenti diretti
|
||||
|
|
|
@ -22,7 +22,8 @@ include_once __DIR__.'/init.php';
|
|||
use Modules\Articoli\Articolo;
|
||||
|
||||
$block_edit = $record['flag_completato'];
|
||||
$righe = $ordine->getRighe();
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $ordine->getRighe()->sortByDesc('created_at') : $ordine->getRighe();
|
||||
$colspan = ($block_edit ? '6' : '7');
|
||||
$direzione = $ordine->direzione;
|
||||
|
||||
|
@ -268,7 +269,7 @@ foreach ($righe as $riga) {
|
|||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
|
||||
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
|
|
|
@ -257,7 +257,7 @@ if (!$block_edit) {
|
|||
<input type="hidden" name="backto" value="record-edit">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
|
@ -265,7 +265,7 @@ if (!$block_edit) {
|
|||
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="margin-top: 25px">
|
||||
<div class="col-md-3" style="margin-top: 25px">
|
||||
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
|
||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||
</button>
|
||||
|
@ -294,6 +294,10 @@ if (!$block_edit) {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
|
||||
</div>
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
@ -519,10 +523,20 @@ if (!empty($elementi)) {
|
|||
</a>
|
||||
|
||||
<script>
|
||||
$("#idsede").change(function(){
|
||||
updateSelectOption("idsede_destinazione", $(this).val());
|
||||
$("#idreferente").selectReset();
|
||||
});
|
||||
|
||||
$("#idsede").change(function(){
|
||||
updateSelectOption("idsede_destinazione", $(this).val());
|
||||
$("#idreferente").selectReset();
|
||||
});
|
||||
|
||||
input("ordinamento").on("change", function(){
|
||||
if (input(this).get() == "desc") {
|
||||
session_set("module_<?php echo $id_module; ?>,order_row_desc", 1, "").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
} else {
|
||||
session_set("module_<?php echo $id_module; ?>,order_row_desc").then(function () {
|
||||
caricaRighe(null);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -20,7 +20,8 @@
|
|||
include_once __DIR__.'/init.php';
|
||||
|
||||
$block_edit = $record['is_completato'];
|
||||
$righe = $preventivo->getRighe();
|
||||
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
|
||||
$righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe();
|
||||
$colspan = ($block_edit ? '6' : '7');
|
||||
$direzione = $preventivo->direzione;
|
||||
|
||||
|
@ -210,7 +211,7 @@ foreach ($righe as $riga) {
|
|||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
|
||||
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
</div>';
|
||||
|
|
|
@ -239,11 +239,15 @@ function controllaConti() {
|
|||
if (continuare) {
|
||||
$("#add-submit").prop("disabled", false);
|
||||
$("#modello-button").prop("disabled", false);
|
||||
$("#save, #save-close").removeAttr("disabled").removeClass("disabled");
|
||||
if (!$("#modals > div").get().length) {
|
||||
$("#save, #save-close").removeAttr("disabled").removeClass("disabled");
|
||||
}
|
||||
} else {
|
||||
$("#add-submit").prop("disabled", true);
|
||||
$("#modello-button").prop("disabled", true);
|
||||
$("#save, #save-close").attr("disabled", "true").addClass("disabled");
|
||||
if (!$("#modals > div").get().length) {
|
||||
$("#save, #save-close").attr("disabled", "true").addClass("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
return continuare;
|
||||
|
|
|
@ -28,50 +28,53 @@ class ServicesHook extends Manager
|
|||
{
|
||||
public function response()
|
||||
{
|
||||
$limite_scadenze = (new Carbon())->addDays(60);
|
||||
$message = '';
|
||||
if (Services::isEnabled()) {
|
||||
$limite_scadenze = (new Carbon())->addDays(60);
|
||||
$message = '';
|
||||
|
||||
// Elaborazione dei servizi in scadenza
|
||||
$servizi_in_scadenza = Services::getServiziInScadenza($limite_scadenze);
|
||||
if (!$servizi_in_scadenza->isEmpty()) {
|
||||
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||
$message .= tr('I seguenti servizi sono in scadenza:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $servizi_in_scadenza->pluck('nome')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
// Elaborazione delle risorse Services scadute
|
||||
$risorse_scadute = Services::getRisorseScadute();
|
||||
if (!$risorse_scadute->isEmpty()) {
|
||||
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||
$message .= tr('Le seguenti risorse sono scadute:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $risorse_scadute->pluck('name')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
// Elaborazione dei servizi scaduti
|
||||
$servizi_scaduti = Services::getServiziScaduti();
|
||||
if (!$servizi_scaduti->isEmpty()) {
|
||||
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||
$message .= tr('I seguenti servizi sono scaduti:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $servizi_scaduti->pluck('nome')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
// Elaborazione delle risorse Services in scadenza
|
||||
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
||||
if (!$risorse_in_scadenza->isEmpty()) {
|
||||
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||
$message .= tr('Le seguenti risorse sono in scadenza:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $risorse_in_scadenza->pluck('name')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
$module = Module::pool('Stato dei servizi');
|
||||
|
||||
// Elaborazione dei servizi in scadenza
|
||||
$servizi_in_scadenza = Services::getServiziInScadenza($limite_scadenze);
|
||||
if (!$servizi_in_scadenza->isEmpty()) {
|
||||
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||
$message .= tr('I seguenti servizi sono in scadenza:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $servizi_in_scadenza->pluck('nome')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
// Elaborazione delle risorse Services scadute
|
||||
$risorse_scadute = Services::getRisorseScadute();
|
||||
if (!$risorse_scadute->isEmpty()) {
|
||||
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||
$message .= tr('Le seguenti risorse sono scadute:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $risorse_scadute->pluck('name')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
// Elaborazione dei servizi scaduti
|
||||
$servizi_scaduti = Services::getServiziScaduti();
|
||||
if (!$servizi_scaduti->isEmpty()) {
|
||||
$message .= '<i class="fa fa-exclamation-triangle text-danger"> </i> ';
|
||||
$message .= tr('I seguenti servizi sono scaduti:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $servizi_scaduti->pluck('nome')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
// Elaborazione delle risorse Services in scadenza
|
||||
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
||||
if (!$risorse_in_scadenza->isEmpty()) {
|
||||
$message .= '<i class="fa fa-clock-o text-warning"> </i> ';
|
||||
$message .= tr('Le seguenti risorse sono in scadenza:<ul><li> _LIST_', [
|
||||
'_LIST_' => implode('</li><li>', $risorse_in_scadenza->pluck('name')->all()),
|
||||
]).'</ul>';
|
||||
}
|
||||
|
||||
|
||||
$module = Module::pool('Stato dei servizi');
|
||||
|
||||
return [
|
||||
'icon' => null,
|
||||
'message' => $message,
|
||||
|
|
|
@ -103,19 +103,13 @@ for(i=0; i<sortable_table; i++){
|
|||
});
|
||||
}
|
||||
|
||||
$("input[name^=\'value\']").keyup(function(){
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_value",
|
||||
value: $(this).val(),
|
||||
id: $(this).attr("data-id"),
|
||||
});
|
||||
});
|
||||
|
||||
$("textarea[name=\'note_checklist\']").keyup(function(){
|
||||
$.post("'.$checklist_module->fileurl('ajax.php').'", {
|
||||
op: "save_note",
|
||||
value: $(this).val(),
|
||||
id: $(this).attr("data-id"),
|
||||
note: $(this).val(),
|
||||
id: $(this).attr("id"),
|
||||
}, function() {
|
||||
alertPush();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1130,10 +1130,8 @@ class FatturaElettronica
|
|||
|
||||
$dati = [];
|
||||
|
||||
foreach ($element['riferimento_linea'] as $linea) {
|
||||
$dati[] = [
|
||||
'RiferimentoNumeroLinea' => $linea,
|
||||
];
|
||||
if (!empty($element['riferimento_linea'])) {
|
||||
$dati['RiferimentoNumeroLinea'] = $element['riferimento_linea'];
|
||||
}
|
||||
|
||||
$dati['IdDocumento'] = $element['id_documento'];
|
||||
|
|
|
@ -667,6 +667,7 @@ class Validator
|
|||
'˜' => ' ',
|
||||
'™' => 'TM',
|
||||
'Ÿ' => 'Y',
|
||||
'č' => 'c',
|
||||
]);
|
||||
|
||||
$output = str_replace(array("\r", "\n"), '', $output);
|
||||
|
@ -773,6 +774,7 @@ class Validator
|
|||
'LJ' => 'LJ',
|
||||
'Lj' => 'Lj',
|
||||
'lj' => 'lj',
|
||||
'č' => 'c',
|
||||
'NJ' => 'NJ',
|
||||
'Nj' => 'Nj',
|
||||
'nj' => 'nj',
|
||||
|
|
|
@ -467,7 +467,7 @@ if (!empty($righe)) {
|
|||
]);
|
||||
|
||||
if ($tipo == '%') {
|
||||
$tot_sconto = $sconto_calcolato * 100 / ($prezzo_unitario * $qta);
|
||||
$tot_sconto = ($prezzo_unitario * $qta != 0 ? $sconto_calcolato * 100 / ($prezzo_unitario * $qta) : 0);
|
||||
} else {
|
||||
$tot_sconto = $sconto_calcolato;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||
|
||||
// Nel caso il prezzo sia negativo viene gestito attraverso l'inversione della quantità (come per le note di credito)
|
||||
// TODO: per migliorare la visualizzazione, sarebbe da lasciare negativo il prezzo e invertire gli sconti.
|
||||
if (!empty($articolo->um) && !empty($articolo->fattore_um_secondaria) && $riga['UnitaMisura'] == $articolo->um_secondaria) {
|
||||
if (!empty($articolo->um) && !empty($articolo->um_secondaria) && !empty((float)$articolo->fattore_um_secondaria) && $riga['UnitaMisura'] == $articolo->um_secondaria) {
|
||||
$qta = (($riga['Quantita'] ?: 1) / $articolo->fattore_um_secondaria);
|
||||
$prezzo = $totale_righe > 0 ? $totale_righe/$qta : -($totale_righe/$qta);
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||
$obj->qta = $qta;
|
||||
|
||||
if (!empty($riga['UnitaMisura'])) {
|
||||
if (!empty($articolo->um) && !empty($articolo->fattore_um_secondaria) && $riga['UnitaMisura'] == $articolo->um_secondaria) {
|
||||
if (!empty($articolo->um) && !empty($articolo->um_secondaria) && !empty((float)$articolo->fattore_um_secondaria) && $riga['UnitaMisura'] == $articolo->um_secondaria) {
|
||||
$obj->um = $articolo->um;
|
||||
} else {
|
||||
$obj->um = $riga['UnitaMisura'];
|
||||
|
|
|
@ -37,6 +37,10 @@ class ReceiptHook extends Manager
|
|||
|
||||
public function needsExecution()
|
||||
{
|
||||
if (!Interaction::isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lettura cache
|
||||
$todo_cache = Cache::pool('Ricevute Elettroniche');
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ abstract class Accounting extends Component
|
|||
*/
|
||||
public function getTipoScontoAttribute()
|
||||
{
|
||||
return $this->sconto_percentuale ? 'PRC' : 'UNT';
|
||||
return $this->sconto_percentuale ? 'PRC' : ($this->sconto ? 'UNT' : 'PRC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -463,7 +463,7 @@ abstract class Accounting extends Component
|
|||
protected function fixSconto()
|
||||
{
|
||||
$this->attributes['sconto'] = $this->sconto;
|
||||
$this->attributes['tipo_sconto'] = $this->sconto_percentuale ? 'PRC' : 'UNT';
|
||||
$this->attributes['tipo_sconto'] = $this->sconto_percentuale ? 'PRC' : ($this->sconto ? 'UNT' : 'PRC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
<?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;
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
.divTable
|
||||
{
|
||||
display: table;
|
||||
width:auto;
|
||||
background-color:#eee;
|
||||
border:1px solid #666666;
|
||||
border-spacing:5px;/*cellspacing:poor IE support for this*/
|
||||
/* border-collapse:separate;*/
|
||||
}
|
||||
|
||||
.divRow
|
||||
{
|
||||
display:table-row;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
.divCell
|
||||
{
|
||||
float:left;/*fix for buggy browsers*/
|
||||
display:table-column;
|
||||
width:147px;
|
||||
background-color:#ccc;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
|
||||
$calendar = $_SESSION['dashboard'];
|
||||
|
||||
$date_start = $calendar['date_week_start'];
|
||||
$date_end = date('Y-m-d', strtotime('+1 day', strtotime($calendar['date_week_end'])));
|
||||
|
||||
$title = date('d/m/Y', strtotime($date_start))." - ".date('d/m/Y', strtotime($date_end));
|
||||
|
||||
$min_date = new Carbon($date_start);
|
||||
$max_date = new Carbon($date_end);
|
||||
|
||||
$stati = (array) $calendar['idstatiintervento'];
|
||||
$tipi = (array) $calendar['idtipiintervento'];
|
||||
$tecnici = (array) $calendar['idtecnici'];
|
||||
|
||||
$query = "SELECT
|
||||
DATE(orario_inizio) AS data,
|
||||
in_interventi.richiesta AS richiesta,
|
||||
DATE_FORMAT(orario_inizio, '%H:%i') AS ora_inizio,
|
||||
DATE_FORMAT(orario_fine, '%H:%i') AS ora_fine,
|
||||
(SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi.idanagrafica) AS anagrafica,
|
||||
GROUP_CONCAT((SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=in_interventi_tecnici.idtecnico) SEPARATOR ', ') AS tecnico,
|
||||
in_statiintervento.colore AS color
|
||||
FROM in_interventi_tecnici
|
||||
INNER JOIN in_interventi ON in_interventi_tecnici.idintervento=in_interventi.id
|
||||
LEFT OUTER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento
|
||||
WHERE ".$where.'
|
||||
idtecnico IN('.implode(',', $tecnici).') AND
|
||||
in_interventi.idstatointervento IN('.implode(',', $stati).') AND
|
||||
in_interventi_tecnici.idtipointervento IN('.implode(',', $tipi).') '.Modules::getAdditionalsQuery('Interventi').'
|
||||
GROUP BY in_interventi.id, data
|
||||
ORDER BY ora_inizio ASC';
|
||||
$sessioni = $dbo->fetchArray($query);
|
||||
|
||||
$sessioni = collect($sessioni)->groupBy('data');
|
||||
|
||||
// Intestazione tabella
|
||||
echo '
|
||||
<h3 class="text-bold">'.tr('Calendario _PERIOD_', [
|
||||
'_PERIOD_' => $title,
|
||||
], ['upper' => true]).'</h3>';
|
||||
|
||||
// Elenco per la gestione
|
||||
$list = [];
|
||||
|
||||
// Filler per i giorni non inclusi della settimana iniziale
|
||||
$current_day = $min_date;
|
||||
|
||||
// Elenco del periodo indicato
|
||||
while ($current_day->lessThan($max_date)) {
|
||||
$list[] = [
|
||||
'date' => $current_day->copy(),
|
||||
'contents' => $sessioni[$current_day->toDateString()] ?: [],
|
||||
];
|
||||
|
||||
$current_day->addDay();
|
||||
}
|
||||
|
||||
// Stampa della tabella
|
||||
echo '
|
||||
<div class="divTable">';
|
||||
|
||||
$count = count($list);
|
||||
for ($i = 0; $i < $count; $i = $i + 7) {
|
||||
echo '
|
||||
<div class="divRow">';
|
||||
|
||||
for ($c = 0; $c < 7; ++$c) {
|
||||
$element = $list[$i + $c];
|
||||
|
||||
echo '
|
||||
<div class="divCell" align="center">'.ucfirst($element['date']->formatLocalized('%A %d/%m')).'</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
<div class="divRow">';
|
||||
|
||||
for ($c = 0; $c < 7; ++$c) {
|
||||
$element = $list[$i + $c];
|
||||
|
||||
$clienti = '';
|
||||
foreach ($element['contents'] as $sessione) {
|
||||
$clienti .= '<table><tr><td style="background-color:'.$sessione['color'].';font-size:8pt;">'.$sessione['ora_inizio'].' - '.$sessione['ora_fine'].'</small><br><b>'.$sessione['anagrafica'].'</b><br>
|
||||
<i>'.$sessione['richiesta'].'</i><small>'.$sessione['tecnico'].'</td></tr></table>';
|
||||
}
|
||||
|
||||
$background = '#ffffff';
|
||||
|
||||
if (empty($clienti)) {
|
||||
$background = 'lightgray';
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="divCell" style="background:'.$background.'">'.(!empty($clienti)?$clienti:' ').'</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>';
|
|
@ -0,0 +1,34 @@
|
|||
<?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/>.
|
||||
*/
|
||||
|
||||
echo '
|
||||
<!-- Intestazione fornitore -->
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<p><b>$f_ragionesociale$</b></p>
|
||||
<p>$f_indirizzo$ $f_citta_full$</p>
|
||||
<p>'.(!empty($f_piva) ? tr('P.Iva').': ' : '').'$f_piva$</p>
|
||||
<p>'.(!empty($f_codicefiscale) ? tr('C.F.').': ' : '').'$f_codicefiscale$</p>
|
||||
<p>'.(!empty($f_capsoc) ? tr('Cap.Soc.').': ' : '').'$f_capsoc$</p>
|
||||
<p>'.(!empty($f_telefono) ? tr('Tel').': ' : '').'$f_telefono$</p>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<img src="$logo$" alt="Logo" border="0"/>
|
||||
</div>
|
||||
</div>';
|
|
@ -0,0 +1,26 @@
|
|||
<?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/>.
|
||||
*/
|
||||
|
||||
$format = (isset($_SESSION['dashboard']['format'])) ? $_SESSION['dashboard']['format'] : 'A4';
|
||||
$orientation = (isset($_SESSION['dashboard']['orientation'])) ? $_SESSION['dashboard']['orientation'] : 'L';
|
||||
|
||||
return [
|
||||
'format' => $format,
|
||||
'orientation' => $orientation,
|
||||
];
|
|
@ -214,28 +214,30 @@ echo '
|
|||
</table>';
|
||||
|
||||
// Firme
|
||||
echo '
|
||||
<table class="table-bordered">
|
||||
<tr>
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma conducente', [], ['upper' => true]).'
|
||||
</th>
|
||||
if ($documento->direzione == 'entrata') {
|
||||
echo '
|
||||
<table class="table-bordered">
|
||||
<tr>
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma conducente', [], ['upper' => true]).'
|
||||
</th>
|
||||
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma vettore', [], ['upper' => true]).'
|
||||
</th>
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma vettore', [], ['upper' => true]).'
|
||||
</th>
|
||||
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma destinatario', [], ['upper' => true]).'
|
||||
</th>
|
||||
</tr>
|
||||
<th class="small" style="width:33%">
|
||||
'.tr('Firma destinatario', [], ['upper' => true]).'
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="height: 10mm"></td>
|
||||
<td style="height: 10mm"></td>
|
||||
<td style="height: 10mm"></td>
|
||||
</tr>
|
||||
</table>';
|
||||
<tr>
|
||||
<td style="height: 10mm"></td>
|
||||
<td style="height: 10mm"></td>
|
||||
<td style="height: 10mm"></td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
|
||||
if (empty($options['last-page-footer'])) {
|
||||
echo '$default_footer$';
|
||||
|
|
|
@ -41,7 +41,7 @@ $default_header$
|
|||
</td>
|
||||
|
||||
<td class="border-right border-bottom border-top text-center">
|
||||
<p class="small-bold">'.tr('Cliente', [], ['upper' => true]).'</p>
|
||||
<p class="small-bold">'.tr('_TYPE_', ['_TYPE_' => $documento->direzione == 'uscita' ? 'Fornitore' : 'Cliente'], ['upper' => true]).'</p>
|
||||
<p>$c_codice$</p>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ $vettore = $dbo->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idan
|
|||
|
||||
$tipo_doc = $documento->tipo->descrizione;
|
||||
if (empty($documento['numero_esterno'])) {
|
||||
$numero = 'pro-forma '.$numero;
|
||||
$numero = 'pro-forma '.$documento['numero'];
|
||||
$tipo_doc = tr('DDT pro-forma', [], ['upper' => true]);
|
||||
} else {
|
||||
$numero = !empty($documento['numero_esterno']) ? $documento['numero_esterno'] : $documento['numero'];
|
||||
|
|
|
@ -57,11 +57,11 @@ $totale_finale = 0;
|
|||
|
||||
// Nel fatturato totale è corretto NON tenere in considerazione eventuali rivalse, ritenute acconto o contributi.
|
||||
foreach ($raggruppamenti as $raggruppamento) {
|
||||
$data = new \Carbon\Carbon($raggruppamento['data']);
|
||||
$data = new \Carbon\Carbon($raggruppamento['data_competenza']);
|
||||
$mese = ucfirst($data->formatLocalized('%B %Y'));
|
||||
|
||||
$imponibile = $raggruppamento['imponibile'];
|
||||
$iva = $raggruppamento['iva'];
|
||||
$imponibile = SUM($raggruppamento['imponibile'], null, 2);
|
||||
$iva = SUM($raggruppamento['iva'], null, 2);
|
||||
$totale = $imponibile + $iva;
|
||||
|
||||
echo '
|
||||
|
|
|
@ -27,9 +27,9 @@ $date_end = $_SESSION['period_end'];
|
|||
|
||||
$raggruppamenti = $dbo->fetchArray('
|
||||
SELECT
|
||||
data,
|
||||
data_competenza,
|
||||
DATE_FORMAT(data_competenza, \'%m-%Y\') AS periodo,
|
||||
SUM(round((subtotale-sconto+co_righe_documenti.rivalsainps) *percentuale/100 *(100-indetraibile)/100 *(IF(co_tipidocumento.reversed = 0, 1,-1 )), 2)) AS iva,
|
||||
SUM((subtotale-sconto+co_righe_documenti.rivalsainps) *percentuale/100 *(100-indetraibile)/100 *(IF(co_tipidocumento.reversed = 0, 1,-1 ))) AS iva,
|
||||
SUM((co_righe_documenti.subtotale - co_righe_documenti.sconto + co_righe_documenti.rivalsainps) *(IF(co_tipidocumento.reversed = 0,1,-1))) AS imponibile
|
||||
FROM
|
||||
co_iva
|
||||
|
@ -39,6 +39,6 @@ $raggruppamenti = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = '.prepare($dir).' AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
data, periodo
|
||||
ORDER BY
|
||||
data ASC');
|
||||
periodo
|
||||
ORDER BY
|
||||
periodo ASC');
|
||||
|
|
|
@ -19,27 +19,27 @@
|
|||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$totale_iva_vendite = sum(array_column($iva_vendite, 'iva'));
|
||||
$totale_subtotale_vendite = sum(array_column($iva_vendite, 'subtotale'));
|
||||
$totale_iva_acquisti = sum(array_column($iva_acquisti, 'iva'));
|
||||
$totale_subtotale_acquisti = sum(array_column($iva_acquisti, 'subtotale'));
|
||||
$totale_iva_vendite = sum(array_column($iva_vendite, 'iva'), null, 2);
|
||||
$totale_subtotale_vendite = sum(array_column($iva_vendite, 'subtotale'), null, 2);
|
||||
$totale_iva_acquisti = sum(array_column($iva_acquisti, 'iva'), null, 2);
|
||||
$totale_subtotale_acquisti = sum(array_column($iva_acquisti, 'subtotale'), null, 2);
|
||||
|
||||
$totale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'iva'));
|
||||
$totale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'iva'));
|
||||
$subtotale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'subtotale'));
|
||||
$subtotale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'subtotale'));
|
||||
$totale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'iva'), null, 2);
|
||||
$totale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'iva'), null, 2);
|
||||
$subtotale_iva_esigibile = sum(array_column($iva_vendite_esigibile, 'subtotale'), null, 2);
|
||||
$subtotale_iva_nonesigibile = sum(array_column($iva_vendite_nonesigibile, 'subtotale'), null, 2);
|
||||
|
||||
$totale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'iva'));
|
||||
$totale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'iva'));
|
||||
$subtotale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'subtotale'));
|
||||
$subtotale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'subtotale'));
|
||||
$totale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'iva'), null, 2);
|
||||
$totale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'iva'), null, 2);
|
||||
$subtotale_iva_detraibile = sum(array_column($iva_acquisti_detraibile, 'subtotale'), null, 2);
|
||||
$subtotale_iva_nondetraibile = sum(array_column($iva_acquisti_nondetraibile, 'subtotale'), null, 2);
|
||||
|
||||
$totale_iva_vendite_anno_precedente = sum(array_column($iva_vendite_anno_precedente, 'iva'));
|
||||
$totale_iva_acquisti_anno_precedente = sum(array_column($iva_acquisti_anno_precedente, 'iva'));
|
||||
$totale_iva_vendite_anno_precedente = sum(array_column($iva_vendite_anno_precedente, 'iva'), null, 2);
|
||||
$totale_iva_acquisti_anno_precedente = sum(array_column($iva_acquisti_anno_precedente, 'iva'), null, 2);
|
||||
$totale_iva_anno_precedente = $totale_iva_vendite_anno_precedente - $totale_iva_acquisti_anno_precedente;
|
||||
|
||||
$totale_iva_vendite_periodo_precedente = sum(array_column($iva_vendite_periodo_precedente, 'iva'));
|
||||
$totale_iva_acquisti_periodo_precedente = sum(array_column($iva_acquisti_periodo_precedente, 'iva'));
|
||||
$totale_iva_vendite_periodo_precedente = sum(array_column($iva_vendite_periodo_precedente, 'iva'), null, 2);
|
||||
$totale_iva_acquisti_periodo_precedente = sum(array_column($iva_acquisti_periodo_precedente, 'iva'), null, 2);
|
||||
$totale_iva_periodo_precedente = $totale_iva_vendite_periodo_precedente - $totale_iva_acquisti_periodo_precedente;
|
||||
|
||||
$totale_iva = $totale_iva_esigibile - $totale_iva_detraibile;
|
||||
|
@ -69,7 +69,18 @@ echo '
|
|||
<th class="text-center" colspan="5">IVA ESIGIBILE DEL PERIODO</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_vendite_esigibile as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -91,7 +102,18 @@ echo '
|
|||
<th class="text-center" colspan="5">IVA NON ESIGIBILE DEL PERIODO</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_vendite_nonesigibile as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -112,7 +134,19 @@ echo '
|
|||
<tr>
|
||||
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA VENDITE</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_vendite as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -149,7 +183,18 @@ echo '
|
|||
<th class="text-center" colspan="5">IVA DETRAIBILE DEL PERIODO</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_acquisti_detraibile as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -172,7 +217,18 @@ echo '
|
|||
<th class="text-center" colspan="5">IVA NON DETRAIBILE DEL PERIODO</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_acquisti_nondetraibile as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -194,7 +250,19 @@ echo '
|
|||
<tr>
|
||||
<th class="text-center" colspan="5">RIEPILOGO GENERALE IVA ACQUISTI</th>
|
||||
</tr>';
|
||||
|
||||
// Somma importi arrotondati per fattura
|
||||
$aliquote=[];
|
||||
|
||||
foreach ($iva_acquisti as $record) {
|
||||
$aliquote[$record['cod_iva']]['aliquota'] = $record['aliquota'];
|
||||
$aliquote[$record['cod_iva']]['cod_iva'] = $record['cod_iva'];
|
||||
$aliquote[$record['cod_iva']]['descrizione'] = $record['descrizione'];
|
||||
$aliquote[$record['cod_iva']]['subtotale'] += sum($record['subtotale'], null, 2);
|
||||
$aliquote[$record['cod_iva']]['iva'] += sum($record['iva'], null, 2);
|
||||
}
|
||||
|
||||
foreach ($aliquote as $aliquota=>$record) {
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.round($record['aliquota']).'%</td>
|
||||
|
@ -220,7 +288,7 @@ echo '
|
|||
<table class="table table-condensed table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" colspan="2">PROSPETTO RIEPILOGATIVO DI LIQUIDAZIONE I.V.A.</th>
|
||||
<th class="text-center" colspan="2">PROSPETTO RIEPILOGATIVO DI LIQUIDAZIONE IVA</th>
|
||||
<tr>
|
||||
<th width="70%">DESCRIZIONE</th>
|
||||
<th class="text-right" width="30%">IMPORTO</th>
|
||||
|
|
|
@ -43,6 +43,7 @@ if (!empty($vendita_banco)){
|
|||
|
||||
$iva_vendite_esigibile = $dbo->fetchArray('
|
||||
SELECT
|
||||
id,
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione,
|
||||
|
@ -51,6 +52,7 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
co_documenti.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -64,9 +66,10 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, co_documenti.id
|
||||
UNION
|
||||
SELECT
|
||||
vb_venditabanco.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -82,16 +85,18 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
vb_venditabanco.data >= '.prepare($date_start).' AND vb_venditabanco.data <= '.prepare($date_end).' AND vb_righe_venditabanco.is_descrizione = 0 AND vb_stati_vendita.descrizione = "Pagato"
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, vb_venditabanco.id
|
||||
) AS tabella
|
||||
GROUP BY
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione;');
|
||||
descrizione,
|
||||
id');
|
||||
|
||||
|
||||
$iva_vendite = $dbo->fetchArray('
|
||||
SELECT
|
||||
id,
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione,
|
||||
|
@ -100,6 +105,7 @@ $iva_vendite = $dbo->fetchArray('
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
co_documenti.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -113,9 +119,10 @@ $iva_vendite = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, co_documenti.id
|
||||
UNION
|
||||
SELECT
|
||||
vb_venditabanco.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -131,15 +138,17 @@ $iva_vendite = $dbo->fetchArray('
|
|||
WHERE
|
||||
vb_venditabanco.data >= '.prepare($date_start).' AND vb_venditabanco.data <= '.prepare($date_end).' AND vb_righe_venditabanco.is_descrizione = 0 AND vb_stati_vendita.descrizione = "Pagato"
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, vb_venditabanco.id
|
||||
) AS tabella
|
||||
GROUP BY
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione;');
|
||||
descrizione,
|
||||
id');
|
||||
|
||||
$iva_vendite_anno_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
id,
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione,
|
||||
|
@ -148,6 +157,7 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
co_documenti.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -161,9 +171,10 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, co_documenti.id
|
||||
UNION
|
||||
SELECT
|
||||
vb_venditabanco.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -179,15 +190,17 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
vb_venditabanco.data >= '.prepare($anno_precedente_start).' AND vb_venditabanco.data <= '.prepare($anno_precedente_end).' AND vb_righe_venditabanco.is_descrizione = 0 AND vb_stati_vendita.descrizione = "Pagato"
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, vb_venditabanco.id
|
||||
) AS tabella
|
||||
GROUP BY
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione;');
|
||||
descrizione,
|
||||
id');
|
||||
|
||||
$iva_vendite_periodo_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
id,
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione,
|
||||
|
@ -196,6 +209,7 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
co_documenti.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -209,9 +223,10 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).'
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, co_documenti.id
|
||||
UNION
|
||||
SELECT
|
||||
vb_venditabanco.id AS id,
|
||||
co_iva.codice_natura_fe AS cod_iva,
|
||||
co_iva.percentuale AS aliquota,
|
||||
co_iva.descrizione AS descrizione,
|
||||
|
@ -227,12 +242,13 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
vb_venditabanco.data >= '.prepare($periodo_precedente_start).' AND vb_venditabanco.data <= '.prepare($periodo_precedente_end).' AND vb_righe_venditabanco.is_descrizione = 0 AND vb_stati_vendita.descrizione = "Pagato"
|
||||
GROUP BY
|
||||
cod_iva, aliquota, descrizione
|
||||
cod_iva, aliquota, descrizione, vb_venditabanco.id
|
||||
) AS tabella
|
||||
GROUP BY
|
||||
cod_iva,
|
||||
aliquota,
|
||||
descrizione;');
|
||||
descrizione,
|
||||
id');
|
||||
|
||||
}
|
||||
|
||||
|
@ -253,7 +269,7 @@ $iva_vendite_esigibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_vendite = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -270,7 +286,7 @@ $iva_vendite = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_vendite_anno_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -287,7 +303,7 @@ $iva_vendite_anno_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_vendite_periodo_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -304,7 +320,7 @@ $iva_vendite_periodo_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
}
|
||||
|
||||
$iva_vendite_nonesigibile = $dbo->fetchArray('
|
||||
|
@ -322,7 +338,7 @@ $iva_vendite_nonesigibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "entrata" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 1 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_acquisti_detraibile = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -339,7 +355,7 @@ $iva_acquisti_detraibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "uscita" AND co_righe_documenti.is_descrizione = 0 AND co_documenti.split_payment = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).' AND co_iva.indetraibile != 100
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_acquisti_nondetraibile = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -356,7 +372,7 @@ $iva_acquisti_nondetraibile = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "uscita" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= ' . prepare($date_start) . ' AND co_documenti.data_competenza <= ' . prepare($date_end) . ' AND co_iva.indetraibile != 0
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_acquisti = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -373,7 +389,7 @@ $iva_acquisti = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "uscita" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($date_start).' AND co_documenti.data_competenza <= '.prepare($date_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_acquisti_anno_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -390,7 +406,7 @@ $iva_acquisti_anno_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "uscita" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($anno_precedente_start).' AND co_documenti.data_competenza <= '.prepare($anno_precedente_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
||||
|
||||
$iva_acquisti_periodo_precedente = $dbo->fetchArray('
|
||||
SELECT
|
||||
|
@ -407,4 +423,4 @@ $iva_acquisti_periodo_precedente = $dbo->fetchArray('
|
|||
WHERE
|
||||
co_tipidocumento.dir = "uscita" AND co_righe_documenti.is_descrizione = 0 AND idstatodocumento NOT IN(SELECT id FROM co_statidocumento WHERE descrizione = "Bozza" OR descrizione = "Annullata") AND co_documenti.data_competenza >= '.prepare($periodo_precedente_start).' AND co_documenti.data_competenza <= '.prepare($periodo_precedente_end).'
|
||||
GROUP BY
|
||||
co_iva.id;');
|
||||
co_iva.id, co_documenti.id');
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$totale_iva = sum(array_column($records, 'iva'));
|
||||
$totale_subtotale = sum(array_column($records, 'subtotale'));
|
||||
$totale_iva = sum(array_column($records, 'iva'), null, 2);
|
||||
$totale_subtotale = sum(array_column($records, 'subtotale'), null, 2);
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
|
@ -42,8 +42,8 @@ echo '
|
|||
|
||||
foreach ($iva as $descrizione => $tot_iva) {
|
||||
if (!empty($descrizione)) {
|
||||
$somma_iva = sum($iva[$descrizione]);
|
||||
$somma_totale = sum($totale[$descrizione]);
|
||||
$somma_iva = sum($iva[$descrizione], null, 2);
|
||||
$somma_totale = sum($totale[$descrizione], null, 2);
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
|
|
|
@ -112,7 +112,7 @@ UPDATE `em_templates` SET `body` = '<p>Gentile Cliente,</p>\n<p>inviamo in alleg
|
|||
|
||||
-- Aggiunta stampa liquidazione provvigioni
|
||||
INSERT INTO `zz_prints` (`id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`, `available_options`) VALUES
|
||||
((SELECT id FROM zz_modules WHERE `name` = 'Anagrafiche'), 1, 'Provvigioni', 'Provvigioni', 'Provvigioni {ragione_sociale}', 'provvigione', 'idanagrafica', '', 'fa fa-print', '', '', 0, 0, 0, 1, NULL);
|
||||
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Anagrafiche'), 1, 'Provvigioni', 'Provvigioni', 'Provvigioni {ragione_sociale}', 'provvigione', 'idanagrafica', '', 'fa fa-print', '', '', 0, 0, 0, 1, NULL);
|
||||
|
||||
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES ( "Visualizza solo promemoria assegnati", '0', 'boolean', '1', 'Applicazione', '7', 'Se abilitata permetti ai tecnici la visualizzazione dei soli promemoria in cui risultano come assegnati');
|
||||
|
||||
|
@ -169,4 +169,4 @@ HAVING
|
|||
2=2
|
||||
ORDER BY
|
||||
`co_documenti`.`data` DESC,
|
||||
CAST(`co_documenti`.`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Fatture di vendita';
|
||||
CAST(`co_documenti`.`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Fatture di vendita';
|
||||
|
|
|
@ -22,4 +22,23 @@ ORDER BY
|
|||
`scadenza` ASC" WHERE `name` = 'Scadenzario';
|
||||
|
||||
-- Rimozione stampa spesometro
|
||||
DELETE FROM `zz_prints` WHERE `name` = 'Spesometro';
|
||||
DELETE FROM `zz_prints` WHERE `name` = 'Spesometro';
|
||||
|
||||
-- Aggiunta stampa ddt in entrata
|
||||
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), '1', 'Ddt di acquisto', 'Ddt in entrata', 'DDT num. {numero} del {data}', 'ddt', 'idddt', '{\"pricing\":true}', 'fa fa-print', '', '', '0', '1', '1', '1');
|
||||
|
||||
-- Aggiunte note checklist
|
||||
ALTER TABLE `zz_checks` ADD `note` TEXT NOT NULL AFTER `content`;
|
||||
|
||||
-- Aggiunto widget per la stampa settimanale del calendario
|
||||
INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `order`, `help`) VALUES
|
||||
(NULL, 'Stampa calendario settimanale', 'print', (SELECT id FROM zz_modules WHERE name = 'Dashboard'), 'controller_top', NULL, NULL, '#4ccc4c', 'fa fa-print', '', './modules/dashboard/widgets/stampa_calendario_settimanale.dashboard.php', 'popup', '', 'Stampa calendario settimanale', 1, 7, NULL);
|
||||
|
||||
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`, `available_options`) VALUES
|
||||
(NULL, (SELECT id FROM zz_modules WHERE name = 'Dashboard'), 1, 'Stampa calendario settimanale', 'Stampa calendario settimanale', 'Calendario settimanale', 'dashboard_settimanale', '', '', 'fa fa-print', '', '', 0, 1, 1, 1, NULL);
|
||||
|
||||
UPDATE `zz_settings` SET `nome` = 'Permetti fatturazione delle attività collegate a contratti' WHERE `zz_settings`.`nome` = 'Permetti fatturazione delle attività collegate a contratti, ordini e preventivi';
|
||||
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Permetti fatturazione delle attività collegate a ordini', (SELECT `valore` FROM `zz_settings` AS `a` WHERE `nome` = 'Permetti fatturazione delle attività collegate a contratti'), 'boolean', '1', 'Fatturazione', NULL, NULL);
|
||||
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Permetti fatturazione delle attività collegate a preventivi', (SELECT `valore` FROM `zz_settings` AS `a` WHERE `nome` = 'Permetti fatturazione delle attività collegate a contratti'), 'boolean', '1', 'Fatturazione', NULL, NULL);
|
||||
|
|
Loading…
Reference in New Issue