Bugfix e miglioramenti
Miglioramento della gestione automatica dei conti relativi ai pagamenti. Aggiunta possibilità di non specificare il nome tra gli allegati (se non impostato, viene preso il nome effettivo del file). Aggiunta possibilità di testare la query principale nel modulo Viste. Risoluzione di alcuni problemi nelle stampe dei contratti.
This commit is contained in:
parent
a9b71e9c4b
commit
d69a43860c
|
@ -40,6 +40,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||
// UPLOAD
|
||||
if (filter('op') == 'link_file' && !empty($_FILES) && !empty($_FILES['blob']['name'])) {
|
||||
$nome = filter('nome_allegato');
|
||||
$nome = !empty($nome) ? $nome : $_FILES['blob']['name'];
|
||||
|
||||
$src = $_FILES['blob']['tmp_name'];
|
||||
$f = pathinfo($_FILES['blob']['name']);
|
||||
|
|
|
@ -252,7 +252,7 @@ echo '
|
|||
<tr>
|
||||
<td>'.$rsa[$i]['nome'].'</td>
|
||||
<td>'.$rsa[$i]['targa'].'</td>
|
||||
<td>'.$rsa[$i]['qta'].' '.$rs[0]['unita_misura'].'</td>
|
||||
<td>'.Translator::numberToLocale($rsa[$i]['qta']).' '.$rs[0]['unita_misura'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ echo '
|
|||
</div>
|
||||
</div>';
|
||||
|
||||
if (get_var('Percentuale rivalsa INPS') != '' || get_var("Percentuale ritenuta d'acconto") != '') {
|
||||
if (get_var('Percentuale rivalsa INPS') != '' || get_var("Percentuale ritenuta d'acconto") != '' || $dir == 'uscita') {
|
||||
echo '
|
||||
<div class="row">';
|
||||
|
||||
// Rivalsa INPS
|
||||
if (get_var('Percentuale rivalsa INPS') != '') {
|
||||
if (get_var('Percentuale rivalsa INPS') != '' || $dir == 'uscita') {
|
||||
echo '
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Rivalsa INPS').'", "name": "idrivalsainps", "required": 1, "value": "'.get_var('Percentuale rivalsa INPS').'", "values": "query=SELECT * FROM co_rivalsainps" ]}
|
||||
|
@ -52,7 +52,7 @@ if (get_var('Percentuale rivalsa INPS') != '' || get_var("Percentuale ritenuta d
|
|||
}
|
||||
|
||||
// Ritenuta d'acconto
|
||||
if (get_var("Percentuale ritenuta d'acconto") != '') {
|
||||
if (get_var("Percentuale ritenuta d'acconto") != '' || $dir == 'uscita') {
|
||||
echo '
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr("Ritenuta d'acconto").'", "name": "idritenutaacconto", "required": 1, "value": "'.get_var("Percentuale ritenuta d'acconto").'", "values": "query=SELECT * FROM co_ritenutaacconto" ]}
|
||||
|
|
|
@ -31,6 +31,8 @@ switch (filter('op')) {
|
|||
'giorno' => $giorno,
|
||||
'prc' => $post['percentuale'][$key],
|
||||
'descrizione' => $descrizione,
|
||||
'idconto_vendite' => $post['idconto_vendite'],
|
||||
'idconto_acquisti' => $post['idconto_acquisti'],
|
||||
];
|
||||
|
||||
if (!empty($id)) {
|
||||
|
|
|
@ -14,8 +14,16 @@ include_once __DIR__.'/../../core.php';
|
|||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<div class="col-xs-12 col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Descrizione') ?>", "name": "descrizione", "value": "$descrizione$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-4">
|
||||
{[ "type": "select", "label": "<?php echo tr('Conto predefinito per le vendite') ?>", "name": "idconto_vendite", "value": "$idconto_vendite$", "ajax-source": "conti" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-4">
|
||||
{[ "type": "select", "label": "<?php echo tr('Conto predefinito per gli acquisti') ?>", "name": "idconto_acquisti", "value": "$idconto_acquisti$", "ajax-source": "conti" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,20 +12,29 @@ include_once __DIR__.'/../../core.php';
|
|||
$iddocumento = get('iddocumento');
|
||||
$dir = get('dir');
|
||||
|
||||
if ($iddocumento != '') {
|
||||
if (!empty($iddocumento)) {
|
||||
// Lettura numero e tipo di documento
|
||||
$query = 'SELECT dir, numero, numero_esterno, data, co_tipidocumento.descrizione AS tdescrizione, idanagrafica AS parent_idanagrafica, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=parent_idanagrafica AND deleted=0) AS ragione_sociale FROM co_documenti LEFT OUTER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_documenti.id='.prepare($iddocumento);
|
||||
$rs = $dbo->fetchArray($query);
|
||||
$dir = $rs[0]['dir'];
|
||||
$numero_doc = (!empty($rs[0]['numero_esterno'])) ? $rs[0]['numero_esterno'] : $rs[0]['numero'];
|
||||
$numero_doc = !empty($rs[0]['numero_esterno']) ? $rs[0]['numero_esterno'] : $rs[0]['numero'];
|
||||
$tipo_doc = $rs[0]['tdescrizione'];
|
||||
$descrizione = "$tipo_doc numero $numero_doc del ".Translator::dateToLocale($rs[0]['data']).' ('.$rs[0]['ragione_sociale'].')';
|
||||
|
||||
$descrizione = tr('_DOC_ numero _NUM_ del _DATE_ (_NAME_)', [
|
||||
'_DOC_' => $tipo_doc,
|
||||
'_NUM_' => $numero_doc,
|
||||
'_DATE_' => Translator::dateToLocale($rs[0]['data']),
|
||||
'_NAME_' => $rs[0]['ragione_sociale'],
|
||||
]);
|
||||
|
||||
/*
|
||||
Predisposizione prima riga
|
||||
*/
|
||||
$field = 'idconto_'.($dir == 'entrata' ? 'vendite' : 'acquisti');
|
||||
$idconto_aziendale = $dbo->fetchArray('SELECT '.$field.' FROM co_pagamenti WHERE id = (SELECT idpagamento FROM co_documenti WHERE id='.prepare($iddocumento).') GROUP BY descrizione')[0][$field];
|
||||
|
||||
// Lettura conto cassa di default
|
||||
$idconto_aziendale = get_var('Conto aziendale predefinito');
|
||||
$idconto_aziendale = !empty($idconto_aziendale) ? $idconto_aziendale : get_var('Conto aziendale predefinito');
|
||||
|
||||
// Generazione causale (incasso fattura)
|
||||
$descrizione_conto_aziendale = $descrizione;
|
||||
|
|
|
@ -134,6 +134,18 @@ switch (filter('op')) {
|
|||
|
||||
break;
|
||||
|
||||
case 'test':
|
||||
$total = Modules::getQuery($id_record);
|
||||
$module_query = $total['query'];
|
||||
|
||||
$module_query = str_replace('|period_start|', $_SESSION['period_start'], $module_query);
|
||||
$module_query = str_replace('|period_end|', $_SESSION['period_end'], $module_query);
|
||||
$module_query = str_replace('|select|', $total['select'], $module_query);
|
||||
|
||||
$dbo->fetchArray($module_query.' LIMIT 1');
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id = filter('id');
|
||||
|
||||
|
|
|
@ -63,7 +63,13 @@ if ($options != '' && $options != 'menu' && $options != 'custom') {
|
|||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<p><strong>'.tr('Query risultante').':</strong></p>
|
||||
<p>'.htmlentities($module_query).'</p>
|
||||
<p>'.htmlentities($module_query).'</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button type="button" class="btn btn-warning pull-righ" onclick="testQuery()"><i class="fa fa-file-text-o "></i> '.tr('Testa la query').'</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
@ -446,6 +452,29 @@ if (!empty($options) && $options != 'custom') {
|
|||
|
||||
echo '
|
||||
<script>
|
||||
function testQuery(){
|
||||
$("#main_loading").fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: "'.ROOTDIR.'/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=test",
|
||||
cache: false,
|
||||
type: "post",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType : "html",
|
||||
success: function(data) {
|
||||
$("#main_loading").fadeOut();
|
||||
|
||||
swal("'.tr('Query funzionante').'", "'.tr('La query attuale funziona correttamente!').'", "success");
|
||||
},
|
||||
error: function(data) {
|
||||
$("#main_loading").fadeOut();
|
||||
|
||||
swal("'.tr('Errore').'", "'.tr('Errore durante il test della query!').'", "error");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.replace(new RegExp(find, "g"), replace);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class FileManager implements ManagerInterface
|
|||
public function manage($options)
|
||||
{
|
||||
$options['showpanel'] = isset($options['showpanel']) ? $options['showpanel'] : true;
|
||||
$options['label'] = isset($options['label']) ? $options['label'] : 'Nuovo allegato:';
|
||||
$options['label'] = isset($options['label']) ? $options['label'] : tr('Nuovo allegato').':';
|
||||
|
||||
$dbo = \Database::getConnection();
|
||||
|
||||
|
@ -70,7 +70,7 @@ class FileManager implements ManagerInterface
|
|||
<b>'.$options['label'].'</b>
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
{[ "type": "text", "placeholder": "'.tr('Nome').'", "name": "nome_allegato", "required": 1 ]}
|
||||
{[ "type": "text", "placeholder": "'.tr('Nome').'", "name": "nome_allegato" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
|
@ -78,7 +78,7 @@ class FileManager implements ManagerInterface
|
|||
</div>
|
||||
|
||||
<div class="col-lg-2 text-right">
|
||||
<button type="button" class="btn btn-success" id="upload_button" onclick="SaveFile();">
|
||||
<button type="button" class="btn btn-success" onclick="saveFile();">
|
||||
<i class="fa fa-upload"></i> '.tr('Carica').'
|
||||
</button>
|
||||
</div>
|
||||
|
@ -86,12 +86,9 @@ class FileManager implements ManagerInterface
|
|||
|
||||
$result .= '
|
||||
<script>
|
||||
function SaveFile(){
|
||||
function saveFile(){
|
||||
if(!$("#blob").val()){
|
||||
alert("Devi selezionare un file con il tasto Sfoglia...");
|
||||
return false;
|
||||
} else if(!$("input[name=nome_allegato]").val()){
|
||||
alert("Devi inserire un nome per il file!");
|
||||
swal("'.addslashes(tr('Attenzione!')).'", "'.addslashes(tr('Devi selezionare un file con il tasto "Sfoglia"')).'...", "warning");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -228,10 +228,18 @@ echo '
|
|||
'.tr('Validità offerta', [], ['upper' => true]).'
|
||||
</th>
|
||||
|
||||
<td>
|
||||
<td>';
|
||||
|
||||
if (!empty($records[0]['validita'])) {
|
||||
echo'
|
||||
'.tr('_TOT_ giorni', [
|
||||
'_TOT_' => $records[0]['validita'],
|
||||
]).' giorni
|
||||
]);
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -240,11 +248,19 @@ echo '
|
|||
'.tr('Validità contratto', [], ['upper' => true]).'
|
||||
</th>
|
||||
|
||||
<td>
|
||||
<td>';
|
||||
|
||||
if (!empty($records[0]['data_accettazione']) && !empty($records[0]['data_conclusione'])) {
|
||||
echo '
|
||||
'.tr('dal _START_ al _END_', [
|
||||
'_START_' => Translator::dateToLocale($records[0]['data_accettazione']),
|
||||
'_END_' => Translator::dateToLocale($records[0]['data_conclusione']),
|
||||
]).'
|
||||
]);
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -321,14 +321,16 @@ $body .= "<td align=\"left\" bgcolor=\"#cccccc\" width=\"24mm\">\n";
|
|||
$body .= '<b>'.$diff." €</b>\n";
|
||||
$body .= "</td></tr>\n";
|
||||
|
||||
$body .= "<tr><td align=\"right\" width=\"131mm\">\n";
|
||||
$body .= "<b>ORE RESIDUE:</b>\n";
|
||||
$body .= "</td>\n";
|
||||
if(!empty($contratto_tot_ore)){
|
||||
$body .= "<tr><td align=\"right\" width=\"131mm\">\n";
|
||||
$body .= "<b>ORE RESIDUE:</b>\n";
|
||||
$body .= "</td>\n";
|
||||
|
||||
$body .= "<td align=\"center\" bgcolor=\"#cccccc\" width=\"24mm\">\n";
|
||||
$diff2 = Translator::numberToLocale($contratto_tot_ore - $totale_ore_impiegate, 2);
|
||||
$body .= "<b>$diff2 (ore erogate: ".Translator::numberToLocale($totale_ore_impiegate, 2).' - ore in contratto: '.Translator::numberToLocale($contratto_tot_ore, 2).")</b>\n";
|
||||
$body .= "</td></tr>\n";
|
||||
$body .= "<td align=\"center\" bgcolor=\"#cccccc\" width=\"24mm\">\n";
|
||||
$diff2 = Translator::numberToLocale($contratto_tot_ore - $totale_ore_impiegate, 2);
|
||||
$body .= "<b>$diff2 (ore erogate: ".Translator::numberToLocale($totale_ore_impiegate, 2).' - ore in contratto: '.Translator::numberToLocale($contratto_tot_ore, 2).")</b>\n";
|
||||
$body .= "</td></tr>\n";
|
||||
}
|
||||
|
||||
$body .= "</table>\n";
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
echo "
|
||||
<table class='table-bordered'>
|
||||
<tr>
|
||||
<td colspan=".(!empty($sconto) ? 5 : 3)." class='cell-padded' style='height:".(!empty($records[0]['ritenutaacconto']) ? 20 : 30)."mm'>";
|
||||
<td colspan=".(!empty($sconto) ? 5 : 3)." class='cell-padded' style='height:".($records[0]['ritenutaacconto'] != 0 ? 20 : 30)."mm'>";
|
||||
|
||||
// Tabella (scadenze + iva)
|
||||
echo "
|
||||
|
|
|
@ -276,10 +276,18 @@ echo '
|
|||
'.tr('Validità offerta', [], ['upper' => true]).'
|
||||
</th>
|
||||
|
||||
<td>
|
||||
<td>';
|
||||
|
||||
if (!empty($records[0]['validita'])) {
|
||||
echo'
|
||||
'.tr('_TOT_ giorni', [
|
||||
'_TOT_' => $records[0]['validita'],
|
||||
]).' giorni
|
||||
]);
|
||||
} else {
|
||||
echo '-';
|
||||
}
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -927,3 +927,6 @@ ALTER TABLE `co_righe_preventivi` DROP `prc_guadagno`;
|
|||
ALTER TABLE `co_iva` DROP `descrizione2`;
|
||||
UPDATE `co_iva` SET `dicitura` = 'Senza addebito iva ex art. 74 comma 8-9 del DPR 633/72' WHERE `descrizione` = 'Esente art. 74';
|
||||
UPDATE `co_iva` SET `dicitura` = 'Operazione soggetta a reverse charge ex art. 17, comma 6, DPR 633/72' WHERE `descrizione` = 'Art. 17 comma 6 DPR 633/72' OR `descrizione` = 'Art. 17 comma 6 DPR 633/72 4%' OR `descrizione` = 'Art. 17 comma 6 DPR 633/72 10%' OR `descrizione` = 'Art. 17 comma 6 DPR 633/72 20%' OR `descrizione` = 'Art. 17 comma 6 DPR 633/72 22%';
|
||||
|
||||
-- Aggiunta campi in co_pagamenti per la selezione del conto di default
|
||||
ALTER TABLE `co_pagamenti` ADD `idconto_vendite` int(11), ADD `idconto_acquisti` int(11);
|
||||
|
|
Loading…
Reference in New Issue