js-gei 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js-gei.es.js +36987 -1084
- package/dist/js-gei.umd.js +64 -2
- package/package.json +6 -2
- package/src/Evaluator/CodeLogic/CodeLogicBaseService.ts +33 -0
- package/src/Evaluator/CodeLogic/CodeLogicItemsService.ts +38 -0
- package/src/Evaluator/CodeLogic/CodeLogicVatsUIService.ts +135 -0
- package/src/Evaluator/ExpresionLogicService.ts +81 -50
- package/src/Evaluator/HelpersTables.ts +9 -4
- package/src/Evaluator/Parser/AddLeadZerosParse.ts +1 -1
- package/src/Evaluator/Parser/AppearParse.ts +2 -2
- package/src/Evaluator/Parser/BaseParse.ts +1 -1
- package/src/Evaluator/Parser/CalcDateParse.ts +1 -1
- package/src/Evaluator/Parser/CheckParse.ts +7 -4
- package/src/Evaluator/Parser/CleanParse.ts +1 -1
- package/src/Evaluator/Parser/CodeListCheckParse.ts +50 -0
- package/src/Evaluator/Parser/CommaParser.ts +2 -2
- package/src/Evaluator/Parser/ConcatParse.ts +1 -1
- package/src/Evaluator/Parser/CountParse.ts +2 -2
- package/src/Evaluator/Parser/DateTimeFormatParse.ts +4 -3
- package/src/Evaluator/Parser/EmptyParse.ts +22 -7
- package/src/Evaluator/Parser/ExistParse.ts +2 -2
- package/src/Evaluator/Parser/ExtractParse.ts +89 -0
- package/src/Evaluator/Parser/FromCodeListParse.ts +109 -0
- package/src/Evaluator/Parser/IfParse.ts +3 -2
- package/src/Evaluator/Parser/InDetailParse.ts +7 -9
- package/src/Evaluator/Parser/InListParse.ts +1 -1
- package/src/Evaluator/Parser/LenParse.ts +39 -0
- package/src/Evaluator/Parser/LiteralValueParse.ts +2 -2
- package/src/Evaluator/Parser/LogicalOperatorParse.ts +2 -2
- package/src/Evaluator/Parser/MonthParse.ts +41 -0
- package/src/Evaluator/Parser/NoEvalParse.ts +17 -0
- package/src/Evaluator/Parser/OnlyExpressionParse.ts +1 -1
- package/src/Evaluator/Parser/OperatorParse.ts +2 -2
- package/src/Evaluator/Parser/RegistryCheckParse.ts +51 -0
- package/src/Evaluator/Parser/StartsParse.ts +1 -1
- package/src/Evaluator/Parser/SubstrParse.ts +1 -1
- package/src/Evaluator/Parser/SumParse.ts +2 -2
- package/src/Evaluator/Parser/TimeParse.ts +92 -0
- package/src/Evaluator/Parser/ToNullParse.ts +62 -0
- package/src/Evaluator/Parser/TotalMinutesParse.ts +95 -0
- package/src/Evaluator/Parser/TrimParse.ts +1 -1
- package/src/Evaluator/Parser/UpperLoverParse.ts +1 -1
- package/src/Evaluator/Parser/UseFirstParse.ts +1 -1
- package/src/Evaluator/Parser/ValueFromObjParse.ts +2 -2
- package/src/Evaluator/Parser/ValueParse.ts +3 -3
- package/src/Evaluator/Parser/YearParse.ts +34 -0
- package/src/HelperSessionStorage.ts +5 -1
- package/src/Interfaces/SchemaStruct.ts +4 -2
- package/src/Lib/axios-1.4.0.min.js +2 -0
- package/src/Lib/jsonrpc-2.0.js +874 -0
- package/src/Lib/jsonrpc-2.0.js.bak +874 -0
- package/src/Structure/InvoiceObj.ts +96 -33
- package/src/Structure/RecordArray.ts +27 -10
- package/src/Structure/RecordSingle.ts +216 -87
- package/src/Structure/TableLevel.ts +34 -4
- package/src/main.ts +265 -18
- package/src/Evaluator/Parser/ToNullParser.ts +0 -0
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SchemaStruct } from "../Interfaces/SchemaStruct";
|
|
4
|
-
import { IfStategment } from "../Evaluator/Parser/IfStategment";
|
|
1
|
+
import type{ SchemaStruct } from "../Interfaces/SchemaStruct";
|
|
5
2
|
import { TableLevel } from "./TableLevel";
|
|
6
|
-
|
|
7
3
|
import { BaseParse } from "../Evaluator/Parser/BaseParse";
|
|
8
4
|
import { ExpresionLogicService } from "../Evaluator/ExpresionLogicService";
|
|
5
|
+
import { CodeLogicVatsUIService } from "../Evaluator/CodeLogic/CodeLogicVatsUIService";
|
|
6
|
+
import { CodeLogicItemsService } from "../Evaluator/CodeLogic/CodeLogicItemsService";
|
|
7
|
+
import { HelpersTables } from "../Evaluator/HelpersTables";
|
|
9
8
|
|
|
10
9
|
export class RecordSingle {
|
|
11
10
|
public Details: any | null = null;
|
|
12
11
|
public IsDefaultRecord:boolean=false;
|
|
13
12
|
private _LeftInstance:any=null;
|
|
13
|
+
private _referenceRecords:Map<string, RecordSingle[]>|null =null;
|
|
14
|
+
public SetReferenceRecords(key:string,records:RecordSingle[])
|
|
15
|
+
{
|
|
16
|
+
if(this._referenceRecords==null)
|
|
17
|
+
{
|
|
18
|
+
this._referenceRecords=new Map<string, RecordSingle[]>();
|
|
19
|
+
}
|
|
20
|
+
this._referenceRecords.set(key, records);
|
|
21
|
+
}
|
|
22
|
+
public GetReferenceRecords(key:string):RecordSingle[]|null{
|
|
23
|
+
if(this._referenceRecords==null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return this._referenceRecords.get(key) ?? null;
|
|
27
|
+
}
|
|
14
28
|
public SetLeftInstanceReference(obj:any)
|
|
15
29
|
{
|
|
16
30
|
this._LeftInstance=obj;
|
|
@@ -21,22 +35,21 @@ export class RecordSingle {
|
|
|
21
35
|
}
|
|
22
36
|
Parent: TableLevel | null;
|
|
23
37
|
Record: any;
|
|
24
|
-
|
|
25
|
-
public constructor(
|
|
26
|
-
obj: any, objectInfo: any, parent: TableLevel | null) {
|
|
27
|
-
|
|
38
|
+
RecordAnalitic:any={};
|
|
39
|
+
public constructor(level: any, objectInfo: any, parent: TableLevel | null) {
|
|
28
40
|
this.Parent = parent;
|
|
29
|
-
if(
|
|
41
|
+
if(level["_details"]!=null)
|
|
30
42
|
{
|
|
31
43
|
var details:any={};
|
|
32
|
-
var tables=Object.keys(
|
|
44
|
+
var tables=Object.keys(level["_details"]);
|
|
33
45
|
tables.forEach(table=>{
|
|
34
|
-
details[table]=new TableLevel(table,
|
|
46
|
+
details[table]=new TableLevel(table,level["_details"][table],objectInfo,this.Parent?.Root??null)
|
|
35
47
|
})
|
|
36
48
|
this.Details=details;
|
|
37
|
-
delete
|
|
49
|
+
delete level["_details"];
|
|
38
50
|
}
|
|
39
|
-
this.Record=
|
|
51
|
+
this.Record={};
|
|
52
|
+
|
|
40
53
|
}
|
|
41
54
|
AddDetail(tableName:string,tableLavel:TableLevel)
|
|
42
55
|
{
|
|
@@ -62,19 +75,20 @@ export class RecordSingle {
|
|
|
62
75
|
return this.Details[tableName]!=null;
|
|
63
76
|
}
|
|
64
77
|
public SetValueToKey(item:SchemaStruct, value:any, record:any){
|
|
78
|
+
if(record!=null)
|
|
79
|
+
{
|
|
80
|
+
if(record==this.Record)
|
|
81
|
+
{
|
|
82
|
+
this.RecordAnalitic[item.FieldName]=value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
65
85
|
if (value == null)
|
|
66
86
|
{
|
|
67
87
|
this.Record[item.FieldName]=null;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
88
|
return;
|
|
72
89
|
}
|
|
73
90
|
if (item.FieldName != null)
|
|
74
91
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
92
|
if (typeof(value)=="string")
|
|
79
93
|
{
|
|
80
94
|
switch (item.Type)
|
|
@@ -98,24 +112,31 @@ export class RecordSingle {
|
|
|
98
112
|
}
|
|
99
113
|
}
|
|
100
114
|
}
|
|
101
|
-
|
|
115
|
+
|
|
102
116
|
if (item.RoundTo!=null)
|
|
103
117
|
{
|
|
104
|
-
|
|
105
118
|
var dec = item.RoundTo;
|
|
106
119
|
if (typeof(value)=="number")
|
|
107
120
|
{
|
|
108
|
-
|
|
109
121
|
value = this.roundUp(value,dec);
|
|
110
|
-
}
|
|
111
|
-
|
|
122
|
+
}
|
|
112
123
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
124
|
+
}
|
|
117
125
|
this.Record[item.FieldName]=value;
|
|
118
126
|
}
|
|
127
|
+
public SetValueToKeyString(key:string, value:any, record:any){
|
|
128
|
+
if(record!=null)
|
|
129
|
+
{
|
|
130
|
+
this.RecordAnalitic[key]=value;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (value == null)
|
|
134
|
+
{
|
|
135
|
+
this.Record[key]=null;
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.Record[key]=value;
|
|
139
|
+
}
|
|
119
140
|
public roundUp(num: number, r: number) {
|
|
120
141
|
let negative = false;
|
|
121
142
|
if (num < 0) { negative = true } else { negative = false };
|
|
@@ -178,14 +199,79 @@ export class RecordSingle {
|
|
|
178
199
|
return;
|
|
179
200
|
}
|
|
180
201
|
listForEval.forEach(item=>{
|
|
181
|
-
this.MapToIdItem(item);
|
|
202
|
+
var record=this.MapToIdItem(item);
|
|
203
|
+
|
|
182
204
|
})
|
|
183
205
|
|
|
184
206
|
}
|
|
185
207
|
MapToIdItem(item:SchemaStruct)
|
|
186
208
|
{
|
|
187
|
-
|
|
188
|
-
|
|
209
|
+
if(item==null)
|
|
210
|
+
{
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
var dic:any={};
|
|
214
|
+
var masterKey=item.FieldName;
|
|
215
|
+
var keys=Object.keys(this.Record);
|
|
216
|
+
var allOIKeys=Object.keys((this.Parent?.Root?.ObjectInfo??{})[item.TableName??""]).filter(x=>x.startsWith(masterKey+"__"));
|
|
217
|
+
|
|
218
|
+
var connectedKeys:string[]=[];
|
|
219
|
+
var filterKeys=keys.filter(x=>x.startsWith(masterKey+"__"));
|
|
220
|
+
if(item.FieldName=="ItemVatCodeSC")
|
|
221
|
+
{
|
|
222
|
+
// debugger
|
|
223
|
+
}
|
|
224
|
+
for(let i=0;i<filterKeys.length;i++)
|
|
225
|
+
{
|
|
226
|
+
var keyWithoutPrefix=filterKeys[i].substring((masterKey+"__").length);
|
|
227
|
+
connectedKeys.push(keyWithoutPrefix);
|
|
228
|
+
if(this.Record[filterKeys[i]]!=null)
|
|
229
|
+
{
|
|
230
|
+
|
|
231
|
+
dic[keyWithoutPrefix]=this.Record[filterKeys[i]];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if(Object.keys(dic).length==0)
|
|
235
|
+
{
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if(item.ConnTable==null)
|
|
239
|
+
{
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
var records:any[]=this.Parent?.Root?.CodeListCache[item.ConnTable];
|
|
243
|
+
var keysDic=Object.keys(dic);
|
|
244
|
+
let filter:any[]=records;
|
|
245
|
+
for(let i=0;i<keysDic.length;i++)
|
|
246
|
+
{
|
|
247
|
+
var key=keysDic[i];
|
|
248
|
+
filter=filter.filter((rec:any)=>rec[key]==dic[key]);
|
|
249
|
+
if(filter.length==0)
|
|
250
|
+
{
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if(filter.length>1)
|
|
255
|
+
{
|
|
256
|
+
throw "More than 1 record found for "+item.FieldName+" with value "+JSON.stringify(dic);
|
|
257
|
+
}
|
|
258
|
+
var filterRecord=filter[0];
|
|
259
|
+
|
|
260
|
+
this.Record[item.FieldName]=filterRecord[item.ByKey??"Id"];
|
|
261
|
+
for(let i=0;i<allOIKeys.length;i++)
|
|
262
|
+
{
|
|
263
|
+
var key=allOIKeys[i];
|
|
264
|
+
var withoutPrefix=key.substring((masterKey+"__").length);
|
|
265
|
+
this.Record[key]=filterRecord[withoutPrefix];
|
|
266
|
+
}
|
|
267
|
+
var recordKeys=Object.keys(filterRecord);
|
|
268
|
+
for(let i=0;i<recordKeys.length;i++)
|
|
269
|
+
{
|
|
270
|
+
var key=recordKeys[i];
|
|
271
|
+
this.RecordAnalitic[item.FieldName+"__"+key]=filterRecord[key];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
189
275
|
EvaluateInner(listForEval:SchemaStruct[]) {
|
|
190
276
|
if(listForEval.length==0)
|
|
191
277
|
{
|
|
@@ -194,11 +280,11 @@ export class RecordSingle {
|
|
|
194
280
|
listForEval.forEach(item=>{
|
|
195
281
|
if(this.Parent?.Root?.EvalType=="Init")
|
|
196
282
|
{
|
|
197
|
-
if(this.Record[item.FieldName]
|
|
283
|
+
if(this.Record[item.FieldName]==null)
|
|
198
284
|
{
|
|
199
|
-
if(item.
|
|
285
|
+
if(item.ValueExpressionInit!=null)
|
|
200
286
|
{
|
|
201
|
-
var value=ExpresionLogicService.ParseAndFillExpression(item.
|
|
287
|
+
var value=ExpresionLogicService.ParseAndFillExpression(item.ValueExpressionInit, item, this?.Parent?.Root??null, this,this.Record, true, false);
|
|
202
288
|
this.Record[item.FieldName]=value;
|
|
203
289
|
}
|
|
204
290
|
}
|
|
@@ -227,23 +313,37 @@ export class RecordSingle {
|
|
|
227
313
|
|
|
228
314
|
if(item.ValueExpression!=null){
|
|
229
315
|
var valueValue:any=ExpresionLogicService.ParseAndFillExpression(item.ValueExpression, item, this?.Parent?.Root??null, this,this.Record, true, false);
|
|
230
|
-
this.
|
|
316
|
+
this.SetValueToKey(item,valueValue,this.Record);
|
|
317
|
+
|
|
231
318
|
}
|
|
232
319
|
else
|
|
233
320
|
{
|
|
234
321
|
if(this.Record[item.FieldName]==null)
|
|
235
322
|
{
|
|
236
|
-
|
|
323
|
+
this.SetValueToKey(item,null,this.Record);
|
|
237
324
|
}
|
|
238
325
|
}
|
|
239
326
|
|
|
240
327
|
switch(item.GetValueFrom)
|
|
241
328
|
{
|
|
242
329
|
case "Code":{
|
|
330
|
+
switch(item.TableName)
|
|
331
|
+
{
|
|
332
|
+
case "EU_Invoices_VatsUI":{
|
|
333
|
+
CodeLogicVatsUIService.Execute(item, this.Parent?.Root??null, this, this.Record);
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
case "EU_Invoices_Items":{
|
|
337
|
+
CodeLogicItemsService.Execute(item, this.Parent?.Root??null, this, this.Record);
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
243
343
|
break;
|
|
244
344
|
}
|
|
245
345
|
case "Mappings":{
|
|
246
|
-
|
|
346
|
+
//todo
|
|
247
347
|
break;
|
|
248
348
|
}
|
|
249
349
|
}
|
|
@@ -319,7 +419,7 @@ export class RecordSingle {
|
|
|
319
419
|
case "E":
|
|
320
420
|
{
|
|
321
421
|
const tableName = split[1];
|
|
322
|
-
const field = split[2];
|
|
422
|
+
//const field = split[2];
|
|
323
423
|
if (tableName=="EU_AOrg")
|
|
324
424
|
{
|
|
325
425
|
// return this.Parent?.Root?.service.aboutOrganisation[field];
|
|
@@ -349,6 +449,7 @@ export class RecordSingle {
|
|
|
349
449
|
console.warn("Other E not supported!")
|
|
350
450
|
return null;
|
|
351
451
|
}
|
|
452
|
+
break;
|
|
352
453
|
|
|
353
454
|
}
|
|
354
455
|
case "S":
|
|
@@ -382,23 +483,7 @@ export class RecordSingle {
|
|
|
382
483
|
|
|
383
484
|
return null;
|
|
384
485
|
}
|
|
385
|
-
|
|
386
|
-
var bC = 0;
|
|
387
|
-
var bO = 0;
|
|
388
|
-
for (var i = 0; i < expresion.length; i++) {
|
|
389
|
-
if (expresion.substring(i, i + 1) == "(") {
|
|
390
|
-
bO++;
|
|
391
|
-
}
|
|
392
|
-
else if (expresion.substring(i, i + 1) == ")") {
|
|
393
|
-
bC++;
|
|
394
|
-
}
|
|
395
|
-
if (bO > 0 && bO == bC) {
|
|
396
|
-
return i;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return -1;
|
|
400
|
-
|
|
401
|
-
}
|
|
486
|
+
|
|
402
487
|
public getSaveObject(objectInfoUIEdit: any) {
|
|
403
488
|
const result: any = {};
|
|
404
489
|
if (this.Details != null) {
|
|
@@ -509,12 +594,13 @@ export class RecordSingle {
|
|
|
509
594
|
const result: any = {};
|
|
510
595
|
if (this.Details != null) {
|
|
511
596
|
const details: any = {};
|
|
512
|
-
|
|
513
|
-
|
|
597
|
+
var detailsTables=Object.keys(this.Details);
|
|
598
|
+
for (let i = 0; i < detailsTables.length; i++) {
|
|
599
|
+
const obj = this.Details[detailsTables[i]].getFullObject(objectInfo);
|
|
514
600
|
if (obj == null) {
|
|
515
601
|
continue;
|
|
516
602
|
}
|
|
517
|
-
details[this.Details[i].Tablename] = obj;
|
|
603
|
+
details[this.Details[detailsTables[i]].Tablename] = obj;
|
|
518
604
|
}
|
|
519
605
|
if (Object.keys(details).length > 0) {
|
|
520
606
|
result["_details"] = details;
|
|
@@ -546,7 +632,7 @@ export class RecordSingle {
|
|
|
546
632
|
}
|
|
547
633
|
continue;
|
|
548
634
|
}*/
|
|
549
|
-
const type = tablePart[key].
|
|
635
|
+
const type = tablePart[key].Type;
|
|
550
636
|
// console.log('type: ' + type);
|
|
551
637
|
switch (type) {
|
|
552
638
|
case "Date": {
|
|
@@ -572,46 +658,89 @@ export class RecordSingle {
|
|
|
572
658
|
|
|
573
659
|
result["InvTotalVatAmountCCInp"]=this.Record["InvTotalVatAmountCC"];
|
|
574
660
|
result["InvAmountInclVatInp"]=this.Record["InvAmountInclVat"];
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
661
|
+
|
|
662
|
+
}
|
|
663
|
+
if (Object.keys(result).length > 0) {
|
|
664
|
+
return result;
|
|
665
|
+
}
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
public GetTableForAlias(objectInfo: any) {
|
|
669
|
+
const result: any = {};
|
|
670
|
+
if (this.Details != null) {
|
|
671
|
+
const details: any = {};
|
|
672
|
+
var detailsTables=Object.keys(this.Details);
|
|
673
|
+
for (let i = 0; i < detailsTables.length; i++) {
|
|
674
|
+
const obj = this.Details[detailsTables[i]].GetTableForAlias(objectInfo);
|
|
675
|
+
if (obj == null) {
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
678
|
+
details[HelpersTables.GetTableForAlias(this.Details[detailsTables[i]].Tablename)] = obj;
|
|
679
|
+
}
|
|
680
|
+
if (Object.keys(details).length > 0) {
|
|
681
|
+
result["_details"] = details;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
if (this.Parent?.Tablename == null) {
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const tablePart = objectInfo[this.Parent?.Tablename]
|
|
690
|
+
const keys = Object.keys(tablePart);
|
|
691
|
+
for (let i = 0; i < keys.length; i++) {
|
|
692
|
+
|
|
693
|
+
const key = keys[i];
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
/*if ("InvIssueDate"==key&&this.Parent?.Tablename == "EU_Invoices") {
|
|
697
|
+
if(this.Parent.Root?.service.aboutOrganisation["InvDateOpen"]==null||
|
|
698
|
+
this.Parent.Root?.service.aboutOrganisation["InvDateOpen"]==false)
|
|
579
699
|
{
|
|
580
|
-
for(let x=0;x<this.Record["__AdditonalRef"].length;x++)
|
|
581
|
-
{
|
|
582
|
-
const addRef=this.Record["__AdditonalRef"][x];
|
|
583
|
-
for(let i=0;i<this.Parent.Root?.service.BuyerRefArray.length;i++)
|
|
584
|
-
{
|
|
585
|
-
const item=this.Parent.Root?.service.BuyerRefArray[i];
|
|
586
|
-
if(addRef.key==item.Tag&&addRef.value!=null)
|
|
587
|
-
{
|
|
588
700
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
701
|
+
let date = new Date();
|
|
702
|
+
result[key]=BaseParse.getIsoDateTime(date);
|
|
703
|
+
}
|
|
704
|
+
else
|
|
705
|
+
{
|
|
706
|
+
result[key]=BaseParse.getIsoDateTime(this.Record[key]);
|
|
707
|
+
}
|
|
708
|
+
continue;
|
|
709
|
+
}*/
|
|
710
|
+
const type = tablePart[key].Type;
|
|
711
|
+
const alias = tablePart[key].Alias??key;
|
|
712
|
+
// console.log('type: ' + type);
|
|
713
|
+
switch (type) {
|
|
714
|
+
case "Date": {
|
|
715
|
+
result[alias] = BaseParse.getIsoDate(this.Record[key]);
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
case "DateTime": {
|
|
592
719
|
|
|
720
|
+
result[alias] = BaseParse.getIsoDateTime(this.Record[key]);
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
default: {
|
|
724
|
+
result[alias] = this.Record[key];
|
|
725
|
+
break;
|
|
593
726
|
}
|
|
594
727
|
}
|
|
595
|
-
}
|
|
596
728
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
result[item.WriteToField]=null;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
729
|
+
}
|
|
730
|
+
if (this.Record["Id"] != null) {
|
|
731
|
+
result["Id"] = this.Record["Id"];
|
|
732
|
+
}
|
|
733
|
+
if (this.Parent?.Tablename == "EU_Invoices") {
|
|
605
734
|
|
|
606
|
-
|
|
607
|
-
|
|
735
|
+
result["InvTotalVatAmountCCInp"]=this.Record["InvTotalVatAmountCC"];
|
|
736
|
+
result["InvAmountInclVatInp"]=this.Record["InvAmountInclVat"];
|
|
737
|
+
|
|
608
738
|
}
|
|
609
739
|
if (Object.keys(result).length > 0) {
|
|
610
740
|
return result;
|
|
611
741
|
}
|
|
612
742
|
return null;
|
|
613
743
|
}
|
|
614
|
-
|
|
615
744
|
public Validate() {
|
|
616
745
|
/*if (this.TableObjectInfo == null) {
|
|
617
746
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { SchemaStruct } from "../Interfaces/SchemaStruct";
|
|
3
|
+
import type { SchemaStruct } from "../Interfaces/SchemaStruct";
|
|
4
4
|
import { InvoiceObj } from "./InvoiceObj";
|
|
5
5
|
import { RecordArray } from "./RecordArray";
|
|
6
6
|
import { RecordSingle } from "./RecordSingle";
|
|
@@ -13,7 +13,7 @@ export class TableLevel {
|
|
|
13
13
|
public Record:RecordSingle|null=null;
|
|
14
14
|
public Records:RecordArray|null=null;
|
|
15
15
|
|
|
16
|
-
public validateDetailsErrors =
|
|
16
|
+
public validateDetailsErrors:any ={};
|
|
17
17
|
|
|
18
18
|
public constructor(
|
|
19
19
|
table:string,
|
|
@@ -26,9 +26,9 @@ export class TableLevel {
|
|
|
26
26
|
this.Tablename=table;
|
|
27
27
|
this.Root=root;
|
|
28
28
|
this.ObjectInfo=objectInfo[table];
|
|
29
|
-
if(
|
|
29
|
+
if(obj.detail===true)
|
|
30
30
|
{
|
|
31
|
-
this.Records=new RecordArray(
|
|
31
|
+
this.Records=new RecordArray([{}],this.DefaultRecord,objectInfo);
|
|
32
32
|
|
|
33
33
|
}
|
|
34
34
|
else
|
|
@@ -147,6 +147,36 @@ export class TableLevel {
|
|
|
147
147
|
}
|
|
148
148
|
return result;
|
|
149
149
|
}
|
|
150
|
+
public GetTableForAlias(objectInfo:any){
|
|
151
|
+
|
|
152
|
+
if(objectInfo[this.Tablename]==null)
|
|
153
|
+
{
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
let result:any=null;
|
|
157
|
+
if(this.Record!=null)
|
|
158
|
+
{
|
|
159
|
+
|
|
160
|
+
let obj=this.Record.GetTableForAlias(objectInfo);
|
|
161
|
+
if(obj==null)
|
|
162
|
+
{
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
result=obj;
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
if(this.Records!=null)
|
|
169
|
+
{
|
|
170
|
+
let obj=this.Records.GetTableForAlias(objectInfo);
|
|
171
|
+
if(obj==null)
|
|
172
|
+
{
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
result=obj;
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
150
180
|
public Validate()
|
|
151
181
|
{
|
|
152
182
|
this.validateDetailsErrors = [];
|