Fast Report - Share Text Message - WhatsApp

From eStream Software
Revision as of 08:10, 5 November 2018 by Twfaung (talk | contribs) (→‎Setting)

Introduction

From Version 849.768 & above user can Share the report to WhatsApp, Skype, Line & etc

Requirement

  • Fast Report
  • WhatsApp, Skype, Line & etc Login
  • SQL Accounting Version 849.768 & above

Setting

Below is example using Sales Invoice

FR-WhatsApp-01.jpg
01. Click the Code Tab
02. Scroll down look for procedure SetUp
03. Copy below script & paste it between the begin & end; in procedure SetUp
  SQL := 'SELECT B.Description As ReportName, B.Description3 As Body '+
         'FROM SL_QT A ' +
         'INNER JOIN SL_QTDTL B ON (A.Dockey=B.Dockey) ' +
         'WHERE A.DocNo=''WHATSAPP'' ' +
         'ORDER BY B.SEQ';
  AddDataSet('plShareMsg', ['ReportName', 'Body'])
  .GetDBData(SQL);
04. Click File | Save As... to save the file (eg Sales Invoice 8 (SST 2)-WhatApp)
05. Click File | Exit to exit the report design
06. Click Design again in the report designer for the file just save on Steps 5 (eg Sales Invoice 8 (SST 2)-WhatApp)
07. Click the Code Tab
FR-WhatsApp-02.jpg
08. Scroll down look for function StrToFloatDef(const lFld:Variant):string
09. Copy below script & paste it above the function
WhatsApp Script (Last Script Update : 05 Nov 2018)
procedure GetShareMsg;
var D  : TfrxDataSet;
   lFN : String;
begin
  lFN := Trim(Report.ReportOptions.Name);
  lFN := StringReplace(lFN,'.fr3','');
  D := Report.GetDataSet('plShareMsg');
  D.First;
  While not D.Eof do begin
    if Trim(D.Value('ReportName')) = lFN then
      Break;
    D.Next;
  end;
end;

function GetShareText: string;
begin
  GetShareMsg;
  Result := GetFldInfo(RichTextToPlainText(<plShareMsg."Body">))
end;
FR-WhatsApp-02.jpg
10. Scroll up again look for function GetFldInfo(const AStr:String):String;
11. Copy below script & paste it between the Add('plEMailTpl'); & end;
  Add('Document_Currency');