<?xml version="1.0" encoding="UTF-8"?>
<receipt>
  <feed lines="1"/>

  <!-- Header -->
  <text align="center" bold="true">DAILY REPORT</text>
  <feed lines="1"/>
  <divider style="-"/>

  <!-- Metadata -->
  <text>{{printf "%-12s%s" "Date:" .generatedDate}}</text>
  <text>{{printf "%-12s%s" "Time:" .generatedTime}}</text>

  <!-- Filters (optional) -->
  <text if="startDateStr">{{printf "%-12s%s" "Start Date:" .startDateStr}}</text>
  <text if="endDateStr">{{printf "%-12s%s" "End Date:" .endDateStr}}</text>
  <text if="locationsStr">{{printf "%-12s%s" "Locations:" .locationsStr}}</text>
  <text if="usersStr">{{printf "%-12s%s" "Users:" .usersStr}}</text>
  <text if="categoriesStr">{{printf "%-12s%s" "Categories:" .categoriesStr}}</text>
  <text if="groupsStr">{{printf "%-12s%s" "Groups:" .groupsStr}}</text>
  <text if="shiftsStr">{{printf "%-12s%s" "Shifts:" .shiftsStr}}</text>
  <divider style="-"/>

  <!-- Items header -->
  <text align="center">{{printf "%-24s%-12s%s" "Article" "Qty" "Total"}}</text>
  <divider style="-"/>

  <!-- Items -->
  <group each=".items">
    <text>{{printf "%-24s%-12s%s" .name (fmtQty .qty) (fmtAmount .total)}}</text>
  </group>

  <!-- Grand total -->
  <divider style="-"/>
  <text align="right">{{printf "GRAND TOTAL: %s" (fmtAmount .grandTotal)}}</text>
  <feed lines="1"/>

  <!-- Payment methods -->
  <divider style="-"/>
  <text align="center">PAYMENT METHODS</text>
  <divider style="-"/>
  <line each=".paymentMethods">
    <text width="50%">{{.method}}</text>
    <text width="50%">{{fmtAmount .amount}}</text>
  </line>
  <divider style="-"/>

  <feed lines="3"/>
</receipt>
