Jump to content
  • 0

Sql For Pending Service With A Paid Invoice


drolfe

Question

Hi,

 

I'm looking for an sql query that will show me pending services that have a paid invoice.

 

This is for some custom alarming, basically we don't want to get alerted when a new order comes through, only once the new order/service is paid for.

 

Any help on a sql query for this would be most appreciated.

 

Regards, Daniel

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi,

 

I'm looking for an sql query that will show me pending services that have a paid invoice.

 

This is for some custom alarming, basically we don't want to get alerted when a new order comes through, only once the new order/service is paid for.

 

Any help on a sql query for this would be most appreciated.

 

Regards, Daniel

 

If you have the Billing Order widget that shows you.

 

Billing > Manage Widgets > Order widget

 

On the Pending if it's a green tick, the invoice has been paid.

 

You could use the order email to get an order and then an email when a payment is made, that's what I do.

 

Payments made => My info > Notices > Payment received.

Link to comment
Share on other sites

  • 0

If you have the Billing Order widget that shows you.

 

Billing > Manage Widgets > Order widget

 

On the Pending if it's a green tick, the invoice has been paid.

 

You could use the order email to get an order and then an email when a payment is made, that's what I do.

 

Payments made => My info > Notices > Payment received.

 

Hi Thanks for that, I didn't know about the order widget.

 

I still need the sql for some SMS notifications, I'll look into the DB a little more

 

Regards, Daniel

Link to comment
Share on other sites

  • 0

Ok , SQL isn't my thing so this almost melted my brain but I think I have something with this one

SELECT COUNT(*) FROM orders INNER JOIN invoices ON orders.invoice_id = invoices.id WHERE orders.status = "pending" AND invoices.date_closed IS NOT NULL;

If anyone else has anything better or knows more about SQL ?

 

Regards, Daniel

Link to comment
Share on other sites

  • 0

I think if you want to get data result, :

- you can remove "COUNT(*)", because if not your query will just give you the number of line that match to your query (just the number like "3")

- you will need to fletch the result, and Blesta do have maybe his own data base communication abstraction to do it, you could check in the code how Blesta is doing it

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
Answer this question...

×   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.

Loading...
×
×
  • Create New...