Commit bb24c447 by Cam Hayes

Fixed PDF formatting and changed access rights for the user page to admin only

parent b230b517
......@@ -87,6 +87,7 @@ uses
procedure TFViewMain.WebFormCreate(Sender: TObject);
var
userName: string;
test: boolean;
begin
FUserInfo := GetUserInfo;
userName := JS.toString(AuthService.TokenPayload.Properties['user_name']);
......@@ -94,10 +95,8 @@ begin
FChildForm := nil;
change := false;
if (not (JS.toBoolean(AuthService.TokenPayload.Properties['user_admin']))) then
lblUsers.Visible := false;
lblUsers.enabled := false;
//Change this later
lblUsers.Visible := true;
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion;
......
......@@ -418,7 +418,7 @@ var
begin
try
// Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCorrugatedPDF', [orderID]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCorrugatedPDF', [xdwdsOrder.FieldByName('ORDER_ID').AsString]));
jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']);
......
object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Width = 956
Height = 728
OnCreate = WebFormCreate
object WebLabel2: TWebLabel
Left = 24
Top = 71
......
......@@ -504,7 +504,7 @@ var
begin
try
// Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderWebPDF', [orderID]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderWebPDF', [xdwdsOrder.FieldByName('ORDER_ID').AsString]));
jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']);
......
......@@ -241,61 +241,61 @@ object FViewOrders: TFViewOrders
ItemIndex = -1
LookupValues = <
item
Value = 'o.ORDER_ID DESC'
DisplayText = 'ID'
Value = 'o.ORDER_ID'
DisplayText = 'Order Num'
end
item
Value = 'c.NAME ASC'
Value = 'c.NAME'
DisplayText = 'Company Name'
end
item
Value = 'o.JOB_NAME ASC'
Value = 'o.JOB_NAME'
DisplayText = 'Job Name'
end
item
Value =
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
'e, cdo.staff_fields_order_date)'
DisplayText = 'Order Date'
end
item
Value = 'PROOF_DUE DESC'
Value = 'PROOF_DUE'
DisplayText = 'Proof Due'
end
item
Value = 'PROOF_DONE DESC'
Value = 'PROOF_DONE'
DisplayText = 'Proof Done'
end
item
Value = 'ART_DUE DESC'
Value = 'ART_DUE'
DisplayText = 'Art Due'
end
item
Value = 'ART_DONE DESC'
Value = 'ART_DONE'
DisplayText = 'Art Done'
end
item
Value = 'PLATE_DUE DESC'
Value = 'PLATE_DUE'
DisplayText = 'Plate Due'
end
item
Value = 'PLATE_DONE DESC'
Value = 'PLATE_DONE'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT_DUE DESC'
Value = 'MOUNT_DUE'
DisplayText = 'Mount Due'
end
item
Value = 'MOUNT_DONE DESC'
Value = 'MOUNT_DONE'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP_DUE DESC'
Value = 'SHIP_DUE'
DisplayText = 'Ship Due'
end
item
Value = 'SHIP_DONE DESC'
Value = 'SHIP_DONE'
DisplayText = 'Ship Done'
end>
end
......@@ -313,6 +313,22 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnOrderBy: TWebButton
Left = 339
Top = 46
Width = 96
Height = 25
Caption = 'Descending'
ChildOrder = 9
ElementID = 'btnorderby'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 100
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnOrderByClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
......
......@@ -2,28 +2,42 @@
<!-- Actions Row -->
<div class="row mt-2 justify-content-center">
<div class="col-auto d-flex align-items-center">
<label class="mt-3" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
<label class="mt-3" style="font-weight: 700;">
Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries
</label>
</div>
<div class="col-auto d-flex align-items-center">
<label class="mt-3" style="font-weight: 700;">Order By: <select class="custom-select" id="wlcborderby" style="font-size: 1.00rem;"></select></label>
<label class="mt-3" style="font-weight: 700;">
Order By: <select class="custom-select" id="wlcborderby" style="font-size: 1.00rem;"></select>
</label>
</div>
<div class="col-auto">
<button id="btnorderby" class="btn btn-secondary mt-3">Descending <i class="fa fa-arrow-down"></i></button>
</div>
<div class="col-auto">
<button id="btnaddorder" class="btn btn-secondary mt-3">Add Order</button>
</div>
<div class="col-auto">
<button id="btnsetstatus" class="btn btn-secondary mt-3">Set Status</button>
</div>
<div class="col-auto">
<button id="btngeneratepdf" class="btn btn-secondary mt-3" type="button">Generate PDF</button>
<div class="invalid-feedback">
No order selected. Please select an order to generate a PDF.
</div>
</div>
<div class="col-auto">
<button id="btnfilters" class="btn btn-secondary mt-3">Filters</button>
</div>
</div>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
<div class="row">
<div class="col-auto">
......
......@@ -59,6 +59,7 @@ type
tmrReturn: TWebTimer;
xdwdsOrdersIN_QB: TStringField;
xdwdsOrdersqbRefNum: TStringField;
btnOrderBy: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -71,6 +72,7 @@ type
procedure WebButton1Click(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject);
[async] procedure GenerateReportPDFAsync(APdfTab: TJSWindow);
procedure btnOrderByClick(Sender: TObject);
private
FChildForm: TWebForm;
FPendingPdfTab: TJSWindow;
......@@ -108,6 +110,7 @@ type
null2: boolean;
OrderBy: string;
direction: string;
filters: boolean;
info: string;
row: integer;
......@@ -143,6 +146,26 @@ begin
end;
procedure TFViewOrders.btnOrderByClick(Sender: TObject);
var
btn: TJSHTMLElement;
begin
btn := document.getElementById('btnorderby') as TJSHTMLElement;
if btnOrderBy.Caption = 'Ascending' then
begin
btnOrderBy.Caption := 'Descending';
btn.innerHTML := 'Descending <i class="fa fa-arrow-down"></i>';
direction := 'DESC';
end
else
begin
btnOrderBy.Caption := 'Ascending';
btn.innerHTML := 'Ascending <i class="fa fa-arrow-up"></i>';
direction := 'ASC';
end;
getOrders(generateSearchOptions());
end;
procedure TFViewOrders.btnPDFClick(Sender: TObject);
begin
if xdwdsOrders.RecordCount >= 100 then
......@@ -230,7 +253,6 @@ begin
[searchOptions]));
jsObject := TJSObject(xdcResponse.Result);
pdfURL := String(jsObject.Properties['value']);
console.log(pdfURL);
if Assigned(APdfTab) then
APdfTab.location.href := pdfURL;
except
......@@ -268,7 +290,6 @@ begin
DMConnection.ApiConnection.Connected := True;
PageNumber := 1;
TotalPages := 1; // Initial total pages
console.log(FViewMain.search = '');
if FViewMain.search = '' then
begin
//Status 1
......@@ -289,7 +310,8 @@ begin
wcbPageSize.Text := '500';
PageSize := 500;
wlcbOrderBy.DisplayText := 'Order Date';
OrderBy := 'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date) DESC';
OrderBy := 'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date)';
direction := 'DESC';
end
else
begin
......@@ -303,6 +325,7 @@ begin
PageSize := StrToInt(params.Values['pagesize']);
wcbPageSize.Text := IntToStr(PageSize);
OrderBy := params.Values['orderby'];
direction := params.Values['direction'];
wlcbOrderBy.DisplayText := OrderBy;
statusOrderType := params.Values['orderType'].ToLower();
statusOrderID := params.Values['orderID'];
......@@ -341,7 +364,6 @@ end;
procedure TFViewOrders.wlcbOrderByChange(Sender: TObject);
begin
//console.log(wlcbOrderBy.Value);
OrderBy := wlcbOrderBy.Value;
getOrders(generateSearchOptions());
end;
......@@ -477,12 +499,12 @@ begin
StatusJSON.AddPair('ORDER_ID', StatusOrderID);
StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date));
StatusJSON.AddPair('status', newform.wlcbStatus.Value);
StatusJSON.AddPair('USER_ID', 1011);
StatusJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
StatusJSON.AddPair('mode', 'EDIT');
StatusJSON.AddPair('staff_fields_ship_date', DateToStr(newForm.dtpNewShipDue.Date));
StatusJSON.AddPair('staff_fields_mount_due', DateToStr(newForm.dtpNewMountDue.Date));
StatusJSON.AddPair('staff_fields_plate_due', DateToStr(newForm.dtpNewPlateDue.Date));
StatusJSON.AddPair('staff_fields_art_due', DateToStr(newForm.dtpNewArtDue.Date));
StatusJSON.AddPair('staff_fields_ship_date', DateToStr(newForm.dtpShipDue.Date));
StatusJSON.AddPair('staff_fields_mount_due', DateToStr(newForm.dtpMountDue.Date));
StatusJSON.AddPair('staff_fields_plate_due', DateToStr(newForm.dtpPlateDue.Date));
StatusJSON.AddPair('staff_fields_art_due', DateToStr(newForm.dtpArtDue.Date));
StatusJSON.AddPair('OrderType', NewForm.OrderType);
......@@ -825,7 +847,8 @@ searchOptions: string;
begin
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy;
'&orderby=' + OrderBy +
'&direction=' + direction;
//Status 1
if ( (filterType1 <> '') and (filterType1 <> 'NONE') ) then
......
......@@ -111,7 +111,11 @@ var
DateFormatSettings: TFormatSettings;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
dtpStartDate1.Date := 0;
dtpStartDate2.Date := 0;
dtpEndDate1.Date := 0;
dtpEndDate2.Date := 0;
{params.StrictDelimiter := true;
params.Delimiter := '&';
params.DelimitedText := searchOptions;
confirm := false;
......@@ -175,7 +179,7 @@ begin
dtpStartDate2.Visible := false;
dtpEndDate2.Visible := false;
end;
end;
end; }
getCustomers();
......@@ -191,6 +195,7 @@ procedure TFSearch.btnClearClick(Sender: TObject);
begin
edtOrderID.Text := '';
edtCompanyID.Text := '';
edtCompanyName.Text := '';
edtSearch.Text := '';
edtJobName.Text := '';
wcbOrderType.Text := 'Any';
......@@ -206,6 +211,7 @@ begin
dtpStartDate2.Visible := true;
dtpEndDate1.Visible := true;
dtpEndDate2.Visible := true;
DBID := '';
end;
procedure TFSearch.btnConfirmClick(Sender: TObject);
......
object FSetStatus: TFSetStatus
Width = 640
Height = 278
Width = 331
Height = 294
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 328
Top = 32
Left = 16
Top = 61
Width = 38
Height = 14
Caption = 'Status:'
......@@ -18,8 +18,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 486
Top = 32
Left = 174
Top = 61
Width = 91
Height = 14
Caption = 'Date Completed:'
......@@ -34,10 +34,10 @@ object FSetStatus: TFSetStatus
end
object WebLabel2: TWebLabel
Left = 16
Top = 32
Width = 48
Top = 14
Width = 63
Height = 14
Caption = 'Order ID:'
Caption = 'Order Num:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
......@@ -49,7 +49,7 @@ object FSetStatus: TFSetStatus
end
object WebLabel3: TWebLabel
Left = 174
Top = 30
Top = 14
Width = 57
Height = 14
Caption = 'Job Name:'
......@@ -62,9 +62,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 13
Top = 94
object lblShip: TWebLabel
Left = 110
Top = 196
Width = 51
Height = 14
Caption = 'Ship Due:'
......@@ -77,24 +77,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 171
Top = 94
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblMount: TWebLabel
Left = 326
Top = 152
Left = 99
Top = 168
Width = 62
Height = 14
Caption = 'Mount Due:'
......@@ -107,24 +92,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblMountNew: TWebLabel
Left = 484
Top = 152
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblPlate: TWebLabel
Left = 13
Top = 152
Left = 107
Top = 140
Width = 54
Height = 14
Caption = 'Plate Due:'
......@@ -137,24 +107,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblPlateNew: TWebLabel
Left = 171
Top = 152
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblArt: TWebLabel
Left = 326
Top = 94
Left = 117
Top = 112
Width = 44
Height = 14
Caption = 'Art Due:'
......@@ -167,36 +122,22 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblArtNew: TWebLabel
Left = 484
Top = 94
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object wlcbStatus: TWebLookupComboBox
Left = 328
Top = 52
Left = 16
Top = 80
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementID = 'wlc_status'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wlcbStatusChange
ItemIndex = -1
LookupValues = <>
end
object dtpDate: TWebDateTimePicker
Left = 486
Top = 52
Left = 174
Top = 80
Width = 145
Height = 22
ElementID = 'dtpdate'
......@@ -206,13 +147,14 @@ object FSetStatus: TFSetStatus
Date = 45665.641243414350000000
Role = ''
Text = ''
OnChange = dtpDateChange
end
object btnConfirm: TWebButton
Left = 16
Top = 225
Left = 114
Top = 235
Width = 96
Height = 25
Caption = 'Confirm'
Caption = 'Save'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
......@@ -224,8 +166,8 @@ object FSetStatus: TFSetStatus
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 127
Top = 225
Left = 223
Top = 235
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -241,7 +183,7 @@ object FSetStatus: TFSetStatus
end
object edtOrderID: TWebEdit
Left = 16
Top = 52
Top = 34
Width = 145
Height = 22
HelpType = htKeyword
......@@ -263,7 +205,7 @@ object FSetStatus: TFSetStatus
end
object edtJobName: TWebEdit
Left = 174
Top = 52
Top = 34
Width = 145
Height = 22
HelpType = htKeyword
......@@ -284,21 +226,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object dtpShipDue: TWebDateTimePicker
Left = 13
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewShipDue: TWebDateTimePicker
Left = 171
Top = 114
Left = 174
Top = 192
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -309,21 +238,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpMountDue: TWebDateTimePicker
Left = 326
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewMountDue: TWebDateTimePicker
Left = 484
Top = 172
Left = 174
Top = 164
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -334,21 +250,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpPlateDue: TWebDateTimePicker
Left = 13
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewPlateDue: TWebDateTimePicker
Left = 171
Top = 172
Left = 174
Top = 136
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -359,21 +262,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpArtDue: TWebDateTimePicker
Left = 326
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewArtDue: TWebDateTimePicker
Left = 484
Top = 114
Left = 174
Top = 108
Width = 145
Height = 22
BorderStyle = bsSingle
......
......@@ -5,7 +5,7 @@ interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.ExtCtrls,
WEBLib.StdCtrls, Utils;
WEBLib.StdCtrls, Utils, System.DateUtils;
type
TFSetStatus = class(TWebForm)
......@@ -19,28 +19,24 @@ type
edtOrderID: TWebEdit;
edtJobName: TWebEdit;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
lblShip: TWebLabel;
dtpShipDue: TWebDateTimePicker;
WebLabel5: TWebLabel;
dtpNewShipDue: TWebDateTimePicker;
lblMount: TWebLabel;
dtpMountDue: TWebDateTimePicker;
lblMountNew: TWebLabel;
dtpNewMountDue: TWebDateTimePicker;
lblPlate: TWebLabel;
dtpPlateDue: TWebDateTimePicker;
lblPlateNew: TWebLabel;
dtpNewPlateDue: TWebDateTimePicker;
lblArt: TWebLabel;
dtpArtDue: TWebDateTimePicker;
lblArtNew: TWebLabel;
dtpNewArtDue: TWebDateTimePicker;
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure wlcbStatusChange(Sender: TObject);
procedure dtpDateChange(Sender: TObject);
private
{ Private declarations }
function Verify(): boolean;
function GetNextDate(CurrDate: TDateTime): TDateTime;
procedure SetDueDates();
public
{ Public declarations }
confirm: boolean;
......@@ -107,6 +103,11 @@ begin
end;
end;
procedure TFSetStatus.dtpDateChange(Sender: TObject);
begin
SetDueDates();
end;
procedure TFSetStatus.WebFormShow(Sender: TObject);
var
ItemsToRemove: TStringList;
......@@ -114,24 +115,20 @@ var
filteredItems: TJSArray;
begin
edtOrderID.Text := OrderID;
dtpDate.Date := 0;
dtpDate.Date := Now;
edtJobName.Text := JobName;
dtpShipDue.Date := ShipDue;
dtpMountDue.Date := MountDue;
dtpPlateDue.Date := PlateDue;
dtpArtDue.Date := ArtDue;
dtpNewShipDue.Date := 0;
dtpNewMountDue.Date := 0;
dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0;
ItemsToRemove := TStringList.Create;
console.log(orderType);
if orderType = 'web plate' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
dtpShipDue.Top := dtpMountDue.Top;
lblShip.Top := lblMount.Top;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('ART', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
......@@ -139,33 +136,88 @@ begin
end
else if orderType = 'cutting die' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
dtpPlateDue.Visible := false;
dtpNewPlateDue.Visible := false;
lblPlate.Visible := false;
lblPlateNew.Visible := false;
dtpArtDue.Visible := false;
dtpNewArtDue.Visible := false;
lblArt.Visible := false;
lblArtNew.Visible := false;
dtpShipDue.Top := dtpArtDue.Top;
lblShip.Top := lblArt.Top;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else
begin
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('ART', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end;
end;
procedure TFSetStatus.wlcbStatusChange(Sender: TObject);
begin
SetDueDates();
end;
procedure TFSetStatus.SetDueDates();
begin
if OrderType = 'corrugated plate' then
begin
if wlcbStatus.DisplayText = 'Art Done' then
begin
dtpPlateDue.Date := getNextDate(dtpDate.Date);
dtpMountDue.Date := getNextDate(dtpPlateDue.Date);
dtpShipDue.Date := getNextDate(dtpMountDue.Date);
end
else if wlcbStatus.DisplayText = 'Plate Done' then
begin
dtpMountDue.Date := getNextDate(dtpDate.Date);
dtpShipDue.Date := getNextDate(dtpMountDue.Date);
end
else if wlcbStatus.DisplayText = 'Mount Done' then
dtpShipDue.Date := getNextDate(dtpDate.Date);
end
else if OrderType = 'web plate' then
begin
if wlcbStatus.DisplayText = 'Art Done' then
begin
dtpPlateDue.Date := getNextDate(dtpDate.Date);
dtpShipDue.Date := getNextDate(dtpMountDue.Date);
end
else if wlcbStatus.DisplayText = 'Plate Done' then
begin
dtpShipDue.Date := getNextDate(dtpMountDue.Date);
end
end
else
begin
if wlcbStatus.DisplayText = 'Art Done' then
begin
dtpShipDue.Date := getNextDate(dtpDate.Date);
end;
end;
end;
function TFSetStatus.GetNextDate(CurrDate: TDateTime): TDateTime;
var
DOW: integer;
begin
CurrDate := CurrDate + 1;
DOW := DayOfWeek(CurrDate);
while DOW in [1, 7] do
begin
CurrDate := CurrDate + 1;
DOW := DayOfWeek(CurrDate);
end;
result := CurrDate;
console.log(CurrDate);
end;
end.
\ No newline at end of file
......@@ -144,7 +144,7 @@ begin
JWT.Claims.SetClaimOfType<string>('user_email', userEmail);
JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID);
JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType);
JWT.Claims.SetClaimOfType<string>('user_admin', LowerCase(BoolToStr(SameText(userAccessType, 'ALL'), True)));
JWT.Claims.SetClaimOfType<string>('user_admin', LowerCase(BoolToStr(SameText(userAccessType, 'ADMIN'), True)));
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
finally
......
......@@ -815,7 +815,7 @@ begin
try
try
// Generate SQL query for a single order
SQL := 'SELECT * FROM corrugated_plate_orders WHERE ORDER_ID = ' + orderID;
SQL := 'SELECT * FROM corrugated_plate_orders c join orders o on c.ORDER_ID = o.ORDER_ID WHERE c.ORDER_ID = ' + orderID;
// Prepare the report with the query
Result := rptOrderCorrugated.PrepareReport(SQL);
......@@ -845,7 +845,7 @@ begin
try
// Generate SQL query for a single order
//SQL := 'SELECT * FROM web_plate_orders w WHERE w.ORDER_ID = ' + orderID ;
SQL := 'SELECT * FROM web_plate_orders w LEFT JOIN qb_sales_orders q ON w.ORDER_ID = q.ORDER_ID WHERE w.ORDER_ID = ' + orderID;
SQL := 'SELECT * FROM web_plate_orders w JOIN orders o ON w.ORDER_ID = o.ORDER_ID WHERE w.ORDER_ID = ' + orderID;
// Prepare the report with the query
Result := rptOrderWeb.PrepareReport(SQL);
......@@ -874,7 +874,7 @@ begin
try
try
// Generate SQL query for a single order
SQL := 'SELECT * FROM cutting_die_orders WHERE ORDER_ID = ' + orderID;
SQL := 'SELECT * FROM cutting_die_orders c JOIN orders o on c.ORDER_ID = o.ORDER_ID WHERE c.ORDER_ID = ' + orderID;
// Prepare the report with the query
Result := rptOrderCutting.PrepareReport(SQL);
......@@ -1025,7 +1025,7 @@ function TLookupService.generateOrdersSQL(searchOptions: string): TSQLQuery;
var
params: TStringList;
PageNum, PageSize: integer;
OrderBy, offset, limit: string;
OrderBy, offset, limit, direction: string;
SQL, whereSQL, orderBySQL: string;
OrderID, CompanyID, JobName, orderType: string;
status1, status2: TStatusSearchInfo;
......@@ -1047,7 +1047,7 @@ begin
limit := IntToStr(PageSize);
end;
OrderBy := params.Values['orderby'];
OrderBy := params.Values['orderby'] + ' ' + params.Values['direction'];
orderType := params.Values['orderType'].ToLower();
OrderID := params.Values['orderID'];
companyID := params.Values['companyID'];
......@@ -1155,6 +1155,7 @@ begin
try
SQL := SQLQuery.SQL;
whereSQL := SQLQuery.whereSQL;
logger.Log(3, 'Getting orders with SQL query ' + SQL);
doQuery(ordersDB.UniQuery1, SQL);
......@@ -1958,7 +1959,7 @@ begin
UserID := StatusInfo.GetValue<string>('USER_ID');
OrderType := StatusInfo.GetValue<string>('OrderType');
if ( (Status = 'PROOF') and (OrderType <> 'cutting die') ) then
{if ( (Status = 'PROOF') and (OrderType <> 'cutting die') ) then
begin
NextStatus := 'ART';
StatusField := 'staff_fields_art_due';
......@@ -1977,7 +1978,7 @@ begin
begin
NextStatus := 'SHIP';
StatusField := 'staff_fields_ship_date';
end;
end;}
Date := DateToStr(StrToDate(Date) + 1);
......@@ -2017,11 +2018,11 @@ begin
if StatusInfo.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' then
AddStatusSchedule('MOUNT', StatusInfo, ORDER_ID);
if Status <> 'SHIP' then
if Status <> 'SHIP' then
begin
order := TJSONObject.Create;
try
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
{ SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
'ORDER_STATUS = ' + quotedStr(NextStatus);
doQuery(ordersDB.UniQuery1, SQL);
......@@ -2031,7 +2032,7 @@ begin
order.AddPair('mode', 'EDIT');
order.AddPair(StatusField, Date);
order.AddPair('USER_ID', UserID);
AddStatusSchedule(NextStatus, order, ORDER_ID);
AddStatusSchedule(NextStatus, order, ORDER_ID); }
// update the order as well
if OrderType = 'web plate' then
......@@ -2054,8 +2055,6 @@ begin
OrdersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString := StatusInfo.GetValue<string>('staff_fields_plate_due');
if StatusInfo.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' then
OrdersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString := StatusInfo.GetValue<string>('staff_fields_mount_due');
OrdersDB.UniQuery1.FieldByName(StatusField).AsString := Date;
OrdersDB.UniQuery1.Post;
finally
......@@ -2063,7 +2062,7 @@ begin
end;
end;
result := 'success';
result := 'success:Status Successfully set';
except
on E: Exception do
logger.Log(2, 'An error occurred when setting status: ' + E.Message);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -101,6 +101,19 @@ type
uqOrderCorrugatedstaff_fields_quantity: TStringField;
uqOrderCorrugatedlayout_rsc_style: TStringField;
uqOrderCorrugatedstaff_fields_art_location: TStringField;
uqOrderCorrugatedORDER_ID_1: TLongWordField;
uqOrderCorrugatedCOMPANY_ID_1: TLongWordField;
uqOrderCorrugatedORDER_TYPE: TStringField;
uqOrderCorrugatedORDER_DATE_1: TDateTimeField;
uqOrderCorrugatedPRICE: TFloatField;
uqOrderCorrugatedJOB_NAME: TStringField;
uqOrderCorrugatedUSER_ID_1: TLongWordField;
uqOrderCorrugatedLOCATION: TStringField;
uqOrderCorrugatedIN_QB: TStringField;
uqOrderCorrugatedQB_ORDER_NUM: TStringField;
uqOrderCorrugatedQB_ESTIMATE_ID: TStringField;
uqOrderCorrugatedQB_ORDER_USER: TStringField;
uqOrderCorrugatedQB_CREATE_DATE: TDateTimeField;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -31,6 +31,20 @@ type
uqOrderCuttingstaff_fields_job_name: TStringField;
uqOrderCuttingstaff_fields_quickbooks_item: TStringField;
uqOrderCuttinggeneral_special_instructions: TStringField;
uqOrderCuttingORDER_STATUS: TStringField;
uqOrderCuttingORDER_ID_1: TLongWordField;
uqOrderCuttingCOMPANY_ID_1: TLongWordField;
uqOrderCuttingORDER_TYPE: TStringField;
uqOrderCuttingORDER_DATE_1: TDateTimeField;
uqOrderCuttingPRICE: TFloatField;
uqOrderCuttingJOB_NAME: TStringField;
uqOrderCuttingUSER_ID_1: TLongWordField;
uqOrderCuttingLOCATION: TStringField;
uqOrderCuttingIN_QB: TStringField;
uqOrderCuttingQB_ORDER_NUM: TStringField;
uqOrderCuttingQB_ESTIMATE_ID: TStringField;
uqOrderCuttingQB_ORDER_USER: TStringField;
uqOrderCuttingQB_CREATE_DATE: TDateTimeField;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -99,7 +99,19 @@ type
uqOrderWebupc_distortion_percent: TStringField;
uqOrderWebupc_distortion_amount: TStringField;
uqOrderWebstaff_fields_art_location: TStringField;
uqOrderWebQB_REF_NUM: TStringField;
uqOrderWebORDER_ID_1: TLongWordField;
uqOrderWebCOMPANY_ID_1: TLongWordField;
uqOrderWebORDER_TYPE: TStringField;
uqOrderWebORDER_DATE_1: TDateTimeField;
uqOrderWebPRICE: TFloatField;
uqOrderWebJOB_NAME: TStringField;
uqOrderWebUSER_ID_1: TLongWordField;
uqOrderWebLOCATION: TStringField;
uqOrderWebIN_QB: TStringField;
uqOrderWebQB_ORDER_NUM: TStringField;
uqOrderWebQB_ESTIMATE_ID: TStringField;
uqOrderWebQB_ORDER_USER: TStringField;
uqOrderWebQB_CREATE_DATE: TDateTimeField;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
......
......@@ -2,12 +2,13 @@
MemoLogLevel=4
FileLogLevel=4
webClientVersion=1.0.0
LogFileNum=103
LogFileNum=126
[Database]
Server=192.168.116.138
--Server=192.168.116.138
--Server=192.168.102.130
--Server=192.168.75.133
Server=192.168.159.10
Database=kg_order_entry
Username=root
Password=emsys01
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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