
CREATE TABLE HRIS_CAFETERIA_MENU_SETUP 
(	
"MENU_ID" NUMBER(10, 0) NOT NULL PRIMARY KEY,
"MENU_NAME" VARCHAR2(30 BYTE) NOT NULL , 
"QUANTITY" FLOAT(126) NOT NULL , 
"RATE" FLOAT(126) NOT NULL , 
"REMARKS" VARCHAR2(100 BYTE), 
"CREATED_BY" NUMBER(10, 0) NOT NULL ,
"CREATED_DATE" DATE DEFAULT TRUNC(SYSDATE), 
"COMPANY_ID" NUMBER(10, 0) NOT NULL, 
FOREIGN KEY(COMPANY_ID) REFERENCES HRIS_COMPANY(COMPANY_ID),
STATUS CHAR(1) DEFAULT 'E' CHECK (STATUS IN ('D','E'))
);


CREATE TABLE HRIS_CAFETERIA_TIME_CODE 
(	
"TIME_ID" NUMBER(10,0) NOT NULL PRIMARY KEY,
"TIME_NAME" VARCHAR2(30 BYTE) NOT NULL , 
"REMARKS" VARCHAR2(100 BYTE), 
"CREATED_BY" NUMBER(10, 0) NOT NULL , 
"CREATED_DATE" DATE DEFAULT TRUNC(SYSDATE) , 
"COMPANY_ID" NUMBER(10,0) NOT NULL,
FOREIGN KEY(COMPANY_ID) REFERENCES HRIS_COMPANY(COMPANY_ID),
STATUS CHAR(1) DEFAULT 'E' CHECK (STATUS IN ('D','E'))
);
 

CREATE TABLE HRIS_CAFETERIA_MENU_TIME_MAP
(	
"MAP_ID" NUMBER(10, 0) NOT NULL PRIMARY KEY,
"MENU_ID" NUMBER(10, 0) NOT NULL , 
"TIME_ID" NUMBER(10, 0) NOT NULL , 
"REMARKS" VARCHAR2(100 BYTE), 
"CREATED_BY" NUMBER(10, 0) NOT NULL , 
"CREATED_DATE" DATE DEFAULT TRUNC(SYSDATE), 
"COMPANY_CODE" NUMBER(10, 0) NOT NULL,
"TYPE" VARCHAR2(20)
) ;


CREATE TABLE HRIS_CAFETERIA_LOG
(	
"LOG_NO" NUMBER(10, 0) NOT NULL PRIMARY KEY, 
"LOG_DATE" DATE NOT NULL, 
"EMPLOYEE_ID" NUMBER NOT NULL, 
"TIME_ID" VARCHAR2(10 BYTE), 
"CREATED_BY" NUMBER, 
"CREATED_DATE" DATE DEFAULT TRUNC(SYSDATE), 
--"COMPANY_CODE" VARCHAR2(10 BYTE) NOT NULL, 
--"BRANCH_CODE" VARCHAR2(30 BYTE) NOT NULL, 
"PAY_TYPE" CHAR(1 BYTE), 
--"FORM_CODE" VARCHAR2(10 BYTE), 
"TOTAL_AMOUNT" FLOAT(126)
) ;
 

CREATE TABLE HRIS_CAFETERIA_LOG_DETAIL
 (	
"SERIAL_NO" NUMBER(10,0) NOT NULL,
"LOG_DATE" DATE NOT NULL , 
"LOG_NO" NUMBER(10, 0)  NOT NULL ,
"TIME_CODE" VARCHAR2(10 BYTE) NOT NULL , 
"MENU_CODE" VARCHAR2(30 BYTE) NOT NULL , 
"QUANTITY" FLOAT(126) NOT NULL , 
"RATE" FLOAT(126) NOT NULL , 
"TOTAL_AMOUNT" FLOAT(126), 
"CREATED_BY" NUMBER, 
"CREATED_DATE" DATE DEFAULT TRUNC(SYSDATE), 
--"COMPANY_CODE" VARCHAR2(10 BYTE) NOT NULL , 
--"BRANCH_CODE" VARCHAR2(30 BYTE) NOT NULL , 
--"FORM_CODE" VARCHAR2(10 BYTE), 
"EMPLOYEE_ID" NUMBER NOT NULL, 
"PAY_TYPE" CHAR(1 BYTE), 
"MODIFY_DATE" DATE,
FOREIGN KEY (LOG_NO) REFERENCES HRIS_CAFETERIA_LOG (LOG_NO)
);


