CREATE  TABLE R5DIVISIONS(DIV_CODE nvarchar(80) NOT NULL,
DIV_DESC nvarchar(80) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (DIV_CODE));

CREATE TABLE R5LINES( LNS_DIVISION nvarchar(80) NOT NULL,
LNS_CODE nvarchar(80) NOT NULL,
LNS_DESC  nvarchar(80) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (LNS_DIVISION, LNS_CODE));

CREATE TABLE R5SECTIONS( SEC_DIVISION nvarchar(80) NOT NULL,
SEC_LINE     nvarchar(80) NOT NULL,
SEC_CODE   nvarchar(80) NOT NULL,
SEC_DESC    nvarchar(80) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (SEC_DIVISION, SEC_LINE, SEC_CODE));

CREATE TABLE R5STATIONS( STS_DIVISION    nvarchar(80) NOT NULL,
STS_LINE        nvarchar(80) NOT NULL,
STS_SECTION   nvarchar(80) NOT NULL,
STS_CODE      nvarchar(80) NOT NULL,
STS_DESC       nvarchar(80) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (STS_DIVISION, STS_LINE, STS_SECTION, STS_CODE));

CREATE TABLE R5TRACKS( TRC_DIVISION    nvarchar(80) NOT NULL,
TRC_LINE        nvarchar(80) NOT NULL,
TRC_CODE      nvarchar(80) NOT NULL,
TRC_DESC       nvarchar(80) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (TRC_DIVISION, TRC_LINE, TRC_CODE));
CREATE TABLE R5MOBILENOTEBOOKEMAILS(
MNE_CODE              nvarchar(30) NOT NULL,
MNE_MOBILENOTEBOOK    nvarchar(30),
MNE_PERSON            nvarchar(15),
MNE_EMAILADDRESS     nvarchar(255),
MNE_MAILEVENT         nvarchar(30),
MNE_MOBILE_CREATED   datetime,
MNE_SENT             datetime,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (MNE_CODE)
);

