UPDATE R5APPSETTINGS SET AST_VALUE = '11611' WHERE AST_NAME='DBVERSION';

ALTER TABLE R5BOOKEDHOURS ADD COLUMN BOO_CORRECTIONDATE datetime NULL ;
ALTER TABLE R5BOOKEDHOURS ADD COLUMN BOO_CORRECTION_REF nvarchar(30) NULL ;
ALTER TABLE R5BOOKEDHOURS ADD COLUMN BOO_DESC nvarchar(80) NULL ;

CREATE TABLE R5CLOSEDPERIODS(
CLP_CLOSED datetime NOT NULL,
CLP_ENTERED datetime NOT NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (CLP_CLOSED, CLP_ENTERED)
);
INSERT INTO R5SYSCOLUMNS VALUES('R5CLOSEDPERIODS','CLP_CLOSED','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5CLOSEDPERIODS','CLP_ENTERED','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');

INSERT INTO R5LISTENTITY  (LET_DATAGRID, LET_SEQNO, LET_GROUPID, LET_DELINSUPD, LET_FILTER, LET_TABLENAME, LET_ORGKEY, LET_CONNECTEDMODE, LET_ALWAYSDOWNLOAD, LET_CATEGORY, LET_CLEARCONDITION) VALUES('BCCLPE_IPAD', 114, 0, 6, 'WCJOBS', 'R5CLOSEDPERIODS', NULL, '-', '-', NULL, NULL);

CREATE TABLE R5DISPATCHEVENTS(
DIW_PK    nvarchar(30),
DIW_EVENT    nvarchar(30),
DIW_ACT    numeric(18,0),
DIW_PERSON    nvarchar(15),
DIW_CREW    nvarchar(15),
DIW_CREW_ORG    nvarchar(15),
DIW_DISPATCHED    datetime,
DIW_DISPATCHEDBY    nvarchar(255),
DIW_COMPLETE    nvarchar(1),
DIW_SEQUENCE    numeric,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (DIW_PK)
);
INSERT INTO R5SYSCOLUMNS VALUES('R5DISPATCHEVENTS','DIW_PK','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');

INSERT INTO R5LISTENTITY  (LET_DATAGRID, LET_SEQNO, LET_GROUPID, LET_DELINSUPD, LET_FILTER, LET_TABLENAME, LET_ORGKEY, LET_CONNECTEDMODE, LET_ALWAYSDOWNLOAD, LET_CATEGORY, LET_CLEARCONDITION) VALUES('WCDIWS_IPAD', 115, 0, 6, 'WCJOBS', 'R5DISPATCHEVENTS', NULL, '-', '-', 'EVNT', NULL);

UPDATE R5CONFIGSETTINGS
SET cfs_xmlconfig = '{ "sections":[ { "name":"Activities", "fields":[ { "id":"ACT_ACT", "lbl":"Activity", "type":"NUM", "def":"", "ro":"NO", "rq":"YES", "len":"80", "hid":"NO" }, { "id":"ACT_NOTE", "lbl":"Note", "type":"CHAR", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" }, { "id":"ACT_TRADE", "lbl":"Trade", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"15", "hid":"NO" }, { "id":"ACT_TASK", "lbl":"Task Plan", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"15", "hid":"NO" }, { "id":"ACT_PERSONS", "lbl":"People Required", "type":"NUM", "def":"", "ro":"NO", "rq":"NO", "len":"8", "hid":"NO" }, { "id":"ACT_EST", "lbl":"Estimated Hours", "type":"NUM", "decimals":"2", "def":"", "ro":"NO", "rq":"NO", "len":"20", "hid":"NO" }, { "id":"ACT_START", "lbl":"Start Date", "type":"DATE", "def":"", "ro":"NO", "rq":"YES", "len":"20", "hid":"NO" }, { "id":"ACT_END", "lbl":"End Date", "type":"DATE", "def":"", "ro":"NO", "rq":"YES", "len":"20", "hid":"NO" }, { "id":"ACT_MATLIST", "lbl":"Material List", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" }, { "id":"ACT_COMPLETED", "lbl":"Completed", "type":"BOOL", "def":"", "ro":"NO", "rq":"NO", "len":"2", "hid":"NO" }, { "id":"ACT_DEFERMAINTENANCE", "lbl":"Deferred Maintenance", "type":"BOOL", "def":"", "ro":"NO", "rq":"NO", "len":"2", "hid":"NO" }, { "id":"ACT_WARRANTY", "lbl":"Warranty", "type":"BOOL", "def":"", "ro":"NO", "rq":"NO", "len":"2", "hid":"YES" }, { "id":"ACT_MANUFACT", "lbl":"Manufacturer", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_RPC", "lbl":"Reason For Repair", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_WAP", "lbl":"Work Accomplished", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_TPF", "lbl":"Technician Part Failure", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_SYSLEVEL_DISP", "lbl":"System Level", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_ASMLEVEL_DISP", "lbl":"Assembly Level", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_COMPLEVEL_DISP", "lbl":"Component Level", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" }, { "id":"ACT_ASSIGNMENTSTATUS", "lbl":"Assignment Status", "type":"LOV-1", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"YES" },{ "id":"DIW_SEQUENCE", "lbl":"Dispatch Sequence", "type":"NUM", "def":"", "ro":"YES", "rq":"NO", "len":"80", "hid":"YES" } ] }, { "name":"Linear Reference Details", "hid":"YES", "ro":"YES", "mode":"CON", "fields":[ { "id":"ACT_FROMPOINT", "lbl":"From Point", "type":"LOV-3", "def":"", "ro":"NO", "rq":"NO", "len":"30", "hid":"NO" }, { "id":"ACT_FROMREFDESC", "lbl":"From Ref. Description", "type":"CHAR", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" }, { "id":"ACT_FROMGEOREF", "lbl":"From Geographical Ref.", "type":"CHAR", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" }, { "id":"ACT_TOPOINT", "lbl":"To Point", "type":"LOV-3", "def":"", "ro":"NO", "rq":"NO", "len":"30", "hid":"NO" }, { "id":"ACT_TOREFDESC", "lbl":"To Ref. Description", "type":"CHAR", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" }, { "id":"ACT_TOGEOREF", "lbl":"To Geographical Ref.", "type":"CHAR", "def":"", "ro":"NO", "rq":"NO", "len":"80", "hid":"NO" } ] } ] }'
WHERE CFS_CODE='TCJACT_IPAD';

