[dbo].[MssWebCreateOrderThirdPartyService]
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