webERP Forum

Full Version: Zero/delete all orders, Purchase and payment etc.,
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi every,

Here I met other problems again.

I found our purchase, sales and payment had many mistake by ourselves, so I want to zero or delete all these deal, but still keep the Customers, suppliers and goods name information.

So I found this function: Delete Sales Transactions
But seems have some problem there
1- Zero all stocks balance, but got the error code 1701
2- Delete All Purchase Orders, got the error code 1451
3- Delete All PO Goods Received (GRNs), also got the error code 1451

And if all above operation done, seems the payment and invoice parts also can't delete, so how can I do?

Please help me again.

A general word of warning to everybody. Any script starting with Z_ should be treated with caution. They are often scripts that bypass fundamental accounting principles, such as maintaining a strict audit trail of transactions, and are often poorly maintained, or not maintained at all. Always test first, and take a backup of your data first.

That said, Alex can you try the attached script and see if it helps your problem.


Hi Tim,

This script is good, I have already deleted the data, thank you.

but seems some accounting data still there, how to clean these parts?



I have already deleted many data, but still have one place, please see below image, how can I delete it?

Alex, how were these transactions created?

Hi Tim,

A few days ago I tried to buy goods from a supplier and set up a new shipment, then the company voucher paid the goods cost, shipping costs, and taxes, but the bank did not actually pay. But today I executed your modified Z_DeleteSalesTransActions.php. All the information such as inventory, sales and purchasing has been deleted, but I have searched about the invoice and payment information from the supplier, It still exists. I later searched by myself from the database and deleted directly, but eventually there is still this information in this place.

And now I didn't know which place we didn't searched?

Hi Alex, after removing GL transactions you need to run the script Z_RePostGLFromPeriod.php to recalculate the GL balances.

The Z_DeleteSalesTransActions.php won't remove those purchasing transactions which is why you had to remove them manually.

Hi I'm,

Perfect, now it is running well.


Paul, I have issued a pull request for the revised Z_DeleteSalesTransactions.php

Reference URL's