💰 Sales Reset
This guide explains how to set up automated daily and monthly sales reset for your JuanFi Vendo system. The script automatically resets income counters at midnight each day and on the first day of each month.
Key Features:
- ✅ Automatic daily sales reset at midnight
- ✅ Automatic monthly sales reset on the 1st of each month
- ✅ Detailed logging for audit trails
- ✅ Zero manual intervention required
Estimated Time: 5-10 minutes Difficulty: Beginner-Intermediate
Prerequisites
- ✅ Access to MikroTik RouterOS terminal
- ✅ JuanFi system with
todayincomeandmonthlyincomescripts - ✅ System clock properly set on MikroTik
- ✅ Existing scheduler configuration (optional, we'll replace it)
Step 1: Remove Old Schedulers
First, remove any outdated sales reset schedulers to avoid conflicts.
Schedulers to Remove:
- ❌
Reset Daily Income - ❌
Reset Monthly Income - ❌ Any other old sales-related schedulers
How to Remove:
- Navigate to System → Scheduler in admin interface
- Find the old schedulers in the list
- Select and delete them
Or use terminal command:
/system scheduler remove [find name="Reset Daily Income"]
/system scheduler remove [find name="Reset Monthly Income"]

Step 2: Create New Sales Reset Scheduler
Create a single consolidated scheduler that handles both daily and monthly resets.
Option A: Terminal Command (Recommended)
Copy and paste this entire command into the MikroTik terminal:
/system scheduler add interval=1d name="Reset Sales" on-event=":local day [:pick [/system clock get date] 8 10];:log warning \"===========<[[ Resetting Daily Sales! ]]>===========\";/system script set source=\"0\" todayincome;:if (\$day = \"01\") do={:log warning \"===========<[[ Resetting Monthly Sales! ]]>===========\";/system script set source=\"0\" monthlyincome;}" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jan/01/2024 start-time=00:00:00
What This Command Does:
- Creates a new scheduler named "Reset Sales"
- Runs every 24 hours (1d interval)
- Resets
todayincomescript variable to "0" daily - Checks if it's the 1st of the month
- Resets
monthlyincomescript variable to "0" on the 1st - Logs all actions for audit trail
Option B: Manual Configuration
If you prefer the GUI, use these settings:
Basic Settings:
| Parameter | Value |
|---|---|
| Name | Reset Sales |
| Start Date | Jan/01/2024 |
| Start Time | 00:00:00 |
| Interval | 1d (1 day) |
Script Content (On Event):
:local day [:pick [/system clock get date] 8 10];
:log warning "===========<[[ Resetting Daily Sales! ]]>===========" ;
/system script set source="0" todayincome;
:if ($day = "01") do={
:log warning "===========<[[ Resetting Monthly Sales! ]]>===========" ;
/system script set source="0" monthlyincome;
}
Policy (Permissions Required):
ftp- File accessreboot- Reboot permissionread- Read datawrite- Write datapolicy- Modify policiestest- Test commandspassword- Password handlingsniff- Packet capturesensitive- Sensitive operationsromon- Remote management

How It Works
Daily Reset (Runs at 00:00:00)
- Extract current date →
day = 01(if 1st of month) or15(if 15th), etc. - Log action → Writes "Resetting Daily Sales!" to system log
- Reset counter → Sets
todayincomescript value to "0" - Vendo displays → Shows $0.00 daily income on next refresh
Monthly Reset (Runs on 1st of month)
- Check if 1st →
if ($day = "01") - Log action → Writes "Resetting Monthly Sales!" to system log
- Reset counter → Sets
monthlyincomescript value to "0" - Vendo displays → Shows $0.00 monthly income on next refresh
Verification
After setting up the scheduler, verify it's working correctly:
Check Scheduler Status
/system scheduler print
Should show:
- Name: "Reset Sales"
- Interval: "1d"
- Next Run: Tomorrow at 00:00:00
- Disabled: "false" (enabled)
Check Logs
View recent activity logs:
/log print where message~"Reset"
Expected Output:
12:34:56 warning: ===========<[[ Resetting Daily Sales! ]]>===========
12:34:57 warning: /system/script: set todayincome=0
(On 1st of month:)
12:34:58 warning: ===========<[[ Resetting Monthly Sales! ]]>=========="
12:34:59 warning: /system/script: set monthlyincome=0
Manual Test
To manually trigger the scheduler for testing:
/system scheduler run [find name="Reset Sales"]
Check logs immediately after to confirm it executed.
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Scheduler doesn't run | Disabled scheduler | Enable: /system scheduler enable [number] |
| Sales not resetting | Incorrect script names | Verify scripts are named todayincome and monthlyincome |
| Wrong reset time | System clock not set | Set correct time: /system clock set time=HH:MM:SS |
| Monthly reset not working | Date format mismatch | Verify date format in logs: [/system clock get date] |
| Multiple resets happening | Duplicate schedulers | Check all schedulers: /system scheduler print |
Advanced: Understanding the Script
Extract Day of Month
:local day [:pick [/system clock get date] 8 10];
- Extracts characters 8-10 from date string (e.g., "jan/01/2024" → "01")
- Allows checking if it's the 1st of the month
Reset Script Variables
/system script set source="0" todayincome;
- Sets the
todayincomescript's source/value to "0" - Resets the income counter for display on Vendo devices
Conditional Monthly Reset
:if ($day = "01") do={ ... }
- Only executes monthly reset if the day equals "01"
- Prevents unnecessary monthly resets on other days
✅ Complete!
Your automated sales reset system is now active. The system will:
- 🔄 Reset daily income every midnight
- 🔄 Reset monthly income on the 1st of each month
- 📝 Log all resets for audit purposes
- ⚡ Require zero manual intervention
Monitor the logs over the next few days to ensure proper operation.