Below looks like a repeat but I've tried this and on one, it would not work and they other pretended to work until you went for a second sale and got a key constraint error. So this together fixes everything without any hassles and issues. Im only posting this because from the openbravo site which is where I got the above code from, flat didnt work, it deleted and then gave me contraints and pain. I found the other somewhere else I can't remember and it worked til 2nd sale. Ran together fixed everything.
DELETES SALES DATA ONLY | COPY AND PASTE BELOW AS A WHOLE NOT ONE OR OTHER
/ This sql deletes all transactions in Openbravo POS /
/ Delete ticketlines before tickets for consistent constraints /
delete from TICKETLINES;
delete from TICKETS;
delete from TAXLINES;
delete from PAYMENTS;
delete from STOCKDIARY;
delete from STOCKCURRENT;
delete from RESERVATION_CUSTOMERS;
delete from RESERVATIONS;
delete from RECEIPTS;
delete from CLOSEDCASH;
update TICKETSNUM set ID = 1;
update PRODUCTS set STOCKCOST=0, STOCKVOLUME=0;
update CUSTOMERS set CURDEBT=0, CURDATE=null;
/ THIS FIXES THE ERROR ON FOREIGN KEY CONSTRAIST ERRORS. RUN THIS AFTER THE FIRST CODE ABOVE /
delete from TICKETLINES;
delete from TICKETS;
delete from RECEIPTS;
delete from TAXLINES;
delete from CLOSEDCASH;
delete from PAYMENTS;
delete from STOCKDIARY;
delete from STOCKCURRENT;
delete from RESERVATION_CUSTOMERS;
delete from RESERVATIONS;
update PRODUCTS set STOCKCOST=0, STOCKVOLUME=0;
update CUSTOMERS set CURDEBT=0, CURDATE=null;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Edited, removed the stockdiary and stockcurrent as for whatever reason we noticed that was one there, you do not remove stock information on a new year refresh, what on earth were they thinking and why we didnt catch that faster... sorry guys, we updated to preserve stockcurrent and diary data
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FOR UNICENTA POS USERS
Below looks like a repeat but I've tried this and on one, it would not work and they other pretended to work until you went for a second sale and got a key constraint error. So this together fixes everything without any hassles and issues. Im only posting this because from the openbravo site which is where I got the above code from, flat didnt work, it deleted and then gave me contraints and pain. I found the other somewhere else I can't remember and it worked til 2nd sale. Ran together fixed everything.
DELETES SALES DATA ONLY | COPY AND PASTE BELOW AS A WHOLE NOT ONE OR OTHER
/ This sql deletes all transactions in Openbravo POS /
/ Delete ticketlines before tickets for consistent constraints /
delete from TICKETLINES;
delete from TICKETS;
delete from TAXLINES;
delete from PAYMENTS;
delete from STOCKDIARY;
delete from STOCKCURRENT;
delete from RESERVATION_CUSTOMERS;
delete from RESERVATIONS;
delete from RECEIPTS;
delete from CLOSEDCASH;
update TICKETSNUM set ID = 1;
update PRODUCTS set STOCKCOST=0, STOCKVOLUME=0;
update CUSTOMERS set CURDEBT=0, CURDATE=null;
/ THIS FIXES THE ERROR ON FOREIGN KEY CONSTRAIST ERRORS. RUN THIS AFTER THE FIRST CODE ABOVE /
delete from TICKETLINES;
delete from TICKETS;
delete from RECEIPTS;
delete from TAXLINES;
delete from CLOSEDCASH;
delete from PAYMENTS;
delete from STOCKDIARY;
delete from STOCKCURRENT;
delete from RESERVATION_CUSTOMERS;
delete from RESERVATIONS;
update PRODUCTS set STOCKCOST=0, STOCKVOLUME=0;
update CUSTOMERS set CURDEBT=0, CURDATE=null;
Edited, removed the stockdiary and stockcurrent as for whatever reason we noticed that was one there, you do not remove stock information on a new year refresh, what on earth were they thinking and why we didnt catch that faster... sorry guys, we updated to preserve stockcurrent and diary data