Send Report by email

Hi,

Here is my situation:

Working Period is opened everyday at 6:00 am and is closed every night between 2 and 3 am.

At 5:00 AM a trigger executes a rule to save 2 reports to files.

At 5:05 AM a trigger executes a rule to send these 2 reports by email.

Results:

  1. First Problem: each reaport is sent twice.
  2. Second Problem: Working Period report is sent with Endind Time 4:59 AM (1 minutes before trigger) instead of the real Ending Time of Working Period (in the showcase : 2:20 AM)
    WP_2
  3. Third Problem: This morning it CREATES the files with the 2 days old Working period.
    Files WP_1211_2017.xps, created today, 11th of Dec. at 5:00 AM is NOT the Working Period of last night BUT 2 days ago (9 Dec. - 10 Dec.)

Marc

Here are the screenshot.

Working Periods

WP

Rules/Actions

Save Report to File

Send Email

Triggers

TriggerMake reportTriggerSendMail

One problem is that Helper.GetUniqueString() (or any other {DATE:X} functions that you could use in V5) will generate the date/timestamp on the fly, so your saved Report Name will be different than your Report File Attachment, because the Helper is generating timestamps seconds (or minutes) apart from each other in the Actions.

You should generate the Report Filename ONCE and store it in a Program Setting, then use the Program Setting for the Report Save action and the Email Attachment action.

Also, hard-coding the attachment Filename in the Save Report Action and the Email Action is a bad idea. Make it a [:parameter] and feed in the Program Setting Filename from the Rules.

C:\AB\COCINA\Report\WP_[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)]_[=Helper.GetUniqueString().substr(0,4)].xps

Generates only the date (no hh:mm:ss) like WP_MMDD_YYYY.xps which I am fine with due to the fact that I create the file and send it the same day. And that works well … also I will not change it, as at least this part works. The problems are:

  1. Report is sent twice
  2. today “Save report to File” saved today an old working period.
    (ignore the yellows, these are the ones I generated manually)
    archivos

Got it for #2 problem !!!
(I guess)
It might be due to the fact that:

  1. in order to excute the trigger SamPOS.exe has to be running (always the case on the server for administrative purpouses)
  2. As I don’t come on Sundays, SambaPOS was running since the Saturday without closing it on and off or login/logoff !

It must be that because SamPOS behaves like a fool when no log off/log on has happened for more than 1 day as far as reports/tickets/messages/etc … are concerned

So basically I cannot take a day off.

(waitress closes working period from a terminal, server is always on with SambaPOS running)

For #1 problem
(report sent twice)

I don’t think it’s due to the fact that SambaPOS is running:

  1. on the server
  2. on a terminal - I can never be sure the waitress has closed “SambaPOS.exe” on the terminal.

because I mapped the rule with Terminal = Server, or is it another thing that does not work (the mapping)?

That is very likely true. The Trigger mechanism should probably moved into the Message Server service since it is likely to always be running.


As for sending email twice, you wouldn’t happen to have the TO and CC addresses the same would you?


That’s fine if you don’t want to take my advice on “best practices” for SambaPOS. You should almost never hard-code action parameters in the Action itself, especially when those parameters contain things that you know will be dynamic. I have seen this exact problem before because people hard-code the action parameters instead of making them a [:parameter] and wonder why it doesn’t work.

Double email sending solved by update to the latest version.
unreg

help me. if i want send report from sambaposv5 to Appication LINE or Whatsapp how can i do ?

Hire a developer and contact Line or What’s app and have them write an integration.

You can try that, it’s a pay service.

https://www.whatsmate.net/whatsapp-gateway-api.html

A email client on your phone would do it also, no?