Compare commits
12 Commits
Smetar_Pla
...
Smetar_Con
| Author | SHA1 | Date | |
|---|---|---|---|
| 87eefef1d5 | |||
| 1052313be9 | |||
| 1afb08344b | |||
| 77f4faef93 | |||
| d66e025c52 | |||
| 605b6f3425 | |||
| 5c28604256 | |||
| c7ad79b030 | |||
| afc628f6c6 | |||
| 084efc777a | |||
| 02b23f7bc5 | |||
| a8a399e41f |
@@ -30,6 +30,7 @@ class MainHandler extends MainHandlerAzienda {
|
||||
return array(
|
||||
"semolaSecca" => self::getSemolaOrdine($order),
|
||||
"scartoFresco" => self::getScartoFresco($order),
|
||||
"semolaRAM" => self::getSemolaRAM($order["codProd"], $order["partitaMag"]),
|
||||
"qtaAcqua" => self::getQtaAcqua($order),
|
||||
"pastaProd" => self::getPastaProd($order),
|
||||
"pastaConf" => self::getPastaConf($order)
|
||||
@@ -112,6 +113,14 @@ GROUP BY ma.cod_mart, ma.unt_mis");
|
||||
return $query->toRet(false)->firstRow()->execute();
|
||||
}
|
||||
|
||||
private static function getSemolaRAM($codMart, $partitaMag) {
|
||||
$query = new \Query("SELECT val_carat FROM mtb_partita_mag_carat WHERE cod_mart = '[cod_mart]' AND partita_mag = '[partita_mag]' AND carat LIKE 'Quantit% semola (KG)'");
|
||||
$query->setVar("partita_mag", $partitaMag)
|
||||
->setVar("cod_mart", $codMart);
|
||||
$ret = $query->firstRowFirstValue()->toRet()->date2ts()->execute();
|
||||
return (float)if_null($ret->get_data(), 0);
|
||||
}
|
||||
|
||||
private static function getPastaConf($order) {
|
||||
$query = new \Query("SELECT ma.cod_mart , SUM(mr.qta_col) AS qta_col, ma.unt_mis
|
||||
FROM mtb_colt mt
|
||||
@@ -149,20 +158,10 @@ GROUP BY ma.cod_mart, ma.unt_mis");
|
||||
$checkSemola = $gestSetupDepo->keySection("FLAG_CHECK_SEMOLA_RAM")->cod_mdep($codMdep)->defaultValue('N')->asBoolean()->get();
|
||||
|
||||
if ($checkSemola) {
|
||||
$query = new \Query();
|
||||
|
||||
$cod_mart = $order["cod_prod"];
|
||||
$partita_mag = $order["partita_mag"];
|
||||
$carat = "Quantità semola (KG)";
|
||||
|
||||
$query->select("val_carat")
|
||||
->from("mtb_partita_mag_carat")
|
||||
->where("cod_mart", $cod_mart)
|
||||
->where("partita_mag", $partita_mag)
|
||||
->where("carat", $carat);
|
||||
|
||||
$ret = $query->firstRowFirstValue()->toRet()->execute();
|
||||
$semolaRAM = (int)if_null($ret->get_data(), 0);
|
||||
$semolaRAM = self::getSemolaRAM($cod_mart, $partita_mag);
|
||||
|
||||
if ($semolaRAM) {
|
||||
$percentdiff = 1.5;
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
use Utility\Date;
|
||||
|
||||
/**
|
||||
* @var array $datiOrdine
|
||||
*/
|
||||
|
||||
$retData = array();
|
||||
$key = array(
|
||||
"gestione" => $order["gestione"],
|
||||
@@ -11,7 +15,8 @@ $key = array(
|
||||
$Ret = MonitoraggioLineeV2::get_ordineLav($key);
|
||||
|
||||
$semolaSecca = 0;
|
||||
$semolaRam = null;
|
||||
|
||||
$semolaRam = array_get($datiOrdine, "semolaRAM", 0);
|
||||
|
||||
if (array_key_exists("semolaSecca", $datiOrdine) && !empty($datiOrdine["semolaSecca"])) {
|
||||
$semolaSecca = from($datiOrdine["semolaSecca"])->sum(function ($elem) {
|
||||
@@ -23,12 +28,12 @@ $key2 = array(
|
||||
"cod_mart" => $order["codProd"],
|
||||
"partita_mag" => $order["partitaMag"],
|
||||
);
|
||||
|
||||
/*
|
||||
$ret = MonitoraggioLineeV2::getSemolaRam($key2);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$semolaRam = $ret->get_data();
|
||||
}
|
||||
}*/
|
||||
|
||||
$semolaUntMis = array_key_exists("semolaSecca", $datiOrdine) && !empty($datiOrdine["semolaSecca"]) ? $datiOrdine["semolaSecca"][0]["unt_mis"] : "KG";
|
||||
$scartoFresco = array_key_exists("scartoFresco", $datiOrdine) && !empty($datiOrdine["scartoFresco"]) ? floatval(str_replace(',', '.', $datiOrdine["scartoFresco"]["val_carat"])) : 0;
|
||||
@@ -61,6 +66,9 @@ if ($Ret->is_OK()) {
|
||||
$ordineLav = $Ret->get_data();
|
||||
}
|
||||
|
||||
$gestSetupDepo = new GestSetupDepo;
|
||||
$checkSemola = $gestSetupDepo->keySection("FLAG_CHECK_SEMOLA_RAM")->cod_mdep($order["codMdep"])->defaultValue('N')->asBoolean()->get();
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
?>
|
||||
|
||||
@@ -128,17 +136,19 @@ if ($Ret->is_OK()) {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="semolaRam">Semola RAM</label></td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm mb-6">
|
||||
<input class="form-control text-monospace disabled text-dark text-left"
|
||||
type="number" value="<?= $semolaRam ?>" id="semolaRam" name="semolaRam"
|
||||
readonly>
|
||||
<span class="input-group-addon bg-white font-weight-bold text-dark"><?= $semolaUntMis ?></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($checkSemola) { ?>
|
||||
<tr>
|
||||
<td><label for="semolaRam">Semola RAM</label></td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm mb-6">
|
||||
<input class="form-control text-monospace disabled text-dark text-left"
|
||||
type="number" value="<?= $semolaRam ?>" id="semolaRam" name="semolaRam"
|
||||
readonly>
|
||||
<span class="input-group-addon bg-white font-weight-bold text-dark"><?= $semolaUntMis ?></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td><label for="qtaAcquaVersata">Qta Acqua (~33% semola)</label></td>
|
||||
<td>
|
||||
@@ -263,6 +273,8 @@ if ($Ret->is_OK()) {
|
||||
const confirmButton = $("#confirmButton");
|
||||
const semolaRam = _.toNumber("<?= $semolaRam ?>");
|
||||
|
||||
<?php if ($checkSemola) { ?>
|
||||
|
||||
if (semolaRam === "" || semolaRam <= 0) {
|
||||
$semolaRam.parents(".input-group").addClass("has-error");
|
||||
confirmButton.prop("disabled", true);
|
||||
@@ -270,6 +282,8 @@ if ($Ret->is_OK()) {
|
||||
$semolaRam.parents(".input-group").removeClass("has-error");
|
||||
confirmButton.prop("disabled", false);
|
||||
}
|
||||
|
||||
<?php } ?>
|
||||
});
|
||||
|
||||
$("[name=scartoFresco]").on("input change", function (e) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -126,7 +126,7 @@ function zeroIfNull($v) {
|
||||
}
|
||||
|
||||
function nullIfBlank($v) {
|
||||
return strlen(trim($v)) == 0 ? null : $v;
|
||||
return is_null($v) || strlen(trim($v)) == 0 ? null : $v;
|
||||
}
|
||||
|
||||
function blankIfNull($v) {
|
||||
|
||||
@@ -798,7 +798,7 @@ class ContattiCommesse {
|
||||
}
|
||||
|
||||
$Body->set("CRMAttivita", $Attivita->to_entityItem());
|
||||
// echo $Body;exit;
|
||||
|
||||
$IMSApi = new IMSApi;
|
||||
$Ret = $IMSApi->post("creaNuovoContattoCRM")->body($Body)->send();
|
||||
if ($Ret->is_OK()) {
|
||||
|
||||
@@ -105,8 +105,9 @@
|
||||
<option value="<?= $item["user_name"] ?>" <?= count($arr_utenti) == 1 ? "selected" : "" ?>><?= $item["full_name"] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<span class="input-group-addon cursor-pointer bt_viewWeekActivities" title="Vedi Attività Settimanali" data-toggle="tooltip" data-placement="top">
|
||||
<i class="fa fa-calendar-check-o text-success"></i>
|
||||
<span class="input-group-addon cursor-pointer bt_viewWeekActivities" title="Vedi Attività Settimanali"
|
||||
data-toggle="tooltip" data-placement="top">
|
||||
<i class="fa fa-calendar-check text-success"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +120,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-4" id="timePickers">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
@@ -174,7 +175,8 @@
|
||||
$arr_esiti = ContattiCommesse::get_esitiAttivita();
|
||||
foreach ($arr_esiti as $item) {
|
||||
?>
|
||||
<option value="<?= $item["activity_result_id"] ?>" data-flag_activity_result="<?= $item["flag_activity_result"] ?>"><?= $item["activity_result_id"] ?></option>
|
||||
<option value="<?= $item["activity_result_id"] ?>"
|
||||
data-flag_activity_result="<?= $item["flag_activity_result"] ?>"><?= $item["activity_result_id"] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@ if (!$flag_editOnly) {
|
||||
<button data-action="clie-esistente"
|
||||
class="col-xs-6 text-truncate radio_btn btn <?= isset($cliente) ? $classes_selected : $classes_unselected ?>"
|
||||
type="button">
|
||||
<i class="fa fa-address-card-o"></i> <span class="hidden-xs">Cliente già censito</span><span
|
||||
<i class="fa fa-address-card"></i> <span class="hidden-xs">Cliente già censito</span><span
|
||||
class="visible-xs-inline">Già censito</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<?
|
||||
if (!$flag_editOnly) {
|
||||
?>
|
||||
<?php if (!$flag_editOnly) { ?>
|
||||
<div class="row mt-10">
|
||||
<div class="col-sm-5">
|
||||
<label for="codVdes">Seleziona una destinazione</label>
|
||||
@@ -13,17 +11,17 @@ if (!$flag_editOnly) {
|
||||
<i class="fa fa-user-plus"></i> Nuova destinazione
|
||||
</button>
|
||||
<button data-action="dest-esistente" class="col-xs-4 radio_btn btn btn-default" type="button">
|
||||
<i class="fa fa-address-card-o"></i> Destinazione già censita
|
||||
<i class="fa fa-address-card"></i> Destinazione già censita
|
||||
</button>
|
||||
<button data-action="dest-no" class="col-xs-4 radio_btn btn btn-default" type="button">
|
||||
<i class="fa fa-ban"></i> Nessuna destinazione
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><?
|
||||
} else { ?>
|
||||
<input id="codVdes" type="hidden" value="<?= $commessa["cod_vdes"] ?>" /><?
|
||||
} ?>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<input id="codVdes" type="hidden" value="<?= $commessa["cod_vdes"] ?>"/>
|
||||
<?php } ?>
|
||||
<div id="form-destinazione" class="mt-20">
|
||||
<h4 class="text-primary">
|
||||
Destinazione
|
||||
@@ -40,14 +38,15 @@ if (!$flag_editOnly) {
|
||||
<div class="col-xs-12 col-sm-3 col-md-3 mt-8">
|
||||
<label>Zona</label>
|
||||
<select name="cod_vzon" class="form-control" autocomplete="off">
|
||||
<option value=""></option><?
|
||||
<option value=""></option>
|
||||
<?php
|
||||
foreach ($arr_zone as $item) {
|
||||
$selected = isset($dest) ? $dest["cod_vzon"] == $item["cod_vzon"] : "";
|
||||
?>
|
||||
<option value="<?= $item["cod_vzon"] ?>" <?= $selected ? "selected" : "" ?>>
|
||||
<?= $item["descrizione"] ?>
|
||||
</option><?
|
||||
} ?>
|
||||
<option value="<?= $item["cod_vzon"] ?>" <?= $selected ? "selected" : "" ?>>
|
||||
<?= $item["descrizione"] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,14 +85,15 @@ if (!$flag_editOnly) {
|
||||
<div class="form-group">
|
||||
<label>Nazione</label>
|
||||
<select name="nazione" class="form-control">
|
||||
<option></option><?
|
||||
<option></option>
|
||||
<?php
|
||||
foreach ($arr_nazioni as $item) {
|
||||
$selected = isset($dest["nazione"]) ? $item["nazione"] == $dest["nazione"] : $item["nazione"] == "IT";
|
||||
?>
|
||||
<option value="<?= $item["nazione"] ?>" <?= $selected ? "selected" : "" ?>>
|
||||
<?= $item["descrizione"] ?>
|
||||
</option><?
|
||||
} ?>
|
||||
<option value="<?= $item["nazione"] ?>" <?= $selected ? "selected" : "" ?>>
|
||||
<?= $item["descrizione"] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
} ?>
|
||||
</select>
|
||||
<span id="bt_viewWeekActivities" class="input-group-addon cursor-pointer">
|
||||
<i class="fa fa-calendar-check-o text-success"></i>
|
||||
<i class="fa fa-calendar-check text-success"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,7 +175,7 @@
|
||||
<div class="col-xs-12">
|
||||
<div class="btn-group btn-group-lg pull-right">
|
||||
<button data-bt_back_to="commessa" class="btn btn-outline-default">
|
||||
<i class="fa fa-arrow-circle-o-up"></i> Indietro
|
||||
<i class="fa fa-arrow-circle-up"></i> Indietro
|
||||
</button>
|
||||
<button id="bt_confAttivita" class="btn btn-lg btn-primary">
|
||||
Salva <i class="fa fa-check-circle"></i>
|
||||
|
||||
@@ -62,7 +62,7 @@ if ($Ret->is_OK()) {
|
||||
<div class="col-xs-12">
|
||||
<div class="btn-group btn-group-lg pull-right">
|
||||
<button data-bt_back_to="cliente" class="btn btn-outline-default">
|
||||
<i class="fa fa-arrow-circle-o-up"></i> Indietro
|
||||
<i class="fa fa-arrow-circle-up"></i> Indietro
|
||||
</button>
|
||||
<button id="bt_confCommessa" class="btn btn-outline-primary ">
|
||||
Prosegui <i class="fa fa-arrow-circle-down"></i>
|
||||
|
||||
@@ -3,6 +3,7 @@ $().ready(function () {
|
||||
});
|
||||
|
||||
var _formDest = {
|
||||
newDest: true,
|
||||
init: function () {
|
||||
var self = this;
|
||||
$(".radio_btn[data-action='dest-nuovo'], .radio_btn[data-action='dest-esistente'], .radio_btn[data-action='dest-no']")
|
||||
@@ -27,12 +28,15 @@ var _formDest = {
|
||||
|
||||
toggle: function (action) {
|
||||
var $form = $("#form-destinazione");
|
||||
let self = this;
|
||||
$form.find("input, select").val("");
|
||||
|
||||
if (action == "dest-esistente") {
|
||||
if (action === "dest-esistente") {
|
||||
|
||||
} else if (action == "dest-nuovo") {
|
||||
} else if (action === "dest-nuovo") {
|
||||
self.newDest = true;
|
||||
$("#codVdes").selectpicker("val", "");
|
||||
|
||||
$form.find("input, select").readonly(false);
|
||||
$form.find("select").disabled(false);
|
||||
$form.find("select[name='nazione']").val("IT");
|
||||
@@ -42,12 +46,13 @@ var _formDest = {
|
||||
$form.find("input[name='rag_soc']").val(ragSoc);
|
||||
$form.find("input[name='indirizzo']").focus();
|
||||
}
|
||||
|
||||
} else if (action == "dest-no") {
|
||||
$("#codVdes").selectpicker("val", "");
|
||||
} else if (action === "dest-no") {
|
||||
self.newDest = false;
|
||||
$("#codVdes").selectpicker("val", null);
|
||||
$form.find("input, select").readonly();
|
||||
$form.find("select").disabled();
|
||||
}
|
||||
|
||||
$form.find("select[name='cod_vzon']").selectpicker("refresh");
|
||||
},
|
||||
|
||||
@@ -62,9 +67,9 @@ var _formDest = {
|
||||
|
||||
fill: function () {
|
||||
var self = this;
|
||||
|
||||
var $form = $("#form-destinazione");
|
||||
var codVdes = $("#codVdes").getValue();
|
||||
|
||||
if (codVdes != null) {
|
||||
$form.find("input").val("");
|
||||
$form.find("input, select").readonly(false);
|
||||
@@ -92,8 +97,8 @@ var _formDest = {
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (codVdes == null) {
|
||||
if ($(".radio_btn[data-action='dest-no']").hasClass("disabled")) {
|
||||
} else {
|
||||
if ($(".radio_btn[data-action='dest-no']").hasClass("disabled") && !self.newDest) {
|
||||
$(".radio_btn[data-action='dest-no']").trigger("click");
|
||||
}
|
||||
}
|
||||
@@ -126,10 +131,10 @@ var _formDest = {
|
||||
|
||||
// PRIMO DESTINATARIO AS DEFAULT
|
||||
//$destinazioni.val(arr_destinazioni[0].cod_vdes).trigger("change");
|
||||
|
||||
} else {
|
||||
$rowControlsListDest.hide();
|
||||
}
|
||||
|
||||
$destinazioni.selectpicker("refresh");
|
||||
},
|
||||
|
||||
|
||||
@@ -469,7 +469,6 @@ var _contattiCommesse = {
|
||||
|
||||
convalida_attivita: function (flag_createOrder) {
|
||||
var self = this;
|
||||
var ret = {returnId: 1};
|
||||
var modalBox = new ModalBox();
|
||||
|
||||
var $userName = $("select[name='user_name']");
|
||||
@@ -486,33 +485,33 @@ var _contattiCommesse = {
|
||||
}
|
||||
|
||||
var cliente = null, destinazione = null, persRif = null;
|
||||
var ret = self.check_formClie();
|
||||
if (ret.returnId == 1) {
|
||||
let ret = self.check_formClie();
|
||||
if (ret.returnId === 1) {
|
||||
cliente = ret.returnData;
|
||||
|
||||
if ($("button[data-action='dest-no']").hasClass("disabled")) {
|
||||
var ret = self.formDest.check();
|
||||
if (ret.returnId == 1) {
|
||||
ret = self.formDest.check();
|
||||
if (ret.returnId === 1) {
|
||||
destinazione = ret.returnData;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
ret = self.check_formPersRif();
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
persRif = ret.returnData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
if (_checkForm.checkData($("#panel-attivita > .panel-body"), true, true, true) === false) {
|
||||
ret = {returnId: -1, errorText: "Verificare che siano stati compilati tutti i campi richiesti"};
|
||||
}
|
||||
}
|
||||
|
||||
var attivita_estimatedTime = null, attivita_estimatedEndtime = null;
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
attivita_estimatedTime = self._dia.get_estimatedTime();
|
||||
if (is_null(attivita_estimatedTime)) {
|
||||
ret = {returnId: -1, errorText: "Ora inizio pianificazione non valida"};
|
||||
@@ -531,7 +530,7 @@ var _contattiCommesse = {
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
var attivita_effectiveTime = null, attivita_effectiveEndtime = null;
|
||||
var $activityResultId = $("select[name='attivita-activity_result_id']");
|
||||
var activityResultId = $activityResultId.getValue();
|
||||
@@ -556,7 +555,7 @@ var _contattiCommesse = {
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.returnId == 1) {
|
||||
if (ret.returnId === 1) {
|
||||
var codJflav = !is_null(userName) ? $userName.optionSelected().attr("data-cod_jflav") : null;
|
||||
|
||||
var data = {
|
||||
|
||||
@@ -267,6 +267,10 @@ function PopupReport() {
|
||||
id: "Cestini George Roth",
|
||||
text: "Cestini George Roth"
|
||||
},
|
||||
{
|
||||
id: "George Roth",
|
||||
text: "George Roth"
|
||||
},
|
||||
{
|
||||
id: "Cestini Spar",
|
||||
text: "Cestini Spar"
|
||||
|
||||
@@ -778,21 +778,6 @@ class MonitoraggioLineeV2 {
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function getSemolaRam($key) {
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("getSemolaRam")
|
||||
->setVar("cod_mart", $key["cod_mart"])
|
||||
->setVar("partita_mag", $key["partita_mag"]);
|
||||
|
||||
$Ret = $Query->firstRowFirstValue()->toRet()->execute();
|
||||
|
||||
if ($Ret->is_KO()) {
|
||||
$Ret->set_error("Ordine non valido");
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function save_udc($data) {
|
||||
$order = $data;
|
||||
$handler = OrderEventHandler::loadCustomHandler($order);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
SELECT val_carat
|
||||
FROM mtb_partita_mag_carat
|
||||
WHERE cod_mart = '[cod_mart]'
|
||||
AND partita_mag = '[partita_mag]'
|
||||
AND carat = N'Quantità semola (KG)'
|
||||
@@ -43,7 +43,7 @@ class Mrp {
|
||||
$codMgrp = implode("','", explode(";", $codMgrpStr));
|
||||
$codMdepStr = array_key_exists("cod_mdep", $data) ? ($data["cod_mdep"] ? implode("", $data["cod_mdep"]) : "") : "";
|
||||
$codMdep = array_key_exists("cod_mdep", $data) ? ($data["cod_mdep"] ? implode("','", $data["cod_mdep"]) : "") : "";
|
||||
$dataCons = isset($data["data_cons"]) ? $data["data_cons"] : null;
|
||||
$dataCons = isset($data["data_cons"]) && $data["data_cons"] !== "" ? $data["data_cons"] : null;
|
||||
$codAnag = isset($data["cod_anag"]) && is_array($data["cod_anag"]) ? implode("','", $data["cod_anag"]) : "";
|
||||
|
||||
$ret = self::getClientiGruppo($codMgrp, $whereCond);
|
||||
@@ -54,8 +54,8 @@ class Mrp {
|
||||
|
||||
$clienti = $ret->get_data();
|
||||
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("list-produzioniGruppo")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("list-produzioniGruppo")
|
||||
->setVar("cod_mgrp", $codMgrp)
|
||||
->setVar("str-cod_mgrp", $codMgrpStr)
|
||||
->setVar("cod_mdep", $codMdep)
|
||||
@@ -64,9 +64,9 @@ class Mrp {
|
||||
->setVar("dataCons", $dataCons)
|
||||
->setVar("str-codAnag", empty($codAnag) ? "" : "S")
|
||||
->setVar("codAnag", $codAnag);
|
||||
$Query->setVar("whereCond", $whereCond ?: "1=1");
|
||||
$query->setVar("whereCond", $whereCond ?: "1=1");
|
||||
|
||||
$ret = $Query->toRet()->execute();
|
||||
$ret = $query->toRet()->execute();
|
||||
|
||||
if ($ret->is_KO()) {
|
||||
return $ret;
|
||||
@@ -90,8 +90,8 @@ class Mrp {
|
||||
$codMdepStr = "";
|
||||
}
|
||||
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("list-produzioniGruppo")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("list-produzioniGruppo")
|
||||
->setVar("cod_mart", $codMart)
|
||||
->setVar("cod_mgrp", "")
|
||||
->setVar("str-cod_mgrp", "")
|
||||
@@ -102,41 +102,41 @@ class Mrp {
|
||||
->setVar("codAnag", null)
|
||||
->setVar("whereCond", "1=1");
|
||||
|
||||
return $Query->toRet()->execute();
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
private static function getListGruppi() {
|
||||
$GestSetupUser = new GestSetupWebUser;
|
||||
$wherecond = $GestSetupUser->keySection("WHERECOND_ARTICOLI")->asString()->get();
|
||||
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("list-gruppi");
|
||||
$query = new Query;
|
||||
$query->importSqlFile("list-gruppi");
|
||||
if (!is_null($wherecond) && !empty($wherecond)) {
|
||||
$Query->where($wherecond);
|
||||
$query->where($wherecond);
|
||||
}
|
||||
|
||||
return $Query->toRet()->execute();
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getAnagraficaProdotto($codMart) {
|
||||
$Query = new Query;
|
||||
return $Query->importSqlFile("anagProdotto")->setVar("cod_mart", $codMart)->toRet()->firstRow()->execute();
|
||||
$query = new Query;
|
||||
return $query->importSqlFile("anagProdotto")->setVar("cod_mart", $codMart)->toRet()->firstRow()->execute();
|
||||
}
|
||||
|
||||
public static function getFabbisognoProdotto($codMart, $codMdep) {
|
||||
$codMdep = implode("','", $codMdep);
|
||||
$Query = new Query;
|
||||
$query = new Query;
|
||||
|
||||
$Query->importSqlFile("list-matFabGiornProdotto")
|
||||
$query->importSqlFile("list-matFabGiornProdotto")
|
||||
->setVar("cod_mart", $codMart)
|
||||
->setVar("cod_mdep", $codMdep);
|
||||
|
||||
return $Query->toRet()->execute();
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function countListiniAcqProdotto($codMart) {
|
||||
$Query = new Query;
|
||||
return $Query->select("cod_alis")->from("mtb_lisa")->where("cod_mart", $codMart)->toRet()->countRowsSql();
|
||||
$query = new Query;
|
||||
return $query->select("cod_alis")->from("mtb_lisa")->where("cod_mart", $codMart)->toRet()->countRowsSql();
|
||||
}
|
||||
|
||||
public static function getDepositoArrivo() {
|
||||
@@ -154,11 +154,11 @@ class Mrp {
|
||||
}
|
||||
|
||||
public static function getListiniFornitoreProdotto($codMart, $codAnag) {
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("list-listiniAcqProdotto")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("list-listiniAcqProdotto")
|
||||
->setVar("cod_mart", $codMart)
|
||||
->where("gtb_anag.cod_anag", $codAnag);
|
||||
$Ret = $Query->toRet()->execute();
|
||||
$Ret = $query->toRet()->execute();
|
||||
if ($Ret->is_OK() && count($Ret->get_data()) == 0) {
|
||||
$Ret->set_error("Il fornitore {$codAnag} non è valido");
|
||||
}
|
||||
@@ -166,8 +166,8 @@ class Mrp {
|
||||
}
|
||||
|
||||
public static function getListiniAcqProdotto($codMart) {
|
||||
$Query = new Query;
|
||||
return $Query->importSqlFile("list-listiniAcqProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
$query = new Query;
|
||||
return $query->importSqlFile("list-listiniAcqProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getListCentriDiLavoro($codMart = null) {
|
||||
@@ -221,20 +221,20 @@ class Mrp {
|
||||
$setup = new GestSetup();
|
||||
$limit = (int)$setup->keySection(strtoupper($codMgrp) . "_NUM_AVG_SAMPLES")->defaultValue($limit)->get();
|
||||
$limit = is_number($limit) && $limit > 0 ? $limit : null;
|
||||
$Query = new Query;
|
||||
$Query
|
||||
$query = new Query;
|
||||
$query
|
||||
->processSql()
|
||||
->importSqlFile("avgConsumi")
|
||||
->setVar("str-cod_mgrp", $codMgrp)
|
||||
->setVar("limit", $limit)
|
||||
->setVar("cod_mgrp", implode("','", explode(";", $codMgrp)))
|
||||
->toRet();
|
||||
return $Query->execute();
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
public static function suggestDataScad($data) {
|
||||
$Query = new Query;
|
||||
return $Query
|
||||
$query = new Query;
|
||||
return $query
|
||||
->importSqlFile("checkDataScadLotto")
|
||||
->setVar("partitaMag", $data["partitaMag"])
|
||||
->setVar("codMart", $data["codMart"])
|
||||
@@ -279,14 +279,14 @@ class Mrp {
|
||||
}
|
||||
|
||||
private static function getNumOrdProd($codAnag, $dataOrdRif, $codJfas) {
|
||||
$Query = new Query;
|
||||
$Query->select("num_ord")
|
||||
$query = new Query;
|
||||
$query->select("num_ord")
|
||||
->from("dtb_ordt")
|
||||
->where("gestione", "A")
|
||||
->where("cod_anag", $codAnag)
|
||||
->where("cod_jfas", is_array($codJfas) ? reset($codJfas) : $codJfas)
|
||||
->whereDate("data_ord", $dataOrdRif);
|
||||
return $Query->toRet()->firstRowFirstValue()->execute();
|
||||
return $query->toRet()->firstRowFirstValue()->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -624,13 +624,13 @@ class Mrp {
|
||||
$EntityList->push($OrdProd);
|
||||
/*
|
||||
foreach($arr_commesse as $codJcom){ // AGGIORNO LA PARTITA SULLE RIGHE DEGLI ORDINI AGGANCIATI ALLE COMMESSE SELEZIONATE
|
||||
$Query = new Query;
|
||||
$Query->select("data_ord", "num_ord", "riga_ord")
|
||||
$query = new Query;
|
||||
$query->select("data_ord", "num_ord", "riga_ord")
|
||||
->from("dtb_ordr")
|
||||
->where("gestione", "V")
|
||||
->where("cod_jcom", $codJcom)
|
||||
->where("cod_mart", $codMart);
|
||||
$Ret = $Query->toRet()->execute();
|
||||
$Ret = $query->toRet()->execute();
|
||||
if($Ret->is_OK()){
|
||||
$arr_ordini = $Ret->get_data();
|
||||
foreach($arr_ordini as $ordine){
|
||||
@@ -797,8 +797,8 @@ class Mrp {
|
||||
|
||||
// AGGIORNA CODJFAS NEGLI STEPS
|
||||
// if ($flagEditedCodJfas) {
|
||||
// $QueryB = new Query;
|
||||
// $QueryB->update("dtb_ord_steps")
|
||||
// $queryB = new Query;
|
||||
// $queryB->update("dtb_ord_steps")
|
||||
// ->set("cod_jfas", $codJfas)
|
||||
// ->where("gestione", $gestioneLav)
|
||||
// ->whereDate("data_ord", $dataOrdLav)
|
||||
@@ -806,7 +806,7 @@ class Mrp {
|
||||
// ->where("cod_jfas", $codJfasPrev);
|
||||
//
|
||||
// $Entity = new EntityItem("dtb_ordt");
|
||||
// $Entity->update()->set("nativeSql", $QueryB);
|
||||
// $Entity->update()->set("nativeSql", $queryB);
|
||||
// $EntityList->push($Entity);
|
||||
// }
|
||||
|
||||
@@ -850,8 +850,8 @@ class Mrp {
|
||||
|
||||
// AGGIORNO DATA/NUM/GESTIONE RIF NELL'ORD. LAV.
|
||||
|
||||
$QueryB = new Query;
|
||||
$QueryB->importSqlFile("updateOrdRifKey")
|
||||
$queryB = new Query;
|
||||
$queryB->importSqlFile("updateOrdRifKey")
|
||||
->setVar("gestione_rif", $ordProdKey["gestione"])
|
||||
->setDateVar("data_ord_rif", $ordProdKey["data_ord"])
|
||||
->setVar("num_ord_rif", $ordProdKey["num_ord"])
|
||||
@@ -860,7 +860,7 @@ class Mrp {
|
||||
->setVar("num_ord_lav", $numOrdLav);
|
||||
|
||||
$Entity = new EntityItem("dtb_ordt");
|
||||
$Entity->update()->set("nativeSql", $QueryB);
|
||||
$Entity->update()->set("nativeSql", $queryB);
|
||||
$EntityList->push($Entity);
|
||||
|
||||
$Ret = $EntityList->send();
|
||||
@@ -879,8 +879,8 @@ class Mrp {
|
||||
}
|
||||
|
||||
public static function suggestDataScadPartitaMag($data) {
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("suggestDataScadPartitaMag")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("suggestDataScadPartitaMag")
|
||||
->setVar("cod_mart", $data["cod_mart"])
|
||||
->setDateVar("data_prod", $data["data_prod"])
|
||||
->setVar("partita_mag", isset($data["partita_mag"]) ? $data["partita_mag"] : "")
|
||||
@@ -889,36 +889,36 @@ class Mrp {
|
||||
->setVar("num_ord", isset($data["num_ord"]) ? $data["num_ord"] : "")
|
||||
->setVar("cod_jfas", isset($data["cod_jfas"]) ? $data["cod_jfas"] : "");
|
||||
|
||||
return $Query->toRet()->firstRow()->execute();
|
||||
return $query->toRet()->firstRow()->execute();
|
||||
}
|
||||
|
||||
public static function getListOrdVendProdotto($codMart) {
|
||||
$Query = new Query;
|
||||
return $Query->importSqlFile("list-ordVendProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
$query = new Query;
|
||||
return $query->importSqlFile("list-ordVendProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getOrdine($filter, $includeRows = false) {
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("ordine")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("ordine")
|
||||
->setVar("gestione", $filter["gestione"])
|
||||
->setDateVar("data_ord", $filter["data_ord"])
|
||||
->setVar("num_ord", $filter["num_ord"]);
|
||||
$Ret = $Query->toRet()->firstRow()->execute();
|
||||
$Ret = $query->toRet()->firstRow()->execute();
|
||||
if ($Ret->is_OK()) {
|
||||
$ordine = $Ret->get_data();
|
||||
if (!is_null($ordine)) {
|
||||
if ($includeRows) {
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("righeOrdine")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("righeOrdine")
|
||||
->setVar("gestione", $filter["gestione"])
|
||||
->setDateVar("data_ord", $filter["data_ord"])
|
||||
->setVar("num_ord", $filter["num_ord"]);
|
||||
|
||||
if (isset($filter["data_cons"])) {
|
||||
$Query->whereDate("CONVERT(DATE, data_cons)", $filter["data_cons"]);
|
||||
$query->whereDate("CONVERT(DATE, data_cons)", $filter["data_cons"]);
|
||||
}
|
||||
|
||||
$Ret = $Query->toRet()->execute();
|
||||
$Ret = $query->toRet()->execute();
|
||||
if ($Ret->is_OK()) {
|
||||
$ordine["rows"] = $Ret->get_data();
|
||||
}
|
||||
@@ -935,8 +935,8 @@ class Mrp {
|
||||
}
|
||||
|
||||
public static function getPromozioniProdotto($codMart) {
|
||||
$Query = new Query;
|
||||
return $Query->importSqlFile("list-promozioniProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
$query = new Query;
|
||||
return $query->importSqlFile("list-promozioniProdotto")->setVar("cod_mart", $codMart)->toRet()->execute();
|
||||
}
|
||||
|
||||
private static function getDepositoCentroLavorazione($codJfas) {
|
||||
@@ -999,27 +999,27 @@ class Mrp {
|
||||
$GestSetup = new GestSetup;
|
||||
$listCodMdepSetup = $GestSetup->keySection("LIST_COD_MDEP")->asArray()->get();
|
||||
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("depositiArrivo");
|
||||
$query = new Query;
|
||||
$query->importSqlFile("depositiArrivo");
|
||||
|
||||
if (!empty($listCodMdepSetup)) {
|
||||
$Query->where("cod_mdep", $listCodMdepSetup);
|
||||
$query->where("cod_mdep", $listCodMdepSetup);
|
||||
}
|
||||
|
||||
return $Query->toRet()->execute();
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getListDepositiFornitore($codAnag) {
|
||||
$Query = new Query;
|
||||
return $Query->select("cod_mdep", "cod_anag", "descrizione", "cod_vdes")->from("mtb_depo")->where("cod_anag", $codAnag)->orderBy("descrizione")->cacheResult()->toRet()->execute();
|
||||
$query = new Query;
|
||||
return $query->select("cod_mdep", "cod_anag", "descrizione", "cod_vdes")->from("mtb_depo")->where("cod_anag", $codAnag)->orderBy("descrizione")->cacheResult()->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getLastProduction($codProd, $codMdep) {
|
||||
$Query = new Query();
|
||||
$Query->importSqlFile("checkLastProd")
|
||||
$query = new Query();
|
||||
$query->importSqlFile("checkLastProd")
|
||||
->setVar("cod_prod", $codProd)
|
||||
->setVar("cod_mdep", $codMdep);
|
||||
return $Query->toRet()->date2ts()->firstRow()->execute();
|
||||
return $query->toRet()->date2ts()->firstRow()->execute();
|
||||
}
|
||||
|
||||
public static function checkProduzione(array $data) {
|
||||
@@ -1066,8 +1066,8 @@ class Mrp {
|
||||
|
||||
/****************************** FUNCTION TO RETURN DATA : CONSUMI MEDI ********************************************/
|
||||
public static function getConsumiMediArticolo($codMart) {
|
||||
$Query = new Query();
|
||||
return $Query->select("*")->processSql()->from("MRP_ConsumiPeriodo")->where("cod_mart", $codMart)->date2ts()->toRet()->execute();
|
||||
$query = new Query();
|
||||
return $query->select("*")->processSql()->from("MRP_ConsumiPeriodo")->where("cod_mart", $codMart)->date2ts()->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getConsumiMediGruppo(array $data) {
|
||||
|
||||
@@ -99,7 +99,7 @@ if ($Ret->is_OK()) {
|
||||
</div>
|
||||
<div class="filterGroup col-sm-3 mt-10 pr-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">Data Cons.</span>
|
||||
<span class="input-group-addon">Fino a Data Cons.</span>
|
||||
<input type="date" class="form-control" id="flt-dataCons"
|
||||
min="<?= \Utility\Date::format(time(), Format::strftimeYMD) ?>">
|
||||
</div>
|
||||
|
||||
@@ -395,7 +395,6 @@ let _mrp_filters = {
|
||||
|
||||
if (_.isEmpty(arr_sottotipi)) {
|
||||
$fltCodMstp.closest(".input-group").parent().hide();
|
||||
|
||||
} else {
|
||||
_.each(arr_sottotipi, function (sottotipo) {
|
||||
$fltCodMstp.append("<option value='" + blankIfNull(sottotipo.cod_mstp) + "' " + (selectedOptions.includes(sottotipo.cod_mstp) ? "selected" : "") + ">" + sottotipo.descrizione + "</option>");
|
||||
|
||||
@@ -168,11 +168,7 @@ FROM mrp_det
|
||||
WHERE (LEN('[str-cod_mgrp]') = 0 OR cod_mgrp IN ('[cod_mgrp]'))
|
||||
AND (LEN('[cod_mart]') = 0 OR mrp_det.cod_mart = '[cod_mart]')
|
||||
AND (LEN('[str-cod_mdep]') = 0 OR cod_mdep IN ('[cod_mdep]'))
|
||||
AND ('[dataCons]' IS NULL OR data_mrp <= '[dataCons]')
|
||||
AND ('[dataCons]' IS NULL OR data_mrp <= '[dataCons]' AND (arrivi > 0 OR impegni > 0))
|
||||
AND ([whereCond])
|
||||
AND (LEN('[str-codAnag]') = 0 OR mrp_det.cod_mart IN (SELECT cod_mart FROM art_ordini))
|
||||
|
||||
ORDER BY cod_mgrp, cod_msgr, cod_msfa, cod_mart
|
||||
|
||||
|
||||
|
||||
ORDER BY cod_mgrp, cod_msgr, cod_msfa, cod_mart
|
||||
@@ -354,11 +354,15 @@ DateIntervalAutomations.prototype.init_oraAttivita = function ($hh, $mm) {
|
||||
delay: 0,
|
||||
onSelect: function (e, item, $this) {
|
||||
$this.val(item.value);
|
||||
// $.tabNext();
|
||||
|
||||
let inputs = $this.closest("#timePickers").find(":input");
|
||||
inputs.eq(inputs.index($this) + 1).focus();
|
||||
},
|
||||
onOneResult: function (e, item, $this) {
|
||||
$this.val(item.value);
|
||||
// $.tabNext();
|
||||
|
||||
let inputs = $this.closest("#timePickers").find(":input");
|
||||
inputs.eq(inputs.index($this) + 1).focus();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -373,11 +377,15 @@ DateIntervalAutomations.prototype.init_oraAttivita = function ($hh, $mm) {
|
||||
delay: 0,
|
||||
onSelect: function (e, item, $this) {
|
||||
$this.val(item.value);
|
||||
// $.tabNext();
|
||||
|
||||
let inputs = $this.closest("#timePickers").find(":input");
|
||||
inputs.eq(inputs.index($this) + 1).focus();
|
||||
},
|
||||
onOneResult: function (e, item, $this) {
|
||||
$this.val(item.value);
|
||||
// $.tabNext();
|
||||
|
||||
let inputs = $this.closest("#timePickers").find(":input");
|
||||
inputs.eq(inputs.index($this) + 1).focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1172,35 +1172,34 @@ $.fn.btn_radio = function (options) {
|
||||
var isBtnLink = $this.hasClass("btn-link");
|
||||
var classActive = (isBtnLink ? "text-" : "btn-") + activeClassName;
|
||||
|
||||
$this.addClass("radio_btn").toggleClass("disabled", !($this.hasClass(classActive)))
|
||||
.on("click", function () {
|
||||
if ($this.hasClass("disabled")) {
|
||||
$this.addClass("radio_btn").toggleClass("disabled", !($this.hasClass(classActive))).on("click", function () {
|
||||
if ($this.hasClass("disabled")) {
|
||||
|
||||
if (!is_function(options.onClick) || options.onClick($this) !== false) {
|
||||
if (!is_function(options.onClick) || options.onClick($this) !== false) {
|
||||
|
||||
var $siblings = $this.siblings("." + options.selector_className);
|
||||
$siblings.each(function () {
|
||||
if (isBtnLink) { // da ottimizz
|
||||
$(this).removeClass("text-primary").removeClass("text-info");
|
||||
} else {
|
||||
$(this).bs_element_setStyle("default");
|
||||
}
|
||||
$(this).addClass("disabled");
|
||||
});
|
||||
|
||||
if (isBtnLink) {
|
||||
$this.addClass("text-" + activeClassName);
|
||||
var $siblings = $this.siblings("." + options.selector_className);
|
||||
$siblings.each(function () {
|
||||
if (isBtnLink) { // da ottimizz
|
||||
$(this).removeClass("text-primary").removeClass("text-info");
|
||||
} else {
|
||||
$this.bs_element_setStyle(activeClassName);
|
||||
$(this).bs_element_setStyle("default");
|
||||
}
|
||||
$(this).addClass("disabled");
|
||||
});
|
||||
|
||||
$this.removeClass("disabled");
|
||||
if (is_function(options.onChange)) {
|
||||
options.onChange($(this));
|
||||
}
|
||||
if (isBtnLink) {
|
||||
$this.addClass("text-" + activeClassName);
|
||||
} else {
|
||||
$this.bs_element_setStyle(activeClassName);
|
||||
}
|
||||
|
||||
$this.removeClass("disabled");
|
||||
if (is_function(options.onChange)) {
|
||||
options.onChange($(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user