IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[userfunc_740_details_selectallocationmaterial]') AND type = 'P')
DROP PROCEDURE [dbo].[userfunc_740_details_selectallocationmaterial]
GO
CREATE PROCEDURE userfunc_740_details_selectallocationmaterial(@cmpid int,   @branchid int,  @userdpid int,  @useruid int,   @userotid int,  @usersecurity int,@ctgid int,@ctgid2 int,@objid bigint,
    @ordid1 bigint ,
    @material_no varchar(100),
    @material_text varchar(200),
    @material_bismt varchar(200),
    @material_cost varchar(10),
    @payment_no varchar(200),
    @payment_name varchar(200),
    @cust_no varchar(200),
    @cust_name varchar(200)
)
as
begin


set nocount on 
declare @objtype varchar(20)='biz' 
declare @ordid bigint 
set @ordid=@objid 
declare @bizid int 
set @bizid = @ctgid 
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 


    set nocount on

    insert  into order_260_2(
        ord2_ordid,
        ord2_tag,
        ord2_wlbm,
        ord2_wlmc,
                      ord2_dj,
        ord2_sl,
        ord2_zfm,       ord2_zffs,       ord2_khbm,       ord2_khms    )
    select 
        @ordid1,
        2,
        @material_no,
        @material_text,
                      0,
        1,
        @payment_no,
        @payment_name,
        @cust_no,
        @cust_name


    select 'ok' result     

    set nocount off



end