USP_DATAFORMTEMPLATE_EDITLOAD_PAYMENT_TERM

The load procedure used by the edit dataform template "Payment Term Edit Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@NAME nvarchar(20) INOUT Payment term
@DESCRIPTION nvarchar(100) INOUT Description
@INCLUDEDISCOUNT bit INOUT Include discount for payment within a discount period
@DISCOUNTPERCENT decimal(20, 4) INOUT Discount percent
@DISCOUNTDAYS smallint INOUT Discount period days
@PAYMENTDUECODE tinyint INOUT Payment due
@DAYSDUE smallint INOUT Number of days
@DAYOFMONTHDUE smallint INOUT Day of month
@MONTHDUECODE smallint INOUT Month
@ISEDITFORM bit INOUT

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_PAYMENT_TERM
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @TSLONG bigint = 0 output,
    @NAME nvarchar(20) = null output,
    @DESCRIPTION nvarchar(100) = null output,
    @INCLUDEDISCOUNT bit = null output,
    @DISCOUNTPERCENT decimal(20,4) = null output,
    @DISCOUNTDAYS smallint = null output,
    @PAYMENTDUECODE tinyint = null output,
    @DAYSDUE smallint = null output,
    @DAYOFMONTHDUE smallint = null output,
    @MONTHDUECODE smallint = null output,
    @ISEDITFORM bit = null output
)
as

    set nocount on;

    -- be sure to set these, in case the select returns no rows

    set @DATALOADED = 0
    set @TSLONG = 0

    -- populate the output parameters, which correspond to fields on the form.  Note that

    -- we set @DATALOADED = 1 to indicate that the load was successful.  Otherwise, the system

    -- will display a "no data loaded" message.  Also note that we fetch the TSLONG so that concurrency

    -- can be considered.

    select
            @DATALOADED = 1,
            @TSLONG = TSLONG,
        @NAME = NAME, 
        @DESCRIPTION = DESCRIPTION, 
        @INCLUDEDISCOUNT = INCLUDEDISCOUNT, 
        @DISCOUNTPERCENT = DISCOUNTPERCENT, 
        @DISCOUNTDAYS = DISCOUNTDAYS, 
        @PAYMENTDUECODE = PAYMENTDUECODE, 
        @DAYSDUE = DAYSDUE,
        @DAYOFMONTHDUE = DAYOFMONTHDUE,
        @MONTHDUECODE = MONTHDUECODE,
        @ISEDITFORM = 1
    from dbo.PAYMENTTERM
    where ID = @ID

    return 0;