Home Information PDF Documents EULANDA Handbooks Training Book's corner Download Contact us Table of Contents About us

Glossary

Password needed Newsgroup

Remote Support system

cn_TraAfLf_dojob (SQL API)

Back | Level back

Produces a delivery note on the basis before with cn_TraAfLf_AddAfp deposited order items and quantities.

Syntax

PROC cn_TraAfLf_DoJob
      @JobId int,
      @lf_id int = NULL OUT,
      @lf_Number int = NULL OUT,
      @LfReservationType int = NULL

Argument

@JobId
The ID of the transformation job. That is the ID column out cnTraAfLfJob.
@lf_id
[OUT]
The ID of the produced delivery note.
@lf_number
[OUT]
The number (column head number) of the produced delivery note.
@LfReservationType 
Indication whether, and if, as the delivery note is to be booked.
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

Example

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