7.09 Direct E-Mail from SQL Accounting

Requirements

01. SQL Accounting Version 542 or Version 663 & above.

02. Make sure your computer had set the default E-mail application like Microsoft Outlook, Outlook Express, Mozilla Thunderbird or Windows Live Mail.

03. To Email more then 1 Email Address use comma (eg. support@sql.com.my,sales@sql.com.my)

Steps(Assuming is in the Report Designer - Customer Statement)

01. Click Calc Tab

02. Click View | Events

03. Click on Groups[0] on the Report Objects Panel

04. Right Click OnGetEmailSettings (For procedure Group2OnGetEmailSettings(EmailSettings: TObject);)

05. Click New & Copy (Script 1) Paste below Script

06. Right Click OnGetFileSuffix (For procedure Group2OnGetFileSuffix(var SuffixValue:String);)

07. Click New & Copy (Script 2) Paste below Script

08. Click Design Tab

09. Click CTRL+G

10. Tick the Option Email new file for Groups[0]:Main.Code

11. Click OK & Save

Related topic ==> https://sites.google.com/site/sqlestream/windows-issue/08-how-to-disable-prompt-confirm-email-dialog

Remember:

If you have set the filename refer to Customer Name, please ensure the customer name DO NOT CONTAINS invalid symbols characters such as /,#,*,@....etc.

Script 1

procedure Group2OnGetEmailSettings(EmailSettings: TObject);

var B : TStrings;

M : TppEmailSettings;

s : String;

begin

s := 'SELECT EMAIL FROM AR_CUSTOMERBRANCH ' +

'WHERE BranchType=''B'' ' +

'AND Code = '+ QuotedStr(Main.GetFieldValue('Code'));

s := Trim(DBSQL_GetFieldValue_AsString(S));

M := TppEmailSettings(EmailSettings);

B := M.Recipients;

B.Clear;

B.CommaText := s;

B := M.CarbonCopy;

B.Clear;

// B.CommaText := 'yr CC Email Address';

B := M.BlindCarbonCopy;

B.Clear;

// B.CommaText := 'yr bcc Email Address';

M.Subject := 'Statement: ' + Main.GetFieldValue('CompanyName') + ' - [ ' + Parameter.GetFieldValue('StatementDate') + ']';

B := M.Body;

B.Add('Dear ' + Company.GetFieldValue('Attention'));

B.Add('');

B.Add('This is an auto-generated email, please do not reply to this email.');

B.Add('');

B.Add('Please check the attachment for statement of ' + Parameter.GetFieldValue('StatementDate'));

B.Add('');

B.Add('Best Regards,');

B.Add(Profile.GetFieldValue('CompanyName'));

end;

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

Script 2

procedure Group2OnGetFileSuffix(var SuffixValue:String);

begin

SuffixValue := Main.GetFieldValue('CompanyName');

end;