CREATE TABLE R5MAILEVENTS(
MAE_CODE nvarchar(30) NOT NULL,
MAE_TEMPLATE nvarchar(18) NULL,
MAE_DATE datetime NULL,
MAE_SEND nvarchar(1) NULL,
MAE_RSTATUS nvarchar(4) NULL,
MAE_ERROR nvarchar(255) NULL,
MAE_PARAM1 nvarchar(4000) NULL,
MAE_PARAM2 nvarchar(4000) NULL,
MAE_PARAM3 nvarchar(4000) NULL,
MAE_PARAM4 nvarchar(4000) NULL,
MAE_PARAM5 nvarchar(4000) NULL,
MAE_PARAM6 nvarchar(4000) NULL,
MAE_PARAM7 nvarchar(4000) NULL,
MAE_PARAM8 nvarchar(4000) NULL,
MAE_PARAM9 nvarchar(4000) NULL,
MAE_PARAM10 nvarchar(4000) NULL,
MAE_PARAM11 nvarchar(4000) NULL,
MAE_PARAM12 nvarchar(4000) NULL,
MAE_PARAM13 nvarchar(4000) NULL,
MAE_PARAM14 nvarchar(4000) NULL,
MAE_PARAM15 nvarchar(4000) NULL,
MAE_ATTRIBPK nvarchar(30) NULL,
MAE_EWSURL nvarchar(255) NULL,
MAE_EMAILRECIPIENT nvarchar(1000) NULL,
MAE_PTFSEND nvarchar(1) NULL,
MAE_PTFERROR nvarchar(255) NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (MAE_CODE);

CREATE TABLE R5MOBILENOTEBOOKS( MNB_CODE nvarchar(30) not null, MNB_ORG nvarchar(15) not null, MNB_PRIVATE nvarchar(1) NULL DEFAULT '-', MNB_HISTORY nvarchar(1) NULL DEFAULT '-', MNB_NOTE nvarchar(4000) NULL, MNB_DEFECT nvarchar(1) NULL DEFAULT '-', MNB_OBJECT nvarchar(30) NULL, MNB_OBJECT_ORG nvarchar(15) NULL, MNB_NCFSEVERITY nvarchar(8) NULL, MNB_MTASEVERITY nvarchar(8) NULL, MNB_NCTTYPE nvarchar(30) NULL, MNB_NCTTYPE_ORG nvarchar(15) NULL, MNB_CLASS nvarchar(8) NULL, MNB_CLASS_ORG nvarchar(15) NULL, MNB_NCFCLASS nvarchar(8) NULL, MNB_NCFCLASS_ORG nvarchar(15) NULL, MNB_DIVISION nvarchar(80) NULL, MNB_LINE nvarchar(80) NULL, MNB_TRACK nvarchar(80) NULL, MNB_SECTION nvarchar(80) NULL, MNB_STATION nvarchar(80) NULL, MNB_STATIONING_MAJOR numeric(6) NULL, MNB_STATIONING_MINOR numeric(2) NULL, MNB_DETAILED_LOCATION nvarchar(250) NULL, MNB_CREATED datetime NULL, MNB_CREATEDBY nvarchar(30) NULL, MNB_MOBILECREATED datetime NULL, MNB_UDFCHAR01 nvarchar(80) NULL, MNB_UDFCHAR02 nvarchar(80) NULL, MNB_UDFCHAR03 nvarchar(80) NULL, MNB_UDFCHAR04 nvarchar(80) NULL, MNB_UDFCHAR05 nvarchar(80) NULL, MNB_UDFCHAR06 nvarchar(80) NULL, MNB_UDFCHAR07 nvarchar(80) NULL, MNB_UDFCHAR08 nvarchar(80) NULL, MNB_UDFCHAR09 nvarchar(80) NULL, MNB_UDFCHAR10 nvarchar(80) NULL, MNB_UDFCHAR11 nvarchar(80) NULL, MNB_UDFCHAR12 nvarchar(80) NULL, MNB_UDFCHAR13 nvarchar(80) NULL, MNB_UDFCHAR14 nvarchar(80) NULL, MNB_UDFCHAR15 nvarchar(80) NULL, MNB_UDFCHAR16 nvarchar(80) NULL, MNB_UDFCHAR17 nvarchar(80) NULL, MNB_UDFCHAR18 nvarchar(80) NULL, MNB_UDFCHAR19 nvarchar(80) NULL, MNB_UDFCHAR20 nvarchar(80) NULL, MNB_UDFCHAR21 nvarchar(80) NULL, MNB_UDFCHAR22 nvarchar(80) NULL, MNB_UDFCHAR23 nvarchar(80) NULL, MNB_UDFCHAR24 nvarchar(80) NULL, MNB_UDFCHAR25 nvarchar(80) NULL, MNB_UDFCHAR26 nvarchar(80) NULL, MNB_UDFCHAR27 nvarchar(80) NULL, MNB_UDFCHAR28 nvarchar(80) NULL, MNB_UDFCHAR29 nvarchar(80) NULL, MNB_UDFCHAR30 nvarchar(80) NULL, MNB_UDFNUM01 numeric(24,6) NULL, MNB_UDFNUM02 numeric(24,6) NULL, MNB_UDFNUM03 numeric(24,6) NULL, MNB_UDFNUM04 numeric(24,6) NULL, MNB_UDFNUM05 numeric(24,6) NULL, MNB_UDFDATE01 datetime NULL, MNB_UDFDATE02 datetime NULL, MNB_UDFDATE03 datetime NULL, MNB_UDFDATE04 datetime NULL, MNB_UDFDATE05 datetime NULL, MNB_UDFCHKBOX01 nvarchar(1) NULL DEFAULT '-', MNB_UDFCHKBOX02 nvarchar(1) NULL DEFAULT '-', MNB_UDFCHKBOX03 nvarchar(1) NULL DEFAULT '-', MNB_UDFCHKBOX04 nvarchar(1) NULL DEFAULT '-', MNB_UDFCHKBOX05 nvarchar(1) NULL DEFAULT '-', DMLTYPE nchar(1) NULL DEFAULT ('N'), PRIMARY KEY ( MNB_CODE ));
CREATE TABLE R5MOBILENOTEBOOKREFERENCES(
MNR_MOBILENOTEBOOK				nvarchar(30) NOT NULL,
MNR_REF_MOBILENOTEBOOK 			nvarchar(30) NOT NULL,
MNR_NOTE 						nvarchar(4000) NULL,
MNR_COPIED						nvarchar(1) NULL DEFAULT('-') ,
MNR_MOBILE_CREATED				DATE NULL,
MNR_CREATED						DATE NULL,
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (MNR_MOBILENOTEBOOK, MNR_REF_MOBILENOTEBOOK));

CREATE TABLE 	R5ASPECTTOLERANCE(
AST_PK                    nvarchar(30)  NOT NULL,
AST_ASPECT                nvarchar(30) NOT NULL,
AST_ORG                   nvarchar(15) NOT NULL,
AST_CLASS                          nvarchar(8),
AST_CLASS_ORG                      nvarchar(15),
AST_OBJECT                         nvarchar(30),
AST_OBJECT_ORG                     nvarchar(15) ,
AST_FROM_OBJECTSIZE                numeric(24,6),
AST_TO_OBJECTSIZE                  numeric(24,6),
AST_MEASUREMENT                    varchar(1),
AST_FROMVALUE                      numeric(24,6) ,
AST_TOVALUE                        numeric(24,6) ,
AST_UOM                            nvarchar(30),
AST_CREATENONCONFORMITY            varchar(1) ,
AST_NONCONFORMITYTYPE              nvarchar(30) ,
AST_NONCONFORMITYTYPE_ORG          nvarchar(15) ,
AST_SEVERITY                       nvarchar(8) ,
AST_POINTTYPE                      nvarchar(30) ,
AST_MOBILEBUTTONSEQ                numeric(2),
DMLTYPE nchar(1) NULL DEFAULT ('N'), PRIMARY KEY (AST_PK));



ALTER TABLE R5PERSONNEL add column PER_EMAILADDRESS nvarchar(255) NULL;
ALTER TABLE R5PERSONNEL add column PER_PHONE nvarchar(50) NULL;
ALTER TABLE R5PERSONNEL add column PER_MOBILEPHONENO nvarchar(50) NULL;
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_GOOD nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_POOR nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_ADJUSTED nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_NONCONFORMITYFOUND nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_SIGNALS nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_TRACK nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_MINSLIDERVALUE numeric(24,0);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_MAXSLIDERVALUE numeric(24,0);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_SRCCALCULATEDVALUE nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_FORMULA nvarchar(2000);

ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_GROUP_LABEL nvarchar(8);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_SEVERITY nvarchar(8);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_NONCONFORMITYTYPE nvarchar(30);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_NONCONFORMITYTYPE_ORG nvarchar(15);

ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_TOLERANCESEVERITY nvarchar(8);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_TOLERANCECRNONCONFORMITY nvarchar(1);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_DIRECTION nvarchar(8);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_NOT_APPLICABLE nvarchar(8);


ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_CONDITION_AS_FOUND nvarchar(8);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_TOLERANCE_NCF_TYPE nvarchar(30);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_TOLERANCE_NCF_TYPE_ORG nvarchar(15);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_POSSIBLE_DIRECTIONS nvarchar(200);

ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_POSSIBLE_NA_OPTIONS nvarchar(500);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_POSSIBLE_CONDS_AS_FOUND nvarchar(500);
ALTER TABLE R5ACTCHECKLISTS ADD COLUMN ACK_POSSIBLE_SEVERITIES nvarchar(500);

ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_CONDITION_AS_FOUND nvarchar(8);
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_PERFORMED2 datetime;
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_PERFORMEDBY2 nvarchar(30);
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_PERFORMEDTYPE2 nvarchar(4);
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_REJECTPERFORMEDBY nvarchar(1);
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_REJECTPERFORMEDBY2 nvarchar(1);
ALTER TABLE R5ACTIVITIES ADD COLUMN ACT_REJECTREASON nvarchar(240);

ALTER TABLE R5MOBILENOTEBOOKEMAILS ADD COLUMN MNE_PERSON_DESC nvarchar(80);
ALTER TABLE R5MOBILENOTEBOOKEMAILS ADD COLUMN MNE_MOBILEPHONENO nvarchar(50);
ALTER TABLE R5MOBILENOTEBOOKEMAILS ADD COLUMN MNE_EMAILSTATUS nvarchar(15);

ALTER TABLE R5TASKS ADD COLUMN TSK_JSI VARCHAR(1);
ALTER TABLE R5TASKS ADD TSK_JOBPLAN nvarchar(1) null;

ALTER TABLE R5USERS ADD COLUMN USR_JSIVIEWER    			 VARCHAR(1);
ALTER TABLE R5USERS ADD COLUMN USR_JSISIGNALS   			 VARCHAR(1);
ALTER TABLE R5USERS ADD COLUMN USR_JSITRACK      			 VARCHAR(1);
ALTER TABLE R5USERS ADD COLUMN USR_JSIREVIEWER 				 VARCHAR(1);
ALTER TABLE R5USERS ADD COLUMN USR_MOBILEFIRSTSCREEN		 VARCHAR(1);

ALTER TABLE R5OBJECTS ADD COLUMN OBJ_TOLERANCE_SIZE numeric(24,6) null;

ALTER TABLE R5EVENTS ADD COLUMN EVT_REQUESTSTART datetime;
ALTER TABLE R5EVENTS ADD COLUMN EVT_REQUESTEND datetime;
ALTER TABLE R5EVENTS ADD COLUMN EVT_LASTSTATUSUPDATE datetime;


CREATE TABLE R5NONCONFORMITYTYPEASPECTS(
NTA_ASPECT       varchar(30) not null,
NTA_NONCONFORMITYTYPE_CODE   varchar(30) not null,
NTA_NONCONFORMITYTYPE_ORG   varchar(15) not null,
NTA_NONCONFORMITYTYPE_DESC varchar(80),
NTA_NOTUSED                varchar(1),
DMLTYPE nchar(1) NULL DEFAULT ('N'),
PRIMARY KEY (NTA_ASPECT,NTA_NONCONFORMITYTYPE_CODE,NTA_NONCONFORMITYTYPE_ORG));




INSERT INTO R5SYSCOLUMNS VALUES('R5MOBILENOTEBOOKEMAILS','MNE_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5MOBILENOTEBOOKS','MNB_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5DIVISIONS','DIV_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5LINES','LNS_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5LINES','LNS_DIVISION','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5SECTIONS','SEC_DIVISION','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5SECTIONS','SEC_LINE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5SECTIONS','SEC_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5STATIONS','STS_LINE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5STATIONS','STS_SECTION','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5STATIONS','STS_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5STATIONS','STS_DIVISION','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5TRACKS','TRC_DIVISION','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5TRACKS','TRC_LINE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5TRACKS','TRC_CODE','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');

INSERT INTO R5SYSCOLUMNS VALUES('R5MOBILENOTEBOOKREFERENCES','MNR_MOBILENOTEBOOK','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5MOBILENOTEBOOKREFERENCES','MNR_REF_MOBILENOTEBOOK','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5ASPECTTOLERANCE','AST_PK','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');

INSERT INTO R5SYSCOLUMNS VALUES('R5NONCONFORMITYTYPEASPECTS','NTA_ASPECT','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5NONCONFORMITYTYPEASPECTS','NTA_NONCONFORMITYTYPE_ORG','+',NULL,NULL,NULL,NULL,NULL,NULL,'N');
INSERT INTO R5SYSCOLUMNS VALUES('R5NONCONFORMITYTYPEASPECTS','NTA_NONCONFORMITYTYPE_CODE','+',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_CLEARCONDITION)
VALUES('ICASPT_IPAD',230,0,3,'WCJOBS','R5ASPECTTOLERANCE', 'AST_ORG','-','-',NULL);
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCNBST_IPAD',221,0,3,'OCMNBK','R5STATIONS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCNBDV_IPAD',222,0,3,'OCMNBK','R5DIVISIONS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCNBTK_IPAD',223,0,3,'OCMNBK','R5TRACKS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCNBLN_IPAD',224,0,3,'OCMNBK','R5LINES',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCNBSC_IPAD',225,0,3,'OCMNBK','R5SECTIONS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCMNBK_IPAD',226,0,3,'OCMNBK','R5MOBILENOTEBOOKS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCMNEM_IPAD',227,0,3,'OCMNBK','R5MOBILENOTEBOOKEMAILS',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD)
VALUES('OCMNRF_IPAD',228,0,3,'OCMNBK','R5MOBILENOTEBOOKREFERENCES',NULL,'-','-');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_CLEARCONDITION)
VALUES('BCPROMMNBK_IPAD',229,0,3,'OCMNBK','R5PROPERTYVALUES',NULL,'-','-','AND PRV_RENTITY=''MNBK'' AND PRV_CODE <> ''*''');
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_CLEARCONDITION)
VALUES('ICASPN_IPAD',231,0,3,'WCJOBS','R5NONCONFORMITYTYPEASPECTS', 'NTA_NONCONFORMITYTYPE_ORG','-','-',NULL);
INSERT INTO R5LISTENTITY(LET_DATAGRID,LET_SEQNO,LET_GROUPID,LET_DELINSUPD,LET_FILTER,LET_TABLENAME,LET_ORGKEY,LET_CONNECTEDMODE,LET_ALWAYSDOWNLOAD,LET_CLEARCONDITION)
VALUES('BCDOCWACL_IPAD',232,0,3,'WCJOBS','R5DOCUMENTS',NULL,'-','-','AND DOC_RENTITY=''WACL''');

