Moifiche per contratti di acquisto
This commit is contained in:
@@ -36,6 +36,8 @@ class Allegati {
|
||||
return Allegati\ListinoAcquisto::get_filelist($key);
|
||||
} else if ($sourceType == SourceType::ORDCOM) {
|
||||
return Allegati\Ordine::get_filelist($key);
|
||||
} else if ($sourceType == SourceType::ATBOFFT) {
|
||||
return Allegati\ContrattoAcquisto::get_filelist($key);
|
||||
}
|
||||
|
||||
$Ret = new \Ret;
|
||||
@@ -74,6 +76,12 @@ class Allegati {
|
||||
);
|
||||
|
||||
$Ret = \Allegati\OrdineAcquisto::get_filelist($key);
|
||||
} else if (isset($data["id_contratto"])) {
|
||||
$key = array(
|
||||
"id_contratto" => $data["id_contratto"],
|
||||
);
|
||||
|
||||
$Ret = \Allegati\ContrattoAcquisto::get_filelist($key);
|
||||
} else {
|
||||
$Ret->set_error("Richiesta non valida");
|
||||
}
|
||||
@@ -269,6 +277,22 @@ class Allegati {
|
||||
return $Ret;
|
||||
}
|
||||
break;
|
||||
case SourceType::ATBOFFT:
|
||||
$ret = Allegati\ContrattoAcquisto::upload($filter, $fileItem);
|
||||
if ($ret->is_OK()) {
|
||||
$reta = $ret->get_data();
|
||||
$item = $reta["item"];
|
||||
unset($item["content"]);
|
||||
$item["source_type"] = $sourceType;
|
||||
$ret->set_data($item);
|
||||
ob_start();
|
||||
include \Controller::current_gestpath_include("popup-main-tr.php");
|
||||
$html = \Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
$ret->set_string($html)->set_title($item["file_name"]);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($activityId)) {
|
||||
|
||||
@@ -1,62 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Allegati;
|
||||
class ContrattoAcquisto {
|
||||
|
||||
use EntityItem;
|
||||
use Query;
|
||||
use Utility\Compression\GZ;
|
||||
use Utility\File;
|
||||
|
||||
class ContrattoAcquisto {
|
||||
public static function get_filelist($key) {
|
||||
$Query = new \Query;
|
||||
$Query
|
||||
->importSqlFile("list-fileContratto")
|
||||
->setVar("cod_alis", $key["codAlis"])
|
||||
->setVar("versione", $key["versione"]);
|
||||
$Ret = $Query->toRet()->execute();
|
||||
if ($Ret->is_OK()) {
|
||||
$items = $Ret->get_data();
|
||||
foreach ($items as $i => $item) {
|
||||
$items[$i] = StbFilesAttached::completeFileItemData($item, SourceType::ORDCOM);
|
||||
$ret = self::get_items($key["id_contratto"]);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$arr_rows = $ret->get_data();
|
||||
foreach ($arr_rows as $i => $row) {
|
||||
$arr_rows[$i] = array_pick($row, "id_attach", "file_name", "descrizione", "icon", "icon_style", "mime_type", "last_upd", "size");
|
||||
$arr_rows[$i]["key"] = array_pick($row, "file_name", "id_attach", "id_contratto");
|
||||
$arr_rows[$i]["source_type"] = SourceType::ATBOFFT;
|
||||
}
|
||||
$Ret->set_data($items);
|
||||
$ret->set_data(array_orderby($arr_rows, "file_name"));
|
||||
}
|
||||
return $Ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function get_items($idContratto) {
|
||||
$query = new Query();
|
||||
$query->importSqlFile("list-fileContrattoAcquisto")
|
||||
->setVar("id_contratto", $idContratto);
|
||||
|
||||
$ret = $query->toRet()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$arr_rows = $ret->get_data();
|
||||
foreach ($arr_rows as $i => $row) {
|
||||
$mime = File::getMimeTypeFromName($row["file_name"]);
|
||||
$icon = File::getFaIcoFromName($row["file_name"]);
|
||||
|
||||
$arr_rows[$i] = array_merge($arr_rows[$i], array(
|
||||
"size" => $row["file_size"], // unsettare 'original_size'
|
||||
"mime_type" => $mime,
|
||||
"user_creator" => null,
|
||||
"icon" => $icon["name"],
|
||||
"icon_style" => $icon["style"]
|
||||
));
|
||||
}
|
||||
|
||||
$ret->set_data($arr_rows);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function upload($key, $fileItem) {
|
||||
$ArlListDataAttach = new \EntityItem("arl_list_data_attach");
|
||||
$ArlListDataAttach->insert()
|
||||
->set("codAlis", $key["codAlis"])
|
||||
->set("versione", $key["versione"]);
|
||||
$ArlOfftAttach = new \EntityItem("arl_offt_attach");
|
||||
|
||||
$Ret = StbFilesAttached::upload($fileItem, $ArlListDataAttach);
|
||||
if ($Ret->is_OK()) {
|
||||
$keyAttach = $Ret->get_data();
|
||||
$ArlOfftAttach->insert()
|
||||
->set("idContratto", $key["id_contratto"]);
|
||||
|
||||
$ret = StbFilesAttached::upload($fileItem, $ArlOfftAttach);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$keyAttach = $ret->get_data();
|
||||
$keyComplete = array_merge($key, $keyAttach);
|
||||
|
||||
$Ret = self::getFileItem($keyComplete);
|
||||
if ($Ret->is_OK()) {
|
||||
$Ret->set_data(array("key" => $keyComplete, "item" => $Ret->get_data()));
|
||||
$ret = self::getFileItem($keyComplete);
|
||||
if ($ret->is_OK()) {
|
||||
$ret->set_data(array("key" => $keyComplete, "item" => $ret->get_data()));
|
||||
}
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getFileItem($key) {
|
||||
$Query = new \Query;
|
||||
$Query
|
||||
->importSqlFile("list-fileContratto")
|
||||
->setVar("cod_alis", $key["codAlis"])
|
||||
->setVar("versione", $key["versione"])
|
||||
$query = new \Query;
|
||||
$query->importSqlFile("list-fileContrattoAcquisto")
|
||||
->setVar("id_contratto", $key["id_contratto"])
|
||||
->where("stb_files_attached.id_attach", $key["id_attach"]);
|
||||
$Ret = $Query->toRet()->firstRow()->execute();
|
||||
if ($Ret->is_OK()) {
|
||||
$item = $Ret->get_data();
|
||||
|
||||
$ret = $query->toRet()->firstRow()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$item = $ret->get_data();
|
||||
if (!is_null($item)) {
|
||||
$Ret->set_data(StbFilesAttached::completeFileItemData($item, SourceType::ORDCOM));
|
||||
$ret->set_data(StbFilesAttached::completeFileItemData($item, SourceType::ATBOFFT));
|
||||
|
||||
} else {
|
||||
$Ret->set_error("Risorsa non trovata");
|
||||
$ret->set_error("Risorsa non trovata");
|
||||
}
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function remove($key) {
|
||||
return \StbFilesAttached::remove($key["id_attach"]);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ class SourceType {
|
||||
const LIS_A = "listinoAcquisti";
|
||||
const LOGOREPARTO = "logoReparto";
|
||||
|
||||
const ATBOFFT = "atbOfft";
|
||||
|
||||
public static function get_items() {
|
||||
$reflectionClass = new \ReflectionClass(new SourceType);
|
||||
return $reflectionClass->getConstants();
|
||||
@@ -43,6 +45,7 @@ class SourceType {
|
||||
self::NOTIFICATIONIMAGE => array("title" => "Immagine notifica", "table" => TableName::STB_FILES_ATTACHED),
|
||||
self::LIS_A => array("title" => "Allegati listino", "table" => TableName::STB_FILES_ATTACHED),
|
||||
self::LOGOREPARTO => array("title" => "Logo reparto", "table" => TableName::STB_FILES_ATTACHED),
|
||||
self::ATBOFFT => array("title" => "Allegati contratto", "table" => TableName::STB_FILES_ATTACHED),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ function ModalAllegati() {
|
||||
this._gestione = null;
|
||||
this._dataOrd = null;
|
||||
this._numOrd = null;
|
||||
this._idContratto = null;
|
||||
|
||||
this._flagOnlyCurrentUser = false; // filtro su commessa, true: solo attivita agganciate a utente corrente
|
||||
this._waitLoader = false;
|
||||
@@ -132,9 +133,14 @@ ModalAllegati.prototype.numOrd = function (v) {
|
||||
return this;
|
||||
};
|
||||
|
||||
ModalAllegati.prototype.idContratto = function (v) {
|
||||
this._idContratto = v;
|
||||
return this;
|
||||
};
|
||||
|
||||
ModalAllegati.prototype._getFilter = function () {
|
||||
var self = this;
|
||||
var filter = {
|
||||
const self = this;
|
||||
const filter = {
|
||||
filter: self._filter,
|
||||
source_type: self._getCurrentSourceType(),
|
||||
visible_sourceTypes: self._visibleSourceTypes,
|
||||
@@ -143,7 +149,9 @@ ModalAllegati.prototype._getFilter = function () {
|
||||
editableDescriptionSourceTypes: self._editableDescriptionSourceTypes
|
||||
};
|
||||
|
||||
if (!is_null(self._codAlis)) {
|
||||
if (!is_null(self._idContratto)) {
|
||||
filter.id_contratto = self._idContratto;
|
||||
} else if (!is_null(self._codAlis)) {
|
||||
filter.cod_alis = self._codAlis;
|
||||
filter.versione = self._versione;
|
||||
} else if (!is_null(self._activityId)) {
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
SELECT stb_files_attached.id_attach,
|
||||
stb_files_attached.file_name,
|
||||
stb_files_attached.description AS descrizione,
|
||||
stb_files_attached.datetime_attach,
|
||||
stb_files_attached.file_size,
|
||||
stb_files_attached.user_name AS user_creator
|
||||
FROM stb_files_attached
|
||||
INNER JOIN arl_list_data_attach ON stb_files_attached.id_attach = arl_list_data_attach.id_attach
|
||||
WHERE arl_list_data_attach.cod_alis = '[cod_alis]'
|
||||
AND arl_list_data_attach.versione = [versione]
|
||||
@@ -0,0 +1,10 @@
|
||||
SELECT stb_files_attached.id_attach,
|
||||
stb_files_attached.file_name,
|
||||
stb_files_attached.description AS descrizione,
|
||||
stb_files_attached.datetime_attach AS last_upd,
|
||||
stb_files_attached.file_size,
|
||||
stb_files_attached.user_name AS user_creator,
|
||||
aoa.id_contratto
|
||||
FROM stb_files_attached
|
||||
INNER JOIN arl_offt_attach aoa ON stb_files_attached.id_attach = aoa.id_attach
|
||||
WHERE aoa.id_contratto = '[id_contratto]'
|
||||
@@ -35,8 +35,8 @@ class ContrattiDiAcquisto {
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getTestataOfferta($codAlis, $versione) {
|
||||
if (empty($codAlis) || empty($versione)) {
|
||||
public static function getTestataOfferta($codAlis, $numOff) {
|
||||
if (empty($codAlis) || empty($numOff)) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("codAlis o versione vuoti.");
|
||||
}
|
||||
@@ -46,21 +46,22 @@ class ContrattiDiAcquisto {
|
||||
$query
|
||||
->importSqlFile("offerta-testata")
|
||||
->setVar("cod_alis", $codAlis)
|
||||
->setVar("versione", $versione)
|
||||
->setVar("num_off", $numOff)
|
||||
->firstRow()
|
||||
->toRet();
|
||||
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
public static function getRigheOfferta($codAlis, $versione) {
|
||||
if (isset($codAlis) && isset($versione)) {
|
||||
public static function getRigheOfferta($data) {
|
||||
$idContratto = $data["id_contratto"];
|
||||
|
||||
if (isset($idContratto)) {
|
||||
$query = new Query();
|
||||
|
||||
$query
|
||||
->importSqlFile("offerta-righe")
|
||||
->setVar("cod_alis", $codAlis)
|
||||
->setVar("versione", $versione)
|
||||
->setVar("id_contratto", $idContratto)
|
||||
->toRet();
|
||||
|
||||
return $query->execute();
|
||||
@@ -111,7 +112,7 @@ class ContrattiDiAcquisto {
|
||||
$query = new Query();
|
||||
|
||||
return $query
|
||||
->setSql("SELECT cod_mdep, cod_mdep + ' - ' + descrizione as descrizione FROM mtb_depo")
|
||||
->setSql("SELECT cod_mdep, cod_mdep + ' - ' + descrizione AS descrizione FROM mtb_depo")
|
||||
->toRet()
|
||||
->execute();
|
||||
}
|
||||
@@ -193,7 +194,9 @@ class ContrattiDiAcquisto {
|
||||
|
||||
public static function saveOfferta($data) {
|
||||
$codAnag = array_get($data, "codAnag");
|
||||
$numOff = array_get($data, "numOff");
|
||||
$codMdep = array_get($data, "codMdep");
|
||||
$idContratto = array_get($data, "idContratto");
|
||||
|
||||
if (is_null($codAnag) || is_null($codMdep)) {
|
||||
$ret = new Ret();
|
||||
@@ -201,81 +204,63 @@ class ContrattiDiAcquisto {
|
||||
return $ret->set_error("Fornitore o deposito non impostati.");
|
||||
}
|
||||
|
||||
$body = new EntityItem();
|
||||
|
||||
$body->set("codAnag", $codAnag);
|
||||
|
||||
$atbListData = new EntityItem("atb_list_data");
|
||||
|
||||
foreach ($data["rows"] as $row) {
|
||||
$mtbLisaData = new EntityItem("mtb_lisa_data");
|
||||
|
||||
$mtbLisaData
|
||||
->insert_or_update()
|
||||
->set("versione", $data["versione"])
|
||||
->set("flagFornPref", $data["flagPref"] ? "S" : "N")
|
||||
->set("codMart", $row["cod_mart"])
|
||||
->set("untMisAcq", $row["unt_mis_acq"])
|
||||
->set("qtaAcqContr", $row["qta_acq_contr"])
|
||||
->set("przAcq", $row["prz_acq"])
|
||||
->set("rapConvAcq", 1)
|
||||
->set("perc1", $row["perc_1"])
|
||||
->set("perc2", $row["perc_2"])
|
||||
->set("perc3", $row["perc_3"])
|
||||
->set("perc4", $row["perc_4"])
|
||||
->set("percProv", $row["perc_prov"])
|
||||
->set("valProv", $row["val_prov"]);
|
||||
|
||||
if (isset($row["tipo_variazione"])) {
|
||||
$mtbLisaData->set("tipoVariazione", $row["tipo_variazione"]);
|
||||
}
|
||||
|
||||
$atbListData->set("mtbLisaData")->append($mtbLisaData);
|
||||
}
|
||||
|
||||
$atbListData
|
||||
->insert_or_update()
|
||||
->set("versione", $data["versione"])
|
||||
$atbOfft = new EntityItem("atb_offt");
|
||||
$atbOfft->insert_or_update()
|
||||
->set("idContratto", $idContratto)
|
||||
->set("codAnag", $codAnag)
|
||||
->set("numOff", $numOff)
|
||||
->setDate("dataIniz", $data["dataIniz"])
|
||||
->setDate("dataFine", $data["dataFine"])
|
||||
->set("codVage", $data["codVage"])
|
||||
->set("codVvet", $data["codVvet"])
|
||||
->set("costoTrasp", $data["costoTrasp"])
|
||||
->set("note", $data["note"]);
|
||||
|
||||
$atbPromoDepo = new EntityItem("atb_promo_depo");
|
||||
|
||||
$atbPromoDepo->delete();
|
||||
|
||||
$atbListData->set("atbPromoDepo")->append($atbPromoDepo);
|
||||
|
||||
$atbPromoDepo = new EntityItem("atb_promo_depo");
|
||||
|
||||
$atbPromoDepo
|
||||
->insert_or_update()
|
||||
->set("note", $data["note"])
|
||||
->set("codMdep", $codMdep);
|
||||
|
||||
$atbListData->set("atbPromoDepo")->append($atbPromoDepo);
|
||||
foreach ($data["rows"] as $row) {
|
||||
$rigaOff = array_get($row, "riga_off");
|
||||
|
||||
$body->set("atbListData", $atbListData, false, true);
|
||||
$atbOffr = new EntityItem("atb_offr");
|
||||
|
||||
if (array_get($row, "tipo_variazione") === "D") {
|
||||
$atbOffr->delete();
|
||||
} else {
|
||||
$atbOffr->insert_or_update();
|
||||
}
|
||||
|
||||
$atbOffr
|
||||
->set("idContratto", $idContratto)
|
||||
->set("rigaOff", $rigaOff)
|
||||
->set("numOff", $numOff)
|
||||
->set("codMart", $row["cod_mart"])
|
||||
->set("untMis", $row["unt_mis_acq"])
|
||||
->set("qtaOff", $row["qta_acq_contr"])
|
||||
->set("valUnt", $row["prz_acq"])
|
||||
->set("sconto5", $row["perc_1"])
|
||||
->set("sconto6", $row["perc_2"])
|
||||
->set("sconto7", $row["perc_3"])
|
||||
->set("sconto8", $row["perc_4"])
|
||||
->set("percProv", $row["perc_prov"])
|
||||
->set("valProv", $row["val_prov"])
|
||||
->set("codArtForn", $row["cod_art_forn"]);
|
||||
|
||||
$atbOfft->set("atbOffr")->append($atbOffr);
|
||||
}
|
||||
|
||||
$imsApi = new IMSApi();
|
||||
|
||||
$imsApi
|
||||
->post("savePurchaseAgreement")
|
||||
->body($body);
|
||||
->post("contratti-acquisto/save")
|
||||
->body($atbOfft);
|
||||
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function deleteContratto($data) {
|
||||
$AtbListData = new EntityItem("atb_list_data");
|
||||
$atbOfft = new EntityItem("atb_offt");
|
||||
|
||||
$AtbListData->delete()
|
||||
->set("codAlis", $data["codAlis"])
|
||||
->set("versione", $data["versione"]);
|
||||
$atbOfft->delete()
|
||||
->set("idContratto", $data["idContratto"]);
|
||||
|
||||
return $AtbListData->send();
|
||||
return $atbOfft->send();
|
||||
}
|
||||
|
||||
public static function getPdfContratto($data) {
|
||||
@@ -285,12 +270,13 @@ class ContrattiDiAcquisto {
|
||||
$JP = $Ret->get("JP");
|
||||
$key = $data["key"];
|
||||
$JP->param("cod_alis", array_get($key, "codAlis"))
|
||||
->param("versione", strval($key["versione"]))
|
||||
->param("id_contratto", strval(array_get($key, "idContratto")))
|
||||
->cacheAs(sprintf("Contratto di Acquisto n. %s",
|
||||
$key["versione"]
|
||||
$key["idContratto"]
|
||||
));
|
||||
$Ret = $JP->run();
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ if (isset($_GET["popupOfferta"])) {
|
||||
ContrattiDiAcquisto::getListContratti(isset($data["scaduti"]) ? $data["scaduti"] : false)->display();
|
||||
} else if (isset($_POST["getRigheOfferta"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_POST["getRigheOfferta"]);
|
||||
ContrattiDiAcquisto::getRigheOfferta($data["cod_alis"], $data["versione"])->display();
|
||||
ContrattiDiAcquisto::getRigheOfferta($data)->display();
|
||||
} else if (isset($_GET["searchFornitore"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["searchFornitore"]);
|
||||
ContrattiDiAcquisto::searchFornitore($data)->display();
|
||||
|
||||
@@ -4,8 +4,8 @@ $testataOfferta = null;
|
||||
$arr_files = array();
|
||||
$emailList = $depositoList = array();
|
||||
|
||||
if (isset($data["cod_alis"]) && isset($data["versione"])) {
|
||||
$ret = ContrattiDiAcquisto::getTestataOfferta($data["cod_alis"], $data["versione"]);
|
||||
if (isset($data["cod_alis"]) && isset($data["num_off"])) {
|
||||
$ret = ContrattiDiAcquisto::getTestataOfferta($data["cod_alis"], $data["num_off"]);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$testataOfferta = $ret->get_data();
|
||||
@@ -17,11 +17,10 @@ if (isset($data["cod_alis"]) && isset($data["versione"])) {
|
||||
}
|
||||
|
||||
$key = array(
|
||||
"cod_alis" => $data["cod_alis"],
|
||||
"versione" => $data["versione"],
|
||||
"id_contratto" => $data["id_contratto"],
|
||||
);
|
||||
|
||||
$RetAllegati = Allegati\ListinoAcquisto::get_filelist($key);
|
||||
$RetAllegati = Allegati\ContrattoAcquisto::get_filelist($key);
|
||||
$arr_files = $RetAllegati->is_OK() ? $RetAllegati->get_data() : array();
|
||||
}
|
||||
|
||||
@@ -49,16 +48,6 @@ if ($ret->is_OK()) {
|
||||
|
||||
<input type="hidden" id="codAnag" name="codAnag"
|
||||
value="<?= $testataOfferta["cod_anag"] ?>">
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
id="flagPref" name="flagPref"
|
||||
<?= $testataOfferta["flag_forn_pref"] == "S" ? "checked" : "" ?>
|
||||
>
|
||||
Imposta come preferito
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-3">
|
||||
@@ -74,13 +63,6 @@ if ($ret->is_OK()) {
|
||||
<div class="col-md-6">
|
||||
<label>Fornitore</label>
|
||||
<select style="width: 100%" name="codAnag" class="form-control"></select>
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="flagPref" name="flagPref">
|
||||
Imposta come preferito
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -157,15 +139,6 @@ if ($ret->is_OK()) {
|
||||
<input type="text" class="form-control" id="searchCodVvet" name="searchCodVvet"
|
||||
value="<?= array_get($testataOfferta, "rag_soc_vet") ?>">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-3">
|
||||
<label for="costoTrasp">
|
||||
Costo di Trasporto
|
||||
</label>
|
||||
|
||||
<input type="number" class="form-control" id="costoTrasp" name="costoTrasp"
|
||||
value="<?= array_get($testataOfferta, "costo_trasp") ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-10">
|
||||
<div class="col-xs-12">
|
||||
@@ -213,12 +186,13 @@ if ($ret->is_OK()) {
|
||||
<tr>
|
||||
<th rowspan="2">Articolo</th>
|
||||
<th rowspan="2">Descrizione</th>
|
||||
<th rowspan="2">Cod. Art. For.</th>
|
||||
<th rowspan="2">Unità di Misura</th>
|
||||
<th colspan="3">Quantità</th>
|
||||
<th rowspan="2">Prezzo acquisto</th>
|
||||
<th colspan="4">Sconto</th>
|
||||
<th rowspan="2">Perc. Prov.</th>
|
||||
<th rowspan="2">Val. Unit. Prov.</th>
|
||||
<th rowspan="2">Val. Unit.<br> Prov.</th>
|
||||
<th rowspan="2"></th>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -74,12 +74,13 @@ PopupEsporta.prototype.open = function () {
|
||||
.post("upload")
|
||||
.module("allegati")
|
||||
.formData(formData)
|
||||
.data({sourceType: _allegati.sourceTypes.LIS_A, key: self._key})
|
||||
.data({sourceType: _allegati.sourceTypes.ATBOFFT, key: self._key})
|
||||
.$button($btUpload)
|
||||
.noticeAsToast()
|
||||
.onSuccess(function (ret) {
|
||||
let fileItem = ret.returnData.item;
|
||||
fileItem.url = _allegati.getDownloadFileUrl(fileItem.key, fileItem.source_type);
|
||||
console.log(fileItem.source_type);
|
||||
self._fileList.push(fileItem);
|
||||
|
||||
let $tr = self._buildTr(fileItem);
|
||||
@@ -167,7 +168,7 @@ PopupEsporta.prototype._buildTr = function (fileItem) {
|
||||
.append($("<td>", {html: "<input type='checkbox' class='' />"}))
|
||||
.append($("<td>").html($a));
|
||||
|
||||
if (fileItem.source_type === _allegati.sourceTypes.LIS_A) {
|
||||
if (fileItem.source_type === _allegati.sourceTypes.ATBOFFT) {
|
||||
let $btDelete = $("<button>", {
|
||||
class: "btn btn-link btn-sm text-danger",
|
||||
text: "Elimina"
|
||||
@@ -250,7 +251,7 @@ PopupEsporta.prototype._getContrattoFileList = function () {
|
||||
let self = this;
|
||||
let d = $.Deferred();
|
||||
|
||||
_allegati.getList(self._key, _allegati.sourceTypes.LIS_A)
|
||||
_allegati.getList(self._key, _allegati.sourceTypes.ATBOFFT)
|
||||
.done(function (ret) {
|
||||
d.resolve(ret.returnData);
|
||||
})
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
function PopupOfferta() {
|
||||
this.modalBox = null;
|
||||
this._codAlis = null;
|
||||
this._versione = null;
|
||||
this._numOff = null;
|
||||
this._codAnag = null;
|
||||
this._idContratto = null;
|
||||
this._jsonIniziale = {};
|
||||
}
|
||||
|
||||
PopupOfferta.prototype.isEditMode = function () {
|
||||
return !is_null(this._codAlis) && !is_null(this._versione);
|
||||
return !is_null(this._codAlis) && !is_null(this._numOff);
|
||||
};
|
||||
|
||||
PopupOfferta.prototype.codAlis = function (codAlis) {
|
||||
@@ -16,8 +17,8 @@ PopupOfferta.prototype.codAlis = function (codAlis) {
|
||||
return this;
|
||||
};
|
||||
|
||||
PopupOfferta.prototype.versione = function (versione) {
|
||||
this._versione = versione;
|
||||
PopupOfferta.prototype.numOff = function (numOff) {
|
||||
this._numOff = numOff;
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -28,6 +29,12 @@ PopupOfferta.prototype.codAnag = function (codAnag) {
|
||||
return this;
|
||||
};
|
||||
|
||||
PopupOfferta.prototype.idContratto = function (idContratto) {
|
||||
this._idContratto = idContratto;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
PopupOfferta.prototype.salvaContratto = function (closeOnSave = true) {
|
||||
const self = this;
|
||||
|
||||
@@ -55,8 +62,9 @@ PopupOfferta.prototype.salvaContratto = function (closeOnSave = true) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.cod_alis = self._codAlis;
|
||||
data.versione = self._versione;
|
||||
data.codAlis = self._codAlis;
|
||||
data.numOff = self._numOff;
|
||||
data.idContratto = self._idContratto;
|
||||
|
||||
if (self._codAnag) {
|
||||
data.codAnag = self._codAnag;
|
||||
@@ -129,7 +137,8 @@ PopupOfferta.prototype.open = function () {
|
||||
.get("popupOfferta")
|
||||
.data({
|
||||
cod_alis: self._codAlis,
|
||||
versione: self._versione,
|
||||
num_off: self._numOff,
|
||||
id_contratto: self._idContratto,
|
||||
})
|
||||
.noticeAsModal()
|
||||
.onSuccess(function (popupRet) {
|
||||
@@ -137,7 +146,7 @@ PopupOfferta.prototype.open = function () {
|
||||
self._listEmailsFornitore = popupRet.returnData.eMailList;
|
||||
|
||||
self.modalBox
|
||||
.title(self._versione ? `Contratto n. ${self._versione}` : "Nuovo Contratto")
|
||||
.title(self._numOff ? `Contratto n. ${self._numOff}` : "Nuovo Contratto")
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Conferma",
|
||||
@@ -236,12 +245,11 @@ PopupOfferta.prototype.open = function () {
|
||||
|
||||
if (_allegati.isLoaded() && _allegati.sourceTypes) {
|
||||
new ModalAllegati()
|
||||
.codAlis(self._codAlis)
|
||||
.versione(self._versione)
|
||||
.sourceTypes([_allegati.sourceTypes.LIS_A])
|
||||
.allowUpload([_allegati.sourceTypes.LIS_A])
|
||||
.allowDelete([_allegati.sourceTypes.LIS_A])
|
||||
.editableDescription([_allegati.sourceTypes.LIS_A])
|
||||
.idContratto(self._idContratto)
|
||||
.sourceTypes([_allegati.sourceTypes.ATBOFFT])
|
||||
.allowUpload([_allegati.sourceTypes.ATBOFFT])
|
||||
.allowDelete([_allegati.sourceTypes.ATBOFFT])
|
||||
.editableDescription([_allegati.sourceTypes.ATBOFFT])
|
||||
.$button($bt)
|
||||
.onChange(function (c) {
|
||||
$bt.find(".badge").bs_element_setStyle(c > 0 ? "primary" : "default").text(c);
|
||||
@@ -254,8 +262,7 @@ PopupOfferta.prototype.open = function () {
|
||||
new Ajax()
|
||||
.get("deleteContratto")
|
||||
.data({
|
||||
codAlis: self._codAlis,
|
||||
versione: self._versione
|
||||
idContratto: self._idContratto
|
||||
})
|
||||
.confirmModal({
|
||||
style: "danger",
|
||||
@@ -264,7 +271,7 @@ PopupOfferta.prototype.open = function () {
|
||||
<div class="text-center">
|
||||
<i class="fas fa-5x fa-exclamation-triangle text-danger"></i><br>
|
||||
<h4 class="mt-10">
|
||||
Confermi di voler eliminare il contratto n. <b>${self._versione}</b>?
|
||||
Confermi di voler eliminare il contratto n. <b>${self._numOff}</b>?
|
||||
</h4>
|
||||
</div>
|
||||
`
|
||||
@@ -289,8 +296,7 @@ PopupOfferta.prototype.open = function () {
|
||||
new Ajax()
|
||||
.post("getRigheOfferta")
|
||||
.data({
|
||||
cod_alis: self._codAlis,
|
||||
versione: self._versione,
|
||||
id_contratto: self._idContratto,
|
||||
})
|
||||
.onSuccess(function (ret) {
|
||||
if (ret.returnData) {
|
||||
@@ -308,6 +314,12 @@ PopupOfferta.prototype.open = function () {
|
||||
columns: [
|
||||
{data: "cod_mart"},
|
||||
{data: "descrizione_art"},
|
||||
{
|
||||
data: "cod_art_forn",
|
||||
render(data, type, row) {
|
||||
return data ? data : null;
|
||||
},
|
||||
},
|
||||
{
|
||||
data: "unt_mis_acq",
|
||||
render(data, type, row) {
|
||||
@@ -403,6 +415,7 @@ PopupOfferta.prototype.open = function () {
|
||||
},
|
||||
{
|
||||
data: "prz_acq",
|
||||
width: "10%",
|
||||
render(data, type) {
|
||||
if (type === "display") {
|
||||
return `
|
||||
@@ -469,6 +482,7 @@ PopupOfferta.prototype.open = function () {
|
||||
},
|
||||
{
|
||||
data: "val_prov",
|
||||
width: "6%",
|
||||
render(data, type) {
|
||||
if (type === "display") {
|
||||
return `<input type="number" class="form-control w-100 valProv" name="valProv" value="${data}" min="0">`;
|
||||
@@ -480,14 +494,18 @@ PopupOfferta.prototype.open = function () {
|
||||
{
|
||||
data: "tipo_variazione",
|
||||
orderable: false,
|
||||
render(data) {
|
||||
render(data, type, row) {
|
||||
let returnString = `
|
||||
<button class="btn btn-danger icbtn delete" title="Elimina riga">
|
||||
<span class="fas fa-trash">
|
||||
</button>`;
|
||||
|
||||
if (data) {
|
||||
returnString = `<input type="hidden" id="tipoVariazione" name="tipoVariazione" value="${data}">${returnString}`;
|
||||
if (row.tipo_variazione) {
|
||||
returnString = `<input type="hidden" id="tipoVariazione" name="tipoVariazione" value="${row.tipo_variazione}">${returnString}`;
|
||||
}
|
||||
|
||||
if (row.riga_off) {
|
||||
returnString = `<input type="hidden" id="tipoVariazione" name="tipoVariazione" value="${row.riga_off}">${returnString}`;
|
||||
}
|
||||
|
||||
return returnString;
|
||||
@@ -497,7 +515,7 @@ PopupOfferta.prototype.open = function () {
|
||||
columnDefs: [
|
||||
{type: "non-empty-string", targets: [0, 1, 2]},
|
||||
{
|
||||
className: "max-width-100px vertical-middle",
|
||||
className: "max-width-100px",
|
||||
targets: [2]
|
||||
},
|
||||
{
|
||||
@@ -618,7 +636,7 @@ PopupOfferta.prototype.open = function () {
|
||||
<div class="text-center">
|
||||
<i class="fas fa-5x fa-exclamation-triangle text-danger"></i><br>
|
||||
<h4 class="mt-10">
|
||||
Confermi di voler eliminare l'articolo <b>${data.descrizione_art}</b> dal contratto n. <b>${self._versione}</b>?
|
||||
Confermi di voler eliminare l'articolo <b>${data.descrizione_art}</b> dal contratto n. <b>${self._numOff}</b>?
|
||||
</h4>
|
||||
</div>
|
||||
`)
|
||||
@@ -765,34 +783,42 @@ PopupOfferta.prototype.open = function () {
|
||||
{
|
||||
field: "descrizione_estesa",
|
||||
title: "Descrizione",
|
||||
width: "50%",
|
||||
width: "45%",
|
||||
filterable: true,
|
||||
attributes: {
|
||||
class: "k-text-left"
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "prz_acq",
|
||||
title: "In Listino",
|
||||
field: "cod_art_forn",
|
||||
title: "Codice Articolo Fornitore",
|
||||
filterable: true,
|
||||
attributes: {
|
||||
class: "k-text-center"
|
||||
},
|
||||
template(data) {
|
||||
if (!_.isNil(data.prz_acq)) {
|
||||
return `<i class="fa fa-check-circle fa_1_5x text-success"></i>`;
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
filterable: {
|
||||
operators: {
|
||||
number: {
|
||||
isnotnull: "Presente",
|
||||
isnull: "Non presente"
|
||||
}
|
||||
}
|
||||
class: "k-text-left"
|
||||
}
|
||||
}
|
||||
},
|
||||
// {
|
||||
// field: "prz_acq",
|
||||
// title: "In Listino",
|
||||
// attributes: {
|
||||
// class: "k-text-center"
|
||||
// },
|
||||
// template(data) {
|
||||
// if (!_.isNil(data.prz_acq)) {
|
||||
// return `<i class="fa fa-check-circle fa_1_5x text-success"></i>`;
|
||||
// }
|
||||
//
|
||||
// return "";
|
||||
// },
|
||||
// filterable: {
|
||||
// operators: {
|
||||
// number: {
|
||||
// isnotnull: "Presente",
|
||||
// isnull: "Non presente"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
]
|
||||
)
|
||||
})
|
||||
@@ -810,10 +836,13 @@ PopupOfferta.prototype.open = function () {
|
||||
.onSuccess(function (ret) {
|
||||
const result = ret.returnData;
|
||||
|
||||
console.log(selectedRow.cod_art_forn);
|
||||
|
||||
const data = {
|
||||
newRow: true,
|
||||
cod_mart: selectedRow.cod_mart,
|
||||
descrizione_art: selectedRow.descrizione,
|
||||
cod_art_forn: selectedRow.cod_art_forn,
|
||||
prz_acq: (result) ? result.prz_acq : 0,
|
||||
perc_1: (result) ? result.perc_1 : 0,
|
||||
perc_2: (result) ? result.perc_2 : 0,
|
||||
@@ -1009,8 +1038,8 @@ PopupOfferta.prototype._initFormEsportazione = function () {
|
||||
PopupOfferta.prototype._onBtGetPdf = function () {
|
||||
let self = this;
|
||||
let key = {
|
||||
cod_alis: self._codAlis,
|
||||
versione: self._versione,
|
||||
codAlis: self._codAlis,
|
||||
idContratto: self._idContratto,
|
||||
dataValidita: moment().unix()
|
||||
};
|
||||
|
||||
@@ -1059,7 +1088,7 @@ PopupOfferta.prototype._onBtInitExport = function () {
|
||||
}), "cod_mart");
|
||||
|
||||
new PopupEsporta()
|
||||
.key({cod_alis: self._codAlis, versione: self._versione})
|
||||
.key({id_contratto: self._idContratto})
|
||||
.eMailList(self._listEmailsFornitore)
|
||||
.productList(productList)
|
||||
.onOpen(function () {
|
||||
|
||||
@@ -92,7 +92,7 @@ const _contrattiDiAcquisto = {
|
||||
"<'panel-footer'<'row'<'col-sm-5'i><'col-sm-7'p>>>",
|
||||
data: self.contratti,
|
||||
columns: [
|
||||
{data: "versione"},
|
||||
{data: "num_off"},
|
||||
{data: "cod_alis"},
|
||||
{data: "descrizione_lisa"},
|
||||
{
|
||||
@@ -210,7 +210,7 @@ const _contrattiDiAcquisto = {
|
||||
orderable: false,
|
||||
render(row) {
|
||||
return `
|
||||
<div class="chartdiv" id="chartdiv-${row.cod_mart + row.cod_vlis + row.versione}"></div>
|
||||
<div class="chartdiv" id="chartdiv-${row.cod_mart + row.cod_vlis + row.num_off}"></div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
@@ -248,7 +248,8 @@ const _contrattiDiAcquisto = {
|
||||
|
||||
new PopupOfferta()
|
||||
.codAlis(contratto.cod_alis)
|
||||
.versione(contratto.versione)
|
||||
.numOff(contratto.num_off)
|
||||
.idContratto(contratto.id_contratto)
|
||||
.open()
|
||||
.then(
|
||||
() => {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
SELECT *
|
||||
FROM atb_offr
|
||||
@@ -0,0 +1,2 @@
|
||||
SELECT *
|
||||
FROM atb_offt
|
||||
@@ -1,8 +1,5 @@
|
||||
SELECT CASE WHEN c = 0 THEN NULL ELSE c END AS c
|
||||
FROM (
|
||||
SELECT COUNT(*) AS c
|
||||
FROM (
|
||||
select distinct versione from avw_contratti_acquisto
|
||||
where is_expiring = 1
|
||||
) t
|
||||
) s
|
||||
FROM (SELECT COUNT(*) AS c
|
||||
FROM (SELECT DISTINCT num_off
|
||||
FROM avw_contratti_acquisto
|
||||
WHERE is_expiring = 1) t) s
|
||||
@@ -1,4 +1,5 @@
|
||||
SELECT contratti.versione,
|
||||
SELECT contratti.id_contratto,
|
||||
contratti.num_off,
|
||||
contratti.cod_alis,
|
||||
contratti.descrizione_lisa,
|
||||
contratti.data_iniz,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
SELECT contratti.cod_mart,
|
||||
SELECT contratti.riga_off,
|
||||
contratti.cod_mart,
|
||||
contratti.descrizione_art,
|
||||
contratti.prz_acq,
|
||||
contratti.perc_1,
|
||||
@@ -15,8 +16,8 @@ SELECT contratti.cod_mart,
|
||||
contratti.qta_ord,
|
||||
contratti.qta_doc,
|
||||
contratti.perc_prov,
|
||||
contratti.val_prov
|
||||
contratti.val_prov,
|
||||
contratti.cod_art_forn
|
||||
FROM avw_contratti_acquisto contratti
|
||||
INNER JOIN mtb_aart ma ON contratti.cod_mart = ma.cod_mart
|
||||
WHERE contratti.cod_alis = '[cod_alis]'
|
||||
AND contratti.versione = [versione]
|
||||
WHERE contratti.id_contratto = '[id_contratto]'
|
||||
@@ -8,11 +8,9 @@ SELECT contratti.cod_anag,
|
||||
contratti.descrizione_lisa,
|
||||
contratti.data_iniz,
|
||||
contratti.data_fine,
|
||||
contratti.versione,
|
||||
contratti.costo_trasp,
|
||||
contratti.num_off,
|
||||
contratti.note,
|
||||
contratti.flag_forn_pref,
|
||||
contratti.cod_mdep
|
||||
FROM avw_contratti_acquisto contratti
|
||||
WHERE contratti.cod_alis = '[cod_alis]'
|
||||
AND contratti.versione = [versione]
|
||||
AND contratti.num_off = [num_off]
|
||||
@@ -9,15 +9,17 @@ WITH TempResult AS (SELECT *
|
||||
ma.rap_conv3,
|
||||
ms.cod_msgr + ' - ' + ms.descrizione AS descrizione_sgrp,
|
||||
msfam.cod_msfa + ' - ' + msfam.descrizione AS descrizione_sfam,
|
||||
lisA.prz_acq
|
||||
lisA.prz_acq,
|
||||
lisA.cod_art_for AS cod_art_forn
|
||||
FROM mtb_aart ma
|
||||
INNER JOIN mtb_sgrp ms ON ma.cod_mgrp = ms.cod_mgrp AND ma.cod_msgr = ms.cod_msgr
|
||||
LEFT OUTER JOIN mtb_sfam msfam
|
||||
ON ma.cod_mgrp = msfam.cod_mgrp AND ma.cod_msgr = msfam.cod_msgr AND
|
||||
ma.cod_msfa = msfam.cod_msfa
|
||||
LEFT OUTER JOIN dbo.getListinoAcquisto(NULL, '[codAlis]', NULL, NULL, 'S', NULL) lisA
|
||||
ON lisA.cod_mart = ma.cod_mart AND lisA.tipo_variazione <> 'D'
|
||||
AND '[codAlis]' IS NOT NULL
|
||||
INNER JOIN dbo.getListinoAcquisto(NULL, '[codAlis]', NULL, NULL, 'S', NULL) lisA
|
||||
ON lisA.cod_mart = ma.cod_mart AND lisA.tipo_variazione <> 'D'
|
||||
AND lisA.flag_attivo = 'S'
|
||||
AND '[codAlis]' IS NOT NULL
|
||||
WHERE flag_stato = 'A'
|
||||
AND (dbo.getGestSetupUser('[userName]', 'PVM', 'PIANO_ARRIVI', 'FILTRO_GRP_MERC') IS NULL OR
|
||||
ma.cod_mgrp IN (SELECT *
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
SELECT atb_forn.cod_anag, gtb_anag.rag_soc, atb_forn.cod_alis
|
||||
FROM atb_forn
|
||||
INNER JOIN gtb_anag ON atb_forn.cod_anag = gtb_anag.cod_anag
|
||||
WHERE atb_forn.flag_stato = 'A'
|
||||
WHERE atb_forn.flag_stato = 'A' and atb_forn.cod_alis is not null
|
||||
|
||||
@@ -29,7 +29,6 @@ SELECT cod_alis,
|
||||
qta_min_ord,
|
||||
data_ult_prezzo,
|
||||
gg_approvig,
|
||||
flag_forn_pref,
|
||||
flag_qta_multipla,
|
||||
tipo_azione,
|
||||
descr_art_forn,
|
||||
@@ -53,7 +52,7 @@ SELECT cod_alis,
|
||||
sconto_stato,
|
||||
partita_mag,
|
||||
flag_prz_base_lisv,
|
||||
convert(varchar, lista_depo),
|
||||
CONVERT(varchar, lista_depo),
|
||||
prz_acq_netto,
|
||||
prz_acq_netto_um,
|
||||
prz_base_lisv,
|
||||
@@ -62,6 +61,5 @@ SELECT cod_alis,
|
||||
cod_vvet,
|
||||
perc_prov,
|
||||
val_prov,
|
||||
qta_acq_contr,
|
||||
costo_trasp
|
||||
qta_acq_contr
|
||||
FROM dbo.getListinoAcquisto(NULL, '[cod_alis]', NULL, '[cod_mart]', 'S', NULL) lis_a
|
||||
@@ -300,13 +300,12 @@ class PianoArrivi {
|
||||
|
||||
if ($isEliminata) {
|
||||
$DtbOrdr->delete();
|
||||
|
||||
} else if (!$data["isOrdTrasf"] && !is_null(array_get($row, "cod_alis"))) {
|
||||
$Ret = self::getRigaListino(array_get($row, "cod_alis"), array_get($row, "cod_art_for"), array_get($head, "cod_mdep"));
|
||||
if ($Ret->is_OK()) {
|
||||
$rigaListino = $Ret->get_data();
|
||||
if (!is_null($rigaListino) && $rigaListino["prz_acq_netto"] !== $row["val_unt"]) {
|
||||
|
||||
if (!is_null($rigaListino) && $rigaListino["prz_acq_netto"] !== $row["val_unt"] && !$row["id_contratto"]) {
|
||||
$MtbLisaData = new EntityItem("mtb_lisa_data");
|
||||
$MtbLisaData->insert_or_update()
|
||||
->set("aggiornatoDa", User::get_current_fullname())
|
||||
@@ -333,13 +332,15 @@ class PianoArrivi {
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
$DtbOrdr->set("qtaOrd", $row["qta_ord"])
|
||||
$DtbOrdr
|
||||
->set("qtaOrd", $row["qta_ord"])
|
||||
->set("flagEvaso", $row["flag_evaso"])
|
||||
->set("valUnt", $row["val_unt"])
|
||||
->set("descrizioneEstesa", $row["descrizione_estesa"])
|
||||
->setDate("dataCons", $row["data_cons"])
|
||||
->set("percProv", $row["perc_prov"])
|
||||
->set("valProv", $row["val_prov"]);
|
||||
->set("valProv", $row["val_prov"])
|
||||
->set("idContratto", $row["id_contratto"]);
|
||||
|
||||
if ($isNuova) {
|
||||
$DtbOrdr->insert()
|
||||
@@ -353,6 +354,7 @@ class PianoArrivi {
|
||||
}
|
||||
|
||||
$Ret = $DtbOrdt->send();
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
if (is_null($key)) {
|
||||
$result = $DtbOrdt->get_result();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<tr data-riga_ord="" data-cod_mart="" data-cod_art_for="" data-cod_alis="" data-unt_ord="" data-deleted="0"
|
||||
data-id_contratto=""
|
||||
data-dirty="0" data-locked="0">
|
||||
<td>
|
||||
<div class="form-group mb-0">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table class="table table-striped table-bordered table-condensed table-hover table-text-middle small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">
|
||||
<th colspan="2" rowspan="2">
|
||||
<input id="filter" type="search" placeholder="Filtra i risultati"
|
||||
class="input-sm form-control font-weight-normal" autocomplete="off"/>
|
||||
</th>
|
||||
@@ -20,8 +20,8 @@
|
||||
<?php if ($flagViewQta) { ?>
|
||||
<th rowspan="2">Q.tà da<br/>contratto</th>
|
||||
<?php } ?>
|
||||
<th colspan="5" class="text-info">Deposito <span class="_codMdep"></span></th>
|
||||
<th rowspan="2" style="width: 90px">Num. consegne</th>
|
||||
<th colspan="6" class="text-info">Deposito <span class="_codMdep"></span></th>
|
||||
<th rowspan="2">Num. consegne</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Scorta min.</th>
|
||||
|
||||
@@ -92,33 +92,48 @@ PopupListino.prototype.open = function () {
|
||||
};
|
||||
|
||||
PopupListino.prototype._retrieveRighe = function () {
|
||||
var self = this;
|
||||
const self = this;
|
||||
const returnData = [];
|
||||
|
||||
var returnData = [];
|
||||
self._modalBox.$div.find("input.ripetizioni").each(function () {
|
||||
var rip = $(this).getNumericValue(true);
|
||||
var codArtFor = $(this).closest("tr").getStringDataAttr("cod_art_for");
|
||||
const rip = $(this).getNumericValue(true);
|
||||
|
||||
if (rip > 0) {
|
||||
var result = Enumerable.From(self._articoli).Where(function (x) {
|
||||
return x.cod_art_for === codArtFor;
|
||||
const codArtFor = $(this).closest("tr").getStringDataAttr("cod_art_for");
|
||||
let idContratto = $(this).closest("tr").getStringDataAttr("id_contratto");
|
||||
|
||||
idContratto = idContratto ? parseInt(idContratto) : null
|
||||
|
||||
const result = Enumerable.From(self._articoli).Where(function (x) {
|
||||
return x.cod_art_for === codArtFor && x.id_contratto === idContratto;
|
||||
}).ToArray();
|
||||
|
||||
if (result.length > 0) {
|
||||
var articolo = result[0];
|
||||
for (var i = 0; i < rip; i++) {
|
||||
const articolo = result[0];
|
||||
|
||||
for (let i = 0; i < rip; i++) {
|
||||
returnData.push(articolo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(returnData);
|
||||
return returnData;
|
||||
};
|
||||
|
||||
PopupListino.prototype._confirmPopup = function () {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
|
||||
console.log("ciao");
|
||||
|
||||
if (is_function(self._onConfirm)) {
|
||||
console.log(self._retrieveRighe());
|
||||
|
||||
self._onConfirm(self._retrieveRighe());
|
||||
}
|
||||
|
||||
self._modalBox.close();
|
||||
};
|
||||
|
||||
@@ -138,9 +153,42 @@ PopupListino.prototype._buildTr = function (item) {
|
||||
|
||||
const flagViewQtaContratto = _pianoArrivi.getModule().get_dataSource("flagViewQtaContratto");
|
||||
|
||||
let $tr = $("<tr>", {class: "cursor-pointer text-unselectable", "data-cod_art_for": item.cod_art_for});
|
||||
$tr.append($("<td>", {html: item.cod_mart + "<br/><span class='small'>" + item.descr_articolo + "</span>"}))
|
||||
.append($("<td>", {class: "text-center", html: item.cod_art_for}))
|
||||
let $tr = $("<tr>", {
|
||||
class: "cursor-pointer text-unselectable",
|
||||
"data-cod_art_for": item.cod_art_for,
|
||||
"data-id_contratto": item.id_contratto
|
||||
});
|
||||
$tr.append($("<td>", {
|
||||
html: item.cod_mart + "<br/><span class='small'>" + item.descr_articolo + "</span>",
|
||||
style: "border-right: 1px solid Transparent !important;"
|
||||
}
|
||||
));
|
||||
|
||||
if (item.id_contratto) {
|
||||
$tr.append($("<td>", {
|
||||
class: "text-center",
|
||||
title: "Presente in Contratto",
|
||||
html: `<i class="fa fa-2x fa-file-contract text-info mt-4 contractInfo"></i>
|
||||
<br><div style="display: inline-block"><b>Dal </b> ${item.data_iniz.unixtime_format("DD/MM/YYYY")}</div>
|
||||
<div style="display: inline-block"><b>Al </b> ${item.data_fine.unixtime_format("DD/MM/YYYY")}</div>`,
|
||||
style: "border-left: 1px solid Transparent !important;"
|
||||
}
|
||||
));
|
||||
} else if (item.cod_promo) {
|
||||
$tr.append($("<td>", {
|
||||
class: "text-center",
|
||||
title: "Presente in Offerta",
|
||||
html: `<i class="fa fa-3x fa-badge-dollar text-warning mt-4"></i>
|
||||
<br><div style="display: inline-block"><b>Dal </b> ${item.data_iniz.unixtime_format("DD/MM/YYYY")}</div>
|
||||
<div style="display: inline-block"><b>Al </b> ${item.data_fine.unixtime_format("DD/MM/YYYY")}</div>`,
|
||||
style: "border-left: 1px solid Transparent !important;"
|
||||
}
|
||||
));
|
||||
} else {
|
||||
$tr.append($("<td>", {style: "border-left: 1px solid Transparent !important;"}));
|
||||
}
|
||||
|
||||
$tr.append($("<td>", {class: "text-center", html: item.cod_art_for}))
|
||||
.append($("<td>", {
|
||||
class: "text-center text-monospace",
|
||||
html: number_format(item.prz_acq_netto, przAcqDigits, ".", "'") + " €"
|
||||
|
||||
@@ -797,6 +797,7 @@ PopupOrdine.prototype._buildRiga = function (riga) {
|
||||
$tr.attr("data-riga_ord", blankIfNull(riga.riga_ord))
|
||||
.attr("data-cod_mart", riga.cod_mart)
|
||||
.attr("data-cod_art_for", riga.cod_art_for)
|
||||
.attr("data-id_contratto", riga.id_contratto)
|
||||
.attr("data-cod_alis", riga.cod_alis)
|
||||
.attr("data-unt_ord", riga.unt_ord);
|
||||
}
|
||||
@@ -1092,6 +1093,10 @@ PopupOrdine.prototype._retrieveRows = function (showToast = true, getAnyway = fa
|
||||
riga.descrizione_estesa = is_null(riga.descrizione_estesa) ? $tr.find("[name='descrizione_estesa']").attr("placeholder") : riga.descrizione_estesa;
|
||||
riga.cod_alis = $tr.getDataAttr("cod_alis");
|
||||
riga.cod_art_for = $tr.getDataAttr("cod_art_for");
|
||||
riga.id_contratto = $tr.getDataAttr("id_contratto");
|
||||
|
||||
console.log($tr.getDataAttr("id_contratto"));
|
||||
|
||||
riga.op = $tr.getBoolDataAttr("deleted") ? "delete" : "update";
|
||||
|
||||
// SOLO PER LE NUOVE
|
||||
|
||||
@@ -1,40 +1,96 @@
|
||||
SELECT lis_a.cod_mart,
|
||||
mtb_aart.descrizione_estesa AS descr_articolo,
|
||||
mtb_aart.descrizione_estesa AS descr_articolo_default,
|
||||
lis_a.cod_art_for,
|
||||
lis_a.cod_alis,
|
||||
lis_a.prz_acq_netto,
|
||||
lis_a.perc_prov,
|
||||
lis_a.val_prov,
|
||||
lis_a.unt_mis_acq,
|
||||
lis_a.qta_min_ord,
|
||||
lis_a.gg_approvig,
|
||||
lis_a.flag_qta_multipla,
|
||||
contratti.qta_acq_contr - contratti.qta_doc - contratti.qta_ord AS qta_contratto,
|
||||
ISNULL(mtb_unt_mis.flag_dig, 'N') AS flag_dig,
|
||||
ISNULL(qta_esistente, 0) - ISNULL(qta_imp_cli, 0) - ISNULL(qta_imp_lav, 0) + ISNULL(qta_ord_for, 0) AS qta_disp,
|
||||
ISNULL(mtb_part.qta_esistente, 0) AS qta_esistente,
|
||||
ISNULL(mtb_part.qta_imp_cli, 0) + ISNULL(mtb_part.qta_imp_lav, 0) AS qta_imp,
|
||||
ISNULL(mtb_part.qta_imp_prox, 0) AS qta_imp_prox,
|
||||
ISNULL(mtb_part.qta_ord_for, 0) AS qta_ord_for,
|
||||
ISNULL(mtb_part.scorta_min, 0) AS scorta_min
|
||||
/* SUM(qta_esistente) AS qta_esistente*/
|
||||
FROM dbo.getListinoAcquisto('[data_validita]', '[cod_alis]', NULL, NULL, 'S', NULL) lis_a
|
||||
LEFT OUTER JOIN avw_contratti_acquisto contratti
|
||||
ON contratti.cod_mart = lis_a.cod_mart
|
||||
AND contratti.cod_alis = lis_a.cod_alis
|
||||
AND contratti.versione = lis_a.versione
|
||||
INNER JOIN mtb_aart ON lis_a.cod_mart = mtb_aart.cod_mart
|
||||
LEFT OUTER JOIN mtb_part ON mtb_aart.cod_mart = mtb_part.cod_mart AND
|
||||
mtb_part.cod_mdep = '[cod_mdep]'
|
||||
LEFT OUTER JOIN mtb_unt_mis ON lis_a.unt_mis_acq = mtb_unt_mis.unt_mis
|
||||
WHERE lis_a.flag_attivo = 'S'
|
||||
AND mtb_aart.flag_stato = 'A'
|
||||
AND ISNULL(lis_a.tipo_variazione, 'I') <> 'D'
|
||||
/*GROUP BY lis_a.cod_mart, mtb_aart.descrizione, lis_a.cod_art_for, lis_a.prz_acq_netto, lis_a.unt_mis_acq, lis_a.qta_min_ord, lis_a.gg_approvig, lis_a.flag_qta_multipla*/
|
||||
AND (dbo.getGestSetupUser('[userName]', 'PVM', 'PIANO_ARRIVI', 'FILTRO_GRP_MERC') IS NULL OR
|
||||
mtb_aart.cod_mgrp IN (SELECT *
|
||||
FROM Dbo.ParseStringIntoArray(
|
||||
(SELECT dbo.getGestSetupUser('[userName]', 'PVM', 'PIANO_ARRIVI',
|
||||
'FILTRO_GRP_MERC')), '|')))
|
||||
ORDER BY lis_a.cod_mart, lis_a.cod_art_for
|
||||
WITH gruppi_merc AS (SELECT mtb_grup.cod_mgrp
|
||||
FROM mtb_grup
|
||||
WHERE (dbo.getGestSetupUser('[userName]', 'PVM', 'PIANO_ARRIVI', 'FILTRO_GRP_MERC') IS NULL OR
|
||||
cod_mgrp IN (SELECT *
|
||||
FROM Dbo.ParseStringIntoArray(
|
||||
(SELECT dbo.getGestSetupUser('[userName]', 'PVM', 'PIANO_ARRIVI',
|
||||
'FILTRO_GRP_MERC')), '|'))))
|
||||
|
||||
, art AS (SELECT lis_a.cod_mart,
|
||||
lis_a.cod_art_for,
|
||||
lis_a.cod_alis,
|
||||
lis_a.prz_acq_netto,
|
||||
lis_a.perc_prov,
|
||||
lis_a.val_prov,
|
||||
lis_a.unt_mis_acq,
|
||||
lis_a.qta_min_ord,
|
||||
lis_a.gg_approvig,
|
||||
lis_a.flag_qta_multipla,
|
||||
CONVERT(numeric(20, 5), 0) AS qta_contratto,
|
||||
ISNULL(qta_esistente, 0) - ISNULL(qta_imp_cli, 0) - ISNULL(qta_imp_lav, 0) +
|
||||
ISNULL(qta_ord_for, 0) AS qta_disp,
|
||||
ISNULL(mtb_part.qta_esistente, 0) AS qta_esistente,
|
||||
ISNULL(mtb_part.qta_imp_cli, 0) + ISNULL(mtb_part.qta_imp_lav, 0) AS qta_imp,
|
||||
ISNULL(mtb_part.qta_imp_prox, 0) AS qta_imp_prox,
|
||||
ISNULL(mtb_part.qta_ord_for, 0) AS qta_ord_for,
|
||||
ISNULL(mtb_part.scorta_min, 0) AS scorta_min,
|
||||
CAST(NULL AS bigint) AS id_contratto,
|
||||
lis_a.cod_promo,
|
||||
lis_a.data_iniz,
|
||||
lis_a.data_fine
|
||||
FROM dbo.getListinoAcquisto('[data_validita]', '[cod_alis]', NULL, NULL, 'S', NULL) lis_a
|
||||
LEFT OUTER JOIN mtb_part ON lis_a.cod_mart = mtb_part.cod_mart AND
|
||||
mtb_part.cod_mdep = '[cod_mdep]'
|
||||
|
||||
WHERE lis_a.flag_attivo = 'S'
|
||||
AND ISNULL(lis_a.tipo_variazione, 'I') <> 'D'
|
||||
UNION ALL
|
||||
SELECT avw_contratti_acquisto.cod_mart,
|
||||
avw_contratti_acquisto.cod_art_forn AS cod_art_for,
|
||||
avw_contratti_acquisto.cod_alis,
|
||||
avw_contratti_acquisto.prz_acq AS prz_acq_netto,
|
||||
avw_contratti_acquisto.perc_prov,
|
||||
avw_contratti_acquisto.val_prov,
|
||||
avw_contratti_acquisto.unt_mis_acq,
|
||||
mtb_lisa.qta_min_ord,
|
||||
mtb_lisa.gg_approvig,
|
||||
mtb_lisa.flag_qta_multipla,
|
||||
qta_saldo AS qta_contratto,
|
||||
0 AS qta_disp,
|
||||
0 AS qta_esistente,
|
||||
0 AS qta_imp,
|
||||
0 AS qta_imp_prox,
|
||||
0 AS qta_ord_for,
|
||||
0 AS scorta_min,
|
||||
id_contratto,
|
||||
NULL AS cod_promo,
|
||||
avw_contratti_acquisto.data_iniz,
|
||||
avw_contratti_acquisto.data_fine
|
||||
FROM avw_contratti_acquisto
|
||||
INNER JOIN mtb_lisa ON avw_contratti_acquisto.cod_alis = mtb_lisa.cod_alis AND
|
||||
avw_contratti_acquisto.cod_art_forn = mtb_lisa.cod_art_for
|
||||
WHERE avw_contratti_acquisto.cod_alis = '[cod_alis]'
|
||||
AND ( avw_contratti_acquisto.is_expiring = 0 OR
|
||||
avw_contratti_acquisto.is_expiring = 1 AND
|
||||
avw_contratti_acquisto.data_fine >= '[data_validita]') )
|
||||
|
||||
SELECT art.cod_mart,
|
||||
mtb_aart.descrizione_estesa AS descr_articolo,
|
||||
mtb_aart.descrizione_estesa AS descr_articolo_default,
|
||||
art.cod_art_for,
|
||||
art.cod_alis,
|
||||
art.prz_acq_netto,
|
||||
art.perc_prov,
|
||||
art.val_prov,
|
||||
art.unt_mis_acq,
|
||||
art.qta_min_ord,
|
||||
art.gg_approvig,
|
||||
art.flag_qta_multipla,
|
||||
ISNULL(mtb_unt_mis.flag_dig, 'N') AS flag_dig,
|
||||
art.qta_contratto,
|
||||
art.qta_disp,
|
||||
art.qta_esistente,
|
||||
art.qta_imp,
|
||||
art.qta_imp_prox,
|
||||
art.qta_ord_for,
|
||||
art.scorta_min,
|
||||
id_contratto,
|
||||
cod_promo,
|
||||
data_iniz,
|
||||
data_fine
|
||||
FROM art
|
||||
INNER JOIN mtb_aart ON art.cod_mart = mtb_aart.cod_mart
|
||||
LEFT OUTER JOIN mtb_unt_mis ON art.unt_mis_acq = mtb_unt_mis.unt_mis
|
||||
WHERE mtb_aart.flag_stato = 'A'
|
||||
AND mtb_aart.cod_mgrp IN (SELECT cod_mgrp FROM gruppi_merc)
|
||||
ORDER BY art.cod_mart, art.cod_art_for, art.data_iniz
|
||||
Reference in New Issue
Block a user