PayrollProcessingDescription

Document Sample
PayrollProcessingDescription Powered By Docstoc
					                     Simplified Sequential File Payroll Processing
A system flow chart of payroll processing using sequential files:

  Old Master                                           New Master
     file                                                 file


                        Payroll Processing


  Transaction                                          Paychecks
      file


WHERE:
Old Master File
This file contains semi-permanent payroll-related data about the company's employees. Such data would
include: employee ID, name, address, pay rate, year-to-date gross pay, etc. This file should be sorted by
employee ID in, say, ascending order. (Employee ID is the primary key for this file.)

Transaction File
This file contains data pertinent to the calculation of pay for each employee for a given pay period, such
as a week. A new transaction file is used every pay period. That is, all records are entered each pay
period. Data in this file include: employee ID, hours worked, etc. This file should be sorted in the same
order as the old master file. (Employee ID is the primary key for this file.)

Paychecks
There will be one paycheck printed for each employee that has a record in the transaction file.

Payroll Processing
This processing results from one or more programs, working together. The program(s) print a paycheck
for each employee that has a transaction record. A new master file is also created, which includes all
records from the old master file. New master file records for employees who receive paychecks, will
have their year-to-date fields updated prior to being written to the new master file.

New Master File
This file is identical to the old master file, except this file has year-to-date fields that have been updated as
the result of payroll processing. For example, year-to-date gross pay in this file would reflect the year-to-
date gross pay that was in the old master file plus the gross pay for this pay period, as calculated by the
payroll processing.


The logic for payroll processing is provided by the following flowchart. Java code for this processing is
also provided. Some assumptions made by the processing logic are:
             All data in the files are good (e.g., the right format) and accurate.
             There are no transaction records that do not have an associated old master file record.
             The primary key for the old master and transaction files is employee ID. Both files are
                sorted by employee ID in ascending order.




316e10b5-b691-4b1b-9382-0292c688bc47.doc           1                                   08/08/11 6:53 PM
                Sequential                       Random
                                                                                         Document
                Access Storage                   Access Storage


                 Video Display                   Manual Input
                                                                                     System Symbols
                   Begin & End                                                               Predefined
                                                  Process
                                                                                             Process

                   Decision                            Input/Output                           Control Flow

                                                                                    Program Symbols

               Begin                                             Begin Read Transaction
              MainLine
                                                                      Read Transaction
                                                                          Record
        Initialize Variables
                                                                           End of         Y
                                                                            File                           Trans Key
         Read Transaction                                            N                                    = High Value
                                                                  End Read Transaction
         Read OldMaster                                          Begin Read OldMaster

                                                                      Read OldMaster
           Trans EOF                         Read                         Record
              And                          OldMaster
          OldMast EOF
                                                                           End of        Y                OldMast Key
Y                                                                           File                          = High Value
                                             Write                     N
           N                               NewMaster

            Trans Key
           Greater Than          Y                                End Read OldMaster
           OldMast Key
                                                                 Begin Write NewMaster
          N
                                                                      Write New Master Record
         Produce Paycheck
                                                                  End Write NewMaster

                                                                 Begin Produce Paycheck
            Update
           YTD Fields                                           Calculate Current Gross, Deductions, NetPay


                                                                       Print Paycheck
         Read Transaction
                                                                 End Produce Paycheck

                                                                Begin Update YTD Fields
                End
               Mainline
                                                                Update YearToDate Field Values


                                                                End Update YTD Fields


316e10b5-b691-4b1b-9382-0292c688bc47.doc               2                                       08/08/11 6:53 PM
                                                           Payroll Class Code
    import java.io.*;                                              private static void ReadTransaction()throws Exception
    public class Payroll                                            {
    {                                                                  try
        private static DataInputStream transactionFile;                {
        private static DataInputStream oldMasterFile;                     transactionKey = transactionFile.readUTF();
        private static DataOutputStream newMasterFile;                    currentHoursWorked = transactionFile.readDouble();
        private static String transactionKey, oldMasterKey,               currentDeductions = transactionFile.readDouble();
                                 newMasterKey;                         }
        private static String lastName, firstName, address;            catch (EOFException endOfFile)
        private static double payRate, currentGrossPay, currentNetPay; {
        private static double ytdGrossPay, ytdDeductions;                 transactionKey = END_OF_FILE;
        private static double currentHoursWorked, currentDeductions;   }
        private static final String END_OF_FILE = "zzzzz";          }
                                                                    private static void ReadOldMaster()throws Exception
      public static void main (String[] args)throws Exception       {
      {                                                                try
        transactionFile = new DataInputStream (new FileInputStream     {
                               ("A:\\Payroll\\transactions.txt"));        oldMasterKey = oldMasterFile.readUTF();
        oldMasterFile = new DataInputStream(new FileInputStream           lastName = oldMasterFile.readUTF();
                               ("A:\\Payroll\\oldmaster.txt"));           firstName = oldMasterFile.readUTF();
        newMasterFile = new DataOutputStream(new FileOutputStream         address = oldMasterFile.readUTF();
                               ("A:\\Payroll\\newmaster.txt"));           payRate = oldMasterFile.readDouble();
        ReadTransaction();                                                ytdGrossPay = oldMasterFile.readDouble();
        ReadOldMaster();                                                  ytdDeductions = oldMasterFile.readDouble();
        while(!(transactionKey.equals(END_OF_FILE) &&                  }
                  oldMasterKey.equals(END_OF_FILE)))                   catch (EOFException endOfFile)
        {                                                              {
           if(transactionKey.compareTo(oldMasterKey)>0)                   oldMasterKey = END_OF_FILE;
           {                                                           }
              WriteNewMaster();                                     }
              ReadOldMaster();                                      private static void WriteNewMaster()throws Exception
           }                                                        {
           else                                                        newMasterFile.writeUTF(oldMasterKey);
           {                                                           newMasterFile.writeUTF(lastName);
              ProducePaycheck();                                       newMasterFile.writeUTF(firstName);
              UpdateYTDFields();                                       newMasterFile.writeUTF(address);
              ReadTransaction();                                       newMasterFile.writeDouble(payRate);
              WriteNewMaster();                                        newMasterFile.writeDouble(ytdGrossPay);
              ReadOldMaster();                                         newMasterFile.writeDouble(ytdDeductions);
           }
        }                                                           }
      }                                                             private static void UpdateYTDFields()
                                                                    {
                                                                       ytdGrossPay += currentGrossPay;
                                                                       ytdDeductions += currentDeductions;
                                                                    }
                                                                       private static void ProducePaycheck()
                                                                    {
                                                                       currentGrossPay = currentHoursWorked * payRate;
                                                                       currentNetPay = currentGrossPay - currentDeductions;

                                                                                 System.out.println(oldMasterKey + " " + lastName + ", "
                                                                                              + firstName + " " + currentNetPay);
                                                                             }
                                                                         }




316e10b5-b691-4b1b-9382-0292c688bc47.doc           3                                       08/08/11 6:53 PM

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:8
posted:8/9/2011
language:English
pages:3