Commit 15cf7db5 by Cam Hayes

Fixed pdf generation issue

parent 2702ac1c
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
"AuthUrl" : "https://webapps.em-sys.net/kgOrders/auth/", "AuthUrl" : "https://webapps.em-sys.net/kgOrders/auth/",
"ApiUrl" : "https://webapps.em-sys.net/kgOrders/api/" "ApiUrl" : "https://webapps.em-sys.net/kgOrders/api/"
} }
...@@ -156,15 +156,19 @@ var ...@@ -156,15 +156,19 @@ var
colorArray: TJSONArray; colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject; colorsObject, colorObject: TJSONObject;
colorsString: string; colorsString: string;
i, maxColors: Integer; i, maxColors, totalColors: Integer;
begin begin
logger.Log( 5, 'TrptOrderCorrugated.PopulateColorTable' ); logger.Log( 5, 'TrptOrderCorrugated.PopulateColorTable' );
maxColors := 13; maxColors := 13;
colorsString := uqOrderCorrugated.FieldByName('colors_colors').AsString; colorsString := uqOrderCorrugated.FieldByName('colors_colors').AsString;
colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject; colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject;
colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items')); colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items'));
totalColors := colorArray.Count;
for i := 0 to maxColors - 1 do if totalColors > maxColors then
totalColors := maxColors;
for i := 0 to totalColors - 1 do
begin begin
row := frxOrderCorrugated.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow; row := frxOrderCorrugated.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow;
colorObject := colorArray.Items[i] as TJSONObject; colorObject := colorArray.Items[i] as TJSONObject;
......
...@@ -155,7 +155,7 @@ var ...@@ -155,7 +155,7 @@ var
colorArray: TJSONArray; colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject; colorsObject, colorObject: TJSONObject;
colorsString: string; colorsString: string;
i, maxColors: Integer; i, maxColors, totalColors: Integer;
begin begin
maxColors := 10; maxColors := 10;
logger.Log( 5, 'TrptOrderWeb.PopulateColorTable' ); logger.Log( 5, 'TrptOrderWeb.PopulateColorTable' );
...@@ -163,8 +163,12 @@ begin ...@@ -163,8 +163,12 @@ begin
colorsString := uqOrderWeb.FieldByName('quantity_and_colors_qty_colors').AsString; colorsString := uqOrderWeb.FieldByName('quantity_and_colors_qty_colors').AsString;
colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject; colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject;
colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items')); colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items'));
totalColors := colorArray.Count;
for i := 0 to maxColors - 1 do if totalColors > maxColors then
totalColors := maxColors;
for i := 0 to totalColors - 1 do
begin begin
row := frxOrderWeb.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow; row := frxOrderWeb.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow;
colorObject := colorArray.Items[i] as TJSONObject; colorObject := colorArray.Items[i] as TJSONObject;
......
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