Commit 1e9dbe96 by cam

Adding orders is now fully functional and fixed colors so it matched the database

parent fcb79526
...@@ -241,6 +241,7 @@ object FOrderEntry: TFOrderEntry ...@@ -241,6 +241,7 @@ object FOrderEntry: TFOrderEntry
Top = 92 Top = 92
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcompanyname' ElementID = 'edtcompanyname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -254,6 +255,7 @@ object FOrderEntry: TFOrderEntry ...@@ -254,6 +255,7 @@ object FOrderEntry: TFOrderEntry
Top = 120 Top = 120
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaccountcompanyname' ElementID = 'edtaccountcompanyname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -266,6 +268,7 @@ object FOrderEntry: TFOrderEntry ...@@ -266,6 +268,7 @@ object FOrderEntry: TFOrderEntry
Top = 148 Top = 148
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinquickbooks' ElementID = 'edtinquickbooks'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -278,6 +281,7 @@ object FOrderEntry: TFOrderEntry ...@@ -278,6 +281,7 @@ object FOrderEntry: TFOrderEntry
Top = 314 Top = 314
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtshipvia' ElementID = 'edtshipvia'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -290,6 +294,7 @@ object FOrderEntry: TFOrderEntry ...@@ -290,6 +294,7 @@ object FOrderEntry: TFOrderEntry
Top = 346 Top = 346
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtquantity' ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -314,6 +319,7 @@ object FOrderEntry: TFOrderEntry ...@@ -314,6 +319,7 @@ object FOrderEntry: TFOrderEntry
Top = 402 Top = 402
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinvoiceto' ElementID = 'edtinvoiceto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -326,6 +332,7 @@ object FOrderEntry: TFOrderEntry ...@@ -326,6 +332,7 @@ object FOrderEntry: TFOrderEntry
Top = 430 Top = 430
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtshipto' ElementID = 'edtshipto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -338,6 +345,7 @@ object FOrderEntry: TFOrderEntry ...@@ -338,6 +345,7 @@ object FOrderEntry: TFOrderEntry
Top = 458 Top = 458
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtponumber' ElementID = 'edtponumber'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -350,6 +358,7 @@ object FOrderEntry: TFOrderEntry ...@@ -350,6 +358,7 @@ object FOrderEntry: TFOrderEntry
Top = 486 Top = 486
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobname' ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -362,6 +371,7 @@ object FOrderEntry: TFOrderEntry ...@@ -362,6 +371,7 @@ object FOrderEntry: TFOrderEntry
Top = 514 Top = 514
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtquickbooksitem' ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -386,6 +396,7 @@ object FOrderEntry: TFOrderEntry ...@@ -386,6 +396,7 @@ object FOrderEntry: TFOrderEntry
Top = 314 Top = 314
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdimensionallayout' ElementID = 'edtdimensionallayout'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -398,6 +409,7 @@ object FOrderEntry: TFOrderEntry ...@@ -398,6 +409,7 @@ object FOrderEntry: TFOrderEntry
Top = 368 Top = 368
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtemail' ElementID = 'edtemail'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -410,6 +422,7 @@ object FOrderEntry: TFOrderEntry ...@@ -410,6 +422,7 @@ object FOrderEntry: TFOrderEntry
Top = 390 Top = 390
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtftp' ElementID = 'edtftp'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -422,6 +435,7 @@ object FOrderEntry: TFOrderEntry ...@@ -422,6 +435,7 @@ object FOrderEntry: TFOrderEntry
Top = 418 Top = 418
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtother' ElementID = 'edtother'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -434,6 +448,7 @@ object FOrderEntry: TFOrderEntry ...@@ -434,6 +448,7 @@ object FOrderEntry: TFOrderEntry
Top = 446 Top = 446
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtexistingcuttingdie' ElementID = 'edtexistingcuttingdie'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -446,6 +461,7 @@ object FOrderEntry: TFOrderEntry ...@@ -446,6 +461,7 @@ object FOrderEntry: TFOrderEntry
Top = 474 Top = 474
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrefartprintcard' ElementID = 'edtrefartprintcard'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -458,6 +474,7 @@ object FOrderEntry: TFOrderEntry ...@@ -458,6 +474,7 @@ object FOrderEntry: TFOrderEntry
Top = 508 Top = 508
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrefartapdf' ElementID = 'edtrefartapdf'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -470,6 +487,7 @@ object FOrderEntry: TFOrderEntry ...@@ -470,6 +487,7 @@ object FOrderEntry: TFOrderEntry
Top = 207 Top = 207
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcadfile' ElementID = 'edtcadfile'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -482,6 +500,7 @@ object FOrderEntry: TFOrderEntry ...@@ -482,6 +500,7 @@ object FOrderEntry: TFOrderEntry
Top = 179 Top = 179
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaroundno' ElementID = 'edtaroundno'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -494,6 +513,7 @@ object FOrderEntry: TFOrderEntry ...@@ -494,6 +513,7 @@ object FOrderEntry: TFOrderEntry
Top = 151 Top = 151
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtacrossno' ElementID = 'edtacrossno'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -506,6 +526,7 @@ object FOrderEntry: TFOrderEntry ...@@ -506,6 +526,7 @@ object FOrderEntry: TFOrderEntry
Top = 123 Top = 123
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdiecutno' ElementID = 'edtdiecutno'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -518,6 +539,7 @@ object FOrderEntry: TFOrderEntry ...@@ -518,6 +539,7 @@ object FOrderEntry: TFOrderEntry
Top = 95 Top = 95
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscd' ElementID = 'edtrscd'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -530,6 +552,7 @@ object FOrderEntry: TFOrderEntry ...@@ -530,6 +552,7 @@ object FOrderEntry: TFOrderEntry
Top = 64 Top = 64
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscw' ElementID = 'edtrscw'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -542,6 +565,7 @@ object FOrderEntry: TFOrderEntry ...@@ -542,6 +565,7 @@ object FOrderEntry: TFOrderEntry
Top = 39 Top = 39
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscl' ElementID = 'edtrscl'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -554,6 +578,7 @@ object FOrderEntry: TFOrderEntry ...@@ -554,6 +578,7 @@ object FOrderEntry: TFOrderEntry
Top = 506 Top = 506
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcustomadhesive' ElementID = 'edtcustomadhesive'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -566,6 +591,7 @@ object FOrderEntry: TFOrderEntry ...@@ -566,6 +591,7 @@ object FOrderEntry: TFOrderEntry
Top = 478 Top = 478
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcustombacking' ElementID = 'edtcustombacking'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -578,6 +604,7 @@ object FOrderEntry: TFOrderEntry ...@@ -578,6 +604,7 @@ object FOrderEntry: TFOrderEntry
Top = 450 Top = 450
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtstandardsetup' ElementID = 'edtstandardsetup'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -590,6 +617,7 @@ object FOrderEntry: TFOrderEntry ...@@ -590,6 +617,7 @@ object FOrderEntry: TFOrderEntry
Top = 430 Top = 430
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtstripmount' ElementID = 'edtstripmount'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -602,6 +630,7 @@ object FOrderEntry: TFOrderEntry ...@@ -602,6 +630,7 @@ object FOrderEntry: TFOrderEntry
Top = 334 Top = 334
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtloose' ElementID = 'edtloose'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -614,6 +643,7 @@ object FOrderEntry: TFOrderEntry ...@@ -614,6 +643,7 @@ object FOrderEntry: TFOrderEntry
Top = 261 Top = 261
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscstyle' ElementID = 'edtrscstyle'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -626,6 +656,7 @@ object FOrderEntry: TFOrderEntry ...@@ -626,6 +656,7 @@ object FOrderEntry: TFOrderEntry
Top = 458 Top = 458
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofother' ElementID = 'edtproofother'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -638,6 +669,7 @@ object FOrderEntry: TFOrderEntry ...@@ -638,6 +669,7 @@ object FOrderEntry: TFOrderEntry
Top = 328 Top = 328
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofshipto' ElementID = 'edtproofshipto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -650,6 +682,7 @@ object FOrderEntry: TFOrderEntry ...@@ -650,6 +682,7 @@ object FOrderEntry: TFOrderEntry
Top = 300 Top = 300
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtemailattn' ElementID = 'edtemailattn'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -662,6 +695,7 @@ object FOrderEntry: TFOrderEntry ...@@ -662,6 +695,7 @@ object FOrderEntry: TFOrderEntry
Top = 272 Top = 272
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofemail' ElementID = 'edtproofemail'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -674,6 +708,7 @@ object FOrderEntry: TFOrderEntry ...@@ -674,6 +708,7 @@ object FOrderEntry: TFOrderEntry
Top = 244 Top = 244
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtfaxattn' ElementID = 'edtfaxattn'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -686,6 +721,7 @@ object FOrderEntry: TFOrderEntry ...@@ -686,6 +721,7 @@ object FOrderEntry: TFOrderEntry
Top = 219 Top = 219
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtfax' ElementID = 'edtfax'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -698,6 +734,7 @@ object FOrderEntry: TFOrderEntry ...@@ -698,6 +734,7 @@ object FOrderEntry: TFOrderEntry
Top = 117 Top = 117
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtclemson' ElementID = 'edtclemson'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -710,6 +747,7 @@ object FOrderEntry: TFOrderEntry ...@@ -710,6 +747,7 @@ object FOrderEntry: TFOrderEntry
Top = 89 Top = 89
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcrosshairs' ElementID = 'edtcrosshairs'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -722,6 +760,7 @@ object FOrderEntry: TFOrderEntry ...@@ -722,6 +760,7 @@ object FOrderEntry: TFOrderEntry
Top = 64 Top = 64
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtmachineindent' ElementID = 'edtmachineindent'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -734,6 +773,7 @@ object FOrderEntry: TFOrderEntry ...@@ -734,6 +773,7 @@ object FOrderEntry: TFOrderEntry
Top = 39 Top = 39
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcylindersize' ElementID = 'edtcylindersize'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -746,6 +786,7 @@ object FOrderEntry: TFOrderEntry ...@@ -746,6 +786,7 @@ object FOrderEntry: TFOrderEntry
Top = 105 Top = 105
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobnumber' ElementID = 'edtjobnumber'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -758,6 +799,7 @@ object FOrderEntry: TFOrderEntry ...@@ -758,6 +799,7 @@ object FOrderEntry: TFOrderEntry
Top = 72 Top = 72
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtplatematerial' ElementID = 'edtplatematerial'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -770,6 +812,7 @@ object FOrderEntry: TFOrderEntry ...@@ -770,6 +812,7 @@ object FOrderEntry: TFOrderEntry
Top = 39 Top = 39
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtThickness' ElementID = 'edtThickness'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -974,6 +1017,7 @@ object FOrderEntry: TFOrderEntry ...@@ -974,6 +1017,7 @@ object FOrderEntry: TFOrderEntry
Top = 185 Top = 185
Width = 121 Width = 121
Height = 22 Height = 22
AutoSize = True
ChildOrder = 78 ChildOrder = 78
ElementID = 'edtspecialinstructions' ElementID = 'edtspecialinstructions'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
......
...@@ -195,6 +195,7 @@ type ...@@ -195,6 +195,7 @@ type
procedure WebButton1Click(Sender: TObject); procedure WebButton1Click(Sender: TObject);
procedure addColorRow(num, Color, LPI, Size: string); procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
private private
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
...@@ -222,12 +223,15 @@ var ...@@ -222,12 +223,15 @@ var
colorCollection: TJSHTMLCollection; colorCollection: TJSHTMLCollection;
color: TJSHTMLElement; color: TJSHTMLElement;
I, J: integer; I, J: integer;
colorJSON: TJSONObject; colorJSON, orderJSON, colorListJSON: TJSONObject;
fieldNames: TStringList; fieldNames: TStringList;
itemList: TJSNodeList; itemList: TJSNodeList;
header, value: string; header, value: string;
Field: TField;
Response: TXDataClientResponse;
begin begin
//TJSONObject.Create; //TJSONObject.Create;
orderJSON := TJSONObject.Create;
colorList := TJSONArray.Create; colorList := TJSONArray.Create;
container := document.getElementById('additionalFields'); container := document.getElementById('additionalFields');
colorCollection := container.children; colorCollection := container.children;
...@@ -243,8 +247,40 @@ begin ...@@ -243,8 +247,40 @@ begin
colorJSON.AddPair(header, value); colorJSON.AddPair(header, value);
end; end;
colorList.Add(colorJSON); colorList.Add(colorJSON);
colorListJSON := TJSONObject.Create;
colorListJSON.AddPair('items', colorList);
end;
XDataWebDataSet1.Edit;
XDataWebDataSet1colors_colors.Value := colorListJSON.ToString;
XDataWebDataSet1.Post;
XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do
begin
for Field in XDataWebDataSet1.Fields do
begin
if Field is TStringField then
begin
if Field.AsString = '' then
orderJSON.AddPair(Field.FieldName, '')
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
end;
XDataWebDataSet1.Next;
end; end;
console.log(colorList.ToString); orderJSON.AddPair('COMPANY_ID', '749');
orderJSON.AddPair('USER_ID', '1011');
AddCorrugatedOrder(orderJSON);
end;
procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject);
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder',
[orderJSON.ToString]));
console.log(Response);
end; end;
class function TFOrderEntry.CreateForm(AElementID, orderInfo: string): TWebForm; class function TFOrderEntry.CreateForm(AElementID, orderInfo: string): TWebForm;
...@@ -336,11 +372,13 @@ var ...@@ -336,11 +372,13 @@ var
data: TJSArray; data: TJSArray;
order: TJSObject; order: TJSObject;
callListLength: integer; callListLength: integer;
tempString: string; tempString, strColorList: string;
colorObject: TJSObject; colorObject: TJSObject;
colorList: TJSArray; colorList: TJSArray;
colorLength: integer; colorLength: integer;
color: TJSObject; color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder',
[Order_ID])); [Order_ID]));
...@@ -349,15 +387,16 @@ begin ...@@ -349,15 +387,16 @@ begin
XDataWebDataSet1.Close; XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order); XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open; XDataWebDataSet1.Open;
if XDataWebDataSet1colors_colors.Value <> '' then
begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors_colors.Value)); colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors_colors.Value));
console.log(order);
colorList := TJSArray(colorObject['items']); colorList := TJSArray(colorObject['items']);
colorLength := colorList.length; for I := 0 to colorList.length -1 do
for i := 0 to colorLength - 1 do
begin begin
color := TJSObject(colorList[i]); color := TJSObject(colorList[i]);
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size'])); addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size']));
end; end;
end;
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value); dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value);
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
......
...@@ -9,10 +9,11 @@ unit View.Orders; ...@@ -9,10 +9,11 @@ unit View.Orders;
interface interface
uses uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WebAudio; ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type type
TFViewOrders = class(TWebForm) TFViewOrders = class(TWebForm)
...@@ -81,8 +82,7 @@ var ...@@ -81,8 +82,7 @@ var
implementation implementation
uses uses
JS, XData.Model.Classes, XData.Model.Classes, View.Main;
ConnectionModule, Auth.Service, View.Main;
{$R *.dfm} {$R *.dfm}
...@@ -129,9 +129,10 @@ var ...@@ -129,9 +129,10 @@ var
NewRow, Cell, P, Button, Audio: TJSHTMLElement; NewRow, Cell, P, Button, Audio: TJSHTMLElement;
colorObject: TJSObject; colorObject: TJSObject;
colorList: TJSArray; colorList: TJSArray;
colorListJSON: TJSONArray;
colors: integer; colors: integer;
ClickHandler: TJSFunction; ClickHandler: TJSFunction;
id: string; id, strColorList: string;
begin begin
NewRow := TJSHTMLElement(document.createElement('tr')); NewRow := TJSHTMLElement(document.createElement('tr'));
NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value; NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
...@@ -294,6 +295,7 @@ begin ...@@ -294,6 +295,7 @@ begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors.Value)); colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors.Value));
colorList := TJSArray(colorObject['items']); colorList := TJSArray(colorObject['items']);
colors := colorList.flength; colors := colorList.flength;
console.log(colorList);
Cell.innerText := IntToStr(colors); Cell.innerText := IntToStr(colors);
end; end;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
......
...@@ -192,6 +192,7 @@ type ...@@ -192,6 +192,7 @@ type
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function DelUser(username: string): string; function DelUser(username: string): string;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
end; end;
implementation implementation
......
...@@ -273,6 +273,7 @@ begin ...@@ -273,6 +273,7 @@ begin
result.staff_fields_quickbooks_item := ordersDB.UniQuery1.FieldByName('staff_fields_quickbooks_item').AsString; result.staff_fields_quickbooks_item := ordersDB.UniQuery1.FieldByName('staff_fields_quickbooks_item').AsString;
result.staff_fields_art_due := ordersDB.UniQuery1.FieldByName('staff_fields_art_due').AsString; result.staff_fields_art_due := ordersDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
result.staff_fields_plate_due := ordersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString; result.staff_fields_plate_due := ordersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString;
result.staff_fields_price := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString;
if orderType = 'corrugated_plate_order' then if orderType = 'corrugated_plate_order' then
result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString; result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString;
result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString; result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
...@@ -604,6 +605,7 @@ var ...@@ -604,6 +605,7 @@ var
Pair: TJSONPair; Pair: TJSONPair;
Field: TField; Field: TField;
DateFormat: TFormatSettings; DateFormat: TFormatSettings;
CurrDate: TDateTime;
begin begin
DateFormat := TFormatSettings.Create; DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd'; DateFormat.ShortDateFormat := 'yyyy-mm-dd';
...@@ -611,9 +613,9 @@ begin ...@@ -611,9 +613,9 @@ begin
JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject; JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject;
if JSONData = nil then if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + JSONData.GetValue('ORDER_ID').Value; SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
if( ordersDB.UniQuery1.IsEmpty ) then if( True ) then
begin begin
try try
ordersDB.UniQuery1.Insert; ordersDB.UniQuery1.Insert;
...@@ -624,7 +626,7 @@ begin ...@@ -624,7 +626,7 @@ begin
begin begin
// handles any dates or datetimes // handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDateTime(Pair.JsonValue.Value, DateFormat) TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value; Field.AsString := Pair.JsonValue.Value;
end; end;
...@@ -633,6 +635,23 @@ begin ...@@ -633,6 +635,23 @@ begin
// Post the new record to the database // Post the new record to the database
ordersDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
SQL := 'select * from orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsString := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString := 'corrugated_plate';
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now;
if JSONData.GetValue<string>('staff_fields_price') = '' then
ordersDB.UniQuery1.FieldByName('PRICE').AsString := '0'
else
ordersDB.UniQuery1.FieldByName('PRICE').AsString := JSONData.GetValue<string>('staff_fields_price');
ordersDB.UniQuery1.FieldByName('JOB_NAME').AsString := JSONData.GetValue<string>('staff_fields_job_name');
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := JSONData.GetValue<string>('USER_ID');
ordersDB.UniQuery1.FieldByName('LOCATION').AsString := JSONData.GetValue<string>('staff_fields_art_location');
ordersDB.UniQuery1.Post;
Result := TJSONObject.Create.AddPair('status', 'success'); Result := TJSONObject.Create.AddPair('status', 'success');
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result); TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
except except
......
[Options] [Options]
LogFileNum=142 LogFileNum=168
UpdateTimerLength=0 UpdateTimerLength=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment