Deleting open transactions in PDK

Dynamics GP's PDK timesheet module won't let you delete an old employee, because it will tell you there are unprocessed timesheet or expense report transactions that have not been posted. Yet there is no easy way to see these unprocessed transactions or fix them. Often, these old transactions don't need to be posted as the employee left the company a long time ago and there is no need to post the employee's final timesheet.

Here's a sql command to delete all open timesheet and expense transactions in PDK. Don't run this if you think you need to process them and post them. Run this only if you think there is no need to process and post these open timeseheets and expense reports:

create proc spICB_DeleteOpenPDKTransactions (@employeeid int) as

--select * from pdk10000 where employid=17 and PDK_Document_Status<>9

--select * from pdk10001 where employid=17

--select * from pdk10500 where employid=17

--select * from pdk10501 where EMPLOYID=17

--select * from pdk10502 where EMPLOYID=17

--select * from pdk10503

--exec spICB_DeleteOpenPDKTransactions 31

--Expense Reports

delete from pdk10500 where employid=@employeeid


delete from pdk10000 where employid=@employeeid and PDK_Document_Status<>9

delete from PDK10001 where PDK_TS_No in

(select pdk_ts_no from pdk10000 where employid=@employeeid and PDK_Document_Status<>9)