Finish GestioneRossoGargano
This commit is contained in:
38
package-lock.json
generated
38
package-lock.json
generated
@@ -9,6 +9,8 @@
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@ihvh/air-datepicker-types": "^2.0.2",
|
||||
"@types/bootstrap": "^3.3.42",
|
||||
"@types/chart.js": "^2.9.37",
|
||||
"@types/datatables.net": "^1.10.24",
|
||||
"@types/jquery": "^3.5.16",
|
||||
@@ -134,6 +136,15 @@
|
||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@ihvh/air-datepicker-types": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@ihvh/air-datepicker-types/-/air-datepicker-types-2.0.2.tgz",
|
||||
"integrity": "sha512-5MsD27CODSJgYtkUTSEmu8FqYwpCXULJUzmy4MtX8sag5JcQAFUKHAhPIE9iktpu3vtbgoeA5qmlu9JhokVvVA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/jquery": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@@ -169,6 +180,15 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/bootstrap": {
|
||||
"version": "3.3.42",
|
||||
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-3.3.42.tgz",
|
||||
"integrity": "sha512-ERkg6+Doymm2Uv/+jvqgxmoDLr6vz7wThaS2523QoY/tcTuw7HKrF5v06u2Ga3nEu0+iVTnNk7HLIzgm6ZZh8A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/jquery": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/chart.js": {
|
||||
"version": "2.9.37",
|
||||
"resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.37.tgz",
|
||||
@@ -7314,6 +7334,15 @@
|
||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
||||
"dev": true
|
||||
},
|
||||
"@ihvh/air-datepicker-types": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@ihvh/air-datepicker-types/-/air-datepicker-types-2.0.2.tgz",
|
||||
"integrity": "sha512-5MsD27CODSJgYtkUTSEmu8FqYwpCXULJUzmy4MtX8sag5JcQAFUKHAhPIE9iktpu3vtbgoeA5qmlu9JhokVvVA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/jquery": "*"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@@ -7340,6 +7369,15 @@
|
||||
"fastq": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"@types/bootstrap": {
|
||||
"version": "3.3.42",
|
||||
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-3.3.42.tgz",
|
||||
"integrity": "sha512-ERkg6+Doymm2Uv/+jvqgxmoDLr6vz7wThaS2523QoY/tcTuw7HKrF5v06u2Ga3nEu0+iVTnNk7HLIzgm6ZZh8A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/jquery": "*"
|
||||
}
|
||||
},
|
||||
"@types/chart.js": {
|
||||
"version": "2.9.37",
|
||||
"resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.37.tgz",
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ihvh/air-datepicker-types": "^2.0.2",
|
||||
"@types/bootstrap": "^3.3.42",
|
||||
"@types/chart.js": "^2.9.37",
|
||||
"@types/datatables.net": "^1.10.24",
|
||||
"@types/jquery": "^3.5.16",
|
||||
|
||||
34
public_html/api.php
Normal file
34
public_html/api.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
session_start();
|
||||
include "functions.php";
|
||||
require_once "include_login.php";
|
||||
include "config.php";
|
||||
include "include/module.php";
|
||||
|
||||
|
||||
$className = null;
|
||||
$methodData = Ajax::getMethodData();
|
||||
|
||||
$methodName = array_get($methodData, "methodName");
|
||||
$type = array_get($methodData, "type");
|
||||
|
||||
if (isset($methodName) && isset($type)) {
|
||||
$data = explode("/", $methodName);
|
||||
|
||||
$className = ucfirst($data[0]);
|
||||
$newMethodName = $data[1];
|
||||
|
||||
$var = $type ? $_GET : $_POST;
|
||||
|
||||
$methodValue = $var[$methodName];
|
||||
unset($var[$methodName]);
|
||||
$var = array_merge(array($newMethodName => $methodValue), $var);
|
||||
|
||||
if ($type == "GET") {
|
||||
$_GET = $var;
|
||||
} else {
|
||||
$_POST = $var;
|
||||
}
|
||||
}
|
||||
|
||||
(new Ajax("\Api\\" . $className))->checkAjaxRequests();
|
||||
15
public_html/classes/Api/Api.php
Normal file
15
public_html/classes/Api/Api.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
use IMSApi;
|
||||
|
||||
class Api {
|
||||
protected static $group = null;
|
||||
|
||||
protected static function imsApi() {
|
||||
$imsApi = new IMSApi();
|
||||
|
||||
return $imsApi->group(static::$group);
|
||||
}
|
||||
}
|
||||
43
public_html/classes/Api/Production.php
Normal file
43
public_html/classes/Api/Production.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
class Production extends Api {
|
||||
protected static $group = "production";
|
||||
|
||||
public static function creaOrdineProd($data) {
|
||||
$imsApi = self::imsApi();
|
||||
|
||||
$imsApi
|
||||
->post("creaOrdineProd")
|
||||
->body(empty($data) ? null : $data);
|
||||
|
||||
return $imsApi->send();
|
||||
}
|
||||
|
||||
public static function getArtsProdByCodMart($codMart) {
|
||||
$imsApi = self::imsApi();
|
||||
|
||||
$imsApi
|
||||
->get("getArtsProdByCodMart")
|
||||
->queryParam("codMart", $codMart);
|
||||
|
||||
$ret = $imsApi->send();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
return $ret->set_data($ret->getDto());
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function creaColliEDoc($data) {
|
||||
$imsApi = self::imsApi();
|
||||
|
||||
$imsApi
|
||||
->post("creaColliEDoc")
|
||||
->body(empty($data) ? null : $data);
|
||||
|
||||
return $imsApi->send();
|
||||
}
|
||||
}
|
||||
7
public_html/classes/Api/StdUtils.php
Normal file
7
public_html/classes/Api/StdUtils.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
class StdUtils extends \StdUtils {
|
||||
|
||||
}
|
||||
17
public_html/classes/Api/System.php
Normal file
17
public_html/classes/Api/System.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Api;
|
||||
|
||||
class System extends Api {
|
||||
protected static $group = "system";
|
||||
|
||||
public static function defaultAzienda() {
|
||||
$imsApi = self::imsApi();
|
||||
|
||||
$imsApi
|
||||
->group(null)
|
||||
->get("defaultAzienda");
|
||||
|
||||
return $imsApi->send();
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,10 @@ class EntityItem {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @return EntityArray
|
||||
*/
|
||||
public function get_childEntityArray($key) {
|
||||
if (!isset($this->childEntityArray[$key])) {
|
||||
$this->childEntityArray[$key] = new EntityArray($key);
|
||||
@@ -145,6 +149,13 @@ class EntityItem {
|
||||
return $this->set($key, $value, $setNullConstant);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
* @param $setNullConstant
|
||||
* @param $oneToOneRelationship
|
||||
* @return $this|EntityArray|false|mixed
|
||||
*/
|
||||
public function set($key, $value = false, $setNullConstant = false, $oneToOneRelationship = false) {
|
||||
if (count(func_get_args()) == 1) { // GET
|
||||
if (isset($this->arr_fields[$key])) {
|
||||
|
||||
@@ -59,8 +59,8 @@ class EntityList {
|
||||
return $this->entityItems;
|
||||
}
|
||||
|
||||
public function push() {
|
||||
$arr_entityItem = func_get_args();
|
||||
public function push(...$arr_entityItem) {
|
||||
// $arr_entityItem = func_get_args();
|
||||
foreach ($arr_entityItem as $EntityItem) {
|
||||
if (\EntityItem::is_entityItem($EntityItem)) {
|
||||
$this->entityItems[] = $EntityItem;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
class IMSApi
|
||||
{
|
||||
class IMSApi {
|
||||
const serviceRootPath = "ems-api/";
|
||||
private $contentType = null;
|
||||
private $group = null;
|
||||
private $serviceName = null;
|
||||
private $serviceMethod = null;
|
||||
private $body = null;
|
||||
@@ -23,6 +23,11 @@ class IMSApi
|
||||
}
|
||||
|
||||
// <editor-fold desc="Setters" defaultstate="collapsed">
|
||||
public function group($value) {
|
||||
$this->group = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function service($value) {
|
||||
$this->serviceName = $value;
|
||||
return $this;
|
||||
@@ -217,7 +222,8 @@ class IMSApi
|
||||
|
||||
public function makeRest() {
|
||||
$rest = new Rest();
|
||||
$rest->service($this->serviceName)
|
||||
$rest
|
||||
->service((is_null($this->group) ? "" : $this->group . "/") . $this->serviceName)
|
||||
->contentType($this->contentType)
|
||||
->method($this->serviceMethod)
|
||||
->urlData($this->queryParams)
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace IMSApi;
|
||||
class ProcessSql extends \IMSApi {
|
||||
private $sql = null;
|
||||
private $date2ts = false;
|
||||
private $date2iso = false;
|
||||
private $camelCase = false;
|
||||
|
||||
public function __construct($sql = null) {
|
||||
@@ -23,6 +24,14 @@ class ProcessSql extends \IMSApi {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $date2iso
|
||||
*/
|
||||
public function setDate2iso($date2iso) {
|
||||
$this->date2iso = $date2iso;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function sql($value) {
|
||||
if (\Query::is_typeQuery($value)) {
|
||||
$this->sql = $value->getSql();
|
||||
@@ -37,6 +46,7 @@ class ProcessSql extends \IMSApi {
|
||||
if (!is_null($this->sql)) {
|
||||
$this->queryParam("camelCase", $this->camelCase);
|
||||
$this->queryParam("date2ts", $this->date2ts);
|
||||
$this->queryParam("date2iso", $this->date2iso);
|
||||
$this->body(array("nativeSql" => $this->sql));
|
||||
|
||||
$Ret = parent::send();
|
||||
|
||||
@@ -74,6 +74,20 @@ class KendoService {
|
||||
return $query;
|
||||
}
|
||||
|
||||
public static function manageRet($ret) {
|
||||
if ($ret->is_OK()) {
|
||||
$data = $ret->get_data();
|
||||
$firstRow = reset($data);
|
||||
|
||||
$ret->set_data(array(
|
||||
"data" => $data,
|
||||
"total" => array_get($firstRow, "rows_count", 0)
|
||||
));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// public static function filterQuery($filter, $alias, $query) {
|
||||
// if (isset($filter["filters"])) {
|
||||
// $query .= "(";
|
||||
|
||||
@@ -1015,6 +1015,7 @@ class Query {
|
||||
$processSql = new \IMSApi\ProcessSql($sql);
|
||||
$processSql->profileDB($this->profileDB);
|
||||
$processSql->setDate2ts($this->date2ts);
|
||||
$processSql->setDate2iso($this->date2iso);
|
||||
$processSql->anonymousAuth($this->anonymousAuth);
|
||||
$result = $processSql->send();
|
||||
if ($result->is_OK()) {
|
||||
|
||||
@@ -102,7 +102,7 @@ class Utility {
|
||||
$output[$var] = self::JSON_values_decode($val);
|
||||
}
|
||||
} else {
|
||||
$output = is_null($input) ? null : (is_string($input) ? urldecode($input) : $input);
|
||||
$output = is_null($input) ? null : (is_string($input) && false ? urldecode($input) : $input);
|
||||
}
|
||||
return $output;
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -2214,5 +2214,19 @@
|
||||
"select2"
|
||||
],
|
||||
"requirePermission": true
|
||||
},
|
||||
"pian_acc_rossg": {
|
||||
"title": "Pianificazione e Accettazione",
|
||||
"pages": "pian_acc_rossg.php",
|
||||
"position": [],
|
||||
"children": [],
|
||||
"icon": "icon.png",
|
||||
"libs": [
|
||||
"std-pkg",
|
||||
"reef",
|
||||
"kendo",
|
||||
"air-datepicker"
|
||||
],
|
||||
"requirePermission": true
|
||||
}
|
||||
}
|
||||
@@ -458,3 +458,23 @@ function array_only($array, $keys) {
|
||||
array_flip($keys)
|
||||
);
|
||||
}
|
||||
|
||||
function array_any(array $array, callable $fn) {
|
||||
foreach ($array as $value) {
|
||||
if ($fn($value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function array_every(array $array, callable $fn) {
|
||||
foreach ($array as $value) {
|
||||
if (!$fn($value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import ViewModule from "@js/ViewModule";
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
|
||||
export default class AnalisiBudget extends ViewModule {
|
||||
name(): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ViewModule from "@js/ViewModule";
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
import PopupCreaBudget from "@gest-lib/gestione_budget/ts/PopupCreaBudget";
|
||||
|
||||
export interface VtbBdgt extends kendo.data.Model {
|
||||
@@ -203,6 +203,9 @@ export default class GestioneBudget extends ViewModule {
|
||||
`
|
||||
}
|
||||
],
|
||||
dataBound: () => {
|
||||
$(".k-icon.fa").removeClass("k-icon");
|
||||
}
|
||||
});
|
||||
|
||||
this.$container.find(".creaBudget").on("click", async (e) => {
|
||||
|
||||
@@ -39,7 +39,6 @@ export interface RetGetClients {
|
||||
}
|
||||
|
||||
export default class PopupCreaBudget extends BasePopup {
|
||||
private readonly module: Module;
|
||||
private readonly vtbBdgt: VtbBdgt;
|
||||
private readonly store: CreaBudgetForm;
|
||||
private clientsConfig: Array<ClientConfig>;
|
||||
@@ -49,14 +48,8 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
private lastStorico: string;
|
||||
static multipleDatesSeparator = " - ";
|
||||
|
||||
constructor(module: Module = null, vtbBdgt: VtbBdgt = null) {
|
||||
super();
|
||||
|
||||
if (module) {
|
||||
this.module = module;
|
||||
} else {
|
||||
this.module = new Module("gestione_budget");
|
||||
}
|
||||
constructor(module: Module | null = null, vtbBdgt: VtbBdgt = null) {
|
||||
super("gestione_budget", module);
|
||||
|
||||
this.vtbBdgt = vtbBdgt;
|
||||
|
||||
@@ -91,7 +84,6 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
.title((this.vtbBdgt ? "Modifica" : "Crea") + " Budget")
|
||||
.style(this.vtbBdgt ? "primary" : "success")
|
||||
.gridSize({xs: 12, sm: 8})
|
||||
.content(this.content())
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: this.vtbBdgt ? "Modifica" : "Crea",
|
||||
@@ -99,7 +91,9 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
this.$okBtn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
await this.saveClients(this.store.clienti);
|
||||
if (!this.vtbBdgt) {
|
||||
await this.saveClients(this.store.clienti);
|
||||
}
|
||||
|
||||
if (await (this.vtbBdgt ? this.modificaBudget({
|
||||
id_bdg: this.vtbBdgt.id_bdg,
|
||||
@@ -121,10 +115,6 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
// return this;
|
||||
// }
|
||||
|
||||
name(): string {
|
||||
return "gestione_budget";
|
||||
}
|
||||
|
||||
content() {
|
||||
if (this.vtbBdgt) {
|
||||
// language=HTML
|
||||
@@ -353,13 +343,11 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
});
|
||||
}
|
||||
|
||||
onBeforeShow($div) {
|
||||
super.onBeforeShow($div);
|
||||
|
||||
onBeforeShow() {
|
||||
this.$okBtn.disabled(!this.vtbBdgt);
|
||||
}
|
||||
|
||||
onShow($div) {
|
||||
onShow($div: JQuery<HTMLElement>) {
|
||||
$div.find("#descrizione").on("change", (e) => this.store.descrizione = <string>$(e.target).val());
|
||||
|
||||
const $storico = $div.find("#storico");
|
||||
@@ -409,8 +397,6 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
}
|
||||
|
||||
async open() {
|
||||
await this.module.load();
|
||||
|
||||
this.clientsConfig = this.module.get_dataSource("clientsConfig");
|
||||
|
||||
let elementsSet = false;
|
||||
@@ -426,7 +412,7 @@ export default class PopupCreaBudget extends BasePopup {
|
||||
};
|
||||
|
||||
const onStoreChange = async () => {
|
||||
console.log(JSON.parse(JSON.stringify(this.store)));
|
||||
// console.log(JSON.parse(JSON.stringify(this.store)));
|
||||
|
||||
const storico = JSON.stringify(this.store.storico);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ViewModule from "@js/ViewModule";
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
import PopupInviaASelezionati from "@gest-lib/invio_variazioni_prezzi/ts/PopupInviaASelezionati";
|
||||
|
||||
export default class InviaVariazioni extends ViewModule {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ViewModule from "@js/ViewModule";
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
|
||||
export default class PopupDettaglioStoricoVariazione extends ViewModule {
|
||||
private columns: Array<kendo.ui.GridColumn>
|
||||
|
||||
@@ -3,6 +3,11 @@ import BasePopup from "@js/BasePopup";
|
||||
export default class PopupInviaASelezionati extends BasePopup {
|
||||
private righe: any[];
|
||||
|
||||
|
||||
constructor(module: Module | null = null) {
|
||||
super("invio_variazioni_prezzi", module);
|
||||
}
|
||||
|
||||
setRighe(value: Array<kendo.data.ObservableObject>): PopupInviaASelezionati {
|
||||
this.righe = value.map(riga => riga.toJSON());
|
||||
|
||||
@@ -54,11 +59,11 @@ export default class PopupInviaASelezionati extends BasePopup {
|
||||
`;
|
||||
}
|
||||
|
||||
name(): string {
|
||||
return "invio_variazioni_prezzi";
|
||||
onBeforeShow($div: JQuery<HTMLElement>): void {
|
||||
return;
|
||||
}
|
||||
|
||||
onShow($div) {
|
||||
onShow($div: JQuery<HTMLElement>) {
|
||||
$div.find("#dataVariazione").datepicker({
|
||||
dateFormat: "dd/mm/yyyy",
|
||||
clearButton: true,
|
||||
@@ -68,54 +73,51 @@ export default class PopupInviaASelezionati extends BasePopup {
|
||||
}
|
||||
|
||||
async open() {
|
||||
return new Promise((resolve, reject) => {
|
||||
new Ajax()
|
||||
.get("popupInviaASelezionati")
|
||||
.data({})
|
||||
.noticeAsModal()
|
||||
.waitModal()
|
||||
.onSuccess((ret) => {
|
||||
this.modalBox
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Invia",
|
||||
style: "success",
|
||||
size: {md: 3},
|
||||
onClick: () => {
|
||||
console.log(this.righe);
|
||||
console.log(_checkForm.checkData(this.modalBox.$div));
|
||||
|
||||
new Ajax()
|
||||
.get("popupInviaASelezionati")
|
||||
.data({})
|
||||
.noticeAsModal()
|
||||
.waitModal()
|
||||
.onSuccess((ret) => {
|
||||
this.modalBox
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Invia",
|
||||
style: "success",
|
||||
size: {md: 3},
|
||||
onClick: () => {
|
||||
console.log(this.righe);
|
||||
console.log(_checkForm.checkData(this.modalBox.$div));
|
||||
const data = {
|
||||
"form": _checkForm.checkData(this.modalBox.$div),
|
||||
"righe": this.righe,
|
||||
};
|
||||
|
||||
const data = {
|
||||
"form": _checkForm.checkData(this.modalBox.$div),
|
||||
"righe": this.righe,
|
||||
};
|
||||
|
||||
new Ajax()
|
||||
.post("inviaVariazioni")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.waitModal()
|
||||
.onSuccess((ret) => {
|
||||
console.log(ret);
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
})
|
||||
.onBeforeShow(($div) => {
|
||||
console.log("");
|
||||
})
|
||||
.gridSize({
|
||||
xs: 12,
|
||||
sm: 10
|
||||
})
|
||||
.content(this.content())
|
||||
.draggable()
|
||||
.title(`Invia a selezionati`)
|
||||
.style("primary")
|
||||
.show();
|
||||
})
|
||||
.execute();
|
||||
})
|
||||
new Ajax()
|
||||
.post("inviaVariazioni")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.waitModal()
|
||||
.onSuccess((ret) => {
|
||||
console.log(ret);
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
})
|
||||
.onBeforeShow(($div) => {
|
||||
console.log("");
|
||||
})
|
||||
.gridSize({
|
||||
xs: 12,
|
||||
sm: 10
|
||||
})
|
||||
.content(this.content())
|
||||
.draggable()
|
||||
.title(`Invia a selezionati`)
|
||||
.style("primary")
|
||||
.show();
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import ViewModule from "@js/ViewModule";
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
import PopupDettaglioStoricoVariazione from "@gest-lib/invio_variazioni_prezzi/ts/PopupDettaglioStoricoVariazione";
|
||||
import {VtbBdgt} from "@gest-lib/gestione_budget/ts/GestioneBudget";
|
||||
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
|
||||
use Api\Production;
|
||||
|
||||
class PianAccRossg {
|
||||
public static function _moduleDatasource($filter) {
|
||||
$Ret = new Ret;
|
||||
if ($Ret->is_OK()) {
|
||||
$retData = array(
|
||||
array("id" => "name", "data" => array()),
|
||||
);
|
||||
$Ret->set_data($retData);
|
||||
}
|
||||
return $Ret;
|
||||
}
|
||||
|
||||
public static function getPianificazioni($data) {
|
||||
$data = array_get($data, "data");
|
||||
|
||||
if (is_null($data)) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Data mancante in getPianificazioni.");
|
||||
}
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "get-pianificazioni", "data_ins_ord DESC");
|
||||
|
||||
$query->setDateVar("dataOrd", $data);
|
||||
|
||||
$ret = $query->toRet()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$pianificazioni = $ret->get_data();
|
||||
$firstRow = reset($pianificazioni);
|
||||
|
||||
$ret->set_data(array(
|
||||
"data" => $pianificazioni,
|
||||
"total" => array_get($firstRow, "rows_count", 0)
|
||||
));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getColli($data) {
|
||||
$gestione = array_get($data, "gestione");
|
||||
$dataOrd = array_get($data, "dataOrd");
|
||||
$numOrd = array_get($data, "numOrd");
|
||||
|
||||
if (array_any(array($gestione, $dataOrd, $numOrd), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati mancanti in getColli.");
|
||||
}
|
||||
|
||||
$query = KendoService::queryInitializerService($data, "get-colli", "row_number");
|
||||
|
||||
$query
|
||||
->setVar("gestione", $gestione)
|
||||
->setDateVar("dataOrd", $dataOrd)
|
||||
->setVar("numOrd", $numOrd);
|
||||
|
||||
$ret = $query->date2iso()->toRet()->execute();
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
$colli = $ret->get_data();
|
||||
$firstRow = reset($colli);
|
||||
|
||||
$ret->set_data(array(
|
||||
"data" => $colli,
|
||||
"total" => array_get($firstRow, "rows_count", 0)
|
||||
));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getOrdiniAcq($data) {
|
||||
$query = $query = KendoService::queryInitializerService($data, "get-ordini-acq", "cod_anag, cod_vdes");
|
||||
|
||||
return KendoService::manageRet($query->toRet()->execute());
|
||||
}
|
||||
|
||||
public static function creaPianificazione($data) {
|
||||
$dataOrd = array_get($data, "dataOrd");
|
||||
$ordAcq = array_get($data, "ordAcq");
|
||||
$nBins = array_get($data, "nBins");
|
||||
$nCamion = array_get($data, "nCamion");
|
||||
|
||||
if (array_any(array($dataOrd, $ordAcq, $nBins, $nCamion), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati mancanti in creaOrdineProd");
|
||||
}
|
||||
|
||||
$data["codAnag"] = array_get($ordAcq, "cod_anag");
|
||||
$data["codVdes"] = array_get($ordAcq, "cod_vdes");
|
||||
$data["codMdep"] = array_get($ordAcq, "cod_mdep");
|
||||
$data["partitaMag"] = array_get($ordAcq, "partita_mag");
|
||||
$data["numCnf"] = $nBins * $nCamion;
|
||||
$data["colliPedana"] = $nBins;
|
||||
|
||||
return Production::creaOrdineProd($data);
|
||||
}
|
||||
|
||||
public static function eliminaPianificazione($data) {
|
||||
$gestione = array_get($data, "gestione");
|
||||
$dataOrd = array_get($data, "dataOrd");
|
||||
$numOrd = array_get($data, "numOrd");
|
||||
|
||||
if (array_any(array($gestione, $dataOrd, $numOrd), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati id mancanti in eliminaPianificazione");
|
||||
}
|
||||
|
||||
$dtbOrdt = new EntityItem("dtb_ordt");
|
||||
|
||||
$dtbOrdt
|
||||
->delete()
|
||||
->set("gestione", $gestione)
|
||||
->setDate("dataOrd", $dataOrd)
|
||||
->set("numOrd", $numOrd);
|
||||
|
||||
return $dtbOrdt->send();
|
||||
}
|
||||
|
||||
public static function getArtsProdByCodMart($data) {
|
||||
return Production::getArtsProdByCodMart(array_get($data, "codMart"));
|
||||
}
|
||||
|
||||
public static function creaCollo($data) {
|
||||
$gestione = array_get($data, "gestione");
|
||||
$dataOrd = array_get($data, "dataOrd");
|
||||
$numOrd = array_get($data, "numOrd");
|
||||
$dataCollo = array_get($data, "dataCollo");
|
||||
$codAnag = array_get($data, "codAnag");
|
||||
$codMdep = array_get($data, "codMdep");
|
||||
$numDoc = array_get($data, "numDoc");
|
||||
$dataDoc = array_get($data, "dataDoc");
|
||||
$codVvet = array_get($data, "codVvet");
|
||||
$targa = array_get($data, "targa");
|
||||
$codMart = array_get($data, "codMart");
|
||||
$partitaMag = array_get($data, "partitaMag");
|
||||
$pesoNettoKg = array_get($data, "pesoNettoKg");
|
||||
$cassoniScaricati = array_get($data, "cassoniScaricati");
|
||||
|
||||
if (array_any(array($gestione, $dataOrd, $numOrd, $dataCollo, $codAnag, $numDoc, $dataDoc, $codMart, $pesoNettoKg, $cassoniScaricati), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati mancanti in creaCollo.");
|
||||
}
|
||||
|
||||
$mtbColr = new EntityItem("mtb_colr");
|
||||
|
||||
$mtbColr
|
||||
->insert()
|
||||
->set("codMart", $codMart)
|
||||
->set("partitaMag", $partitaMag)
|
||||
->set("qtaCol", $pesoNettoKg)
|
||||
->set("numCnf", $cassoniScaricati);
|
||||
|
||||
$mtbColt = new EntityItem("mtb_colt");
|
||||
|
||||
$mtbColt
|
||||
->insert()
|
||||
->set("gestione", $gestione)
|
||||
->setDate("dataOrd", $dataOrd)
|
||||
->set("numOrd", $numOrd)
|
||||
->set("segno", 1)
|
||||
->setDate("dataCollo", $dataCollo)
|
||||
->set("serCollo", "P1")
|
||||
->set("codAnag", $codAnag)
|
||||
->set("codMdep", $codMdep)
|
||||
->set("mtbColr")->append($mtbColr);
|
||||
|
||||
$body = new EntityItem();
|
||||
|
||||
$body
|
||||
->set("codDtip", "CLAV")
|
||||
->set("flagLeggiDatiOrd", true)
|
||||
->setDate("dataDoc", $dataDoc)
|
||||
->set("serDoc", "P1")
|
||||
->set("numDoc", $numDoc)
|
||||
->set("codMdep", $codMdep)
|
||||
->set("gestione", $gestione)
|
||||
->setDate("dataOrd", $dataOrd)
|
||||
->set("numOrd", $numOrd)
|
||||
->set("codVvet", $codVvet)
|
||||
->set("targa", $targa)
|
||||
->set("colli")->append($mtbColt);
|
||||
|
||||
return Production::creaColliEDoc($body);
|
||||
}
|
||||
|
||||
public static function eliminaCollo($data) {
|
||||
$codAnag = array_get($data, "codAnag");
|
||||
$codDtip = array_get($data, "codDtip");
|
||||
$dataDoc = array_get($data, "dataDoc");
|
||||
$serDoc = array_get($data, "serDoc");
|
||||
$numDoc = array_get($data, "numDoc");
|
||||
$gestione = array_get($data, "gestione");
|
||||
$dataCollo = array_get($data, "dataCollo");
|
||||
$serCollo = array_get($data, "serCollo");
|
||||
$numCollo = array_get($data, "numCollo");
|
||||
|
||||
if (array_any(array($codAnag, $codDtip, $dataDoc, $serDoc, $numDoc, $gestione, $dataCollo, $serCollo, $numCollo), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati id mancanti in eliminaCollo");
|
||||
}
|
||||
|
||||
$mtbColt = new EntityItem("mtb_colt");
|
||||
|
||||
$mtbColt
|
||||
->delete()
|
||||
->set("gestione", $gestione)
|
||||
->setDate("dataCollo", $dataCollo)
|
||||
->set("serCollo", $serCollo)
|
||||
->set("numCollo", $numCollo);
|
||||
|
||||
$dtbDoct = new EntityItem("dtb_doct");
|
||||
|
||||
$dtbDoct
|
||||
->delete()
|
||||
->set("codAnag", $codAnag)
|
||||
->set("codDtip", $codDtip)
|
||||
->setDate("dataDoc", $dataDoc)
|
||||
->set("serDoc", $serDoc)
|
||||
->set("numDoc", $numDoc)
|
||||
->set("mtbColt")->append($mtbColt);
|
||||
|
||||
$entityList = new EntityList();
|
||||
|
||||
$entityList->push($dtbDoct, $mtbColt);
|
||||
|
||||
return $entityList->send();
|
||||
}
|
||||
|
||||
public static function stampaCollo($data) {
|
||||
$gestione = array_get($data, "gestione");
|
||||
$dataCollo = array_get($data, "data_collo");
|
||||
$numCollo = array_get($data, "num_collo");
|
||||
$serCollo = array_get($data, "ser_collo");
|
||||
|
||||
if (array_any(array($gestione, $dataCollo, $numCollo, $serCollo), function ($var) {
|
||||
return is_null($var);
|
||||
})) {
|
||||
$ret = new Ret();
|
||||
return $ret->set_error("Dati mancanti in stampaCollo");
|
||||
}
|
||||
|
||||
$gestSetup = new GestSetup();
|
||||
$gestSetup->keySection("REPORT_NAME_COLLO")->defaultValue("EtichettaSSCCNew");
|
||||
|
||||
$JP = new JasperProcessor();
|
||||
|
||||
$ret = $JP->load($gestSetup);
|
||||
|
||||
if ($ret->is_OK()) {
|
||||
/**
|
||||
* @var JasperProcessor $JP
|
||||
*/
|
||||
$JP = $ret->get("JP");
|
||||
$JP
|
||||
->param("gestione", $gestione)
|
||||
->paramDate("data_collo", $dataCollo)
|
||||
->param("num_collo", $numCollo)
|
||||
->param("ser_collo", $serCollo)
|
||||
->cacheAs("Collo n. $numCollo del " . (new DateTime($dataCollo))->format(Format::strtotimeDMY));
|
||||
|
||||
$ret = $JP->run();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
1
public_html/gest-lib/pian_acc_rossg/css/main.css
Normal file
1
public_html/gest-lib/pian_acc_rossg/css/main.css
Normal file
@@ -0,0 +1 @@
|
||||
.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{background-color:#fafafa}/*# sourceMappingURL=main.css.map */
|
||||
BIN
public_html/gest-lib/pian_acc_rossg/icon.png
Normal file
BIN
public_html/gest-lib/pian_acc_rossg/icon.png
Normal file
Binary file not shown.
1
public_html/gest-lib/pian_acc_rossg/include/main.php
Normal file
1
public_html/gest-lib/pian_acc_rossg/include/main.php
Normal file
@@ -0,0 +1 @@
|
||||
<div id="app">Caricamento...</div>
|
||||
3
public_html/gest-lib/pian_acc_rossg/scss/main.scss
Normal file
3
public_html/gest-lib/pian_acc_rossg/scss/main.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
.nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
20
public_html/gest-lib/pian_acc_rossg/sql/get-colli.sql
Normal file
20
public_html/gest-lib/pian_acc_rossg/sql/get-colli.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
SELECT mct.gestione,
|
||||
mct.data_collo,
|
||||
mct.ser_collo,
|
||||
mct.num_collo,
|
||||
mct.data_ins,
|
||||
mct.cod_anag,
|
||||
mct.cod_dtip,
|
||||
mct.data_doc,
|
||||
mct.ser_doc,
|
||||
mct.num_doc,
|
||||
mcr.num_cnf,
|
||||
mcr.qta_col,
|
||||
mcr.qta_cnf
|
||||
FROM mtb_colt mct
|
||||
INNER JOIN dbo.mtb_colr mcr ON mct.gestione = mcr.gestione AND mct.data_collo = mcr.data_collo AND
|
||||
mct.ser_collo = mcr.ser_collo AND mct.num_collo = mcr.num_collo
|
||||
WHERE segno = 1
|
||||
AND mct.gestione = '[gestione]'
|
||||
AND mct.data_ord = '[dataOrd]'
|
||||
AND mct.num_ord = [numOrd]
|
||||
21
public_html/gest-lib/pian_acc_rossg/sql/get-ordini-acq.sql
Normal file
21
public_html/gest-lib/pian_acc_rossg/sql/get-ordini-acq.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
SELECT dot.cod_anag,
|
||||
ga.rag_soc,
|
||||
dot.cod_anag + ' - ' + ga.rag_soc AS fornitore,
|
||||
dot.cod_vdes,
|
||||
vd.destinatario,
|
||||
dot.cod_mdep,
|
||||
dor.cod_mart,
|
||||
ma.descrizione,
|
||||
dor.cod_mart + ' - ' + ma.descrizione AS articolo,
|
||||
dor.partita_mag,
|
||||
dor.qta_ord - dor.qta_evasa AS qta_ord,
|
||||
dor.unt_ord
|
||||
FROM dtb_ordt dot
|
||||
INNER JOIN dbo.dtb_ordr dor
|
||||
ON dot.gestione = dor.gestione AND dot.data_ord = dor.data_ord AND
|
||||
dot.num_ord = dor.num_ord
|
||||
INNER JOIN dbo.gtb_anag ga ON dot.cod_anag = ga.cod_anag
|
||||
INNER JOIN dbo.mtb_aart ma ON dor.cod_mart = ma.cod_mart
|
||||
INNER JOIN vtb_dest vd ON dot.cod_vdes = vd.cod_vdes
|
||||
WHERE dot.gestione = 'A'
|
||||
AND dot.gestione_rif IS NULL
|
||||
@@ -0,0 +1,33 @@
|
||||
SELECT dot.gestione,
|
||||
dot.data_ord,
|
||||
dot.num_ord,
|
||||
dot.cod_anag,
|
||||
ga.rag_soc,
|
||||
dot.cod_anag + ' - ' + ga.rag_soc AS produttore,
|
||||
dot.cod_mdep,
|
||||
ga.cod_fisc,
|
||||
ga.part_iva,
|
||||
dot.cod_prod,
|
||||
dot.descr_estesa_prod AS articolo,
|
||||
dot.partita_mag,
|
||||
dot.data_ins_ord,
|
||||
COUNT(DISTINCT mc.num_collo) AS n_camion,
|
||||
dot.num_cnf_prod / IIF(dot.colli_pedana = 0, 1, dot.colli_pedana) AS n_camion_ord,
|
||||
dot.num_cnf_prod AS tot_colli_ord,
|
||||
ISNULL(SUM(mcr.num_cnf), 0) AS tot_colli,
|
||||
dot.qta_prod * dot.rap_conv_prod AS tot_kg_ord,
|
||||
SUM(ISNULL(mcr.peso_netto_kg, 0)) AS tot_kg
|
||||
FROM dtb_ordt dot
|
||||
INNER JOIN gtb_anag ga ON dot.cod_anag = ga.cod_anag
|
||||
LEFT OUTER JOIN dbo.mtb_colt mc
|
||||
ON dot.gestione = mc.gestione AND dot.data_ord = mc.data_ord AND dot.num_ord = mc.num_ord
|
||||
AND mc.segno = 1
|
||||
LEFT OUTER JOIN dbo.mtb_colr mcr ON mc.gestione = mcr.gestione AND mc.data_collo = mcr.data_collo AND
|
||||
mc.ser_collo = mcr.ser_collo AND mc.num_collo = mcr.num_collo AND
|
||||
dot.cod_prod = mcr.cod_mart
|
||||
WHERE dot.gestione = 'L'
|
||||
AND flag_evaso_prod = 'I'
|
||||
AND dot.data_ord = '[dataOrd]'
|
||||
GROUP BY dot.gestione, dot.data_ord, dot.num_ord, dot.cod_anag, ga.rag_soc, dot.cod_mdep, ga.cod_fisc, ga.part_iva,
|
||||
dot.cod_prod, dot.descr_estesa_prod, dot.partita_mag, dot.data_ins_ord,
|
||||
dot.num_cnf_prod, dot.colli_pedana, dot.qta_prod, dot.rap_conv_prod
|
||||
609
public_html/gest-lib/pian_acc_rossg/ts/PianAccRossg.ts
Normal file
609
public_html/gest-lib/pian_acc_rossg/ts/PianAccRossg.ts
Normal file
@@ -0,0 +1,609 @@
|
||||
import TabsViewModule from "@js/modules/TabsViewModule";
|
||||
import Moment = moment.Moment;
|
||||
import {numberStyle} from "@js/utils";
|
||||
import PopupCreaOrdineRacc from "@gest-lib/pian_acc_rossg/ts/PopupCreaOrdineRacc";
|
||||
import PopupCreaCollo from "@gest-lib/pian_acc_rossg/ts/PopupCreaCollo";
|
||||
|
||||
const {store} = reef;
|
||||
|
||||
export class Pianificazione extends kendo.data.Model.define({
|
||||
id: "row_number",
|
||||
fields: {
|
||||
row_number: {type: "number"},
|
||||
gestione: {type: "string"},
|
||||
data_ord: {type: "date"},
|
||||
num_ord: {type: "number"},
|
||||
cod_anag: {type: "string"},
|
||||
rag_soc: {type: "string"},
|
||||
cod_mdep: {type: "string"},
|
||||
cod_fisc: {type: "string"},
|
||||
part_iva: {type: "string"},
|
||||
produttore: {type: "string"},
|
||||
cod_prod: {type: "string"},
|
||||
articolo: {type: "string"},
|
||||
partita_mag: {type: "string"},
|
||||
data_ins_ord: {type: "date"},
|
||||
n_camion: {type: "number"},
|
||||
n_camion_ord: {type: "number"},
|
||||
tot_colli_ord: {type: "number"},
|
||||
tot_colli: {type: "number"},
|
||||
tot_kg_ord: {type: "number"},
|
||||
tot_kg: {type: "number"}
|
||||
}
|
||||
}) {
|
||||
gestione: string
|
||||
data_ord: Date
|
||||
num_ord: number
|
||||
cod_anag: string
|
||||
rag_soc: string
|
||||
cod_mdep: string
|
||||
cod_fisc: string
|
||||
part_iva: string
|
||||
produttore: string
|
||||
cod_prod: string
|
||||
articolo: string
|
||||
partita_mag: string
|
||||
data_ins_ord: Date
|
||||
n_camion: number
|
||||
n_camion_ord: number
|
||||
tot_colli_ord: number
|
||||
tot_colli: number
|
||||
tot_kg_ord: number
|
||||
tot_kg: number
|
||||
}
|
||||
|
||||
export class Collo extends kendo.data.Model.define({
|
||||
gestione: {type: "string"},
|
||||
data_collo: {type: "date"},
|
||||
ser_collo: {type: "string"},
|
||||
num_collo: {type: "number"},
|
||||
data_ins: {type: "date"},
|
||||
cod_anag: {type: "string"},
|
||||
cod_dtip: {type: "string"},
|
||||
data_doc: {type: "date"},
|
||||
ser_doc: {type: "string"},
|
||||
num_doc: {type: "number"},
|
||||
num_cnf: {type: "number"},
|
||||
qta_col: {type: "number"},
|
||||
qta_cnf: {type: "number"},
|
||||
}) {
|
||||
gestione: string
|
||||
data_collo: Date
|
||||
ser_collo: string
|
||||
num_collo: number
|
||||
data_ins: Date
|
||||
cod_anag: string
|
||||
cod_dtip: string
|
||||
data_doc: Date
|
||||
ser_doc: string
|
||||
num_doc: number
|
||||
num_cnf: number
|
||||
qta_col: number
|
||||
qta_cnf: number
|
||||
}
|
||||
|
||||
export default class PianAccRossg extends TabsViewModule {
|
||||
private readonly selectedDate: {
|
||||
value: Moment
|
||||
}
|
||||
private readonly columnsPianificazioni: Array<kendo.ui.GridColumn>
|
||||
private readonly dataSourcePianificazioni: kendo.data.DataSource
|
||||
private gridPianificazioni: kendo.ui.Grid
|
||||
|
||||
constructor(selector: string) {
|
||||
super(selector, [
|
||||
{
|
||||
id: "piani",
|
||||
title: "Trasporti del giorno",
|
||||
content:
|
||||
// language=HTML
|
||||
async () => `
|
||||
<div id="contextMenuTablePianificazioni"></div>
|
||||
<div id="tablePianificazioni" style="border-top: 0"></div>
|
||||
`
|
||||
},
|
||||
{
|
||||
id: "consegne",
|
||||
title: "Lista consegne",
|
||||
content: async () => "tab2"
|
||||
},
|
||||
{
|
||||
id: "scarico",
|
||||
title: "Scarico prodotto",
|
||||
content: async () => "tab3"
|
||||
}
|
||||
]);
|
||||
|
||||
this.selectedDate = store({
|
||||
value: moment().startOf("day")
|
||||
}, "date");
|
||||
|
||||
this.columnsPianificazioni = _kendo.setDefaultCellOptions([
|
||||
{
|
||||
id: "5ff974ed-7da5-4259-9666-6769435c008a",
|
||||
field: "produttore",
|
||||
title: "Produttore",
|
||||
type: "string",
|
||||
width: "30%",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "fd00cece-7918-4d24-aa5d-747cdd37963f",
|
||||
field: "articolo",
|
||||
title: "Prodotto",
|
||||
type: "string",
|
||||
width: "30%",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "cb0281af-07ff-4183-bf79-f1848ccd376b",
|
||||
title: "N.ro Camion",
|
||||
template: (data: Pianificazione) => `${numberStyle(data.n_camion)}/${numberStyle(data.n_camion_ord)}`
|
||||
},
|
||||
{
|
||||
id: "dedbc5e8-fa29-4dbf-b116-ee13e0a8e3c3",
|
||||
title: "Tot. Colli",
|
||||
template: (data: Pianificazione) => `${numberStyle(data.tot_colli)}/${numberStyle(data.tot_colli_ord)}`
|
||||
},
|
||||
{
|
||||
id: "c9349bb1-d1f6-44d2-bb3e-9422d9a55299",
|
||||
title: "Tot. Kg",
|
||||
template: (data: Pianificazione) => `${numberStyle(data.tot_kg)}/${numberStyle(data.tot_kg_ord)}`
|
||||
},
|
||||
{
|
||||
id: "1b5e876f-581c-468a-ac9e-ae240d6975c9",
|
||||
title: " ",
|
||||
command: [
|
||||
{
|
||||
text: "Modifica",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Modifica"
|
||||
class="k-button-solid-tertiary k-grid-Modifica k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-edit k-button-icon"></span>
|
||||
</button>`,
|
||||
click: () => {
|
||||
new Toast().warning("TODO");
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Nuovo",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Nuovo"
|
||||
class="k-button-solid-success k-grid-Nuovo k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-truck k-button-icon"></span>
|
||||
</button>`,
|
||||
click: async (e: Event) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
|
||||
const data = this.gridPianificazioni.dataItem($btn.parents("tr")) as Pianificazione;
|
||||
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
if (await new PopupCreaCollo(data, this.module).open()) {
|
||||
this.dataSourcePianificazioni.read();
|
||||
}
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Cancella",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Cancella"
|
||||
class="k-button-solid-error k-grid-Cancella k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-trash k-button-icon"></span>
|
||||
</button>`,
|
||||
click: async (e: Event) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
|
||||
const data = this.gridPianificazioni.dataItem($btn.parents("tr")) as Pianificazione;
|
||||
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
if (await this.eliminaPianificazione(data)) {
|
||||
this.dataSourcePianificazioni.read();
|
||||
}
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
this.dataSourcePianificazioni = new kendo.data.DataSource({
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
_kendo.checkFilterValuesColumns(
|
||||
options.data.filter,
|
||||
this.columnsPianificazioni
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await this.getPianificazioni({
|
||||
data: this.selectedDate.value.unix(),
|
||||
...options.data,
|
||||
filter: {
|
||||
filters: [
|
||||
...options.data.filter?.filters || []
|
||||
],
|
||||
logic: "and"
|
||||
}
|
||||
});
|
||||
|
||||
options.success(data);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
options.success([]);
|
||||
}
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "data",
|
||||
total: "total",
|
||||
model: Pianificazione
|
||||
},
|
||||
sort: {
|
||||
field: "data_ins_ord",
|
||||
dir: "desc"
|
||||
},
|
||||
serverPaging: false,
|
||||
serverFiltering: false,
|
||||
serverSorting: false
|
||||
});
|
||||
}
|
||||
|
||||
name(): string {
|
||||
return "pian_acc_rossg";
|
||||
}
|
||||
|
||||
async onLoad(): Promise<void> {
|
||||
await super.onLoad();
|
||||
|
||||
this.gridPianificazioni = await _kendo.savableTable(this.$container.find("#tablePianificazioni"), "PIANIFICAZIONE", {
|
||||
columns: this.columnsPianificazioni,
|
||||
dataSource: this.dataSourcePianificazioni,
|
||||
filterable: {
|
||||
mode: "menu"
|
||||
},
|
||||
pageable: false,
|
||||
mobile: true,
|
||||
toolbar: [
|
||||
{
|
||||
// language=HTML
|
||||
template: `
|
||||
<input id="dataSelector" style="pointer-events: all"/>
|
||||
|
||||
<button type="button"
|
||||
class="k-grid-save-changes k-button k-button-md k-rounded-md k-button-solid k-button-solid-success ml-14 creaOrdineRacc">
|
||||
<span class="k-icon k-i-add k-button-icon"></span>
|
||||
<span class="k-button-text">Crea Ordine di Racc.</span>
|
||||
</button>
|
||||
`
|
||||
}
|
||||
],
|
||||
dataBound: () => {
|
||||
$(".k-icon.fa").removeClass("k-icon");
|
||||
},
|
||||
detailInit: (e: kendo.ui.GridDetailInitEvent) => {
|
||||
const columns = _kendo.setDefaultCellOptions([
|
||||
{
|
||||
id: "55cfcf8c-db81-4306-9517-6ee0b12d6bc8",
|
||||
field: "row_number",
|
||||
title: "Num.",
|
||||
type: "number"
|
||||
},
|
||||
{
|
||||
id: "f612c43c-4663-45f9-b759-fa3ac83c93b2",
|
||||
field: "num_cnf",
|
||||
title: "Colli",
|
||||
type: "number",
|
||||
template: (data: Collo) => numberStyle(data.num_cnf)
|
||||
},
|
||||
{
|
||||
id: "893130fa-47ba-463a-bdc8-7aec6374ac9a",
|
||||
field: "qta_col",
|
||||
title: "Kg",
|
||||
type: "number",
|
||||
template: (data: Collo) => numberStyle(data.qta_col)
|
||||
},
|
||||
{
|
||||
id: "7ebc5aeb-4398-4a88-b1e1-548d089c5b15",
|
||||
title: "DDT",
|
||||
type: "string",
|
||||
template: (data: Collo) => data.num_doc && `DDT n. ${data.num_doc} del ${moment(data.data_doc).format("DD/MM/YYYY")}` || "-"
|
||||
},
|
||||
{
|
||||
id: "1b5e876f-581c-468a-ac9e-ae240d6975c9",
|
||||
title: " ",
|
||||
command: [
|
||||
{
|
||||
text: "ModificaCollo",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Modifica"
|
||||
class="k-button-solid-tertiary k-grid-ModificaCollo k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-edit k-button-icon"></span>
|
||||
</button>`,
|
||||
click: () => {
|
||||
new Toast().warning("TODO");
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "StampaCollo",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Stampa"
|
||||
class="k-button-solid-success k-grid-StampaCollo k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-print k-button-icon"></span>
|
||||
</button>`,
|
||||
click: async (e: Event) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
|
||||
const {
|
||||
gestione,
|
||||
data_collo,
|
||||
num_collo,
|
||||
ser_collo
|
||||
} = $btn.parents("#tableColli").data("kendoGrid").dataItem($btn.parents("tr")) as Collo;
|
||||
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
await new Ajax()
|
||||
.post("stampaCollo")
|
||||
.data({
|
||||
gestione,
|
||||
data_collo,
|
||||
num_collo,
|
||||
ser_collo
|
||||
})
|
||||
.noticeAsModal()
|
||||
.waitModal(`Stampa Collo...`)
|
||||
.onSuccess({
|
||||
modalBox: {IFrame: true}
|
||||
})
|
||||
.execute();
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "CancellaCollo",
|
||||
// language=HTML
|
||||
template: `
|
||||
<button title="Cancella"
|
||||
class="k-button-solid-error k-grid-CancellaCollo k-button k-button-lg k-rounded-md k-button-solid k-button-solid-base">
|
||||
<span class="fa fa-trash k-button-icon"></span>
|
||||
</button>`,
|
||||
click: async (e: Event) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
|
||||
const data = $btn.parents("#tableColli").data("kendoGrid").dataItem($btn.parents("tr")) as Collo;
|
||||
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
if (await this.eliminaCollo(data)) {
|
||||
this.dataSourcePianificazioni.read();
|
||||
}
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
const pianificazione = e.data as Pianificazione;
|
||||
|
||||
const detailGrid = $("<div id='tableColli'/>").appendTo(e.detailCell).kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
_kendo.checkFilterValuesColumns(
|
||||
options.data.filter,
|
||||
columns
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await this.getColli({
|
||||
gestione: pianificazione.gestione,
|
||||
dataOrd: moment(pianificazione.data_ord).unix(),
|
||||
numOrd: pianificazione.num_ord,
|
||||
...options.data
|
||||
});
|
||||
|
||||
options.success(data);
|
||||
} catch (e) {
|
||||
options.error(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "data",
|
||||
total: "total",
|
||||
model: Collo
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
field: "row_number",
|
||||
dir: "asc"
|
||||
}
|
||||
],
|
||||
serverPaging: false,
|
||||
serverFiltering: false,
|
||||
serverSorting: false
|
||||
},
|
||||
scrollable: false,
|
||||
sortable: true,
|
||||
filterable: false,
|
||||
pageable: false,
|
||||
columns
|
||||
});
|
||||
|
||||
detailGrid.css("max-width", "60%");
|
||||
},
|
||||
}, false);
|
||||
|
||||
const $dataSelector = this.$container.find("#dataSelector");
|
||||
|
||||
const onDateChange = () => {
|
||||
$dataSelector.data("datepicker").selectDate(this.selectedDate.value.toDate());
|
||||
}
|
||||
|
||||
$dataSelector
|
||||
.kendoTextBox({
|
||||
label: {
|
||||
content: "Data"
|
||||
},
|
||||
readonly: true
|
||||
})
|
||||
.datepicker({
|
||||
dateFormat: "dd/mm/yyyy",
|
||||
autoClose: true,
|
||||
onSelect: async (formattedDate, date) => {
|
||||
if (date) {
|
||||
document.removeEventListener("reef:store-date", onDateChange);
|
||||
this.selectedDate.value = moment(date);
|
||||
document.addEventListener("reef:store-date", onDateChange);
|
||||
|
||||
if (this.selectedDate.value) {
|
||||
await this.dataSourcePianificazioni.read();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.data("datepicker")
|
||||
.selectDate(this.selectedDate.value.toDate());
|
||||
|
||||
document.addEventListener("reef:store-date", onDateChange);
|
||||
|
||||
this.$container.find(".creaOrdineRacc").on("click", async (e) => {
|
||||
const $btn = $(e.currentTarget);
|
||||
|
||||
$btn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
if (await new PopupCreaOrdineRacc(this.selectedDate.value, this.module).open()) {
|
||||
this.dataSourcePianificazioni.read();
|
||||
}
|
||||
} finally {
|
||||
$btn.btn_setWaitStatus(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async getPianificazioni(data: object) {
|
||||
const ret = await this.ajax()
|
||||
.get("getPianificazioni")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnData as {
|
||||
data: Array<Pianificazione>
|
||||
total: number
|
||||
};
|
||||
}
|
||||
|
||||
async eliminaPianificazione(pianificazione: Pianificazione) {
|
||||
const ret = await this.ajax()
|
||||
.post("eliminaPianificazione")
|
||||
.data({
|
||||
gestione: pianificazione.gestione,
|
||||
dataOrd: moment(pianificazione.data_ord),
|
||||
numOrd: pianificazione.num_ord
|
||||
})
|
||||
.confirmModal({
|
||||
style: "danger",
|
||||
title: "Conferma Eliminazione",
|
||||
// language=HTML
|
||||
message: `
|
||||
<div class="text-center">
|
||||
<i class="fas fa-5x fa-exclamation-triangle text-danger"></i><br>
|
||||
<h4 class="mt-10">
|
||||
Confermi di voler eliminare la pianificazione?
|
||||
</h4>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
.waitModal("Cancellazione Pianificazione...")
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
|
||||
async getColli(data: object) {
|
||||
const ret = await this.ajax()
|
||||
.get("getColli")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnData as {
|
||||
data: Array<Collo>
|
||||
total: number
|
||||
};
|
||||
}
|
||||
|
||||
async eliminaCollo(collo: Collo) {
|
||||
const ret = await this.ajax()
|
||||
.post("eliminaCollo")
|
||||
.data({
|
||||
codAnag: collo.cod_anag,
|
||||
codDtip: collo.cod_dtip,
|
||||
dataDoc: collo.data_doc,
|
||||
serDoc: collo.ser_doc,
|
||||
numDoc: collo.num_doc,
|
||||
gestione: collo.gestione,
|
||||
dataCollo: moment(collo.data_collo),
|
||||
serCollo: collo.ser_collo,
|
||||
numCollo: collo.num_collo
|
||||
})
|
||||
.confirmModal({
|
||||
style: "danger",
|
||||
title: "Conferma Eliminazione",
|
||||
// language=HTML
|
||||
message: `
|
||||
<div class="text-center">
|
||||
<i class="fas fa-5x fa-exclamation-triangle text-danger"></i><br>
|
||||
<h4 class="mt-10">
|
||||
Confermi di voler eliminare il collo?
|
||||
</h4>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
.waitModal("Cancellazione Collo...")
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
}
|
||||
451
public_html/gest-lib/pian_acc_rossg/ts/PopupCreaCollo.ts
Normal file
451
public_html/gest-lib/pian_acc_rossg/ts/PopupCreaCollo.ts
Normal file
@@ -0,0 +1,451 @@
|
||||
import BasePopup from "@js/BasePopup";
|
||||
import Moment = moment.Moment;
|
||||
import {Pianificazione} from "@gest-lib/pian_acc_rossg/ts/PianAccRossg";
|
||||
import {getDefaultAzienda} from "@js/api/system";
|
||||
import Azienda = PVM.Azienda;
|
||||
import {getListVettori} from "@js/api/stdutils";
|
||||
|
||||
export class CreaColloForm extends kendo.data.Model.define({}) {
|
||||
gestione: string
|
||||
dataOrd: Moment
|
||||
numOrd: number
|
||||
numCollo: number
|
||||
dataCollo: Moment
|
||||
codMart: string
|
||||
partitaMag: string
|
||||
prodotto: string
|
||||
codAnag: string
|
||||
ragSoc: string
|
||||
codMdep: string
|
||||
codFisc: string
|
||||
partIva: string
|
||||
azienda: Azienda
|
||||
numDoc: number
|
||||
dataDoc: Moment
|
||||
targa: string
|
||||
codVvet: string
|
||||
dataIns: Moment
|
||||
pesoNettoKg: number
|
||||
cassoniScaricati: number
|
||||
|
||||
getDataCollo() {
|
||||
return this.dataCollo.format("DD/MM/YYYY");
|
||||
}
|
||||
|
||||
getDataDoc() {
|
||||
return this.dataDoc.format("DD/MM/YYYY");
|
||||
}
|
||||
|
||||
getDataIns() {
|
||||
return this.dataIns.format("DD/MM/YYYY HH:mm");
|
||||
}
|
||||
}
|
||||
|
||||
export default class PopupCreaCollo extends BasePopup {
|
||||
private readonly pianificazione: Pianificazione
|
||||
private azienda: PVM.Azienda
|
||||
private kendoForm: JQuery<HTMLElement>
|
||||
private promise: Promise<boolean>
|
||||
|
||||
constructor(pianificazione: Pianificazione, module: Module | null) {
|
||||
super("pian_acc_rossg", module);
|
||||
|
||||
this.pianificazione = pianificazione;
|
||||
|
||||
this.modalBox
|
||||
.title("Nuovo Collo (BOZZA)")
|
||||
.style("success")
|
||||
.gridSize({xs: 12, sm: 8})
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Crea",
|
||||
onClick: async () => {
|
||||
this.kendoForm.find("#submit").trigger("click");
|
||||
|
||||
return await this.promise;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
content(): string {
|
||||
// language=HTML
|
||||
return `
|
||||
<div class="panel panel-default mb-0">
|
||||
<div class="panel-body">
|
||||
<form id="creaCollo"></form>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
onBeforeShow(): void {
|
||||
this.$okBtn.disabled();
|
||||
}
|
||||
|
||||
onShow($div: JQuery<HTMLElement>): void {
|
||||
this.kendoForm = $div.find("#creaCollo").kendoForm({
|
||||
formData: {
|
||||
gestione: this.pianificazione.gestione,
|
||||
dataOrd: moment(this.pianificazione.data_ord),
|
||||
numOrd: this.pianificazione.num_ord,
|
||||
dataCollo: moment(this.pianificazione.data_ord),
|
||||
codMart: this.pianificazione.cod_prod,
|
||||
partitaMag: this.pianificazione.partita_mag,
|
||||
prodotto: this.pianificazione.articolo,
|
||||
codAnag: this.pianificazione.cod_anag,
|
||||
ragSoc: this.pianificazione.rag_soc,
|
||||
codMdep: this.pianificazione.cod_mdep,
|
||||
codFisc: this.pianificazione.cod_fisc,
|
||||
partIva: this.pianificazione.part_iva,
|
||||
azienda: this.azienda,
|
||||
dataDoc: moment(this.pianificazione.data_ord),
|
||||
dataIns: moment(),
|
||||
|
||||
getDataCollo() {
|
||||
return this.dataCollo.format("DD/MM/YYYY");
|
||||
},
|
||||
|
||||
getDataDoc() {
|
||||
return this.dataDoc.format("DD/MM/YYYY");
|
||||
},
|
||||
|
||||
getDataIns() {
|
||||
return this.dataIns.format("DD/MM/YYYY HH:mm");
|
||||
}
|
||||
} as CreaColloForm,
|
||||
validatable: {
|
||||
validateOnBlur: false
|
||||
},
|
||||
buttonsTemplate: `<button class="hidden" id="submit">Submit</button>`,
|
||||
change: (e) => {
|
||||
this.$okBtn.disabled(!e.sender.validator.validate());
|
||||
},
|
||||
submit: async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
this.$okBtn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
console.log(e.model);
|
||||
|
||||
this.promise = this.creaCollo(e.model as CreaColloForm);
|
||||
|
||||
if (await this.promise) {
|
||||
this.modalBox.close();
|
||||
}
|
||||
} finally {
|
||||
this.$okBtn.btn_setWaitStatus(false);
|
||||
}
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 2, gutter: 50},
|
||||
items: [
|
||||
{
|
||||
field: "numCollo",
|
||||
label: "Certificato di consegna N.",
|
||||
title: "Certificato di consegna N.",
|
||||
},
|
||||
{
|
||||
field: "getDataCollo",
|
||||
label: "del",
|
||||
editor: (container, options) => {
|
||||
$(`<input name="${options.field}" data-bind="value: ${options.field}" title="Data Collo" style="pointer-events: all"/>`)
|
||||
.appendTo(container)
|
||||
.kendoTextBox({
|
||||
readonly: true
|
||||
})
|
||||
.datepicker({
|
||||
dateFormat: "dd/mm/yyyy",
|
||||
autoClose: true,
|
||||
inModal: true,
|
||||
onSelect: async (formattedDate, date) => {
|
||||
const model = options.model as CreaColloForm;
|
||||
|
||||
model.set("dataCollo", moment(date));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Estremi del contratto e dei contraenti",
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 2, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "prodotto",
|
||||
label: "Prodotto",
|
||||
title: "Prodotto",
|
||||
colSpan: 2,
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Produttore conferente",
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 2, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "ragSoc",
|
||||
label: "Cognome e nome o Rag. Sociale",
|
||||
title: "Cognome e nome o Rag. Sociale",
|
||||
colSpan: 2,
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "codFisc",
|
||||
label: "Codice fiscale",
|
||||
title: "Codice fiscale",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "partIva",
|
||||
label: "P. IVA",
|
||||
title: "Partita IVA",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Industria Destinataria",
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 4, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "azienda.nomeDitta",
|
||||
label: "Rag. Sociale",
|
||||
title: "Ragione Sociale",
|
||||
colSpan: 2,
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "azienda.partIva",
|
||||
label: "P. IVA",
|
||||
title: "Partita IVA",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "azienda.codFiscale",
|
||||
label: "Codice Fiscale",
|
||||
title: "Codice Fiscale",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "azienda.indirizzo",
|
||||
label: "Sede stabilimento",
|
||||
title: "Sede stabilimento",
|
||||
colSpan: 2,
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "azienda.citta",
|
||||
label: "Comune",
|
||||
title: "Comune",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "azienda.cap",
|
||||
label: "CAP",
|
||||
title: "CAP",
|
||||
editorOptions: {
|
||||
readonly: true
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Estremi del documento di trasporto",
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 2, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "numDoc",
|
||||
label: "Ddt n.",
|
||||
title: "Ddt n.",
|
||||
validation: {
|
||||
required: {
|
||||
message: "Ddt n. è richiesto"
|
||||
},
|
||||
min: 1
|
||||
},
|
||||
editor: "NumericTextBox",
|
||||
editorOptions: {
|
||||
selectOnFocus: true,
|
||||
decimals: 0,
|
||||
format: "n0",
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "getDataDoc",
|
||||
label: "del",
|
||||
editor: (container, options) => {
|
||||
$(`<input name="${options.field}" data-bind="value: ${options.field}" title="Data Documento" style="pointer-events: all"/>`)
|
||||
.appendTo(container)
|
||||
.kendoTextBox({
|
||||
readonly: true
|
||||
})
|
||||
.datepicker({
|
||||
dateFormat: "dd/mm/yyyy",
|
||||
autoClose: true,
|
||||
inModal: true,
|
||||
onSelect: async (formattedDate, date) => {
|
||||
const model = options.model as CreaColloForm;
|
||||
|
||||
model.set("dataDoc", moment(date));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "targa",
|
||||
label: "Targa automezzo",
|
||||
title: "Targa automezzo",
|
||||
},
|
||||
{
|
||||
field: "codVvet",
|
||||
label: "Vettore",
|
||||
title: "Vettore",
|
||||
editor: "DropDownList",
|
||||
editorOptions: {
|
||||
filter: "contains",
|
||||
dataTextField: "rag_soc",
|
||||
dataValueField: "cod_vvet",
|
||||
optionLabel: "Seleziona il vettore",
|
||||
valuePrimitive: true,
|
||||
dataBound: (e) => {
|
||||
e.sender.list.find(".k-list-optionlabel").hide();
|
||||
},
|
||||
dataSource: {
|
||||
sort: {
|
||||
field: "rag_soc",
|
||||
dir: "asc"
|
||||
},
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
try {
|
||||
const ret = await getListVettori();
|
||||
|
||||
options.success(ret);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
options.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Verifica di scarico",
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 3, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "getDataIns",
|
||||
label: "Data e Ora",
|
||||
editor: (container, options) => {
|
||||
$(`<input name="${options.field}" data-bind="value: ${options.field}" title="Data e Ora" style="pointer-events: all"/>`)
|
||||
.appendTo(container)
|
||||
.kendoTextBox({
|
||||
readonly: true
|
||||
})
|
||||
.datepicker({
|
||||
dateFormat: "dd/mm/yy",
|
||||
autoClose: true,
|
||||
inModal: true,
|
||||
timepicker: true,
|
||||
position: "top left",
|
||||
onSelect: async (formattedDate, date) => {
|
||||
const model = options.model as CreaColloForm;
|
||||
|
||||
model.set("dataIns", moment(date));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "pesoNettoKg",
|
||||
label: "Peso Netto Kg.",
|
||||
title: "Peso Netto Kg.",
|
||||
validation: {
|
||||
required: {
|
||||
message: "Peso Netto Kg. è richiesto"
|
||||
},
|
||||
min: 1
|
||||
},
|
||||
editor: "NumericTextBox",
|
||||
editorOptions: {
|
||||
selectOnFocus: true,
|
||||
decimals: 0,
|
||||
format: "n0"
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "cassoniScaricati",
|
||||
label: "Cassoni Scaricati",
|
||||
title: "Cassoni Scaricati",
|
||||
validation: {
|
||||
min: 1
|
||||
},
|
||||
editor: "NumericTextBox",
|
||||
editorOptions: {
|
||||
selectOnFocus: true,
|
||||
decimals: 0,
|
||||
format: "n0",
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
$(".k-form-legend").filter(function () {
|
||||
return $(this).text() == "";
|
||||
}).remove();
|
||||
}
|
||||
|
||||
async open(): Promise<any> {
|
||||
this.azienda = await getDefaultAzienda();
|
||||
|
||||
return await this.modalBox.show();
|
||||
}
|
||||
|
||||
async creaCollo(data: CreaColloForm) {
|
||||
const ret = await this.ajax()
|
||||
.get("creaCollo")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
}
|
||||
386
public_html/gest-lib/pian_acc_rossg/ts/PopupCreaOrdineRacc.ts
Normal file
386
public_html/gest-lib/pian_acc_rossg/ts/PopupCreaOrdineRacc.ts
Normal file
@@ -0,0 +1,386 @@
|
||||
import BasePopup from "@js/BasePopup";
|
||||
import {numberStyle} from "@js/utils";
|
||||
import Moment = moment.Moment;
|
||||
|
||||
export class OrdineAcq extends kendo.data.Model.define({
|
||||
id: "row_number",
|
||||
fields: {
|
||||
row_number: {type: "number"},
|
||||
cod_anag: {type: "string"},
|
||||
rag_soc: {type: "string"},
|
||||
fornitore: {type: "string"},
|
||||
cod_vdes: {type: "string"},
|
||||
destinatario: {type: "string"},
|
||||
cod_mdep: {type: "string"},
|
||||
cod_mart: {type: "string"},
|
||||
descrizione: {type: "string"},
|
||||
articolo: {type: "string"},
|
||||
partita_mag: {type: "string"},
|
||||
qta_ord: {type: "number"},
|
||||
unt_ord: {type: "string"},
|
||||
}
|
||||
}) {
|
||||
cod_anag: string
|
||||
rag_soc: string
|
||||
fornitore: string
|
||||
cod_vdes: string
|
||||
destinatario: string
|
||||
cod_mdep: string
|
||||
cod_mart: string
|
||||
descrizione: string
|
||||
articolo: string
|
||||
partita_mag: string
|
||||
qta_ord: number
|
||||
unt_ord: string
|
||||
}
|
||||
|
||||
export class CreaOrdineProdForm extends kendo.data.Model.define({}) {
|
||||
codMart: string;
|
||||
dataOrd: Moment;
|
||||
nBins: number;
|
||||
nCamion: number;
|
||||
ordAcq: OrdineAcq;
|
||||
qtaCnf: number;
|
||||
qtaPrev: number;
|
||||
untMis: string;
|
||||
|
||||
getQtaCnf() {
|
||||
return numberStyle(this.get("qtaCnf"));
|
||||
}
|
||||
|
||||
getQtaPrev() {
|
||||
return numberStyle(this.get("qtaPrev"), undefined, "", this.get("untMis"));
|
||||
}
|
||||
}
|
||||
|
||||
export default class PopupCreaOrdineRacc extends BasePopup {
|
||||
private readonly dataOrd: Moment
|
||||
private kendoForm: JQuery<HTMLElement>
|
||||
private promise: Promise<boolean>
|
||||
|
||||
constructor(dataOrd: Moment | null = null, module: Module | null = null) {
|
||||
super("pian_acc_rossg", module);
|
||||
|
||||
this.dataOrd = dataOrd;
|
||||
|
||||
this.modalBox
|
||||
.title("Crea Ordine di Racc.")
|
||||
.style("success")
|
||||
.gridSize({xs: 12, sm: 8})
|
||||
.okCancel()
|
||||
.btOK({
|
||||
text: "Crea",
|
||||
onClick: async () => {
|
||||
this.kendoForm.find("#submit").trigger("click");
|
||||
|
||||
if (this.promise) {
|
||||
return await this.promise;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
content(): string {
|
||||
// language=HTML
|
||||
return `
|
||||
<div class="panel panel-default mb-0">
|
||||
<div class="panel-body">
|
||||
<form id="creaOrdineRacc"></form>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
onBeforeShow(): void {
|
||||
this.$okBtn.disabled();
|
||||
}
|
||||
|
||||
onShow($div: JQuery<HTMLElement>): void {
|
||||
this.kendoForm = $div.find("#creaOrdineRacc").kendoForm({
|
||||
formData: {
|
||||
dataOrd: this.dataOrd,
|
||||
ordAcq: null,
|
||||
codMart: null,
|
||||
nBins: 0,
|
||||
nCamion: 0,
|
||||
qtaCnf: 0,
|
||||
untMis: null,
|
||||
qtaPrev: 0,
|
||||
|
||||
getQtaCnf() {
|
||||
return numberStyle(this.get("qtaCnf"));
|
||||
},
|
||||
|
||||
getQtaPrev() {
|
||||
return numberStyle(this.get("qtaPrev"), undefined, "", this.get("untMis"));
|
||||
}
|
||||
} as CreaOrdineProdForm,
|
||||
validatable: {
|
||||
validateOnBlur: false
|
||||
},
|
||||
buttonsTemplate: `<button class="hidden" id="submit">Submit</button>`,
|
||||
change: (e) => {
|
||||
this.$okBtn.disabled(!e.sender.validator.validate());
|
||||
|
||||
const model = e.sender.editable.options.model as CreaOrdineProdForm;
|
||||
|
||||
model.set("qtaPrev", model.nCamion * model.nBins * model.qtaCnf);
|
||||
},
|
||||
submit: async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
this.$okBtn.btn_setWaitStatus();
|
||||
|
||||
try {
|
||||
// TODO Gestire modifica pianificazione
|
||||
this.promise = this.creaPianificazione(e.model as CreaOrdineProdForm);
|
||||
|
||||
if (await this.promise) {
|
||||
this.modalBox.close();
|
||||
}
|
||||
} finally {
|
||||
this.$okBtn.btn_setWaitStatus(false);
|
||||
}
|
||||
},
|
||||
items: [
|
||||
{
|
||||
field: "ordAcq",
|
||||
label: "Lotti di prod.",
|
||||
validation: {
|
||||
required: true
|
||||
},
|
||||
editor: (container, options) => {
|
||||
const columns = _kendo.setDefaultCellOptions([
|
||||
{
|
||||
field: "partita_mag",
|
||||
title: "Lotto",
|
||||
type: "string",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "fornitore",
|
||||
title: "Fornitore",
|
||||
type: "string",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "destinatario",
|
||||
title: "Località",
|
||||
type: "string",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "articolo",
|
||||
title: "Prodotto",
|
||||
type: "string",
|
||||
filterable: {
|
||||
extra: false,
|
||||
operators: {
|
||||
string: {
|
||||
contains: "Contiene",
|
||||
doesnotcontain: "Non contiene"
|
||||
}
|
||||
}
|
||||
},
|
||||
template: (data: OrdineAcq) => data.descrizione
|
||||
},
|
||||
{
|
||||
field: "qta_ord",
|
||||
title: "Qtà prevista",
|
||||
type: "number",
|
||||
template: (data: OrdineAcq) => numberStyle(data.qta_ord, undefined, "", data.unt_ord)
|
||||
},
|
||||
]);
|
||||
|
||||
$("<div/>").appendTo(container).kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: async (options) => {
|
||||
_kendo.checkFilterValuesColumns(
|
||||
options.data.filter,
|
||||
columns
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await this.getOrdiniAcq({
|
||||
...options.data
|
||||
});
|
||||
|
||||
options.success(data);
|
||||
} catch (e) {
|
||||
options.error(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
data: "data",
|
||||
total: "total",
|
||||
model: OrdineAcq
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
field: "cod_anag",
|
||||
dir: "asc"
|
||||
},
|
||||
{
|
||||
field: "cod_vdes",
|
||||
dir: "asc"
|
||||
}
|
||||
],
|
||||
serverPaging: false,
|
||||
serverFiltering: false,
|
||||
serverSorting: false
|
||||
},
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
pageable: false,
|
||||
selectable: "row",
|
||||
height: "20rem",
|
||||
columns,
|
||||
change: async (e) => {
|
||||
const $selectedRows = e.sender.select();
|
||||
|
||||
const items = $selectedRows
|
||||
.map((i, el) => e.sender.dataItem(el).toJSON() as OrdineAcq)
|
||||
.toArray();
|
||||
|
||||
options.model.set("ordAcq", items[0]);
|
||||
|
||||
const arts = await this.getArtsProdByCodMart(items[0].cod_mart);
|
||||
|
||||
if (arts?.length > 0) {
|
||||
if (arts.length === 1) {
|
||||
options.model.set("codMart", arts[0].codMart);
|
||||
options.model.set("nBins", arts[0].colliPedana);
|
||||
options.model.set("qtaCnf", arts[0].qtaCnf);
|
||||
options.model.set("untMis", arts[0].untMis);
|
||||
} else {
|
||||
// TODO chiedere prodotto da usare all'utente
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "group",
|
||||
layout: "grid",
|
||||
grid: {cols: 4, gutter: 10},
|
||||
items: [
|
||||
{
|
||||
field: "nCamion",
|
||||
label: "Num. Camion",
|
||||
title: "Num. Camion",
|
||||
validation: {
|
||||
required: {
|
||||
message: "Num. Camion è richiesto"
|
||||
},
|
||||
min: 1
|
||||
},
|
||||
editorOptions: {
|
||||
selectOnFocus: true,
|
||||
decimals: 0,
|
||||
format: "n0"
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "nBins",
|
||||
label: "Num. Colli x Camion",
|
||||
title: "Num. Colli x Camion",
|
||||
validation: {
|
||||
required: {
|
||||
message: "Num. Colli x Camion è richiesto"
|
||||
},
|
||||
min: 1
|
||||
},
|
||||
editorOptions: {
|
||||
selectOnFocus: true,
|
||||
decimals: 0,
|
||||
format: "n0"
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "getQtaCnf",
|
||||
label: "Peso Medio Collo",
|
||||
editor: (container, options) => {
|
||||
$(`<h3 data-bind="html: ${options.field}"/>`).appendTo(container);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "getQtaPrev",
|
||||
label: "Qtà prevista",
|
||||
editor: (container, options) => {
|
||||
$(`<h3 data-bind="html: ${options.field}"/>`).appendTo(container);
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async open(): Promise<any> {
|
||||
return await this.modalBox.show();
|
||||
}
|
||||
|
||||
async getOrdiniAcq(data: object) {
|
||||
const ret = await this.ajax()
|
||||
.get("getOrdiniAcq")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnData as {
|
||||
data: Array<OrdineAcq>
|
||||
total: number
|
||||
};
|
||||
}
|
||||
|
||||
async creaPianificazione(data: CreaOrdineProdForm) {
|
||||
const ret = await this.ajax()
|
||||
.get("creaPianificazione")
|
||||
.data(data)
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnId === 1;
|
||||
}
|
||||
|
||||
async getArtsProdByCodMart(codMart: string) {
|
||||
const ret = await this.ajax()
|
||||
.get("getArtsProdByCodMart")
|
||||
.data({codMart})
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnData as Array<{
|
||||
codMart: string
|
||||
descrizione: string
|
||||
qtaCnf: number
|
||||
colliPedana: number
|
||||
untMis: string
|
||||
}>;
|
||||
}
|
||||
}
|
||||
5
public_html/gest-lib/pian_acc_rossg/ts/main.ts
Normal file
5
public_html/gest-lib/pian_acc_rossg/ts/main.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import PianAccRossg from "@gest-lib/pian_acc_rossg/ts/PianAccRossg";
|
||||
|
||||
$(function () {
|
||||
new PianAccRossg("#app");
|
||||
});
|
||||
@@ -421,7 +421,7 @@ function PopupGenerateOrders() {
|
||||
row.colli_ord = row.kg_ord / row.qta_cnf;
|
||||
}
|
||||
|
||||
row.colli_ord = _.ceil(row.colli_ord || 0);
|
||||
row.colli_ord = _.round(row.colli_ord || 0);
|
||||
|
||||
// language=HTML
|
||||
const $input = $("<div>", {
|
||||
@@ -461,7 +461,7 @@ function PopupGenerateOrders() {
|
||||
row.pedane_ord = row.kg_ord / row.qta_cnf / row.colli_pedana;
|
||||
}
|
||||
|
||||
row.pedane_ord = _.ceil(row.pedane_ord || 0);
|
||||
row.pedane_ord = _.round(row.pedane_ord || 0);
|
||||
|
||||
const $input = $("<div>", {
|
||||
class: "input-group"
|
||||
@@ -1255,8 +1255,8 @@ function PopupGenerateOrders() {
|
||||
|
||||
$kgOrd.off("input").on("input", function () {
|
||||
data.kg_ord = $(this).getNumericValue();
|
||||
data.colli_ord = _.ceil(data.kg_ord / data.qta_cnf);
|
||||
data.pedane_ord = _.ceil(data.kg_ord / data.qta_cnf / data.colli_pedana);
|
||||
data.colli_ord = _.round(data.kg_ord / data.qta_cnf);
|
||||
data.pedane_ord = _.round(data.kg_ord / data.qta_cnf / data.colli_pedana);
|
||||
|
||||
$colliOrd.val(data.colli_ord);
|
||||
$pedaneOrd.val(data.pedane_ord);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/*# sourceMappingURL=main.css.map */
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
if (isset($_GET["popup-sample"])) {
|
||||
$data = Utility::sanitizeB64JSON_parse($_GET["popup-sample"]);
|
||||
include "popup-sample.php";
|
||||
|
||||
} else if (Controller::is_ajaxRequest()) {
|
||||
$Ret = new Ret;
|
||||
$Ret->set_errorCode(ErrorHandler::UNEXPECTED_AJAX_METHOD)->display();
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<?php
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
$Ret = new Ret;
|
||||
|
||||
if ($Ret->is_OK()) {
|
||||
ob_start();
|
||||
|
||||
$html = Utility\Str::remove_multiple_spaces(@ob_get_clean());
|
||||
$Ret->set_string($html);
|
||||
}
|
||||
|
||||
$Ret->display();
|
||||
@@ -1,15 +0,0 @@
|
||||
$(function () {
|
||||
_stdUtils.init();
|
||||
});
|
||||
|
||||
var _stdUtils = {
|
||||
module: null,
|
||||
|
||||
init: function () {
|
||||
var self = this;/*
|
||||
self.module = new Module();
|
||||
self.module.onLoad(function(){
|
||||
|
||||
}).load();*/
|
||||
}
|
||||
};
|
||||
@@ -126,18 +126,19 @@ Ajax.prototype._toggleDisable = function (disable) {
|
||||
/**
|
||||
*
|
||||
* @param {function | undefined} callback
|
||||
* @param {boolean} arrayEncode
|
||||
* @returns {Promise<PVM.IRet>}
|
||||
*/
|
||||
Ajax.prototype.execute = function (callback = undefined) {
|
||||
Ajax.prototype.execute = function (callback = undefined, arrayEncode = false) {
|
||||
var self = this;
|
||||
if (self._confirmModal !== false && !self._isConfirmed) {
|
||||
return self._requestConfirmation(callback);
|
||||
return self._requestConfirmation(callback, arrayEncode);
|
||||
|
||||
} else {
|
||||
var data = {};
|
||||
var request = null;
|
||||
// _data?
|
||||
data[self._action] = !is_null(self._data) ? _ojbc.B64JSON_stringify(self._data) : "";
|
||||
data[self._action] = !is_null(self._data) ? _ojbc.B64JSON_stringify(self._data, arrayEncode) : "";
|
||||
|
||||
if (!is_null(self._url)) {
|
||||
self._ajaxObjOptions.url = self._url;
|
||||
@@ -855,7 +856,7 @@ Ajax.prototype.confirmModal = function (options) { // message / {message title
|
||||
return this;
|
||||
};
|
||||
|
||||
Ajax.prototype._requestConfirmation = async function (callback) {
|
||||
Ajax.prototype._requestConfirmation = async function (callback, arrayEncode = true) {
|
||||
var self = this;
|
||||
var modalBoxConfirm = new ModalBox();
|
||||
if (!is_undefined(self._confirmModal.yesText)) {
|
||||
@@ -886,7 +887,7 @@ Ajax.prototype._requestConfirmation = async function (callback) {
|
||||
|
||||
self._isConfirmed = ret;
|
||||
if (ret) {
|
||||
return self.execute(callback);
|
||||
return self.execute(callback, arrayEncode);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,30 +1,48 @@
|
||||
export default abstract class BasePopup {
|
||||
readonly modalBox: ModalBox
|
||||
$okBtn: JQuery
|
||||
protected readonly module: Module
|
||||
protected readonly modalBox: ModalBox
|
||||
$okBtn: JQuery<HTMLElement>
|
||||
|
||||
protected constructor(name: string, module: Module | null = null) {
|
||||
if (module) {
|
||||
this.module = module;
|
||||
} else {
|
||||
this.module = new Module(name);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.modalBox = new ModalBox();
|
||||
|
||||
this.modalBox
|
||||
.onBeforeShow(($div) => this.onBeforeShow($div))
|
||||
.onShow(($div) => this.onShow($div))
|
||||
.content(this.content())
|
||||
.onBeforeShow(($div: JQuery<HTMLElement>) => {
|
||||
this.$okBtn = $div.find(".modal-btn-ok");
|
||||
|
||||
this.onBeforeShow($div);
|
||||
})
|
||||
.onShow(($div: JQuery<HTMLElement>) => this.onShow($div));
|
||||
|
||||
const original = this.open;
|
||||
this.open = async () => {
|
||||
await BasePopup.prototype.open.apply(this);
|
||||
return await original.apply(this);
|
||||
}
|
||||
}
|
||||
|
||||
ajax() {
|
||||
return new Ajax()
|
||||
.module(this.name())
|
||||
.module(this.module.name)
|
||||
.noticeAsModal();
|
||||
}
|
||||
|
||||
onBeforeShow($div) {
|
||||
this.$okBtn = $div.find(".modal-btn-ok");
|
||||
async open(): Promise<any> {
|
||||
if (!this.module.isLoaded()) {
|
||||
await this.module.load();
|
||||
}
|
||||
}
|
||||
|
||||
abstract name(): string;
|
||||
|
||||
abstract content(): string;
|
||||
|
||||
abstract onShow($div);
|
||||
abstract onBeforeShow($div: JQuery<HTMLElement>): void;
|
||||
|
||||
abstract open();
|
||||
abstract onShow($div: JQuery<HTMLElement>): void;
|
||||
}
|
||||
9
public_html/js/api/stdutils.ts
Normal file
9
public_html/js/api/stdutils.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export async function getListVettori() {
|
||||
const ret = await new Ajax()
|
||||
.module("api")
|
||||
.get("stdutils/getListVettori")
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return ret?.returnData;
|
||||
}
|
||||
9
public_html/js/api/system.ts
Normal file
9
public_html/js/api/system.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export async function getDefaultAzienda() {
|
||||
const ret = await new Ajax()
|
||||
.module("api")
|
||||
.get("system/defaultAzienda")
|
||||
.noticeAsModal()
|
||||
.execute();
|
||||
|
||||
return (ret?.returnData[0] as PVM.IServiceRestResponse).entity as PVM.Azienda;
|
||||
}
|
||||
@@ -108,6 +108,9 @@ moment.fn.ceil = function (precision, unit) {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
moment.fn.toJSON = function() { return this.format(); }
|
||||
|
||||
/*
|
||||
Number.prototype.timeDiff = function(time2){
|
||||
//var time1 = this.toString();
|
||||
|
||||
8
public_html/js/interfaces/kendo.all.d.ts
vendored
8
public_html/js/interfaces/kendo.all.d.ts
vendored
@@ -5654,6 +5654,8 @@ declare namespace kendo.ui {
|
||||
|
||||
element: JQuery;
|
||||
wrapper: JQuery;
|
||||
validator: Validator;
|
||||
editable: any;
|
||||
|
||||
static extend(proto: Object): Form;
|
||||
|
||||
@@ -5724,9 +5726,9 @@ declare namespace kendo.ui {
|
||||
}
|
||||
|
||||
interface FormValidatable {
|
||||
validateOnBlur: boolean;
|
||||
validationSummary: boolean;
|
||||
errorTemplate: string|Function;
|
||||
validateOnBlur?: boolean;
|
||||
validationSummary?: boolean;
|
||||
errorTemplate?: string|Function;
|
||||
}
|
||||
|
||||
interface FormEvent {
|
||||
|
||||
@@ -151,7 +151,7 @@ const _kendo = {
|
||||
* @param {kendo.ui.GridOptions} options
|
||||
* @returns {Promise<kendo.ui.Grid>}
|
||||
*/
|
||||
async savableTable($el, title, options) {
|
||||
async savableTable($el, title, options, autoBind = true) {
|
||||
let kendoOptions;
|
||||
|
||||
switch (options.savable?.location) {
|
||||
@@ -376,7 +376,9 @@ const _kendo = {
|
||||
});
|
||||
}
|
||||
|
||||
await kendoGrid.dataSource.read();
|
||||
if (autoBind) {
|
||||
await kendoGrid.dataSource.read();
|
||||
}
|
||||
|
||||
return kendoGrid;
|
||||
}
|
||||
|
||||
82
public_html/js/modules/TabsViewModule.ts
Normal file
82
public_html/js/modules/TabsViewModule.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import ViewModule from "@js/modules/ViewModule";
|
||||
|
||||
const {store} = reef;
|
||||
|
||||
export interface Tab {
|
||||
id: string
|
||||
title: string
|
||||
content: () => Promise<string>
|
||||
}
|
||||
|
||||
export default abstract class TabsViewModule extends ViewModule {
|
||||
readonly currentTab: typeof store
|
||||
readonly tabs: Array<Tab>
|
||||
|
||||
protected constructor(selector: string | null, tabs: Array<Tab>, currentTab: string | null = null) {
|
||||
if (tabs.length === 0) {
|
||||
throw new Error("Array tabs vuoto in creazione TabViewModule");
|
||||
}
|
||||
|
||||
super(selector);
|
||||
|
||||
this.currentTab = store(currentTab || tabs[0].id, "tab");
|
||||
this.tabs = store(tabs, "tabs");
|
||||
}
|
||||
|
||||
async onLoad(): Promise<void> {
|
||||
try {
|
||||
if (this.$container) {
|
||||
const onTabChange = () => {
|
||||
$(`[href=#${this.currentTab.value}]`).tab("show");
|
||||
};
|
||||
|
||||
const onTabsChange = async () => {
|
||||
this.$container.html(await this.content());
|
||||
|
||||
this.$container.find("[role=tab]")
|
||||
.on("shown.bs.tab", (e) => {
|
||||
document.removeEventListener("reef:store-tab", onTabChange);
|
||||
|
||||
this.currentTab.value = $(e.target).attr("aria-controls");
|
||||
|
||||
document.addEventListener("reef:store-tab", onTabChange);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("reef:store-tab", onTabChange);
|
||||
document.addEventListener("reef:store-tabs", onTabsChange);
|
||||
|
||||
await onTabsChange();
|
||||
}
|
||||
} finally {
|
||||
_APP.setSplashScreen();
|
||||
}
|
||||
}
|
||||
|
||||
async content(): Promise<string> {
|
||||
// language=HTML
|
||||
return `
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
${this.tabs.map(tab => `
|
||||
<li role="presentation" class="${tab.id === this.currentTab.value && "active" || ""}">
|
||||
<a href="#${tab.id}" aria-controls="${tab.id}" role="tab" data-toggle="tab">
|
||||
${ucfirst(tab.title, true)}
|
||||
</a>
|
||||
</li>
|
||||
`).join("")}
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
${(await Promise.all(this.tabs.map(async tab => `
|
||||
<div role="tabpanel" class="tab-pane ${tab.id === this.currentTab.value && "active" || ""}" id="${tab.id}">
|
||||
${await tab.content()}
|
||||
</div>
|
||||
`))).join("")}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import BaseModule from "@js/BaseModule";
|
||||
import BaseModule from "@js/modules/BaseModule";
|
||||
|
||||
export default abstract class ViewModule extends BaseModule {
|
||||
readonly $container: JQuery
|
||||
@@ -16,8 +16,8 @@ var _ojbc = {
|
||||
return null;
|
||||
},
|
||||
|
||||
B64JSON_stringify: function (input) { // OBJECT to JSON STRING to B64
|
||||
return btoa(JSON.stringify(this.array_encode($.extend(true, {}, input)))); // deep clone
|
||||
B64JSON_stringify: function (input, arrayEncode = true) { // OBJECT to JSON STRING to B64
|
||||
return btoa(JSON.stringify(arrayEncode ? this.array_encode($.extend(true, {}, input)) : input)); // deep clone
|
||||
},
|
||||
|
||||
array_encode: function (obj) { // CODIFICA ARRAY
|
||||
|
||||
41
public_html/js/types.d.ts
vendored
41
public_html/js/types.d.ts
vendored
@@ -11,6 +11,11 @@ declare namespace PVM {
|
||||
INSERT_OR_UPDATE
|
||||
}
|
||||
|
||||
interface EntityBase {
|
||||
type: string
|
||||
operation: OperationType
|
||||
}
|
||||
|
||||
interface IServiceRestResponse {
|
||||
esito: number
|
||||
execDate: string
|
||||
@@ -19,6 +24,7 @@ declare namespace PVM {
|
||||
errorCode: number
|
||||
errorMessage: string
|
||||
dto?: object
|
||||
entity?: EntityBase
|
||||
genericList?: unknown
|
||||
}
|
||||
|
||||
@@ -36,6 +42,39 @@ declare namespace PVM {
|
||||
S = "S",
|
||||
N = "N"
|
||||
}
|
||||
|
||||
interface Azienda extends EntityBase {
|
||||
applicationName: string
|
||||
nomeDitta: string
|
||||
indirizzo: string
|
||||
cap: string
|
||||
citta: string
|
||||
prov: string
|
||||
partIva: string
|
||||
numTel: string
|
||||
annoContab: number
|
||||
annoMagaz: number
|
||||
annoAttuale: number
|
||||
ultDataGio: Date
|
||||
ultNumGio: number
|
||||
liquidazioniIva: string
|
||||
lastUpgDb: Date
|
||||
logoFile: string
|
||||
ultDareAv: number
|
||||
ggUtili: number
|
||||
flagFattDiff: Flag
|
||||
lastUpgSp: string
|
||||
capitaleSoc: number
|
||||
prefissoEan: string
|
||||
codFiscale: string
|
||||
flagPersFisica: Flag
|
||||
flagSetIvaOmaggi: Flag
|
||||
lastUpgQc: string
|
||||
tipoAzienda: string
|
||||
nazione: string
|
||||
codDiviContab: string
|
||||
emailSdi: string
|
||||
}
|
||||
}
|
||||
|
||||
declare const reef: {
|
||||
@@ -60,4 +99,6 @@ interface JQuery {
|
||||
disabled(v?: boolean)
|
||||
|
||||
btn_setWaitStatus(active?: boolean)
|
||||
|
||||
datepicker(options: AirDatepickerOptions): JQuery;
|
||||
}
|
||||
@@ -1,2 +1,8 @@
|
||||
export const monospace = html => `<span class="text-monospace">${html}</span>`;
|
||||
export const nowrap = html => `<span class="text-nowrap">${html}</span>`;
|
||||
export const monospace = (html: string) => `<span class="text-monospace">${html}</span>`;
|
||||
export const nowrap = (html: string) => `<span class="text-nowrap">${html}</span>`;
|
||||
export const numberStyle =
|
||||
(number: number, type: "positive" | "negative" | undefined = undefined, prefix = "", postfix = "", precision = 0, thousandsSeparator = "'", decimalSeparator = null) => {
|
||||
const html = nowrap(monospace(number_format_datatable(prefix, postfix, precision, thousandsSeparator, decimalSeparator).display(number)));
|
||||
|
||||
return type && `<span class="text-${type}">${html}</span>` || html;
|
||||
};
|
||||
32
public_html/pian_acc_rossg.php
Normal file
32
public_html/pian_acc_rossg.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
session_start();
|
||||
include "functions.php";
|
||||
require_once "include_login.php";
|
||||
include "config.php";
|
||||
include "include/module.php";
|
||||
|
||||
include Controller::current_mainClasspath();
|
||||
(new Ajax())->checkAjaxRequests();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<!--html manifest="manifest.appcache"-->
|
||||
<html lang="it">
|
||||
<head>
|
||||
<?php include pvm_tagHead; ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php include pvm_headerNavbar; ?>
|
||||
<?php include pvm_splashScreen; ?>
|
||||
<div id="content">
|
||||
<div><?php
|
||||
include pvm_navTab;
|
||||
if (!PVM\CurrentModule::isAuthorizedToCurrentUser()) {
|
||||
include pvm_unauthorized;
|
||||
} else {
|
||||
include Controller::current_gestpath_mainPage();
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php include pvm_footerMinimal; ?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user