Skip to content

Scheduled Tasks

Andy Theuninck edited this page Feb 3, 2016 · 2 revisions

CORE Office provides an interface for managing scheduled tasks. For Linux/Unix veterans, this is just a light wrapper around cron. By default it's in the admin menu.

The Transaction Shuffle

The most important nightly task to understand is transaction archiving. Sooner or later, depending on one's hardware budget, reporting queries against all transaction data, ever get unbearably slow, so transaction data is rotated into other tables and databases. The Transaction Archiving task handles this rotation. It should typically be run once a day, after midnight.

At any given time, transaction data can be found in:

  • The dtransactions table in the transactional database. This contains the current day's transactions.
  • The transarchive table in the transactional database. This contains the previous 90 days' transactions.
  • The dedicated archive database (default name: trans_archive). This contains everything except what's in dtransactions.

There are two different methods for archive data controlled by the Archive Method setting on Office's main configuration page. The partitions method will store all historical data in one large, partitioned table named bigArchive. The tables method will create a separate table for each month of data named transArchiveYYYYMM. The partitions approach can be more performant with reporting over long time periods and large data sets and is the default selection.

Batches

There are two related tasks here. Sales Batch Task turns items on and off sale based on start and end dates of Sales Batches. This task should also run after midnight.

The other task, nightly pcbatch updates items' regular, non-sale price (i.e., normal_price) based on any price change batches with a matching start date. Price change batches are only applied once, so their end date is irrelevant. This task should also run after midnight.

Equity Tracking

Equity purchases are stored in the table stockpurchases. To keep this up to date, run the task Equity History nightly. This task should be run after the dtransactions rotation and after midnight. An equity department or departments must be configured. This setting is found on the Members tab of Office's configuration page.

Reporting Data

A few reports require precalculation to return results reasonably quickly. Cache Report Data is necessary for the sales batch movement report as well as the cashier report with bar graphs. Summarize Product Sales for the last quarter is necessary for some tools related to contribution to margin. Real-time transaction sync allows reporting on some recent time periods to include the day. How up-to-date the recent 15 day period is depends how often this task is run.

Miscellaneous Maintenance

Table Snapshot creates copies of the products and custdata tables named productBackup and custdataBackup. Your backup strategy for the entire database will, of course, make this redundant and not strictly necessary but they can be handy for undoing mistakes. Product Changelog Maintenance scans through the complete history of product changes, which tends to be noisy, and compiles separate tables indicating when price, cost, and department actually changed. Some overlay reports on the item editor require these tables. Product Last-Sold Maintenance manages the field indicating when a product was last sold and Auto Pars Task attempts to estimate an item's daily movement.

Clone this wiki locally
You can’t perform that action at this time.