pict-section-form 1.0.86 → 1.0.88
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/example_applications/simple_form/Simple-Form_Default_Manifest.json +15 -21
- package/harness/Harness.js +125 -0
- package/harness/package.json +14 -0
- package/harness/tsconfig.json +16 -0
- package/package.json +1 -1
- package/source/providers/Pict-Provider-DynamicSolver.js +9 -9
- package/source/providers/inputs/Pict-Provider-Input-PreciseNumber.js +6 -1
- package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts +3 -1
- package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts.map +1 -1
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
[
|
|
15
15
|
"Area = Height * Width",
|
|
16
16
|
"WidthCubeArea = Width ^ 3",
|
|
17
|
-
"HeightCubeArea = Height ^ 3"
|
|
17
|
+
"HeightCubeArea = Height ^ 3",
|
|
18
|
+
"DTPN = Height * Width",
|
|
19
|
+
"ITPNRO = Height * Width",
|
|
20
|
+
"ITDRO = Height * Width",
|
|
21
|
+
"ITPRO = Height * Width"
|
|
18
22
|
],
|
|
19
23
|
"MetaTemplates":
|
|
20
24
|
[
|
|
@@ -81,39 +85,29 @@
|
|
|
81
85
|
"Hash":"Area",
|
|
82
86
|
"DataType":"PreciseNumber"
|
|
83
87
|
|
|
84
|
-
,"PictForm": {"
|
|
88
|
+
,"PictForm": {"Section":"Area", "Row":4, "Width":2 }
|
|
85
89
|
},
|
|
86
90
|
|
|
87
|
-
"
|
|
91
|
+
"DTPN":
|
|
88
92
|
{
|
|
89
93
|
"Name":"DataType PreciseNumber",
|
|
90
94
|
"Hash":"DTPN",
|
|
91
95
|
"DataType":"PreciseNumber"
|
|
92
96
|
,"PictForm": {"InputType": "PreciseNumberReadOnly", "Section":"Marshaling", "Row":1, "Width":3 }
|
|
93
97
|
},
|
|
94
|
-
"
|
|
98
|
+
"ITPNRO":
|
|
95
99
|
{
|
|
96
100
|
"Name":"InputType PreciseNumberReadOnly",
|
|
97
101
|
"Hash":"ITPNRO",
|
|
98
102
|
"DataType":"PreciseNumber",
|
|
99
103
|
"InputType": "PreciseNumberReadOnly"
|
|
100
|
-
,"PictForm": {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"InputType": "DollarsReadOnly"
|
|
108
|
-
,"PictForm": { "Section":"Marshaling", "Row":1, "Width":3 }
|
|
109
|
-
},
|
|
110
|
-
"PercentOutputExercise":
|
|
111
|
-
{
|
|
112
|
-
"Name":"InputType PercentReadOnly",
|
|
113
|
-
"Hash":"ITPRO",
|
|
114
|
-
"DataType":"PreciseNumber",
|
|
115
|
-
"InputType": "PercentReadOnly"
|
|
116
|
-
,"PictForm": { "Section":"Marshaling", "Row":1, "Width":3 }
|
|
104
|
+
,"PictForm": {
|
|
105
|
+
"InputType": "PreciseNumberReadOnly",
|
|
106
|
+
"DecimalPrecision": 2,
|
|
107
|
+
"AddCommas": false,
|
|
108
|
+
"DigitsPrefix": "$",
|
|
109
|
+
"DigitsPostfix": " (estimated)",
|
|
110
|
+
"Section":"Marshaling", "Row":1, "Width":3 }
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
|
|
2
|
+
const Pict = require('pict');
|
|
3
|
+
const Provider = require('../source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js');
|
|
4
|
+
|
|
5
|
+
const main = async (projectID) =>
|
|
6
|
+
{
|
|
7
|
+
const pict = new Pict({ RestClientURLPrefix: 'https://api.qa.headlight.com', PictDefaultURLPrefix: '/1.0/' });
|
|
8
|
+
pict.LogNoisiness = 1;
|
|
9
|
+
const preRequestOptions = pict.RestClient.prepareRequestOptions;
|
|
10
|
+
let token = '';
|
|
11
|
+
pict.RestClient.prepareRequestOptions = (pOptions) =>
|
|
12
|
+
{
|
|
13
|
+
if (!pOptions.headers)
|
|
14
|
+
{
|
|
15
|
+
pOptions.headers = { };
|
|
16
|
+
}
|
|
17
|
+
if (token)
|
|
18
|
+
{
|
|
19
|
+
pOptions.headers.Authorization = `Bearer ${token}`;
|
|
20
|
+
}
|
|
21
|
+
pict.log.info(`Requesting ${pOptions.url} with token ${token}`);
|
|
22
|
+
return preRequestOptions(pOptions);
|
|
23
|
+
};
|
|
24
|
+
await new Promise((resolve, reject) => pict.RestClient.postJSON({ url: '/1.0/Authenticate', body: { UserName: 'ladotd', Password: 'emerald guppy' } }, (err, response, result) =>
|
|
25
|
+
{
|
|
26
|
+
if (err)
|
|
27
|
+
{
|
|
28
|
+
return reject(err);
|
|
29
|
+
}
|
|
30
|
+
token = result.SessionID;
|
|
31
|
+
pict.log.info(`Received token ${token}`);
|
|
32
|
+
resolve(result);
|
|
33
|
+
}));
|
|
34
|
+
pict.AppData.IDProject = projectID;
|
|
35
|
+
const provider = pict.addProvider('EntityBundleRequest', {}, Provider);
|
|
36
|
+
const dataLoadError = await provider.gatherDataFromServer({},
|
|
37
|
+
{
|
|
38
|
+
PictForm:
|
|
39
|
+
{
|
|
40
|
+
EntitiesBundle:
|
|
41
|
+
[
|
|
42
|
+
{
|
|
43
|
+
"Entity": "Project",
|
|
44
|
+
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}",
|
|
45
|
+
"Destination": "AppData.Project",
|
|
46
|
+
"SingleRecord": true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"Entity": "Document",
|
|
50
|
+
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}~FBV~DocumentType~EQ~LADOTD-PartialPayment~FSF~DocumentDate~DESC~0~FSF~IDDocument~DESC~0",
|
|
51
|
+
"Destination": "AppData.PaymentForms",
|
|
52
|
+
"RecordCount": 1
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"Entity": "Document",
|
|
56
|
+
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}~FBV~DocumentType~EQ~ProjectProgressUpdate-LADOTD~FSF~DocumentDate~DESC~0~FSF~IDDocument~DESC~0",
|
|
57
|
+
"Destination": "AppData.ProgressForms",
|
|
58
|
+
"RecordCount": 1
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"Entity": "Contract",
|
|
62
|
+
"Filter": "FBV~IDContract~EQ~{~D:AppData.Project.IDContract~}",
|
|
63
|
+
"Destination": "AppData.Contract"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"Entity": "ContractDate",
|
|
67
|
+
"Filter": "FBV~IDContract~EQ~{~D:AppData.Project.IDContract~}~FBV~Hash~EQ~NTPD",
|
|
68
|
+
"Destination": "AppData.NTPDate",
|
|
69
|
+
"SingleRecord": true
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"Entity": "LineItem",
|
|
73
|
+
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}",
|
|
74
|
+
"Destination": "AppData.LineItems"
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}, { IDProject: projectID });
|
|
79
|
+
if (dataLoadError)
|
|
80
|
+
{
|
|
81
|
+
pict.log.error(`Error loading data from server: ${dataLoadError.message || dataLoadError}`, { dataLoadError });
|
|
82
|
+
}
|
|
83
|
+
const data =
|
|
84
|
+
{
|
|
85
|
+
ProjectID: pict.AppData.Project.IDProject,
|
|
86
|
+
ContractID: pict.AppData.Project.IDContract,
|
|
87
|
+
Project: pict.AppData.Project.Name,
|
|
88
|
+
ContractedDays: pict.AppData.Project.ContractedDays,
|
|
89
|
+
//TODO: precise math?
|
|
90
|
+
SumOfLineItemAmounts: pict.AppData.LineItems.reduce((sum, lineItem) => sum + lineItem.ExpectedQuantity * lineItem.CostPerUnit, 0),
|
|
91
|
+
TotalBidAmount: pict.AppData.Contract.TotalBidAmount,
|
|
92
|
+
NetChangeOrderAmount: pict.AppData.Contract.NetChangeOrderAmount,
|
|
93
|
+
NTPDate: pict.AppData.NTPDate ? pict.AppData.NTPDate.Date : null,
|
|
94
|
+
};
|
|
95
|
+
if (pict.AppData.PaymentForms.length > 0)
|
|
96
|
+
{
|
|
97
|
+
data.PaymentDaysTotalPaidIncludingThisPayment = pict.AppData.PaymentForms[0].FormData.PaymentDaysTotalPaidIncludingThisPayment;
|
|
98
|
+
data.WorkingDaysTotal = pict.AppData.PaymentForms[0].FormData.WorkingDaysTotal;
|
|
99
|
+
for (const total of pict.AppData.PaymentForms[0].FormData.Totals)
|
|
100
|
+
{
|
|
101
|
+
if (total.name == 'Grand Total Paid to Date this Contract - Including this Payment')
|
|
102
|
+
{
|
|
103
|
+
data.PaidTotal = total.amount;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (pict.AppData.ProgressForms.length > 0)
|
|
108
|
+
{
|
|
109
|
+
const progressData = pict.AppData.ProgressForms[0].FormData?.EstimatedCompletion;
|
|
110
|
+
if (progressData)
|
|
111
|
+
{
|
|
112
|
+
data.EstimatedCompletionDate = `${progressData.Month}, ${progressData.Year}`;
|
|
113
|
+
data.ECDNotes = progressData.Notes;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
pict.log.info('Data gathered from server', data);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
main(7323).then(() =>
|
|
120
|
+
{
|
|
121
|
+
console.info('Done');
|
|
122
|
+
}).catch((err) =>
|
|
123
|
+
{
|
|
124
|
+
console.error(err);
|
|
125
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "harness",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "Harness.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"author": "",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"description": "",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"pict": "^1.0.241"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["*.js", "../source"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"target": "es2019",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"module": "commonjs",
|
|
14
|
+
"resolveJsonModule": true
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -164,7 +164,7 @@ class PictDynamicSolver extends libPictProvider
|
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
tmpSolver.StartTimeStamp =
|
|
167
|
+
tmpSolver.StartTimeStamp = Date.now();
|
|
168
168
|
tmpSolver.Hash = `${pGroupSolverArray[j].ViewHash}-GroupSolver-${j}`;
|
|
169
169
|
|
|
170
170
|
if (this.pict.LogNoisiness > 1)
|
|
@@ -174,12 +174,11 @@ class PictDynamicSolver extends libPictProvider
|
|
|
174
174
|
|
|
175
175
|
let tmpRecordSet = tmpView.getTabularRecordSet(tmpGroup.GroupIndex);
|
|
176
176
|
|
|
177
|
-
if (
|
|
177
|
+
if (Array.isArray(tmpRecordSet))
|
|
178
178
|
{
|
|
179
|
-
let
|
|
180
|
-
for (let l = 0; l < tmpRecordSetKeys.length; l++)
|
|
179
|
+
for (let l = 0; l < tmpRecordSet.length; l++)
|
|
181
180
|
{
|
|
182
|
-
let tmpRecord = tmpRecordSet[
|
|
181
|
+
let tmpRecord = tmpRecordSet[l];
|
|
183
182
|
tmpSolver.ResultsObject = {};
|
|
184
183
|
let tmpSolutionValue = tmpView.fable.ExpressionParser.solve(tmpSolver.Expression, tmpRecord, tmpSolver.ResultsObject, tmpGroup.supportingManifest, tmpRecord);
|
|
185
184
|
if (this.pict.LogNoisiness > 1)
|
|
@@ -188,11 +187,12 @@ class PictDynamicSolver extends libPictProvider
|
|
|
188
187
|
}
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
|
-
if (
|
|
190
|
+
else if (typeof(tmpRecordSet) == 'object')
|
|
192
191
|
{
|
|
193
|
-
|
|
192
|
+
let tmpRecordSetKeys = Object.keys(tmpRecordSet);
|
|
193
|
+
for (let l = 0; l < tmpRecordSetKeys.length; l++)
|
|
194
194
|
{
|
|
195
|
-
let tmpRecord = tmpRecordSet[l];
|
|
195
|
+
let tmpRecord = tmpRecordSet[tmpRecordSetKeys[l]];
|
|
196
196
|
tmpSolver.ResultsObject = {};
|
|
197
197
|
let tmpSolutionValue = tmpView.fable.ExpressionParser.solve(tmpSolver.Expression, tmpRecord, tmpSolver.ResultsObject, tmpGroup.supportingManifest, tmpRecord);
|
|
198
198
|
if (this.pict.LogNoisiness > 1)
|
|
@@ -201,7 +201,7 @@ class PictDynamicSolver extends libPictProvider
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
tmpSolver.EndTimeStamp =
|
|
204
|
+
tmpSolver.EndTimeStamp = Date.now();
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -15,7 +15,7 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
15
15
|
|
|
16
16
|
/** @type {import('pict')} */
|
|
17
17
|
this.pict;
|
|
18
|
-
/** @type {import('pict') & { Math: any }} */
|
|
18
|
+
/** @type {import('pict') & { Math: any } & { DataFormat: any }} */
|
|
19
19
|
this.fable;
|
|
20
20
|
/** @type {any} */
|
|
21
21
|
this.log;
|
|
@@ -42,6 +42,11 @@ class CustomInputHandler extends libPictSectionInputExtension
|
|
|
42
42
|
tmpValue = this.fable.Math.roundPrecise(tmpValue, pInput.PictForm.DecimalPrecision, tmpRoundingMethod);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
if (('AddCommas' in pInput.PictForm) && pInput.PictForm.AddCommas)
|
|
46
|
+
{
|
|
47
|
+
tmpValue = this.fable.DataFormat.formatterAddCommasToNumber(tmpValue);
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
if ('DigitsPrefix' in pInput.PictForm)
|
|
46
51
|
{
|
|
47
52
|
tmpValue = pInput.PictForm.DigitsPrefix + tmpValue;
|
|
@@ -10,9 +10,11 @@ declare class CustomInputHandler extends libPictSectionInputExtension {
|
|
|
10
10
|
constructor(pFable: any, pOptions: any, pServiceHash: any);
|
|
11
11
|
/** @type {import('pict')} */
|
|
12
12
|
pict: import("pict");
|
|
13
|
-
/** @type {import('pict') & { Math: any }} */
|
|
13
|
+
/** @type {import('pict') & { Math: any } & { DataFormat: any }} */
|
|
14
14
|
fable: import("pict") & {
|
|
15
15
|
Math: any;
|
|
16
|
+
} & {
|
|
17
|
+
DataFormat: any;
|
|
16
18
|
};
|
|
17
19
|
/** @type {any} */
|
|
18
20
|
log: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pict-Provider-Input-PreciseNumber.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-PreciseNumber.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,
|
|
1
|
+
{"version":3,"file":"Pict-Provider-Input-PreciseNumber.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-PreciseNumber.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,mEAAmE;IACnE,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,GAAG,CAAA;KAAE,CACrD;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IAGT,0CAoCC;IAED;;;;;;;;;;OAUG;IACH,6EAJW,GAAG,iBACH,MAAM,GACJ,OAAO,CAMnB;IAED;;;;;;;;;;OAUG;IACH,yEALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAMf;CACD"}
|