How to Bill All Closed Jobs
Share
This article displays a scripted method for setting a billed status to all closed jobs.
IMPORTANT: YOU SHOULD PERFORM A COMPLETE BACKUP OF ALL USER AND SYSTEM DATABASES BEFORE PERFORMING ANY PROCEDURE IN THE ARTICLE.
Things to keep in mind before executing this script:
- This script will set the status of ALL closed Jobs to Billed.
- No Invoices will be created.
- After running the script it will not be possible to reopen or to create Invoices for all closed, unbilled, Jobs.
- This script is to be run ONLY once.
- It is strongly suggested you make a full backup of your Database.
- Apply this script to the database in which you want to have closed jobs billed.
To set all closed jobs to a status of Billed:
- Open the Microsoft SQL Server Query Analyzer. (Start/Programs/Microsoft SQL Server/SQL Query Analyzer)
- Enter the appropriate login and password to connect to the appropriate SQL Server.
- In the Query Analyzer, choose the database in which you would like to have all closed job billed.
- Copy and paste the script below into the Query Analyzer:
- Run the query.
| BEGIN TRANSACTION |
| UPDATE order_entry |
| SET billed_job = 1, |
| billed_date = Getdate() |
| WHERE closed_job = 1 |
| AND billed_job = 0 |
| COMMIT TRANSACTION |