USE [Agri]
GO
/****** Object: StoredProcedure [dbo].[in_dm] Script Date: 09/14/2013 11:16:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[idm]
(@Product varchar(15),@Date DateTime ,@BillNo varchar(30) ,
@CustomerName varchar(50),@Address varchar(50) ,
@BrandName varchar(50) ,@Quantity varchar(20),
@ProductPrice varchar(20) , @Requiredno varchar(50),
@Price varchar(50), @Extra varchar(20) ,
@Vat varchar(50),@TotalAmount varchar(50),
@CorrectPrice varchar(50),@type varchar(10)
)
AS
BEGIN
insert into sampl (ProductName,Date,BillNo,CustomerName,Address,BrandName,
Quantity,ProductPrice,Requiredno,Price,Vat,TotalAmount,type)
values(@Product,@Date,@BillNo ,@CustomerName ,@Address ,@BrandName ,
@Quantity ,@ProductPrice ,@Requiredno ,@Price ,@Vat ,@TotalAmount,@type);
insert into samle (ProductName,Date,BillNo,CustomerName,Address,BrandName,
Quantity,ProductPrice,Requiredno,Price,Extra,Vat,CorrectPrice,type) values
(@Product ,@Date,@BillNo ,@CustomerName ,@Address ,@BrandName ,@Quantity ,
@ProductPrice ,@Requiredno ,@Price ,@Extra ,
@Vat,@CorrectPrice,@type );
END
if @type='s'
begin
update pr set purno=purno-Requiredno where BrandName=@BrandName
end
need to update the table pr reduce the requiredno from purno (but requiredno is not inn the table pr) the required no is in the table sampl and samle .