EULANDA® ERP System Head Start thru Technology
Produces a delivery note on the basis before with cn_TraAfLf_AddAfp deposited order items and quantities.
PROC cn_TraAfLf_DoJob
@JobId int,
@lf_id int = NULL OUT,
@lf_Number int = NULL OUT,
@LfReservationType int = NULL
@JobId
@lf_id
@lf_number
@LfReservationType
| Value | Description |
| NULL | The default value is used |
| 0 | The delivery note is not booked |
| 1 | The delivery note is reserved |
| 2 | The camp is booked |
DECLARE @JobId int, @lf_number int, @exec int
/* Produce a new job */
INSERT cnTraAfLfJob (Status) VALUES(0)
SELECT @jobid = SCOPE_IDENTITY()
/* Add an order position to this job */
EXEC @exec = cn_TraAfLf_JobAddAfp
@JobId = @JobId, @Quantity = 5, @afp_id = 433
/* here futher order items can be added */
/* Actual converting of the order */
EXEC @exec = cn_TraAfLf_DoJob @JobId = @JobId,
@lf_number = @lf_number OUT
IF @exec = 0
BEGIN
PRINT 'Produced delivery note :'+CONVERT(varchar, @lf_number)
/* Here can on IDs of the produced */
/* Delivery note positions to be accessed */
SELECT afp_id [OrderPos-ID], lfp_id [DeliveryNotePos-ID], Quantity
FROM cnTraAfLfJobItem WHERE jobid = @jobId
END ELSE
PRINT 'An error arose'
/* Delete the job */
EXEC @exec = cn_TraAfLf_DelJob @JobId = @JobId