New call-to-action
Results 1 to 10 of 10

Thread: Should a newbie attempt this?

  1. #1
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default Should a newbie attempt this?

    Hi,

    I've been working on a project in which time information is collected each week to assist in preparing payroll. There is a table of master paycodes describing different tasks the various employees perform, with default pay rates for each one. When the employee record is setup, those paycodes that apply to the employee are selected from the master table, so that when the time is actually entered, those codes applicable are available. There are maybe 30 paycodes, and of them, about 10 or so are more or less "standard" for the majority of the employees.

    Can anybody describe a way I can create a button during the employee setup, that would trigger a script of some kind that would copy selected paycodes from the master record over to the employee's record, helping to cut down on employee setup time? I could add a field to the master paycode record that could be tagged as "copy", so those records would be copied.

    As the title implies, I don't know if this would be too dificult to tackle at this time. I can always add the feature later... but any help would be tremendous. Thanks!

  2. #2
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Hi Shawn,

    This would require some programming but could be accomplished. Others may have an easier way, but here is one.

    Create a template table with the various default values that you would like to set.

    Put a button on the setup form. Open an xdialog displaying the templates available and allow for a selection of one of the templates.

    Open the template table, locate the selected template record, and capture the field values from that record.

    Now write those values to your form fields.

    I have done something similar to this but mine was a bit easier. I was setting default values using one discount value (prompting the user for the discount they wanted) and populating several records in a customer discount table with that one value. This was approximately 150 lines of code.

    Good luck
    Cheryl

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default there might be some easier alternatives

    Don't do payroll so excuse my ignorance.

    Does the employee record have multiple fields containing paycodes or is there one field holding a "list" of paycodes?

    Quote Originally Posted by smrogers
    Hi,

    I've been working on a project in which time information is collected each week to assist in preparing payroll. There is a table of master paycodes describing different tasks the various employees perform, with default pay rates for each one. When the employee record is setup, those paycodes that apply to the employee are selected from the master table, so that when the time is actually entered, those codes applicable are available. There are maybe 30 paycodes, and of them, about 10 or so are more or less "standard" for the majority of the employees.

    Can anybody describe a way I can create a button during the employee setup, that would trigger a script of some kind that would copy selected paycodes from the master record over to the employee's record, helping to cut down on employee setup time? I could add a field to the master paycode record that could be tagged as "copy", so those records would be copied.

    As the title implies, I don't know if this would be too dificult to tackle at this time. I can always add the feature later... but any help would be tremendous. Thanks!

  4. #4
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default

    Hi Stan,

    Each employee table stores standard stuff; Employee ID, name, address, DOB, etc. There is a table LINKED to the employee table that stores the paycodes for each employee, linked by employee ID. This table is accessed from the employee setup form via an embedded browse. There is a separate table called "paycodes" that has the default paycodes and rates. When the user is setting up the employee and enters the embded browse, IT (the browse) does a lookup of available paycodes from the paycode table, linked by paycode ID. The user then picks and chooses which paycodes the employee needs from the list, and either accepts the default payrate or overrides it. Those codes are then entered into the table that stores codes for each employee and their rates.

    As I mentioned, for almost every employee, about 10 of these codes are going to be entered for each employee, and then others will be added as necessary. my goal is to just cut down on data entry time by giving the option of populating the employee's own paycode record with those codes that are used by MOST. A Y/N field could be entered into the master paycode table to define which codes are the ones that should be copied over. My dilema... how to copy those selected codes over to the employee table? Would using a script to POST those records over work? I haven't any real experience with posting, so I am not sure.... Thanks for any insight you can provide!!

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default thick on payroll

    Quote Originally Posted by smrogers
    Hi Stan,
    There is a table LINKED to the employee table that stores the paycodes for each employee, linked by employee ID.
    - linked one to many? So there are multiple paycode records per employee?

    I'm thinking on the lines of a multi-select listbox xdialog where the list is computed automatically, populated with values from the paycodes table. Selections in this listbox would populate a variable. Xbasic would then parse the variable, line by line, and create the child paycode records. I'd have to see more to think through overriding the default payrate.

    Just some musings on how to accomplish what you want.

  6. #6
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Shawn,

    You can use some variation of this:
    Code:
    'Pull all paycodes flagged 'Y' to create new records 
    'in the employee paycode table
    
    t_source = table.open("paycode")    
    query.description = "Paycodes" 
    query.filter = "Y/N field name = Y"
    query.options = "" 
    qry = t_source.query_create() 
    count = qry.records_get()
    
    t_source.fetch_first()
    while .NOT. t_source.fetch_eof()
    
        t_dest = table.get("emp_paycode")    
        t_dest.enter_begin(.t.)
            t_dest.fld1 = t_source.fld1
            t_dest.fld2= t_source.fld2
            t_dest.fld3 = t_source.fld3
        t_dest.enter_end(.t.)
        
        xbasic_wait_for_idle()
    
    t_source.fetch_next()   'fetch the next paycode
    end while
    Good luck
    Cheryl

  7. #7
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default

    Wow Cheryl! That looks great... I'm going to have to digest it a bit, but it looks like it could work for me! I'll work on it this afternoon and let you know how I do... thanks.

    Another question as an aside: I'm working on a report with sub-reports; do you know if there is a limit to the number of sub-reports you can have? It works fine with 5, but if I add a 6th the report goes nuts.

    Thanks again!

  8. #8
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Don't forget to close the tables, that code is just a snippet to get you started with the loop.

    I personally have not worked with subreports, I have not yet had the need for them. I cannot imagine needing so many subreports .... but I am sure somebody else can answer your subreport question.

    Cheryl

  9. #9
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    http://support.alphasoftware.com/alp...ifications.htm

    Under layouts it shows unlimited per table/set. I would consider a subreport as a layout so you should not have problems with 6 or even 12 subreports.

    Unless I am misreading it.

  10. #10
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,051

    Default Re: Should a newbie attempt this?

    I found that the magic number to be close to 20. I have a vacation schedule that uses a subreport for each day. I have to do 2 reports, 1 for the first half of a month, one for the second half of the month. My subs are small and I suspect larger ones may reduce the numer availeable.

    Dave M

Similar Threads

  1. Help for newbie
    By Mike Bridges in forum Alpha Five Version 6
    Replies: 12
    Last Post: 10-01-2004, 04:26 AM
  2. Help Newbie
    By Lorraine Pena in forum Alpha Five Version 6
    Replies: 4
    Last Post: 09-10-2004, 02:41 PM
  3. Newbie ???
    By Peter DeBilio in forum Alpha Five Version 5
    Replies: 3
    Last Post: 02-01-2003, 11:02 AM
  4. another attempt at file attach
    By eeetee in forum Alpha Five Version 4
    Replies: 1
    Last Post: 12-17-2002, 06:06 PM
  5. help for a newbie
    By Ubaldo Passamonti in forum Alpha Five Version 5
    Replies: 4
    Last Post: 07-30-2002, 05:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •