[Catalogo Moda]

- Fix: i prezzi risultano tutti a zero
- Pulizia codice
This commit is contained in:
2023-08-01 10:11:03 +02:00
parent 667b29bb2f
commit fdd4dcd84f
3 changed files with 73 additions and 68 deletions

View File

@@ -884,7 +884,9 @@ class CatalogoModa {
$ret = $query->toRet()->firstRow()->execute();
if ($ret->is_OK()) {
$retData = $ret->get_data();
if ($ret->is_OK() && count($retData) > 0) {
return $ret;
}
}
@@ -893,7 +895,7 @@ class CatalogoModa {
->importSqlFile("listino-clie")
->setVar("cod_anag", User::get_current_userCode());
return $query->toRet()->firstRowFirstValue()->execute();
return $query->toRet()->firstRow()->execute();
}
private static function getDataClie() {
@@ -909,7 +911,7 @@ class CatalogoModa {
$Query = new Query();
$listino = null;
if (User::get_current_group() !== 3) {
if (!User::is_cliente()) {
$Query
->importSqlFile("listino-agente")
->setVar("cod_vage", User::getCodVage())
@@ -936,6 +938,7 @@ class CatalogoModa {
if ($Ret->is_OK()) {
$listinoClie = $Ret->get_data();
$listino = $listinoClie["cod_vlis"];
$Query->importSqlFile("prezzo-articolo")
->setVar("cod_style", $data["cod_style"])

View File

@@ -2,77 +2,76 @@
<table class="table">
<thead>
<tr>
<td colspan="2" class="text-right font-weight-bold">&nbsp;</td><?php
foreach ($arr_tagCol["tag"] as $dt_tagl) {
?>
<td class="text-center"><?= $dt_tagl["cod_tagl"] ?></td><?php
} ?>
<td colspan="2" class="text-right font-weight-bold">&nbsp;</td>
<?php foreach ($arr_tagCol["tag"] as $dt_tagl) { ?>
<td class="text-center"><?= $dt_tagl["cod_tagl"] ?></td>
<?php } ?>
<td class="font-weight-bold">
<?= __("TOT") ?>
</td>
<td>&nbsp;</td>
<!-- <td class="text-center"><span class="small text-uppercase">Assortimento</span></td>-->
</tr><?php
if ($flag_viewRowPrices) {
?>
</tr>
<?php if ($flag_viewRowPrices) { ?>
<tr>
<td colspan="2" class="text-right font-weight-bold">
<?= __("Prezzi") ?>
<?php if (array_key_exists("listino", $data) && User::get_current_group() == User::AGENTE) { ?>
<div class="font-weight-normal hidden" style="margin-top: -16px;">
Listino <?= $data["listino"] ?>
</div>
<td colspan="2" class="text-right font-weight-bold">
<?= __("Prezzi") ?>
<?php if (array_key_exists("listino", $data) && User::get_current_group() == User::AGENTE) { ?>
<div class="font-weight-normal hidden" style="margin-top: -16px;">
Listino <?= $data["listino"] ?>
</div>
<?php } ?>
</td>
<?php foreach ($arr_tagCol["tag"] as $dt_tagl) { ?>
<td data-codTagl_price="<?= $dt_tagl["cod_tagl"] ?>" class="text-center text-monospace"></td>
<?php } ?>
</td><?php
foreach ($arr_tagCol["tag"] as $dt_tagl) {
?>
<td data-codTagl_price="<?= $dt_tagl["cod_tagl"] ?>" class="text-center text-monospace"></td><?php
} ?>
<td colspan="2">&nbsp;</td>
</tr><?php
} ?>
<td colspan="2">&nbsp;</td>
</tr>
<?php } ?>
</thead>
<tbody><?php
<tbody>
<?php
$repoCcImages = UtilityTextiles::getRepoImagesRoot() . "colorchart/";
foreach ($arr_tagCol["col"] as $dt_col) {
?>
<tr data-cod_col="<?= $dt_col["cod_col"] ?>" data-cod_asso="">
<td class="text-truncate text-left font-weight-bold"><?= $dt_col["cod_col"] ?> <span
class="text-muted small <?= $dt_col["descr_col"] == $dt_col["cod_col"] ? "hidden" : "" ?>"><?= $dt_col["descr_col"] ?></span>
</td>
<td class="vertical-middle">
<div class="color_chart">
<img data-url="<?= $repoCcImages . (isset($codStyle) ? $codStyle : null) . "-" . $dt_col["cod_col"] . ".jpg" ?>"
class="img-responsive img-rounded hidden" alt=""/>
</div>
</td><?php
$sumQtaCol = 0;
foreach ($arr_tagCol["tag"] as $dt_tagl) {
?>
<td class="vertical-middle text-center">
<input type="number" data-cod_tagl="<?= $dt_tagl["cod_tagl"] ?>" value=""
class="form-control input-sm text-monospace text-unselectable" readonly max=""/>
</td><?php
} ?>
<td class="sum_qta_col text-right text-monospace <?= $sumQtaCol > 0 ? "notZero" : "" ?>"><?= $sumQtaCol ?></td>
<td class="text-center">
<div class="input-group">
<div class="input-group-btn">
<button class="btn btn-sm btn-default ope trow" type="button">
<i class="fa fa-plus"></i>
<i class="fa fa-minus" style="display: none;"></i>
<i class="fa fa-copy" style="display: none;"></i>
<i class="fa fa-paste" style="display: none;"></i>
<i class="fa fa-pencil" style="display: none;"></i>
</button>
<tr data-cod_col="<?= $dt_col["cod_col"] ?>" data-cod_asso="">
<td class="text-truncate text-left font-weight-bold"><?= $dt_col["cod_col"] ?> <span
class="text-muted small <?= $dt_col["descr_col"] == $dt_col["cod_col"] ? "hidden" : "" ?>"><?= $dt_col["descr_col"] ?></span>
</td>
<td class="vertical-middle">
<div class="color_chart">
<img data-url="<?= $repoCcImages . (isset($codStyle) ? $codStyle : null) . "-" . $dt_col["cod_col"] . ".jpg" ?>"
class="img-responsive img-rounded hidden" alt=""/>
</div>
<select class="cod_asso" autocomplete="off" title="<?= __("Assortimento") ?>">
<option value="">Assortimento</option>
</select>
</div>
</td>
</tr><?php
} ?>
</td>
<?php
$sumQtaCol = 0;
foreach ($arr_tagCol["tag"] as $dt_tagl) {
?>
<td class="vertical-middle text-center">
<input type="number" data-cod_tagl="<?= $dt_tagl["cod_tagl"] ?>" value=""
class="form-control input-sm text-monospace text-unselectable" readonly max=""/>
</td>
<?php } ?>
<td class="sum_qta_col text-right text-monospace <?= $sumQtaCol > 0 ? "notZero" : "" ?>"><?= $sumQtaCol ?></td>
<td class="text-center">
<div class="input-group">
<div class="input-group-btn">
<button class="btn btn-sm btn-default ope trow" type="button">
<i class="fa fa-plus"></i>
<i class="fa fa-minus" style="display: none;"></i>
<i class="fa fa-copy" style="display: none;"></i>
<i class="fa fa-paste" style="display: none;"></i>
<i class="fa fa-pencil" style="display: none;"></i>
</button>
</div>
<select class="cod_asso" autocomplete="off" title="<?= __("Assortimento") ?>">
<option value="">Assortimento</option>
</select>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@@ -1049,18 +1049,21 @@ ModalArtTagCol.prototype._getPriceCells = function () {
};
ModalArtTagCol.prototype._setRowPrices = function () {
var self = this;
const self = this;
if (!is_null(self._arrPrices)) {
var arr_prices = self._arrPrices;
var $arr_cellPrice = self._getPriceCells();
const arr_prices = self._arrPrices;
const $arr_cellPrice = self._getPriceCells();
$.each($arr_cellPrice, function () {
var $cell = $(this);
var codTagl = $cell.getDataAttr("codTagl_price");
var price = Enumerable.From(arr_prices)
const $cell = $(this);
const codTagl = $cell.getDataAttr("codTagl_price");
const price = Enumerable.From(arr_prices)
.Where(function (x) {
return x.cod_tagl === codTagl;
})
.Select(function (x) {
console.log(x.price);
if (x.perc_sco1 > 0 || x.perc_sco2 > 0) {
return `<s>&euro;${x.price.toFixed(2)}</s> <strong class="text-danger">&euro;${((x.price * (100 - (x.perc_sco1 || 0)) / 100) * ((100 - (x.perc_sco2 || 0)) / 100)).toFixed(2)}</strong>`
} else {