Mayooran Navamany

Mayooran Navamany

  • 324
  • 5.6k
  • 131.4k

Save and Update difference table

Jul 18 2016 2:10 AM
when press button save and update difference table sql with C#...
 
jest i develop stoke management i want a current stroke level. when i enter GRN (Good received Note)  data and after submit save button on time happn
01.. GRN data insert into GRN Code /Item Code..
02 .. where  Item Code.. to find and update current stroke table 
i want SP and C# Cord Plz help me 
 
 
ALTER PROCEDURE [dbo].[GRNInfo]
@GrnId int ,
@GrnCode nchar(10) ,
@ItemCode nchar(10) ,
@Qty int ,
@TotalPrice decimal(18, 0) ,
@GrnDate date,
@NewQty int
AS
BEGIN
if not exists (select GrnId from atoGRN where GrnId=@GrnId)
begin
insert into atoGRN (GrnCode,FK_ItemCode,Qty,TotalPrice,GrnDate) values (@GrnCode,@ItemCode,@Qty,@TotalPrice,@GrnDate)
end
else
begin
update atoGRN set GrnCode=@GrnCode ,FK_ItemCode=@ItemCode ,Qty=@Qty ,TotalPrice=@TotalPrice ,GrnDate=@GrnDate where GrnId=@GrnId
end
DECLARE @CurrentQty AS INT;
select @CurrentQty = Quantity from atoQuantityDisc where FK_ItemCode=@ItemCode
begin
SET @NewQty = @CurrentQty + @Qty
UPDATE atoQuantityDisc
SET Quantity = @NewQty
WHERE FK_ItemCode=@ItemCode;
end
END
 

Answers (6)