Skip to main content

Navision - How to Format Dates for Cheque Reports?

Hi all,

This is nothing most of you would be interested in. This post only show steps about how to Format Cheque Date specific to Actual Cheque.

If you don't know this, then please go ahead.

The intended readers for this post are the Peoples who have recently joined and are still Learning NAV. Based on Request received via Contact Form..


So in Cheque Report we have date like 22/10/2014 i.e DD/MM/YYYY which may not what Customer is looking for in actual cheque. Customer Normally look for format as per country regulation. In India current Cheque Date format is as shown below -


How we can change that in Navision Report 1401 ?

Design the Report 1401 you will see something like shown below -


Go to the Code of Second Data Item i.e GenJnlLine and on Trigger onAfterGetRecord you need to search for CheckDateText.

This is the text constant that is used to display Date in Cheque Reports.

So how can i change that to my desired format?

I will create three global variables as listed below -

CheckDateText1 - Data Type (Text) - Length (30)
ChrB                    - Data Type (Text) - Length (1)
Chr1                     - Data Type (Text) - Length (1)  & Dimension (8)

Now I will change code as below -

Standard -
-------------------------------------------------------------------------
  IF "Cheque Date" <> 0D THEN
    CheckDateText := FORMAT("Cheque Date",0,4);
ELSE
    CheckDateText := FORMAT("Posting Date",0,4);
-------------------------------------------------------------------------
Modified -
-------------------------------------------------------------------------
  IF "Cheque Date" <> 0D THEN
    CheckDateText := FORMAT("Cheque Date",0,'<Day,2><Month,2><Year4>')
  ELSE
    CheckDateText := FORMAT("Posting Date",0,'<Day,2><Month,2><Year4>')

  Chr1[1] := FORMAT(CheckDateText[1]);
  Chr1[2] := FORMAT(CheckDateText[2]);
  Chr1[3] := FORMAT(CheckDateText[3]);
  Chr1[4] := FORMAT(CheckDateText[4]);
  Chr1[5] := FORMAT(CheckDateText[5]);
  Chr1[6] := FORMAT(CheckDateText[6]);
  Chr1[7] := FORMAT(CheckDateText[7]);
  Chr1[8] := FORMAT(CheckDateText[8]);
  ChrB := ' ';

 CheckDateText1 := Chr1[1] + ChrB + Chr1[2] + ChrB + Chr1[3] +  ChrB + Chr1[4] + ChrB + Chr1[5] + ChrB + Chr1[6] +  ChrB+ Chr1[7] + ChrB + Chr1[8];
-------------------------------------------------------------------------

I will replace the source expression of Cheque Date From CheckDateText to CheckDateText1.

What Exactly the Code DO?

1. The Code First Convert the Date as Format (DDMMYYYY).

2. Put Each part of the Text i.e Date into a text constant of Length 1 (8 Dimension for 8 Values).

3. ChrB is used to put Spaces in the Middle of Date Parts. (NEED TO BE CHANGED AS PER CHEQUE)

The No. of occurrence of ChrB changes as per cheque that you want to print.

I hope you find the post useful and let me know the feedback of such basic Navision post on the Contact form or as a comment to post.

Stay tuned for More.

Regards,
Saurav Dhyani
www.sauravdhyani.com

Comments

Popular posts from this blog

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

MSDYN365BC - Data Upgrade To Microsoft Dynamics 365 Business Central on premises.

Hi Readers, We have already talked about the number of steps for upgrading to Business Central on Premises from different NAV versions. After that article, I received multiple requests for an article which list down steps for Data Migration. In this article, we will discuss steps of data migration to MSDYN365BC (on-Prem) from NAV 2017. For this article, I am considering a Cronus Demo Database without any customization. For an actual upgrade project, we will have to complete object merge using compare and Merge process. After the Merge Process, the next step is data migration. Let's discuss those steps. Direct Upgrade to Microsoft Dynamics 365 Business Central (on-Prem) is from following versions - 1. NAV 2015. 2. NAV 2016. 3. NAV 2017. 4. NAV 2018.