mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 04:20:50 +01:00
Merge branch 'grafica-importazione-fe'
This commit is contained in:
commit
7693657cb3
@ -21,7 +21,7 @@ function input(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Input(name) {
|
function Input(name) {
|
||||||
this.element = $("[name=" + name + "]").last();
|
this.element = $("[name='" + name + "']").last();
|
||||||
|
|
||||||
// Fix per select multipli
|
// Fix per select multipli
|
||||||
if (this.element.length === 0) {
|
if (this.element.length === 0) {
|
||||||
|
@ -99,8 +99,28 @@ function start_superselect() {
|
|||||||
params.page = params.page || 0;
|
params.page = params.page || 0;
|
||||||
params.length = params.length || 100;
|
params.length = params.length || 100;
|
||||||
|
|
||||||
|
let results = data.results;
|
||||||
|
|
||||||
|
// Interpretazione forzata per campi optgroup
|
||||||
|
if (results[0]['optgroup']) {
|
||||||
|
let groups = results.reduce(function (r, a) {
|
||||||
|
r[a.optgroup] = r[a.optgroup] || [];
|
||||||
|
r[a.optgroup].push(a);
|
||||||
|
return r;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
let results_groups = [];
|
||||||
|
for (const key in groups) {
|
||||||
|
results_groups.push({
|
||||||
|
text: key,
|
||||||
|
children: groups[key],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
results = results_groups;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
results: data.results,
|
results: results,
|
||||||
pagination: {
|
pagination: {
|
||||||
more: (params.page + 1) * params.length < data.recordsFiltered,
|
more: (params.page + 1) * params.length < data.recordsFiltered,
|
||||||
}
|
}
|
||||||
@ -236,8 +256,8 @@ jQuery.fn.getSelectOption = function (name) {
|
|||||||
* @param name
|
* @param name
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
function updateSelectOption(name, value){
|
function updateSelectOption(name, value) {
|
||||||
$(".superselectajax").each(function (){
|
$(".superselectajax").each(function () {
|
||||||
$(this).setSelectOption(name, value);
|
$(this).setSelectOption(name, value);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -210,9 +210,9 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -235,9 +235,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
|
@ -272,9 +272,9 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -297,9 +297,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
@ -323,17 +323,17 @@ function rimuoviRiga(button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modificaSeriali(button) {
|
function modificaSeriali(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function apriRiferimenti(button) {
|
function apriRiferimenti(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Riferimenti riga').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_riferimenti&riga_id=" + id + "&riga_type=" + type)
|
openModal("'.tr('Riferimenti riga').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=visualizza_riferimenti&riga_id=" + id + "&riga_type=" + type)
|
||||||
}
|
}
|
||||||
|
50
modules/fatture/ajax/select.php
Normal file
50
modules/fatture/ajax/select.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../../core.php';
|
||||||
|
|
||||||
|
switch ($resource) {
|
||||||
|
/*
|
||||||
|
* Opzioni utilizzate:
|
||||||
|
* - id_anagrafica
|
||||||
|
*/
|
||||||
|
case 'riferimenti-fe':
|
||||||
|
$direzione = 'uscita';
|
||||||
|
$id_anagrafica = $superselect['id_anagrafica'];
|
||||||
|
if (empty($id_anagrafica)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$query_ordini = "SELECT or_ordini.id,
|
||||||
|
CONCAT('Ordine num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d-%m-%Y'), ' [', (SELECT descrizione FROM or_statiordine WHERE id = idstatoordine) , ']') AS text,
|
||||||
|
'Ordini' AS optgroup,
|
||||||
|
'ordine' AS tipo
|
||||||
|
FROM or_ordini
|
||||||
|
WHERE idanagrafica = ".prepare($id_anagrafica)." AND
|
||||||
|
idstatoordine IN (
|
||||||
|
SELECT id FROM or_statiordine WHERE descrizione IN ('Bozza', 'Accettato', 'Parzialmente evaso', 'Parzialmente fatturato')
|
||||||
|
) AND
|
||||||
|
idtipoordine IN (
|
||||||
|
SELECT id FROM or_tipiordine WHERE dir = ".prepare($direzione).'
|
||||||
|
)
|
||||||
|
ORDER BY data DESC, numero DESC';
|
||||||
|
|
||||||
|
$query_ddt = "SELECT dt_ddt.id,
|
||||||
|
CONCAT('DDT num. ', IF(numero_esterno != '', numero_esterno, numero), ' del ', DATE_FORMAT(data, '%d-%m-%Y'), ' [', (SELECT descrizione FROM dt_statiddt WHERE id = idstatoddt) , ']') AS text,
|
||||||
|
'DDT' AS optgroup,
|
||||||
|
'ddt' AS tipo
|
||||||
|
FROM dt_ddt
|
||||||
|
WHERE idanagrafica = ".prepare($id_anagrafica)." AND
|
||||||
|
idstatoddt IN (
|
||||||
|
SELECT id FROM dt_statiddt WHERE descrizione IN ('Bozza', 'Parzialmente evaso', 'Parzialmente fatturato')
|
||||||
|
) AND
|
||||||
|
idtipoddt IN (
|
||||||
|
SELECT id FROM dt_tipiddt WHERE dir=".prepare($direzione).'
|
||||||
|
)
|
||||||
|
ORDER BY data DESC, numero DESC';
|
||||||
|
|
||||||
|
$ordini = $database->fetchArray($query_ordini);
|
||||||
|
$ddt = $database->fetchArray($query_ddt);
|
||||||
|
$results = array_merge($ordini, $ddt);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
@ -380,9 +380,9 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -405,9 +405,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
@ -431,17 +431,17 @@ function rimuoviRiga(button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modificaSeriali(button) {
|
function modificaSeriali(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
function apriInformazioniFE(button) {
|
function apriInformazioniFE(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Dati Fattura Elettronica').'", "'.$module->fileurl('fe/row-fe.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type)
|
openModal("'.tr('Dati Fattura Elettronica').'", "'.$module->fileurl('fe/row-fe.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type)
|
||||||
}
|
}
|
||||||
|
@ -168,9 +168,9 @@ if (!$righe->isEmpty()) {
|
|||||||
echo '
|
echo '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -193,9 +193,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
@ -219,9 +219,9 @@ function rimuoviRiga(button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modificaSeriali(button) {
|
function modificaSeriali(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
|
@ -287,9 +287,9 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -312,9 +312,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
@ -338,9 +338,9 @@ function rimuoviRiga(button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modificaSeriali(button) {
|
function modificaSeriali(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
openModal("'.tr('Aggiorna SN').'", globals.rootdir + "/modules/fatture/add_serial.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&riga_id=" + id + "&riga_type=" + type);
|
||||||
}
|
}
|
||||||
|
@ -236,9 +236,9 @@ echo '
|
|||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
async function modificaRiga(button) {
|
async function modificaRiga(button) {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
// Salvataggio via AJAX
|
// Salvataggio via AJAX
|
||||||
let valid = await salvaForm(button, $("#edit-form"));
|
let valid = await salvaForm(button, $("#edit-form"));
|
||||||
@ -261,9 +261,9 @@ function rimuoviRiga(button) {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: "'.tr('Sì').'"
|
confirmButtonText: "'.tr('Sì').'"
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var riga = $(button).closest("tr");
|
let riga = $(button).closest("tr");
|
||||||
var id = riga.data("id");
|
let id = riga.data("id");
|
||||||
var type = riga.data("type");
|
let type = riga.data("type");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
|
@ -278,12 +278,17 @@ if (!empty($righe)) {
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover table-striped table-condensed">
|
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||||
<tr>
|
<thead>
|
||||||
<th>'.tr('Descrizione').'</th>
|
<tr>
|
||||||
<th width="25%">'.tr('Dati contabili').'*</th>
|
<th>'.tr('Descrizione').'</th>
|
||||||
<th width="25%">'.tr('Articolo').'</th>
|
<th class="text-center" width="10%">'.tr('Quantità').'</th>
|
||||||
</tr>';
|
<th class="text-center" width="10%">'.tr('Prezzo unitario').'</th>
|
||||||
|
<th class="text-center" width="10%">'.tr('Aliquota').'</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>';
|
||||||
|
|
||||||
foreach ($righe as $key => $riga) {
|
foreach ($righe as $key => $riga) {
|
||||||
$query = 'SELECT id, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)) AS descrizione FROM co_iva WHERE percentuale = '.prepare($riga['AliquotaIVA']);
|
$query = 'SELECT id, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)) AS descrizione FROM co_iva WHERE percentuale = '.prepare($riga['AliquotaIVA']);
|
||||||
@ -310,84 +315,111 @@ if (!empty($righe)) {
|
|||||||
$id_articolo = $database->fetchOne('SELECT id FROM mg_articoli WHERE codice = '.prepare($codice_principale))['id'];
|
$id_articolo = $database->fetchOne('SELECT id FROM mg_articoli WHERE codice = '.prepare($codice_principale))['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$qta = $riga['Quantita'];
|
||||||
|
$um = $riga['UnitaMisura'];
|
||||||
|
$prezzo_unitario = $riga['PrezzoUnitario'];
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr data-id="'.$key.'" data-qta="'.$qta.'" data-prezzo_unitario="'.$prezzo_unitario.'" data-iva_percentuale="'.$riga['AliquotaIVA'].'">
|
||||||
<td>
|
<td>
|
||||||
'.$riga['Descrizione'].'<br>
|
'.$riga['Descrizione'].'<br>
|
||||||
|
|
||||||
'.(!empty($codici_articoli) ? '<small>'.implode(', ', $codici_articoli).'</small><br>' : '').'
|
'.(!empty($codici_articoli) ? '<small>'.implode(', ', $codici_articoli).'</small><br>' : '').'
|
||||||
|
<span id="riferimento_'.$key.'_descrizione"></span>
|
||||||
|
<b id="riferimento_'.$key.'"></b>
|
||||||
|
</td>
|
||||||
|
|
||||||
<small>'.tr('Q.tà: _QTA_ _UM_', [
|
<td class="text-center">
|
||||||
'_QTA_' => Translator::numberToLocale($riga['Quantita']),
|
'.numberFormat($qta, 'qta').' '.$um.'
|
||||||
'_UM_' => $riga['UnitaMisura'],
|
<span id="riferimento_'.$key.'_qta"></span>
|
||||||
]).'</small><br>
|
</td>
|
||||||
|
|
||||||
<small>'.tr('Aliquota IVA: _VALUE_ _DESC_', [
|
<td class="text-right">
|
||||||
|
'.moneyFormat($prezzo_unitario).'
|
||||||
|
<span id="riferimento_'.$key.'_prezzo"></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-right">
|
||||||
|
'.replace('_VALUE_ _DESC_', [
|
||||||
'_VALUE_' => empty($riga['Natura']) ? numberFormat($riga['AliquotaIVA']).'%' : $riga['Natura'],
|
'_VALUE_' => empty($riga['Natura']) ? numberFormat($riga['AliquotaIVA']).'%' : $riga['Natura'],
|
||||||
'_DESC_' => $riga['RiferimentoNormativo'] ? ' - '.$riga['RiferimentoNormativo'] : '',
|
'_DESC_' => $riga['RiferimentoNormativo'] ? ' - '.$riga['RiferimentoNormativo'] : '',
|
||||||
]).'</small>
|
]).'
|
||||||
|
<span id="riferimento_'.$key.'_iva"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="dati_'.$key.'">
|
||||||
|
<td colspan="4" class="row">
|
||||||
<span class="hide" id="aliquota['.$key.']">'.$riga['AliquotaIVA'].'</span>
|
<span class="hide" id="aliquota['.$key.']">'.$riga['AliquotaIVA'].'</span>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{[ "type": "select", "name": "iva['.$key.']", "values": "query='.str_replace('"', '\"', $query).'", "required": 1, "placeholder": "Aliquota iva" ]}
|
|
||||||
<br>
|
|
||||||
{[ "type": "select", "name": "conto['.$key.']", "ajax-source": "conti-acquisti", "required": 1, "placeholder": "Conto acquisti" ]}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{[ "type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.Modules::get('Articoli')['id'].'|codice='.htmlentities($codice_principale).'&descrizione='.htmlentities($riga['Descrizione']).'", "value": "'.$id_articolo.'" ]}
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<span id="riferimento_'.$key.'"></span>
|
|
||||||
<button type="button" class="btn btn-info pull-right btn-xs" onclick="selezionaRiferimento('.$key.')">
|
|
||||||
<i class="fa fa-chevron-right"></i> '.tr('Riferimenti').'
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<input type="hidden" name="qta_riferimento['.$key.']" id="qta_riferimento_'.$key.'" value="'.$riga['Quantita'].'">
|
<input type="hidden" name="qta_riferimento['.$key.']" id="qta_riferimento_'.$key.'" value="'.$riga['Quantita'].'">
|
||||||
|
|
||||||
<input type="hidden" name="tipo_riferimento['.$key.']" id="tipo_riferimento_'.$key.'" value="">
|
<input type="hidden" name="tipo_riferimento['.$key.']" id="tipo_riferimento_'.$key.'" value="">
|
||||||
<input type="hidden" name="id_riferimento['.$key.']" id="id_riferimento_'.$key.'" value="">
|
<input type="hidden" name="id_riferimento['.$key.']" id="id_riferimento_'.$key.'" value="">
|
||||||
<input type="hidden" name="id_riga_riferimento['.$key.']" id="id_riga_riferimento_'.$key.'" value="">
|
<input type="hidden" name="id_riga_riferimento['.$key.']" id="id_riga_riferimento_'.$key.'" value="">
|
||||||
<input type="hidden" name="tipo_riga_riferimento['.$key.']" id="tipo_riga_riferimento_'.$key.'" value="">
|
<input type="hidden" name="tipo_riga_riferimento['.$key.']" id="tipo_riga_riferimento_'.$key.'" value="">
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
{[ "type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.Modules::get('Articoli')['id'].'|codice='.htmlentities($codice_principale).'&descrizione='.htmlentities($riga['Descrizione']).'", "value": "'.$id_articolo.'", "label": "'.tr('Articolo').'" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
{[ "type": "select", "name": "conto['.$key.']", "ajax-source": "conti-acquisti", "required": 1, "label": "'.tr('Conto acquisti').'" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
{[ "type": "select", "name": "iva['.$key.']", "values": '.json_encode('query='.$query).', "required": 1, "label": "'.tr('Aliquota IVA').'" ]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
{[ "type": "select", "name": "selezione_riferimento['.$key.']", "ajax-source": "riferimenti-fe", "select-options": '.json_encode(['id_anagrafica' => $anagrafica ? $anagrafica->id : '']).', "required": 1, "label": "'.tr('Riferimento').'", "icon-after": '.json_encode('<button type="button" onclick="rimuoviRiferimento(this)" class="btn btn-primary disabled" id="rimuovi_riferimento_'.$key.'"><i class="fa fa-close"></i></button>').' ]}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<script>
|
<script>
|
||||||
function copy(){
|
function copy() {
|
||||||
var first_iva = null;
|
let aliquote = $("select[name^=iva");
|
||||||
var first_conto = null;
|
let conti = $("select[name^=conto");
|
||||||
|
|
||||||
$("select[name^=iva").each( function(){
|
// Individuazione della prima IVA selezionata
|
||||||
if( $(this).val() != "" && first_iva == null ){
|
let iva_selezionata = null;
|
||||||
first_iva = $(this);
|
for (const aliquota of aliquote) {
|
||||||
|
const data = $(aliquota).selectData();
|
||||||
|
if (data) {
|
||||||
|
iva_selezionata = data;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
$("select[name^=conto").each( function(){
|
// Individuazione del primo conto selezionato
|
||||||
if( $(this).val() != "" && first_conto == null ){
|
let conto_selezionato = null;
|
||||||
first_conto = $(this);
|
for (const conto of conti) {
|
||||||
|
const data = $(conto).selectData();
|
||||||
|
if (data) {
|
||||||
|
conto_selezionato = data;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
if(first_iva) {
|
// Selezione generale per l\'IVA
|
||||||
$iva = first_iva.selectData();
|
if (iva_selezionata) {
|
||||||
|
aliquote.each(function() {
|
||||||
$("select[name^=iva").each(function(){
|
$(this).selectSet(iva_selezionata.id);
|
||||||
$(this).selectSet($iva.id);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(first_conto) {
|
// Selezione generale per il conto
|
||||||
$conto = first_conto.selectData();
|
if (conto_selezionato) {
|
||||||
|
console.log(conto_selezionato);
|
||||||
$("select[name^=conto").each(function(){
|
conti.each(function() {
|
||||||
$(this).selectSetNew($conto.id, $conto.text);
|
$(this).selectSetNew(conto_selezionato.id, conto_selezionato.text, conto_selezionato);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,25 +444,124 @@ echo '
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function selezionaRiferimento(id_riga, qta) {
|
$("select[name^=selezione_riferimento").change(function() {
|
||||||
var qta = $("#qta_riferimento_" + id_riga).val();
|
let $this = $(this);
|
||||||
|
let data = $this.selectData();
|
||||||
|
|
||||||
var tipo = $("#tipo_riferimento_" + id_riga).val();
|
if (data) {
|
||||||
var id_documento = $("#id_riferimento_" + id_riga).val();
|
let riga = $this.closest("tr").prev();
|
||||||
var id_riga_riferimento = $("#id_riga_riferimento_" + id_riga).val();
|
selezionaRiferimento(riga, data.tipo, data.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
openModal("'.tr('Selezione riferimento').'", "'.$structure->fileurl('riferimento.php').'?id_module='.$id_module.'&id_plugin='.$id_plugin.'&id_record='.$id_record.'&id_riga=" + id_riga + "&qta=" + qta + "&tipo_riferimento=" + tipo + "&id_documento=" + id_documento + "&id_riga_riferimento=" + id_riga_riferimento);
|
function rimuoviRiferimento(button) {
|
||||||
impostaRiferimento(id_riga, "", "", null);
|
let riga = $(button).closest("tr").prev();
|
||||||
$("#riferimento_" + id_riga).html("");
|
let id_riga = riga.data("id");
|
||||||
|
|
||||||
|
impostaRiferimento(id_riga, {}, {});
|
||||||
|
|
||||||
|
input("selezione_riferimento[" + id_riga + "]").enable()
|
||||||
|
.getElement().selectReset();
|
||||||
|
$(button).addClass("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
function impostaRiferimento(id_riga, tipo, id_documento, tipo_riga_riferimento, id_riga_riferimento, testo) {
|
function selezionaRiferimento(riga, tipo_documento, id_documento) {
|
||||||
$("#tipo_riferimento_" + id_riga).val(tipo);
|
let id_riga = riga.data("id");
|
||||||
$("#id_riferimento_" + id_riga).val(id_documento);
|
let qta = riga.data("qta");
|
||||||
|
|
||||||
$("#tipo_riga_riferimento_" + id_riga).val(tipo_riga_riferimento);
|
let riferimenti = getRiferimenti();
|
||||||
$("#id_riga_riferimento_" + id_riga).val(id_riga_riferimento);
|
let query = {
|
||||||
|
id_module: "'.$id_module.'",
|
||||||
|
id_record: "'.$id_record.'",
|
||||||
|
qta: qta,
|
||||||
|
id_riga: id_riga,
|
||||||
|
id_documento: id_documento,
|
||||||
|
tipo_documento: tipo_documento,
|
||||||
|
righe_ddt: riferimenti.ddt,
|
||||||
|
righe_ordini: riferimenti.ordini,
|
||||||
|
};
|
||||||
|
|
||||||
$("#riferimento_" + id_riga).html(testo);
|
let url = "'.$structure->fileurl('riferimento.php').'?" + $.param(query);
|
||||||
|
|
||||||
|
openModal("'.tr('Selezione riferimento').'", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRiferimenti() {
|
||||||
|
let righe_ordini = {};
|
||||||
|
let righe_ddt = {};
|
||||||
|
|
||||||
|
$("[id^=tipo_riferimento_]").each(function(index, item) {
|
||||||
|
let tipo = $(item).val();
|
||||||
|
let riga = $(item).closest("tr");
|
||||||
|
|
||||||
|
let qta = parseFloat(riga.find("[id^=qta_riferimento_]").val());
|
||||||
|
let id_riga = riga.find("[id^=id_riga_riferimento_]").val();
|
||||||
|
if (tipo === "ordine") {
|
||||||
|
righe_ordini[id_riga] = righe_ordini[id_riga] ? righe_ordini[id_riga] : 0;
|
||||||
|
righe_ordini[id_riga] += qta;
|
||||||
|
} else if (tipo === "ddt") {
|
||||||
|
righe_ddt[id_riga] = righe_ddt[id_riga] ? righe_ddt[id_riga] : 0;
|
||||||
|
righe_ddt[id_riga] += qta;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
ordini: righe_ordini,
|
||||||
|
ddt: righe_ddt,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id_riga
|
||||||
|
* @param documento = {tipo, id, descrizione }
|
||||||
|
* @param riga = {tipo, id, descrizione, qta, prezzo_unitario}
|
||||||
|
*/
|
||||||
|
function impostaRiferimento(id_riga, documento, riga) {
|
||||||
|
// Informazioni interne per il riferimento
|
||||||
|
$("#tipo_riferimento_" + id_riga).val(documento.tipo);
|
||||||
|
$("#id_riferimento_" + id_riga).val(documento.id);
|
||||||
|
$("#tipo_riga_riferimento_" + id_riga).val(riga.tipo);
|
||||||
|
$("#id_riga_riferimento_" + id_riga).val(riga.id);
|
||||||
|
|
||||||
|
// Gestione della selezione
|
||||||
|
input("selezione_riferimento[" + id_riga + "]").disable();
|
||||||
|
$("#rimuovi_riferimento_" + id_riga).removeClass("disabled");
|
||||||
|
|
||||||
|
let riga_fe = $("#id_riga_riferimento_" + id_riga).closest("tr").prev();
|
||||||
|
|
||||||
|
// Informazioni visibili sulla quantità
|
||||||
|
impostaContenuto(riga_fe.data("qta"), riga.qta, "#riferimento_" + id_riga + "_qta");
|
||||||
|
|
||||||
|
// Informazioni visibili sul prezzo unitario
|
||||||
|
impostaContenuto(riga_fe.data("prezzo_unitario"), riga.prezzo_unitario, "#riferimento_" + id_riga + "_prezzo");
|
||||||
|
|
||||||
|
// Informazioni visibili sull\'aliquota IVA
|
||||||
|
impostaContenuto(riga_fe.data("iva_percentuale"), riga.iva_percentuale, "#riferimento_" + id_riga + "_iva");
|
||||||
|
|
||||||
|
$("#riferimento_" + id_riga).html(documento.descrizione ? documento.descrizione : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Informazioni visibili sull\'aliquota IVA
|
||||||
|
function impostaContenuto(valore_riga, valore_riferimento, id_elemento) {
|
||||||
|
let elemento = $(id_elemento);
|
||||||
|
if (valore_riferimento === undefined){
|
||||||
|
elemento.html("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
valore_riga = parseFloat(valore_riga);
|
||||||
|
valore_riferimento = parseFloat(valore_riferimento);
|
||||||
|
|
||||||
|
let contenuto = valore_riferimento.toLocale() + "%";
|
||||||
|
if (valore_riferimento === valore_riga) {
|
||||||
|
contenuto = `<i class="fa fa-warning"></i> ` + contenuto;
|
||||||
|
elemento.addClass("text-success").removeClass("text-warning");
|
||||||
|
} else {
|
||||||
|
contenuto = `<i class="fa fa-check"></i> ` + contenuto;
|
||||||
|
elemento.removeClass("text-success").addClass("text-warning");
|
||||||
|
}
|
||||||
|
|
||||||
|
elemento.html("<br>" + contenuto);
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
@ -24,22 +24,20 @@ include_once __DIR__.'/../../core.php';
|
|||||||
include_once __DIR__.'/init.php';
|
include_once __DIR__.'/init.php';
|
||||||
|
|
||||||
$direzione = 'uscita';
|
$direzione = 'uscita';
|
||||||
$id_anagrafica = $anagrafica->id;
|
|
||||||
$id_riga = get('id_riga');
|
$id_riga = get('id_riga');
|
||||||
$qta = get('qta');
|
$qta = get('qta');
|
||||||
|
|
||||||
$id_documento = get('id_documento');
|
$id_documento = get('id_documento');
|
||||||
$tipo_documento = get('tipo_documento');
|
$tipo_documento = get('tipo_documento');
|
||||||
if (!empty($tipo_documento)) {
|
if ($tipo_documento == 'ordine') {
|
||||||
if ($tipo_documento == 'ordine') {
|
$documento = Ordine::find($id_documento);
|
||||||
$documento = Ordine::find($id_documento);
|
$righe_utilizzate = get('righe_ordini');
|
||||||
$righe_utilizzate = get('righe_ordini');
|
} else {
|
||||||
} else {
|
$documento = DDT::find($id_documento);
|
||||||
$documento = DDT::find($id_documento);
|
$righe_utilizzate = get('righe_ddt');
|
||||||
$righe_utilizzate = get('righe_ddt');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<table class="table table-striped table-hover table-condensed table-bordered">
|
<table class="table table-striped table-hover table-condensed table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Descrizione').'</th>
|
<th>'.tr('Descrizione').'</th>
|
||||||
@ -49,140 +47,55 @@ if (!empty($tipo_documento)) {
|
|||||||
|
|
||||||
<tbody>';
|
<tbody>';
|
||||||
|
|
||||||
$id_riferimento = get('id_riferimento');
|
$id_riferimento = get('id_riferimento');
|
||||||
$righe = $documento->getRighe();
|
$righe = $documento->getRighe();
|
||||||
foreach ($righe as $riga) {
|
foreach ($righe as $riga) {
|
||||||
$qta_rimanente = $riga->qta_rimanente - $righe_utilizzate[$riga->id];
|
$qta_rimanente = $riga->qta_rimanente - $righe_utilizzate[$riga->id];
|
||||||
|
|
||||||
echo '
|
$dettagli = [
|
||||||
<tr '.($id_riferimento == $riga->id ? 'class="success"' : '').'>
|
'tipo' => get_class($riga),
|
||||||
|
'id' => $riga->id,
|
||||||
|
'qta' => $riga->qta,
|
||||||
|
'prezzo_unitario' => $riga->prezzo_unitario,
|
||||||
|
'id_iva' => $riga->id_iva,
|
||||||
|
'iva_percentuale' => $riga->aliquota->percentuale,
|
||||||
|
];
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<tr '.($id_riferimento == $riga->id ? 'class="success"' : '').' data-dettagli='.json_encode($dettagli).'>
|
||||||
<td>'.$riga->descrizione.'</td>
|
<td>'.$riga->descrizione.'</td>
|
||||||
<td>'.numberFormat($qta_rimanente, 'qta').' / '.numberFormat($riga->qta, 'qta').'</td>
|
<td>'.numberFormat($qta_rimanente, 'qta').' / '.numberFormat($riga->qta, 'qta').'</td>
|
||||||
<td class="text-center">';
|
<td class="text-center">';
|
||||||
|
|
||||||
if ($qta_rimanente >= $qta) {
|
if ($qta_rimanente >= $qta) {
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-info btn-xs" onclick="selezionaRiga(this, \''.$tipo_documento.'\',\''.$id_documento.'\', \''.addslashes(get_class($riga)).'\', \''.$riga->id.'\', \'Rif. '.$tipo_documento.' num. '.$documento->numero.'\')">
|
<button type="button" class="btn btn-info btn-xs" onclick="selezionaRiga(this)">
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
</button>';
|
</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</tbody>
|
|
||||||
</table>';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="row">
|
</tbody>
|
||||||
<div class="col-md-6">
|
</table>
|
||||||
{[ "type": "select", "label": "'.tr('Ordine').'", "name": "id_ordine", "values": "query=SELECT or_ordini.id, CONCAT(\'Ordine num. \', IF(numero_esterno != \'\', numero_esterno, numero), \' del \', DATE_FORMAT(data, \'%d-%m-%Y\'), \' [\', (SELECT descrizione FROM or_statiordine WHERE id = idstatoordine) , \']\') AS descrizione FROM or_ordini WHERE idanagrafica = '.prepare($id_anagrafica).' AND idstatoordine IN (SELECT id FROM or_statiordine WHERE descrizione IN(\'Bozza\', \'Accettato\', \'Parzialmente evaso\')) AND idtipoordine IN (SELECT id FROM or_tipiordine WHERE dir='.prepare($direzione).') ORDER BY data DESC, numero DESC", "value": "" ]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{[ "type": "select", "label": "'.tr('Ddt').'", "name": "id_ddt", "values": "query=SELECT dt_ddt.id, CONCAT(\'DDT num. \', IF(numero_esterno != \'\', numero_esterno, numero), \' del \', DATE_FORMAT(data, \'%d-%m-%Y\'), \' [\', (SELECT descrizione FROM dt_statiddt WHERE id = idstatoddt) , \']\') AS descrizione FROM dt_ddt WHERE idanagrafica = '.prepare($id_anagrafica).' AND idstatoddt IN (SELECT id FROM dt_statiddt WHERE descrizione IN(\'Bozza\', \'Parzialmente evaso\')) AND idtipoddt IN (SELECT id FROM dt_tipiddt WHERE dir='.prepare($direzione).') ORDER BY data DESC, numero DESC" ]}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="righe_documento">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="alert alert-info" id="box-loading">
|
|
||||||
<i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'...
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
$file = basename(__FILE__);
|
|
||||||
echo '
|
|
||||||
<script>$(document).ready(init)</script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var content = $("#righe_documento");
|
var documento_importazione = {
|
||||||
var loader = $("#box-loading");
|
tipo: "'.$tipo_documento.'",
|
||||||
|
id: "'.$id_documento.'",
|
||||||
|
descrizione: "'.$documento->getReference().'",
|
||||||
|
};
|
||||||
|
|
||||||
var id_riga_riferimento = "'.get('id_riga_riferimento').'";
|
function selezionaRiga(button) {
|
||||||
|
let riga = $(button).closest("tr");
|
||||||
|
|
||||||
$(document).ready(function(){
|
let dettagli_riga = riga.data("dettagli");
|
||||||
loader.hide();';
|
impostaRiferimento("'.$id_riga.'", documento_importazione, dettagli_riga);
|
||||||
|
|
||||||
$tipo_riferimento = get('tipo_riferimento');
|
$(button).closest(".modal").modal("hide");
|
||||||
if (!empty($tipo_riferimento)) {
|
|
||||||
echo '
|
|
||||||
$("#id_'.$tipo_riferimento.'").val('.$id_documento.').trigger("change");';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#id_ddt").on("change", function(){
|
|
||||||
var value = $(this).val();
|
|
||||||
if (value) {
|
|
||||||
caricaRighe("ddt", value);
|
|
||||||
$("#id_ordine").selectClear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#id_ordine").on("change", function(){
|
|
||||||
var value = $(this).val();
|
|
||||||
if (value) {
|
|
||||||
caricaRighe("ordine", value);
|
|
||||||
$("#id_ddt").selectClear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function caricaRighe(tipo_documento, id_documento){
|
|
||||||
loader.show();
|
|
||||||
|
|
||||||
var righe_ordini = {};
|
|
||||||
var righe_ddt = {};
|
|
||||||
$("[id^=tipo_riferimento_]").each(function(index, item) {
|
|
||||||
var tipo = $(item).val();
|
|
||||||
var c = $(item).closest("tr");
|
|
||||||
|
|
||||||
var qta = parseFloat(c.find("[id^=qta_riferimento_]").val());
|
|
||||||
var id_riga = c.find("[id^=id_riga_riferimento_]").val();
|
|
||||||
if (tipo == "ordine") {
|
|
||||||
righe_ordini[id_riga] = righe_ordini[id_riga] ? righe_ordini[id_riga] : 0;
|
|
||||||
righe_ordini[id_riga] += qta;
|
|
||||||
} else if (tipo == "ddt") {
|
|
||||||
righe_ddt[id_riga] = righe_ddt[id_riga] ? righe_ddt[id_riga] : 0;
|
|
||||||
righe_ddt[id_riga] += qta;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
content.html("");
|
|
||||||
$.ajax({
|
|
||||||
url: "'.$structure->fileurl($file).'",
|
|
||||||
cache: false,
|
|
||||||
type: "GET",
|
|
||||||
data: {
|
|
||||||
id_module: '.$id_module.',
|
|
||||||
id_record: '.$id_record.',
|
|
||||||
qta: '.$qta.',
|
|
||||||
id_riferimento: id_riga_riferimento,
|
|
||||||
id_documento: id_documento,
|
|
||||||
tipo_documento: tipo_documento,
|
|
||||||
righe_ddt: righe_ddt,
|
|
||||||
righe_ordini: righe_ordini,
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
loader.hide();
|
|
||||||
|
|
||||||
content.html(data)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
id_riga_riferimento = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function selezionaRiga(btn, tipo_documento, id_documento, tipo_riga_riferimento, id_riga_riferimento, testo) {
|
|
||||||
impostaRiferimento("'.$id_riga.'", tipo_documento, id_documento, tipo_riga_riferimento, id_riga_riferimento, testo);
|
|
||||||
|
|
||||||
$(btn).closest(".modal").modal("hide");
|
|
||||||
}
|
|
||||||
</script>';
|
</script>';
|
||||||
|
@ -138,7 +138,6 @@ class Interventi extends AppResource
|
|||||||
codice,
|
codice,
|
||||||
richiesta,
|
richiesta,
|
||||||
data_richiesta,
|
data_richiesta,
|
||||||
(SELECT MIN(`orario_inizio`) FROM `in_interventi_tecnici` WHERE `in_interventi_tecnici`.`idintervento` = `in_interventi`.`id`) AS `data`,
|
|
||||||
descrizione,
|
descrizione,
|
||||||
idanagrafica AS id_cliente,
|
idanagrafica AS id_cliente,
|
||||||
id_contratto,
|
id_contratto,
|
||||||
|
@ -185,6 +185,10 @@ class HTMLWrapper implements WrapperInterface
|
|||||||
$values['icon-custom'] = 'no-padding';
|
$values['icon-custom'] = 'no-padding';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (str_contains($string, '<button')) {
|
||||||
|
$values['icon-custom'] = 'no-padding';
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user