mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-04-11 16:51:20 +02:00
Migliorie tabella listini
This commit is contained in:
parent
cd0b84d606
commit
b3845575e1
@ -31,5 +31,32 @@ switch ($resource) {
|
|||||||
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
|
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'articoli_listino':
|
||||||
|
// Gestione campi di ricerca
|
||||||
|
if (!empty($search)) {
|
||||||
|
$search_fields[] = '|table_listini|.data_scadenza LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = '|table_listini|.prezzo_unitario LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = '|table_listini|.prezzo_unitario_ivato LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = '|table_listini|.sconto_percentuale LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = '|table_articoli|.codice LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = '|table_articoli|.descrizione LIKE '.prepare('%'.$search.'%');
|
||||||
|
$search_fields[] = ($prezzi_ivati ? '|table_articoli|.minimo_vendita_ivato' : '|table_articoli|.minimo_vendita').' LIKE '.prepare('%'.$search.'%');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiunta filtri di ricerca
|
||||||
|
$where = empty($search_fields) ? '1=1' : '('.implode(' OR ', $search_fields).')';
|
||||||
|
|
||||||
|
$query = 'SELECT mg_listini_articoli.*, mg_articoli.codice, mg_articoli.descrizione, mg_articoli.'.($prezzi_ivati ? 'minimo_vendita_ivato' : 'minimo_vendita').' AS minimo_vendita FROM mg_listini_articoli LEFT JOIN mg_articoli ON mg_listini_articoli.id_articolo=mg_articoli.id WHERE id_listino='.prepare($id_listino).' AND 1=1 LIMIT '.$start.', '.$length;
|
||||||
|
|
||||||
|
$query = str_replace('1=1', !empty($where) ? replace($where, [
|
||||||
|
'|table_listini|' => 'mg_listini_articoli',
|
||||||
|
'|table_articoli|' => 'mg_articoli',
|
||||||
|
]) : '', $query);
|
||||||
|
$articoli = $database->fetchArray($query);
|
||||||
|
$results = $articoli;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,20 @@
|
|||||||
include_once __DIR__.'/../../../core.php';
|
include_once __DIR__.'/../../../core.php';
|
||||||
|
|
||||||
$id_listino = filter('id_listino');
|
$id_listino = filter('id_listino');
|
||||||
|
$search = filter('search') ? filter('search')['value'] : null;
|
||||||
|
$start = filter('start');
|
||||||
|
$length = filter('length');
|
||||||
|
|
||||||
$tot_articoli = $dbo->select('mg_listini_articoli', '*', ['id_listino' => $id_listino]);
|
$tot_articoli = $dbo->select('mg_listini_articoli', '*', ['id_listino' => $id_listino]);
|
||||||
$articoli = $dbo->fetchArray('SELECT mg_listini_articoli.*, mg_articoli.codice, mg_articoli.descrizione, mg_articoli.'.($prezzi_ivati ? 'minimo_vendita_ivato' : 'minimo_vendita').' AS minimo_vendita FROM mg_listini_articoli LEFT JOIN mg_articoli ON mg_listini_articoli.id_articolo=mg_articoli.id WHERE id_listino='.prepare($id_listino).' LIMIT '.filter('start').', '.filter('length'));
|
|
||||||
|
if (empty($search)) {
|
||||||
|
$articoli = $dbo->fetchArray('SELECT mg_listini_articoli.*, mg_articoli.codice, mg_articoli.descrizione, mg_articoli.'.($prezzi_ivati ? 'minimo_vendita_ivato' : 'minimo_vendita').' AS minimo_vendita FROM mg_listini_articoli LEFT JOIN mg_articoli ON mg_listini_articoli.id_articolo=mg_articoli.id WHERE id_listino='.prepare($id_listino).' LIMIT '.$start.', '.$length);
|
||||||
|
} else {
|
||||||
|
$resource = 'articoli_listino';
|
||||||
|
include_once __DIR__.'/select.php';
|
||||||
|
|
||||||
|
$articoli = $results;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($articoli as $articolo) {
|
foreach ($articoli as $articolo) {
|
||||||
$riga = [
|
$riga = [
|
||||||
|
@ -63,11 +63,11 @@ echo '
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-offset-7 col-md-3">
|
<div class="col-md-5">
|
||||||
{[ "type":"select", "label":"'.tr('Articolo').'", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1, "id_listino": '.$id_record.'} ]}
|
{[ "type":"select", "label":"'.tr('Articolo').'", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1, "id_listino": '.$id_record.'} ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-1">
|
||||||
<div class="btn-group btn-group-flex">
|
<div class="btn-group btn-group-flex">
|
||||||
<button type="button" class="btn btn-primary" style="margin-top:25px;" onclick="aggiungiArticolo(this, true)">
|
<button type="button" class="btn btn-primary" style="margin-top:25px;" onclick="aggiungiArticolo(this, true)">
|
||||||
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
|
||||||
@ -82,35 +82,14 @@ echo '
|
|||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
<br><input id="check_all" type="checkbox"/>
|
<br><input id="check_all" type="checkbox"/>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th class="text-center" width="200">'.tr('Codice').'</th>
|
||||||
'.tr('Codice').'<br>
|
<th class="text-center" width="350">'.tr('Descrizione').'</th>
|
||||||
{[ "type": "text", "size": "10", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
<th class="text-center" width="95">'.tr('Data scadenza').'</th>
|
||||||
</th>
|
<th class="text-center">'.tr('Minimo').'</th>
|
||||||
<th class="text-center">
|
<th class="text-center">'.tr('Prezzo di listino').'</th>
|
||||||
'.tr('Descrizione').'<br>
|
<th class="text-center">'.tr('Prezzo ivato').'</th>
|
||||||
{[ "type": "text", "size": "30", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
<th class="text-center">'.tr('Sconto').'</th>
|
||||||
</th>
|
<th class="text-center" width="40"></th>
|
||||||
<th class="text-center">
|
|
||||||
'.tr('Data scadenza').'<br>
|
|
||||||
{[ "type": "text", "size": "3", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
'.tr('Minimo').'<br>
|
|
||||||
{[ "type": "text", "size": "3", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
'.tr('Prezzo di listino').'<br>
|
|
||||||
{[ "type": "text", "size": "3", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
'.tr('Prezzo ivato').'<br>
|
|
||||||
{[ "type": "text", "size": "3", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
'.tr('Sconto').'<br>
|
|
||||||
{[ "type": "text", "size": "3", "name": "search_sconto", "placeholder": "'.tr('Filtra').'..." ]}
|
|
||||||
</th>
|
|
||||||
<th class="text-center"></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
@ -184,7 +163,7 @@ echo '
|
|||||||
language: globals.translations.datatables,
|
language: globals.translations.datatables,
|
||||||
retrieve: true,
|
retrieve: true,
|
||||||
ordering: false,
|
ordering: false,
|
||||||
searching: false,
|
searching: true,
|
||||||
paging: true,
|
paging: true,
|
||||||
order: [],
|
order: [],
|
||||||
lengthChange: false,
|
lengthChange: false,
|
||||||
@ -206,36 +185,6 @@ echo '
|
|||||||
$("#mini-loader").hide();
|
$("#mini-loader").hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input[id^=\'search_\']").keyup(function() {
|
|
||||||
$("#tablelistini tr").each(function(){
|
|
||||||
$(this).show();
|
|
||||||
});
|
|
||||||
$("input[id^=\'search_\']").each(function(){
|
|
||||||
var position = $(this).closest("th").index();
|
|
||||||
var filter = $(this).val().toUpperCase();
|
|
||||||
|
|
||||||
var tr = $("#tablelistini tr");
|
|
||||||
if(filter!=""){
|
|
||||||
for (i = 0; i < tr.length; i++) {
|
|
||||||
td = tr[i].getElementsByTagName("td")[position];
|
|
||||||
if (td) {
|
|
||||||
if (td.innerText.toUpperCase().indexOf(filter) <= -1) {
|
|
||||||
tr[i].style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if ($("#check_all").is(":checked")) {
|
|
||||||
$("#check_all").trigger("click");
|
|
||||||
$(".check").each(function(){
|
|
||||||
if ($(this).is(":checked")) {
|
|
||||||
$(this).trigger("click");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Estraggo le righe spuntate
|
// Estraggo le righe spuntate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user