The billing platform administrator can delete a client via the web-interface provided that: 

  • The client didn't make payments.  
  • The client doesn't have due expenses. 
  • The client doesn't have active services.   

In all other cases he needs to execute the following requests in the 'billmgr' database to delete a client:

set @account_id = <CLIENT_ID>;
DELETE FROM expense WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
DELETE FROM payment WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
DELETE FROM ticket WHERE item IN (SELECT id FROM item WHERE account = AccountId OR parent IN (SELECT id FROM item WHERE account = AccountId));
DELETE FROM recurring WHERE profile IN (SELECT id FROM profile WHERE account = AccountId);
DELETE FROM billorder WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
UPDATE ip SET item = NULL WHERE item IN (SELECT id FROM item WHERE account = @account_id OR parent IN (SELECT id FROM item WHERE account = @account_id));
DELETE FROM invoiceitem where invoice in (SELECT id FROM invoice WHERE customer IN (SELECT id FROM profile WHERE account = @account_id));
DELETE FROM item WHERE parent IN (SELECT id FROM (SELECT id FROM item WHERE account = @account_id) itm);
DELETE FROM item WHERE account = @account_id;
DELETE FROM service_profile WHERE account = @account_id;
DELETE FROM invoice WHERE customer IN (SELECT id FROM profile WHERE account = @account_id);
DELETE FROM profile WHERE account = @account_id;
DELETE FROM ticket WHERE account_client = @account_id;
DELETE FROM user WHERE account = @account_id;
DELETE FROM affiliatereward WHERE account = @account_id OR referal = @account_id;
DELETE FROM account WHERE id = @account_id;
SQL

The billing platform will delete all the information associated with that client, his billing information, and support ticket history. However, the system doesn't delete the client files, such as the configuration files, avatars, and ticket attachments. 

Restart BILLmanager:

/usr/local/mgr5/sbin/mgrctl -m billmgr exit
DIFF