CREATE PROCEDURE [dbo].[PostGetCityTax] @ACityTaxDoPost BIT, @AGuestNumber INT, @APrice MONEY, @APriceOverWritten BIT, @AProductNumber INT, @AStayBeginDate DATETIME, @AStayEndDate DATETIME, @APostDate DATETIME, @ABookedTypeNumber INT, @ANumberOfRooms INT, @AAdults INT, @AChildren1 INT, @Achildren2 INT,
@ARoomPrice MONEY OUTPUT AS
/*
  Created by Kent Johansen, september 2022
  Get "Citytax" room price. Amount is used for postpackage, but only if city tax is enabled.
*/
DECLARE @DummyDepartureAddon MONEY
DECLARE @DummyBillTextProduct VARCHAR(50)
DECLARE @BillTextProduct1DepartureAddon VARCHAR(50)
DECLARE @DummyPacketNumber INT
DECLARE @DummyEnviromentFeeProduct SMALLMONEY
DECLARE @DummyIsFixedPriceProduct BIT
DECLARE @DummyVATProduct BIT
DECLARE @DummySpecifiedDepartureAddOn BIT
DECLARE @DummyEnviromentFeeType FLOAT

IF @ACityTaxDoPost = 1
BEGIN
  IF @APriceOverWritten = 0
    EXEC ProductPricesDay @AProductNumber, @AStayBeginDate, @AStayEndDate, @APostDate, @ABookedTypeNumber, @ANumberOfRooms, @AAdults, @AChildren1, @AChildren2, @DummyDepartureAddon OUTPUT, @DummyBillTextProduct OUTPUT, @BillTextProduct1DepartureAddon OUTPUT, @ARoomPrice OUTPUT, @DummyPacketNumber OUTPUT, @DummyEnviromentFeeProduct OUTPUT, @DummyIsFixedPriceProduct OUTPUT, @DummyVATProduct OUTPUT, @DummySpecifiedDepartureAddOn OUTPUT, -1, 0, @DummyEnviromentFeeType OUTPUT
  ELSE
  BEGIN
    IF ISNULL(@APrice, 0) = 0 
      SET @ARoomPrice = 0
    IF @AGuestNumber = 0 AND @ANumberOfRooms > 0
      SET @ARoomPrice = @APrice * @ANumberOfRooms
    ELSE 
      SET @ARoomPrice = @APrice
  END
END
ELSE
  SET @ARoomPrice = 0