Cutoffs management
1. Each saleshead should have an equivalent number of transactioncutoffs table
set @terminalno = 1;
select count(*)
from saleshead
where terminalno = @terminalno;
select count(*)
from transactioncutoffs as T, saleshead as H
where H.wid = T.salesheadwid
and H.terminalno = @terminalno;
2. Re-initialize the transactioncutoffs table if found out that it doesn't tally with the saleshead count OR the 00:00:00 cutoff id is not 1.
truncate table transactioncutoffs;
insert into transactioncutoffs (salesheadwid,cutoffid)
select wid, 1 from saleshead;
3. Fix discrepancies in the transactioncutoffs table
A. check if there are duplicates
select count(*), cutoffid from transactioncutoffs group by cutoffid;
B. fix the duplicate entries by running this
drop table transactioncutoffs;
update ´cutoffs´ set id='1' where cutofftime = '00:00:00';
C. Run the POS for it to recreate the transactioncutoffs table.
4. set the effective date for the 00:00:00 cutofftime to the year 2000
update cutoffs set effectivedate = '2000-01-01' where cutofftime = '00:00:00';