Virtual Work Periods and Emailing WP Report

Thanks, Jesse!

20characters

So sorry pulling this up, do we have a way to auto email reports at a specific time when using Virtual Workperiods?

Yes you can do that.

Could you give me a basic idea how to achieve that Jesse?

Trying to look around but still couldn’t find a way to trigger a rule to send the reports out at a specific time of a day. Need your advices everyone.

Had to delete my last posts because I misread.

  1. Set Trigger
  2. Create Save Report to File Action
  3. Create Send Email Action
  4. Rule

Trigger

Save Report Action
image

Send Email Action

Rule (not mine, but should work) I convert mine to PDF

C:\Program Files (x86)\SambaPOS5\Reports\WP_[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)]_[=Helper.GetUniqueString().substr(0,4)].xps

You could also look at Data Export for CSV format. Mine is based on:

3 Likes

Hi, thank you for your kindness Joe, the guide is detail. Yeah, I’m sending reports, not database backups. However, I understood just fine the general idea from your previous posts. I put the system into a test run tonight, will get back for the result on next days. Thank you so much! :smile:

FYI

As per JTRTech

On my server SambaPOS is running but not logged in, just on login screen.
Mapping the rule to the server only was to ensure the resulting script was only run once by the server avoiding chance of double running on other terminal (if that is possible or not am not sure but wanted to be safe).
As I understand it trigger is a global event so would trigger the rule on every machine open to triggers at that time.

I didn’t leave the Samba client open on the server last night so it didn’t send. Mapped it and left it open this morning. Worked fine.

1 Like

I’m looking into XPS converter, do we need to put something like delay for few seconds between XPS creation - XPS converter - PDF sending email?

My converter seems not work correctly, I wonder if something like [=Helper.GetUniqueString().substr(4,2)] will work or not.

image

image

image

To add a delay you need to split the rule in to seperate rules for the steps and add execute automation command with a delay action and command name for next rule.

1 Like

Yes you need to add a delay. Create an execute automate command action with a 3 second delay after creating the report. I added this later compared to my screenshots above.

Is the report creating successfully? If not, it’s likely security settings to the reports folder. Why would you want to write it to C:\ ?

I created a reports folder in the SambaPOS5 directory and I didn’t have to make any security changes.

1 Like

Thanks, I’ll try to put the delay in today, still blurry how to do that. Actually, the reports are in C:\SambaPOS5\Reports\ and I made it shorter for screenshot purpose. Oh, and I can create XPS just fine, PDF convert not work through SambaPOS yet.

Okay, not home right now, but I’ll send my screens when I get in. Its generally:

  1. Rule - Trigger/Automation Command Rule (your choice to start the process)
  2. Action - Save Report to File Action (Create XPS)
  3. Action - Execute Automation Command (add delay, select a name for the command)
  4. Rule - Automation Command Executed (whatever you named in #3)
  5. Action - Execute Ghostscript conversion
  6. Action - Email action

I have mine running every two hours to watch for any issues right now.

1 Like

Here’s how my is temporarily setup. I will obviously be setting my report to be execute prior to the close of my virtual work period and when the business is no longer executing orders.

  1. Trigger (Set to your liking)

  2. Action - Save Report to File

  3. Action - Execute Automation Command

  4. Rule - Save Report, Execute Automation Command

Filename:

C:\Program Files (x86)\SambaPOS5\Reports\WP_[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)]_[=Helper.GetUniqueString().substr(0,4)].xps

  1. Action - Start Process

  2. Action - Send Email (set to your needs)

  3. Rule - Automate Command Executed

Arguments:

“C:\Program Files (x86)\SambaPOS5\Reports\WP_[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)][=Helper.GetUniqueString().substr(0,4)].xps" "C:\Program Files (x86)\SambaPOS5\Reports\WP[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)]_[=Helper.GetUniqueString().substr(0,4)].pdf”

Filename:

C:\Program Files (x86)\SambaPOS5\Reports\WP_[=Helper.GetUniqueString().substr(4,2)][=Helper.GetUniqueString().substr(6,2)]_[=Helper.GetUniqueString().substr(0,4)].pdf

1 Like

Thanks! I’m trying now. What is your Retry Count & Retry Minutes? Do we need them in our case?

image

1 Like

I left these blank. I haven’t had any issues with my SMTP server. Worse case scenario I could VPN to the server and grab the report.

Keep in mind, if you’re trying to use GMail SMTP server you might need to grant additional access to devices. I had to do this with my network printer for scanning purposes.

See - Other Setup Options - Use the Gmail SMTP Server: https://support.google.com/a/answer/176600?hl=en

1 Like

Can I have a look at your XPS to PDF batch file? I think I’m having issue there, still can’t convert XPS to PDF. :confounded:

Yeah your batch file is diff. Remove the quotes from your change directory command and script home location values.

@echo off
cls

set rSource=%1
set rTarget=%2

set gxpsLocation=C:\Program Files (x86)\SambaPOS5\Reports\gxps\

:: Delete previous rTarget
if exist %rTarget% del %rTarget%

C:
CD
CD %gxpsLocation%
gxpswin64.exe -sDEVICE=pdfwrite -sOutputFile=%rTarget% -dNOPAUSE %rSource%

It’s just so strange, I tried my best but could not find where the error is. It says the syntax of the command is incorrect.

image

image