UPDATE R5LISTENTITY SET LET_FILTER='OCOBJC'
WHERE LET_DATAGRID IN ('OCNCNTE_IPAD','OCNCMTS_IPAD','OCNCNTP_IPAD','OCNCTP_IPAD');

insert into r5configsettings(CFS_CODE, CFS_GROUP, CFS_USER, CFS_COMPTYPE, CFS_CONFIG, CFS_XMLCONFIG, CFS_UPDATED, CFS_DESK)
values('TCMNBK_IPAD', '*', '*', 'U', 1, '{ "sections": [{ "name": "Mobile Notebook", "fields": [{ "id": "MNB_CODE", "lbl": "Mobile Notebook", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_CREATEDBY", "lbl": "Created By", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_CREATEDBY_NAME", "lbl": "Created By Name", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_MOBILECREATED", "lbl": "Date/Time Created", "type": "DATI", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" }, { "id": "MNB_ORG", "lbl": "Organization", "type": "LOV-1", "def": "", "ro": "NO", "rq": "YES", "len": "30", "hid": "NO" }, { "id": "MNB_PRIVATE", "lbl": "Private", "type": "BOOL", "def": "", "ro": "NO", "rq": "NO", "len": "2", "hid": "NO" }, { "id": "MNB_NOTE", "lbl": "Note", "type": "MEMO-1", "def": "", "ro": "NO", "rq": "YES", "len": "256", "hid": "NO" }, { "id": "MNB_EMAILS", "lbl": "Emails", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_REFERENCES", "lbl": "References", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" } ] }, { "name": "Physical Location", "fields": [{ "id": "MNB_DIVISION", "lbl": "Division", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_LINE", "lbl": "Line", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_TRACK", "lbl": "Track", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_SECTION", "lbl": "Section", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATION", "lbl": "In/Nearest Station", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATIONING_MAJOR", "lbl": "Stationing(major)", "type": "NUM", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATIONING_MINOR", "lbl": "Stationing(minor)", "type": "NUM", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_DETAILED_LOCATION", "lbl": "Detailed Location", "type": "CHAR", "def": "", "ro": "NO", "rq": "NO", "len": "80", "hid": "NO" } ] }, { "name": "Defect Details", "fields": [{ "id": "MNB_DEFECT", "lbl": "Defect", "type": "BOOL", "def": "", "ro": "NO", "rq": "NO", "len": "2", "hid": "NO" }, { "id": "MNB_OBJECT", "lbl": "Equipment", "type": "LOV-2", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_OBJECT_ORG", "lbl": "Equipment Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" }, { "id": "MNB_NCFSEVERITY", "lbl": "Severity", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCTTYPE", "lbl": "Type", "type": "LOV-2", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCTTYPE_ORG", "lbl": "Nonconformity Type Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" }, { "id": "MNB_NCFCLASS", "lbl": "Class", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCFCLASS_ORG", "lbl": "Nonconformity Class Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" }, { "id": "MNB_MTASEVERITY", "lbl": "MTA Severity", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_CLASS", "lbl": "Mobile Notebook Class", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_CLASS_ORG", "lbl": "Mobile Notebook Class Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" } ] }, { "name": "Attachments", "sectype": "ATTACHMENTS", "fields": [] } ] } ','2017-10-06',1);

