# Virtual Work Periods and Emailing WP Report

**URL:** <https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995>\
**Category:** V5 Question\
**Created:** [April 8, 2020, 1:10am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995 "2020-04-08T01:10:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Memo](https://forum.sambapos.com/user_avatar/forum.sambapos.com/memo/32/55443_2.png) [@Memo](https://forum.sambapos.com/u/Memo)\
**Post date:** [April 8, 2020, 1:10am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/1 "2020-04-08T01:10:34Z")

</div>

When virtual work periods are enabled, will the closing/opening of the new virtual work period trigger any rules related to the event “Work Period Ended”?

Also, is it safe to assume that SambaPOS needs to be running for any of the above to run?

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [April 8, 2020, 2:22am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/2 "2020-04-08T02:22:01Z")

</div>

Virtual workperiods never close they are one continuous period that uses the last active ticket as end point and the start point you defined for reports but it never actualy ends a work period. You need to end work period to do stock takes etc.

So no it won’t trigger any rules that have to do with work period ends.

It will auto start a wp based on the hour you set though if you ended a wp.

---

<div class="post-metadata">

**Author:** ![Memo](https://forum.sambapos.com/user_avatar/forum.sambapos.com/memo/32/55443_2.png) [@Memo](https://forum.sambapos.com/u/Memo)\
**Post date:** [April 8, 2020, 2:34am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/3 "2020-04-08T02:34:01Z")

</div>

> [@Jesse](#):
>
> So no it won’t trigger any rules that have to do with work period ends.

Thanks, Jesse!

20characters

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [October 26, 2020, 3:42am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/4 "2020-10-26T03:42:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [October 26, 2020, 4:06am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/5 "2020-10-26T04:06:57Z")

</div>

Yes you can do that.

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [October 26, 2020, 4:19am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/6 "2020-10-26T04:19:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [October 31, 2020, 1:09am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/7 "2020-10-31T01:09:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [October 31, 2020, 9:53am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/10 "2020-10-31T09:53:48Z")

</div>

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

 ![image](https://forum.sambapos.com/uploads/default/original/3X/c/a/cac325f1c3e2bc54790bca001bb6827c2a3856e3.jpeg)

Save Report Action  
 ![image](https://forum.sambapos.com/uploads/default/original/3X/d/4/d4b2d98f2c458562ba9451e9903fb544013ba6a1.png)

Send Email Action

 ![image](https://forum.sambapos.com/uploads/default/original/3X/c/c/cc687d37b443c20cd2b8ba96f8c639fbbf79db43.jpeg)

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

 ![image](https://forum.sambapos.com/uploads/default/original/3X/8/7/8750862cdcd4265c92c646aae0283d996b1fdc1d.jpeg)

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

> [@Option to export/save report as PDF?](https://forum.sambapos.com/t/option-to-export-save-report-as-pdf/2167/4):
>
> You can use GhostXPS for this ([http://www.ghostscript.com/download/gpcldnld.html](http://www.ghostscript.com/download/gpcldnld.html)). Download GhostPCL GPL release, put the gxps folder in your sambapos folder, and then create a batch file like this in your sambapos folder (convert.bat): @echo off cls set rSource=%1 set rTarget=%2 set gxpsLocation=“C:\SambaPOS3\gxps” :: Delete previous rTarget if exist %rTarget% del %rTarget% C: CD CD “%gxpsLocation%” gxps.exe -sDEVICE=pdfwrite -sOutputFile=%rTarget% -dNOPAUSE %rSource% Cre…

 ![image](https://forum.sambapos.com/uploads/default/original/3X/2/4/24de9bb17c12883608f8403b8b3a43620f5ee53c.png)

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [October 31, 2020, 11:28am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/11 "2020-10-31T11:28:56Z")

</div>

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! 😄

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [October 31, 2020, 4:05pm UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/12 "2020-10-31T16:05:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [November 4, 2020, 11:15am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/13 "2020-11-04T11:15:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [November 4, 2020, 11:52am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/14 "2020-11-04T11:52:40Z")

</div>

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

![image](https://forum.sambapos.com/uploads/default/original/3X/0/9/09e755c6add552f1580bc853a0cd8e9b0c581ebf.png)

![image](https://forum.sambapos.com/uploads/default/original/3X/8/2/82409e4b8b0ca09eeb4f22d65edabd08e34ce515.png)

![image](https://forum.sambapos.com/uploads/default/original/3X/e/0/e02a16c5085f6c9be11881e008895bd8c1feae46.png)

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [November 4, 2020, 3:00pm UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/15 "2020-11-04T15:00:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [November 4, 2020, 3:12pm UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/16 "2020-11-04T15:12:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [November 4, 2020, 11:52pm UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/17 "2020-11-04T23:52:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [November 5, 2020, 2:06am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/18 "2020-11-05T02:06:20Z")

</div>

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.

 ![image](https://forum.sambapos.com/uploads/default/original/3X/9/7/9765a6f353fa6957d284d23efc4ca53d6b726eab.png)

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [November 5, 2020, 4:57am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/19 "2020-11-05T04:57:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [November 5, 2020, 5:39am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/20 "2020-11-05T05:39:25Z")

</div>

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

![image](https://forum.sambapos.com/uploads/default/original/3X/b/2/b225cc88b1504d2004b2ba679dbbc8a91f2c8763.png)

---

<div class="post-metadata">

**Author:** ![josephrussell](https://forum.sambapos.com/user_avatar/forum.sambapos.com/josephrussell/32/57854_2.png) [@josephrussell](https://forum.sambapos.com/u/josephrussell)\
**Post date:** [November 5, 2020, 5:58am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/21 "2020-11-05T05:58:07Z")

</div>

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](https://support.google.com/a/answer/176600?hl=en)

---

<div class="post-metadata">

**Author:** ![setawild](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@setawild](https://forum.sambapos.com/u/setawild)\
**Post date:** [November 5, 2020, 6:48am UTC](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995/22 "2020-11-05T06:48:03Z")

</div>

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. 😖

[Next page](https://forum.sambapos.com/t/virtual-work-periods-and-emailing-wp-report/21995.md?page=2)
