Stored Procedures [dbo].[MssWebCreateOrderThirdPartyService]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inOrderIdint4
@inVendorIdvarchar(15)15
@inAmountmoney8
@inPONumbervarchar(20)20
@inInvoiceNumbervarchar(20)20
@inDescriptionvarchar(60)60
@inServiceDatedatetime8
@inInvoiceReceivedDatedatetime8
@inInvoiceApprovedDatedatetime8
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE PROCEDURE [dbo].[MssWebCreateOrderThirdPartyService]
    @inOrderId int,
    @inVendorId varchar(15),
    @inAmount money,
    @inPONumber varchar(20),
    @inInvoiceNumber varchar(20),
    @inDescription varchar(60),
    @inServiceDate datetime,
    @inInvoiceReceivedDate datetime,
    @inInvoiceApprovedDate datetime
AS
BEGIN
    Declare @id int ;
    insert into  OrderThirdPartys
    (
        OrdPriKey,
        VendorID,
        Amount,
        PONumber,
        InvoiceNumber,
        Description,
        Date,
        InvoiceReceivedDate,
        InvoiceApprovedDate
    )
    select
        OrdPriKey = @inOrderId,
        VendorID = @inVendorId,
        Amount = @inAmount,
        PONumber = @inPONumber,
        InvoiceNumber = @inInvoiceNumber,
        Description = @inDescription,
        Date = @inServiceDate,
        InvoiceReceivedDate = @inInvoiceReceivedDate,
        InvoiceApprovedDate = @inInvoiceApprovedDate
        Set @id=SCOPE_IDENTITY()

update Orders set
    JobCostingCalculated = 0
    from dbo.OrderThirdPartys
inner join Orders on Orders.PriKey=OrderThirdPartys.OrdPrikey and
    Orders.PriKey=@inOrderId
where OrderThirdPartys.OrdThirdPartyPriKey = @id and
    Orders.ReleaseDate is null
Select @id    

END
GO
GRANT EXECUTE ON  [dbo].[MssWebCreateOrderThirdPartyService] TO [MssExec]
GO
Uses