In follow example we don't allow to create a time receipt, if no material is booed
Time receipts are possible in many different areas: TimeReceipt, LogOff in Desktop Terminal, Desktop Application and WEB Application or directly over Beas Service Layer.
It take too many time, to change all windows. For this we've the possibility to insert own scripts directly in the function self - not user front end based: The userevents. More details how to use it, see this video
The best user event is in this case the "TimeRecording" Event
Order:
Allow to create time receipt only, if material is booked completely (part receipts not supported)
In server mode return only an error message and cancel the process
In desktop mode (example Terminal) we display all lines, which not booked, in a html message box and cancel the process
NOTE: This script is for follow workflow:
BEFORE you create the first time receipt, you must create the complete issue of Bill of Material manually.
This don't check manual receipts. Additional you can check, if this is the last position (see bsl.workorderrouting) or you can check this in the assembly receipt event
We use datastorevalues, beas service layer, bsl and Beas Script,
workordermanagement.src
function TimeRecording
// check count of entries which not booked completely
// we use beas service layer
instance datastore d
d.bsl=WorkorderBom?$select=ItemCode,QuantityWhsUoM,UoMWarehouseId,QuantityBooked&$filter=DocEntry eq <e_WoDocEntry> and LineNumber eq <e_WoLineNumber> and QuantityWhsUoM gt QuantityBooked and Closed eq false
// if no entry found, then all is ok and we can continue
if <d.rowcount> n= 0 then
// don't forget to destroy the created datastore
destroy=d
return success
end if
// if server mode (example Beas service layer or WEB App, we return only an error message
if <system.servermodus> = true then
messagebox=error$$Not all lines booked completely!
destroy=d
return failure
end if
// we create a messagebox with all lines, which not booked as html message
setvar=ls_html=<html><body>Follow lines not booked completely:</br></br><table><tr><td>Item Number</td><td>Planned Quantity</td><td>Booked Quantity</td></tr>
// create the lines
// Note: All field names must be lower case.
for ll_line=1 to <d.rowcount>
d.setrow=<ll_line>
addvar=ls_html=<tr><td><d.itemcode></td><td><d.quantitywhsuom> <d.uomwarehouseid></td><td><d.quantitybooked> <d.uomwarehouseid></td></tr>
next
// don't forget to destroy the created datastore
destroy=d
addvar=ls_html=</table></br>It is not possible to create a time receipt before complete material is booked!</body></html>
// Display the message
messagebox=info$popup=true<tab>text=<ls_html>
// Cancel the process
return failure
end function