Commit 9bbaf56d by Cam Hayes

Finished Copy and delete in the ways discussed with dave.

Delete doesn't delete every relationship with the order in the database so there will still be clutter in the Status Tables.
parent 7bb7fd61
object FViewMain: TFViewMain object FViewMain: TFViewMain
Width = 1322
Height = 764
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
Color = clWhite
ElementFont = efCSS ElementFont = efCSS
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
FormStyle = fsNormal ParentFont = False
Height = 764
Left = 0
OnCreate = WebFormCreate OnCreate = WebFormCreate
TabOrder = 0
Top = 0
Width = 1322
object lblUsername: TWebLabel object lblUsername: TWebLabel
Left = 529
Top = 4
Width = 59
Height = 14
Caption = 'lblUsername' Caption = 'lblUsername'
ElementID = 'view.main.username' ElementID = 'view.main.username'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET HeightPercent = 100.000000000000000000
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 21
Left = 529
Top = 4
Transparent = False Transparent = False
Width = 80 WidthPercent = 100.000000000000000000
end end
object wllblUserProfile: TWebLinkLabel object wllblUserProfile: TWebLinkLabel
Caption = ' User Profile'
ElementID = 'dropdown.menu.userprofile'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 0
Left = 529 Left = 529
OnClick = wllblUserProfileClick
Top = 21 Top = 21
Width = 0 Width = 59
Height = 14
ElementID = 'dropdown.menu.userprofile'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = wllblUserProfileClick
Caption = ' User Profile'
end end
object wllblLogout: TWebLinkLabel object wllblLogout: TWebLinkLabel
Caption = ' Logout'
ElementID = 'dropdown.menu.logout'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 0
Left = 551 Left = 551
OnClick = wllblLogoutClick
Top = 143 Top = 143
Width = 0 Width = 36
Height = 14
ElementID = 'dropdown.menu.logout'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = wllblLogoutClick
Caption = ' Logout'
end end
object lblHome: TWebLinkLabel object lblHome: TWebLinkLabel
Caption = 'Home'
ElementID = 'dropdown.menu.home'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 0
Left = 556 Left = 556
OnClick = lblHomeClick
Top = 38 Top = 38
Width = 0 Width = 27
Height = 14
ElementID = 'dropdown.menu.home'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblHomeClick
Caption = 'Home'
end end
object lblAppTitle: TWebLabel object lblAppTitle: TWebLabel
Left = 57
Top = 31
Width = 75
Height = 14
Caption = 'Koehler-Gibson' Caption = 'Koehler-Gibson'
ElementID = 'view.main.apptitle' ElementID = 'view.main.apptitle'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET HeightPercent = 100.000000000000000000
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 40
Left = 57
Top = 31
Transparent = False Transparent = False
Width = 202 WidthPercent = 100.000000000000000000
end end
object lblItemsList: TWebLinkLabel object lblItemsList: TWebLinkLabel
Caption = 'Items'
ElementFont = efCSS
ElementID = 'dropdown.menu.itemlist'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 32
Left = 560 Left = 560
OnClick = lblItemsListClick
Top = 85 Top = 85
Width = 95 Width = 25
Height = 14
ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblItemsListClick
Caption = 'Items'
end end
object lblUsers: TWebLinkLabel object lblUsers: TWebLinkLabel
Caption = 'Users'
ElementFont = efCSS
ElementID = 'dropdown.menu.users'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 0
Left = 561 Left = 561
OnClick = lblUsersClick
Top = 108 Top = 108
Width = 0 Width = 29
Height = 14
ElementID = 'dropdown.menu.users'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblUsersClick
Caption = 'Users'
end end
object lblorders: TWebLabel object lblorders: TWebLabel
Left = 556
Top = 52
Width = 34
Height = 14
Caption = 'Orders' Caption = 'Orders'
ElementFont = efCSS
ElementID = 'lblorders' ElementID = 'lblorders'
ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 32
HeightStyle = ssAuto HeightStyle = ssAuto
Left = 556 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblordersClick OnClick = lblordersClick
Top = 52
Width = 104
end end
object lblCustomers: TWebLabel object lblCustomers: TWebLabel
Left = 540
Top = 69
Width = 52
Height = 14
Caption = 'Customers' Caption = 'Customers'
ElementFont = efCSS
ElementID = 'lblcustomers' ElementID = 'lblcustomers'
ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 32
HeightStyle = ssAuto HeightStyle = ssAuto
Left = 540 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblCustomersClick OnClick = lblCustomersClick
Top = 69
Width = 131
end end
object lblQuickbooks: TWebLabel object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 57
Height = 14
Caption = 'QuickBooks' Caption = 'QuickBooks'
ElementFont = efCSS
ElementID = 'lblquickbooks' ElementID = 'lblquickbooks'
ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 32
HeightStyle = ssAuto HeightStyle = ssAuto
Left = 546 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick OnClick = lblQuickbooksClick
Top = 125
Width = 139
end end
object WebPanel1: TWebPanel object lblVersion: TWebLabel
ChildOrder = 3 Left = 358
Color = clBtnFace Top = 209
Width = 47
Height = 14
Caption = 'lblVersion'
ElementID = 'view.main.version'
ElementFont = efCSS ElementFont = efCSS
ElementID = 'main.webpanel' ElementPosition = epRelative
ElementPosition = epIgnore
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 0
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebPanel1: TWebPanel
Left = 77 Left = 77
Role = 'null'
TabOrder = 0
TabStop = False
Top = 112 Top = 112
Width = 1322 Width = 1322
Height = 0
ElementID = 'main.webpanel'
HeightStyle = ssAuto
WidthStyle = ssAuto WidthStyle = ssAuto
ChildOrder = 3
ElementFont = efCSS
ElementPosition = epIgnore
Role = 'null'
TabOrder = 0
end end
object WebMemo1: TWebMemo object WebMemo1: TWebMemo
AutoSize = False Left = 77
Color = clWindow Top = 479
Width = 471
Height = 83
ElementID = 'main.debugmemo' ElementID = 'main.debugmemo'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET HeightPercent = 100.000000000000000000
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 83
Left = 77
Lines.Strings = ( Lines.Strings = (
'WebMemo1') 'WebMemo1')
ReadOnly = False
Role = 'null' Role = 'null'
SelLength = 0 SelLength = 0
SelStart = 0 SelStart = 0
ShowFocus = True
TabOrder = 0
Top = 479
Visible = False Visible = False
Width = 471 WidthPercent = 100.000000000000000000
end
object lblVersion: TWebLabel
Caption = 'lblVersion'
ElementFont = efCSS
ElementID = 'view.main.version'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 21
HeightStyle = ssAuto
Left = 358
Top = 209
Width = 60
end end
object WebMessageDlg1: TWebMessageDlg object WebMessageDlg1: TWebMessageDlg
Left = 47
Top = 232
Width = 24
Height = 24
Buttons = []
CustomButtons = <> CustomButtons = <>
DialogText.Strings = ( DialogText.Strings = (
'Warning' 'Warning'
...@@ -267,13 +201,7 @@ object FViewMain: TFViewMain ...@@ -267,13 +201,7 @@ object FViewMain: TFViewMain
'No to all' 'No to all'
'Help' 'Help'
'Close') 'Close')
Height = 24
Left = 47
Opacity = 0.200000000000000000 Opacity = 0.200000000000000000
Top = 232
Width = 24
Left = 47
Top = 232
end end
object XDataWebClient: TXDataWebClient object XDataWebClient: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
......
...@@ -57,6 +57,8 @@ type ...@@ -57,6 +57,8 @@ type
procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string); procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
procedure ViewOrders(info: string); procedure ViewOrders(info: string);
procedure ShowUserForm(Info: string); procedure ShowUserForm(Info: string);
var
search: string;
end; end;
var var
......
...@@ -247,7 +247,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -247,7 +247,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Text = '' Text = ''
end end
object edtCompanyName: TWebDBEdit object edtCompanyName: TWebDBEdit
Left = 24 Left = 18
Top = 92 Top = 92
Width = 300 Width = 300
Height = 22 Height = 22
...@@ -1159,6 +1159,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1159,6 +1159,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementID = 'btndelete' ElementID = 'btndelete'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end end
object btnClose: TWebButton object btnClose: TWebButton
Left = 1094 Left = 1094
......
...@@ -209,6 +209,7 @@ type ...@@ -209,6 +209,7 @@ type
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject); [async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
[async] procedure GenerateReportPDF; [async] procedure GenerateReportPDF;
[async] procedure DelOrder();
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
procedure btnCopyClick(Sender: TObject); procedure btnCopyClick(Sender: TObject);
...@@ -216,6 +217,7 @@ type ...@@ -216,6 +217,7 @@ type
procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet); procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet);
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject); procedure btnCloseNotificationClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject);
private private
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
...@@ -371,7 +373,7 @@ begin ...@@ -371,7 +373,7 @@ begin
orderJSON.AddPair('mode', mode); orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID); orderJSON.AddPair('ORDER_ID', orderID);
AddCorrugatedOrder(orderJSON);
if mode = 'ADD' then if mode = 'ADD' then
ShowNotification('Success:Order Added Successfully!') ShowNotification('Success:Order Added Successfully!')
else else
...@@ -382,15 +384,31 @@ end; ...@@ -382,15 +384,31 @@ end;
procedure TFOrderEntryCorrugated.btnConfirmClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server // Converts all the information on the page into a JSON to then send to the server
begin begin
//When confirm is clicked should we then switch to edit mode with the ID? should the server send back an OrderID?
sendOrderToServer(); sendOrderToServer();
window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryCorrugated.btnCopyClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCopyClick(Sender: TObject);
begin begin
mode := 'ADD'; mode := 'ADD';
sendOrderToServer(); //sendOrderToServer();
// Should we then open the "new" order. window.scrollTo(0, 0);
dtpOrderDate.Date := 0;
dtpProofDate.Date := 0;
dtpArtDue.Date := 0;
dtpPlateDue.Date := 0;
dtpMountDue.Date := 0;
dtpShipDate.Date := 0;
dtpApprovedDate.Date := 0;
ShowNotification('Success:Order Successfully Copied');
window.scrollTo(0, 0);
end;
procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject);
begin
//mode := 'DEL';
//sendOrderToServer();
DelOrder();
end; end;
procedure TFOrderEntryCorrugated.btnPDFClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnPDFClick(Sender: TObject);
...@@ -435,6 +453,14 @@ begin ...@@ -435,6 +453,14 @@ begin
console.log(OrderID); console.log(OrderID);
end; end;
procedure TFOrderEntryCorrugated.DelOrder();
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder',
[OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
end;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm; class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
var var
localMode: string; localMode: string;
...@@ -515,13 +541,15 @@ end; ...@@ -515,13 +541,15 @@ end;
procedure TFOrderEntryCorrugated.btnCancelClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCancelClick(Sender: TObject);
begin begin
If mode = 'EDIT' then // need to get this button working properly edit version does not work correctly
if mode = 'EDIT' then
begin begin
getOrder(OrderID); getOrder(OrderID);
ShowNotification('Failure:Changes Discarded'); ShowNotification('Failure:Changes Discarded');
end end
else else
FViewMain.ViewOrderEntryCorrugated('', CustomerID, 'ADD'); FViewMain.ViewOrderEntryCorrugated('', CustomerID, 'ADD');
window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryCorrugated.btnCloseClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCloseClick(Sender: TObject);
......
object FOrderEntryWeb: TFOrderEntryWeb object FOrderEntryWeb: TFOrderEntryWeb
Width = 1015 Width = 1261
Height = 628 Height = 628
OnShow = WebFormShow OnShow = WebFormShow
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
...@@ -1078,7 +1078,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1078,7 +1078,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Save'
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnconfirm' ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -1086,7 +1086,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1086,7 +1086,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object btnPDF: TWebButton object btnPDF: TWebButton
Left = 867 Left = 963
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
...@@ -1098,7 +1098,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1098,7 +1098,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
OnClick = btnPDFClick OnClick = btnPDFClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 761 Left = 853
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
...@@ -1186,6 +1186,42 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1186,6 +1186,42 @@ object FOrderEntryWeb: TFOrderEntryWeb
DataField = 'print_orientation_print_orient' DataField = 'print_orientation_print_orient'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnCopy: TWebButton
Left = 751
Top = 568
Width = 96
Height = 25
Caption = 'Copy'
ChildOrder = 91
ElementID = 'btncopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCopyClick
end
object btnDelete: TWebButton
Left = 1065
Top = 568
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnClose: TWebButton
Left = 1063
Top = 523
Width = 96
Height = 25
Caption = 'Close'
ChildOrder = 80
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 160 Left = 160
......
...@@ -357,13 +357,22 @@ ...@@ -357,13 +357,22 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button> <button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Save</button>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button> <button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div> </div>
<div class="col-auto">
<button id="btncopy" class="btn btn-primary btn-sm float-end my-2">Copy</button>
</div>
<div class="col-auto"> <div class="col-auto">
<button id="btnpdf" class="btn btn-primary btn-sm float-end my-2">PDF</button> <button id="btnpdf" class="btn btn-primary btn-sm float-end my-2">PDF</button>
</div> </div>
<div class="col-auto">
<button id="btndelete" class="btn btn-primary btn-sm float-end my-2">Delete</button>
</div>
<div class="col-auto">
<button id="btnclose" class="btn btn-primary btn-sm float-end my-2">Close</button>
</div>
</div> </div>
</div> </div>
...@@ -198,6 +198,9 @@ type ...@@ -198,6 +198,9 @@ type
WebDBComboBox3: TWebDBComboBox; WebDBComboBox3: TWebDBComboBox;
wcbPrint: TWebDBComboBox; wcbPrint: TWebDBComboBox;
WebDBComboBox4: TWebDBComboBox; WebDBComboBox4: TWebDBComboBox;
btnCopy: TWebButton;
btnDelete: TWebButton;
btnClose: TWebButton;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure HideNotification(); procedure HideNotification();
procedure ShowNotification(Notification: string); procedure ShowNotification(Notification: string);
...@@ -212,6 +215,11 @@ type ...@@ -212,6 +215,11 @@ type
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
[async] procedure GenerateReportPDF; [async] procedure GenerateReportPDF;
procedure SendOrderToServer;
procedure btnCopyClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject);
[async] procedure DelOrder;
private private
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
...@@ -235,6 +243,46 @@ uses ...@@ -235,6 +243,46 @@ uses
View.Home, View.Main; View.Home, View.Main;
procedure TFOrderEntryWeb.btnConfirmClick(Sender: TObject); procedure TFOrderEntryWeb.btnConfirmClick(Sender: TObject);
begin
SendOrderToServer();
window.scrollTo(0, 0);
end;
procedure TFOrderEntryWeb.btnCopyClick(Sender: TObject);
begin
mode := 'ADD';
dtpOrderDate.Date := 0;
dtpProofDate.Date := 0;
dtpArtDue.Date := 0;
dtpPlateDue.Date := 0;
dtpShipDate.Date := 0;
dtpPDFDate1.Date := 0;
dtpPDFDate2.Date := 0;
dtpPDFDate3.Date := 0;
dtpInkJetDate1.Date := 0;
dtpInkJetDate2.Date := 0;
dtpInkJetDate3.Date := 0;
dtpColorContractDate1.Date := 0;
dtpColorContractDate2.Date := 0;
dtpDigitalColorDate.Date := 0;
ShowNotification('Success:Order Successfully Copied');
window.scrollTo(0, 0);
end;
procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject);
begin
DelOrder();
end;
[async] procedure TFOrderEntryWeb.DelOrder();
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder',
[OrderID, 'web', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
end;
procedure TFOrderEntryWeb.SendOrderToServer();
// Converts all the information on the page into a JSON to then send to the server // Converts all the information on the page into a JSON to then send to the server
var var
colorList: TJSONArray; colorList: TJSONArray;
...@@ -249,12 +297,10 @@ var ...@@ -249,12 +297,10 @@ var
Field: TField; Field: TField;
Response: TXDataClientResponse; Response: TXDataClientResponse;
begin begin
console.log('confirm');
orderJSON := 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;
for I := 0 to colorCollection.length - 1 do for I := 0 to colorCollection.length - 1 do
begin begin
colorJSON := TJSONObject.Create; colorJSON := TJSONObject.Create;
...@@ -323,8 +369,7 @@ begin ...@@ -323,8 +369,7 @@ begin
else else
info := 'Success:Order Successfully Added'; info := 'Success:Order Successfully Added';
AddWebOrder(orderJSON); AddWebOrder(orderJSON);
ShowNotification(info);
FViewMain.ViewOrders(info);
end; end;
procedure TFOrderEntryWeb.btnPDFClick(Sender: TObject); procedure TFOrderEntryWeb.btnPDFClick(Sender: TObject);
...@@ -332,7 +377,7 @@ begin ...@@ -332,7 +377,7 @@ begin
GenerateReportPDF; GenerateReportPDF;
end; end;
[async] procedure TFOrderEntryWeb.GenerateReportPDF; procedure TFOrderEntryWeb.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results // sends the search to the server which then sends back a pdf of the results
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
...@@ -441,6 +486,11 @@ end; ...@@ -441,6 +486,11 @@ end;
procedure TFOrderEntryWeb.btnCancelClick(Sender: TObject); procedure TFOrderEntryWeb.btnCancelClick(Sender: TObject);
begin begin
//FViewMain.ViewOrders('');
end;
procedure TFOrderEntryWeb.btnCloseClick(Sender: TObject);
begin
FViewMain.ViewOrders(''); FViewMain.ViewOrders('');
end; end;
...@@ -619,10 +669,29 @@ begin ...@@ -619,10 +669,29 @@ begin
end; end;
procedure TFOrderEntryWeb.ShowNotification(Notification: string); procedure TFOrderEntryWeb.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin begin
if Notification <> '' then if Notification <> '' then
begin begin
lblMessage.Caption := Notification; splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False; pnlMessage.ElementHandle.hidden := False;
end; end;
end; end;
......
...@@ -624,7 +624,7 @@ begin ...@@ -624,7 +624,7 @@ begin
xdwdsOrders.Close; xdwdsOrders.Close;
xdwdsOrders.SetJsonData(orderList['data']); xdwdsOrders.SetJsonData(orderList['data']);
xdwdsOrders.Open; xdwdsOrders.Open;
wdbtcOrders.HideColumn(0); //wdbtcOrders.HideColumn(0);
asm asm
endSpinner(); endSpinner();
......
...@@ -251,7 +251,7 @@ object FSearch: TFSearch ...@@ -251,7 +251,7 @@ object FSearch: TFSearch
Top = 579 Top = 579
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Search'
ChildOrder = 7 ChildOrder = 7
ElementClassName = 'btn btn-secondary' ElementClassName = 'btn btn-secondary'
ElementFont = efCSS ElementFont = efCSS
......
...@@ -277,15 +277,11 @@ begin ...@@ -277,15 +277,11 @@ begin
// Set up column headers // Set up column headers
TMSFNCGrid1.ColumnCount := 4; TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1; TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID'; TMSFNCGrid1.Cells[0, 0] := 'DBID';
TMSFNCGrid1.Cells[1, 0] := 'Short Name'; TMSFNCGrid1.Cells[1, 0] := 'ID';
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; TMSFNCGrid1.Cells[3, 0] := 'Address';
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset // Populate the grid with data from the dataset
xdwdsCustomers.First; xdwdsCustomers.First;
RowIndex := 1; RowIndex := 1;
......
...@@ -380,6 +380,7 @@ type ...@@ -380,6 +380,7 @@ type
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function DelUser(username: string): string; function DelUser(username: string): string;
function DelOrder(orderID, orderType, UserID: string): TJSONObject;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject; function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddWebOrder(orderInfo: string): TJSONObject; function AddWebOrder(orderInfo: string): TJSONObject;
......
...@@ -19,7 +19,8 @@ uses ...@@ -19,7 +19,8 @@ uses
iexToolbars, iexUserInteractions, imageenio, imageenproc, QuickRpt, QRCtrls, iexToolbars, iexUserInteractions, imageenio, imageenproc, QuickRpt, QRCtrls,
dbimageen, Vcl.ExtCtrls, ieview, imageenview, IdBaseComponent, IdComponent, dbimageen, Vcl.ExtCtrls, ieview, imageenview, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP,
iexProcEffects, frxDBSet, frxExportBaseDialog, frCoreClasses, rOrderList, rOrderCorrugated, Common.Logging; iexProcEffects, frxDBSet, frxExportBaseDialog, frCoreClasses, rOrderList, rOrderCorrugated, Common.Logging,
DateUtils;
type type
...@@ -50,6 +51,7 @@ type ...@@ -50,6 +51,7 @@ type
function AddCorrugatedOrder(orderInfo: string): TJSONObject; function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddWebOrder(orderInfo: string): TJSONObject; function AddWebOrder(orderInfo: string): TJSONObject;
function AddCuttingDieOrder(orderInfo: string): TJSONObject; function AddCuttingDieOrder(orderInfo: string): TJSONObject;
function delOrder(OrderID, OrderType, UserID: string): TJSONObject;
function GenerateSubQuery(currStatus: string): string; function GenerateSubQuery(currStatus: string): string;
...@@ -1420,7 +1422,6 @@ begin ...@@ -1420,7 +1422,6 @@ begin
result := 'success'; result := 'success';
except except
on E: Exception do on E: Exception do
// This block will catch any exception derived from the Exception class
logger.Log(5, 'An error occurred when setting status: ' + E.Message); logger.Log(5, 'An error occurred when setting status: ' + E.Message);
end; end;
...@@ -1727,8 +1728,132 @@ begin ...@@ -1727,8 +1728,132 @@ begin
end; end;
end; end;
function TLookupService.delOrder(OrderID, orderType, UserID: string): TJSONObject;
var
table: string;
table2: string;
sql: string;
CorrugatedOrder: TFullOrder;
WebOrder: TWebOrder;
CuttingDieOrder: TCuttingDie;
DateFormat: TFormatSettings;
JSONData: TJSONObject;
JSONArray: TJSONArray;
Pair: TJSONPair;
Field: TField;
ORDER_ID: string;
mode: string;
stream: TStringStream;
RevisionID: integer;
JSONValue: TJSONValue;
JSONObject: TJSONObject;
DataObject: TJSONObject;
begin
if orderType = 'corrugated' then
begin
table := 'corrugated_plate_orders';
table2 := 'corrugated_plate_orders_revisions';
end
else if orderType = 'web' then
begin
table := 'web_plate_orders';
table2 := 'web_plate_orders_revisions';
end
else
begin
table := 'cutting_die_orders';
table2 := 'cutting_die_orders_revisions';
end;
stream := TStringStream.Create('', TEncoding.UTF8);
DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd';
DateFormat.DateSeparator := '-';
//Update RevisionID
SQL := 'UPDATE idfield set KEYVALUE = KEYVALUE + 1 WHERE KEYNAME = ' + quotedStr('GEN_ORDER_REVISION_ID');
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
//Retrieve updated RevisionID
SQL := 'select KEYVALUE from idfield where KEYNAME = ' + quotedStr('GEN_ORDER_REVISION_ID');
doQuery(OrdersDB.UniQuery1, SQL);
RevisionID := OrdersDB.UniQuery1.FieldByName('KEYVALUE').AsInteger;
// Convert Order into JSON
SQL := 'select * from ' + table + ' where ORDER_ID = ' + OrderID;
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.SaveToJSON(stream);
stream.Position := 0;
JSONValue := TJSONObject.ParseJSONValue(Stream.DataString);
if not Assigned(JSONValue) then
raise Exception.Create('Invalid JSON content');
try
if not (JSONValue is TJSONObject) then
raise Exception.Create('Expected JSON object');
JSONObject := TJSONObject(JSONValue);
// Get the "data" object
if not JSONObject.TryGetValue('data', DataObject) then
raise Exception.Create('Missing "data" object in JSON');
// Get the "rows" array
if not DataObject.TryGetValue('rows', JSONArray) then
raise Exception.Create('Missing "rows" array in JSON data');
JSONData := JSONArray.Items[0] as TJSONObject;
SQL := 'select * from ' + table2 + ' where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
try
ordersDB.UniQuery1.Insert;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
if Assigned(Field) then
begin
// handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := ISO8601ToDate(Pair.JsonValue.Value, False)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString := OrderID;
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := 'DELETED';
ordersDB.UniQuery1.FieldByName('REVISION_NUMBER').AsInteger := 1;
ordersDB.UniQuery1.FieldByName('ORDER_REVISION_ID').AsInteger := RevisionID;
ordersDB.UniQuery1.FieldByName('REVISION_USER_ID').AsString := UserID;
// Post the record to the database
ordersDB.UniQuery1.Post;
Result := TJSONObject.Create.AddPair('status', 'success');
Result.AddPair('OrderID', ORDER_ID);
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
except
on E: Exception do
begin
Result := TJSONObject.Create.AddPair('error', E.Message);
end
end;
finally
JSONData.Free;
end;
sql := 'delete from ' + table + ' where ORDER_ID = ' + OrderID;
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
sql := 'delete from orders where ORDER_ID = ' + OrderID;
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
end;
initialization initialization
RegisterServiceType(TLookupService); RegisterServiceType(TLookupService);
end. end.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.2 webClientVersion=0.9.2
LogFileNum=366 LogFileNum=396
[Database] [Database]
Server=192.168.159.132 Server=192.168.159.132
......
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