CREATE PROCEDURE [dbo].[ProductPricePerPerson] @OldProductNumber int,  @ArrivalDate datetime, @DepartureDate datetime, @PriceDate datetime, @OldRoomTypeNumber int, @NumberOfRooms int, 
  @Adults int, @Children1 int, @Children2 int, @PaysAdults int, @PaysChildren1 int, @PaysChildren2 int, @CalcPriceDay money OUTPUT AS

  SET NOCOUNT ON

  DECLARE @ProductPrice money
  DECLARE @Addon money
  DECLARE @BillText VARCHAR(50)
  DECLARE @BillTextAddon VARCHAR(50)
  DECLARE @PacketNumber INT
  DECLARE @EnvironmentFee smallmoney
  DECLARE @FixedPrice Bit 
  DECLARE @VATProduct Bit 
  DECLARE @SpecifiedDepartureAddOn Bit

  IF @Adults + @Children1 + @Children2 = 0
	SET @Adults = @PaysAdults
  IF @Adults + @Children1 + @Children2 = 0
	SET @Adults = 1

  exec ProductPricesDay @OldProductNumber, @ArrivalDate, @DepartureDate, @PriceDate, @OldRoomTypeNumber, @NumberOfRooms, @Adults, @Children1, @Children2, 
                        @Addon OUTPUT, @BillText OUTPUT, @BillTextAddon OUTPUT, @CalcPriceDay OUTPUT, @PacketNumber OUTPUT, @EnvironmentFee OUTPUT,
						@FixedPrice OUTPUT, @VATProduct OUTPUT, @SpecifiedDepartureAddOn OUTPUT

  SET @CalcPriceDay = (@CalcPriceDay / (@Adults + @Children1 + @Children2)) * (@PaysAdults + @PaysChildren1 + @PaysChildren2)

