Jump to content

Missing Income Lookup


rickybsb

Recommended Posts

 

 Hi folks. 

I had some cases that invoices were not generated.  When that happened,  we deleted orders and clients record and made new identical ones, so apparently problem has gone.

BUT we really needed a tool to help us identify any monthly missing invoices.

I wrote the following SQL, running once a month and mailing me details, so I have peace of mind.

I´d appreciate opinions from who´s in the same boat.


select tblclients.companyname, tblclients.email, tblhosting.orderid, tblhosting.amount, tblhosting.domain, tblhosting.domainstatus, tblhosting.billingcycle, tblhosting.notes from tblhosting INNER JOIN tblclients ON tblclients.id = tblhosting.userid where tblhosting.domainstatus='Active' and tblhosting.billingcycle='Monthly' and tblhosting.id not in 
(select a.relid from tblinvoiceitems a, tblinvoices b where a.invoiceid=b.id and a.type='Hosting' and YEAR(b.date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) AND MONTH(b.date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH) ) ;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated