Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Payroll SQL View

Posted on by Microsoft Employee

Hi,  Do you have any Payroll SQL Views that will display the Employee details, salary, deductions, benefits, posting date with GL distributions? 

*This post is locked for comments

  • Deb@gpsupport Profile Picture
    Deb@gpsupport 112 on at
    Payroll SQL View
    I don't need one with GL distributions, but I do need one that includes FED/FICA/MED withholdings for an a file to send to a payroll service for a GP company moving off GP Payroll.  I still cannot understand why this view doesn't already exist in GP.
  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: Payroll SQL View

    Hi Pete,

    I will be happy to sent the statement. Send your email address to me at leslievail@earthlink.net

    Again, the query I created doesn't look at transactions, it's purely looking at setups. What it might help you see is how to do a union among tables that have very different layouts.

    Kind regards,

    Leslie

  • Pete72 Profile Picture
    Pete72 540 on at
    RE: Payroll SQL View

    Hi Leslie,

    Would it be possible to send me the sql statement you mention that has the pay, benefits and deductions. I might be able to leverage off that to determine the distribution accounts.

    Thanks

  • Kumar_Sat Profile Picture
    Kumar_Sat 1,146 on at
    RE: Payroll SQL View

    Distribution once posted are stored in CPY30231 which you can filter by batch id, employee ID and posting date.

  • Kumar_Sat Profile Picture
    Kumar_Sat 1,146 on at
    RE: Payroll SQL View

    Also, this is only for the work tables, you might have to find the historical ones by yourself or you may union them if you want both. But I wonder, why someone would need distribution for a payroll transaction. I mean one payroll transaction could have 10 distribution lines, so what kind of purpose it would be solving if you see 10 lines per employee in any report, will not it look weird.

  • Suggested answer
    Kumar_Sat Profile Picture
    Kumar_Sat 1,146 on at
    RE: Payroll SQL View

    SELECT comp.INTERID
     ,a.PEmployeeID
     ,a.PCutoffDate
     ,a.PEIDeducted18
     ,a.PCPPDeducted16
     ,a.PEmploymentIncome14
     ,a.PStartDate
     ,c.PPaychqNum
     ,c.PChequeAmount
     ,a.PIncomeTaxDeducted22
     ,d.PDescription
     ,d.PIncomeCode
     ,d.PRate
     ,d.PPayrollCodeType
     ,d.PLineTotal
     ,d.PYTDAmount
     ,d.PMatchingOvertimePayCode
     ,d.PUnits
     ,b.PFirstName
     ,b.PLastName
     ,b.PAddress1
     ,b.PAddress2
     ,b.PCity
     ,b.PProvince
     ,b.PPostalCode
     ,c.PChequeDate
    FROM DYNAMICS..SY01500 comp
    INNER JOIN CPY30150 a
     ON comp.INTERID = DB_NAME()
    INNER JOIN CPY10100 b
     ON a.PEmployeeID = b.PEmployeeID
    INNER JOIN CPY30110 c
     ON a.PEmployeeID = c.PEmployeeID
     AND a.BACHNUMB = c.BACHNUMB
    LEFT OUTER JOIN CPY30161 d
     ON a.BACHNUMB = d.BACHNUMB
     AND a.PEmployeeID=d.PEmployeeID
    LEFT OUTER JOIN CPY10101 e
     ON a.PEmployeeID = e.PEmployeeID
    WHERE d.PDescription NOT LIKE '%offset%'
    --AND a.PEmployeeID = @EmployeeNumber
    --AND c.PPaychqNum = @PaymentNumber
    ORDER BY d.PEmployeeID

    You have to add the GL distribution as a left outer join and then you should be fine

  • Pete72 Profile Picture
    Pete72 540 on at
    RE: Payroll SQL View

    Thanks for your reply Leslie.

    I'm really looking at the best way to reconcile payroll detail with the G/L as opposed to a form of report. The G/L shows the employee name and amount but I'm trying to tie this to their respective checks which includes paycode information. I don't see a transaction table that stores both the paycode and the G/L account so the closest thing I can see is the Payroll posting accounts but if these are modified then my historical data wouldn't be accurate.

    What is the best way of reconciling payroll transactions to the General Ledger?

  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: Payroll SQL View

    Hi,

    What exactly are you looking for? I mean, what do you want the report to look like? If you could take one employees paycheck and show the information you wanted, that would be helpful. I've got a view that provides the paycodes, benefits and deductions, but it doesn't have anything related to distribution accounts. Do you want all of the tax and FICA deductions too? A pro-forma would help a lot. Chances are, you only want one side of the distributions, what does that look like?

    Leslie

  • Pete72 Profile Picture
    Pete72 540 on at
    RE: Payroll SQL View

    Me too if anyone has come up with something. Thanks

  • NelsonC Profile Picture
    NelsonC 280 on at
    RE: Payroll SQL View

    Emerald,

    did you ever find a SQL View for this.  I am also looking for this.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans