USE [Agri]
GO
/****** Object: StoredProcedure [dbo].[inse_sales] Script Date: 09/21/2013 12:44:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[inse_sales]
(@ProductName varchar(15),@Date varchar(20) ,@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 float,
@CorrectPrice varchar(50),@type varchar(10)
)
AS
BEGIN
insert into orgnal (ProductName,Date,BillNo,CustomerName,Address,BrandName,
Quantity,ProductPrice,Requiredno,Price,Vat,TotalAmount,type)
values(@ProductName,@Date,@BillNo ,@CustomerName ,@Address ,@BrandName ,
@Quantity ,@ProductPrice ,@Requiredno ,@Price ,@Vat ,@TotalAmount,@type);
insert into dummy (ProductName,Date,BillNo,CustomerName,Address,BrandName,
Quantity,ProductPrice,Requiredno,Price,Extra,Vat,CorrectPrice) values
(@ProductName ,@Date,@BillNo ,@CustomerName ,@Address ,@BrandName ,@Quantity ,
@ProductPrice ,@Requiredno ,@Price ,@Extra ,
@Vat,@CorrectPrice );
if @type='s'
begin
declare @puno int
set @puno=(select purno from purchaseprodu where brandname in ('ProductName','ProductPrice'))
declare @Reqno int
set @Reqno=(select @Requiredno from orgnal where brandname in ('ProductName','ProductPrice'))
declare @ans int
set @ans=@puno-@Reqno
update purchaseprodu set purno=ISNULL(@puno,0)-ISNULL(@Reqno,0) where brandname in ('ProductName','Price')
end
END
command executed but purno is not reduced...