When you sell gift cards, this is treated as you holding money on behalf of the customer until the point the discount is redeemed. It is only when the gift card is redeemed that an actual sale is recorded, based on the products sold.
If you sell gift cards at a discount, there is is no sales amount to be discounted at the time, so instead the discount amount attributable to the gift card will be recorded on the gift card and applied to the order when the gift card is redeemed.
You will see discounted gift card sales, as well as redemptions that are treated as discounts in the gift card account section of your Z report.
As gift cards issued at a discount or redeemed as a discount won't have any impact on your declared payments, these are excluded from the main gift card account line used for the variance calculation on your Z report. As such, the gift card account calculation is:
gift cards redeemed excluding discounts minus gift cards issued excluding discounts.