insert into r5configsettings(CFS_CODE, CFS_GROUP, CFS_USER, CFS_COMPTYPE, CFS_CONFIG, CFS_XMLCONFIG, CFS_UPDATED, CFS_DESK)
values('TCMNBK_IPAD', '*', '*', 'U', 1, '{ "sections": [{ "name": "Mobile Notebook", "fields": [{ "id": "MNB_CODE", "lbl": "Mobile Notebook", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_CREATEDBY", "lbl": "Created By", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_CREATEDBY_NAME", "lbl": "Created By Name", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "30", "hid": "YES" }, { "id": "MNB_MOBILECREATED", "lbl": "Date/Time Created", "type": "DATI", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "YES" }, { "id": "MNB_ORG", "lbl": "Organization", "type": "LOV-1", "def": "", "ro": "NO", "rq": "YES", "len": "30", "hid": "NO" }, { "id": "MNB_PRIVATE", "lbl": "Private", "type": "BOOL", "def": "", "ro": "NO", "rq": "NO", "len": "2", "hid": "NO" }, { "id": "MNB_NOTE", "lbl": "Note", "type": "MEMO-1", "def": "", "ro": "NO", "rq": "YES", "len": "256", "hid": "NO" }, { "id": "MNB_EMAILS", "lbl": "Emails", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_REFERENCES", "lbl": "References", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" } ] }, { "name": "Physical Location", "fields": [{ "id": "MNB_DIVISION", "lbl": "Division", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_LINE", "lbl": "Line", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_TRACK", "lbl": "Track", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_SECTION", "lbl": "Section", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATION", "lbl": "In/Nearest Station", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATIONING_MAJOR", "lbl": "Stationing(major)", "type": "NUM", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_STATIONING_MINOR", "lbl": "Stationing(minor)", "type": "NUM", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_DETAILED_LOCATION", "lbl": "Detailed Location", "type": "CHAR", "def": "", "ro": "NO", "rq": "NO", "len": "80", "hid": "NO" } ] }, { "name": "Defect Details", "fields": [{ "id": "MNB_DEFECT", "lbl": "Defect", "type": "BOOL", "def": "", "ro": "NO", "rq": "NO", "len": "2", "hid": "NO" }, { "id": "MNB_OBJECT", "lbl": "Equipment", "type": "LOV-2", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_OBJECT_ORG", "lbl": "Equipment Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "NO" }, { "id": "MNB_NCFSEVERITY", "lbl": "Severity", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCTTYPE", "lbl": "Type", "type": "LOV-2", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCTTYPE_ORG", "lbl": "Nonconformity Type Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "NO" }, { "id": "MNB_NCFCLASS", "lbl": "Class", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_NCFCLASS_ORG", "lbl": "Nonconformity Class Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "NO" }, { "id": "MNB_MTASEVERITY", "lbl": "MTA Severity", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_CLASS", "lbl": "Mobile Notebook Class", "type": "LOV-1", "def": "", "ro": "NO", "rq": "NO", "len": "30", "hid": "NO" }, { "id": "MNB_CLASS_ORG", "lbl": "Mobile Notebook Class Org.", "type": "CHAR", "def": "", "ro": "YES", "rq": "NO", "len": "80", "hid": "NO" } ] }, { "name": "Attachments", "sectype": "ATTACHMENTS", "fields": [] } ] } ',date('now'),1);
UPDATE R5APPSETTINGS SET AST_VALUE = '11321' WHERE AST_NAME='DBVERSION';
