NJC__Documentation::DB

dbo.sp_insertmodulbc30manual

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

Name Data Type Length Description
@car varchar 26
@idx bigint 8
@nodaft varchar 40
@tgdaft date 3
@userid varchar 10

SQL Script

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.sp_insertmodulbc30manual
(@car as varchar(26), @idx as bigint, @nodaft varchar(40),@tgdaft date,@userid varchar(10))    
AS
BEGIN
   declare @countdata int
   declare @detilitemcount int

   set @countdata = (select COUNT(*) as cnt from dbo.tbl_bc_out_hdr where id_bc_out_hdr = @idx and statusdok = 'DATA BARU') 
   
   IF @countdata <> 1 
   BEGIN
 select '01' as status, ' DATA Not Found or Already Exist' as hasil
 return
   END
   
   SET ANSI_NULLS ON
   SET ANSI_WARNINGS ON
   

 
 declare @now datetime
    set @now = GETDATE()
 UPDATE tbl_bc_out_hdr set CAR = @car, NODAFT=@nodaft, TGDAFT=@tgdaft ,Status = '00', statusdok='DATA PROCESSED' where id_bc_out_hdr = @idx
    UPDATE tbl_bc_out_dtl set CAR = @car where id_bc_out_hdr = @idx
    UPDATE tbl_bc_out_dok set CAR = @car where id_bc_out_hdr = @idx
    
    INSERT INTO tbl_bc_out_hdr_h_status
                  (id_bc_out_hdr, statusdok, status_date
                  ,[create_by]
      ,[create_date]
      ,[update_by]
      ,[update_date])
    VALUES     (@idx, (select top 1 statusdok from tbl_bc_out_hdr where id_bc_out_hdr = @idx), @now
  ,@userid
  ,@now
  ,@userid
  ,@now
    
  )

    
    select '00' as status, ' Sukses'+' NO AJU BARU: '+@car as hasil

END
GO

Used By

No items found