Showing posts with label QR/Bar Code. Show all posts
Showing posts with label QR/Bar Code. Show all posts

Wednesday, May 4, 2022

Generate QR Code in Business Central (On-Prime) Version

Hello Friends,

Using QR Generator codeunit in Indian Localization we can generate the QR Code in BC on-Prime version.

Sample Code to Generate QR Code Blob Image File.

report 67467 ItemBarCode
{
    UsageCategory = Administration;
    ApplicationArea = All;
    DefaultLayout = RDLC;
    Caption = 'Item Barcodes (BC On-Prime)';
    RDLCLayout = 'ItemBarcodes.rdl';
    dataset
    {
        dataitem(Item; Item)
        {
            DataItemTableView = sorting("No.");
            RequestFilterFields = "No.";
            RequestFilterHeading = 'Items';
            column(No_; "No.")
            {
            }
            column(Description; Description)
            {
            }

            column(QR_BLOB; ComInf_gRecTmp.Picture)
            {
            }
            trigger OnAfterGetRecord()
            var
                OS_iOS: OutStream;
                IS_iIN: InStream;
                TempBlob: Codeunit "Temp Blob";
                QRBase64String: Text;
                QRGenerator: Codeunit "QR Generator";
            begin
                QRBase64String := Item."No." + '|' + Item."Description";

                TempBlob.CreateInStream(IS_iIN);
                QRGenerator.GenerateQRCodeImage(QRBase64String, TempBlob);
                ComInf_gRecTmp.Reset();
                ComInf_gRecTmp.DeleteAll();

                ComInf_gRecTmp.Init();
                ComInf_gRecTmp.Picture.CreateOutStream(OS_iOS);
                COPYSTREAM(OS_iOS, IS_iIN);
                ComInf_gRecTmp.Insert(TRUE);
                ComInf_gRecTmp.CalcFields(Picture);
            end;
        }
    }

    var
        ComInf_gRecTmp: Record "Company Information" temporary;
}

RDLC Layout File Design:


Sample Output in BC On-Prime:






Note: you need to add depedancy "QR Generator" in indian localization BC Version

    {
      "id": "7106d701-c601-4a5f-97c2-b8b323ae2c18",
      "publisher": "Microsoft",
      "name": "QR Generator",
      "version": "19.0.0.0"
    }

Thank you for reading.
I hope this help someone
Keep Sharing...Keep Growing...


Saturday, August 21, 2021

System.IO.IOException - The file exists --- Dyamics NAV

Hello Experts,

I have face many time below error and it is very hard to find solution first time.

Now i have solution for below issue so though to share with you. 

Error details in event log:

==============================================================

Server instance: DynamisNAV90

Tenant ID: <ii>default</ii>

<ii>Session type: Background

Session ID: 18694

User:

Type: System.IO.IOException

Message:

  <ii>The file exists.

  </ii>

StackTrace:

     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

     at System.IO.Path.InternalGetTempFileName(Boolean checkHost)

     at Microsoft.Dynamics.Nav.Runtime.NavReport.GetSaveAsRenderer(String fileName, ReportFormat format, String& tempFilePath)

     at Microsoft.Dynamics.Nav.Runtime.NavReport.SaveAs(DataError errorLevel, Int32 reportId, String fileName, NavRecord record, ReportFormat format)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SaveReportAsHTML_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SaveReportAsHTML(Int32 reportID, NavVariant recordVariant, NavCode layoutCode)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.GetEmailBody_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.GetEmailBody(ByRef`1 serverEmailBodyFilePath, Int32 reportUsage, NavVariant recordVariant, NavCode custNo, ByRef`1 custEmailAddress, NavCode docNo_iRec)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.OnInvoke(Int32 memberId, Object[] args)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailToCustDirectly_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailToCustDirectly(Int32 reportUsage, NavVariant recordVariant, NavCode docNo, NavText docName, Boolean showDialog, NavCode custNo)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailInBackground_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailInBackground(INavRecordHandle jobQueueEntry)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.OnInvoke(Int32 memberId, Object[] args)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit260.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit260.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit449.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit449.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest(INavRecordHandle jobQueueEntry)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.RunCodeunit(Int32 codeunitId, NavRecordRef recordRef)

     at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.InternalRun()

Source: mscorlib

HResult: -2147024816

</ii>

=============================================================

This error will come at time of system use the TEMP folder for saving any intermedicate result file.

Like - While Generate word layout report, QR Code Generate, Create Zip File, etc. case

Use will face the error on screen like below.


===========================================

Solution:

Delete files from TEMP folder for below users account:

1) Delete temp file in User Machine

2) Delete temp file from NAV Service Acccount User in NAV Application Server.

You can open the TEMP Folder in user machine by click on RUN and type %temp%


Select All and make sure you delete all .tmp files


Done....

Restart NAV in User Machine and try to do the process.
It will solve the issue.

I hope it will help someone in future.
Thank you for reading

Keep Sharing...Keep Growing....

Saturday, June 27, 2015

QR Code Print - Dynamics NAV

Hello Friends,

Recently I have developed the QR Code printing report in one of our domestic client.

I want to share code for QR Code printing.

QR Code Detail: QR codes (abbreviated from Quick Response code) are appearing in many different places today, and they are found to be quick and efficient when it comes to working with mobile phones and other devices which can read them. QR Code is a multipurpose instrument and it can hold all sorts of different types of valuable information like your company’s or your salesperson’s contact details, sales invoice information, promotional codes, location information, checksums, amounts, web links etc., which you can read using a QR code reader to automate some of the routine manual processes, like typing in things manually. 

The QR code is a two-dimensional data-matrix which can be decoded very fast. The format is clearly defined and published as an ISO standard.














NAV Code to Print QR Code

Microsoft has developed QR Code print in Base Dynamics NAV NA Version.

I have found the code from it.


Generate the QR Code Image by following code





Find the more detail about QR code printing in attached Microsoft blog.


Sample Objects Download Link (NAV 2013 R2):
https://1drv.ms/u/s!An8nhANnLJmtiSNrpe0U86FoFIxG