Hi all !!!
Now I use B1 Version P :12 , I Add some code in Stored : "SBO_SP_TransactionNotification"
Code Here :
ADD CODE HERE
IF (@object_type = '13' and (@transaction_type = 'A' or @transaction_type = 'U'))
Begin
Select @vnd = DocTotal,@SerialNo = U_SerialNo, @InvNo = U_InvNo, @VNDes = U_VNDes, @Comments = U_VName
, @Ref3 = U_Tax
From OINV
Inner Join OCRD On OCRD.CardCode = OINV.CardCode
Where DocNum = @list_of_cols_val_tab_del
Select Top 1 @ProfitCenter = OcrCode From INV1 Where DocEntry = @list_of_cols_val_tab_del
Update OINV
set U_VNese = [dbo].fSoThanhChu(@vnd)
Where DocEntry = @list_of_cols_val_tab_del
Update OJDT
set Ref1 = @SerialNo
,Ref2 = @InvNo
Where BaseRef = @list_of_cols_val_tab_del
Update JDT1
set Ref1 = @SerialNo
,Ref2 = @InvNo
,LineMemo = @Comments
,ProfitCode = @ProfitCenter
,Ref3Line = @Ref3
,U_VNDes = @VNDes
Where BaseRef = @list_of_cols_val_tab_del
end
IF (@object_type = '18' and (@transaction_type = 'A' or @transaction_type = 'U'))
Begin
Select @vnd = DocTotal,@SerialNo = U_SerialNo, @InvNo = U_InvNo, @VNDes = U_VNDes, @Comments = U_VName
, @Ref3 = U_Tax
From OPCH
Inner Join OCRD On OCRD.CardCode = OPCH.CardCode
Where DocNum = @list_of_cols_val_tab_del
Select Top 1 @ProfitCenter = OcrCode From PCH1 Where DocEntry = @list_of_cols_val_tab_del
Update OPCH
set U_VNese = [dbo].fSoThanhChu(@vnd)
Where DocEntry = @list_of_cols_val_tab_del
Update OJDT
set Ref1 = @SerialNo
,Ref2 = @InvNo
Where BaseRef = @list_of_cols_val_tab_del
Update JDT1
set Ref1 = @SerialNo
,Ref2 = @InvNo
,LineMemo = @Comments
,ProfitCode = @ProfitCenter
,U_VNDes = @VNDes
,Ref3Line = @Ref3
Where BaseRef = @list_of_cols_val_tab_del
end
-- For Inventory transfer
IF (@object_type = '67' and @transaction_type = 'A' )
Begin
Declare @CardCode char(10),@frWH char(10), @toWH char(10), @FrPC char(20),@ToPC char(20)
Select @CardCode = CardCode,@frWH = Filler From OWTR Where DocEntry = @list_of_cols_val_tab_del
Select top 1 @toWH = WhsCode From WTR1 Where DocEntry = @list_of_cols_val_tab_del
IF ((Select count(*) From [@VNS_WHSE] Where U_FrWH = @frWH and U_ToWH = @toWH) = 1 )
Begin
Select @FrPC = U_FrPC, @ToPC = U_ToPC From [@VNS_WHSE] Where U_FrWH = @frWH and U_ToWH = @toWH
exec [dbo].[sp_InventoryTransferWithVAT] @list_of_cols_val_tab_del ,@CardCode,@FrPC,@ToPC
--INSERT [@VNS_OINV] (CODE,[NAME]) VALUES (@list_of_cols_val_tab_del ,@CardCode)
End
-
Update Inventory Transaction
Select @vnd = DocTotal,@SerialNo = U_SerialNo, @InvNo = U_InvNo, @VNDes = U_VNDes, @Comments = U_VName
, @Ref3 = U_Tax
From OWTR
Inner Join OCRD On OCRD.CardCode = OWTR.CardCode
Where DocNum = @list_of_cols_val_tab_del
-- Select Top 1 @ProfitCenter = OcrCode From INV1 Where DocEntry = @list_of_cols_val_tab_del
Update OWTR
set U_VNese = [dbo].fSoThanhChu(@vnd)
Where DocEntry = @list_of_cols_val_tab_del
Update OJDT
set Ref1 = @SerialNo
,Ref2 = @InvNo
Where BaseRef = @list_of_cols_val_tab_del
Update JDT1
set Ref1 = @SerialNo
,Ref2 = @InvNo
,LineMemo = @Comments
,ProfitCode = @ProfitCenter
,Ref3Line = @Ref3
,U_VNDes = @VNDes
Where BaseRef = @list_of_cols_val_tab_del
end
-
DMDMDMDM
IF (@object_type = '67' and @transaction_type = 'U')
Begin
-- Declare @CardCode char(10),@frWH char(10), @toWH char(10), @FrPC char(20),@ToPC char(20)
Select @vnd = DocTotal,@SerialNo = U_SerialNo, @InvNo = U_InvNo, @VNDes = U_VNDes, @Comments = U_VName
, @Ref3 = U_Tax
From OWTR
Inner Join OCRD On OCRD.CardCode = OWTR.CardCode
Where DocNum = @list_of_cols_val_tab_del
-- Select Top 1 @ProfitCenter = OcrCode From INV1 Where DocEntry = @list_of_cols_val_tab_del
Update OWTR
set U_VNese = [dbo].fSoThanhChu(@vnd)
Where DocEntry = @list_of_cols_val_tab_del
Update OJDT
set Ref1 = @SerialNo
,Ref2 = @InvNo
Where BaseRef = @list_of_cols_val_tab_del
Update JDT1
set Ref1 = @SerialNo
,Ref2 = @InvNo
,LineMemo = @Comments
,Ref3Line = @Ref3
,U_VNDes = @VNDes
Where BaseRef = @list_of_cols_val_tab_del
end
---Pick
IF (@object_type = '156' and @transaction_type = 'A')
Begin
Declare @Customer_name char(100)
Select Top 1 @Customer_name =
ORDR.CardName from PKl1
Inner Join ORDR On ORDR.DocNum = PKL1.OrderEntry -1
Where AbsEntry = @list_of_cols_val_tab_del
Update OPKL Set U_cus_pick = @Customer_name
Where AbsEntry =@list_of_cols_val_tab_del
End .
Now I havea problem , I can not Add New Item Master .
please help me .