Jump to content

Sales Order converted to Sales Invoice - ability to show Qty_Remaining on the Sales Invoice


 Share

Recommended Posts

This is the scenario

Sales Order (or Pick Slip) is for Quantity 50

Sales Order is partially converted to Sales Invoice (Pack Slip) for say Qty 20.

The Sales Order currently has a field on it called Qty_Remaining and it is populated with 30.

I would like the Qty Remaining information to be displayed on the Sales Invoice for printing/communication to the customer.

Already established this won't be possible through a Smart Event.

Will a trigger work for this?  I figure we would somehow need to copy the Qty Remaining into a custom field that is shared with the Sales Invoice but I can't work out how.

Anyone done something similar?

Link to comment
Share on other sites

3 hours ago, Lee-Ann Wood said:

This is the scenario

Sales Order (or Pick Slip) is for Quantity 50

Sales Order is partially converted to Sales Invoice (Pack Slip) for say Qty 20.

The Sales Order currently has a field on it called Qty_Remaining and it is populated with 30.

I would like the Qty Remaining information to be displayed on the Sales Invoice for printing/communication to the customer.

Already established this won't be possible through a Smart Event.

Will a trigger work for this?  I figure we would somehow need to copy the Qty Remaining into a custom field that is shared with the Sales Invoice but I can't work out how.

Anyone done something similar?

Okay so the progress so far is to use backorders.

Create a custom field for original quantity that was on the Sales Order - visible on Sales Invoice

Now we need a trigger on the Sales Invoice to do the calculation to take the original quantity in the custom field - current qty on the sales invoice.  What is the logic to use for the trigger.  This is what I tried without success.  What is the correct syntax to do a subtraction of two values and store in a new field?

<update>
<SODOCUMENTENTRY>
<RECORDNO>{!SODOCUMENTENTRY.RECORDNO!}</RECORDNO>
<LINENO>{!SODOCUMENTENTRY.LINE_NO!}</LINENO>
<EQ_BACKORDER>{!SODOCUMENTENTRY.EQ_ORG_QTY2!} - {!SODOCUMENTENTRY.QUANTITY!}</EQ_BACKORDER> 
</SODOCUMENTENTRY>
</update>

Link to comment
Share on other sites

  • Members

Hi @Lee-Ann Wood! I hope you're well! In the document template that is used in the trigger I think something like this would work. Give this a try

<update>
<SODOCUMENTENTRY>
<RECORDNO>{!SODOCUMENTENTRY.RECORDNO!}</RECORDNO>
<EQ_BACKORDER>#EVAL[{!SODOCUMENTENTRY.EQ_ORG_QTY2!}-{!SODOCUMENTENTRY.QUANTITY!}]</EQ_BACKORDER> 
</SODOCUMENTENTRY>
</update>

  • Like 1
Link to comment
Share on other sites

Hi Louis, 

All good this side!! Thanks for your help as always!  That worked for me... the only thing is it is not immediate.  I have the trigger to run offline as got errors otherwise.  So it does update but takes around a min.  Just wondering if this is a limitation or if there is a way around this?

Link to comment
Share on other sites

  • 2 weeks later...

In my experience for SO and PO docs, the base doc is created as a temporary record and the "full" document is not created until a few seconds later. I have a similar problem when I use triggers that push out to our external processing platform, I have to either intrduce a wait in there before processing or I poll the table to check to see if the record has been fully created. It seems that the triggers fire when the temporary record are created rather than the full document.

Link to comment
Share on other sites

 Share

×
×
  • Create New...