Jump to content

Detect invoice creation flag, whether it is new order or recurring or manually created


berstein

Recommended Posts

Dear all,

I would like to know how to detect (or some kind of flag) whether the invoice is created through new order, recurring, or manually created.

For new order, I can search for the order that have the same invoice ID as the invoice.

For recurring, temporary, I get all the relid of the invoice items and loop them in tblinvoiceitems. If any of the relid return more than 1, then the invoice is recurring.

Is there any better way to achieve this?

Thank you

Link to comment
Share on other sites

Dear all,

For update, I change the logic where if all invoice item's relid is 0 and the type is "", then it counted as manual invoice. Then, if the invoice is not counted as new order or manual invoice, it counted as recurring invoice.

Still, if you have better way to achieve this, please inform me.

Thank you

Link to comment
Share on other sites

15 hours ago, Kian said:

Use InvoiceCreation hook point. More in particular source parameter.

 

Dear @Kian, thank you for your reply,

Unfortunately, the data I'm collecting is pulled via SQL query, so I think hooks is out of the options.
But, after some thought, we can use the hook to create flag of the invoice in the database by using custom table.
The only downside is this will only works on invoice created after this hooks' activation.

I have used this hook in the past, but if I'm not mistaken, the autogen source can't differentiate between recurring invoice and invoice created through new order.
Please correct me if I'm wrong.

Thank you

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