[Inventario]
- Adesso viene salvata corretamente i decimali della quantità - Pulizia codice e modifiche minori
This commit is contained in:
@@ -129,6 +129,7 @@ class Inventario {
|
||||
|
||||
public static function save($data) {
|
||||
$Ret = new Ret;
|
||||
|
||||
if (count($data["rows"]) > 0) {
|
||||
$MtbInvent = new EntityItem("mtb_invent");
|
||||
$MtbInvent->update()
|
||||
@@ -137,7 +138,7 @@ class Inventario {
|
||||
|
||||
foreach ($data["rows"] as $row) {
|
||||
$idRiga = $row["id_riga"];
|
||||
$qtaInv = (int)$row["qta_inv"];
|
||||
$qtaInv = (float)$row["qta_inv"];
|
||||
|
||||
$MtbInvenr = new \EntityItem("mtb_invenr");
|
||||
$MtbInvenr->set("idRiga", $idRiga);
|
||||
@@ -153,7 +154,7 @@ class Inventario {
|
||||
} else {
|
||||
$Ret->set_error("Nessuna riga ricevuta");
|
||||
}
|
||||
return $Ret->set_data(null);
|
||||
}
|
||||
|
||||
return $Ret->set_data();
|
||||
}
|
||||
}
|
||||
@@ -18,65 +18,62 @@ if ($Ret->is_OK()) {
|
||||
<table id="p_invenr" class="table table-striped table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Articolo</th><?
|
||||
<th>Articolo</th>
|
||||
<?php
|
||||
if ($flag_tagCol) {
|
||||
?>
|
||||
<th>Taglia</th>
|
||||
<th>Colore</th><?
|
||||
} ?>
|
||||
<th>Colore</th>
|
||||
<?php } ?>
|
||||
<th>U.M.</th>
|
||||
<th>Q.tà<br/>Invent.</th>
|
||||
<th>
|
||||
<select id="id_disp" class="form-control font-weight-normal input-xs">
|
||||
<option value="">TUTTI I DISP.</option><?
|
||||
foreach ($arr_disp as $disp) {
|
||||
?>
|
||||
<option value="<?= $disp ?>"><?= $disp ?></option><?
|
||||
} ?>
|
||||
<option value="">TUTTI I DISP.</option>
|
||||
<?php foreach ($arr_disp as $disp) { ?>
|
||||
<option value="<?= $disp ?>"><?= $disp ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</th>
|
||||
<th>Data Creazione</th>
|
||||
<th>
|
||||
<select id="zona" class="form-control font-weight-normal input-xs">
|
||||
<option value="">TUTTE LE ZONE</option><?
|
||||
foreach ($arr_zone as $zona) {
|
||||
?>
|
||||
<option value="<?= $zona ?>"><?= $zona ?></option><?
|
||||
} ?>
|
||||
<option value="">TUTTE LE ZONE</option>
|
||||
<?php foreach ($arr_zone as $zona) { ?>
|
||||
<option value="<?= $zona ?>"><?= $zona ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?
|
||||
foreach ($arr_rows as $row) {
|
||||
?>
|
||||
<tr data-id_riga="<?= $row["id_riga"] ?>" data-id_disp="<?= $row["id_disp"] ?>"
|
||||
data-zona="<?= $row["zona"] ?>">
|
||||
<td><?= $row["cod_mart"] ?><br/><small class="text-muted"><?= $row["descrizione"] ?></small></td>
|
||||
<?
|
||||
if ($flag_tagCol) {
|
||||
?>
|
||||
<td class="text-center"><?= $row["cod_tagl"] ?></td>
|
||||
<td class="text-center"><?= $row["cod_col"] ?></td><?
|
||||
} ?>
|
||||
<td class="text-center"><?= $row["unt_mis"] ?></td>
|
||||
<td><input lang="en" type="number" class="form-control input-xs p_qtaInv"
|
||||
value="<?= $row["qta_inv"] ?>" step="any" min="-1"/></td>
|
||||
<td class="text-center"><?= $row["id_disp"] ?></td>
|
||||
<td class="text-center"><?= !is_null($row["data_ora_inv"]) ? strftime("%d/%m/%Y", $row["data_ora_inv"]) . "<br/><small class='text-muted'>" . strftime("%H:%M:%S", $row["data_ora_inv"]) . "</small>" : "" ?></td>
|
||||
<td class="text-center"><?= $row["zona"] ?></td>
|
||||
<td>
|
||||
<button class="delete_row btn btn-sm btn-default">
|
||||
<i class="fas fa-trash text-danger"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr><?
|
||||
} ?>
|
||||
<tbody>
|
||||
<?php foreach ($arr_rows as $row) { ?>
|
||||
<tr data-id_riga="<?= $row["id_riga"] ?>" data-id_disp="<?= $row["id_disp"] ?>"
|
||||
data-zona="<?= $row["zona"] ?>">
|
||||
<td><?= $row["cod_mart"] ?><br/><small class="text-muted"><?= $row["descrizione"] ?></small>
|
||||
</td>
|
||||
<?php if ($flag_tagCol) { ?>
|
||||
<td class="text-center"><?= $row["cod_tagl"] ?></td>
|
||||
<td class="text-center"><?= $row["cod_col"] ?></td>
|
||||
<?php } ?>
|
||||
<td class="text-center"><?= $row["unt_mis"] ?></td>
|
||||
<td><input lang="en" type="number" class="form-control input-xs p_qtaInv"
|
||||
value="<?= $row["qta_inv"] ?>" step="any" min="-1"/></td>
|
||||
<td class="text-center"><?= $row["id_disp"] ?></td>
|
||||
<td class="text-center"><?= !is_null($row["data_ora_inv"]) ? strftime("%d/%m/%Y", $row["data_ora_inv"]) . "<br/><small class='text-muted'>" . strftime("%H:%M:%S", $row["data_ora_inv"]) . "</small>" : "" ?></td>
|
||||
<td class="text-center"><?= $row["zona"] ?></td>
|
||||
<td>
|
||||
<button class="delete_row btn btn-sm btn-default">
|
||||
<i class="fas fa-trash text-danger"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><?
|
||||
</div><?php
|
||||
$html = Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
$Ret->set_string($html);
|
||||
|
||||
|
||||
@@ -156,19 +156,20 @@ var _inventario = {
|
||||
},
|
||||
|
||||
save: function (idInventario) {
|
||||
var self = this;
|
||||
var d = $.Deferred();
|
||||
var arr_rows = [];
|
||||
var $arr_tr = $("#p_invenr").find("tbody > tr");
|
||||
const self = this;
|
||||
const d = $.Deferred();
|
||||
const arr_rows = [];
|
||||
const $arr_tr = $("#p_invenr").find("tbody > tr");
|
||||
|
||||
$arr_tr.each(function () {
|
||||
var $tr = $(this);
|
||||
const $tr = $(this);
|
||||
arr_rows.push({
|
||||
id_riga: $tr.getDataAttr("id_riga"),
|
||||
qta_inv: $tr.find(".p_qtaInv").getNumericValue()
|
||||
});
|
||||
});
|
||||
|
||||
var ajax = new Ajax();
|
||||
const ajax = new Ajax();
|
||||
ajax.post("save")
|
||||
.data({id_inventario: idInventario, rows: arr_rows})
|
||||
.noticeAsModal()
|
||||
|
||||
Reference in New Issue
Block a user