Problem:

How to modify the custom cheque layout to use the CPA date format.

Solution:

Steps:

  1. Open the custom cheque layout in the edit mode by going into Configuration > User defined cheques and paystubs layouts.
  2. Highlight the layout and click Edit (If you have not created a cheque layout, you will need to make one first by clicking add).
  3. Go to cheque portion select the object (item) which is in use to display the date on the cheque. Take a note of the properties values for Username, DataPipeline and Datafield from the property window.
  4. Go to Calc tab from the top menu and right click on the blank area under the Report Object Pane and choose the Events option. Now find the object for which you noted the name in the previous step and select it.
  5. On the right hand side you will see a window with Events listed out. Select the OnGetText event and click on the window below. Select the window at the bottom it will automatically show you some text like begin, Text:= and End. Delete all the text in this and paste the following code and save the layout.

    procedure ChqDateOnGetText(var Text: String);
    i, j : Integer;
    begin

    Text := FormatDateTime('ddmmyyyy',CustomPaycards['Pay Date']);

    i := length(Text) * 2;
    j := 1;
    while j < i do
    begin
    Insert(' ', Text, j+1);
    j := j +2;
    end;
    end;

**Note**
If you want some other date format other than the one shown in the code you can change the ddmmyyyy in the above code to other formats like (mmddyyyy. yyyymmdd etc).Also make sure in the above code the CustomPaycards is the datapipeline value and Pay Date is the Datafield value which you noted in step 2. If it is different than use what you have noted in step 2.

This above code is to insert one blank space between each date character if you need to have more than one blank space you can increase the spaces by editing the code. For Example:Insert(' ', Text, j+1); (insert one blank space between date characters)
Insert('  ', Text, j+1); (insert two blank spaces, between the date characters)