Compare commits
136 Commits
Integry_MR
...
Licor_Moni
| Author | SHA1 | Date | |
|---|---|---|---|
| 96d983a923 | |||
| 8a5be1660f | |||
| 24a5cdefbc | |||
| dd9320d7c9 | |||
| 3c111096c1 | |||
| e6ed487499 | |||
| 96f5478273 | |||
| 5138f8fdd3 | |||
| 0ce750f233 | |||
| af66b3db12 | |||
| 8bfa118543 | |||
| d224d513ea | |||
| 8b262876cc | |||
| 6f293a5459 | |||
| 162a5ecd22 | |||
| c005301fa6 | |||
| a81bca7bce | |||
| 41d9ac4a77 | |||
| 6ab6fbecd7 | |||
| ac5481d386 | |||
| 266c8df54b | |||
| 48006124be | |||
| 9d25af739b | |||
| a5b1a4a67d | |||
| 382b9d5df0 | |||
| c01fa9bdf6 | |||
| 7613a29370 | |||
| 4fca5ccfc9 | |||
| 8cfa6eea88 | |||
| fec4df0477 | |||
| 6e37719db1 | |||
| 7860043a2e | |||
| e6a5c32a77 | |||
| 210668a23f | |||
| 91a3f9f6ee | |||
| 20eb47b07e | |||
| f4cf0b2d43 | |||
| 42831ca8cb | |||
| c856ecc062 | |||
| 650a9285f8 | |||
| d17891bc72 | |||
| 0b9c2ae993 | |||
| a5107e669c | |||
| 05cca03d60 | |||
| da7211026a | |||
| 87fdd92ff9 | |||
| db11b4a719 | |||
| 8fafae725b | |||
| bd1154cf36 | |||
| ec8b3b1e08 | |||
| 61dd8ac8a2 | |||
| 8716bedac1 | |||
| 14786f68e6 | |||
| e57ad565f4 | |||
| 7cc44128ee | |||
| 0455406a52 | |||
| 12e205736c | |||
| 262a6feb0d | |||
| 7a5ee8c9b5 | |||
| ab3bc2fc90 | |||
| 3f2f59cff1 | |||
| 80a1f1dbe7 | |||
| 80e8f4da13 | |||
| 35f8774bf0 | |||
| 94781bef76 | |||
| b469535917 | |||
| 1ed42dda8e | |||
| 9c38b15470 | |||
| a0a2cec00d | |||
| 209d4f7922 | |||
| bca8636e4b | |||
| f4bbea373c | |||
| 847a5c3c63 | |||
| 652c3ba19f | |||
| d970b39ae9 | |||
| ffe760949d | |||
| 28fe701677 | |||
| fc8bc7e53c | |||
| bf74ba1698 | |||
| fa2ecee83b | |||
| 13cb6b86ab | |||
| c6ab8f85c2 | |||
| d8043c7589 | |||
| 59ccc62dc7 | |||
| 3ddc846689 | |||
| 0f83a0fcf2 | |||
| 65889d28a1 | |||
| 07dceb81cb | |||
| 34dc4091c1 | |||
| 5fb0e62d87 | |||
| 051dd901c7 | |||
| d8e1b95fbd | |||
| aa4e81a045 | |||
| 33726fad43 | |||
| a6c5b46794 | |||
| 0080e638c6 | |||
| 7eb571a2a7 | |||
| 0007f5b12f | |||
| 64a81c1888 | |||
| 241df06378 | |||
| 5a46ed9664 | |||
| b4e2f87f5b | |||
| d42641671c | |||
| 6df076518b | |||
| c30eb591bf | |||
| e04d381ce3 | |||
| 10cf9e2888 | |||
| e5c827d96c | |||
| 329fc7d0cb | |||
| 67e44e1d9a | |||
| 292e9f3c39 | |||
| 3c4e5eecc5 | |||
| 73541c2441 | |||
| c9d91630a4 | |||
| e04293fee9 | |||
| 5609a75dd7 | |||
| 277b79be7f | |||
| ece9a34b9e | |||
| 18eda39136 | |||
| d70d5b185b | |||
| f1988627ca | |||
| bb2982f8d5 | |||
| 98e377645d | |||
| 28b7128fcf | |||
| 2fb6a9ed24 | |||
| 3e6ae0439b | |||
| 240bc07a2a | |||
| 50cecba3ae | |||
| 3c936fb16f | |||
| f59aee83f9 | |||
| af08926a4d | |||
| 8e203589d1 | |||
| 7281a5be83 | |||
| 3517e4b0d5 | |||
| 5e54e2494b | |||
| 186749d98a |
23
.idea/pvm.iml
generated
23
.idea/pvm.iml
generated
@@ -3,26 +3,30 @@
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/DULCIAR/monitoraggio_linee_v2" isTestSource="false" packagePrefix="DULCIAR" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/DULCIAR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/magazzino_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2" isTestSource="false" packagePrefix="GRAMM" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LEVANPLAST/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LEVANPLAST" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LICOR" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/modellini/include" isTestSource="false" packagePrefix="Modellini" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/report_area/classes" isTestSource="false" packagePrefix="ReportArea" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/DULCIAR/monitoraggio_linee_v2" isTestSource="false" packagePrefix="DULCIAR" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/DULCIAR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/DULCIAR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/magazzino_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/magazzino_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2" isTestSource="false" packagePrefix="GRAMM" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2" isTestSource="false" packagePrefix="GRAMM" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/GRAMM/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LEVANPLAST/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LEVANPLAST" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LEVANPLAST/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LEVANPLAST" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LICOR" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2" isTestSource="false" packagePrefix="LICOR" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/config_aziende/LICOR/monitoraggio_linee_v2/tipo_prod" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/modellini/include" isTestSource="false" packagePrefix="Modellini" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/modellini/include" isTestSource="false" packagePrefix="Modellini" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/monitoraggio_linee_v2/classes" isTestSource="false" packagePrefix="MonitoraggioLineeV2" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/report_area/classes" isTestSource="false" packagePrefix="ReportArea" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/public_html/gest-lib/report_area/classes" isTestSource="false" packagePrefix="ReportArea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/public_html/cache/*" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/public_html/vendor/vlucas/phpdotenv" />
|
||||
@@ -77,6 +81,5 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="counter" level="application" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -33,6 +33,7 @@ const _arr_aziende = [
|
||||
{n: "sapori_veri", sub: ["dispensa"]},
|
||||
{n: "smetar"},
|
||||
{n: "suit", sub: ["santantonio", "carni_sardegna", "valpietro"]},
|
||||
{n: "tosca_cloud"},
|
||||
{n: "tosca_ce"},
|
||||
{n: "tosca_ba"},
|
||||
{n: "tosca_mi"},
|
||||
|
||||
6708
package-lock.json
generated
6708
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@
|
||||
"number-ticker": "file:public_html/assets/number-ticker",
|
||||
"pre-commit": "^1.2.2",
|
||||
"rimraf": "^4.4.1",
|
||||
"typescript": "^5.0.3"
|
||||
"typescript": "~5.0.3"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
|
||||
@@ -18,7 +18,7 @@ if (isset($methodName) && isset($type)) {
|
||||
$className = ucfirst(camelCaseEncode($data[0]));
|
||||
$newMethodName = $data[1];
|
||||
|
||||
$var = $type ? $_GET : $_POST;
|
||||
$var = $type === "GET" ? $_GET : $_POST;
|
||||
|
||||
$methodValue = $var[$methodName];
|
||||
unset($var[$methodName]);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
(function ($) {
|
||||
$.fn.dropzone = function (options) {
|
||||
if (!this.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const settings = $.extend({
|
||||
onDrop: undefined,
|
||||
dragBackgroundColor: "#e6ffe6",
|
||||
|
||||
22
public_html/classes/Api/RemoteSynchronizationController.php
Normal file
22
public_html/classes/Api/RemoteSynchronizationController.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
class RemoteSynchronizationController extends Api {
|
||||
protected static $group = "system/remote-sync";
|
||||
|
||||
|
||||
public static function publicationsStatus() {
|
||||
$imsApi = self::imsApi();
|
||||
$imsApi->get("publications/status");
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function startPublication($id) {
|
||||
$imsApi = self::imsApi();
|
||||
$id = array_get($id, "id");
|
||||
$imsApi->get("publications/{$id}/start");
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
class RemoteSynchronizationSetupController extends Api {
|
||||
protected static $group = "system/remote-sync/setup";
|
||||
|
||||
|
||||
public static function retrievePublications() {
|
||||
$imsApi = self::imsApi();
|
||||
$imsApi->get("publications/retrieve");
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function insertPublicationGroup($data) {
|
||||
$imsApi = self::imsApi();
|
||||
$imsApi->post("publications/insert-group")
|
||||
->body($data);
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function insertPublicationDetail($data) {
|
||||
$imsApi = self::imsApi();
|
||||
$id = array_get($data, "id_parent");
|
||||
$imsApi->post("publications/{$id}/insert")
|
||||
->body(array_pick($data, array("id", "entityName", "active", "exportHistory", "whereCondSql", "whereCondJava")));
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function editPublicationDetail($data) {
|
||||
$imsApi = self::imsApi();
|
||||
$id = array_get($data, "id");
|
||||
$imsApi->post("publications/{$id}/edit")
|
||||
->body(array_pick($data, array("id", "entityName", "active", "exportHistory", "whereCondSql", "whereCondJava"))
|
||||
);
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function deletePublicationDetail($data) {
|
||||
$imsApi = self::imsApi();
|
||||
$id = array_get($data, "id_parent");
|
||||
$imsApi->post("publications/{$id}/delete")
|
||||
->body(array(
|
||||
"entityName" => array_get($data, "entityName"),
|
||||
"active" => array_get($data, "active"),
|
||||
"exportHistory" => array_get($data, "exportHistory")
|
||||
|
||||
));
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function deletePublicationGroup($id) {
|
||||
$imsApi = self::imsApi();
|
||||
$imsApi->get("publications/$id/delete-group");
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function removePublicationGroup($id) {
|
||||
$imsApi = self::imsApi();
|
||||
$id = array_get($id, "id");
|
||||
$imsApi->post("publications/$id/delete-group");
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -31,4 +31,8 @@ class EntityArray {
|
||||
public function get_children() {
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function count() {
|
||||
return count($this->children);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,18 +78,17 @@ class GestSetupWebUser extends GestSetup {
|
||||
return !is_null($this->gest_name) && !is_null($this->getSection()) && !is_null($this->key_section) && !is_null($this->userName);
|
||||
}
|
||||
|
||||
|
||||
public function getAllBySection() {
|
||||
$Query = new Query;
|
||||
$Query->select("CONVERT(TEXT, value) AS value")
|
||||
$query = new Query;
|
||||
$query->select("key_section, CONVERT(TEXT, value) AS value")
|
||||
->from($this->setupTable)
|
||||
->where("user_name", $this->userName)
|
||||
->where("section", $this->getSection())
|
||||
->where("gest_name", $this->gest_name);
|
||||
$Ret = $Query->firstRowFirstValue()->toRet()->execute();
|
||||
|
||||
$value = $Ret->is_OK() ? $Ret->get_data() : null;
|
||||
$ret = $query->toRet()->execute();
|
||||
$value = $ret->is_OK() ? $ret->get_data() : null;
|
||||
|
||||
return $this->parseValue($value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -112,8 +112,7 @@ class MtbAartLink {
|
||||
|
||||
public static function upload($codMart, $fileItems) {
|
||||
$Ret = new Ret;
|
||||
|
||||
$fileItems = \Utility\File::rearrangeFilesArray($fileItems["files"]);
|
||||
$fileItems = \Utility\File::rearrangeFilesArray(array_get($fileItems, "files", $fileItems));
|
||||
|
||||
foreach ($fileItems as $fileItem) {
|
||||
if (file_exists($fileItem["tmp_name"])) {
|
||||
|
||||
@@ -58,25 +58,37 @@ class StbActivityFile {
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function upload($activityId, $fileItem, $profileDb = null, $getItem = true) {
|
||||
public static function upload($activityId, $fileItems, $profileDb = null, $getItem = true) {
|
||||
$Ret = new Ret;
|
||||
if (file_exists($fileItem["tmp_name"])) {
|
||||
if (is_array($activityId)) {
|
||||
foreach ($activityId as $id) {
|
||||
if ($Ret->is_KO()) {
|
||||
break;
|
||||
$fileItems = \Utility\File::rearrangeFilesArray($fileItems["files"]);
|
||||
$attachments = array();
|
||||
|
||||
foreach ($fileItems as $fileItem) {
|
||||
if (file_exists($fileItem["tmp_name"])) {
|
||||
if (is_array($activityId)) {
|
||||
foreach ($activityId as $id) {
|
||||
if ($Ret->is_KO()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$Ret = self::saveFile($id, $fileItem, true, $profileDb, $getItem);
|
||||
}
|
||||
$Ret = self::saveFile($id, $fileItem, true, $profileDb, $getItem);
|
||||
} else {
|
||||
$Ret = self::saveFile($activityId, $fileItem, true, $profileDb, $getItem);
|
||||
}
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
$retData = $Ret->get_data();
|
||||
$attachments[] = $retData;
|
||||
@unlink($fileItem["tmp_name"]);
|
||||
}
|
||||
} else {
|
||||
$Ret = self::saveFile($activityId, $fileItem, true, $profileDb, $getItem);
|
||||
}
|
||||
if ($Ret->is_OK()) {
|
||||
@unlink($fileItem["tmp_name"]);
|
||||
$Ret->set_error("File non trovato");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$Ret->set_error("File non trovato");
|
||||
if (count($attachments) > 0) {
|
||||
$Ret->set_data($attachments);
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
|
||||
@@ -2268,7 +2268,9 @@
|
||||
"title": "Listini di vendita",
|
||||
"pages": "listini_vendita.php",
|
||||
"position": [],
|
||||
"children": [],
|
||||
"children": [
|
||||
"modal_selezione_articoli"
|
||||
],
|
||||
"icon": "icon.png",
|
||||
"libs": [
|
||||
"std-pkg",
|
||||
@@ -2289,5 +2291,18 @@
|
||||
"kendo"
|
||||
],
|
||||
"requirePermission": true
|
||||
},
|
||||
"sincronizzazioni": {
|
||||
"title": "Sincronizzazioni",
|
||||
"pages": "sincronizzazioni.php",
|
||||
"position": [],
|
||||
"children": [],
|
||||
"icon": "icon.png",
|
||||
"libs": [
|
||||
"std-pkg",
|
||||
"kendo",
|
||||
"visibility"
|
||||
],
|
||||
"requirePermission": true
|
||||
}
|
||||
}
|
||||
@@ -1642,7 +1642,7 @@ export default class RossogargAnalisiBudget extends AnalisiBudget {
|
||||
const command = $(e.item).data("command");
|
||||
|
||||
try {
|
||||
let ret: PVM.IRet = null;
|
||||
let ret: PVM.IRet<unknown> = null;
|
||||
|
||||
switch (command) {
|
||||
case "assignCodMartStat": {
|
||||
@@ -1715,7 +1715,7 @@ export default class RossogargAnalisiBudget extends AnalisiBudget {
|
||||
const command = $(e.item).data("command");
|
||||
|
||||
try {
|
||||
let ret: PVM.IRet = null;
|
||||
let ret: PVM.IRet<unknown> = null;
|
||||
|
||||
switch (command) {
|
||||
case "assignCodMartStat": {
|
||||
@@ -2071,7 +2071,7 @@ export default class RossogargAnalisiBudget extends AnalisiBudget {
|
||||
.post("assignCodMartStat")
|
||||
.data({articoli: articoli.flatMap(articolo => articolo.cod_mart), codMart})
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<void>();
|
||||
}
|
||||
|
||||
async addArtInBdg(data: { idBdg: number, codAnag: string, codMart: string }) {
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
import BasePopup from "@js/BasePopup.js";
|
||||
import {MtbColt, OperationType, VtbVett, VtbViaggi} from "@js/ims/ems-core.module.js";
|
||||
import {getListVettori} from "@js/api/stdutils.js";
|
||||
import {Mezzo, OperationType, VtbVett, VtbViaggi} from "@js/ims/ems-core.module.js";
|
||||
import {getListAutomezzi, getListVettori} from "@js/api/stdutils.js";
|
||||
|
||||
export class CreaViaggioForm extends kendo.data.Model.define({}) {
|
||||
export class CreaViaggioForm implements kendo.ui.FormData {
|
||||
codAuto: string;
|
||||
codVvet: string;
|
||||
codVzon: string;
|
||||
dataOraInizTrasp: Date;
|
||||
flagRitirClie: boolean;
|
||||
idViaggio: string;
|
||||
note: string;
|
||||
targa: string;
|
||||
numPrenotazione: string;
|
||||
mezzo: Mezzo;
|
||||
|
||||
constructor(data: VtbViaggi = null) {
|
||||
super(data);
|
||||
|
||||
this.codAuto = data?.codAuto;
|
||||
this.codVvet = data?.codVvet;
|
||||
this.codVzon = data?.codVzon;
|
||||
this.dataOraInizTrasp = data?.dataOraInizTrasp;
|
||||
this.flagRitirClie = data?.flagRitirClie || false;
|
||||
this.idViaggio = data?.idViaggio;
|
||||
this.note = data?.note;
|
||||
this.targa = data?.targa;
|
||||
this.numPrenotazione = data?.numPrenotazione;
|
||||
this.mezzo = data?.mezzo || Mezzo.VETTORE;
|
||||
}
|
||||
}
|
||||
|
||||
export default class PopupCreaViaggio extends BasePopup {
|
||||
export default class PopupCreaViaggio extends BasePopup<VtbViaggi> {
|
||||
private readonly formData: CreaViaggioForm
|
||||
private kendoForm: kendo.ui.Form
|
||||
private promise: Promise<VtbViaggi>
|
||||
@@ -85,7 +87,7 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
this.$okBtn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
this.promise = this.creaViaggio(e.model as CreaViaggioForm);
|
||||
this.promise = this.creaViaggio(e.model as any);
|
||||
|
||||
if (await this.promise) {
|
||||
this.modalBox.close();
|
||||
@@ -100,11 +102,81 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
gutter: 10
|
||||
},
|
||||
items: [
|
||||
{
|
||||
field: "mezzo",
|
||||
label: "Mezzo",
|
||||
title: "Mezzo",
|
||||
colSpan: 1,
|
||||
editor: "DropDownList",
|
||||
editorOptions: {
|
||||
dataTextField: "text",
|
||||
dataValueField: "value",
|
||||
optionLabel: {
|
||||
value: null,
|
||||
text: "Seleziona il mezzo"
|
||||
},
|
||||
dataBound: (e: kendo.ui.DropDownListDataBoundEvent) => e.sender.list.find(".k-list-optionlabel").hide(),
|
||||
dataSource: [
|
||||
{
|
||||
value: Mezzo.VETTORE,
|
||||
text: "Vettore"
|
||||
},
|
||||
{
|
||||
value: Mezzo.MITTENTE,
|
||||
text: "Mittente"
|
||||
},
|
||||
{
|
||||
value: Mezzo.DESTINATARIO,
|
||||
text: "Destinatario"
|
||||
},
|
||||
],
|
||||
change: (e: kendo.ui.DropDownListChangeEvent) => {
|
||||
const value = e.sender.value();
|
||||
|
||||
if (value) {
|
||||
const vettDropDownList = this.modalBox.$div.find("[name='codVvet']").data("kendoDropDownList");
|
||||
const autoDropDownList = this.modalBox.$div.find("[name='codAuto']").data("kendoDropDownList");
|
||||
|
||||
switch (parseInt(value)) {
|
||||
case Mezzo.VETTORE:
|
||||
vettDropDownList.element.parents(".k-form-field").show();
|
||||
autoDropDownList.element.parents(".k-form-field").hide();
|
||||
|
||||
autoDropDownList.value("");
|
||||
autoDropDownList.trigger("change");
|
||||
|
||||
break;
|
||||
case Mezzo.MITTENTE:
|
||||
vettDropDownList.element.parents(".k-form-field").hide();
|
||||
autoDropDownList.element.parents(".k-form-field").show();
|
||||
|
||||
vettDropDownList.value("");
|
||||
vettDropDownList.trigger("change");
|
||||
|
||||
break;
|
||||
case Mezzo.DESTINATARIO:
|
||||
vettDropDownList.element.parents(".k-form-field").hide();
|
||||
autoDropDownList.element.parents(".k-form-field").hide();
|
||||
|
||||
vettDropDownList.value("");
|
||||
vettDropDownList.trigger("change");
|
||||
autoDropDownList.value("");
|
||||
autoDropDownList.trigger("change");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} as kendo.ui.DropDownListOptions
|
||||
},
|
||||
{
|
||||
field: "codVvet",
|
||||
label: "Vettore",
|
||||
title: "Vettore",
|
||||
colSpan: 1,
|
||||
attributes: {
|
||||
class: "hide-form"
|
||||
},
|
||||
editor: "DropDownList",
|
||||
editorOptions: {
|
||||
filter: "contains",
|
||||
@@ -145,9 +217,7 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
|
||||
return $btn;
|
||||
},
|
||||
dataBound: (e) => {
|
||||
e.sender.list.find(".k-list-optionlabel").hide();
|
||||
},
|
||||
dataBound: (e) => e.sender.list.find(".k-list-optionlabel").text("Rimuovi"),
|
||||
dataSource: {
|
||||
sort: {
|
||||
field: "ragSoc",
|
||||
@@ -182,37 +252,88 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
const value = e.sender.value();
|
||||
|
||||
if (value) {
|
||||
const flagRitirClie = this.modalBox.$div.find("[name='flagRitirClie']").data("kendoSwitch");
|
||||
const autoDropDownList = this.modalBox.$div.find("[name='codAuto']").data("kendoDropDownList");
|
||||
|
||||
flagRitirClie.check(false);
|
||||
flagRitirClie.trigger("change");
|
||||
autoDropDownList.value("");
|
||||
autoDropDownList.trigger("change");
|
||||
}
|
||||
}
|
||||
} as kendo.ui.DropDownListOptions,
|
||||
},
|
||||
{
|
||||
field: "flagRitirClie",
|
||||
label: "Ritiro Cliente",
|
||||
title: "Ritiro Cliente",
|
||||
field: "codAuto",
|
||||
label: "Automezzo",
|
||||
title: "Automezzo",
|
||||
colSpan: 1,
|
||||
editor: "Switch",
|
||||
editor: "DropDownList",
|
||||
attributes: {
|
||||
class: "hide-form"
|
||||
},
|
||||
editorOptions: {
|
||||
messages: {
|
||||
checked: "Si",
|
||||
unchecked: "No"
|
||||
filter: "contains",
|
||||
dataTextField: "descrizione",
|
||||
dataValueField: "codAuto",
|
||||
optionLabel: "Seleziona l'automezzo",
|
||||
valuePrimitive: true,
|
||||
dataBound: (e) => e.sender.list.find(".k-list-optionlabel").text("Rimuovi"),
|
||||
dataSource: {
|
||||
sort: {
|
||||
field: "descrizione",
|
||||
dir: "asc"
|
||||
},
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
try {
|
||||
const ret = await getListAutomezzi();
|
||||
|
||||
options.success(ret);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
options.error(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: {
|
||||
model: {
|
||||
id: "codAuto",
|
||||
}
|
||||
}
|
||||
},
|
||||
change: (e: kendo.ui.SwitchChangeEvent) => {
|
||||
const checked = e.sender.check();
|
||||
change: (e: kendo.ui.DropDownListChangeEvent) => {
|
||||
const value = e.sender.value();
|
||||
|
||||
if (checked) {
|
||||
const codVvet = this.modalBox.$div.find("[name='codVvet']").data("kendoDropDownList");
|
||||
if (value) {
|
||||
const vvetDropDownList = this.modalBox.$div.find("[name='codVvet']").data("kendoDropDownList");
|
||||
|
||||
codVvet.value("");
|
||||
codVvet.trigger("change");
|
||||
vvetDropDownList.value("");
|
||||
vvetDropDownList.trigger("change");
|
||||
}
|
||||
}
|
||||
} as kendo.ui.SwitchOptions,
|
||||
} as kendo.ui.DropDownListOptions,
|
||||
},
|
||||
// {
|
||||
// field: "flagRitirClie",
|
||||
// label: "Ritiro Cliente",
|
||||
// title: "Ritiro Cliente",
|
||||
// colSpan: 1,
|
||||
// editor: "Switch",
|
||||
// editorOptions: {
|
||||
// messages: {
|
||||
// checked: "Si",
|
||||
// unchecked: "No"
|
||||
// },
|
||||
// change: (e: kendo.ui.SwitchChangeEvent) => {
|
||||
// const checked = e.sender.check();
|
||||
//
|
||||
// if (checked) {
|
||||
// const codVvet = this.modalBox.$div.find("[name='codVvet']").data("kendoDropDownList");
|
||||
//
|
||||
// codVvet.value("");
|
||||
// codVvet.trigger("change");
|
||||
// }
|
||||
// }
|
||||
// } as kendo.ui.SwitchOptions,
|
||||
// },
|
||||
{
|
||||
field: "dataOraInizTrasp",
|
||||
label: "Data Inizio Trasporto",
|
||||
@@ -220,7 +341,7 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
colSpan: 2,
|
||||
editor: "DateTimePicker",
|
||||
editorOptions: {
|
||||
min: this.formData.dataOraInizTrasp
|
||||
min: moment(this.formData.dataOraInizTrasp).startOf("day").toDate()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -241,7 +362,7 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
editor: "TextBox",
|
||||
},
|
||||
{
|
||||
field: "num_prenotazione",
|
||||
field: "numPrenotazione",
|
||||
label: "Num. Prenotazione",
|
||||
title: "Num. Prenotazione",
|
||||
colSpan: 2,
|
||||
@@ -250,6 +371,25 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
]
|
||||
}).data("kendoForm");
|
||||
|
||||
this.kendoForm.element.find(".hide-form").parents(".k-form-field").hide();
|
||||
|
||||
let elToShow = null;
|
||||
|
||||
switch (this.formData.mezzo) {
|
||||
case Mezzo.VETTORE:
|
||||
elToShow = "codVvet";
|
||||
|
||||
break;
|
||||
case Mezzo.MITTENTE:
|
||||
elToShow = "codAuto";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (elToShow) {
|
||||
this.kendoForm.element.find(`#${elToShow}`).parents(".k-form-field").show();
|
||||
}
|
||||
|
||||
// this.kendoForm.validator.setOptions({
|
||||
// rules: {
|
||||
// requiredIf: (input: JQuery<HTMLElement>) => {
|
||||
@@ -266,10 +406,6 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
// } as kendo.ui.ValidatorOptions)
|
||||
}
|
||||
|
||||
async open(): Promise<VtbViaggi> {
|
||||
return super.open();
|
||||
}
|
||||
|
||||
async creaViaggio(data: CreaViaggioForm): Promise<VtbViaggi> {
|
||||
const ret = await this.ajax()
|
||||
.get("creaViaggio")
|
||||
@@ -278,7 +414,7 @@ export default class PopupCreaViaggio extends BasePopup {
|
||||
.execute();
|
||||
|
||||
return {
|
||||
...this.formData.toJSON(),
|
||||
...data,
|
||||
...ret?.returnData[0].entity
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import BasePopup from "@js/BasePopup.js";
|
||||
import groupBy from "lodash-es/groupBy.js";
|
||||
import Moment = moment.Moment;
|
||||
import PopupCreaViaggio from "@config-aziende/ROSSOGARGANO/delivery_plan/PopupCreaViaggio.module.js";
|
||||
import {VtbViaggi} from "@js/ims/ems-core.module.js";
|
||||
import {Mezzo, VtbViaggi} from "@js/ims/ems-core.module.js";
|
||||
import {numberStyle, numberToColor} from "@js/utils.js";
|
||||
import round from "lodash-es/round.js";
|
||||
import mapKeys from "lodash-es/mapKeys.js";
|
||||
@@ -20,12 +20,15 @@ export class Riepilogo extends kendo.data.Model.define({
|
||||
data_ora_iniz_trasp: {type: "date"},
|
||||
cod_vvet: {type: "string"},
|
||||
vettore: {type: "string"},
|
||||
cod_auto: {type: "string"},
|
||||
automezzo: {type: "string"},
|
||||
flag_ritir_clie: {type: "string"},
|
||||
note_viag: {type: "string"},
|
||||
gestione: {type: "string"},
|
||||
data_ord: {type: "date"},
|
||||
num_ord: {type: "number"},
|
||||
riga_ord: {type: "number"},
|
||||
pos_riga: {type: "number"},
|
||||
precode: {type: "string"},
|
||||
cod_anag: {type: "string"},
|
||||
rag_soc: {type: "string"},
|
||||
@@ -35,6 +38,7 @@ export class Riepilogo extends kendo.data.Model.define({
|
||||
cod_mart: {type: "string"},
|
||||
descrizione: {type: "string"},
|
||||
cod_mdep: {type: "string"},
|
||||
posti_pallet: {type: "number"},
|
||||
pedane_ord: {type: "number"},
|
||||
num_cnf: {type: "number"},
|
||||
colli_pedana: {type: "number"},
|
||||
@@ -54,14 +58,18 @@ export class Riepilogo extends kendo.data.Model.define({
|
||||
data_ora_iniz_trasp: Date
|
||||
cod_vvet: string
|
||||
vettore: string
|
||||
cod_auto: string
|
||||
automezzo: string
|
||||
note_viag: string
|
||||
flag_ritir_clie: string
|
||||
targa: string
|
||||
num_prenotazione: string
|
||||
note_viag: string
|
||||
mezzo: Mezzo
|
||||
gestione: string
|
||||
data_ord: Date
|
||||
num_ord: number
|
||||
riga_ord: number
|
||||
pos_riga: number
|
||||
precode: string
|
||||
cod_anag: string
|
||||
rag_soc: string
|
||||
@@ -72,6 +80,7 @@ export class Riepilogo extends kendo.data.Model.define({
|
||||
descrizione: string
|
||||
cod_mdep: string
|
||||
depositi: Array<{ cod_mdep: string, descrizione: string, qta_esistente: number, unt_mis: string }>
|
||||
posti_pallet: number
|
||||
pedane_ord: number
|
||||
num_cnf: number
|
||||
colli_pedana: number
|
||||
@@ -107,6 +116,14 @@ const aggregates = [
|
||||
field: "rif_ord",
|
||||
aggregate: "min"
|
||||
},
|
||||
{
|
||||
field: "posti_pallet",
|
||||
aggregate: "min"
|
||||
},
|
||||
{
|
||||
field: "pedane_ord",
|
||||
aggregate: "sum"
|
||||
},
|
||||
{
|
||||
field: "destinazione",
|
||||
aggregate: "min"
|
||||
@@ -273,6 +290,11 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
|
||||
async loadRiepiloghi(keepScrollPos = true) {
|
||||
const isEditable = this.isEditable();
|
||||
const onSave = async (grid: kendo.ui.Grid) => {
|
||||
await timeout(250);
|
||||
|
||||
await grid.dataSource.sync();
|
||||
}
|
||||
|
||||
const scrollTop = this.modalBox.$div.find(".modal-body").scrollTop();
|
||||
|
||||
@@ -305,7 +327,7 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
const columns = _kendo.setDefaultCellOptions([
|
||||
{
|
||||
id: "e2dd706a-ec44-4f69-896b-7330c15e7b2f",
|
||||
title: firstRiepilogo.data_ora_iniz_trasp && `Ora Partenza: ${moment(riepiloghi[0].data_ora_iniz_trasp).format("HH:mm")}` || "",
|
||||
title: firstRiepilogo.data_ora_iniz_trasp && `ID: ${firstRiepilogo.id_viaggio}<br>ORA PARTENZA: ${moment(firstRiepilogo.data_ora_iniz_trasp).format("HH:mm")}` || "",
|
||||
columns: [
|
||||
{
|
||||
id: "7e281934-0241-4f35-98cf-f5e6df253eef",
|
||||
@@ -315,31 +337,54 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
attributes: {
|
||||
"class": "td-hidden"
|
||||
},
|
||||
groupHeaderTemplate: ({id_ord, precode, rag_soc, rif_ord, destinazione, note_ord}) => {
|
||||
groupHeaderTemplate: ({
|
||||
id_ord,
|
||||
precode,
|
||||
rag_soc,
|
||||
rif_ord,
|
||||
posti_pallet,
|
||||
pedane_ord,
|
||||
destinazione,
|
||||
note_ord
|
||||
}) => {
|
||||
const data = id_ord.min.split("~");
|
||||
|
||||
// language=HTML
|
||||
return [
|
||||
`
|
||||
<td>
|
||||
${data[2]}
|
||||
/${moment(data[1]).format("YY")}${precode.min && `<br>(${precode.min})` || ""}
|
||||
${data[2]}/${moment(data[1]).format("YY")}
|
||||
${precode.min && `<br>(${precode.min})` || ""}
|
||||
</td>`,
|
||||
`
|
||||
<td>
|
||||
${rag_soc.min}${destinazione.min && `<br>${destinazione.min}` || ""}
|
||||
</td>`,
|
||||
`
|
||||
<td colspan="5">
|
||||
<td colspan="2">
|
||||
${rif_ord.min && `RIF. ORDINE: ${rif_ord.min}` || ""}
|
||||
|
||||
<button class="attachments ml-10" type="button"
|
||||
title="Allegati"></button>
|
||||
</td>`,
|
||||
`
|
||||
<td
|
||||
class="!k-text-center ${posti_pallet.min && posti_pallet.min !== pedane_ord.sum && "!k-text-warning" || ""} togglePostiPallet"
|
||||
title="${posti_pallet.min && posti_pallet.min !== pedane_ord.sum && "Diverso dalla somma delle pedane\n" || ""}Clicca per modificare">
|
||||
${numberStyle(posti_pallet.min || pedane_ord.sum)}
|
||||
<input class="hidden"
|
||||
data-change="${_ojbc.B64JSON_stringify({
|
||||
component: "kendoTextBox",
|
||||
field: "posti_pallet",
|
||||
})}"
|
||||
title="Pedane" value="${posti_pallet.min || pedane_ord.sum}">
|
||||
</td>`,
|
||||
`
|
||||
<td colspan="2"></td>`,
|
||||
`
|
||||
<td class="toggleNoteOrd" title="Clicca per modificare">
|
||||
<span>${note_ord.min || ""}</span>
|
||||
<input type="text" class="hidden" data-change="noteOrd"
|
||||
<input class="hidden" data-change="note_ord"
|
||||
title="Note" value="${note_ord.min || ""}">`
|
||||
].join("");
|
||||
},
|
||||
@@ -349,9 +394,12 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
},
|
||||
{
|
||||
id: "3bb73886-f814-4701-ae6a-a3543a39241f",
|
||||
title: [
|
||||
firstRiepilogo.vettore && `Vettore: ${firstRiepilogo.vettore}` || firstRiepilogo.flag_ritir_clie && "LORO" || "Vettore non assegnato",
|
||||
firstRiepilogo.targa && `Targa ${firstRiepilogo.targa}` || firstRiepilogo.num_prenotazione || ""
|
||||
title: !firstRiepilogo.id_viaggio && "VIAGGIO NON ASSEGNATO" || [
|
||||
firstRiepilogo.mezzo === Mezzo.VETTORE && (firstRiepilogo.vettore && `VETTORE: ${firstRiepilogo.vettore}` || "VETTORE NON ASSEGNATO") ||
|
||||
firstRiepilogo.mezzo === Mezzo.MITTENTE && ("CONSEGNA CON NOSTRO MEZZO"
|
||||
+ (firstRiepilogo.automezzo && `<br>MEZZO: ${firstRiepilogo.automezzo}` || "")) ||
|
||||
firstRiepilogo.mezzo === Mezzo.DESTINATARIO && "RITIRA IL CLIENTE" || "",
|
||||
firstRiepilogo.targa && `TARGA ${firstRiepilogo.targa}` || firstRiepilogo.num_prenotazione || ""
|
||||
].join("<br>"),
|
||||
columns: [
|
||||
{
|
||||
@@ -377,7 +425,7 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
},
|
||||
{
|
||||
id: "7e54b38c-2271-424f-8d7f-6e484bae5dca",
|
||||
title: firstRiepilogo.note_viag && `Note: ${firstRiepilogo.note_viag}` || "",
|
||||
title: firstRiepilogo.note_viag && `${firstRiepilogo.note_viag.replaceAll("\n", "<br>")}` || "",
|
||||
columns: [
|
||||
{
|
||||
id: "eda00bf7-aa54-4675-94db-af1afb71e834",
|
||||
@@ -406,7 +454,9 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
// language=HTML
|
||||
return `
|
||||
${data.descrizione}<br>
|
||||
Giacenza ${numberStyle(data.qta_esistente, undefined, "", data.unt_mis)}`;
|
||||
Giacenza ${numberStyle(data.qta_esistente, undefined, {
|
||||
postfix: data.unt_mis
|
||||
})}`;
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -533,7 +583,7 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
dir: "asc"
|
||||
},
|
||||
{
|
||||
field: "riga_ord",
|
||||
field: "pos_riga",
|
||||
dir: "asc"
|
||||
}
|
||||
],
|
||||
@@ -568,68 +618,83 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$dataChangeElements.kendoTextBox({
|
||||
change: async (e: kendo.ui.TextBoxChangeEvent) => {
|
||||
const textBox = e.sender;
|
||||
const table = textBox.element.parents(".k-grid").data("kendoGrid");
|
||||
$dataChangeElements.each((index, el) => {
|
||||
const definition = _ojbc.B64JSON_parse($(el).attr("data-change")) || $(el).attr("data-change");
|
||||
|
||||
const riepiloghi = textBox.element.parents(".k-grouping-row").nextUntil(".k-grouping-row").map((_, el) => table.dataItem(el)).toArray() as Array<Riepilogo>;
|
||||
const riepilogo = riepiloghi[0];
|
||||
($(el) as any)[definition?.component || "kendoTextBox"]({
|
||||
...(definition?.options || {}),
|
||||
change: async (e: kendo.ui.TextBoxChangeEvent) => {
|
||||
const textBox = e.sender;
|
||||
const table = textBox.element.parents(".k-grid").data("kendoGrid");
|
||||
|
||||
riepilogo.set("note_ord", textBox.value());
|
||||
const riepiloghi = textBox.element.parents(".k-grouping-row").nextUntil(".k-grouping-row").map((_, el) => table.dataItem(el)).toArray() as Array<Riepilogo>;
|
||||
const riepilogo = riepiloghi[0];
|
||||
|
||||
// grid.saveChanges();
|
||||
riepilogo.set(definition?.field || definition, textBox.value());
|
||||
|
||||
// await this.loadRiepiloghi();
|
||||
}
|
||||
grid.dataSource.sync();
|
||||
|
||||
await this.loadRiepiloghi();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (isEditable) {
|
||||
e.sender.element.find(".toggleNoteOrd").on("click focusout", (e) => {
|
||||
e.sender.element.find("[data-change]").parents("td").on("click focusout", (e) => {
|
||||
const $children = $(e.currentTarget).children();
|
||||
|
||||
$children.toggleClass("hidden");
|
||||
$children.children().toggleClass("hidden");
|
||||
$children.children("input").toggleClass("hidden");
|
||||
});
|
||||
}
|
||||
|
||||
e.sender.tbody.children().each(function (_index, row) {
|
||||
const $row = $(row);
|
||||
e.sender.tbody.children()
|
||||
.filter((index, row) => $(row).hasClass("k-grouping-row"))
|
||||
.each(function (_index, row) {
|
||||
const $row = $(row);
|
||||
|
||||
const dataItem = e.sender.dataItem($row) as Riepilogo;
|
||||
const dataItem = e.sender.dataItem($row) as Riepilogo;
|
||||
|
||||
if (!["PF", "SL"].includes(dataItem.tipo_mgrp)) {
|
||||
$row.addClass("hidden");
|
||||
} else if (dataItem.gruppo_cons) {
|
||||
$row.find(".col-pedane").css("background-color", numberToColor(parseInt(dataItem.gruppo_cons))).text("DA FARE");
|
||||
}
|
||||
const $attachmentBtn = $row.find(".attachments");
|
||||
|
||||
const $attachmentBtn = $row.find(".attachments");
|
||||
if ($attachmentBtn.length) {
|
||||
const attachmentButton = $attachmentBtn.kendoButton({
|
||||
icon: "- fal fa-paperclip fa-flip-vertical",
|
||||
badge: {
|
||||
text: dataItem.n_allegati
|
||||
},
|
||||
click: async (e: kendo.ui.ButtonClickEvent) => {
|
||||
await new ModalAllegati()
|
||||
.sourceTypes([_allegati.sourceTypes.ORDCOM])
|
||||
.allowUpload(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.allowDelete(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.editableDescription(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.gestione(dataItem.gestione)
|
||||
.dataOrd(moment(dataItem.data_ord).unix())
|
||||
.numOrd(dataItem.num_ord)
|
||||
.$button(e.sender.element)
|
||||
.onChange(function (c) {
|
||||
(attachmentButton as any)._badge(c);
|
||||
})
|
||||
.open();
|
||||
}
|
||||
}).data("kendoButton");
|
||||
}
|
||||
});
|
||||
|
||||
if ($attachmentBtn.length) {
|
||||
const attachmentButton = $attachmentBtn.kendoButton({
|
||||
icon: "- fal fa-paperclip fa-flip-vertical",
|
||||
badge: {
|
||||
text: dataItem.n_allegati
|
||||
},
|
||||
click: async (e: kendo.ui.ButtonClickEvent) => {
|
||||
await new ModalAllegati()
|
||||
.sourceTypes([_allegati.sourceTypes.ORDCOM])
|
||||
.allowUpload(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.allowDelete(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.editableDescription(isEditable && [_allegati.sourceTypes.ORDCOM] || [])
|
||||
.gestione(dataItem.gestione)
|
||||
.dataOrd(moment(dataItem.data_ord).unix())
|
||||
.numOrd(dataItem.num_ord)
|
||||
.$button(e.sender.element)
|
||||
.onChange(function (c) {
|
||||
(attachmentButton as any)._badge(c);
|
||||
})
|
||||
.open();
|
||||
}
|
||||
}).data("kendoButton");
|
||||
}
|
||||
});
|
||||
e.sender.tbody.children()
|
||||
.filter((index, row) => !$(row).hasClass("k-grouping-row"))
|
||||
.each(function (_index, row) {
|
||||
const $row = $(row);
|
||||
|
||||
const dataItem = e.sender.dataItem($row) as Riepilogo;
|
||||
|
||||
if (!["PF", "SL"].includes(dataItem.tipo_mgrp)) {
|
||||
$row.addClass("hidden");
|
||||
} else if (dataItem.gruppo_cons) {
|
||||
$row.find(".col-pedane").css("background-color", numberToColor(parseInt(dataItem.gruppo_cons))).text("DA FARE");
|
||||
}
|
||||
});
|
||||
|
||||
// $(".k-grouping-row").each(function () {
|
||||
// const groupKey = rowGroupKey($(this), e.sender);
|
||||
@@ -645,6 +710,10 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
if (e.values?.colli_pedana) {
|
||||
riepilogo.set("pedane_ord", round(riepilogo.num_cnf / e.values?.colli_pedana, 0));
|
||||
}
|
||||
|
||||
if (riepilogo.dirty) {
|
||||
onSave(e.sender);
|
||||
}
|
||||
}
|
||||
})
|
||||
.data("kendoGrid");
|
||||
@@ -804,6 +873,10 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
if (!riepilogo.get("cod_mdep") && riepilogo.depositi?.length === 1) {
|
||||
riepilogo.set("cod_mdep", riepilogo.depositi[0].cod_mdep);
|
||||
}
|
||||
|
||||
if (!riepilogo.get("posti_pallet")) {
|
||||
riepilogo.set("posti_pallet", riepiloghi.reduce((pedaneOrd, riepilogo) => pedaneOrd + riepilogo.pedane_ord, 0));
|
||||
}
|
||||
});
|
||||
|
||||
await grid.dataSource.sync();
|
||||
@@ -948,7 +1021,9 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
},
|
||||
template: (data) => {
|
||||
data.text_field = `
|
||||
<b>Ore
|
||||
<b>
|
||||
ID: ${data.id_viaggio}
|
||||
Ore
|
||||
${moment(data.data_ora_iniz_trasp).format("HH:mm")}${data.rag_soc && ` - ${data.rag_soc}` || " - Ritiro Cliente"}</b>
|
||||
<br>
|
||||
${data.destinazioni}${data.note && `<br>${data.note}` || ""}
|
||||
@@ -1023,7 +1098,6 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
footerAttributes: {
|
||||
class: "!k-text-center"
|
||||
},
|
||||
footerTemplate: ({ num_pedane }) => numberStyle(num_pedane.sum),
|
||||
},
|
||||
{
|
||||
field: "colli_pedana",
|
||||
@@ -1045,7 +1119,26 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
footerAttributes: {
|
||||
class: "!k-text-center"
|
||||
},
|
||||
footerTemplate: ({ tot_colli }) => numberStyle(tot_colli.sum),
|
||||
footerTemplate: ({tot_colli}) => numberStyle(tot_colli.sum),
|
||||
},
|
||||
{
|
||||
field: "qta_esistente",
|
||||
title: "Qtà esistente",
|
||||
type: "number",
|
||||
template: ({qta_esistente}) => qta_esistente && numberStyle(qta_esistente) || "",
|
||||
},
|
||||
{
|
||||
field: "qta_residua",
|
||||
title: "Qtà residua",
|
||||
type: "number",
|
||||
template: ({qta_residua}) => qta_residua && numberStyle(qta_residua, qta_residua < 0 && "negative" || undefined) || "",
|
||||
},
|
||||
{
|
||||
field: "ammanco",
|
||||
title: "Ammanco",
|
||||
type: "number",
|
||||
hidden: true,
|
||||
template: ({ammanco}) => ammanco && numberStyle(ammanco, ammanco && "negative" || undefined) || "",
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -1192,7 +1285,7 @@ export default class PopupRiepGiorno extends BasePopup {
|
||||
.get("getRiepilogoGiorno")
|
||||
.data({dataCons: dataCons.unix()})
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<Array<{ rows_count: number }>>();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
|
||||
1
public_html/config_aziende/TOSCA_CLOUD/custom.css
Normal file
1
public_html/config_aziende/TOSCA_CLOUD/custom.css
Normal file
@@ -0,0 +1 @@
|
||||
nav#nb-main .navbar-center #titlebar{color:#2f363d}.navbar-default{background-color:#f5f5f5;border-color:#e0e0e0}.navbar-default .navbar-brand{color:#2f363d}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#2f363d}.navbar-default .navbar-text{color:#2f363d}.navbar-default .navbar-nav>li>a{color:#2f363d}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#2f363d}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff !important;background-color:#63221c}.navbar-default .navbar-nav>.open:not(.active)>a,.navbar-default .navbar-nav>.open:not(.active)>a:hover,.navbar-default .navbar-nav>.open:not(.active)>a:focus{color:#2f363d !important;background-color:#e0e0e0}.navbar-default .navbar-toggle{border-color:#e0e0e0}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#e0e0e0}.navbar-default .navbar-toggle .icon-bar{background-color:#2f363d}.navbar-default .navbar-link{color:#2f363d}.navbar-default .navbar-link:hover{color:#2f363d}@media(max-width: 767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#2f363d}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#2f363d}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff !important;background-color:#63221c}}#bt_nb-side-dismiss>i,#bt_nb-side-collapse>i{color:#8f9ca9}#nb-side>div>.navbar{background-color:#f5f5f5;border-color:#e0e0e0}/*# sourceMappingURL=custom.css.map */
|
||||
11
public_html/config_aziende/TOSCA_CLOUD/custom.scss
Normal file
11
public_html/config_aziende/TOSCA_CLOUD/custom.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
/** NAVBAR */
|
||||
/* warning: ho generato con twbscolor, e aggiunto $bgActive, $colActive */
|
||||
|
||||
$bgDefault: #f5f5f5;
|
||||
$bgHighlight: #e0e0e0;
|
||||
$bgActive: #63221C;
|
||||
$colDefault: #2f363d;
|
||||
$colHighlight: #2f363d;
|
||||
$colActive: #fff;
|
||||
|
||||
@import "../navbar";
|
||||
2
public_html/config_aziende/TOSCA_CLOUD/gestioni.json
Normal file
2
public_html/config_aziende/TOSCA_CLOUD/gestioni.json
Normal file
@@ -0,0 +1,2 @@
|
||||
[
|
||||
]
|
||||
BIN
public_html/config_aziende/TOSCA_CLOUD/images/logo_azienda.png
Normal file
BIN
public_html/config_aziende/TOSCA_CLOUD/images/logo_azienda.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"endPoint": "192.168.1.12:8080",
|
||||
"endPointRemote": null,
|
||||
"public_url": "http://app.dulciar.com/portale/"
|
||||
"public_url": "https://app.dulciar.com/portale/"
|
||||
},
|
||||
"dbNameWeb": "DULCIAR",
|
||||
"azienda": "DULCIAR",
|
||||
|
||||
16
public_html/config_aziende/tosca_cloud.config.json
Normal file
16
public_html/config_aziende/tosca_cloud.config.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"studioml": {
|
||||
"endPoint": "192.168.3.15:8080",
|
||||
"endPointRemote": "https://www2.studioml.it",
|
||||
"public_url": "https://www.studioml.it/pvm/"
|
||||
},
|
||||
"cliente": {
|
||||
"endPoint": "10.4.0.4:8080",
|
||||
"endPointRemote": null,
|
||||
"public_url": ""
|
||||
},
|
||||
"dbNameWeb": "TOSCA_CLOUD",
|
||||
"azienda": "TOSCA_CLOUD",
|
||||
"sc_project": "12024361",
|
||||
"sc_security": "5e40043c"
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"endPoint": "10.107.107.15:8080",
|
||||
"endPointRemote": null,
|
||||
"public_url": "http://ws.salpar.it/portale/"
|
||||
"public_url": "https://ws.salpar.it/portale/"
|
||||
},
|
||||
"dbNameWeb": "VGALIMENTI",
|
||||
"azienda": "VGALIMENTI",
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
importScripts("assets/firebase/firebase-app.js");
|
||||
importScripts("assets/firebase/firebase-messaging.js");
|
||||
importScripts("gest-lib/notifiche/js/main.js");
|
||||
|
||||
// self._firebase = undefined;
|
||||
|
||||
// self.addEventListener("install", () => {
|
||||
// _notifiche.setForSW(true);
|
||||
// _notifiche.getFirebase().then(firebase => {
|
||||
// if (firebase) {
|
||||
// self._firebase = firebase;
|
||||
//
|
||||
// firebase.messaging();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
importScripts("dist/gest-lib/notifiche/js/main.js");
|
||||
|
||||
self.addEventListener("notificationclick", e => {
|
||||
e.notification.close();
|
||||
@@ -63,4 +50,4 @@ self.addEventListener("push", async function (e) {
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -26,13 +26,6 @@ class Allegati {
|
||||
"versione" => $key["versione"]
|
||||
);
|
||||
|
||||
return Allegati\ListinoAcquisto::get_filelist($key);
|
||||
} else if ($sourceType == SourceType::ORDACQCOM) {
|
||||
$key = array(
|
||||
"cod_alis" => $key["cod_alis"],
|
||||
"versione" => $key["versione"]
|
||||
);
|
||||
|
||||
return Allegati\ListinoAcquisto::get_filelist($key);
|
||||
} else if (in_array($sourceType, array(SourceType::ORDCOM, SourceType::ORDLAVCOM, SourceType::ORDVENCOM))) {
|
||||
return Allegati\Ordine::get_filelist($key);
|
||||
@@ -111,22 +104,16 @@ class Allegati {
|
||||
|
||||
if ($tableName === \Allegati\TableName::STB_ACTIVITY_FILE) {
|
||||
return \StbActivityFile::get_item($key["activity_id"], $key["file_name"]);
|
||||
|
||||
} else if ($tableName === \Allegati\TableName::STB_FILES_ATTACHED) {
|
||||
return \StbFilesAttached::get_item($key["id_attach"]);
|
||||
|
||||
} else if ($tableName === \Allegati\TableName::DTB_DOC_PDF) {
|
||||
return \PdfDoc::get($key);
|
||||
|
||||
} else if ($tableName === \Allegati\TableName::DTB_ORD_PDF) {
|
||||
return \PdfOrd::get($key);
|
||||
|
||||
} else if ($tableName === \Allegati\TableName::MTB_AART_LINK) {
|
||||
return \MtbAartLink::getItemContent($key["cod_mart"], $key["id_riga"], $options);
|
||||
|
||||
} else if ($tableName === \Allegati\TableName::TTB_LINE) {
|
||||
return \UtilityTextiles::getLogoLineaContent($key["cod_line"], $options);
|
||||
|
||||
} else if ($sourceType === SourceType::JASPERREPORT) {
|
||||
return Allegati\JasperReport::run($key, $options);
|
||||
}
|
||||
@@ -188,9 +175,8 @@ class Allegati {
|
||||
}
|
||||
|
||||
public static function upload($data, $files) {
|
||||
$file = array_get($files, 0);
|
||||
$file = reset($files);
|
||||
$sourceType = $data["sourceType"];
|
||||
//$tableName = Allegati\SourceType::getTableName($sourceType);
|
||||
$key = $data["key"];
|
||||
|
||||
if ($sourceType == SourceType::PARTITAMAG) {
|
||||
@@ -201,9 +187,7 @@ class Allegati {
|
||||
return Allegati\Libero::upload($files);
|
||||
} else if ($sourceType == SourceType::LIS_A) {
|
||||
return Allegati\ListinoAcquisto::upload($key, $file);
|
||||
} else if ($sourceType == SourceType::ORDACQCOM) {
|
||||
return Allegati\OrdineAcquisto::upload($key, $file);
|
||||
} else if (in_array($sourceType, array(SourceType::ORDCOM, SourceType::ORDLAVCOM, SourceType::ORDVENCOM))) {
|
||||
} else if (in_array($sourceType, array(SourceType::ORDCOM, SourceType::ORDLAVCOM, SourceType::ORDVENCOM, SourceType::ORDACQCOM))) {
|
||||
return Allegati\Ordine::upload($key, $file);
|
||||
}
|
||||
|
||||
@@ -212,7 +196,7 @@ class Allegati {
|
||||
}
|
||||
|
||||
public static function uploadFromModal($filter, $fileItem) {
|
||||
$Ret = new \Ret;
|
||||
$ret = new \Ret;
|
||||
|
||||
$sourceTypesDict = Allegati\SourceType::get_dictionary();
|
||||
$sourceType = $filter["source_type"];
|
||||
@@ -222,19 +206,19 @@ class Allegati {
|
||||
|
||||
switch ($sourceType) {
|
||||
case SourceType::LIS_A:
|
||||
$Ret = Allegati\ListinoAcquisto::upload($filter, $fileItem);
|
||||
if ($Ret->is_OK()) {
|
||||
$reta = $Ret->get_data();
|
||||
$ret = Allegati\ListinoAcquisto::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);
|
||||
$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"]);
|
||||
$ret->set_string($html)->set_title($item["file_name"]);
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
break;
|
||||
case SourceType::ATTIVITA:
|
||||
@@ -242,47 +226,31 @@ class Allegati {
|
||||
break;
|
||||
case SourceType::COMMESSA:
|
||||
$codJcom = $filter["cod_jcom"];
|
||||
$Ret = \Allegati\Commessa::get_activityId($codJcom);
|
||||
if ($Ret->is_OK()) {
|
||||
$activityId = $Ret->get_string();
|
||||
$ret = \Allegati\Commessa::get_activityId($codJcom);
|
||||
if ($ret->is_OK()) {
|
||||
$activityId = $ret->get_string();
|
||||
}
|
||||
break;
|
||||
case SourceType::PARTITAMAG:
|
||||
$Ret = Allegati\PartitaMag::upload($filter, $fileItem);
|
||||
if ($Ret->is_OK()) {
|
||||
$reta = $Ret->get_data();
|
||||
$ret = Allegati\PartitaMag::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);
|
||||
$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"]);
|
||||
$ret->set_string($html)->set_title($item["file_name"]);
|
||||
|
||||
return $Ret;
|
||||
}
|
||||
break;
|
||||
case SourceType::ORDACQCOM:
|
||||
$Ret = Allegati\OrdineAcquisto::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;
|
||||
return $ret;
|
||||
}
|
||||
break;
|
||||
case SourceType::ORDCOM:
|
||||
$Ret = Allegati\Ordine::upload($filter, $fileItem);
|
||||
if ($Ret->is_OK()) {
|
||||
$attachments = $Ret->get_data();
|
||||
$ret = Allegati\Ordine::upload($filter, $fileItem);
|
||||
if ($ret->is_OK()) {
|
||||
$attachments = $ret->get_data();
|
||||
$html = "";
|
||||
|
||||
foreach ($attachments as $index => $attachment) {
|
||||
@@ -295,9 +263,9 @@ class Allegati {
|
||||
$html .= \Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
}
|
||||
|
||||
$Ret->set_data($attachments)->set_string($html);
|
||||
$ret->set_data($attachments)->set_string($html);
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
break;
|
||||
case SourceType::ATBOFFT:
|
||||
@@ -319,23 +287,28 @@ class Allegati {
|
||||
}
|
||||
|
||||
if (isset($activityId)) {
|
||||
$Ret = \StbActivityFile::upload($activityId, $fileItem);
|
||||
if ($Ret->is_OK()) {
|
||||
$item = $Ret->get_data();
|
||||
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"]);
|
||||
}
|
||||
$ret = \StbActivityFile::upload($activityId, $fileItem);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$attachments = $ret->get_data();
|
||||
$html = "";
|
||||
|
||||
foreach ($attachments as $index => $item) {
|
||||
unset($item["content"]);
|
||||
$item["source_type"] = $sourceType;
|
||||
$attachments[$index] = $item;
|
||||
ob_start();
|
||||
include \Controller::current_gestpath_include("popup-main-tr.php");
|
||||
$html .= \Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
}
|
||||
|
||||
$ret->set_data($attachments)->set_string($html);
|
||||
}
|
||||
} else {
|
||||
$Ret->set_error("Richiesta di upload non valida");
|
||||
$ret->set_error("Richiesta di upload non valida");
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function download_all($filter) {
|
||||
@@ -415,25 +388,16 @@ class Allegati {
|
||||
|
||||
if ($sourceType == SourceType::ATTIVITA || $sourceType == SourceType::COMMESSA) {
|
||||
$Ret = \StbActivityFile::remove($key["activity_id"], $key["file_name"]);
|
||||
|
||||
} else if ($sourceType == SourceType::ARTICOLO) {
|
||||
$Ret = Allegati\Articolo::remove($key);
|
||||
|
||||
} else if ($sourceType == SourceType::LIS_A) {
|
||||
$Ret = Allegati\ListinoAcquisto::remove($key);
|
||||
|
||||
} else if ($sourceType == SourceType::PARTITAMAG) {
|
||||
$Ret = Allegati\PartitaMag::remove($key);
|
||||
|
||||
} else if ($sourceType == SourceType::LIBERO) {
|
||||
$Ret = Allegati\Libero::remove($key);
|
||||
|
||||
} else if ($sourceType == SourceType::ORDACQCOM) {
|
||||
$Ret = Allegati\OrdineAcquisto::remove($key);
|
||||
|
||||
} else if (in_array($sourceType, array(SourceType::ORDCOM, SourceType::ORDLAVCOM, SourceType::ORDVENCOM))) {
|
||||
$Ret = Allegati\Ordine::remove($key);
|
||||
|
||||
} else {
|
||||
$Ret->set_error("Source non supportato");
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Allegati;
|
||||
|
||||
use Utility\File;
|
||||
|
||||
class StbFilesAttached {
|
||||
|
||||
public static function upload($fileItems, $EntityDetail = null) {
|
||||
$Ret = new \Ret;
|
||||
|
||||
$fileItems = \Utility\File::rearrangeFilesArray(array_get($fileItems, "files", $fileItems));
|
||||
|
||||
$idAttachs = array();
|
||||
|
||||
@@ -61,18 +61,11 @@ $item["last_upd"] = isset($item["last_upd"]) ? $item["last_upd"] : null;
|
||||
<small><?= \Utility\Date::format($item["last_upd"], Format::strftimeDMy) ?></small></td>
|
||||
<td class="vertical-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<?php if ($isEliminabile && ($sourceType == Allegati\SourceType::ATTIVITA || $sourceType == Allegati\SourceType::COMMESSA || $sourceType == Allegati\SourceType::LIS_A || $sourceType == Allegati\SourceType::PARTITAMAG || $sourceType == Allegati\SourceType::ORDACQCOM || $sourceType == Allegati\SourceType::ORDCOM)) { ?>
|
||||
<?php if ($isEliminabile && ($sourceType == Allegati\SourceType::ATTIVITA || $sourceType == Allegati\SourceType::COMMESSA || $sourceType == Allegati\SourceType::LIS_A || $sourceType == Allegati\SourceType::PARTITAMAG || $sourceType == Allegati\SourceType::ORDCOM)) { ?>
|
||||
<button class="btn btn-default btRemoveAllegato" title="Rimuovi">
|
||||
<i class="fas fa-trash text-danger"></i>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
// if (Messenger::is_enabled()) {
|
||||
// ?>
|
||||
<!-- <button class="btn btn-default bt_sendAllegato" title="Allega ad un messaggio">-->
|
||||
<!-- <i class="fa fa-envelope text-info"></i>-->
|
||||
<!-- </button>-->
|
||||
<!-- --><?php //} ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -47,24 +47,26 @@ if ($Ret->is_OK()) {
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<div style="height: 60vh;max-height: 60vh;overflow-y: auto;">
|
||||
<table id="m_tbAllegati" class="table table-condensed table-striped table-hover mt-8">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">File</th>
|
||||
<th>Descrizione</th>
|
||||
<th class="small">Dimensioni</th>
|
||||
<th class="small" style="width: 80px;">Modificato il</th>
|
||||
<th style="width: 50px;"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php
|
||||
foreach ($arr_files as $item) {
|
||||
include "popup-main-tr.php";
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><?php
|
||||
|
||||
<table id="m_tbAllegati" class="table table-condensed table-striped table-hover mt-8">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">File</th>
|
||||
<th>Descrizione</th>
|
||||
<th class="small">Dimensioni</th>
|
||||
<th class="small" style="width: 80px;">Modificato il</th>
|
||||
<th style="width: 50px;"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($arr_files as $item) {
|
||||
include "popup-main-tr.php";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
$html = Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
$Ret->set_string($html)->set_data();
|
||||
}
|
||||
|
||||
@@ -310,9 +310,10 @@ ModalAllegati.prototype.initDropzone = function () {
|
||||
};
|
||||
|
||||
ModalAllegati.prototype._onRefreshSourceTypeTab = function () {
|
||||
var self = this;
|
||||
var sourceType = self._getCurrentSourceType();
|
||||
var $table = self._getShowedTable();
|
||||
const self = this;
|
||||
const sourceType = self._getCurrentSourceType();
|
||||
const $table = self._getShowedTable();
|
||||
|
||||
$table.find("tr[data-source_type]").hide();
|
||||
$table.find("tr[data-source_type='" + sourceType + "']").show();
|
||||
return self;
|
||||
|
||||
@@ -173,7 +173,7 @@ let _allegati = {
|
||||
let key = $tr.getDataAttr("key");
|
||||
let fileName = $tr.getDataAttr("file_name");
|
||||
|
||||
if ([self.sourceTypes.ATTIVITA, self.sourceTypes.LIBERO, self.sourceTypes.COMMESSA, self.sourceTypes.LIS_A, self.sourceTypes.PARTITAMAG, self.sourceTypes.ORDACQCOM, self.sourceTypes.ORDCOM].indexOf(sourceType) >= 0) {
|
||||
if ([self.sourceTypes.ATTIVITA, self.sourceTypes.LIBERO, self.sourceTypes.COMMESSA, self.sourceTypes.LIS_A, self.sourceTypes.PARTITAMAG, self.sourceTypes.ORDCOM].indexOf(sourceType) >= 0) {
|
||||
let shortenFilename = shorten_filename(fileName, 20);
|
||||
let messageTitle = null;
|
||||
let messageFileDelete = "Stai eliminando <b>" + shortenFilename + "</b>";
|
||||
|
||||
@@ -35,10 +35,8 @@ if (isset($_GET["load_filters"])) {
|
||||
} else if (isset($_POST["upload_allegato"])) {
|
||||
$Ret = new Ret;
|
||||
if (count($_FILES) > 0) {
|
||||
$files = array_values($_FILES);
|
||||
$file = $files[0];
|
||||
$data = Utility::B64JSON_parse($_POST["upload_allegato"]);
|
||||
$Ret = Catalogo\Prodotto::upload_allegato($data, $file);
|
||||
$Ret = Catalogo\Prodotto::upload_allegato($data, $_FILES);
|
||||
} else {
|
||||
$Ret->set_error("File non pervenuto");
|
||||
}
|
||||
|
||||
@@ -23,24 +23,25 @@ $(function () {
|
||||
});
|
||||
|
||||
$(document).on("change", "#m_fileAllegato", function (e) {
|
||||
var $file = $(this);
|
||||
if (!is_null($file.getValue())) {
|
||||
var $toDisable = $file.closest(".modal-content").children();
|
||||
const $file = $(this);
|
||||
|
||||
if (!is_null($file.getValue())) {
|
||||
const $toDisable = $file.closest(".modal-content").children();
|
||||
const data = {codMart: _catalogo.product.codMart};
|
||||
const ajax = new Ajax();
|
||||
|
||||
var data = {codMart: _catalogo.product.codMart};
|
||||
var ajax = new Ajax();
|
||||
ajax.post("upload_allegato")
|
||||
.data(data)
|
||||
.file($file)
|
||||
.file($file, true)
|
||||
.$button($("#m_btAllega"))
|
||||
.$toDisable($toDisable)
|
||||
.noticeAsModal()
|
||||
.onSuccess(function (ret) {
|
||||
_catalogo.product.allegato.callbackOK(ret.returnData);
|
||||
var toast = new Toast();
|
||||
const toast = new Toast();
|
||||
toast.success("Il file <b>" + ret.returnData.path_link + "</b> è stato aggiunto");
|
||||
|
||||
var $tr = $(ret.returnString);
|
||||
const $tr = $(ret.returnString);
|
||||
$("#m_tbAllegati").children("tbody").append($tr);
|
||||
$tr.highlightRow();
|
||||
})
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 4.7 KiB |
@@ -70,24 +70,28 @@ WITH art AS (SELECT cod_mart, cod_mart AS cod_mart_mov, descrizione
|
||||
INNER JOIN mtb_depo ON ordini.cod_mdep = mtb_depo.cod_mdep),
|
||||
TempResult AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS row_number,
|
||||
*
|
||||
FROM (SELECT DISTINCT promo.cod_vlis + '-' + promo.cod_mart AS id,
|
||||
FROM (SELECT DISTINCT promo.cod_vlis + '-' + promo.cod_mart AS id,
|
||||
promo.cod_vlis,
|
||||
promo.descrizione,
|
||||
promo.cod_mart,
|
||||
mtb_aart.descrizione AS articolo,
|
||||
mtb_aart.descrizione AS articolo,
|
||||
data_iniz,
|
||||
data_fine,
|
||||
cod_promo,
|
||||
promo.note,
|
||||
aggiornato_da,
|
||||
prz_vend_iva,
|
||||
ordini.sudd,
|
||||
CAST(IIF(ordini.data_ord IS NOT NULL, 1, 0) AS BIT) AS flag_riass
|
||||
ISNULL(ordini.sudd, 0) AS sudd,
|
||||
CAST(IIF(ordini.data_ord IS NOT NULL, 1, 0) AS BIT) AS flag_riass,
|
||||
UPPER(IIF(CHARINDEX(' ', aggiornato_da) > 0,
|
||||
LEFT(aggiornato_da, CHARINDEX(' ', aggiornato_da)),
|
||||
aggiornato_da)) AS user_name
|
||||
FROM dbo.getPromozioneVendita('[dataVal]', '[dataVal]', NULL, NULL, NULL) promo
|
||||
INNER JOIN mtb_aart ON promo.cod_marT = mtb_aart.cod_mart
|
||||
LEFT OUTER JOIN tmp_ord ordini ON promo.cod_vlis = ordini.cod_vlis AND
|
||||
promo.cod_mart = ordini.cod_mart AND
|
||||
ordini.data_ord BETWEEN promo.data_iniz AND promo.data_fine) t
|
||||
ordini.data_ord BETWEEN promo.data_iniz AND promo.data_fine
|
||||
WHERE promo.flag_tipo_promo = 'T') t
|
||||
WHERE [filter]),
|
||||
TempCount AS (SELECT COUNT(*) AS rows_count
|
||||
FROM TempResult)
|
||||
|
||||
@@ -18,8 +18,10 @@ export class Promozione extends kendo.data.Model.define({
|
||||
prz_vend_iva: {type: "number"},
|
||||
sudd: {type: "boolean"},
|
||||
flag_riass: {type: "boolean"},
|
||||
user_name: {type: "string"},
|
||||
}
|
||||
}) {
|
||||
type = "mtb_lisv_data"
|
||||
id_ord: string
|
||||
cod_vlis: string
|
||||
descrizione: string
|
||||
@@ -33,7 +35,7 @@ export class Promozione extends kendo.data.Model.define({
|
||||
prz_vend_iva: number
|
||||
sudd: boolean
|
||||
flag_riass: boolean
|
||||
type = "mtb_lisv_data"
|
||||
user_name: string
|
||||
}
|
||||
|
||||
export default class ChiusuraTagliPrezzo extends ViewModule {
|
||||
@@ -110,32 +112,90 @@ export default class ChiusuraTagliPrezzo extends ViewModule {
|
||||
title: "Data Inizio",
|
||||
type: "date",
|
||||
format: "{0:dd/MM/yyyy}",
|
||||
filterable: {
|
||||
cell: {
|
||||
minLength: 100,
|
||||
operator: "eq",
|
||||
suggestionOperator: "eq"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "9256ed35-434d-4ee6-9e2f-9b4f1c2a00ab",
|
||||
field: "data_fine",
|
||||
title: "Data Fine",
|
||||
type: "date",
|
||||
format: "{0:dd/MM/yyyy}"
|
||||
format: "{0:dd/MM/yyyy}",
|
||||
filterable: {
|
||||
cell: {
|
||||
minLength: 100,
|
||||
operator: "eq",
|
||||
suggestionOperator: "eq"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "dd73e45b-31ff-480a-a61a-f6887ef2cad7",
|
||||
field: "cod_promo",
|
||||
title: "Cod. Promo",
|
||||
type: "string"
|
||||
type: "string",
|
||||
filterable: {
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "0cc0e1d6-f57e-44f9-a11a-ecfe2bcbe94f",
|
||||
field: "note",
|
||||
title: "Note",
|
||||
type: "string"
|
||||
type: "string",
|
||||
filterable: {
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "0ad4f5a1-b9e6-4a41-bcb1-a785a0141b12",
|
||||
field: "sudd",
|
||||
title: "Suddivisione",
|
||||
type: "boolean",
|
||||
template: ({sudd}) => `<i class="fas fa-${sudd && "check" || "times"}"></i>`
|
||||
template: ({sudd}) => `<i class="fas fa-${sudd && "check" || "times"}"></i>`,
|
||||
filterable: {
|
||||
ui: (input) => input.kendoDropDownList({
|
||||
dataSource: {
|
||||
data: [
|
||||
{text: "Si", value: true},
|
||||
{text: "No", value: false}
|
||||
]
|
||||
},
|
||||
dataTextField: "text",
|
||||
dataValueField: "value",
|
||||
valuePrimitive: true,
|
||||
optionLabel: "Tutti"
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "bccc7a72-a789-4d38-9f7d-b9170801282b",
|
||||
field: "user_name",
|
||||
title: "Utente",
|
||||
type: "string",
|
||||
filterable: {
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -195,9 +255,15 @@ export default class ChiusuraTagliPrezzo extends ViewModule {
|
||||
return `
|
||||
<aside class="flex gaps mb-10 align-center">
|
||||
<input type="text" id="dataVal" style="width: 10%">
|
||||
|
||||
<button id="selectAll" type="button">
|
||||
Seleziona tutto
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="filterRiass" class="mt-0">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="filterMiePromo" class="mt-0">
|
||||
</div>
|
||||
@@ -222,8 +288,18 @@ export default class ChiusuraTagliPrezzo extends ViewModule {
|
||||
}
|
||||
}).data("kendoDatePicker");
|
||||
|
||||
this.$container.find("#selectAll").kendoButton({
|
||||
click: () => {
|
||||
const selected = this.tablePromozioni.select();
|
||||
|
||||
this.tablePromozioni.clearSelection();
|
||||
this.tablePromozioni.select($("tr").not(selected));
|
||||
}
|
||||
});
|
||||
|
||||
this.checkboxRiass = this.$container.find("#filterRiass").kendoCheckBox({
|
||||
label: "Solo articoli riassortiti",
|
||||
checked: true,
|
||||
change: () => {
|
||||
this.dataSourcePromozioni.read();
|
||||
}
|
||||
|
||||
@@ -46,9 +46,24 @@ class ContoEconomicoProdotto {
|
||||
return $gestSetup->section("VERIFICA_AGGIORNAMENTO_PREZZI")->keySection("USA_COSTO_MERC")->asBoolean()->defaultValue(false)->get();
|
||||
}
|
||||
|
||||
private static function getTipoRagguppamento() {
|
||||
public static function getFiltroCodMgrp() {
|
||||
$gestSetup = new GestSetup();
|
||||
return $gestSetup->section("CONTO_ECONOMICO_PRODOTTO")->keySection("FILTRO_COD_MGRP")->get();
|
||||
}
|
||||
|
||||
public static function getFiltroTipoMgrp() {
|
||||
$gestSetup = new GestSetup();
|
||||
return $gestSetup->section("CONTO_ECONOMICO_PRODOTTO")->keySection("FILTRO_TIPO_MGRP")->get();
|
||||
}
|
||||
|
||||
public static function getTipoRagguppamento() {
|
||||
$GestSetup = new \GestSetup;
|
||||
return $GestSetup->keySection("TIPO_RAGGRUPPAMENTO")->defaultValue("T")->get();
|
||||
return $GestSetup->section("CONTO_ECONOMICO_PRODOTTO")->keySection("TIPO_RAGGRUPPAMENTO")->defaultValue("T")->get();
|
||||
}
|
||||
|
||||
public static function isPrzBaseDaDist() {
|
||||
$GestSetup = new GestSetup();
|
||||
return $GestSetup->section("CONTO_ECONOMICO_PRODOTTO")->keySection("PRZ_BASE_DA_DIST")->defaultValue(false)->asBoolean()->get();
|
||||
}
|
||||
|
||||
public static function get_contattiListino($codVlis) {
|
||||
@@ -56,11 +71,26 @@ class ContoEconomicoProdotto {
|
||||
return $Query->importSqlFile("list-contatti-listino")->setVar("cod_vlis", $codVlis)->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function get_listini() {
|
||||
public static function get_listini($data = array()) {
|
||||
$Query = new Query;
|
||||
$Ret = $Query->importSqlFile("list-listini")->toRet()->execute();
|
||||
if ($Ret->is_OK()) {
|
||||
$arr_rows = $Ret->get_data();
|
||||
$addNew = array_get($data, "addNew", false);
|
||||
|
||||
if ($addNew) {
|
||||
$arr_rows = array_merge(
|
||||
array(
|
||||
array(
|
||||
"cod_vlis" => "NEW",
|
||||
"descrizione" => ""
|
||||
)
|
||||
),
|
||||
$Ret->get_data()
|
||||
);
|
||||
} else {
|
||||
$arr_rows = $Ret->get_data();
|
||||
}
|
||||
|
||||
foreach ($arr_rows as $i => $row) {
|
||||
$row["descrizione"] = htmlentities($row["descrizione"]);
|
||||
// $Ret = self::get_contattiListino($row["cod_vlis"]);
|
||||
@@ -81,25 +111,53 @@ class ContoEconomicoProdotto {
|
||||
$Query->select("data_iniz")->from("vtb_list_data")->where("cod_vlis", $data["cod_vlis"])->orderBy("data_iniz");
|
||||
$ret = $Query->firstColumn()->toRet()->date2ts()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$dateVariazioni = $ret->get_data();
|
||||
$today = strtotime("today");
|
||||
|
||||
if (!array_any($dateVariazioni, function ($dataVariazioni) use ($today) {
|
||||
return $dataVariazioni == $today;
|
||||
})) {
|
||||
$dateVariazioni[] = $today;
|
||||
}
|
||||
|
||||
$ret->set_data($dateVariazioni);
|
||||
}
|
||||
// if ($ret->is_OK()) {
|
||||
// $dateVariazioni = $ret->get_data();
|
||||
// $today = strtotime("today");
|
||||
//
|
||||
// if (!array_any($dateVariazioni, function ($dataVariazioni) use ($today) {
|
||||
// return $dataVariazioni == $today;
|
||||
// })) {
|
||||
// $dateVariazioni[] = $today;
|
||||
// }
|
||||
//
|
||||
// $ret->set_data($dateVariazioni);
|
||||
// }
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private static function get_articoliAll() {
|
||||
$Query = new Query;
|
||||
return $Query->importSqlFile("list-articoli-all")->toRet()->execute();
|
||||
public static function get_articoliAll($data = array()) {
|
||||
$useKendo = array_get($data, "useKendo", false);
|
||||
|
||||
if ($useKendo) {
|
||||
$query = KendoService::queryInitializerService($data, "list-articoli-all", "2, 1");
|
||||
|
||||
$query
|
||||
->setVar("codVlis", array_get($data, "codVlis"));
|
||||
} else {
|
||||
$query = new Query();
|
||||
|
||||
$query
|
||||
->importSqlFile("list-articoli-all")
|
||||
->setVar("codVlis", array_get($data, "codVlis"));
|
||||
|
||||
$query->sql .= "\nORDER BY 2, 1";
|
||||
}
|
||||
|
||||
$filtroCodMgrp = ContoEconomicoProdotto::getFiltroCodMgrp();
|
||||
|
||||
if (isset($filtroCodMgrp)) {
|
||||
$query
|
||||
->setVar("tipoFiltro", "FILTRO_COD_MGRP")
|
||||
->setVar("joinFiltro", "mtb_aart.cod_mgrp = stp.value_string");
|
||||
} else {
|
||||
$query
|
||||
->setVar("tipoFiltro", "FILTRO_TIPO_MGRP")
|
||||
->setVar("joinFiltro", "mg.tipo_mgrp = stp.value_string");
|
||||
}
|
||||
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
private static function flag_userCanSave() {//return true;
|
||||
@@ -135,7 +193,8 @@ class ContoEconomicoProdotto {
|
||||
$queryInterna->importSqlFile("list-articoli-listino_interna")
|
||||
->setVar("cod_vlis", $codVlis)
|
||||
->setDateVar("data_validita", $dataValidita)
|
||||
->setVar("tipo_ragg", ContoEconomicoProdotto::getTipoRagguppamento());
|
||||
->setVar("tipo_ragg", ContoEconomicoProdotto::getTipoRagguppamento())
|
||||
->setVar("przBaseDaDist", ContoEconomicoProdotto::isPrzBaseDaDist());
|
||||
|
||||
if (isset($data["cod_mart"])) {
|
||||
$queryInterna->setVar("cod_mart", $data["cod_mart"])
|
||||
@@ -144,7 +203,7 @@ class ContoEconomicoProdotto {
|
||||
$queryInterna->setVar("cod_mart", null);
|
||||
}
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "list-articoli-listino", "cod_mtip, cod_mstp, cod_mart")
|
||||
$query = KendoService::queryInitializerService($data, "list-articoli-listino", "cod_mtip, cod_mstp, cod_mart, da")
|
||||
->setVar("query_interna", $queryInterna->getSql());
|
||||
|
||||
if (array_key_exists("filters", $data)) {
|
||||
@@ -511,25 +570,49 @@ class ContoEconomicoProdotto {
|
||||
}
|
||||
|
||||
public static function delete_artListino($data) {
|
||||
$VtbListData = new EntityItem("vtb_list_data");
|
||||
$VtbListData->insert_or_update()
|
||||
->setDate("dataIniz", $data["data_iniz"])
|
||||
->set("codVlis", $data["cod_vlis"]);
|
||||
$listini = array_get($data, "listini.models");
|
||||
|
||||
$MtbLisvData = new EntityItem("mtb_lisv_data");
|
||||
$MtbLisvData->insert_or_update()
|
||||
->set("tipoVariazione", "D")
|
||||
->set("codMart", $data["cod_mart"])
|
||||
->set("aggiornatoDa", User::get_current_username());
|
||||
if (is_null($listini)) {
|
||||
$listini = array($data);
|
||||
}
|
||||
|
||||
return $VtbListData->set("mtbLisvData", $MtbLisvData)->send();
|
||||
$entityList = new EntityList();
|
||||
|
||||
foreach ($listini as $listino) {
|
||||
$mtbLisvData = new EntityItem("mtb_lisv_data");
|
||||
|
||||
$mtbLisvData
|
||||
->insert_or_update()
|
||||
->set("tipoVariazione", "D")
|
||||
->set("codMart", array_get($listino, "cod_mart"))
|
||||
->set("aggiornatoDa", User::get_current_username());
|
||||
|
||||
$vtbListData = new EntityItem("vtb_list_data");
|
||||
|
||||
$vtbListData
|
||||
->insert_or_update()
|
||||
->setDate("dataIniz", array_get($listino, "data_iniz"))
|
||||
->set("codVlis", array_get($listino, "cod_anag", array_get($listino, "cod_vlis")))
|
||||
->set("mtbLisvData", $mtbLisvData);
|
||||
|
||||
$entityList->push($vtbListData);
|
||||
}
|
||||
|
||||
return $entityList->send();
|
||||
}
|
||||
|
||||
public static function getCondizioniCommLisv($data) {
|
||||
$query = new Query;
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
$query->importSqlFile("getCondizioniCommLisv")
|
||||
->setVar("cod_vlis", $data["codVlis"]);
|
||||
if (array_any_null(array($codVlis))) {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "getCondizioniCommLisv");
|
||||
}
|
||||
|
||||
$query = new Query();
|
||||
|
||||
$query
|
||||
->importSqlFile("getCondizioniCommLisv")
|
||||
->setVar("cod_vlis", $codVlis);
|
||||
|
||||
return $query->toRet()->firstRow()->execute();
|
||||
}
|
||||
@@ -579,6 +662,24 @@ class ContoEconomicoProdotto {
|
||||
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getSchedaCosti(array $data) {
|
||||
$gestSetup = new GestSetup();
|
||||
$JP = new JasperProcessor();
|
||||
$key = $data["key"];
|
||||
|
||||
$ret = $JP->load($gestSetup->keySection("REPORT_SCHEDA_COSTI"));
|
||||
if ($ret->is_OK()) {
|
||||
$JP->param("cod_vlis", $key["codVlis"])
|
||||
->param("cod_mart", $key["codMart"])
|
||||
->paramDate("data_iniz", $key["dataValidita"])
|
||||
->cacheAs("StampaSchedaCosti");
|
||||
|
||||
$ret = $JP->run();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists("StdUtils")) {
|
||||
|
||||
@@ -32,6 +32,9 @@ if (isset($_GET["popup-det_articolo"])) {
|
||||
} else if (isset($_POST["saveCondizioniCommerciali"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_POST["saveCondizioniCommerciali"]);
|
||||
ContoEconomicoProdotto::saveCondizioniCommerciali($data)->display();
|
||||
} else if (isset($_GET["getSchedaCosti"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["getSchedaCosti"]);
|
||||
ContoEconomicoProdotto::getSchedaCosti($data)->display();
|
||||
} else if (isset($_GET["popup-condizioni_commerciali"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["popup-condizioni_commerciali"]);
|
||||
include "popup-condizioni_commerciali.php";
|
||||
|
||||
@@ -40,8 +40,8 @@ $(function () {
|
||||
let codMart = $tr.getDataAttr("cod_mart");
|
||||
let codVlis = _cep.get_codVlis();
|
||||
let versione = $tr.getDataAttr("versione");
|
||||
let loadJson = true;
|
||||
let dataValidita = $(this).getDataAttr("data_validita");
|
||||
let loadJson = true;
|
||||
|
||||
if ($(this).hasClass("open_edit")) {
|
||||
dataValidita = moment().unix();
|
||||
@@ -51,6 +51,29 @@ $(function () {
|
||||
_cep.load_dettArticolo(codVlis, codMart, dataValidita, versione, loadJson);
|
||||
});
|
||||
|
||||
$(document).on("click", "button.print", function () {
|
||||
const $tr = $(this).closest("tr[data-cod_mart]");
|
||||
const codVlis = _cep.get_codVlis();
|
||||
const codMart = $tr.attr("data-cod_mart");
|
||||
const dataValidita = $(this).attr("data-data_validita");
|
||||
const systemNote = $(this).attr("data-system_note");
|
||||
|
||||
const key = {
|
||||
codVlis,
|
||||
codMart,
|
||||
dataValidita,
|
||||
systemNote
|
||||
}
|
||||
|
||||
new Ajax()
|
||||
.get("getSchedaCosti")
|
||||
.data({key: key})
|
||||
.$button($("#btPdfDettagliOrdine"))
|
||||
.noticeAsModal()
|
||||
.onSuccess({modalBox: {IFrame: true}})
|
||||
.execute();
|
||||
});
|
||||
|
||||
$(document).on("click", "#list-articoli-all tr[data-cod_mart]", function (e) {
|
||||
var $tr = $(this);
|
||||
var codMart = $tr.getDataAttr("cod_mart");
|
||||
@@ -468,6 +491,7 @@ var _cep = {
|
||||
tr += "<td class=''>" + blankIfNull(artListData.descr_pedana) + "</td>";
|
||||
|
||||
tr += "<td class='text-center'>";
|
||||
|
||||
if (artListData.has_storico === "S") {
|
||||
tr += "<button type='button' class='btn btn-default btn-xs open_det' data-data_validita='" + artListData.data_iniz + "'>\n\
|
||||
" + artListData.data_iniz.unixtime_format("DD/MM/YYYY") + "\n\
|
||||
@@ -475,6 +499,7 @@ var _cep = {
|
||||
} else {
|
||||
tr += artListData.data_iniz.unixtime_format("DD/MM/YYYY");
|
||||
}
|
||||
|
||||
tr += "</td>";
|
||||
|
||||
tr += "<td class='text-right text-monospace'>" + number_format(artListData.qta_cnf, 1) + "</td>";
|
||||
@@ -484,11 +509,24 @@ var _cep = {
|
||||
tr += "<td class='text-right text-monospace margine " + ((artListData.margine < 0) ? "text-danger" : "") + "'>" + number_format(artListData.margine, 2) + "</td>";
|
||||
tr += "<td class='text-right text-monospace margine_perc " + ((artListData.margine_perc < 0) ? "text-danger" : "") + "'>" + number_format(artListData.margine_perc, 2) + "% </td>";
|
||||
tr += "<td class='text-right text-monospace'>" + number_format(artListData.prezzo_kg, 2) + "</td>";
|
||||
tr += "<td class='text-center'>\n\
|
||||
<button type='button' class='btn btn-xs btn-default open_edit' data-data_validita='" + artListData.data_iniz + "'>\n\
|
||||
<span class='text-info'><i class='fa fa-pencil'></i> Modifica</span>\n\
|
||||
</button>\n\
|
||||
</td>";
|
||||
tr += `<td class='text-center'>
|
||||
<button type='button' class='btn btn-xs btn-default open_edit' data-data_validita='${artListData.data_iniz}'>
|
||||
<span class='text-info'>
|
||||
<i class='fa fa-pencil'></i> Modifica
|
||||
</span>
|
||||
</button>`;
|
||||
|
||||
const system_note = artListData.system_note;
|
||||
|
||||
if (system_note) {
|
||||
tr += `<button type='button' class='btn btn-xs btn-default print' data-data_validita='${artListData.data_iniz}' data-system_note='${system_note}'>
|
||||
<span class='text-primary'>
|
||||
<i class='fa fa-print'></i> Stampa
|
||||
</span>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
tr += `</td>`;
|
||||
tr += "</tr>";
|
||||
|
||||
$tbody.append(tr);
|
||||
@@ -497,19 +535,16 @@ var _cep = {
|
||||
$listArticoli.show();
|
||||
$noArticoli.hide();
|
||||
d.resolve(true);
|
||||
|
||||
} else {
|
||||
var toast = new Toast();
|
||||
const toast = new Toast();
|
||||
toast.info("Non ci sono articoli disponibili", "Listino " + ret.returnData.descrizione);
|
||||
|
||||
// $listArticoli.hide();
|
||||
$noArticoli.show();
|
||||
d.resolve(false);
|
||||
}
|
||||
|
||||
self.enable_bt_addArticolo(true);
|
||||
|
||||
self.boxDettaglioListino.setData(ret.returnData);
|
||||
|
||||
} else {
|
||||
self.enable_bt_addArticolo(false);
|
||||
$listArticoli.hide();
|
||||
@@ -518,6 +553,7 @@ var _cep = {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return d;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
SELECT cod_mart,
|
||||
LTRIM(ISNULL(descrizione_estesa, ISNULL(descrizione, ''))) AS descr_art,
|
||||
unt_mis AS unt_mis_ven
|
||||
FROM mtb_aart,
|
||||
( SELECT value_string AS cod_mgrp
|
||||
FROM dbo.parseStringIntoArray(dbo.getGestSetup('PVM', 'CONTO_ECONOMICO_PRODOTTO', 'FILTRO_COD_MGRP'), '|')
|
||||
) stp
|
||||
WHERE mtb_aart.flag_stato = 'A' AND
|
||||
mtb_aart.flag_incl_listino = 'S' AND
|
||||
mtb_aart.cod_mgrp = stp.cod_mgrp
|
||||
ORDER BY 2, 1
|
||||
SELECT mtb_aart.cod_mart,
|
||||
LTRIM(ISNULL(descrizione_estesa, ISNULL(mtb_aart.descrizione, ''))) AS descr_art,
|
||||
unt_mis AS unt_mis_ven,
|
||||
ms.descrizione AS sottogruppo,
|
||||
mt.descrizione AS tipo,
|
||||
mst.descrizione AS sottotipo,
|
||||
mtb_aart.cod_tcol_ui,
|
||||
mtb_aart.qta_cnf,
|
||||
mtb_aart.peso_kg,
|
||||
mtb_aart.marchio,
|
||||
IIF(mtb_aart.data_ult_scar > mtb_aart.data_ult_car, YEAR(mtb_aart.data_ult_scar),
|
||||
YEAR(mtb_aart.data_ult_car)) AS anno_ult_mov
|
||||
FROM mtb_aart
|
||||
INNER JOIN mtb_grup mg ON mtb_aart.cod_mgrp = mg.cod_mgrp
|
||||
INNER JOIN mtb_sgrp ms ON mtb_aart.cod_mgrp = ms.cod_mgrp AND mtb_aart.cod_msgr = ms.cod_msgr
|
||||
INNER JOIN (SELECT value_string
|
||||
FROM dbo.parseStringIntoArray(
|
||||
dbo.getGestSetup('PVM', 'CONTO_ECONOMICO_PRODOTTO', '[tipoFiltro]'), '|')) stp
|
||||
ON [joinFiltro]-- mtb_aart.cod_mgrp = stp.cod_mgrp
|
||||
LEFT OUTER JOIN dbo.getListinoVendita(NULL, ISNULL('[codVlis]', NULL), NULL) listino
|
||||
ON mtb_aart.cod_mart = listino.cod_mart
|
||||
AND listino.tipo_variazione <> 'D'
|
||||
LEFT OUTER JOIN mtb_tipi mt ON mtb_aart.cod_mtip = mt.cod_mtip
|
||||
LEFT OUTER JOIN mtb_stip mst ON mtb_aart.cod_mtip = mst.cod_mtip AND
|
||||
mtb_aart.cod_mstp = mst.cod_mstp
|
||||
WHERE mtb_aart.flag_stato = 'A'
|
||||
AND mtb_aart.flag_incl_listino = 'S'
|
||||
AND listino.cod_mart IS NULL
|
||||
-- ORDER BY 2, 1
|
||||
@@ -1,6 +1,17 @@
|
||||
SELECT t.*,
|
||||
t.prezzo - t.costo AS margine,
|
||||
(t.prezzo - t.costo) / (CASE WHEN prezzo = 0 THEN 1 ELSE prezzo END) * 100 AS margine_perc
|
||||
(t.prz_vend +
|
||||
IIF(t.flag_add_trasp = 1, ISNULL(t.costo_trasp, 0), 0)) *
|
||||
(1 - ISNULL(t.sconto_trasp, 0) / 100) AS prz_vend_trasp,
|
||||
t.prezzo - t.costo AS margine,
|
||||
(t.prezzo - t.costo) / (CASE WHEN prezzo = 0 THEN 1 ELSE prezzo END) * 100 AS margine_perc,
|
||||
CONCAT(
|
||||
t.tipo,
|
||||
IIF(t.cod_tcol_UI IS NOT NULL, ' ' + t.cod_tcol_UI, ''),
|
||||
IIF(t.qta_cnf IS NOT NULL, ' ' + CAST(t.qta_cnf AS FLOAT), ''),
|
||||
' ', 'x', ' ',
|
||||
IIF(t.peso_kg IS NOT NULL, ' ' + CAST(t.peso_kg AS FLOAT), ''),
|
||||
IIF(t.sottotipo IS NOT NULL, ' ' + t.sottotipo, ''),
|
||||
IIF(t.marchio IS NOT NULL, ' ' + t.marchio, '')) AS group_equi
|
||||
FROM ([query_interna]) t
|
||||
WHERE 1 = 1
|
||||
-- ORDER BY cod_mtip, cod_mstp, cod_mart
|
||||
@@ -1,71 +1,81 @@
|
||||
SELECT listino.cod_mart + '-' + listino.cod_vlis + '-' + CAST(listino.versione AS VARCHAR) + '-' +
|
||||
CAST(mlds.da AS VARCHAR) + ':' +
|
||||
CAST(mlds.a AS VARCHAR) AS id,
|
||||
CAST(mlds.a AS VARCHAR) AS id,
|
||||
case '[tipo_ragg]'
|
||||
when 'T' THEN ISNULL(mtb_aart.cod_mtip, '')
|
||||
when 'G' THEN mtb_aart.cod_mgrp
|
||||
ELSE '' END AS cod_mtip,
|
||||
ELSE '' END AS cod_mtip,
|
||||
case '[tipo_ragg]'
|
||||
when 'T' THEN ISNULL(mtb_tipi.descrizione, '')
|
||||
when 'G' THEN mtb_grup.descrizione
|
||||
ELSE '' END AS descr_tipi,
|
||||
ELSE '' END AS descr_tipi,
|
||||
case '[tipo_ragg]'
|
||||
when 'T' THEN ISNULL(mtb_aart.cod_mstp, '')
|
||||
when 'G' THEN mtb_aart.cod_mgrp
|
||||
ELSE '' END AS cod_mstp,
|
||||
ELSE '' END AS cod_mstp,
|
||||
case '[tipo_ragg]'
|
||||
when 'T' THEN ISNULL(mtb_stip.descrizione, '')
|
||||
when 'G' THEN mtb_sgrp.descrizione
|
||||
ELSE '' END AS descr_stipi,
|
||||
ELSE '' END AS descr_stipi,
|
||||
data_iniz,
|
||||
listino.descrizione AS descr_listino,
|
||||
listino.descrizione AS descr_listino,
|
||||
listino.cod_mart,
|
||||
IsNull(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descr_articolo,
|
||||
listino.cod_mart + ' ' + mtb_aart.descrizione AS info_articolo,
|
||||
IsNull(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descr_articolo,
|
||||
listino.cod_mart + ' ' + mtb_aart.descrizione AS info_articolo,
|
||||
listino.unt_mis_ven,
|
||||
listino.prz_vend,
|
||||
listino.prz_vend + IIF(listino.flag_add_trasp = 1, calcoli.costo_trasp, 0) AS prz_vend_trasp,
|
||||
listino.magg_prz_vend,
|
||||
listino.prz_base AS costo,
|
||||
IIF('[przBaseDaDist]' = 0 OR jc.prezzo_base IS NULL OR jc.prezzo_base = 0, listino.prz_base,
|
||||
jc.prezzo_base) AS costo,
|
||||
listino.perc_prov,
|
||||
listino.perc_promo,
|
||||
listino.ricarico,
|
||||
mtb_aart.qta_cnf,
|
||||
mtb_aart.unt_mis,
|
||||
mum.tipo_um,
|
||||
mtb_aart.unt_mis2,
|
||||
mtb_aart.rap_conv2,
|
||||
mum2.tipo_um AS tipo_um2,
|
||||
mum2.tipo_um AS tipo_um2,
|
||||
mtb_aart.unt_mis3,
|
||||
mtb_aart.rap_conv3,
|
||||
mum3.tipo_um AS tipo_um3,
|
||||
mum3.tipo_um AS tipo_um3,
|
||||
mtb_aart.peso_kg,
|
||||
mlds.da,
|
||||
mlds.a,
|
||||
calcoli.costo_trasp AS costo_trasp,
|
||||
listino.flag_add_trasp,
|
||||
calcoli.costo_trasp AS costo_trasp,
|
||||
mlds.perc_sconto AS sconto_trasp,
|
||||
listino.colli_pedana,
|
||||
listino.cod_tcol_UL,
|
||||
mtb_tcol.descrizione AS descr_pedana,
|
||||
mtb_tcol.descrizione AS descr_pedana,
|
||||
ROUND(listino.prz_vend_netto * (1 - ISNULL(vtb_clie.sconto1, 0) / 100) * (1 - ISNULL(vtb_clie.sconto2, 0) / 100),
|
||||
2) AS prezzo,
|
||||
2) AS prezzo,
|
||||
ROUND(listino.prz_vend_netto * (1 - ISNULL(vtb_clie.sconto1, 0) / 100) *
|
||||
(1 - ISNULL(vtb_clie.sconto2, 0) / 100) / listino.rap_conv /
|
||||
CASE WHEN mtb_aart.peso_kg = 0 THEN 1 ELSE mtb_aart.peso_kg END, 2) AS prezzo_kg,
|
||||
CASE WHEN mtb_aart.peso_kg = 0 THEN 1 ELSE mtb_aart.peso_kg END,
|
||||
2) AS prezzo_kg,
|
||||
ROUND(listino.prz_base / listino.rap_conv / CASE WHEN mtb_aart.peso_kg = 0 THEN 1 ELSE mtb_aart.peso_kg END,
|
||||
2) AS costo_kg,
|
||||
vtb_clie.sconto1 AS sconto_clie,
|
||||
listino.perc_sco1 AS sconto_1,
|
||||
listino.perc_sco2 AS sconto_2,
|
||||
listino.perc_sco3 AS sconto_3,
|
||||
listino.perc_sco4 AS sconto_4,
|
||||
2) AS costo_kg,
|
||||
vtb_clie.sconto1 AS sconto_clie,
|
||||
listino.perc_sco1 AS sconto_1,
|
||||
listino.perc_sco2 AS sconto_2,
|
||||
listino.perc_sco3 AS sconto_3,
|
||||
listino.perc_sco4 AS sconto_4,
|
||||
listino.versione,
|
||||
listino.cod_vlis AS cod_anag,
|
||||
CAST(listino.descrizione_html AS VARCHAR(MAX)) AS descrizione_html,
|
||||
listino.cod_vlis AS cod_anag,
|
||||
CAST(listino.descrizione_html AS VARCHAR(MAX)) AS descrizione_html,
|
||||
listino.note,
|
||||
CASE WHEN listino.system_note IS NULL THEN 'N' ELSE 'S' END AS has_storico,
|
||||
(SELECT SUM(IIF(vlp.perc_fat <> 0, vlp.perc_fat, (vlp.valore_fisso / vlp.fatturato_bdg) * 100)) AS premio
|
||||
listino.system_note,
|
||||
CASE WHEN listino.system_note IS NULL THEN 'N' ELSE 'S' END AS has_storico,
|
||||
(SELECT SUM(IIF(vlp.perc_fat_04 <> 0, vlp.perc_fat_04,
|
||||
(vlp.valore_fisso / IIF(vlp.fatturato_bdg <> 0, vlp.fatturato_bdg, 1)) * 100)) AS premio
|
||||
FROM vtb_list_premi vlp
|
||||
WHERE listino.data_iniz BETWEEN vlp.da_data_fat AND vlp.a_data_fat
|
||||
AND vlp.cod_vlis = listino.cod_vlis) AS premio
|
||||
WHERE '[data_validita]' BETWEEN vlp.da_data_fat AND vlp.a_data_fat
|
||||
AND vlp.cod_vlis = listino.cod_vlis) AS premio,
|
||||
mtb_tipi.descrizione AS tipo,
|
||||
mtb_stip.descrizione AS sottotipo,
|
||||
mtb_aart.cod_tcol_ui,
|
||||
mtb_aart.marchio
|
||||
FROM dbo.getListinoVendita('[data_validita]', '[cod_vlis]', '[cod_mart]') listino
|
||||
INNER JOIN mtb_aart ON listino.cod_mart = mtb_aart.cod_mart
|
||||
INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp
|
||||
@@ -92,9 +102,10 @@ FROM dbo.getListinoVendita('[data_validita]', '[cod_vlis]', '[cod_mart]') listin
|
||||
LEFT OUTER JOIN mtb_tipi ON mtb_aart.cod_mtip = mtb_tipi.cod_mtip
|
||||
LEFT OUTER JOIN mtb_stip ON mtb_aart.cod_mtip = mtb_stip.cod_mtip AND
|
||||
mtb_aart.cod_mstp = mtb_stip.cod_mstp
|
||||
LEFT OUTER JOIN jtb_cicl jc ON mtb_aart.cod_mart = jc.cod_prod
|
||||
OUTER APPLY (SELECT ROUND(mlds.val_ricarico / listino.colli_pedana /
|
||||
IIF(mum_vend.tipo_um = 'UP', listino.qta_cnf, 1)
|
||||
+ listino.prz_base * mlds.perc_ricarico / 100
|
||||
- listino.prz_base * mlds.perc_sconto / 100, 4) AS costo_trasp) AS calcoli
|
||||
+ mlds.val_ricarico * mlds.perc_ricarico / 100
|
||||
, 2) AS costo_trasp) AS calcoli
|
||||
WHERE listino.tipo_variazione <> 'D'
|
||||
AND listino.flag_attivo = 'S'
|
||||
@@ -1,4 +1,12 @@
|
||||
SELECT cod_vlis, descrizione, flag_add_trasp
|
||||
SELECT cod_vlis,
|
||||
descrizione,
|
||||
flag_add_trasp,
|
||||
(SELECT MAX(versione)
|
||||
FROM vtb_list_data vld
|
||||
WHERE vtb_list.cod_vlis = vld.cod_vlis) AS versione,
|
||||
(SELECT ISNULL(MAX(data_iniz), GETDATE())
|
||||
FROM vtb_list_data vld
|
||||
WHERE vtb_list.cod_vlis = vld.cod_vlis) AS data_iniz
|
||||
FROM vtb_list
|
||||
WHERE flag_attivo = 'S'
|
||||
and cod_vlis_rif is null
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
SELECT data_iniz,
|
||||
note,
|
||||
porto,
|
||||
descrizione
|
||||
FROM vtb_list_data INNER JOIN vtb_list ON vtb_list_data.cod_vlis = vtb_list.cod_vlis
|
||||
WHERE vtb_list.cod_vlis = '[cod_vlis]' AND
|
||||
data_iniz <= '[data_validita]'
|
||||
SELECT data_iniz,
|
||||
note,
|
||||
porto,
|
||||
descrizione
|
||||
FROM vtb_list_data
|
||||
INNER JOIN vtb_list ON vtb_list_data.cod_vlis = vtb_list.cod_vlis
|
||||
WHERE vtb_list.cod_vlis = '[cod_vlis]'
|
||||
AND data_iniz <= '[data_validita]'
|
||||
ORDER BY data_iniz DESC
|
||||
@@ -107,7 +107,10 @@ ControlloGiacenze.prototype.kendoInitiator = function () {
|
||||
.data(this.columns.map((column) => column.field))
|
||||
.execute();
|
||||
},
|
||||
selectable: "multiple, row",
|
||||
selectable: {
|
||||
mode: "multiple, row",
|
||||
dragToSelect: false
|
||||
},
|
||||
pageable: {
|
||||
refresh: true,
|
||||
pageSize: 25,
|
||||
|
||||
@@ -997,22 +997,21 @@ class DeliveryPlan {
|
||||
}
|
||||
|
||||
private static function getRigheOrdini($ordini, $day = null, $considerDataDocForCons = false) {
|
||||
|
||||
$ordersTableValues = self::ordersToValuesString($ordini);
|
||||
$Query = new Query;
|
||||
$Query->importSqlFile("getOrderRows")
|
||||
$query = new Query;
|
||||
$query->importSqlFile("getOrderRows")
|
||||
->setVar("values", implode(",", $ordersTableValues))
|
||||
->setVar("considerDataDocForCons", $considerDataDocForCons);
|
||||
|
||||
if (!is_null($day)) {
|
||||
if ($considerDataDocForCons) {
|
||||
$Query->whereDate("CONVERT(DATE, ISNULL(docs.data_doc,data_cons))", $day);
|
||||
$query->whereDate("CONVERT(DATE, ISNULL(docs.data_doc,data_cons))", $day);
|
||||
} else {
|
||||
$Query->whereDate("CONVERT(DATE, data_cons)", $day);
|
||||
$query->whereDate("CONVERT(DATE, data_cons)", $day);
|
||||
}
|
||||
}
|
||||
|
||||
return $Query->toRet()->execute();
|
||||
return $query->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function completaNotaCliente($cliente) {
|
||||
@@ -1699,6 +1698,7 @@ class DeliveryPlan {
|
||||
->set("numOrd", array_get($riepilogo, "num_ord"))
|
||||
->setDate("dataInizTrasp", array_get($riepilogo, "data_ora_iniz_trasp"))
|
||||
->set("note", array_get($riepilogo, "note_ord"), true)
|
||||
->set("postiPallet", array_get($riepilogo, "posti_pallet"), true)
|
||||
->set("dtbOrdr")->append($dtbOrdr);
|
||||
|
||||
$entityList->push($dtbOrdt);
|
||||
@@ -1741,12 +1741,14 @@ class DeliveryPlan {
|
||||
}
|
||||
|
||||
$vtbViaggi
|
||||
->set("codVvet", $codVvet)
|
||||
->set("codVvet", $codVvet, true)
|
||||
->set("codAuto", array_get($data, "codAuto"), true)
|
||||
->set("flagRitirClie", $flagRitirClie)
|
||||
->setDatetime("dataOraInizTrasp", $dataOraInizTrasp)
|
||||
->set("note", array_get($data, "note"))
|
||||
->set("targa", array_get($data, "targa"))
|
||||
->set("numPrenotazione", array_get($data, "num_prenotazione"));
|
||||
->set("note", array_get($data, "note"), true)
|
||||
->set("targa", array_get($data, "targa"), true)
|
||||
->set("numPrenotazione", array_get($data, "num_prenotazione"), true)
|
||||
->set("mezzo", array_get($data, "mezzo"));
|
||||
|
||||
return $vtbViaggi->send();
|
||||
}
|
||||
@@ -1811,7 +1813,7 @@ class DeliveryPlan {
|
||||
public static function getRiepilogoGiorno(array $data) {
|
||||
$dataCons = array_get($data, "dataCons");
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "get-riepiloghi-giorno", "cod_msgr, articolo");
|
||||
$query = KendoService::queryInitializerService($data, "get-riepiloghi-giorno", "cod_msgr, articolo", false, false);
|
||||
|
||||
$query->setDateVar("dataCons", $dataCons);
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ $depositi = $ret->is_OK() ? $ret->get_data() : array();
|
||||
<div class="col-xs-12 col-sm-10">
|
||||
<ul class="nav nav-tabs nav-justified">
|
||||
<li class="<?= $view === "weeklyPlanner" ? "active" : "" ?>" role="presentation">
|
||||
<a xdata-toggle="pill" href="<?= $_SERVER["PHP_SELF"] ?>" xhref="#tab-wp">Calendario spedizioni
|
||||
settimanale</a>
|
||||
<a xdata-toggle="pill" href="<?= $_SERVER["PHP_SELF"] ?>" xhref="#tab-wp">
|
||||
Calendario spedizioni settimanale
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?= $view === "monthlyPlanner" ? "active" : "" ?>" role="presentation">
|
||||
<a xdata-toggle="pill" href="?mp" xhref="#tab-mp">Calendario spedizioni mensile</a>
|
||||
|
||||
@@ -39,6 +39,7 @@ if (!is_null($key)) {
|
||||
}
|
||||
|
||||
$isNuovoOrdine = is_null($ordine);
|
||||
$arr_vettori = array();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$ret = StdUtils::getResources(array("vettori", "porti"));
|
||||
@@ -426,7 +427,9 @@ if ($ret->is_OK()) {
|
||||
<select name="cod_vvet" class="form-control input-sm" autocomplete="off">
|
||||
<option value="">Non selezionato</option>
|
||||
<?php foreach ($arr_vettori as $item) { ?>
|
||||
<option value="<?= $item["cod_vvet"] ?>"><?= $item["rag_soc"] ?></option>
|
||||
<option value="<?= array_get($item, "cod_vvet") ?>">
|
||||
<?= array_get($item, "rag_soc") ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -759,7 +759,7 @@ PopupOrdine.prototype._showModalAggiungiAlListino = function () {
|
||||
|
||||
if (self._getListino()) {
|
||||
arr_codMartExcluded = _.compact(self._getListino().map(function (item) {
|
||||
return item.isDeleted ? null : item.cod_mart;
|
||||
return item.isDeleted || !item.art_lisv ? null : item.cod_mart;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -120,16 +120,16 @@ _deliveryPlan.mp = {
|
||||
},
|
||||
|
||||
refreshOrdiniMese: function () {
|
||||
var self = this;
|
||||
var d = $.Deferred();
|
||||
const self = this;
|
||||
const d = $.Deferred();
|
||||
|
||||
self.planner.get$monthPicker().disableAll();
|
||||
|
||||
_deliveryPlan.plannerUtils.filter.reset();
|
||||
_deliveryPlan.plannerUtils.clearListOrdini();
|
||||
self.planner.initDroppables();
|
||||
|
||||
var limitDays = self.planner.getLimitDays();
|
||||
const limitDays = self.planner.getLimitDays();
|
||||
|
||||
_deliveryPlan.plannerUtils.getGiorniUtili(limitDays).done(function (ret) {
|
||||
self.refreshOrdiniGiorni(ret.returnData.days, true).always(function () {
|
||||
d.resolve();
|
||||
@@ -207,22 +207,18 @@ _deliveryPlan.mp = {
|
||||
},
|
||||
|
||||
refreshItems: function (reloadOrders) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
if (reloadOrders) {
|
||||
self.refreshOrdiniMese();
|
||||
} else {
|
||||
const days = self.planner.getDayList();
|
||||
|
||||
var days = self.planner.getDayList();
|
||||
for (var i = 0; i < days.length; i++) {
|
||||
for (let i = 0; i < days.length; i++) {
|
||||
self._showOrdiniGiorno(days[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//var arr_usefulDaysRapportini = ret.returnData.rapportini;
|
||||
//self.planner.getDaysCells().each(function(){
|
||||
// self.initBtViewRapportiniUtente($(this), arr_usefulDaysRapportini);
|
||||
//});
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
|
||||
@@ -315,29 +315,31 @@ _deliveryPlan.plannerUtils = {
|
||||
},
|
||||
|
||||
clearDaysListOrdini: function (days) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
self._listOrdini = _.filter(self._listOrdini, function (x) {
|
||||
return !(_.includes(days, x.data_cons));
|
||||
//return daysDiff(x.data_cons, day) !== 0;
|
||||
});
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
pushOrdini: function (rows) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
self._listOrdini = _.union(self._listOrdini, rows);
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
filterOrdiniGiorno: function (day) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
return _.filter(self._listOrdini, function (x) {
|
||||
var dates = _.map(x.rows, "data_cons");
|
||||
var isSospeso = x.flag_sospeso === "S";
|
||||
var flagIt = x.nazione === "IT";
|
||||
|
||||
var filter = self.filter;
|
||||
const dates = _.map(x.rows, "data_cons");
|
||||
const isSospeso = x.flag_sospeso === "S";
|
||||
const flagIt = x.nazione === "IT";
|
||||
const filter = self.filter;
|
||||
|
||||
return _.includes(dates, day) &&
|
||||
(!filter.show_soloSospesi() || (isSospeso && filter.show_soloSospesi())) &&
|
||||
@@ -350,8 +352,8 @@ _deliveryPlan.plannerUtils = {
|
||||
},
|
||||
|
||||
getListClienti: function () {
|
||||
var self = this;
|
||||
var ret = _.sortBy(
|
||||
const self = this;
|
||||
const ret = _.sortBy(
|
||||
_.uniqBy(
|
||||
_.map(self._listOrdini, function (x) {
|
||||
return _.pick(x, "cod_anag", "rag_soc", "indirizzo_clie", "citta_clie", "prov_clie");
|
||||
@@ -360,6 +362,7 @@ _deliveryPlan.plannerUtils = {
|
||||
),
|
||||
"cod_anag"
|
||||
);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
@@ -381,17 +384,19 @@ _deliveryPlan.plannerUtils = {
|
||||
$("<thead>")
|
||||
.append(
|
||||
$("<tr>", {class: "bg-primary"})
|
||||
.append("<th colspan='7'>" + duplicateBtn + " " + OrdtTitle.replace("__NUMORD__", ordine.num_ord).replace("__DATAORD__", moment(ordine.data_ord * 1000).format("DD/MM/YY")).replace("__CLIENTE__", ordine.rag_soc).replace("__RIFORD__", blankIfNull(ordine.rif_ord)) + "</th>")
|
||||
.append("<th colspan='9'>" + duplicateBtn + " " + OrdtTitle.replace("__NUMORD__", ordine.num_ord).replace("__DATAORD__", moment(ordine.data_ord * 1000).format("DD/MM/YY")).replace("__CLIENTE__", ordine.rag_soc).replace("__RIFORD__", blankIfNull(ordine.rif_ord)) + "</th>")
|
||||
)
|
||||
.append(
|
||||
$("<tr>", {class: "bg-primary"})
|
||||
.append("<th>Cod. Art.</th>")
|
||||
.append("<th>Descrizione</th>")
|
||||
.append("<th>Peso KG</th>")
|
||||
.append("<th>Colli</th>")
|
||||
.append("<th>Pedane</th>")
|
||||
.append("<th>Tipo Pedana</th>")
|
||||
.append(isGestioneVenditeAbilitata ? "<th>Prezzo</th>" : "")
|
||||
.append(isGestioneVenditeAbilitata ? "<th>Prezzo KG</th>" : "")
|
||||
.append(isGestioneVenditeAbilitata ? "<th>Prezzo a U.M.</th>" : "")
|
||||
.append("<th>Colli Residui</th>")
|
||||
)
|
||||
);
|
||||
|
||||
@@ -401,6 +406,7 @@ _deliveryPlan.plannerUtils = {
|
||||
let isImportoZero = row.val_unt === 0;
|
||||
$tbody.append(
|
||||
$("<tr>", {class: isImportoZero ? "warning" : ""})
|
||||
.append($("<td>", {class: "", text: row.cod_mart}))
|
||||
.append($("<td>", {class: "", text: row.descrizione_estesa}))
|
||||
.append($("<td>", {
|
||||
class: "text-monospace text-right",
|
||||
@@ -420,12 +426,16 @@ _deliveryPlan.plannerUtils = {
|
||||
}))
|
||||
.append(isGestioneVenditeAbilitata ? $("<td>", {
|
||||
class: "text-monospace text-right " + (isImportoZero ? "font-weight-bold text-warning" : ""),
|
||||
text: number_format(row.val_unt, 2, ".", "'") + "/" + row.unt_ord
|
||||
text: number_format(row.val_unt, 3, ".", "'") + "/" + row.unt_ord
|
||||
}) : null)
|
||||
.append(isGestioneVenditeAbilitata ? $("<td>", {
|
||||
class: "text-monospace text-right " + (isImportoZero ? "font-weight-bold text-warning" : ""),
|
||||
text: number_format((row.val_unt / row.rap_conv), 2, ".", "'")
|
||||
text: number_format((row.val_unt / row.rap_conv), 3, ".", "'")
|
||||
}) : null)
|
||||
.append($("<td>", {
|
||||
class: "text-monospace text-right",
|
||||
text: blankIfNull(row.colli_residui)
|
||||
}))
|
||||
);
|
||||
});
|
||||
|
||||
@@ -549,7 +559,7 @@ _deliveryPlan.plannerUtils = {
|
||||
},
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
self.$selectStato().selectpicker({style: "btn btn-default small"}).on("change", function () {
|
||||
self._onChangeCallback();
|
||||
@@ -572,12 +582,14 @@ _deliveryPlan.plannerUtils = {
|
||||
item_labelSmallKey: "cod_anag",
|
||||
item_labelSubKey: ["indirizzo_clie", "citta_clie", "prov_clie"],
|
||||
onSelect: function (e, clie, $this) {
|
||||
$this.blur(); //fix chrome: blur triggera change, e qui resetta
|
||||
self._setCodAnag(clie.cod_anag);
|
||||
$this.val(clie.rag_soc);
|
||||
$this.val(clie.rag_soc).blur();
|
||||
}
|
||||
}).on("change delete", function () {
|
||||
self.codAnag = null;
|
||||
if ($(this).valueIsEmpty()) {
|
||||
self.codAnag = null;
|
||||
}
|
||||
|
||||
self._onChangeCallback();
|
||||
});
|
||||
},
|
||||
@@ -612,7 +624,6 @@ _deliveryPlan.plannerUtils = {
|
||||
|
||||
_setCodAnag: function (codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
this._onChangeCallback();
|
||||
},
|
||||
|
||||
_setCodMdep: function (codMdep) {
|
||||
@@ -622,24 +633,25 @@ _deliveryPlan.plannerUtils = {
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
var self = this;
|
||||
var listOrdini = _deliveryPlan.plannerUtils.getListOrdini();
|
||||
const self = this;
|
||||
const listOrdini = _deliveryPlan.plannerUtils.getListOrdini();
|
||||
const countTutti = listOrdini.length;
|
||||
|
||||
var countTutti = listOrdini.length;
|
||||
self.$selectStato().find("option[value='']").text("Tutti (" + countTutti + ")");
|
||||
self.$selectNazione().find("option[value='']").text("Tutte le nazioni (" + countTutti + ")");
|
||||
|
||||
var suspendedCountWise = _.countBy(listOrdini, {flag_sospeso: "S"});
|
||||
const suspendedCountWise = _.countBy(listOrdini, {flag_sospeso: "S"});
|
||||
const countSospesi = _.isNil(suspendedCountWise.true) ? 0 : suspendedCountWise.true;
|
||||
|
||||
var countSospesi = _.isNil(suspendedCountWise.true) ? 0 : suspendedCountWise.true;
|
||||
self.$selectStato().find("option[value='sospesi']").text("Sospesi (" + countSospesi + ")");
|
||||
|
||||
var countNoSospesi = _.isNil(suspendedCountWise.false) ? 0 : suspendedCountWise.false;
|
||||
const countNoSospesi = _.isNil(suspendedCountWise.false) ? 0 : suspendedCountWise.false;
|
||||
|
||||
self.$selectStato().find("option[value='no-sospesi']").text("Non sospesi (" + countNoSospesi + ")");
|
||||
|
||||
var nationWiseCount = _.countBy(listOrdini, {nazione: "IT"});
|
||||
var countIT = _.isNil(nationWiseCount.true) ? 0 : nationWiseCount.true;
|
||||
var countEstero = _.isNil(nationWiseCount.false) ? 0 : nationWiseCount.false;
|
||||
const nationWiseCount = _.countBy(listOrdini, {nazione: "IT"});
|
||||
const countIT = _.isNil(nationWiseCount.true) ? 0 : nationWiseCount.true;
|
||||
const countEstero = _.isNil(nationWiseCount.false) ? 0 : nationWiseCount.false;
|
||||
|
||||
self.$selectNazione().find("option[value='IT']").text("Italia (" + countIT + ")");
|
||||
self.$selectNazione().find("option[value='ESTERO']").text("Estero (" + countEstero + ")");
|
||||
|
||||
@@ -383,19 +383,19 @@ _deliveryPlan.wp = {
|
||||
|
||||
_isLoading: false,
|
||||
refreshOrdiniGiorni: function (days, showToast) {
|
||||
var self = this;
|
||||
var d = $.Deferred();
|
||||
const self = this;
|
||||
const d = $.Deferred();
|
||||
const toastProgress = new Toast();
|
||||
showToast = !(is_undefined(showToast) || showToast !== true);
|
||||
|
||||
if (days.length > 0) {
|
||||
var daysPlanner = self.get$Planner().weekPlanner("getWeekDates");
|
||||
const daysPlanner = self.get$Planner().weekPlanner("getWeekDates");
|
||||
|
||||
self._isLoading = true;
|
||||
_deliveryPlan.plannerUtils.clearDaysListOrdini(days);
|
||||
_deliveryPlan.plannerUtils.filter.refresh().disable();
|
||||
|
||||
if (showToast) {
|
||||
var toastProgress = new Toast();
|
||||
toastProgress.progress().bottomRight().show("", "Caricamento ordini");
|
||||
}
|
||||
|
||||
@@ -408,10 +408,11 @@ _deliveryPlan.wp = {
|
||||
async.eachSeries(days, function (day, done) {
|
||||
if (daysPlanner.indexOf(day) >= 0) {
|
||||
if (showToast) {
|
||||
var dateFormatted = day.unixtime_format("D") + " " + ucfirst(getMonthName(day.unixtime_format("M"))) + " " + day.unixtime_format("YYYY");
|
||||
var index = days.indexOf(day);
|
||||
const dateFormatted = day.unixtime_format("D") + " " + ucfirst(getMonthName(day.unixtime_format("M"))) + " " + day.unixtime_format("YYYY");
|
||||
const index = days.indexOf(day);
|
||||
toastProgress.bottomRight().progressTime(index, days.length - 1, dateFormatted, "Caricamento ordini");
|
||||
}
|
||||
|
||||
self._refreshOrdiniGiorno(day, _deliveryPlan.plannerUtils.filter.codMdep)
|
||||
.done(function () {
|
||||
self.get$Planner().weekPlanner("enable_dayColumn", day);
|
||||
@@ -426,15 +427,17 @@ _deliveryPlan.wp = {
|
||||
}
|
||||
}, function () {
|
||||
self._isLoading = false;
|
||||
|
||||
_deliveryPlan.plannerUtils.filter.refresh().enable();
|
||||
self.adjustColumnsHeight();
|
||||
|
||||
if (showToast) {
|
||||
toastProgress.remove(500);
|
||||
}
|
||||
|
||||
d.resolve();
|
||||
self.get$Planner().weekPlanner("getSelector").enableAll();
|
||||
});
|
||||
|
||||
} else {
|
||||
d.resolve();
|
||||
}
|
||||
@@ -461,12 +464,13 @@ _deliveryPlan.wp = {
|
||||
},
|
||||
|
||||
_showOrdiniGiorno: function (day) {
|
||||
let self = this;
|
||||
const self = this;
|
||||
const arr_ordiniGiorno = _deliveryPlan.plannerUtils.filterOrdiniGiorno(day);
|
||||
|
||||
self._cleanDayItems(day);
|
||||
let arr_ordiniGiorno = _deliveryPlan.plannerUtils.filterOrdiniGiorno(day);
|
||||
|
||||
if (_deliveryPlan.raggruppaPerCliente()) {
|
||||
let arr_codAnag = Enumerable.From(arr_ordiniGiorno)
|
||||
const arr_codAnag = Enumerable.From(arr_ordiniGiorno)
|
||||
.Distinct(function (x) {
|
||||
return x.cod_anag;
|
||||
})
|
||||
@@ -475,18 +479,17 @@ _deliveryPlan.wp = {
|
||||
})
|
||||
.ToArray();
|
||||
for (let i = 0; i < arr_codAnag.length; i++) {
|
||||
var codAnag = arr_codAnag[i];
|
||||
var arr_ordiniClie = Enumerable.From(arr_ordiniGiorno).Where(function (x) {
|
||||
const codAnag = arr_codAnag[i];
|
||||
const arr_ordiniClie = Enumerable.From(arr_ordiniGiorno).Where(function (x) {
|
||||
return x.cod_anag === codAnag;
|
||||
}).ToArray();
|
||||
|
||||
if (arr_ordiniClie.length === 1) {
|
||||
self._appendOrdineSingolo(day, arr_ordiniClie[0]);
|
||||
|
||||
} else if (arr_ordiniClie.length > 1) {
|
||||
self._appendOrdineMultiplo(day, arr_ordiniClie);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let i = 0; i < arr_ordiniGiorno.length; i++) {
|
||||
self._appendOrdineSingolo(day, arr_ordiniGiorno[i]);
|
||||
@@ -501,9 +504,9 @@ _deliveryPlan.wp = {
|
||||
},
|
||||
|
||||
_appendOrdineSingolo: async function (day, ordine) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
const $item = await _deliveryPlan.plannerUtils.buildItemSingolo(ordine);
|
||||
|
||||
var $item = await _deliveryPlan.plannerUtils.buildItemSingolo(ordine);
|
||||
_deliveryPlan.plannerUtils.popover.build($item, ordine, day);
|
||||
self._appendItem($item, day);
|
||||
|
||||
|
||||
@@ -1,53 +1,45 @@
|
||||
SELECT mtb_aart.cod_msgr,
|
||||
mtb_sgrp.descrizione AS famiglia,
|
||||
dor.cod_mart,
|
||||
dor.descrizione AS articolo,
|
||||
SUM(FLOOR(dor.num_cnf / IIF(dor.colli_pedana = 0, 1, dor.colli_pedana))) AS num_pedane,
|
||||
dor.colli_pedana AS colli_pedana,
|
||||
SUM(dor.num_cnf - FLOOR(dor.num_cnf / IIF(dor.colli_pedana = 0, 1, dor.colli_pedana)) *
|
||||
dor.colli_pedana) AS colli_extra,
|
||||
SUM(dor.num_cnf) AS tot_colli
|
||||
FROM dtb_ordr dor
|
||||
INNER JOIN dtb_ordt dot
|
||||
ON dor.gestione = dot.gestione
|
||||
AND dor.data_ord = dot.data_ord
|
||||
AND dor.num_ord = dot.num_ord
|
||||
INNER JOIN mtb_aart ON dor.cod_mart = mtb_aart.cod_mart
|
||||
INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp
|
||||
INNER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND
|
||||
mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
WHERE dor.data_cons = '[dataCons]'
|
||||
AND dor.id_viaggio IS NOT NULL
|
||||
AND mtb_grup.tipo_mgrp IN ('PF', 'SL')
|
||||
AND dot.gestione = 'V'
|
||||
GROUP BY mtb_aart.cod_msgr, mtb_sgrp.descrizione, dor.cod_mart, dor.descrizione, dor.colli_pedana
|
||||
UNION ALL
|
||||
SELECT 'Z' AS cod_msgr,
|
||||
'PEDANE MISTE' AS famiglia,
|
||||
'' AS cod_mart,
|
||||
'PEDANE MISTE' AS articolo,
|
||||
COUNT(*) AS num_pedane,
|
||||
q.colliXPedanaMista AS colli_pedana,
|
||||
0 as colli_extra,
|
||||
0 as tot_colli
|
||||
FROM (SELECT dor.gestione,
|
||||
dor.data_ord,
|
||||
dor.num_ord,
|
||||
dor.gruppo_cons,
|
||||
SUM(dor.num_cnf) colliXPedanaMista
|
||||
FROM dtb_ordr dor
|
||||
INNER JOIN dtb_ordt dot
|
||||
ON dor.gestione = dot.gestione
|
||||
AND dor.data_ord = dot.data_ord
|
||||
AND dor.num_ord = dot.num_ord
|
||||
INNER JOIN mtb_aart ON dor.cod_mart = mtb_aart.cod_mart
|
||||
INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp
|
||||
INNER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND
|
||||
mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
WHERE dor.data_cons = '[dataCons]'
|
||||
AND dor.id_viaggio IS NOT NULL
|
||||
AND mtb_grup.tipo_mgrp IN ('PF', 'SL')
|
||||
AND dot.gestione = 'V'
|
||||
AND dor.gruppo_cons IS NOT NULL
|
||||
GROUP BY dor.gestione, dor.data_ord, dor.num_ord, dor.gruppo_cons) q
|
||||
GROUP BY colliXPedanaMista
|
||||
WITH Consegne AS (SELECT mtb_aart.cod_msgr,
|
||||
mtb_sgrp.descrizione AS famiglia,
|
||||
dor.cod_mart,
|
||||
dor.descrizione AS articolo,
|
||||
SUM(FLOOR(dor.num_cnf / IIF(dor.colli_pedana = 0, 1, dor.colli_pedana))) AS num_pedane,
|
||||
dor.colli_pedana AS colli_pedana,
|
||||
SUM(dor.num_cnf - FLOOR(dor.num_cnf / IIF(dor.colli_pedana = 0, 1, dor.colli_pedana)) *
|
||||
dor.colli_pedana) AS colli_extra,
|
||||
SUM(dor.num_cnf) AS tot_colli
|
||||
FROM dtb_ordr dor
|
||||
INNER JOIN dtb_ordt dot
|
||||
ON dor.gestione = dot.gestione
|
||||
AND dor.data_ord = dot.data_ord
|
||||
AND dor.num_ord = dot.num_ord
|
||||
INNER JOIN mtb_aart ON dor.cod_mart = mtb_aart.cod_mart
|
||||
INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp
|
||||
INNER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND
|
||||
mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
WHERE dor.data_cons = '[dataCons]'
|
||||
AND dor.id_viaggio IS NOT NULL
|
||||
AND mtb_grup.tipo_mgrp IN ('PF', 'SL')
|
||||
AND dot.gestione = 'V'
|
||||
GROUP BY mtb_aart.cod_msgr, mtb_sgrp.descrizione, dor.cod_mart, dor.descrizione, dor.colli_pedana),
|
||||
Giacenze AS
|
||||
(SELECT mtb_aart.cod_mart, CONVERT(DECIMAL(20, 5), SUM(qta_esistente / qta_cnf)) AS qta_esistente
|
||||
FROM mtb_part
|
||||
INNER JOIN mtb_aart ON mtb_part.cod_mart = mtb_aart.cod_mart
|
||||
GROUP BY mtb_aart.cod_mart),
|
||||
TempResult AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS row_number,
|
||||
*
|
||||
FROM (SELECT Consegne.*,
|
||||
ISNULL(Giacenze.qta_esistente, 0) AS qta_esistente,
|
||||
ISNULL(Giacenze.qta_esistente, 0) - Consegne.tot_colli AS qta_residua,
|
||||
IIF(Consegne.tot_colli < ISNULL(Giacenze.qta_esistente, 0), 0,
|
||||
Consegne.tot_colli - ISNULL(Giacenze.qta_esistente, 0)) AS ammanco
|
||||
FROM Consegne
|
||||
LEFT OUTER JOIN Giacenze ON Consegne.cod_mart = Giacenze.cod_mart) t
|
||||
WHERE [filter]),
|
||||
TempCount AS (SELECT COUNT(*) AS rows_count
|
||||
FROM TempResult)
|
||||
SELECT TempResult.*,
|
||||
TempCount.*
|
||||
FROM TempResult,
|
||||
TempCount
|
||||
ORDER BY [orderBy]
|
||||
@@ -1,20 +1,24 @@
|
||||
SELECT *
|
||||
FROM (SELECT IIF(vv.id_viaggio IS NULL, 0, 1) AS sort,
|
||||
IIF(ISNULL(vd.nazione, ga.nazione) = (SELECT nazione FROM azienda),
|
||||
'1 - ' + ISNULL(vd.nazione, ga.nazione),
|
||||
IIF(gn.flag_intracee = 'S', '2 - INTRACE', '3 - EXTRACE')) AS nazionalita,
|
||||
'3 - ' + TRIM(ISNULL(vd.nazione, ga.nazione)),
|
||||
IIF(gn.flag_intracee = 'S', '2 - INTRACE', '1 - EXTRACE')) AS nazionalita,
|
||||
vv.id_viaggio,
|
||||
vv.data_ora_iniz_trasp,
|
||||
vett.cod_vvet,
|
||||
vett.rag_soc AS vettore,
|
||||
auto.cod_auto,
|
||||
auto.descrizione AS automezzo,
|
||||
vv.note AS note_viag,
|
||||
vv.flag_ritir_clie,
|
||||
vv.targa,
|
||||
vv.num_prenotazione,
|
||||
vv.note AS note_viag,
|
||||
vv.mezzo,
|
||||
dor.gestione,
|
||||
dor.data_ord,
|
||||
dor.num_ord,
|
||||
dor.riga_ord,
|
||||
dor.pos_riga,
|
||||
su.precode,
|
||||
ga.cod_anag,
|
||||
ga.rag_soc,
|
||||
@@ -24,26 +28,33 @@ FROM (SELECT IIF(vv.id_viaggio IS NULL, 0, 1)
|
||||
dor.cod_mart,
|
||||
IIF(dor.cod_mart IS NOT NULL, dor.cod_mart + ' ', '') + dor.descrizione AS descrizione,
|
||||
dor.system_note AS cod_mdep,
|
||||
(
|
||||
-- SELECT mp.cod_mdep, md.descrizione, mp.qta_esistente
|
||||
-- FROM mtb_part mp
|
||||
-- INNER JOIN dbo.mtb_depo md ON mp.cod_mdep = md.cod_mdep
|
||||
-- WHERE cod_mart = dor.cod_mart
|
||||
-- AND mp.qta_esistente <> 0
|
||||
SELECT md.cod_mdep,
|
||||
md.descrizione,
|
||||
SUM(GIAC_qta) AS qta_esistente,
|
||||
IIF(art.qta_cnf > 1, 'COL', 'PZ') AS unt_mis
|
||||
FROM RossoGarganoExchange.dbo.GIACENZE gia
|
||||
INNER JOIN rossogargano.dbo.mtb_depo md
|
||||
ON gia.GIAC_CODMAG = cod_mdep AND md.flag_tipo_negozio = 'V'
|
||||
INNER JOIN RossoGargano.dbo.mtb_aart art on gia.GIAC_CODART = art.cod_mart
|
||||
WHERE gia.GIAC_CODART = dor.cod_mart
|
||||
GROUP BY md.cod_mdep, md.descrizione, art.qta_cnf
|
||||
FOR JSON PATH) AS depositi,
|
||||
ROUND(dor.num_cnf /
|
||||
IIF(dor.colli_pedana = 0, 1, dor.colli_pedana),
|
||||
0) AS pedane_ord,
|
||||
(SELECT md.cod_mdep,
|
||||
md.descrizione,
|
||||
SUM(mp.qta_esistente) / art.qta_cnf AS qta_esistente,
|
||||
IIF(art.qta_cnf > 1, 'COL', 'PZ') AS unt_mis
|
||||
FROM mtb_part mp
|
||||
INNER JOIN mtb_depo md ON mp.cod_mdep = md.cod_mdep AND md.flag_tipo_negozio = 'V'
|
||||
INNER JOIN mtb_aart art ON mp.cod_mart = art.cod_mart
|
||||
WHERE mp.cod_mart = dor.cod_mart
|
||||
AND mp.qta_esistente <> 0
|
||||
GROUP BY md.cod_mdep, md.descrizione, art.qta_cnf
|
||||
-- SELECT md.cod_mdep,
|
||||
-- md.descrizione,
|
||||
-- SUM(GIAC_qta) AS qta_esistente,
|
||||
-- IIF(art.qta_cnf > 1, 'COL', 'PZ') AS unt_mis
|
||||
-- FROM RossoGarganoExchange.dbo.GIACENZE gia
|
||||
-- INNER JOIN rossogargano.dbo.mtb_depo md
|
||||
-- ON gia.GIAC_CODMAG = cod_mdep AND md.flag_tipo_negozio = 'V'
|
||||
-- INNER JOIN RossoGargano.dbo.mtb_aart art on gia.GIAC_CODART = art.cod_mart
|
||||
-- WHERE gia.GIAC_CODART = dor.cod_mart
|
||||
-- GROUP BY md.cod_mdep, md.descrizione, art.qta_cnf
|
||||
FOR JSON PATH) AS depositi,
|
||||
dot.posti_pallet,
|
||||
IIF(mg.tipo_mgrp IN ('PF', 'SL'),
|
||||
ROUND(dor.num_cnf /
|
||||
IIF(dor.colli_pedana = 0, 1, dor.colli_pedana),
|
||||
0),
|
||||
0) AS pedane_ord,
|
||||
dor.num_cnf,
|
||||
dor.colli_pedana,
|
||||
dor.note,
|
||||
@@ -60,14 +71,16 @@ FROM (SELECT IIF(vv.id_viaggio IS NULL, 0, 1)
|
||||
AND dor.data_ord = dot.data_ord
|
||||
AND dor.num_ord = dot.num_ord
|
||||
INNER JOIN gtb_anag ga ON dot.cod_anag = ga.cod_anag
|
||||
LEFT OUTER JOIN mtb_aart ma ON dor.cod_mart = ma.cod_mart
|
||||
INNER JOIN mtb_aart ma ON dor.cod_mart = ma.cod_mart
|
||||
LEFT OUTER JOIN mtb_grup mg ON ma.cod_mgrp = mg.cod_mgrp
|
||||
LEFT OUTER JOIN vtb_viaggi vv ON dor.id_viaggio = vv.id_viaggio
|
||||
LEFT OUTER JOIN vtb_vett vett ON vv.cod_vvet = vett.cod_vvet
|
||||
LEFT OUTER JOIN vtb_auto auto ON vv.cod_auto = auto.cod_auto
|
||||
LEFT OUTER JOIN stb_user su ON dot.compilato_da = su.full_name
|
||||
LEFT OUTER JOIN vtb_dest vd ON dot.cod_anag = vd.cod_anag AND dot.cod_vdes = vd.cod_vdes
|
||||
LEFT OUTER JOIN gtb_nazi gn ON ISNULL(vd.nazione, ga.nazione) = gn.nazione
|
||||
WHERE --mg.tipo_mgrp IN ('PF', 'SL')
|
||||
dot.gestione = 'V'
|
||||
AND dot.flag_sospeso = 'N'
|
||||
AND dor.data_cons = '[dataCons]') t
|
||||
-- WHERE depositi IS NOT NULL
|
||||
@@ -22,4 +22,4 @@ SELECT vv.id_viaggio,
|
||||
WHERE vvi.id_viaggio = vv.id_viaggio) t) AS destinazioni
|
||||
FROM vtb_viaggi vv
|
||||
LEFT OUTER JOIN dbo.vtb_vett vett ON vv.cod_vvet = vett.cod_vvet
|
||||
WHERE data_ora_iniz_trasp >= '[dataOraInizTrasp]'
|
||||
WHERE data_ora_iniz_trasp = '[dataOraInizTrasp]'
|
||||
@@ -7,7 +7,7 @@ SELECT dtb_ordr.num_ord,
|
||||
dtb_ordr.riga_ord,
|
||||
dtb_ordr.cod_mart,
|
||||
mpm.partita_mag,
|
||||
mpm.flag_stato as stato_partita,
|
||||
mpm.flag_stato AS stato_partita,
|
||||
dtb_ordr.descrizione_estesa,
|
||||
dtb_ordr.val_unt,
|
||||
dtb_ordr.num_cnf,
|
||||
@@ -29,7 +29,8 @@ SELECT dtb_ordr.num_ord,
|
||||
vcv.qta_residua,
|
||||
dtb_ordr.peso_lordo,
|
||||
dtb_ordr.id_viaggio,
|
||||
mg.tipo_mgrp
|
||||
mg.tipo_mgrp,
|
||||
(dtb_ordr.qta_ord - dtb_ordr.qta_evasa) / dtb_ordr.qta_cnf AS colli_residui
|
||||
FROM orders
|
||||
LEFT JOIN dtb_ordr ON dtb_ordr.data_ord = orders.data_ord AND dtb_ordr.num_ord = orders.num_ord AND
|
||||
dtb_ordr.gestione = orders.gestione
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?php
|
||||
|
||||
if (isset($_GET["get_listDepo"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["get_listDepo"]);
|
||||
FileExchangePanel::get_listDepo($data)->display();
|
||||
|
||||
} else if (isset($_POST["transmit"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_POST["transmit"]);
|
||||
$files = array_values($_FILES);
|
||||
$file = $files[0];
|
||||
FileExchangePanel::transmit($data, $file)->display();
|
||||
|
||||
} else if (isset($_GET["get_log"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["get_log"]);
|
||||
FileExchangePanel::get_log($data)->display();
|
||||
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
foreach ($arr_rows as $row) {
|
||||
$idInventario = array_get($row, "idInventario");
|
||||
$dataInventario = array_get($row, "dataInventario");
|
||||
$dataOraInv = array_get($row, "dataOraInv");
|
||||
$filtro = array_get($row, "filtro");
|
||||
$codMdep = array_get($row, "codMdep");
|
||||
$numRighe = array_get($row, "numRighe");
|
||||
@@ -55,6 +56,7 @@
|
||||
<tr data-idInventario="<?= $idInventario ?>"
|
||||
data-codMdep="<?= $codMdep ?>"
|
||||
data-dataInventario="<?= $dataInventario ?>"
|
||||
data-dataOraInv="<?= $dataOraInv ?>"
|
||||
data-profileDb="<?= $profileDb ?>"
|
||||
class="<?= ($focusedRow == $idInventario) ? "focus_fade" : "" ?>">
|
||||
<?php if (!$isPuntoVendita) { ?>
|
||||
|
||||
@@ -40,12 +40,14 @@ $(function () {
|
||||
const idInventario = $tr.getAttr("data-idInventario");
|
||||
const codMdep = $tr.getAttr("data-codMdep");
|
||||
const dataInventario = $tr.getAttr("data-dataInventario");
|
||||
const dataOraInv = $tr.getAttr("data-dataOraInv");
|
||||
const profileDb = $tr.getAttr("data-profileDb");
|
||||
|
||||
const key = {
|
||||
idInventario,
|
||||
codMdep,
|
||||
dataInventario,
|
||||
dataOraInv,
|
||||
profileDb,
|
||||
}
|
||||
|
||||
@@ -176,9 +178,11 @@ const _inventario = {
|
||||
const idInventario = key.idInventario;
|
||||
const codMdep = key.codMdep;
|
||||
const today = moment().startOf("day").unix();
|
||||
const unixDataInv = moment(key.dataInventario, "DD/MM/YYYY").unix();
|
||||
const unixDataInv = key?.dataOraInv ? moment(key.dataOraInv, "DD/MM/YYYY").unix() : null;
|
||||
|
||||
key.isInventarioGiorno = today === unixDataInv;
|
||||
if (unixDataInv) {
|
||||
key.isInventarioGiorno = today === unixDataInv;
|
||||
}
|
||||
|
||||
ajax.get("popup-invenr")
|
||||
.data(key)
|
||||
@@ -193,8 +197,7 @@ const _inventario = {
|
||||
const modalBoxPopup = new ModalBox();
|
||||
|
||||
if (_USER.is_puntoVendita() || !key.isInventarioGiorno) {
|
||||
modalBoxPopup
|
||||
.closeOnly()
|
||||
modalBoxPopup.closeOnly();
|
||||
} else {
|
||||
modalBoxPopup
|
||||
.okClose()
|
||||
@@ -209,7 +212,6 @@ const _inventario = {
|
||||
modalBoxPopup.close();
|
||||
modalBoxWait.close();
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
SELECT mtb_invenr.cod_mart,
|
||||
CASE
|
||||
WHEN mtb_invenr.cod_mart IS NULL THEN 'ARTICOLO NON RICONOSCIUTO ' + scan_cod_barre
|
||||
ELSE descrizione END AS descrizione,
|
||||
qta_inv,
|
||||
unt_mis,
|
||||
id_riga,
|
||||
data_ora_inv,
|
||||
cod_tagl,
|
||||
cod_col,
|
||||
ISNULL(id_disp, '[np_value]') AS id_disp,
|
||||
ISNULL(zona, '[np_value]') AS zona
|
||||
FROM mtb_invenr
|
||||
LEFT OUTER JOIN mtb_aart ON mtb_invenr.cod_mart = mtb_aart.cod_mart
|
||||
WHERE id_inventario = [id_inventario]
|
||||
AND cod_mdep = '[cod_mdep]'
|
||||
ORDER BY zona, id_disp + 0, data_ora_inv, id_riga
|
||||
@@ -1,10 +0,0 @@
|
||||
SELECT id_inventario,
|
||||
data_inventario,
|
||||
filtro,
|
||||
cod_mdep,
|
||||
(SELECT COUNT(*)
|
||||
FROM mtb_invenr
|
||||
WHERE mtb_invent.id_inventario = mtb_invenr.id_inventario
|
||||
AND mtb_invent.cod_mdep = mtb_invenr.cod_mdep) AS num_righe
|
||||
FROM mtb_invent
|
||||
WHERE data_inventario >= DATEADD(YEAR, -5, GETDATE())
|
||||
@@ -5,14 +5,14 @@ class ListiniVendita {
|
||||
$Ret = new Ret;
|
||||
if ($Ret->is_OK()) {
|
||||
$retData = array(
|
||||
array("id" => "name", "data" => array()),
|
||||
array("id" => "codSpesTrasp", "data" => self::getCodSpesTrasp()),
|
||||
);
|
||||
$Ret->set_data($retData);
|
||||
}
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function updateListini($data) {
|
||||
public static function updateArticoloListino($data) {
|
||||
$listini = array_get($data, "listini.models");
|
||||
|
||||
if (is_null($listini)) {
|
||||
@@ -25,26 +25,58 @@ class ListiniVendita {
|
||||
$mtbLisvData = new EntityItem("mtb_lisv_data");
|
||||
|
||||
$mtbLisvData
|
||||
->update()
|
||||
->insert_or_update()
|
||||
->set("codVlis", array_get($listino, "cod_anag"))
|
||||
->setDate("dataIniz", array_get($listino, "data_iniz"))
|
||||
->set("codMart", array_get($listino, "cod_mart"))
|
||||
->set("przBase", array_get($listino, "costo"))
|
||||
->set("przVend", array_get($listino, "prz_vend"))
|
||||
->set("ricarica", array_get($listino, "ricarico"))
|
||||
->set("percProv", array_get($listino, "perc_prov"))
|
||||
->set("untMisVen", array_get($listino, "unt_mis_ven"));
|
||||
->set("ricarica", array_get($listino, "ricarico") ?: 0)
|
||||
->set("percSco1", array_get($listino, "sconto_1") ?: 0)
|
||||
->set("percSco2", array_get($listino, "sconto_2") ?: 0)
|
||||
->set("percProv", array_get($listino, "perc_prov") ?: 0)
|
||||
->set("percPromo", array_get($listino, "perc_promo") ?: 0)
|
||||
->set("untMisVen", array_get($listino, "unt_mis_ven"))
|
||||
->set("tipoVariazione", "U");
|
||||
|
||||
$vtbListData = new EntityItem("vtb_list_data");
|
||||
$entityList->push($mtbLisvData);
|
||||
|
||||
$vtbListData
|
||||
->no_op()
|
||||
->set("codVlis", array_get($listino, "cod_anag"))
|
||||
->set("versione", array_get($listino, "versione"))
|
||||
->set("mtbLisvData")->append($mtbLisvData);
|
||||
$jtbCicl = new EntityItem("jtb_cicl");
|
||||
|
||||
$entityList->push($vtbListData);
|
||||
$jtbCicl
|
||||
->update()
|
||||
->set("codProd", array_get($listino, "cod_mart"))
|
||||
->set("prezzoBase", array_get($listino, "costo"));
|
||||
|
||||
$entityList->push($jtbCicl);
|
||||
}
|
||||
|
||||
return $entityList->send();
|
||||
$imsApi = new IMSApi();
|
||||
|
||||
$imsApi
|
||||
->queryParam("tipoImportListino", "V")
|
||||
->post("importAnagListini")
|
||||
->body($entityList);
|
||||
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function saveCondCommListino($data) {
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
if (array_any_null(array($codVlis))) {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "loadCondCommListino");
|
||||
}
|
||||
|
||||
$vtbListData = new EntityItem("vtb_list_data");
|
||||
|
||||
$vtbListData
|
||||
->insert_or_update()
|
||||
->set("codVlis", $codVlis)
|
||||
->set("versione", array_get($data, "versione"))
|
||||
->set("condizioniComm", array_get($data, "condizioniComm"), true);
|
||||
|
||||
return $vtbListData->send();
|
||||
}
|
||||
|
||||
public static function updateListino($data) {
|
||||
@@ -64,6 +96,49 @@ class ListiniVendita {
|
||||
return $vtbList->send();
|
||||
}
|
||||
|
||||
public static function saveVtbListData($data) {
|
||||
$vtbListDataArray = array_get($data, "vtbListData");
|
||||
|
||||
if (is_null($vtbListDataArray)) {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "saveVtbListData");
|
||||
}
|
||||
|
||||
$vtbListData = EntityItem::fromArray(array_merge(
|
||||
$vtbListDataArray,
|
||||
array("type" => "vtb_list_data")
|
||||
));
|
||||
|
||||
return $vtbListData->send();
|
||||
}
|
||||
|
||||
public static function getCosti($data) {
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
if (is_null($codVlis)) {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "getCosti");
|
||||
}
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "get-costi", "2, 1");
|
||||
|
||||
$query
|
||||
->setDateVar("dataValidita", array_get($data, "dataValidita", time()))
|
||||
->setVar("codVlis", $codVlis)
|
||||
->setVar("tipoRagg", ContoEconomicoProdotto::getTipoRagguppamento());
|
||||
|
||||
$ret = $query->toRet()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$costi = $ret->get_data();
|
||||
|
||||
$ret->set_data(array(
|
||||
"data" => $costi,
|
||||
"total" => array_get($costi, "0.rows_count")
|
||||
));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getTrasporti($data) {
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
@@ -89,6 +164,10 @@ class ListiniVendita {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCodSpesTrasp() {
|
||||
return (new GestSetup())->keySection("COD_SPES_TRASP")->get();
|
||||
}
|
||||
|
||||
public static function updateTrasporti($data) {
|
||||
$trasporti = array_get($data, "trasporti.models");
|
||||
|
||||
@@ -188,7 +267,7 @@ class ListiniVendita {
|
||||
$incidPremio = array_get($premio, "perc_fat_04", 0);
|
||||
|
||||
if (!$incidPremio) {
|
||||
$incidPremio = (array_get($premio, "valore_fisso", 0) / array_get($premio, "fatturato_bdg", 0) ?: 1) * 100;
|
||||
$incidPremio = (array_get($premio, "valore_fisso", 0) / (array_get($premio, "fatturato_bdg") ?: 1)) * 100;
|
||||
}
|
||||
|
||||
$premio["incid_premio"] = $incidPremio;
|
||||
@@ -221,21 +300,33 @@ class ListiniVendita {
|
||||
$idRiga = array_get($premio, "id_riga");
|
||||
|
||||
if ($idRiga == 0) {
|
||||
$vtbListPremi->insert();
|
||||
$ret = self::getFatturatoBudget(array(
|
||||
"daData" => (new DateTime(array_get($premio, "da_data_fat")))->sub(new DateInterval("P1Y"))->getTimestamp(),
|
||||
"aData" => (new DateTime(array_get($premio, "a_data_fat")))->sub(new DateInterval("P1Y"))->getTimestamp(),
|
||||
"codVlis" => array_get($premio, "cod_vlis"),
|
||||
));
|
||||
|
||||
if ($ret->is_KO()) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$vtbListPremi
|
||||
->insert()
|
||||
->set("fatturatoBdg", $ret->get_data());
|
||||
} else {
|
||||
$vtbListPremi
|
||||
->update()
|
||||
->set("idRiga", $idRiga);
|
||||
->set("idRiga", $idRiga)
|
||||
->set("fatturatoBdg", array_get($premio, "fatturato_bdg"));
|
||||
}
|
||||
|
||||
$vtbListPremi
|
||||
->setDate("daDataFat", array_get($premio, "da_data_fat"))
|
||||
->setDate("aDataFat", array_get($premio, "a_data_fat"))
|
||||
->set("descrizione", array_get($premio, "descrizione"))
|
||||
->set("aImportoFat", array_get($premio, "a_importo_fat"))
|
||||
->set("percFat", array_get($premio, "percFat"))
|
||||
->set("valoreFisso", array_get($premio, "valore_fisso"))
|
||||
->set("fatturatoBdg", array_get($premio, "fatturato_bdg"));
|
||||
->set("aImportoFat04", array_get($premio, "a_importo_fat_04"))
|
||||
->set("percFat04", array_get($premio, "perc_fat_04"))
|
||||
->set("valoreFisso", array_get($premio, "valore_fisso"));
|
||||
|
||||
$vtbList = new EntityItem("vtb_list");
|
||||
|
||||
@@ -286,6 +377,26 @@ class ListiniVendita {
|
||||
return $entityList->send();
|
||||
}
|
||||
|
||||
public static function getFatturatoBudget($data) {
|
||||
$daData = array_get($data, "daData", time());
|
||||
$aData = array_get($data, "aData", time());
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
if (is_null($codVlis)) {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "getFatturatoBudget");
|
||||
}
|
||||
|
||||
$query = new Query();
|
||||
|
||||
$query
|
||||
->importSqlFile("get-fatturato-budget")
|
||||
->setDateVar("daData", $daData)
|
||||
->setDateVar("aData", $aData)
|
||||
->setVar("codVlis", $codVlis);
|
||||
|
||||
return $query->firstRowFirstValue()->toRet()->execute();
|
||||
}
|
||||
|
||||
public static function getStatistiche($data) {
|
||||
$codVlis = array_get($data, "codVlis");
|
||||
|
||||
@@ -293,14 +404,9 @@ class ListiniVendita {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "getStatistiche");
|
||||
}
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "get-statistiche", "1");
|
||||
|
||||
$currentYear = intval(date("Y"));
|
||||
$lastYear = $currentYear - 1;
|
||||
$query = KendoService::queryInitializerService($data, "get-statistiche", "4, 6");
|
||||
|
||||
$query
|
||||
->setVar("currentYear", $currentYear)
|
||||
->setVar("lastYear", $lastYear)
|
||||
->setVar("codVlis", $codVlis);
|
||||
|
||||
$ret = $query->toRet()->execute();
|
||||
|
||||
@@ -1 +1 @@
|
||||
#tableListini .k-header .k-link{justify-content:center}#tableListini .k-grid-header tr.k-table-row:nth-child(2){display:none}#tableListini tr:not(.k-grouping-row) td:not(.k-group-cell){border-bottom:1px solid rgba(0,0,0,.08)}#tableListini .k-grid-header{position:sticky;top:51px;z-index:3}#tableTrasporti .k-header .k-link{justify-content:center}#tableStatistiche .k-grouping-row{text-align:center}/*# sourceMappingURL=main.css.map */
|
||||
#tableListini .k-header .k-link{justify-content:center}#tableListini .k-grid-header tr.k-table-row:nth-child(2){display:none}#tableListini tr:not(.k-grouping-row) td:not(.k-group-cell){border-bottom:1px solid rgba(0,0,0,.08)}#tableListini .k-grid-header{position:sticky;top:51px;z-index:3}#tableCosti .k-header .k-link{justify-content:center}#tableTrasporti .k-header .k-link{justify-content:center}#tableStatistiche .k-grouping-row{text-align:center}/*# sourceMappingURL=main.css.map */
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 25 KiB |
@@ -18,6 +18,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
#tableCosti {
|
||||
.k-header .k-link {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
#tableTrasporti {
|
||||
.k-header .k-link {
|
||||
justify-content: center;
|
||||
|
||||
49
public_html/gest-lib/listini_vendita/sql/get-costi.sql
Normal file
49
public_html/gest-lib/listini_vendita/sql/get-costi.sql
Normal file
@@ -0,0 +1,49 @@
|
||||
SELECT list.cod_vlis AS cod_anag,
|
||||
list.versione,
|
||||
list.data_iniz,
|
||||
list.cod_mart AS id,
|
||||
list.cod_mart,
|
||||
mtb_aart.descrizione,
|
||||
list.unt_mis_ven,
|
||||
list.rap_conv AS pz_x_collo,
|
||||
lavorazione,
|
||||
confezionamento,
|
||||
ISNULL(lavorazione, 0) + ISNULL(confezionamento, 0) AS costo,
|
||||
list.ricarico,
|
||||
list.magg_prz_vend,
|
||||
CASE '[tipoRagg]'
|
||||
WHEN 'T' THEN ISNULL(mtb_aart.cod_mtip, '')
|
||||
WHEN 'G' THEN mtb_aart.cod_mgrp
|
||||
ELSE '' END AS cod_mtip,
|
||||
CASE '[tipoRagg]'
|
||||
WHEN 'T' THEN ISNULL(mtb_tipi.descrizione, '')
|
||||
WHEN 'G' THEN mtb_grup.descrizione
|
||||
ELSE '' END AS descr_tipi,
|
||||
CASE '[tipoRagg]'
|
||||
WHEN 'T' THEN ISNULL(mtb_aart.cod_mstp, '')
|
||||
WHEN 'G' THEN mtb_aart.cod_mgrp
|
||||
ELSE '' END AS cod_mstp,
|
||||
CASE '[tipoRagg]'
|
||||
WHEN 'T' THEN ISNULL(mtb_stip.descrizione, '')
|
||||
WHEN 'G' THEN mtb_sgrp.descrizione
|
||||
ELSE '' END AS descr_stipi,
|
||||
jc.prezzo_base,
|
||||
mtb_tipi.descrizione AS tipo,
|
||||
mtb_stip.descrizione AS sottotipo,
|
||||
mtb_aart.cod_tcol_ui,
|
||||
mtb_aart.marchio,
|
||||
CONCAT_WS(' ', mtb_tipi.descrizione, mtb_aart.cod_tcol_UI, CAST(mtb_aart.qta_cnf AS FLOAT), 'x',
|
||||
CAST(mtb_aart.peso_kg AS FLOAT), mtb_stip.descrizione, mtb_aart.marchio) AS group_equi
|
||||
FROM getListinoVendita('[dataValidita]', '[codVlis]', NULL) list
|
||||
INNER JOIN mtb_aart ON list.cod_mart = mtb_aart.cod_mart
|
||||
INNER JOIN jtb_cicl jc ON mtb_aart.cod_mart = jc.cod_prod
|
||||
INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp
|
||||
INNER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
LEFT OUTER JOIN mtb_tipi ON mtb_aart.cod_mtip = mtb_tipi.cod_mtip
|
||||
LEFT OUTER JOIN mtb_stip ON mtb_aart.cod_mtip = mtb_stip.cod_mtip AND
|
||||
mtb_aart.cod_mstp = mtb_stip.cod_mstp
|
||||
CROSS APPLY
|
||||
(SELECT SUM([lavorazione]) AS lavorazione, SUM([confezionamento]) AS confezionamento
|
||||
FROM (SELECT * FROM RossoGargano.dbo.f_ExplodeDistMultiLev_costi(list.cod_mart, list.rap_conv, 1)) p
|
||||
PIVOT ( SUM(CostoUnt) FOR activity_type_id IN ([lavorazione],[confezionamento])
|
||||
) pvt) Costi
|
||||
@@ -0,0 +1,9 @@
|
||||
SELECT SUM(Vend.BOL_IMPORTON) AS val_vend
|
||||
FROM RossoGarganoExchange.dbo.AnalisiVenditeMaster_TAB Vend
|
||||
INNER JOIN mtb_aart ON Vend.BOL_ART = mtb_aart.cod_mart
|
||||
INNER JOIN dbo.mtb_grup mg ON mtb_aart.cod_mgrp = mg.cod_mgrp
|
||||
INNER JOIN gtb_anag ON Vend.cod_anag = gtb_anag.cod_anag
|
||||
LEFT OUTER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
WHERE Vend.BOL_DTINS BETWEEN '[daData]' AND '[aData]'
|
||||
AND gtb_anag.cod_anag = '[codVlis]'
|
||||
AND mg.tipo_mgrp IN ('SL', 'PF')
|
||||
@@ -1,35 +1,25 @@
|
||||
SELECT cod_anag,
|
||||
SELECT gtb_anag.cod_anag,
|
||||
rag_soc,
|
||||
famiglia,
|
||||
cod_mart,
|
||||
articolo,
|
||||
ISNULL([[lastYear]], 0) AS val_vend_annop,
|
||||
ISNULL([[currentYear]], 0) AS val_vend_annoc,
|
||||
ISNULL([[lastYear]2], 0) AS costo_prod_annop,
|
||||
ISNULL([[currentYear]2], 0) AS costo_prod_annoc,
|
||||
ISNULL([[lastYear]3], 0) AS costo_trasp_annop,
|
||||
ISNULL([[currentYear]3], 0) AS costo_trasp_annoc,
|
||||
provvigioni,
|
||||
premi
|
||||
FROM (SELECT cod_anag,
|
||||
rag_soc,
|
||||
annoproduzione,
|
||||
annoproduzione AS annoproduzione2,
|
||||
annoproduzione AS annoproduzione3,
|
||||
famiglia,
|
||||
cod_mart,
|
||||
articolo,
|
||||
val_vend,
|
||||
costo_prod,
|
||||
costo_trasp,
|
||||
0 AS provvigioni,
|
||||
0 AS premi
|
||||
FROM RG_AnalisiVenditeDetail_costi
|
||||
WHERE (annoproduzione = YEAR(GETDATE())
|
||||
OR annoproduzione = YEAR(GETDATE()) - 1)
|
||||
AND cod_anag IN (SELECT cod_anag
|
||||
FROM vtb_clie
|
||||
WHERE cod_vlis = '[codVlis]')) AS Source
|
||||
PIVOT ( SUM(val_vend) FOR annoproduzione IN ([[lastYear]], [[currentYear]]) ) AS t
|
||||
PIVOT ( SUM(costo_prod) FOR annoproduzione2 IN ([[lastYear]2], [[currentYear]2]) ) AS t2
|
||||
PIVOT ( SUM(costo_trasp) FOR annoproduzione3 IN ([[lastYear]3], [[currentYear]3]) ) AS t3
|
||||
mtb_sgrp.descrizione AS famiglia,
|
||||
mtb_aart.cod_mart,
|
||||
cod_mart + ' - ' + mtb_aart.descrizione AS articolo,
|
||||
SUM(CASE WHEN BOL_ANNO = YEAR(GETDATE()) - 1 THEN Vend.BOL_IMPORTON ELSE 0 END) AS val_vend_annop,
|
||||
SUM(CASE WHEN BOL_ANNO = YEAR(GETDATE()) THEN Vend.BOL_IMPORTON ELSE 0 END) AS val_vend_annoc,
|
||||
0 AS costo_prod_annop,
|
||||
0 AS costo_prod_annoc,
|
||||
0 AS costo_trasp_annop,
|
||||
0 AS costo_trasp_annoc,
|
||||
0 AS provvigioni,
|
||||
0 AS premi
|
||||
FROM RossoGarganoExchange.dbo.AnalisiVenditeMaster_TAB Vend
|
||||
INNER JOIN mtb_aart ON Vend.BOL_ART = mtb_aart.cod_mart
|
||||
INNER JOIN dbo.mtb_grup mg ON mtb_aart.cod_mgrp = mg.cod_mgrp
|
||||
LEFT OUTER JOIN mtb_sgrp ON mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr
|
||||
INNER JOIN gtb_anag ON Vend.cod_anag = gtb_anag.cod_anag
|
||||
WHERE Vend.BOL_ANNO BETWEEN YEAR(GETDATE()) - 1 AND YEAR(GETDATE())
|
||||
AND gtb_anag.cod_anag IN (SELECT cod_anag
|
||||
FROM vtb_clie
|
||||
WHERE cod_vlis = '[codVlis]')
|
||||
AND mg.tipo_mgrp IN ('SL', 'PF')
|
||||
GROUP BY gtb_anag.cod_anag, rag_soc,
|
||||
mtb_sgrp.descrizione, mtb_aart.cod_mart, mtb_aart.descrizione
|
||||
File diff suppressed because it is too large
Load Diff
75
public_html/gest-lib/listini_vendita/ts/PopupCondComm.ts
Normal file
75
public_html/gest-lib/listini_vendita/ts/PopupCondComm.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import BasePopup from "@js/BasePopup.js";
|
||||
import {Listino} from "@gest-lib/listini_vendita/ts/ListiniVendita.js";
|
||||
|
||||
export default class PopupCondComm extends BasePopup {
|
||||
private readonly listino: Listino
|
||||
private editorCondComm: kendo.ui.Editor
|
||||
|
||||
constructor(listino: Listino, module: Module | null = null) {
|
||||
super("listini_vendita", module);
|
||||
|
||||
this.listino = listino;
|
||||
|
||||
this.modalBox
|
||||
.title("Condizioni Commerciali")
|
||||
.style("primary")
|
||||
.gridSize({xs: 12, md: 8})
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Salva",
|
||||
onClick: async (e, $btn) => {
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
if (await this.saveCondCommListino(this.listino, this.editorCondComm.value())) {
|
||||
this.modalBox.close();
|
||||
}
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async content(): Promise<string> {
|
||||
// language=HTML
|
||||
return `
|
||||
<textarea id="condComm"></textarea>
|
||||
`;
|
||||
}
|
||||
|
||||
async onBeforeShow($div: JQuery<HTMLElement>): Promise<void> {
|
||||
const listino = await this.getCondizioniCommLisv(this.listino);
|
||||
|
||||
this.editorCondComm = $div.find("#condComm")
|
||||
.val(listino?.condizioni_comm)
|
||||
.kendoEditor({})
|
||||
.data("kendoEditor");
|
||||
}
|
||||
|
||||
async getCondizioniCommLisv(listino: Listino) {
|
||||
const ret = await this.ajax()
|
||||
.module("conto_economico_prodotto")
|
||||
.get("getCondizioniCommLisv")
|
||||
.data(listino)
|
||||
.execute<{condizioni_comm: string}>();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
|
||||
async saveCondCommListino(listino: Listino, condizioniComm: string) {
|
||||
const ret = await this.ajax()
|
||||
.get("saveCondCommListino")
|
||||
.data({
|
||||
codVlis: listino.cod_vlis,
|
||||
versione: listino.versione,
|
||||
condizioniComm
|
||||
})
|
||||
.onSuccess({
|
||||
toast: "Condizioni Commerciali modificate con successo"
|
||||
})
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
}
|
||||
150
public_html/gest-lib/listini_vendita/ts/PopupVtbListData.ts
Normal file
150
public_html/gest-lib/listini_vendita/ts/PopupVtbListData.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
import FormPopup, {SubmitResponse} from "@js/FormPopup.js";
|
||||
import {OperationType, VtbListData} from "@js/ims/ems-core.module.js";
|
||||
import {getListDivi} from "@js/api/stdutils.js";
|
||||
|
||||
export default class PopupVtbListData extends FormPopup<VtbListData> {
|
||||
private readonly vtbListData?: VtbListData
|
||||
|
||||
constructor(vtbListData?: VtbListData, module?: Module | null) {
|
||||
super("listini_vendita", module);
|
||||
|
||||
this.vtbListData = vtbListData;
|
||||
|
||||
this.modalBox
|
||||
.title(`${this.vtbListData?.codVlis && "Modifica" || "Nuovo"} listino di vendita`)
|
||||
.style("success")
|
||||
.gridSize({xs: 12, sm: 8})
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Salva",
|
||||
dismissOnClick: false
|
||||
});
|
||||
|
||||
this.options = {
|
||||
formData: {
|
||||
...this.vtbListData
|
||||
} as VtbListData,
|
||||
layout: "grid",
|
||||
grid: {
|
||||
cols: 4,
|
||||
gutter: 10
|
||||
},
|
||||
items: [
|
||||
{
|
||||
field: "codVlis",
|
||||
label: "Cod. Listino",
|
||||
title: "Cod. Listino",
|
||||
editor: "TextBox",
|
||||
editorOptions: {
|
||||
keyup(e: kendo.ui.TextBoxKeyupEvent) {
|
||||
const value = e.sender.element.val();
|
||||
|
||||
if (value) {
|
||||
e.sender.value(value.toString().toUpperCase());
|
||||
}
|
||||
}
|
||||
} as kendo.ui.TextBoxOptions
|
||||
},
|
||||
{
|
||||
field: "descrizione",
|
||||
label: "Descrizione",
|
||||
title: "Descrizione",
|
||||
colSpan: 3,
|
||||
editor: "TextBox",
|
||||
editorOptions: {
|
||||
keyup(e: kendo.ui.TextBoxKeyupEvent) {
|
||||
const value = e.sender.element.val();
|
||||
|
||||
if (value) {
|
||||
e.sender.value(value.toString().toUpperCase());
|
||||
}
|
||||
}
|
||||
} as kendo.ui.TextBoxOptions
|
||||
},
|
||||
{
|
||||
field: "dataIniz",
|
||||
label: "Data inizio",
|
||||
title: "Data inizio",
|
||||
colSpan: 2,
|
||||
editor: "DatePicker",
|
||||
editorOptions: {
|
||||
dateInput: true
|
||||
} as kendo.ui.DatePickerOptions
|
||||
},
|
||||
{
|
||||
field: "codDivi",
|
||||
label: "Cod. Divisa",
|
||||
title: "Cod. Divisa",
|
||||
colSpan: 2,
|
||||
editor: "DropDownList",
|
||||
editorOptions: {
|
||||
filter: "contains",
|
||||
dataTextField: "descrizione",
|
||||
dataValueField: "codDivi",
|
||||
optionLabel: "Seleziona il cod. divisa",
|
||||
valuePrimitive: true,
|
||||
dataBound: (e) => e.sender.list.find(".k-list-optionlabel").remove(),
|
||||
dataSource: {
|
||||
sort: {
|
||||
field: "descrizione",
|
||||
dir: "asc"
|
||||
},
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
try {
|
||||
const ret = await getListDivi();
|
||||
|
||||
options.success(ret);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
options.error(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: {
|
||||
model: {
|
||||
id: "codDivi",
|
||||
}
|
||||
}
|
||||
},
|
||||
} as kendo.ui.DropDownListOptions,
|
||||
}
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
onShow($div: JQuery<HTMLElement>) {
|
||||
super.onShow($div);
|
||||
|
||||
this.form.element.find("input").first().trigger("focus")
|
||||
}
|
||||
|
||||
async onSubmit(e: kendo.ui.FormSubmitEvent): Promise<SubmitResponse<VtbListData>> {
|
||||
console.log(e);
|
||||
|
||||
return await this.saveVtbListData(new VtbListData({
|
||||
...e.model,
|
||||
type: "vtb_list_data",
|
||||
operation: this.vtbListData?.codVlis && OperationType.UPDATE || OperationType.INSERT
|
||||
}));
|
||||
}
|
||||
|
||||
async saveVtbListData(vtbListData: VtbListData) {
|
||||
const ret = await this.ajax()
|
||||
.post("saveVtbListData")
|
||||
.data({vtbListData})
|
||||
.waitModal()
|
||||
.noticeAsModal()
|
||||
.execute<VtbListData>();
|
||||
|
||||
const response: SubmitResponse<VtbListData> = {
|
||||
success: ret?.returnId === 1,
|
||||
data: {
|
||||
...this.vtbListData,
|
||||
...ret?.returnData[0].entity
|
||||
}
|
||||
};
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
376
public_html/gest-lib/listini_vendita/ts/TabCostiProd.ts
Normal file
376
public_html/gest-lib/listini_vendita/ts/TabCostiProd.ts
Normal file
@@ -0,0 +1,376 @@
|
||||
import {TabImpl} from "@js/modules/TabsViewModule.js";
|
||||
import ListiniVendita from "@gest-lib/listini_vendita/ts/ListiniVendita.js";
|
||||
import {numberStyle} from "@js/utils.js";
|
||||
|
||||
export class Costo extends kendo.data.Model.define({
|
||||
id: "id",
|
||||
fields: {
|
||||
id: {type: "string"},
|
||||
cod_anag: {type: "string"},
|
||||
versione: {type: "number"},
|
||||
data_iniz: {type: "date"},
|
||||
cod_mart: {type: "string"},
|
||||
descrizione: {type: "string"},
|
||||
unt_mis_ven: {type: "string"},
|
||||
pz_x_collo: {type: "number"},
|
||||
lavorazione: {type: "number"},
|
||||
confezionamento: {type: "number"},
|
||||
costo: {type: "number"},
|
||||
ricarico: {type: "number"},
|
||||
magg_prz_vend: {type: "number"},
|
||||
cod_mtip: {type: "string"},
|
||||
descr_tipi: {type: "string"},
|
||||
cod_mstp: {type: "string"},
|
||||
descr_stipi: {type: "string"},
|
||||
prezzo_base: {type: "number"},
|
||||
tipo: {type: "string"},
|
||||
sottotipo: {type: "string"},
|
||||
cod_tcol_ui: {type: "string"},
|
||||
marchio: {type: "string"},
|
||||
}
|
||||
}) {
|
||||
cod_anag: string;
|
||||
versione: number;
|
||||
data_iniz: Date;
|
||||
cod_mart: string;
|
||||
descrizione: string;
|
||||
unt_mis_ven: string;
|
||||
pz_x_collo: number;
|
||||
lavorazione: number;
|
||||
confezionamento: number;
|
||||
costo: number;
|
||||
ricarico: number;
|
||||
magg_prz_vend: number;
|
||||
cod_mtip: string;
|
||||
descr_tipi: string;
|
||||
cod_mstp: string;
|
||||
descr_stipi: string;
|
||||
prezzo_base: number;
|
||||
tipo?: string;
|
||||
sottotipo?: string;
|
||||
cod_tcol_ui?: string;
|
||||
marchio?: string;
|
||||
}
|
||||
|
||||
export default class TabCostiProd extends TabImpl<ListiniVendita> {
|
||||
private readonly columnsCosti: Array<kendo.ui.GridColumn>
|
||||
private readonly dataSourceCosti: kendo.data.DataSource
|
||||
private gridCosti: kendo.ui.Grid
|
||||
|
||||
id = "costi_prod";
|
||||
title = "Costi di Produzione";
|
||||
component = {
|
||||
content: async () => {
|
||||
// language=HTML
|
||||
return `
|
||||
<div id="tableCosti"></div>
|
||||
`;
|
||||
},
|
||||
onShown: async () => {
|
||||
if (this.gridCosti) {
|
||||
if (this.module.listino.get("value")?.cod_vlis) {
|
||||
this.dataSourceCosti.read();
|
||||
}
|
||||
} else {
|
||||
this.gridCosti = await _kendo.savableTable(this.module.$container.find("#tableCosti"), "COSTI", {
|
||||
columns: this.columnsCosti,
|
||||
dataSource: this.dataSourceCosti,
|
||||
filterable: {
|
||||
mode: "menu"
|
||||
},
|
||||
pageable: false,
|
||||
scrollable: false,
|
||||
sortable: true,
|
||||
editable: true,
|
||||
selectable: "multiple, row",
|
||||
contextMenu: {
|
||||
body: [
|
||||
{
|
||||
name: "UpdCostoProd",
|
||||
text: "Applica costo da produzione",
|
||||
icon: "- fas fa-check",
|
||||
command: "UpdCostoProd"
|
||||
},
|
||||
{
|
||||
name: "UpdCostoStd",
|
||||
text: "Applica costo da standard",
|
||||
icon: "- fas fa-check",
|
||||
command: "UpdCostoStd"
|
||||
}
|
||||
],
|
||||
open: (e) => {
|
||||
const selectedRows = this.gridCosti.select();
|
||||
const targetTr = $(e.target).parents("tr").get(0);
|
||||
|
||||
if (!selectedRows.toArray().some(selectedRow => selectedRow === targetTr)) {
|
||||
this.gridCosti.clearSelection();
|
||||
this.gridCosti.select(targetTr);
|
||||
}
|
||||
}
|
||||
},
|
||||
save: async (e) => {
|
||||
const costo = e.model as Costo;
|
||||
|
||||
if (costo.dirty) {
|
||||
if (e.values?.prezzo_base) {
|
||||
costo.set("costo", e.values.prezzo_base);
|
||||
|
||||
e.values.costo = e.values.prezzo_base;
|
||||
}
|
||||
|
||||
const currentRow = e.container.parent(".k-master-row");
|
||||
|
||||
currentRow
|
||||
.prevUntil(".k-grouping-row")
|
||||
.addBack()
|
||||
.nextUntil(".k-grouping-row")
|
||||
.addBack()
|
||||
.not(currentRow)
|
||||
.map((i, el) => e.sender.dataItem(el))
|
||||
.toArray()
|
||||
.forEach(listinoGruppo => {
|
||||
Object.entries(e.values).forEach(([key, value]) => {
|
||||
listinoGruppo.set(key, value);
|
||||
})
|
||||
});
|
||||
|
||||
await timeout(250);
|
||||
|
||||
await this.dataSourceCosti.sync();
|
||||
|
||||
// const przVend = await calcPrzVend({
|
||||
// codVlis: costo.cod_anag,
|
||||
// codMart: costo.cod_mart,
|
||||
// przBase: costo.costo,
|
||||
// ricarico: costo.ricarico,
|
||||
// maggPrzVend: costo.magg_prz_vend
|
||||
// });
|
||||
//
|
||||
// costo.set("prz_vend", przVend);
|
||||
//
|
||||
// await this.dataSourceCosti.sync();
|
||||
}
|
||||
},
|
||||
remove: async (e: kendo.ui.GridRemoveEvent) => {
|
||||
await timeout(250);
|
||||
|
||||
await e.sender.dataSource.sync();
|
||||
},
|
||||
}, {autoBind: !!this.module.listino.get("value")?.cod_vlis});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
kendo.ui.grid.commands["UpdCostoProd"] = kendo.ui.grid.GridCommand.extend({
|
||||
exec: async () => {
|
||||
const selectedRows = this.gridCosti.select();
|
||||
|
||||
const costi = selectedRows
|
||||
.map((i, row) => this.gridCosti.dataItem(row) as Costo)
|
||||
.toArray();
|
||||
|
||||
if (costi?.length) {
|
||||
costi.forEach(costo => costo.dirty = true);
|
||||
|
||||
this.gridCosti.saveChanges();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
kendo.ui.grid.commands["UpdCostoStd"] = kendo.ui.grid.GridCommand.extend({
|
||||
exec: async () => {
|
||||
const selectedRows = this.gridCosti.select();
|
||||
|
||||
const costi = selectedRows
|
||||
.map((i, row) => this.gridCosti.dataItem(row) as Costo)
|
||||
.toArray();
|
||||
|
||||
if (costi?.length) {
|
||||
costi.forEach(costo => costo.set("costo", costo.prezzo_base));
|
||||
|
||||
this.gridCosti.saveChanges();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constructor(module: ListiniVendita) {
|
||||
super(module);
|
||||
|
||||
this.columnsCosti = _kendo.setDefaultCellOptions([
|
||||
{
|
||||
id: "36ef7095-8fa3-4baf-aa16-54b644cfa4d9",
|
||||
field: "descr_stipi",
|
||||
title: "Categoria",
|
||||
type: "string",
|
||||
hidden: true,
|
||||
groupHeaderTemplate: (data) => `<span style="font-size: 1.1em">${data.value}</span>`
|
||||
},
|
||||
{
|
||||
id: "fe513d77-4ef4-4335-a5e2-4b9e56c90188",
|
||||
field: "group_equi",
|
||||
title: "Gruppo",
|
||||
type: "string",
|
||||
hidden: true,
|
||||
groupHeaderTemplate: (data) => `<span class="k-font-italic" style="font-size: 0.9em">${data.value}</span>`
|
||||
},
|
||||
{
|
||||
id: "49c164e4-3717-4f93-9f85-ac325e1a484e",
|
||||
field: "cod_mart",
|
||||
title: "Articolo",
|
||||
type: "string",
|
||||
},
|
||||
{
|
||||
id: "68c2375b-7744-49d8-b5ca-99fb7a00680e",
|
||||
field: "descrizione",
|
||||
title: "Descrizione",
|
||||
type: "string",
|
||||
},
|
||||
{
|
||||
id: "de8ac6c3-e684-41c3-8856-d50942b45b89",
|
||||
field: "lavorazione",
|
||||
title: "Costi di<br>lavorazione",
|
||||
type: "number",
|
||||
template: ({lavorazione}) => numberStyle(lavorazione, undefined, {
|
||||
postfix: "€",
|
||||
precision: 4
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: "c0721b62-4911-4b54-b007-e7636693fb94",
|
||||
field: "confezionamento",
|
||||
title: "Costi di<br>confezionamento",
|
||||
type: "number",
|
||||
template: ({confezionamento}) => numberStyle(confezionamento, undefined, {
|
||||
postfix: "€",
|
||||
precision: 4
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'c0721b62-4911-4b54-b007-e7636693fb94',
|
||||
field: "costo",
|
||||
title: "Costi di<br>produzione<br>calcolato",
|
||||
type: "number",
|
||||
template: ({costo}) => numberStyle(costo, undefined, {
|
||||
postfix: "€",
|
||||
precision: 4
|
||||
}),
|
||||
editable: () => false,
|
||||
editor: (container, options) => {
|
||||
$(`<input name="${options.field}" data-bind="value: ${options.field}" title="${options.field}"/>`)
|
||||
.appendTo(container)
|
||||
.kendoNumericTextBox({
|
||||
spinners: false,
|
||||
selectOnFocus: true,
|
||||
decimals: 2
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "bf4b815a-d763-4895-a5f1-fe2e481e1d9c",
|
||||
field: "prezzo_base",
|
||||
title: "Costo di<br>produzione<br>impostato",
|
||||
type: "number",
|
||||
template: ({prezzo_base}) => numberStyle(prezzo_base, undefined, {
|
||||
postfix: "€",
|
||||
precision: 4
|
||||
}),
|
||||
editable: () => true,
|
||||
editor: (container, options) => {
|
||||
$(`<input name="${options.field}" data-bind="value: ${options.field}" title="${options.field}"/>`)
|
||||
.appendTo(container)
|
||||
.kendoNumericTextBox({
|
||||
spinners: false,
|
||||
selectOnFocus: true,
|
||||
decimals: 2
|
||||
});
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
this.dataSourceCosti = new kendo.data.DataSource({
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
_kendo.checkFilterValuesColumns(
|
||||
options.data.filter,
|
||||
this.columnsCosti
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await this.getCosti({
|
||||
...options.data,
|
||||
cod_vlis: this.module.listino.get("value")?.cod_vlis,
|
||||
data_validita: this.module.dataVariazioni.value()
|
||||
});
|
||||
|
||||
options.success(data);
|
||||
} catch (e) {
|
||||
options.error(e);
|
||||
}
|
||||
},
|
||||
update: async (options) => {
|
||||
try {
|
||||
options.success(await this.module.updateArticoloListino({
|
||||
models: options.data.models.map(model => ({
|
||||
...model,
|
||||
data_iniz: this.module.dataVariazioni.value() || options.data.data_iniz
|
||||
}))
|
||||
} as any));
|
||||
|
||||
await this.module.refreshVariazioni();
|
||||
await this.dataSourceCosti.read();
|
||||
} catch (e) {
|
||||
options.error(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
batch: true,
|
||||
schema: {
|
||||
data: "data",
|
||||
total: "total",
|
||||
model: Costo
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
field: "cod_mtip",
|
||||
dir: "asc"
|
||||
},
|
||||
{
|
||||
field: "cod_mstp",
|
||||
dir: "asc"
|
||||
},
|
||||
{
|
||||
field: "cod_mart",
|
||||
dir: "asc"
|
||||
}
|
||||
],
|
||||
group: [
|
||||
{
|
||||
field: "descr_stipi"
|
||||
},
|
||||
{
|
||||
field: "group_equi"
|
||||
}
|
||||
],
|
||||
serverPaging: false,
|
||||
serverFiltering: false,
|
||||
serverSorting: false,
|
||||
});
|
||||
}
|
||||
|
||||
async getCosti(data) {
|
||||
const ret = await this.module.ajax()
|
||||
.get("getCosti")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute<{
|
||||
data: Array<Costo>,
|
||||
total: number
|
||||
}>();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
}
|
||||
@@ -1751,10 +1751,13 @@ const _mappaCampiDiRaccolta = {
|
||||
}
|
||||
|
||||
const $backButton = $templateOrderPanel.find("#backButton");
|
||||
let dropzone;
|
||||
|
||||
$backButton.on("click", function () {
|
||||
$backButton.disableAllToggle();
|
||||
|
||||
dropzone?.destroy();
|
||||
|
||||
$orderPanel.animate(
|
||||
{
|
||||
left: "+=100%",
|
||||
@@ -2050,7 +2053,7 @@ const _mappaCampiDiRaccolta = {
|
||||
|
||||
const $dropzone = $templateOrderPanel.find("#dropzone");
|
||||
|
||||
$dropzone.dropzone({
|
||||
dropzone = $dropzone.dropzone({
|
||||
multiple: false,
|
||||
async onDrop(e, files) {
|
||||
e.preventDefault();
|
||||
@@ -2155,9 +2158,13 @@ const _mappaCampiDiRaccolta = {
|
||||
|
||||
const $backButton = $templateReportPanel.find("#backButton");
|
||||
|
||||
let dropzone;
|
||||
|
||||
$backButton.on("click", function () {
|
||||
$backButton.disableAllToggle();
|
||||
|
||||
dropzone?.destroy();
|
||||
|
||||
$reportPanel.animate(
|
||||
{
|
||||
left: "+=100%",
|
||||
@@ -2218,7 +2225,7 @@ const _mappaCampiDiRaccolta = {
|
||||
|
||||
const $dropzone = $templateReportPanel.find("#dropzone");
|
||||
|
||||
$dropzone.dropzone({
|
||||
dropzone = $dropzone.dropzone({
|
||||
async onDrop(e, files) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ class ModalMrp {
|
||||
array("id" => "mediaConsumi", "data" => self::getMediaConsumi()),
|
||||
array("id" => "codMartMiscela", "data" => self::getCodMartMiscela()),
|
||||
array("id" => "checkDisponibilitaMP", "data" => self::getCheckDisponibilitaMP()),
|
||||
array("id" => "daysForWarning", "data" => self::daysForWarning())
|
||||
array("id" => "daysForWarning", "data" => self::daysForWarning()),
|
||||
array("id" => "flagAttivaSelezioneMultiplaOrdV", "data" => self::flagAttivaSelezioneMultiplaOrdV())
|
||||
);
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
@@ -218,6 +219,12 @@ class ModalMrp {
|
||||
return $gestSetup->section("MRP")->keySection("DAYS_FOR_WARNING")->asInt()->get();
|
||||
}
|
||||
|
||||
public static function flagAttivaSelezioneMultiplaOrdV() {
|
||||
$gestSetup = new GestSetup();
|
||||
|
||||
return $gestSetup->section("MRP")->keySection("ATTIVA_SELEZIONE_MULTIPLA_ORDV")->asBoolean()->get();
|
||||
}
|
||||
|
||||
public static function getDepositoArrivo() {
|
||||
$Ret = StdUtils::getListDepositiAziendali();
|
||||
if ($Ret->is_OK()) {
|
||||
@@ -690,18 +697,7 @@ class ModalMrp {
|
||||
$rapConvProd = $prodotto["rap_conv_prod"];
|
||||
$untMisProd = $prodotto["unt_mis_prod"];
|
||||
$codMdep = $codMdep ?: $deposito["cod_mdep"];
|
||||
//$arr_commesse = $data["commesse"];
|
||||
|
||||
$body = new EntityItem();
|
||||
// $EntityList = new EntityList;
|
||||
// if (!empty($partitaMag)) {
|
||||
// $MtbPartitaMag = new EntityItem("mtb_partita_mag");
|
||||
// $MtbPartitaMag->insert_or_update()
|
||||
// ->set("partitaMag", $partitaMag)
|
||||
// ->set("codMart", $codMart)
|
||||
// ->setDate("dataScad", $dataScad);
|
||||
// $EntityList->push($MtbPartitaMag);
|
||||
// }
|
||||
|
||||
// ORDINE DI PRODUZIONE
|
||||
$OrdProd = new EntityItem("dtb_ordt");
|
||||
@@ -751,43 +747,10 @@ class ModalMrp {
|
||||
->set("codTcolUl", $codTcolUl)
|
||||
->set("note", $note);
|
||||
|
||||
// if (isset($data["cod_jcom"])) {
|
||||
// $OrdLav->set("codJcom", $data["cod_jcom"]);
|
||||
// }
|
||||
/*
|
||||
if(count($arr_commesse)==1){
|
||||
$OrdLav->set("codJcom", $arr_commesse[0]);
|
||||
}*/
|
||||
$OrdProd->set("dtbOrdr")->append($OrdLav);
|
||||
|
||||
$body->set("ordine", $OrdProd, false, true);
|
||||
$body->set("ordiniSelezionati", array_get($data, "ordiniSelezionati"));
|
||||
// $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")
|
||||
->from("dtb_ordr")
|
||||
->where("gestione", "V")
|
||||
->where("cod_jcom", $codJcom)
|
||||
->where("cod_mart", $codMart);
|
||||
$Ret = $query->toRet()->execute();
|
||||
if($Ret->is_OK()){
|
||||
$arr_ordini = $Ret->get_data();
|
||||
foreach($arr_ordini as $ordine){
|
||||
$DtbOrdr = new EntityItem("dtb_ordr");
|
||||
$DtbOrdr->update()
|
||||
->set("partitaMag", $partitaMag)
|
||||
->set("gestione", "V")
|
||||
->setDate("dataOrd", $ordine["data_ord"])
|
||||
->set("numOrd", $ordine["num_ord"])
|
||||
->set("rigaOrd", $ordine["riga_ord"]);
|
||||
$EntityList->push($DtbOrdr);
|
||||
}
|
||||
} else{
|
||||
return $Ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
$imsApi = new IMSApi();
|
||||
|
||||
@@ -880,12 +843,11 @@ class ModalMrp {
|
||||
$flagInsertedOrdProd = false;
|
||||
$flagEditedCodJfas = !in_array($codJfasPrev, $codJfas);
|
||||
$flagEditedDataOrd = Utility\Date\Day::diff($orderLavKey["data_ord"], $newDataOrd) !== 0;
|
||||
$partitaMag = array_get($data, "partita_mag");
|
||||
|
||||
$entityList = new EntityList;
|
||||
|
||||
if ($flagInCorso) {
|
||||
$partitaMag = array_get($data, "partita_mag");
|
||||
|
||||
if (isset($partitaMag)) {
|
||||
$mtbPartitaMag = new EntityItem("mtb_partita_mag");
|
||||
|
||||
@@ -986,8 +948,6 @@ class ModalMrp {
|
||||
$Entity->update()->set("nativeSql", $queryB);
|
||||
$entityList->push($Entity);
|
||||
|
||||
$partitaMag = array_get($data, "partita_mag");
|
||||
|
||||
if (isset($partitaMag)) {
|
||||
$mtbPartitaMag = new EntityItem("mtb_partita_mag");
|
||||
|
||||
@@ -1001,39 +961,53 @@ class ModalMrp {
|
||||
$entityList->push($mtbPartitaMag);
|
||||
}
|
||||
|
||||
if (isset($partitaMag) && $ordineLav["partita_mag"] != $partitaMag) {
|
||||
$dtbOrdt = new EntityItem("dtb_ordt");
|
||||
$dtbOrdt = new EntityItem("dtb_ordt");
|
||||
|
||||
$dtbOrdt
|
||||
->update()
|
||||
->set("gestione", $ordineLav["gestione"])
|
||||
->setDate("dataOrd", $ordineLav["data_ord"])
|
||||
->set("numOrd", $ordineLav["num_ord"])
|
||||
->set("codProd", $ordineLav["cod_prod"])
|
||||
->set("partitaMag", $data["partita_mag"])
|
||||
->set("descrizione", $data["note"]);
|
||||
$dtbOrdt
|
||||
->update()
|
||||
->set("gestione", $ordineLav["gestione"])
|
||||
->setDate("dataOrd", $flagEditedDataOrd ? $newDataOrdLav : $ordineLav["data_ord"])
|
||||
->set("numOrd", $ordineLav["num_ord"])
|
||||
->set("codProd", $ordineLav["cod_prod"])
|
||||
->set("partitaMag", $data["partita_mag"])
|
||||
->set("descrizione", $data["note"]);
|
||||
|
||||
$ordiniSelezionati = array_get($data, "ordiniSelezionati", array());
|
||||
$entityArr = new EntityArray();
|
||||
|
||||
if (count($ordiniSelezionati) > 0) {
|
||||
$entityArr = new EntityArray();
|
||||
$ordiniSelezionati = array_get($data, "ordiniSelezionati", array());
|
||||
if (count($ordiniSelezionati) > 0) {
|
||||
foreach ($ordiniSelezionati as $ord) {
|
||||
$entity = new EntityItem("dtb_ordt");
|
||||
|
||||
foreach ($ordiniSelezionati as $ord) {
|
||||
$entity = new EntityItem("dtb_ordt");
|
||||
$entity
|
||||
->set("gestione", $ord["gestione"])
|
||||
->setDate("dataOrd", $ord["data_ord"])
|
||||
->set("numOrd", $ord["num_ord"]);
|
||||
|
||||
$entity
|
||||
->set("gestione", $ord["gestione"])
|
||||
->setDate("dataOrd", $ord["data_ord"])
|
||||
->set("numOrd", $ord["num_ord"]);
|
||||
|
||||
$entityArr->append($entity);
|
||||
}
|
||||
|
||||
$dtbOrdt->set("ordiniV", $entityArr, false, true);
|
||||
$entityArr->append($entity);
|
||||
}
|
||||
|
||||
$entityList->push($dtbOrdt);
|
||||
}
|
||||
|
||||
$ordiniDeselezionati = array_get($data, "ordiniDeselezionati", array());
|
||||
if (count($ordiniDeselezionati) > 0) {
|
||||
foreach ($ordiniDeselezionati as $ord) {
|
||||
$entity = new EntityItem("dtb_ordt");
|
||||
|
||||
$entity
|
||||
->set("gestione", $ord["gestione"])
|
||||
->setDate("dataOrd", $ord["data_ord"])
|
||||
->set("numOrd", $ord["num_ord"])
|
||||
->set("flagScollegaPartitaMag", true);
|
||||
|
||||
$entityArr->append($entity);
|
||||
}
|
||||
}
|
||||
|
||||
if ($entityArr->count() > 0) {
|
||||
$dtbOrdt->set("ordiniV", $entityArr, false, true);
|
||||
}
|
||||
|
||||
$entityList->push($dtbOrdt);
|
||||
}
|
||||
|
||||
$ret = $entityList->send();
|
||||
@@ -1070,7 +1044,8 @@ class ModalMrp {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function deleteOrd($data) {
|
||||
public
|
||||
static function deleteOrd($data) {
|
||||
$Ret = new Ret;
|
||||
$orderKey = $data["key"];
|
||||
$gestione = $orderKey["gestione"];
|
||||
@@ -1094,7 +1069,8 @@ class ModalMrp {
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function suggestDataScad($data) {
|
||||
public
|
||||
static function suggestDataScad($data) {
|
||||
$query = new Query;
|
||||
|
||||
return $query
|
||||
|
||||
@@ -28,12 +28,14 @@ ob_start();
|
||||
$fabbisogniArray = array();
|
||||
|
||||
foreach ($fabbisogni as $fabbisogno) {
|
||||
$fabbisogniArray[$fabbisogno["flag_sospeso"]][] = $fabbisogno;
|
||||
$key = $fabbisogno["partita_mag"] ? "PM" : $fabbisogno["flag_sospeso"];
|
||||
$fabbisogniArray[$key][] = $fabbisogno;
|
||||
}
|
||||
?>
|
||||
<table id="list-fabbisogniSospesi" class="table table-hover table-striped table-bordered table-text-middle small">
|
||||
<thead class="text-unselectable">
|
||||
<tr class="info">
|
||||
<th>Deposito</th>
|
||||
<th>Data Cons.</th>
|
||||
<th>Cliente</th>
|
||||
<th>Data Ord.</th>
|
||||
@@ -52,19 +54,27 @@ ob_start();
|
||||
?>
|
||||
<?php if ($key === 'S') { ?>
|
||||
<tr class="warning">
|
||||
<td colspan="6" class="text-center">Ordini Sospesi</td>
|
||||
<td colspan="2"><?= number_format($sumFabb) ?></td>
|
||||
<td colspan="7" class="text-center">Ordini Sospesi</td>
|
||||
<td colspan="1" class="text-center"><?= number_format($sumFabb) ?></td>
|
||||
<td colspan="1"></td>
|
||||
</tr>
|
||||
<?php } else if ($key === 'N') { ?>
|
||||
<tr class="success">
|
||||
<td colspan="6" class="text-center">Ordini Non Sospesi</td>
|
||||
<td colspan="2"><?= number_format($sumFabb) ?></td>
|
||||
<td colspan="7" class="text-center">Ordini Non Sospesi</td>
|
||||
<td colspan="1" class="text-center"><?= number_format($sumFabb) ?></td>
|
||||
<td colspan="1"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
foreach ($value as $fabbisogno) {
|
||||
?>
|
||||
<?php } else if ($key === 'PM') { ?>
|
||||
<tr class="danger">
|
||||
<td colspan="7" class="text-center">Ordini Pianificati in Produzione</td>
|
||||
<td colspan="1" class="text-center"><?= number_format($sumFabb) ?></td>
|
||||
<td colspan="1"></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php foreach ($value as $fabbisogno) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $fabbisogno["cod_mdep"] ?></td>
|
||||
<td class="text-center"><?= \Utility\Date::format($fabbisogno["data_cons"], "%d %B %Y") ?></td>
|
||||
<td class="text-center"><?= $fabbisogno["cod_anag"] ?> - <?= $fabbisogno["rag_soc"] ?></td>
|
||||
<td class="text-center"><?= \Utility\Date::format($fabbisogno["data_ord"], Format::strftimeDMY) ?></td>
|
||||
@@ -76,10 +86,8 @@ ob_start();
|
||||
<td class="text-center"><?= $fabbisogno["qta_ord"] ?></td>
|
||||
<td class="text-center"><?= $fabbisogno["fabbisogno"] ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Utility\Date;
|
||||
|
||||
$codMdep = isset($data["deposito"]) ? $data["deposito"] : null;
|
||||
$codMart = isset($data["articolo"]) ? $data["articolo"] : null;
|
||||
$ret = new Ret();
|
||||
@@ -48,8 +51,8 @@ ob_start();
|
||||
data-qta="<?= $partita["qta"] ?>">
|
||||
<td class="text-center"><?= $partita["partita_mag"] ?></td>
|
||||
<td class="text-center"><?= $partita["desc_partita"] ?></td>
|
||||
<td class="text-center"><?= \Utility\Date::format($partita["data_scad"], Format::strftimeDMY) ?></td>
|
||||
<td class="text-center"><?= ($partita["flag_stato"] === "A") ? "<i style='color: green' class='fa fa-check'></i>" : "<i style='color: red' class='fa fa-times'></i>" ?></td>
|
||||
<td class="text-center"><?= array_get($partita, "data_scad") ? Date::format($partita["data_scad"], Format::strftimeDMY) : "" ?></td>
|
||||
<td class="text-center"><?= $partita["flag_stato"] === "A" ? "<i style='color: green' class='fa fa-check'></i>" : "<i style='color: red' class='fa fa-times'></i>" ?></td>
|
||||
<td class="text-center"><?= $partita["posizione"] ?></td>
|
||||
<td class="text-center"><?= $partita["TipoPedana"] ?></td>
|
||||
<td class="text-monospace text-center"><?= number_format($partita["pedane"], 0, '.', "'") ?></td>
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($Ret->is_OK()) {
|
||||
$arr_ordiniV = from($arr_ordiniV)
|
||||
->where(function ($ordineV) use ($orderKey, $rigaOrdine) {
|
||||
return isset($orderKey) ?
|
||||
isset($ordineV["partita_mag"]) && $ordineV["partita_mag"] == $rigaOrdine["partita_mag"]
|
||||
(isset($ordineV["partita_mag"]) && $ordineV["partita_mag"] == $rigaOrdine["partita_mag"]) || is_null($ordineV["partita_mag"])
|
||||
: is_null($ordineV["partita_mag"]);
|
||||
})
|
||||
->toArray();
|
||||
@@ -254,13 +254,14 @@ if ($Ret->is_OK()) {
|
||||
<tbody>
|
||||
<?php
|
||||
$totColli = 0;
|
||||
|
||||
foreach ($arr_ordiniV as $ordineV) {
|
||||
$totColli += $ordineV["num_cnf"];
|
||||
?>
|
||||
<tr data-row="<?= Utility::B64JSON_stringify($ordineV) ?>">
|
||||
<td class="text-center">
|
||||
<input type="checkbox" id="cod_jcom"
|
||||
value="<?= $ordineV["cod_jcom"] ?>" <?= isset($orderKey) ? "disabled checked" : "" ?>
|
||||
<input type="checkbox" id="cod_jcom" value="<?= $ordineV["cod_jcom"] ?>"
|
||||
<?= isset($orderKey) && !is_null($ordineV["partita_mag"]) ? "checked" : "" ?>
|
||||
>
|
||||
</td>
|
||||
<td class="text-center"><?= $ordineV["num_ord"] ?>
|
||||
|
||||
@@ -16,6 +16,7 @@ function PopupOrdProd() {
|
||||
this._modalBox = null;
|
||||
this._onSave = null;
|
||||
this._onOpen = null;
|
||||
this._ordiniSelezionatiApertura = [];
|
||||
}
|
||||
|
||||
PopupOrdProd.prototype.codMart = function (v) {
|
||||
@@ -199,6 +200,10 @@ PopupOrdProd.prototype.open = function () {
|
||||
$div.find("[name='note']").val(rigaOrdine.note);
|
||||
$div.find("[name='note_old']").val(rigaOrdine.note);
|
||||
$div.find("[name='qta_prod']").val(rigaOrdine.qta_prod).trigger("change");
|
||||
|
||||
self._ordiniSelezionatiApertura = self._modalBox.$div.find("input[id=cod_jcom]:checked")
|
||||
.map((index, el) => _ojbc.B64JSON_parse($(el).parents("tr").attr("data-row")))
|
||||
.toArray();
|
||||
}
|
||||
|
||||
// TODO mostrare linee con ore disponibili
|
||||
@@ -248,13 +253,9 @@ PopupOrdProd.prototype._setEvents = function () {
|
||||
let $div = self._modalBox.$div;
|
||||
let $bt_proponiPartitaScad = $div.find("#bt_proponiPartitaScad");
|
||||
|
||||
// if (self._isNew()) {
|
||||
$bt_proponiPartitaScad.on("click", function () {
|
||||
self._refreshPartitaScad();
|
||||
});
|
||||
// } else {
|
||||
// $bt_proponiPartitaScad.parent().remove();
|
||||
// }
|
||||
|
||||
let $numPedane = $div.find("input[name='num_pedane']");
|
||||
let $colliPedana = $div.find("input[name='colli_pedana']");
|
||||
@@ -263,6 +264,7 @@ PopupOrdProd.prototype._setEvents = function () {
|
||||
let $qtaProd = $div.find("input[name='qta_prod']");
|
||||
let $qtaOrd = $div.find("input[name='qta_ord']");
|
||||
let $codJfas = $div.find("select[name='cod_jfas']");
|
||||
let $codTcolUl = $div.find("select[name='cod_tcol_ul']");
|
||||
let qtaCnf = self._anag.qta_cnf;
|
||||
let flagDigUntMisProd = self._anag.flag_dig_unt_mis_prod;
|
||||
|
||||
@@ -438,9 +440,11 @@ PopupOrdProd.prototype._setEvents = function () {
|
||||
const checked = $("input[id=cod_jcom]:checked:first");
|
||||
const firstRow = _ojbc.B64JSON_parse($(checked).parents("tr").attr("data-row"));
|
||||
const assegnaQtaColDaOrdiniV = _modalMrp.module.get_dataSource("assegnaQtaColDaOrdiniV");
|
||||
const flagAttivaSelezioneMultiplaOrdV = _modalMrp.module.get_dataSource("flagAttivaSelezioneMultiplaOrdV");
|
||||
|
||||
if (assegnaQtaColDaOrdiniV && firstRow) {
|
||||
$colliPedana.val(firstRow.colli_pedana);
|
||||
$codTcolUl.val(firstRow.cod_tcol_ul);
|
||||
}
|
||||
|
||||
const sumNumCnf = $("input[id=cod_jcom]:checked")
|
||||
@@ -452,23 +456,19 @@ PopupOrdProd.prototype._setEvents = function () {
|
||||
.toArray()
|
||||
.reduce((a, b) => a + b, 0);
|
||||
|
||||
$("input[id=cod_jcom]:not(:checked)")
|
||||
.each((index, elem) => {
|
||||
const $el = $(elem);
|
||||
const row = _ojbc.B64JSON_parse($el.parents("tr").attr("data-row"));
|
||||
$("input[id=cod_jcom]:not(:checked)").each((index, elem) => {
|
||||
const $el = $(elem);
|
||||
const row = _ojbc.B64JSON_parse($el.parents("tr").attr("data-row"));
|
||||
let disabled = false;
|
||||
|
||||
$el.prop("disabled", (firstRow && row.cod_tcol_ul !== firstRow.cod_tcol_ul) || false);
|
||||
});
|
||||
if (firstRow && (!flagAttivaSelezioneMultiplaOrdV || row.cod_tcol_ul !== firstRow.cod_tcol_ul || row.colli_pedana !== firstRow.colli_pedana)) {
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
$el.prop("disabled", disabled);
|
||||
});
|
||||
|
||||
if (assegnaQtaColDaOrdiniV) {
|
||||
// let numPedane = firstRow && sumNumCnf && sumNumCnf / firstRow.colli_pedana;
|
||||
//
|
||||
// if (numPedane && numPedane < 1) {
|
||||
// numPedane = 1;
|
||||
// }
|
||||
//
|
||||
// $numPedane.val(numPedane || 0).trigger("change");
|
||||
|
||||
$qtaProd.val(sumNumCnf).trigger("change");
|
||||
}
|
||||
});
|
||||
@@ -909,14 +909,20 @@ PopupOrdProd.prototype._onUpdate = async function () {
|
||||
.map((index, el) => _ojbc.B64JSON_parse($(el).parents("tr").attr("data-row")))
|
||||
.toArray();
|
||||
|
||||
const answer = await self.checkQtaOrdiniSel(formData);
|
||||
const ordiniSelezionatiApertura = self._ordiniSelezionatiApertura;
|
||||
const ordiniSelezionati = formData.ordiniSelezionati;
|
||||
const ordiniDeselezionati = ordiniSelezionatiApertura.filter(a => !ordiniSelezionati.some(b => {
|
||||
return a.gestione === b.gestione && a.data_ord === b.data_ord && a.num_ord === b.num_ord
|
||||
}))
|
||||
|
||||
formData.ordiniDeselezionati = ordiniDeselezionati;
|
||||
|
||||
const answer = await self.checkQtaOrdiniSel(formData);
|
||||
if (!answer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await self._checkMaterie();
|
||||
|
||||
if (response) {
|
||||
new Ajax()
|
||||
.post("updateOrdLav")
|
||||
|
||||
@@ -12,8 +12,6 @@ SELECT dtb_ordt.cod_jcom,
|
||||
ELSE dtb_ordr.colli_pedana END AS colli_pedana,
|
||||
dtb_ordr.num_cnf,
|
||||
dtb_ordr.partita_mag
|
||||
/*SUM(CASE WHEN dtb_ordr.colli_pedana <> 0 THEN dtb_ordr.num_cnf / dtb_ordr.colli_pedana ELSE 0 END) AS pedane,*/
|
||||
/*SUM(dtb_ordr.num_cnf) AS num_cnf*/
|
||||
FROM dtb_ordt
|
||||
INNER JOIN dtb_ordr ON dtb_ordt.data_ord = dtb_ordr.data_ord AND
|
||||
dtb_ordt.num_ord = dtb_ordr.num_ord AND
|
||||
@@ -26,5 +24,4 @@ WHERE dtb_ordt.gestione = 'V'
|
||||
AND dtb_ordr.flag_evaso = 'I'
|
||||
AND dtb_ordr.qta_evasa < dtb_ordr.qta_ord
|
||||
AND dtb_ordr.cod_mart = '[cod_mart]'
|
||||
/*GROUP BY dtb_ordr.colli_pedana,dtb_ordr.cod_tcol_ul, mtb_tcol.descrizione, dtb_ordt.cod_jcom, gtb_anag.rag_soc, gtb_anag.citta, gtb_anag.cod_anag, dtb_ordt.gestione, dtb_ordt.data_ord, dtb_ordt.num_ord*/
|
||||
ORDER BY dtb_ordt.data_ord, dtb_ordt.num_ord
|
||||
@@ -1353,9 +1353,8 @@ EOF;
|
||||
}
|
||||
|
||||
public static function getSettings() {
|
||||
$gestsetup = new GestSetupWebUser();
|
||||
$gestsetup = new GestSetupWebUser();
|
||||
$settings = $gestsetup->getAllBySection();
|
||||
return $settings;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,10 @@ const _Modellini = {
|
||||
self.el = $("#main");
|
||||
self.module = new Module("modellini");
|
||||
self.module.onLoad(function () {
|
||||
let settings = JSON.parse(self.module.get_dataSource("userSettings"));
|
||||
const userSettings = self.module.get_dataSource("userSettings");
|
||||
const impostazioni = _.find(userSettings, {key_section: "IMPOSTAZIONI"})
|
||||
const settings = impostazioni?.value ? JSON.parse(impostazioni.value) : {};
|
||||
|
||||
self.filterOnlyMine = settings?.filterOnlyMine ?? false;
|
||||
self.togglefilterMineAppearance();
|
||||
self.list = _List.init({
|
||||
@@ -103,7 +106,6 @@ const _Modellini = {
|
||||
self.el.find("a.hideInspections").on("click", _.bind(self.hideInspections, self));
|
||||
self.el.find("a.filterOnlyMine").on("click", _.bind(self.toggleFilterOnlyMine, self));
|
||||
self.el.find("#manageCategories").on("click", _.bind(self.manageCategories, self));
|
||||
// self.el.find("#settings").on("click", _.bind(self.openSettings, self));
|
||||
},
|
||||
setParams: function (params) {
|
||||
let self = this;
|
||||
|
||||
@@ -573,6 +573,7 @@ class MonitoraggioLineeV2 {
|
||||
$row["ggScadPartita"] = array_get($row, "ggScadPartita");
|
||||
$row["noteLav"] = array_get($row, "noteLav");
|
||||
$row["descrizioneTcol"] = array_get($row, "descrizioneTcol");
|
||||
$row["qtaResidua"] = array_get($row, "qtaProd", 0) - (array_get($row, "qtaTrasferite", 0) / (array_get($row, "rapConv2", 1) ?: 1));
|
||||
|
||||
if (!is_null($row["mtbColtToEdit"])) {
|
||||
$row["mtbColtToEdit"]["data_collo"] = Utility\Date::strtotime($row["mtbColtToEdit"]["data_collo"], Format::strtotimeDMYHMS);
|
||||
@@ -1047,24 +1048,25 @@ class MonitoraggioLineeV2 {
|
||||
}
|
||||
|
||||
public static function cambioDataProduzione(array $data) {
|
||||
$Ret = self::get_ordineLav($data["key"]);
|
||||
if ($Ret->is_OK()) {
|
||||
$ordineLav = $Ret->get_data();
|
||||
$ret = self::get_ordineLav($data["key"]);
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
$Ret = self::updateOrdLav($data, $ordineLav, $ordineLav["last_id_step"] !== 0);
|
||||
if ($ret->is_OK()) {
|
||||
$ordineLav = $ret->get_data();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$ret = self::updateOrdLav($data, $ordineLav, $ordineLav["last_id_step"] !== 0);
|
||||
}
|
||||
|
||||
if ($Ret->is_OK() && !($ordineLav["last_id_step"] !== 0)) {
|
||||
if ($ret->is_OK() && !($ordineLav["last_id_step"] !== 0)) {
|
||||
$data["key"]["data_ord"] = $data["data_prod"];
|
||||
}
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
$Ret = self::get_ordineLav($data["key"]);
|
||||
if ($ret->is_OK()) {
|
||||
$ret = self::get_ordineLav($data["key"]);
|
||||
}
|
||||
}
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function insertPartitaMag(array $data) {
|
||||
@@ -1594,20 +1596,14 @@ GROUP BY mtb_colt.gestione,
|
||||
|
||||
public static function updateOrdLav($data, $ordineLav, $productionStarted = false) {
|
||||
$orderLavKey = $data["key"];
|
||||
$rigaOrdRif = $ordineLav["riga_ord_rif"];
|
||||
$codJfasPrev = $data["cod_jfas_corrente"];
|
||||
$codJfas = array_key_exists("cod_jfas", $data) ? $data["cod_jfas"] : $codJfasPrev;
|
||||
$newDataOrd = $data["data_prod"];
|
||||
$ordProdKeyPrec = array(
|
||||
"gestione" => $ordineLav["gestione_rif"],
|
||||
"data_ord" => $ordineLav["data_ord_rif"],
|
||||
"num_ord" => $ordineLav["num_ord_rif"]
|
||||
);
|
||||
|
||||
$ordProdKey = array(
|
||||
"gestione" => $ordProdKeyPrec["gestione"],
|
||||
"gestione" => $ordineLav["gestione_rif"],
|
||||
"data_ord" => $newDataOrd,
|
||||
"num_ord" => $ordProdKeyPrec["num_ord"]
|
||||
"num_ord" => $ordineLav["num_ord_rif"]
|
||||
);
|
||||
|
||||
$dataOrdLav = $orderLavKey["data_ord"];
|
||||
@@ -1621,47 +1617,71 @@ GROUP BY mtb_colt.gestione,
|
||||
|
||||
$EntityList = new EntityList;
|
||||
|
||||
$OrdLav = new EntityItem("dtb_ordt");
|
||||
$OrdLav->update()
|
||||
$ordLav = new EntityItem("dtb_ordt");
|
||||
$ordLav->update()
|
||||
->setDate("dataOrd", $dataOrdLav)
|
||||
->set("gestione", $gestioneLav)
|
||||
->set("numOrd", $numOrdLav);
|
||||
|
||||
if (!$productionStarted) {
|
||||
$OrdLav->setDate("dataInizProd", $newDataOrd)
|
||||
->setDate("dataCons", $newDataOrd);
|
||||
$ordLav
|
||||
->setDate("dataInizProd", $newDataOrd)
|
||||
->setDate("dataConsProd", $newDataOrd);
|
||||
|
||||
$query = new Query();
|
||||
$query->importSqlFile("getDtbOrdr")
|
||||
->setDateVar("data_ord", $dataOrdLav)
|
||||
->setVar("gestione", $gestioneLav)
|
||||
->setVar("num_ord", $numOrdLav);
|
||||
|
||||
$righeOrdine = $query->toRet(false)->execute();
|
||||
|
||||
foreach ($righeOrdine as $rigaOrdine) {
|
||||
$dtbOrdr = new EntityItem("dtb_ordr");
|
||||
$dtbOrdr->update()
|
||||
->set("rigaOrd", $rigaOrdine["riga_ord"])
|
||||
->setDate("dataCons", $newDataOrd);
|
||||
|
||||
$ordLav->set("dtbOrdr")->append($dtbOrdr);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("cod_jfas_testata", $data) && $data["cod_jfas_testata"] != $codJfasPrev) {
|
||||
$OrdLav->set("codJfas", $codJfas);
|
||||
$ordLav->set("codJfas", $codJfas);
|
||||
}
|
||||
|
||||
// CAMBIO ORDINE DI PRODUZIONE
|
||||
$ordineLavEdited = $ordineLav;
|
||||
$ordineLavEdited["data_ord_rif"] = $newDataOrd;
|
||||
$ordineLavEdited["cod_jfas"] = $codJfas;
|
||||
$Ret = Mrp::findOrdineProd($ordineLavEdited);
|
||||
if ($Ret->is_OK()) {
|
||||
$ordProdKey = $Ret->get_data();
|
||||
$ret = Mrp::findOrdineProd($ordineLavEdited);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$ordProdKey = $ret->get_data();
|
||||
|
||||
if (is_null($ordProdKey)) { // CREO ORDINE DI PRODUZIONE
|
||||
$Ret = Mrp::insertOrdProd($ordineLavEdited);
|
||||
if ($Ret->is_OK()) {
|
||||
$ret = Mrp::insertOrdProd($ordineLavEdited);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$flagInsertedOrdProd = true;
|
||||
$ordProdKey = $Ret->get_data();
|
||||
$ordProdKey = $ret->get_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$Ret->is_OK()) {
|
||||
return $Ret;
|
||||
if ($ret->is_KO()) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if ($flagEditedCodJfas) {
|
||||
if ($productionStarted) {
|
||||
$Ret = self::getLastStepOrder($orderLavKey, $data["cod_jfas_corrente"]);
|
||||
if ($Ret->is_KO()) {
|
||||
return $Ret;
|
||||
$ret = self::getLastStepOrder($orderLavKey, $data["cod_jfas_corrente"]);
|
||||
|
||||
if ($ret->is_KO()) {
|
||||
return $ret;
|
||||
}
|
||||
$lastStep = $Ret->get_data();
|
||||
|
||||
$lastStep = $ret->get_data();
|
||||
// se la produzione è stata parzialmente avviata creiamo un nuovo step sulla nuova linea
|
||||
|
||||
$dtbOrdStep = new EntityItem("dtb_ord_steps");
|
||||
@@ -1675,10 +1695,8 @@ GROUP BY mtb_colt.gestione,
|
||||
}
|
||||
|
||||
$dtbOrdStepCurrent = clone $dtbOrdStep;
|
||||
|
||||
$dtbOrdStepCurrent->update()->set("flagStepAttivo", "N");
|
||||
|
||||
$OrdLav->set("dtbOrdSteps")->append($dtbOrdStepCurrent);
|
||||
$ordLav->set("dtbOrdSteps")->append($dtbOrdStepCurrent);
|
||||
|
||||
$dtbOrdStep
|
||||
->insert()
|
||||
@@ -1688,7 +1706,7 @@ GROUP BY mtb_colt.gestione,
|
||||
->set("codJfas", $codJfas)
|
||||
->set("flagStepAttivo", "S");
|
||||
|
||||
$OrdLav->set("dtbOrdSteps")->append($dtbOrdStep);
|
||||
$ordLav->set("dtbOrdSteps")->append($dtbOrdStep);
|
||||
} else {
|
||||
// AGGIORNA CODJFAS NEGLI STEPS
|
||||
$QueryB = new Query;
|
||||
@@ -1704,7 +1722,8 @@ GROUP BY mtb_colt.gestione,
|
||||
$EntityList->push($Entity);
|
||||
}
|
||||
}
|
||||
$EntityList->push($OrdLav);
|
||||
|
||||
$EntityList->push($ordLav);
|
||||
|
||||
// SOSTITUZIONE DATA_ORD IN ORD. LAV.
|
||||
if ($flagEditedDataOrd && (!$productionStarted)) {
|
||||
@@ -1735,14 +1754,13 @@ GROUP BY mtb_colt.gestione,
|
||||
$Entity->update()->set("nativeSql", $QueryB);
|
||||
$EntityList->push($Entity);
|
||||
|
||||
$Ret = $EntityList->send();
|
||||
$ret = $EntityList->send();
|
||||
|
||||
if ($Ret->is_KO() && $flagInsertedOrdProd) {
|
||||
if ($ret->is_KO() && $flagInsertedOrdProd) {
|
||||
OrdiniUtils::delete($ordProdKey);
|
||||
}
|
||||
|
||||
|
||||
return $Ret;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getScarichiSemoleOrdine($key) {
|
||||
|
||||
@@ -472,13 +472,13 @@ if (!is_null($ordineLav["note"])) {
|
||||
data-cod_jfas="<?= $item["cod_jfas"] ?>"
|
||||
data-num_prog_collo="<?= ($key + 1) ?>">
|
||||
<td class="text-center"><?= ($key + 1) ?></td>
|
||||
<td class="text-center"><?= (new DateTime($item["data_collo"]))->format(Format::strtotimeDMY) ?></td>
|
||||
<td class="text-center"><?= (new DateTime($item["data_collo"]))->format(Format::strtotimeDMY) ?></td>
|
||||
<td class="text-center"><?= $item["num_collo"] ?> <?= $item["ser_collo"] ?></td>
|
||||
<td class="text-center"><?= $item["qta_col"] ?></td>
|
||||
<td class="text-center"><?= $item["num_cnf"] ?></td>
|
||||
<td class="text-center"><?= $item["giacenza"] ?></td>
|
||||
<td class="text-center"><?= $item["giacenza_col"] ?></td>
|
||||
<td class="text-center"><?= (new DateTime($item["datetime_row"]))->format(Format::strtotimeDMY) ?></td>
|
||||
<td class="text-center"><?= (new DateTime($item["datetime_row"]))->format(Format::strtotimeDMYHM) ?></td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-md btn-block">
|
||||
<button title="PDF etichetta" type="button"
|
||||
|
||||
@@ -180,7 +180,7 @@ PopupSelezionePriorita.prototype.open = function () {
|
||||
rowData.selected = this.checked;
|
||||
tableQtaLinea.row($(this).parents("tr")).data(rowData);
|
||||
|
||||
const data = tableQtaLinea.data().toArray();
|
||||
const data = tableQtaLinea.rows().data().toArray();
|
||||
|
||||
let newData = data.filter(row => row.selected).map((row, index) => {
|
||||
row.row_index = index;
|
||||
|
||||
@@ -989,14 +989,15 @@ export let _ordini = {
|
||||
});
|
||||
|
||||
$popoverCDBTip.find(".bt_updateDataOrdProd").off("click").on("click", function () {
|
||||
let newDataOrdProd = $dataOrdProd.getTimestampValue();
|
||||
let codJfas = $codJfas.val();
|
||||
const newDataOrdProd = $dataOrdProd.getTimestampValue();
|
||||
const codJfas = $codJfas.val();
|
||||
const key = {
|
||||
gestione: ordine.gestione,
|
||||
data_ord: ordine.dataOrd,
|
||||
num_ord: ordine.numOrd
|
||||
};
|
||||
let ajax = new Ajax();
|
||||
|
||||
const ajax = new Ajax();
|
||||
ajax.post("cambio_data_produzione")
|
||||
.data({
|
||||
key,
|
||||
@@ -1021,18 +1022,14 @@ export let _ordini = {
|
||||
.noticeAsModal()
|
||||
.waitToast()
|
||||
.onSuccess(function (ret) {
|
||||
let returnData = ret.returnData;
|
||||
let toast = new Toast();
|
||||
const returnData = ret.returnData;
|
||||
const toast = new Toast();
|
||||
|
||||
toast.success("L'ordine di lavoro n. <b>" + ordine.numOrd + "</b> è stato trasferito nella produzione n. " + returnData.num_ord_rif + " del " + returnData.data_ord_rif.unixtime_format("DD/MM/YYYY"));
|
||||
self.refresh_table();
|
||||
$btUpdateDataOrdProd.disabled();
|
||||
}).execute();
|
||||
}).disabled();
|
||||
|
||||
//self.autoRefresh.pause();
|
||||
}).on("hide.bs.popover", function () {
|
||||
//$popoverCDP.popover("destroy");
|
||||
// self.autoRefresh.start();
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -1983,7 +1980,6 @@ export let _ordini = {
|
||||
await self.loadScarichiArticolo(listScarichi, order, result);
|
||||
|
||||
const $btnNuovoScarico = $div.find("#bt_nuovoScarico");
|
||||
|
||||
$btnNuovoScarico.on("click", function () {
|
||||
const $bt = $(this);
|
||||
_ordini.start_adminSession(function () {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
SELECT data_ord,
|
||||
num_ord,
|
||||
gestione,
|
||||
riga_ord
|
||||
FROM dtb_ordr
|
||||
WHERE data_ord = '[data_ord]'
|
||||
AND num_ord = [num_ord]
|
||||
AND gestione = '[gestione]'
|
||||
@@ -64,7 +64,7 @@ FROM (SELECT mtb_aart.cod_mart,
|
||||
ISNULL(art.unt_mis2, '') AND
|
||||
ISNULL(mtb_aart.unt_mis3, '') =
|
||||
ISNULL(art.unt_mis3, '') AND
|
||||
mtb_aart.flag_attivo = 'S'
|
||||
mtb_aart.flag_stato = 'A'
|
||||
LEFT OUTER JOIN mtb_unt_mis
|
||||
ON mtb_aart.unt_mis = mtb_unt_mis.unt_mis
|
||||
LEFT JOIN mrp ON mrp.cod_mart = mtb_aart.cod_mart) dett
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import FormPopup, {SubmitResponse} from "@js/FormPopup.js";
|
||||
import FormPopup from "@js/FormPopup.js";
|
||||
import {MtbAart, MtbColr, MtbColt} from "@js/ims/ems-core.module.js";
|
||||
import {getArticolo} from "@js/api/stdutils.js";
|
||||
|
||||
@@ -20,11 +20,7 @@ interface Data {
|
||||
codMdep: string
|
||||
}
|
||||
|
||||
interface RientroSubmitResponse extends SubmitResponse {
|
||||
data: MtbColt
|
||||
}
|
||||
|
||||
export default class PopupRientro extends FormPopup {
|
||||
export default class PopupRientro extends FormPopup<MtbColt> {
|
||||
private readonly data: Data
|
||||
private articolo: CamelKeysToSnake<MtbAart>
|
||||
|
||||
@@ -122,7 +118,7 @@ export default class PopupRientro extends FormPopup {
|
||||
model.set("numCnf", model.qtaCol / this.articolo.qta_cnf);
|
||||
}
|
||||
|
||||
async onSubmit(e: kendo.ui.FormSubmitEvent): Promise<SubmitResponse> {
|
||||
async onSubmit(e: kendo.ui.FormSubmitEvent) {
|
||||
console.log(e);
|
||||
|
||||
return await this.createColloRientro(e.model as CreateColloRientroForm);
|
||||
@@ -137,16 +133,14 @@ export default class PopupRientro extends FormPopup {
|
||||
})
|
||||
.waitModal()
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<MtbColt>();
|
||||
|
||||
const response: RientroSubmitResponse = {
|
||||
return {
|
||||
success: ret?.returnId === 1,
|
||||
data: {
|
||||
...ret?.returnData[0].entity,
|
||||
dataCollo: moment(ret?.returnData[0].entity.dataCollo, "DD/MM/YYYY")
|
||||
}
|
||||
} as typeof ret.returnData
|
||||
};
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -26,26 +26,11 @@ class MonitoraggioOrdini {
|
||||
return Ret::errorCode(ErrorHandler::MISSING_PARAMS, "openGroupStep");
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
case "OPEN":
|
||||
$service = "openGroupStep";
|
||||
break;
|
||||
case "CLOSE":
|
||||
$service = "closeGroupStep";
|
||||
break;
|
||||
case "STOP":
|
||||
$service = "stopGroupStep";
|
||||
break;
|
||||
case "CAMBIO_FASE":
|
||||
$service = "cambioFaseGroup";
|
||||
break;
|
||||
}
|
||||
|
||||
$imsApi = new IMSApi();
|
||||
|
||||
$imsApi
|
||||
->post("mes_v2/$service")
|
||||
->post("mes_v2/executeGroupStep")
|
||||
->queryParam("action", $action)
|
||||
->body(array(
|
||||
"codJfas" => $codJfas,
|
||||
"codJcom" => $codJcom,
|
||||
@@ -71,6 +56,7 @@ class MonitoraggioOrdini {
|
||||
$row["dataInizProd"] = Utility\Date::format(array_get($row, "dataInizProd"), Format::strftimeYMDHMS);
|
||||
$row["dataIniz"] = Utility\Date::format(array_get($row, "dataIniz"), Format::strftimeYMDHMS);
|
||||
$row["dataFine"] = Utility\Date::format(array_get($row, "dataFine"), Format::strftimeYMDHMS);
|
||||
$row["qtaProd"] = array_get($row, "qtaResidua");
|
||||
|
||||
return $row;
|
||||
}, $data);
|
||||
|
||||
@@ -48,6 +48,7 @@ export class OrdineLavorazione extends kendo.data.Model.define({
|
||||
qtaLav: {type: "number"},
|
||||
qtaProd: {type: "number"},
|
||||
qtaTrasferite: {type: "number"},
|
||||
qtaResidua: {type: "number"},
|
||||
ragSocAnag: {type: "string"},
|
||||
rapConv: {type: "number"},
|
||||
rapConv2: {type: "number"},
|
||||
@@ -101,7 +102,6 @@ export class OrdineLavorazione extends kendo.data.Model.define({
|
||||
hrNum: number;
|
||||
maxFase: number;
|
||||
maxStep: number;
|
||||
mtbColtToEdit: any;
|
||||
noteStep: string;
|
||||
numCnf: number;
|
||||
numFase: number;
|
||||
@@ -120,6 +120,7 @@ export class OrdineLavorazione extends kendo.data.Model.define({
|
||||
qtaProd: number;
|
||||
qtaOrd2: number;
|
||||
qtaTrasferite: number;
|
||||
qtaResidua: number;
|
||||
ragSocAnag: string;
|
||||
rapConv: number;
|
||||
rapConv2: number;
|
||||
@@ -463,10 +464,18 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
|
||||
// language=HTML
|
||||
const btnChangeLine = `
|
||||
<button class="btn btn-default" type="button" title="Cambia Centro di Lavoro" data-action="onLineChange">
|
||||
<button class="btn btn-default" type="button" title="Cambia Centro di Lavoro"
|
||||
data-action="onLineChange">
|
||||
<i class="fa fa-lg fa-fw fa-exchange"></i>
|
||||
</button>`;
|
||||
|
||||
// language=HTML
|
||||
const btnDeleteLine = `
|
||||
<button class="btn btn-danger" type="button" title="Cancella Centro di Lavoro"
|
||||
data-action="onLineDelete">
|
||||
<i class="fa fa-lg fa-fw fa-trash"></i>
|
||||
</button>`;
|
||||
|
||||
const buttons: Array<string> = [];
|
||||
|
||||
if (flagInCorso.min) {
|
||||
@@ -485,6 +494,10 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
}
|
||||
}
|
||||
|
||||
if (numFase.max === maxFase.max && stato.group.items.every((ordine: OrdineLavorazione) => ordine.udcTrasferiti === 0)) {
|
||||
buttons.push(btnDeleteLine);
|
||||
}
|
||||
|
||||
if (this.lineeDisponibili?.length > 1 && this.dataSourceOrdini.data().toJSON().every((ordine: OrdineLavorazione) => ordine.stato === "PROGRAMMATO")) {
|
||||
buttons.push(btnChangeLine);
|
||||
}
|
||||
@@ -540,8 +553,14 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
width: "15%",
|
||||
template: (data: OrdineLavorazione) => {
|
||||
return [
|
||||
numberStyle(data.qtaProd, undefined, "", data.untOrd, 2),
|
||||
...data.untOrd2 && [numberStyle(data.qtaProd * data.rapConv2, undefined, "", data.untOrd2, 2)] || [],
|
||||
numberStyle(data.qtaProd, undefined, {
|
||||
postfix: data.untOrd,
|
||||
precision: 2
|
||||
}),
|
||||
...data.untOrd2 && [numberStyle(data.qtaProd * data.rapConv2, undefined, {
|
||||
postfix: data.untOrd2,
|
||||
precision: 2
|
||||
})] || [],
|
||||
].join(" - ");
|
||||
}
|
||||
},
|
||||
@@ -644,8 +663,14 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
width: "15%",
|
||||
template: (data: OrdineLavorazione) => {
|
||||
return [
|
||||
numberStyle(data.qtaProd, undefined, "", data.untOrd, 2),
|
||||
...data.untOrd2 && [numberStyle(data.qtaProd * data.rapConv2, undefined, "", data.untOrd2, 2)] || [],
|
||||
numberStyle(data.qtaProd, undefined, {
|
||||
postfix: data.untOrd,
|
||||
precision: 2
|
||||
}),
|
||||
...data.untOrd2 && [numberStyle(data.qtaProd * data.rapConv2, undefined, {
|
||||
postfix: data.untOrd2,
|
||||
precision: 2
|
||||
})] || [],
|
||||
].join(" - ");
|
||||
}
|
||||
},
|
||||
@@ -672,7 +697,7 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
.post("get_listLinee")
|
||||
.module("monitoraggio_linee_v2")
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<Array<typeof this.linea>>();
|
||||
|
||||
if (ret.returnData) {
|
||||
this.menu.push(...ret.returnData.map(linea => ({
|
||||
@@ -774,6 +799,19 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
|
||||
break;
|
||||
}
|
||||
case "onLineDelete": {
|
||||
if (await this.cancellaFaseGroup({
|
||||
codJfas: this.currentMenu.value,
|
||||
codJcom: ordine.codJcom,
|
||||
dataOrdProd: ordine.dataOrdProd,
|
||||
numOrdProd: ordine.numOrdProd,
|
||||
codProd: ordine.codProd
|
||||
})) {
|
||||
this.dataSourceOrdini.read();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case "onCreateUdc": {
|
||||
let popupCreateUdc;
|
||||
|
||||
@@ -1032,6 +1070,22 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
|
||||
async cancellaFaseGroup(data: GroupKey) {
|
||||
const ret = await this.ajax()
|
||||
.post("actionGroupStep")
|
||||
.data({...data, action: "CANCELLA_FASE"})
|
||||
.confirmModal({
|
||||
message: `Vuoi cancellare il centro di lavoro per l'ordine commessa <b>${data.codJcom}</b> n. <b>${data.numOrdProd}</b> art. <b>${data.codProd}</b>?`,
|
||||
title: "Cancella Centro di Lavoro",
|
||||
style: "danger"
|
||||
})
|
||||
.noticeAsModal()
|
||||
.waitModal(`Cancello centro di lavoro per ordine commessa <b>${data.codJcom}</b> n. <b>${data.numOrdProd}</b> art. <b>${data.codProd}</b>`)
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
|
||||
async askCodId(): Promise<string | null> {
|
||||
// language=HTML
|
||||
return await new ModalBox()
|
||||
@@ -1088,7 +1142,7 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
.get("load_linea")
|
||||
.data({codJfas})
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<typeof this.linea>();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
@@ -1100,7 +1154,7 @@ export default class MonitoraggioOrdini extends MenuViewModule {
|
||||
codJfas
|
||||
})
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
.execute<Array<object>>();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,18 @@ export default class PopupCreateUdc extends BasePopup {
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "qtaProd",
|
||||
field: "qtaResidua",
|
||||
title: "Q.tà Prod.",
|
||||
template: (data: OrdineLavorazione) => {
|
||||
return [
|
||||
numberStyle(data.qtaProd, undefined, "", data.untOrd, 2),
|
||||
...data.untOrd2 && [numberStyle(data.qtaProd * data.rapConv2, undefined, "", data.untOrd2, 2)] || [],
|
||||
numberStyle(data.qtaResidua, undefined, {
|
||||
postfix: data.untOrd,
|
||||
precision: 2
|
||||
}),
|
||||
...data.untOrd2 && [numberStyle(data.qtaResidua * data.rapConv2, undefined, {
|
||||
postfix: data.untOrd2,
|
||||
precision: 2
|
||||
})] || [],
|
||||
].join(" - ");
|
||||
},
|
||||
editable: () => true,
|
||||
@@ -50,7 +56,7 @@ export default class PopupCreateUdc extends BasePopup {
|
||||
});
|
||||
|
||||
if (ordine.untOrd2) {
|
||||
ordine.qtaOrd2 = ordine.qtaProd * ordine.rapConv2;
|
||||
ordine.qtaOrd2 = ordine.qtaResidua * ordine.rapConv2;
|
||||
|
||||
qtaOrd2TextBox = $(`<input name="qtaOrd2" data-bind="value: qtaOrd2" title="Qtà Ord. 2" class="w-50" readonly/>`)
|
||||
.appendTo(container)
|
||||
|
||||
@@ -149,7 +149,10 @@ export default class PopupOrderDetail extends TabsPopup {
|
||||
<button type="button"
|
||||
class="btn btn-default btnShowDettaglioQtaTotale"
|
||||
title="Mostra dettaglio quantità totale in giacenza">
|
||||
${data.qta_esistente && numberStyle(data.qta_esistente, undefined, "", data.unt_mis, 2) || 0}
|
||||
${data.qta_esistente && numberStyle(data.qta_esistente, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 2
|
||||
}) || 0}
|
||||
</button>`
|
||||
},
|
||||
{
|
||||
@@ -160,7 +163,10 @@ export default class PopupOrderDetail extends TabsPopup {
|
||||
<button type="button"
|
||||
class="btn btn-default btnShowDettaglioScarichi"
|
||||
title="Visualizza dettaglio scarichi">
|
||||
${this.scarichi && numberStyle(this.scarichi.find(scarico => scarico.cod_mart === data.cod_mart)?.qta_col || 0, undefined, "", data.unt_mis, 2) || 0}
|
||||
${this.scarichi && numberStyle(this.scarichi.find(scarico => scarico.cod_mart === data.cod_mart)?.qta_col || 0, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 2
|
||||
}) || 0}
|
||||
</button>`
|
||||
}
|
||||
]);
|
||||
@@ -441,28 +447,40 @@ export default class PopupOrderDetail extends TabsPopup {
|
||||
field: "qta_col",
|
||||
title: "Q.tà",
|
||||
type: "number",
|
||||
template: (data: Udc) => data.qta_col && numberStyle(data.qta_col, undefined, "", data.unt_mis, 5) || 0
|
||||
template: (data: Udc) => data.qta_col && numberStyle(data.qta_col, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 5
|
||||
}) || 0
|
||||
},
|
||||
{
|
||||
id: "784cbd25-3066-4500-9d86-d6c239e7c961",
|
||||
field: "num_cnf",
|
||||
title: "Q.tà (COL)",
|
||||
type: "number",
|
||||
template: (data: Udc) => data.num_cnf && numberStyle(data.num_cnf, undefined, "", data.unt_mis, 5) || 0
|
||||
template: (data: Udc) => data.num_cnf && numberStyle(data.num_cnf, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 5
|
||||
}) || 0
|
||||
},
|
||||
{
|
||||
id: "0f2f29c6-8e25-4631-9613-4c1ce29de4ff",
|
||||
field: "giacenza",
|
||||
title: "Giacenza",
|
||||
type: "number",
|
||||
template: (data: Udc) => data.giacenza && numberStyle(data.giacenza, undefined, "", data.unt_mis, 5) || 0
|
||||
template: (data: Udc) => data.giacenza && numberStyle(data.giacenza, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 5
|
||||
}) || 0
|
||||
},
|
||||
{
|
||||
id: "1e71e184-a18b-46db-863c-b5faaf8e0e05",
|
||||
field: "giacenza_col",
|
||||
title: "Giacenza (COL)",
|
||||
type: "number",
|
||||
template: (data: Udc) => data.giacenza_col && numberStyle(data.giacenza_col, undefined, "", data.unt_mis, 5) || 0
|
||||
template: (data: Udc) => data.giacenza_col && numberStyle(data.giacenza_col, undefined, {
|
||||
postfix: data.unt_mis,
|
||||
precision: 5
|
||||
}) || 0
|
||||
},
|
||||
{
|
||||
id: "5308c9ad-27d0-4772-bd8c-fbd9b72e0f41",
|
||||
|
||||
@@ -45,7 +45,7 @@ PopupOrdProd.prototype._isNew = function () {
|
||||
|
||||
PopupOrdProd.prototype.open = function () {
|
||||
const self = this;
|
||||
const title = self._isNew() ? "NUOVO ORDINE DI PRODUZIONE <small>" + self._codMart + " <small>" + self._anag.descrizione + "</small></small>" : "Ordine di lavorazione n. <b>" + self._orderKey.num_ord + "</b> del " + self._orderKey.data_ord.unixtime_format("DD/MM/YYYY");
|
||||
const title = self._isNew() ? "Nuovo ordine di Produzione <small>" + self._codMart + " <small>" + self._anag.descrizione + "</small></small>" : "Ordine di lavorazione n. <b>" + self._orderKey.num_ord + "</b> del " + self._orderKey.data_ord.unixtime_format("DD/MM/YYYY");
|
||||
const ajax = new Ajax();
|
||||
|
||||
ajax.get("popup-ord-prod")
|
||||
@@ -728,7 +728,7 @@ PopupOrdProd.prototype._checkMaterie = async function () {
|
||||
.content(
|
||||
"I seguenti articoli non hanno disponibilità nel giorno " + dataProd + ". Vuoi continuare?" +
|
||||
"<br><br>" +
|
||||
righeNegative.join('<br>')
|
||||
righeNegative.join("<br>")
|
||||
)
|
||||
.title("Disponibilità negativa")
|
||||
.show();
|
||||
|
||||
@@ -9,7 +9,9 @@ SELECT dtb_ordt.cod_anag,
|
||||
dtb_ordr.data_cons,
|
||||
dtb_ordr.cod_mart,
|
||||
dtb_ordr.descrizione_estesa,
|
||||
dtb_ordt.flag_sospeso
|
||||
dtb_ordt.flag_sospeso,
|
||||
dtb_ordt.cod_mdep,
|
||||
dtb_ordr.partita_mag
|
||||
FROM (SELECT jtb_dist_mate.cod_prod,
|
||||
jtb_dist_mate.cod_mart,
|
||||
jtb_dist_mate.qta_prod * jtb_dist_mate.rap_conv_prod /
|
||||
@@ -42,5 +44,4 @@ WHERE s.cod_mart = '[codMart]'
|
||||
AND dtb_ordt.flag_annulla = 'N'
|
||||
AND dtb_ordr.flag_evaso = 'I'
|
||||
AND dtb_ordt.gestione = 'V'
|
||||
AND dtb_ordr.partita_mag IS NULL
|
||||
ORDER BY flag_sospeso, data_cons, gtb_anag.rag_soc, data_ord, num_ord
|
||||
ORDER BY dtb_ordr.partita_mag, flag_sospeso, cod_mdep DESC, data_cons, gtb_anag.rag_soc, data_ord, num_ord
|
||||
@@ -1,7 +1,7 @@
|
||||
select mtb_depo.cod_mdep,
|
||||
SELECT mtb_depo.cod_mdep,
|
||||
mtb_depo.cod_mdep + ' - ' + mtb_depo.descrizione AS descrizione,
|
||||
case WHEN (gtb_anag.part_iva = azienda.part_iva) then 1 else 0 end AS default_depo
|
||||
from mtb_depo
|
||||
left join gtb_anag on mtb_depo.cod_anag = gtb_anag.cod_anag,
|
||||
CASE WHEN (gtb_anag.part_iva = azienda.part_iva) THEN 1 ELSE 0 END AS default_depo
|
||||
FROM mtb_depo
|
||||
LEFT JOIN gtb_anag ON mtb_depo.cod_anag = gtb_anag.cod_anag,
|
||||
azienda
|
||||
where mtb_depo.flag_movimentabile = 'S'
|
||||
WHERE mtb_depo.flag_movimentabile = 'S'
|
||||
@@ -6,6 +6,7 @@ class Notifiche {
|
||||
$ret = new Ret();
|
||||
$endpoint = self::getFirebaseEndpoint();
|
||||
$response = null;
|
||||
|
||||
if ($endpoint != null) {
|
||||
$response = Cache::writeR("firebase_config.json", file_get_contents(self::getFirebaseEndpoint()), null, true);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,10 @@ $(function () {
|
||||
.execute();
|
||||
});
|
||||
|
||||
$(".emailbox > input[type='email']").on("enterKey", function () {
|
||||
$(".emailbox > input[type='email']").on("enterKey", _.debounce(function () {
|
||||
$(this).trigger("blur");
|
||||
$(this).closest("td").find(".emailbox .emailok").trigger("click");
|
||||
});
|
||||
}, 500));
|
||||
|
||||
$(".bt_sendMail").on("click", function () {
|
||||
const $btn = $(this);
|
||||
|
||||
@@ -374,10 +374,12 @@ const _ordiniARiassClie_filtroArticoli = {
|
||||
},
|
||||
|
||||
getLineeCambioMerce: function () {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
if (_ordiniARiassClie.righeOrdine.length > 0) {
|
||||
var codLine = _ordiniARiassClie.righeOrdine[0].cod_line;
|
||||
var linea = self.getLinea(codLine);
|
||||
const codLine = _ordiniARiassClie.righeOrdine[0].cod_line;
|
||||
const linea = self.getLinea(codLine);
|
||||
|
||||
if (is_null(linea)) {
|
||||
new ModalBox()
|
||||
.message("La linea <b>" + codLine + "</b> non è valida.<br/>Contattare l'azienda per le opportune verifiche.")
|
||||
@@ -385,11 +387,13 @@ const _ordiniARiassClie_filtroArticoli = {
|
||||
_URL.replace(_URL.current.removeParameter("k")).reload();
|
||||
})
|
||||
.danger().show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return (!is_null(linea.linee_cambio_merce) && !_.isEmpty(linea.linee_cambio_merce.trim())) ? linea.linee_cambio_merce.trim().split("|") : [];
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
|
||||
@@ -416,10 +420,11 @@ const _ordiniARiassClie_filtroArticoli = {
|
||||
},
|
||||
|
||||
getLinea: function (codLine) {
|
||||
var self = this;
|
||||
var result = Enumerable.From(self.listLinee).Where(function (x) {
|
||||
return x.cod_line == codLine;
|
||||
const self = this;
|
||||
const result = Enumerable.From(self.listLinee).Where(function (x) {
|
||||
return x.cod_line === codLine;
|
||||
}).ToArray();
|
||||
|
||||
return result.length > 0 ? result[0] : null;
|
||||
},
|
||||
|
||||
@@ -514,16 +519,18 @@ const _ordiniARiassClie_filtroArticoli = {
|
||||
},
|
||||
|
||||
refreshArticoli: function () {
|
||||
var self = this;
|
||||
const self = this;
|
||||
const filter = {};
|
||||
|
||||
var filter = {};
|
||||
$("#flt-articoli input, #flt-articoli select").each(function () {
|
||||
var $input = $(this);
|
||||
var key = $input.attr("id");
|
||||
var value = $input.getValue();
|
||||
const $input = $(this);
|
||||
const key = $input.attr("id");
|
||||
let value = $input.getValue();
|
||||
|
||||
if ($input.is_inputCheckbox()) {
|
||||
value = $input.prop("checked");
|
||||
}
|
||||
|
||||
filter[key] = value;
|
||||
});
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ class OrdiniUtils {
|
||||
$ccList = isset($options["cc"]) && is_array($options["cc"]) ? $options["cc"] : array();
|
||||
|
||||
$Mailer->requestDeliveryNotification(array_get($options, "requestDeliveryNotification", false), array_get($options, "deliveryAddress"));
|
||||
|
||||
if ($logToDtbOrdPdf || !$attachPdfLink) {
|
||||
$Ret = self::getFile($urlData);
|
||||
if ($Ret->is_OK()) {
|
||||
|
||||
@@ -332,7 +332,7 @@ class OrdiniWebPlants {
|
||||
$WdtbOrdt->set("codVage", self::getCodVageUtente());
|
||||
}
|
||||
}
|
||||
} else {// UPDATE
|
||||
} else { // UPDATE
|
||||
$WdtbOrdt->set("gestione", $ordine["key"]["gestione"])
|
||||
->setDate("dataOrd", $ordine["key"]["data_ord"])
|
||||
->set("numOrd", $ordine["key"]["num_ord"])
|
||||
@@ -340,6 +340,12 @@ class OrdiniWebPlants {
|
||||
->delete_then_insert();
|
||||
}
|
||||
|
||||
$percScontoClie = self::getPercScontoClie();
|
||||
|
||||
if ($percScontoClie && User::is_cliente()) {
|
||||
$WdtbOrdt->set("sconto1", $percScontoClie);
|
||||
}
|
||||
|
||||
$WdtbOrdt->set("flagElaborato", $ordine["flag_complete"] ? self::getValoreFlagConfermato() : "I")
|
||||
->set("note", $ordine["note_ordine"], true)
|
||||
->set("userName", User::get_current_username()) // sempre dell'ultimo utente che modifica
|
||||
@@ -359,13 +365,17 @@ class OrdiniWebPlants {
|
||||
$WdtbOrdt->set("wdtbOrdr")->append($WdtbOrdr);
|
||||
}
|
||||
}
|
||||
|
||||
$EntityList->push($WdtbOrdt);
|
||||
$ret = $EntityList->send();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
if (is_null($ordine["key"])) { // NUOVO
|
||||
$retData = $ret->get_data();
|
||||
|
||||
if (isset($retData[0]["entity"])) {
|
||||
$retEntity = $retData[0]["entity"];
|
||||
|
||||
$ordine["key"] = array(
|
||||
"gestione" => $retEntity["gestione"],
|
||||
"data_ord" => Utility\Date::strtotime($retEntity["dataOrd"], \Format::strtotimeDMYHMS),
|
||||
@@ -376,6 +386,42 @@ class OrdiniWebPlants {
|
||||
$ret->error("Si è verificato un problema durante la lettura del salvataggio. Controllare la situazione della pagina degli ordini inseriti");
|
||||
}
|
||||
}
|
||||
|
||||
// Commentato come da richiesta, non viene salvato più come riga ma direttamente come sconto1 nella testata
|
||||
// $percScontoClie = self::getPercScontoClie();
|
||||
//
|
||||
// if ($percScontoClie) {
|
||||
// $key = $ordine["key"];
|
||||
// $query = new Query();
|
||||
//
|
||||
// $query->importSqlFile('getWdtbOrdt')
|
||||
// ->setVar("gestione", $key["gestione"])
|
||||
// ->setDateVar("dataOrd", $key["data_ord"])
|
||||
// ->setVar("numOrd", $key["num_ord"])
|
||||
// ->setVar("serie", $key["serie"]);
|
||||
//
|
||||
// $savedWdtbOrdt = $query->firstRow()->execute();
|
||||
//
|
||||
// $wdtbOrdt = new EntityItem("wdtb_ordt");
|
||||
// $wdtbOrdt->no_op()
|
||||
// ->set("gestione", $key["gestione"])
|
||||
// ->setDate("dataOrd", $key["data_ord"])
|
||||
// ->set("numOrd", $key["num_ord"])
|
||||
// ->set("serie", $key["serie"]);
|
||||
//
|
||||
// $codMartScontoClie = self::getCodMartScontoClie();
|
||||
//
|
||||
// $scontoClie = $savedWdtbOrdt["netto_merce"] * ($percScontoClie / 100);
|
||||
//
|
||||
// $wdtbOrdr = new EntityItem("wdtb_ordr");
|
||||
// $wdtbOrdr->insert()
|
||||
// ->set("codMart", $codMartScontoClie)
|
||||
// ->set("qtaOrd", -1)
|
||||
// ->set("valUnt", $scontoClie);
|
||||
//
|
||||
// $wdtbOrdt->set("wdtbOrdr")->append($wdtbOrdr);
|
||||
// $ret = $wdtbOrdt->send();
|
||||
// }
|
||||
}
|
||||
|
||||
if ($ret->is_OK() && $ordine["flag_complete"]) {
|
||||
@@ -393,6 +439,20 @@ class OrdiniWebPlants {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getPercScontoClie() {
|
||||
$gestSetup = new GestSetup;
|
||||
$percScontoClie = $gestSetup->keySection("PERC_SCONTO_CLIE")->asInt()->get();
|
||||
|
||||
return $percScontoClie;
|
||||
}
|
||||
|
||||
public static function getCodMartScontoClie() {
|
||||
$gestSetup = new GestSetup;
|
||||
$codMartScontoClie = $gestSetup->keySection("COD_MART_SCONTO_CLIE")->get();
|
||||
|
||||
return $codMartScontoClie;
|
||||
}
|
||||
|
||||
public static function updateOrdine($data) {
|
||||
if (is_null($data["key"])) {
|
||||
$ret = self::writeUpdate($data);
|
||||
@@ -679,7 +739,6 @@ class OrdiniWebPlants {
|
||||
public static function getPdf($data) {
|
||||
if (isset($data["key_ord"])) {
|
||||
return self::getPdfOrdine($data["key_ord"]);
|
||||
|
||||
} else if (isset($data["key_doc"])) {
|
||||
return PdfDoc::cache($data["key_doc"]);
|
||||
}
|
||||
@@ -691,6 +750,7 @@ class OrdiniWebPlants {
|
||||
// <editor-fold desc="GENERAZIONE REPORT ORDINE" defaultstate="collapsed">
|
||||
public static function getPdfOrdine($data) {
|
||||
$Ret = self::getJPOrdine();
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
$JP = $Ret->get("JP");
|
||||
$JP->param("gestione", $data["gestione"])
|
||||
|
||||
@@ -639,16 +639,15 @@ const _ordiniWebPlants = {
|
||||
if (qtaOrd > 0) {
|
||||
if (valUnt > 0) {
|
||||
arr_rows.push({
|
||||
cod_mart: $tr.getDataAttr("cod_mart"),
|
||||
cod_mart: $tr.attr("data-cod_mart"),
|
||||
qta_ord: qtaOrd,
|
||||
val_unt: valUnt,
|
||||
note_riga: $tr.find("input.noteRiga").getValue(),
|
||||
qta_cnf: $tr.getFloatDataAttr("qta_cnf")
|
||||
});
|
||||
|
||||
} else {
|
||||
modalBox.warning("Prezzo non valido per uno o più articoli").then(function () {
|
||||
$("input.valUnt", $tr).select();
|
||||
$("input.valUnt", $tr).trigger("select");
|
||||
});
|
||||
flagOk = false;
|
||||
return false;
|
||||
@@ -714,7 +713,6 @@ const _ordiniWebPlants = {
|
||||
};
|
||||
|
||||
saveCallback();
|
||||
|
||||
} else {
|
||||
modalBox.sm().warning("Non è stata specificata la quantità per alcun articolo");
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user