Sunday, October 11, 2009

Online Checks - using the GetNextNumberWithGapsCommit() function

Here is a good sample for using the GetNextNumberWithGapsCommit() function for online paycheck numbers.

First on a RowInit() lets gray the field or make it display only on the page.

If %Component = Component.PAY_OL_SHEET Then
Gray(PAY_LINE.PAYCHECK_NBR);
End-If
;

Next, lets get the Max() paycheck number from pay_check currently within Production and insert that number into a custom record.

SQLExec("SELECT MAX(A.PAYCHECK_NBR) FROM PS_PAY_CHECK A WHERE (A.FORM_ID = '******' OR A.FORM_ID = ' ')", &MAX_PAYCHECK_NBR);


INSERT INTO PS_ASU_HR_TRAN_NBR
(ASU_HR_APP_CODE, TRANSACTION_NBR)
VALUES
(
'OLCK' -- A place holder value if you plan to use other types of transactions
,'123456') -- This will be the max number currently within ps_pay_check


SavePreChange code

If %Component = Component.PAY_OL_SHEET Then
If None(PAY_LINE.PAYCHECK_NBR) Or
%Mode = "A" Then
&next_pay_check_nbr = GetNextNumberWithGapsCommit(ASU_HR_TRAN_NBR.TRANSACTION_NBR, 999999999999999, 1, "WHERE ASU_HR_APP_CODE = 'OLCK'");
PAY_LINE.PAYCHECK_NBR.Value = &next_pay_check_nbr;
End-If;
End-If;

No comments: