244 lines
6.6 KiB
Plaintext
244 lines
6.6 KiB
Plaintext
|
* MSD.PAY.DATES
|
||
|
*
|
||
|
* AUTHOR: Scott Redmond
|
||
|
* DATE: 01/18/96
|
||
|
* PURPOSE: Load CLOCK.PAY.DATES file with pay period data
|
||
|
*
|
||
|
*---------------------------------------------------------------*
|
||
|
*
|
||
|
$INCLUDE GEN.COMMON
|
||
|
$INCLUDE USER
|
||
|
$INCLUDE CLOCK.PAY.DATES
|
||
|
*
|
||
|
*---------------------------------------------------------------*
|
||
|
*
|
||
|
OPEN 'PT' TO PT ELSE ABORT 201, 'PT'
|
||
|
OPEN 'USER' TO USER.FILE ELSE ABORT 201, 'USER'
|
||
|
OPEN 'CLOCK.PAY.DATES' TO CLOCK.PAY.DATES ELSE ABORT 201, 'CLOCK.PAY.DATES'
|
||
|
OPEN 'CLOCK.GEN.KEYS' TO CLOCK.GEN.KEYS ELSE ABORT 201, 'CLOCK.GEN.KEYS'
|
||
|
*
|
||
|
*---------------------------------------------------------------*
|
||
|
*
|
||
|
TODAY=DATE() ; UTABLE=''
|
||
|
*
|
||
|
*---------------------------------------------------------------*
|
||
|
*
|
||
|
HDG='CLOCK PAY PERIOD DATE UTILITY'
|
||
|
CALL MSD.HDG(HDG)
|
||
|
*
|
||
|
100 *-----------------------------------------------------------*
|
||
|
*
|
||
|
PERIOD=OCONV(TODAY,'D2/') ;* default current period
|
||
|
PERIOD=PERIOD[7,2]:"/":PERIOD[1,2]
|
||
|
PERIOD.HOLD=PERIOD
|
||
|
*
|
||
|
CRT @(0,2):CR:
|
||
|
CRT @(0,22):CL:RV:" Enter period to update, 'R'eport, else '/' to escape ":ERV:
|
||
|
CRT @(2,3):CL:RV:" Enter period to update :":ERV:" ":PERIOD
|
||
|
PROMPT=''
|
||
|
CRT @(27,3):
|
||
|
INPUT PERIOD
|
||
|
IF PERIOD=PF3 THEN GO 9999
|
||
|
IF PERIOD='' THEN PERIOD=PERIOD.HOLD
|
||
|
PROMPT=' '
|
||
|
IF PERIOD='R' THEN
|
||
|
EXECUTE "EX CPD.RPT"
|
||
|
END
|
||
|
IF PERIOD MATCHES '2N/2N' ELSE GO 100
|
||
|
*
|
||
|
GOSUB 4000 ;* determine period/find beginning date
|
||
|
GOSUB 3000 ;* paint screen
|
||
|
GOSUB 3500 ;* display data for selected month
|
||
|
*
|
||
|
500 *--- main prompt -------------------------------------------*
|
||
|
CRT @(0,22):CL:RV:" Enter # (1-3), 'E'nd, 'C'lear week, else '/' to escape :":ERV:
|
||
|
INPUT ANSWER,7
|
||
|
BEGIN CASE
|
||
|
CASE ANSWER='C'
|
||
|
CRT @(0,22):CL:RV:" Enter week # to clear (1-3) :":ERV:
|
||
|
INPUT CANS,9
|
||
|
IF CANS >= 1 AND CANS <= 3 THEN
|
||
|
UTABLE<CANS>=''
|
||
|
GOSUB 3000 ;* repaint screen
|
||
|
GOSUB 3500 ;* redisplay data
|
||
|
GO 500
|
||
|
END
|
||
|
CASE ANSWER='E'
|
||
|
GOSUB 4500 ;* write data
|
||
|
CASE ANSWER='/'
|
||
|
IF UTABLE # PAY.HOLD THEN
|
||
|
LOOP
|
||
|
CRT @(0,22):CL:BEEP:RV:" Save changes (Y/N) :":ERV:
|
||
|
INPUT CHANS,9
|
||
|
UNTIL CHANS='Y' OR CHANS='N' DO REPEAT
|
||
|
IF CHANS='Y' THEN GOSUB 4500 ;* write data
|
||
|
END
|
||
|
CASE ANSWER>=1 AND ANSWER<=3
|
||
|
GOSUB 1000 ;* update 'update array'
|
||
|
GO 500
|
||
|
CASE 1
|
||
|
GO 500
|
||
|
END CASE
|
||
|
*
|
||
|
GO 100 ;* return to update additional period(s)
|
||
|
*
|
||
|
9999 * --- end -----*
|
||
|
ENTER MSD.INFO.ACCRUAL
|
||
|
*
|
||
|
1000 *--- update line one (1) ----------------------------------*
|
||
|
BEGIN CASE
|
||
|
CASE ANSWER=1 ; UROW=9
|
||
|
CASE ANSWER=2 ; UROW=12
|
||
|
CASE ANSWER=3 ; UROW=15
|
||
|
END CASE
|
||
|
UCOL='-6'
|
||
|
FOR CC = 1 TO 5
|
||
|
CRT @(0,22):CL:RV:" Enter date (Ex: 1.2, 01/02/97) ":ERV:
|
||
|
UCOL=UCOL+12
|
||
|
1500 *
|
||
|
CRT @(UCOL+1,UROW):OCONV(UTABLE<ANSWER,CC>,'D2/')
|
||
|
PROMPT=''
|
||
|
CRT @(UCOL,UROW):
|
||
|
INPUT RESPONSE,10
|
||
|
PROMPT=' '
|
||
|
IF RESPONSE=PF3 THEN RETURN
|
||
|
*
|
||
|
IF CC > 1 AND RESPONSE='<' THEN ;* back up one field
|
||
|
CC=CC-1
|
||
|
UCOL=UCOL-12
|
||
|
GO 1500
|
||
|
END
|
||
|
*
|
||
|
IF RESPONSE='' THEN
|
||
|
IF UTABLE<ANSWER,CC>='' THEN
|
||
|
IF CC=1 THEN RETURN
|
||
|
IF CC >= 2 AND CC <= 4 THEN
|
||
|
CRT @(0,22):CL:BEEP:RV:" Required Information - Enter date <return> :":ERV:
|
||
|
INPUT ANY,6
|
||
|
GO 1500 ;* try again
|
||
|
END
|
||
|
END ELSE
|
||
|
CRT @(UCOL+1,UROW):OCONV(UTABLE<ANSWER,CC>,'D2/')'L#10'
|
||
|
END
|
||
|
END ELSE
|
||
|
RESPONSE=ICONV(RESPONSE,'D')
|
||
|
IF RESPONSE > 1 THEN
|
||
|
UTABLE<ANSWER,CC>=RESPONSE
|
||
|
CRT @(UCOL+1,UROW):OCONV(UTABLE<ANSWER,CC>,'D2/')'L#10'
|
||
|
END ELSE
|
||
|
CRT @(0,22):CL:RV:" Invalid date <return> :":ERV:
|
||
|
INPUT ANY,9
|
||
|
GO 1500 ;* try again
|
||
|
END
|
||
|
IF CC=3 THEN ;* check for sunday
|
||
|
IF OCONV(RESPONSE,'DWA') # 'SUNDAY' THEN
|
||
|
CRT @(0,22):CL:BEEP:RV:" Beginning date must be Sunday <return> :":ERV:
|
||
|
INPUT ANY,8
|
||
|
GO 1500 ;* try again
|
||
|
END
|
||
|
END
|
||
|
IF CC=4 THEN ;* check for saturday
|
||
|
IF OCONV(RESPONSE,'DWA') # 'SATURDAY' THEN
|
||
|
CRT @(0,22):CL:BEEP:RV:" Beginning date must be Saturday <return> :":ERV:
|
||
|
INPUT ANY,8
|
||
|
GO 1500 ;* try again
|
||
|
END
|
||
|
END
|
||
|
END
|
||
|
IF CC = 5 THEN
|
||
|
UTABLE<ANSWER,6>=(UTABLE<ANSWER,4>-UTABLE<ANSWER,3>)+1
|
||
|
CRT @(UCOL+16,UROW):UTABLE<ANSWER,6>'L#10'
|
||
|
END
|
||
|
NEXT CC
|
||
|
RETURN
|
||
|
*
|
||
|
3000 *--- paint screen -----------------------------------------*
|
||
|
CRT @(0,6):CR:
|
||
|
CRT @(7,6):CL:RV:" Pay ":ERV:
|
||
|
CRT @(7,7):CL:RV:" Date ":ERV:
|
||
|
CRT @(19,6):CL:RV:" Check ":ERV:
|
||
|
CRT @(19,7):CL:RV:" Issue ":ERV:
|
||
|
CRT @(30,6):CL:RV:" Beginning ":ERV:
|
||
|
CRT @(30,7):CL:RV:" Date ":ERV:
|
||
|
CRT @(43,6):CL:RV:" Ending ":ERV:
|
||
|
CRT @(43,7):CL:RV:" Date ":ERV:
|
||
|
CRT @(54,6):CL:RV:" Transmit ":ERV:
|
||
|
CRT @(54,7):CL:RV:" Date ":ERV:
|
||
|
CRT @(66,6):CL:RV:" Number of ":ERV:
|
||
|
CRT @(66,7):CL:RV:" Days Paid ":ERV:
|
||
|
CRT @(1,9):CL:RV:"1":ERV:
|
||
|
CRT @(1,12):CL:RV:"2":ERV:
|
||
|
CRT @(1,15):CL:RV:"3":ERV:
|
||
|
RETURN
|
||
|
*
|
||
|
3500 *--- display period data ----------------------------------*
|
||
|
FOR AA = 1 TO 3
|
||
|
BEGIN CASE
|
||
|
CASE AA=1 ; UROW=9
|
||
|
CASE AA=2 ; UROW=12
|
||
|
CASE AA=3 ; UROW=15
|
||
|
END CASE
|
||
|
UCOL='-6'
|
||
|
FOR CC = 1 TO 6
|
||
|
UCOL=UCOL+12
|
||
|
IF CC < 6 THEN
|
||
|
CRT @(UCOL+1,UROW):OCONV(UTABLE<AA,CC>,'D2/')
|
||
|
END ELSE
|
||
|
CRT @(UCOL+4,UROW):UTABLE<AA,CC>'L#10'
|
||
|
END
|
||
|
NEXT CC
|
||
|
NEXT AA
|
||
|
RETURN
|
||
|
*
|
||
|
4000 *--- determine period date --------------------------------*
|
||
|
UTABLE=''
|
||
|
PERIOD.KEY=PERIOD[1,2]:PERIOD[4,2]
|
||
|
READ PAY.TABLE FROM CLOCK.PAY.DATES,PERIOD.KEY ELSE PAY.TABLE=''
|
||
|
FOR EE = 1 TO 3
|
||
|
FOR FF = 1 TO 6
|
||
|
UTABLE=INSERT(UTABLE,EE,FF;PAY.TABLE<FF,EE>)
|
||
|
NEXT FF
|
||
|
NEXT EE
|
||
|
PAY.HOLD=UTABLE
|
||
|
BDATE=ICONV(PERIOD[4,2]:"/01/":PERIOD[1,2],'D')
|
||
|
CRT @(2,3):CL:RV:" Enter period to update :":ERV:" ":PERIOD'L#5':SPACE(4):OCONV(OCONV(BDATE,'DMA'),'MCT'):" ":OCONV(BDATE,'DY')
|
||
|
RETURN
|
||
|
*
|
||
|
4500 *--- write data -------------------------------------------*
|
||
|
PERIOD.KEY=PERIOD[1,2]:PERIOD[4,2]
|
||
|
FOR EE = 1 TO 3
|
||
|
FOR FF = 1 TO 6
|
||
|
PAY.TABLE<FF,EE>=UTABLE<EE,FF>
|
||
|
NEXT FF
|
||
|
NEXT EE
|
||
|
*
|
||
|
*----- figure week 1 2 & 3 beginning and ending dates ----------*
|
||
|
FOR GG = 1 TO 3 ;* number of periods in month
|
||
|
WEEKS=0 ; ONE.END='' ; TWO.END='' ; THREE.END=''
|
||
|
FOR HH = PAY.TABLE<3,GG> TO PAY.TABLE<4,GG>
|
||
|
IF OCONV(HH,'DWA')="SATURDAY" THEN
|
||
|
WEEKS=WEEKS+1
|
||
|
IF WEEKS=1 THEN
|
||
|
PAY.TABLE<CPD$WEEK.ONE.END,GG>=HH
|
||
|
END
|
||
|
IF WEEKS=2 THEN
|
||
|
PAY.TABLE<CPD$WEEK.TWO.END,GG>=HH
|
||
|
END
|
||
|
IF WEEKS=3 THEN
|
||
|
PAY.TABLE<CPD$WEEK.THREE.END,GG>=HH
|
||
|
END
|
||
|
END
|
||
|
NEXT HH
|
||
|
PAY.TABLE<CPD$NUM.WEEKS,GG>=WEEKS
|
||
|
NEXT GG
|
||
|
*
|
||
|
FIRST.DAY=ICONV(PERIOD.KEY[3,2]:"/28/":PERIOD.KEY[1,2],'D')
|
||
|
THIS.MONTH=OCONV(FIRST.DAY,'DM')
|
||
|
FOR II = FIRST.DAY TO FIRST.DAY+5
|
||
|
IF OCONV(II,'DM') # THIS.MONTH THEN
|
||
|
PAY.TABLE<CPD$NEXT.PERIOD>=OCONV(II,'D2/')[7,2]:OCONV(II,'D2/')[1,2]
|
||
|
END
|
||
|
NEXT II
|
||
|
WRITE PAY.TABLE ON CLOCK.PAY.DATES,PERIOD.KEY
|
||
|
RETURN
|