*************** PAYEMPS.CMD COMMAND FILE ***************************
*	Does normal payroll processing or exceptions.
********************************************************************

SET TALK OFF
STORE T TO Salaries
DO WHILE Salaries
   ERASE
   @  3,20 SAY '   PAYROLL FUNCTIONS		'
   @  6,20 SAY '   1> NORMAL PAYROLL		'
   @  7,20 SAY '   2> PARTIAL PAYMENT(S)	'
   @  8,20 SAY '   3> SKIP EMPLOYEE(S)		'
   @ 10,20 SAY '	<RETURN>'
   WAIT TO Action

   IF Action = '1'
      DO Payroll
   ELSE
     IF Action = '2'
	ERASE
	?
	?
	?
	? 'This procedure allows you to pay less than a full salary if'
	? 'for some reason an employee skipped days of work that are '
	? 'not to be paid for.  Do you want to continue (Y or N)?'
	WAIT TO Continue
	IF !(Continue) = 'Y'
	   RESTORE FROM B:Constant
	   USE B:Personne
	   ? 'Select the employee number for partial payment:'
	   ? '	     (Type 0 to quit.)'
	   ?
	   ?'NO.    NAME		  % OF PAY'
	   LIST Name, Ratio*100 FOR .NOT. *
	   ?
           INPUT 'Which number(0 to quit)?' TO Wipe
	   STORE INT(Wipe) TO Wipe
	   DO WHILE Wipe <> 0
	      GO Wipe
	      ? 'How many days were worked'
	      ? 'since last regular payday?'
	      ? 'Use decimals if needed (1 hour = 0.1333).'
	      ?
	      INPUT TO Worked
	      STORE Worked/11.0000 TO NewRatio
	      REPLACE Ratio WITH NewRatio
	      ?
	      DISP Name, Ratio*100
	      ?
	      INPUT 'Next (0 to quit)? ' TO Wipe
	      STORE INT(Wipe) TO Wipe
	   ENDDO
	ENDIF
	RELEASE All
	
	?
	? 'Do you want to SKIP any employees (Y or N)? '
	WAIT TO Skip
	IF !(Skip) <> 'Y'
	   DO Payroll
	ENDIF
	RELEASE Skip
     ELSE
	IF Action = '3'
	   ERASE
	   ?
	   ?
	   ?
	   ? 'This procedure allows you to skip a paycheck in the payroll'
	   ? 'procedure.  Do you want to continue (Y or N)?'
	   WAIT TO Continue
	   IF !(Continue) = 'Y'
	      RESTORE FROM B:Constant
	      USE B:Personne
	      ? 'Select the number of the employee to skip:'
	      ? '	(Type 0 to quit.)'
	      ?'NO.    NAME		   SKIP'
	      ?
	      LIST Name, Paid FOR .NOT. *
	      ?
	      INPUT 'Which number (0 to quit)? TO Wipe
	      STORE INT(Wipe) TO Wipe
	      DO WHILE Wipe <> 0
		 GO Wipe
		 REPLACE Paid WITH T
		 ?
		 ?'NO.	  NAME		     SKIP'
		 ?
		 DISP Name, Paid
		 ?
		 INPUT 'Next? ("0" to quit) ' TO Wipe
		 STORE INT(Wipe) TO Wipe
	      ENDDO
	   ENDIF
	   RELEASE All

	   ?
	   ? 'Do you want to pay a partial salary'
	   ? 'to any employees (Y or N)?'
	   WAIT TO Part
	   IF !(Part) <> 'Y'
	      DO Payroll
	   ENDIF
	   RELEASE Part
	ELSE
	   IF Action = '4'
	      ? 'Something 4'
	      WAIT
	   ELSE
	      RELEASE All
	      RETURN
	   ENDIF 4
	ENDIF 3
     ENDIF 2
   ENDIF 1
   STORE T TO Salaries
ENDDO Salaries
