QR Code - codeunit

James111James111 Member Posts: 63
Hi,

I have one question, how i basis Parameter Name on SalesInvoiceHeader."No." in this codeunit,

OBJECT Codeunit 50001 QR Code Mgt.
{
OBJECT-PROPERTIES
{
Date=;
Time=;
Modified=Yes;
Version List=QR Code;
}
PROPERTIES
{
OnRun=VAR
CompanyInfo@1170000004 : Record 2000000006;
SalesInvoiceHeader@1170000003 : Record 112;
TempBlob@1170000002 : Record 99008535;
QRCodeInput@1170000000 : Text[1024];
QRCodeFileName@1170000001 : Text[1024];
BEGIN
// Save a QR code image into a file in a temporary folder
QRCodeInput := CreateQRCodeInput('John,Doe','+555 1231231','john@doe.zzz','www.johndoe.zzz');
QRCodeFileName := GetQRCode(QRCodeInput);
QRCodeFileName := MoveToMagicPath(QRCodeFileName); // To avoid confirmation dialogue on RTC

// Load the image from file into the BLOB field
CLEAR(TempBlob);
ThreeTierMgt.BLOBImport(TempBlob,QRCodeFileName,FALSE);
IF SalesInvoiceHeader.FINDFIRST THEN BEGIN
SalesInvoiceHeader."QR Code" := TempBlob.Blob;
SalesInvoiceHeader.MODIFY;
END;

// Erase the temporary file
IF NOT ISSERVICETIER THEN
IF EXISTS(QRCodeFileName) THEN
ERASE(QRCodeFileName);

MESSAGE('Done!');
END;
}
CODE
{
VAR
ThreeTierMgt@1170000001 : Codeunit 419;

LOCAL PROCEDURE CreateQRCodeInput@1020046(Name@1020000 : Text[80];PhoneNo@1020002 : Text[80];EMail@1020003 : Text[80];URL@1170000000 : Text[80]) QRCodeInput : Text[1024];
BEGIN
QRCodeInput :=
'MECARD:' +
'N:' + Name + ';' +
'TEL:' + PhoneNo + ';' +
'EMAIL:' + EMail + ';' +
'URL:' + URL + ';';
END;

LOCAL PROCEDURE GetQRCode@1020038(QRCodeInput@1020001 : Text[1024]) QRCodeFileName : Text[1024];
VAR
IBarCodeProvider@1020000 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{9FE38730-1A3C-4B84-A8C2-AFAC6A90E641}:'Microsoft Dynamics Nav MX Services'.IBarCodeProvider";
BEGIN
GetBarCodeProvider(IBarCodeProvider);
QRCodeFileName := IBarCodeProvider.GetBarCode(QRCodeInput);
END;

PROCEDURE GetBarCodeProvider@1020001(VAR IBarCodeProvider@1020000 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{9FE38730-1A3C-4B84-A8C2-AFAC6A90E641}:'Microsoft Dynamics Nav MX Services'.IBarCodeProvider");
VAR
QRCodeProvider@1020002 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{69FEA5E6-0A76-4555-B74B-F170956B0098}:'Microsoft Dynamics Nav MX Services'.QRCodeProvider";
BEGIN
IF ISCLEAR(QRCodeProvider) THEN
CREATE(QRCodeProvider,TRUE,TRUE);
IBarCodeProvider := QRCodeProvider;
END;

PROCEDURE MoveToMagicPath@1170000000(SourceFileName@1170000000 : Text[1024]) DestinationFileName : Text[1024];
VAR
FileSystemObject@1170000001 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{0D43FE01-F093-11CF-8940-00A0C9054228}:'Windows Script Host Object Model'.FileSystemObject";
BEGIN
DestinationFileName := ThreeTierMgt.ClientTempFileName('','');
IF ISCLEAR(FileSystemObject) THEN
CREATE(FileSystemObject,TRUE,TRUE);
FileSystemObject.MoveFile(SourceFileName,DestinationFileName);
END;

BEGIN
END.
}
}
Sign In or Register to comment.