<pdf>

	<version>1.0.0</version>
	<title>PDF Template Demo - Stock inventory report</title>
	<date>2026-12-02</date>
	<note>Warehouse stock inventory report built with the table element (version 1.0.13): items read from a CSV file, multi-page table with repeated header, zebra rows, conditional row and cell styles, truncated descriptions, totals, a summary printed right after the table and the approval signatures at a fixed position on the last page</note>

	<default_page>
		<orientation>P</orientation>
		<unit>mm</unit>
		<format>A4</format>
	</default_page>

	<doc_info>
		<creator>Alien Project</creator>
		<author>#MBR</author>
		<title>PDF Stock Inventory Report Demo</title>
		<subject>Copyright (C) 2026 - Alien Project</subject>
		<keywords>inventory, stock, warehouse, table, csv, pdf, example</keywords>
	</doc_info>

	<!-- Section without data provider: the table adds the pages it needs -->
	<section id="report">
		<page format="A4" orientation="P"/>

		<!-- For debug, set BORDER=1 to check the box sizes -->
		<setvar name="BORDER" value="0"/>
		<setvar name="COLOR_DARK" value="1f2d3d"/>
		<setvar name="COLOR_ACCENT" value="e8a317"/>
		<setvar name="COLOR_SOFT" value="f1f4f8"/>
		<setvar name="COLOR_ZEBRA" value="f6f8fb"/>
		<setvar name="COLOR_LINE" value="d3dae3"/>
		<setvar name="COLOR_TEXT" value="1f2933"/>
		<setvar name="COLOR_GREY" value="6b7785"/>
		<setvar name="COLOR_GREEN" value="17803d"/>
		<setvar name="COLOR_ORANGE" value="b45309"/>
		<setvar name="COLOR_RED" value="b42318"/>
		<setvar name="COLOR_RED_SOFT" value="fdeceb"/>
		<setvar name="COLOR_WHITE" value="ffffff"/>
		<!-- Number format: 1,234.56 -->
		<setvar name="NUMERICDECIMALSEPARATOR" value="."/>
		<setvar name="NUMERICTHOUSANDSEPARATOR" value=","/>
		<setvar name="CURRENCYSYMBOL" value=" USD"/>

		<print_content>page_header</print_content>
		<print_content>report_info</print_content>
		<print_content>stock_table</print_content>

		<!-- Printed 6 mm below the end of the table (on a new page if the 24 mm do not fit above y_end) -->
		<print_content after="inv" gap="6" height="24">summary</print_content>
		<!-- Always at the bottom of the last page (y 248), on a new page if the table or the summary end below it -->
		<print_content after="inv" position="fixed" top="248" height="24">signatures</print_content>

		<print_content>page_footer</print_content>
	</section>

	<section id="finalize">
		<output>
			<dest>I</dest>
			<name>inventory_report.pdf</name>
			<isUTF8>true</isUTF8>
		</output>
	</section>

	<!-- ********************************** -->

	<!-- Printed on the first page by the section, and on the next pages by the table (page_header attribute) -->
	<content id="page_header">
		<rectangle x1="0" y1="0" x2="210" y2="25" radius="0" border="0000">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_DARK}"/>
		</rectangle>
		<rectangle x1="0" y1="25" x2="210" y2="26.2" radius="0" border="0000">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_ACCENT}"/>
		</rectangle>
		<!-- Logo drawn with shapes: three stacked boxes -->
		<rectangle x1="15" y1="13.5" x2="21" y2="19.5" radius="0.6" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_ACCENT}"/>
		</rectangle>
		<rectangle x1="22" y1="13.5" x2="28" y2="19.5" radius="0.6" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_ACCENT}"/>
		</rectangle>
		<rectangle x1="18.5" y1="6.5" x2="24.5" y2="12.5" radius="0.6" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<fill type="N"/>

		<box x="32" y="6" width="95" height="7" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>{COMPANY_NAME}</text>
			<font family="Helvetica" style="B" size="13" color="{COLOR_WHITE}"/>
		</box>
		<box x="32" y="13" width="95" height="8" border="{BORDER}" horizalign="Left" vertalign="Top">
			<text>{COMPANY_ADDRESS}
{COMPANY_CONTACTS}</text>
			<font family="Helvetica" style="N" size="7.2" color="b8c2cf"/>
		</box>

		<box x="115" y="6" width="80" height="7" border="{BORDER}" horizalign="Right" vertalign="Center">
			<text>STOCK INVENTORY REPORT</text>
			<font family="Helvetica" style="B" size="13" color="{COLOR_WHITE}"/>
		</box>
		<box x="115" y="13" width="80" height="4.5" border="{BORDER}" horizalign="Right" vertalign="Center">
			<text>{REPORT_NUMBER} - count date {COUNT_DATE}</text>
			<font family="Helvetica" style="B" size="8" color="{COLOR_ACCENT}"/>
		</box>
		<box x="115" y="17.5" width="80" height="4.5" border="{BORDER}" horizalign="Right" vertalign="Center">
			<text>{WAREHOUSE_NAME}</text>
			<font family="Helvetica" style="N" size="7.2" color="b8c2cf"/>
		</box>

		<!-- Next pages: title of the table -->
		<box x="15" y="29" width="120" height="6" border="{BORDER}" horizalign="Left" vertalign="Center" printif="{PAGEINDEX}&gt;1">
			<text>Stock list (continued)</text>
			<font family="Helvetica" style="B" size="10" color="{COLOR_DARK}"/>
		</box>
	</content>

	<!-- ********************************** -->

	<!-- First page: warehouse, count details and title of the table -->
	<content id="report_info">
		<box x="15" y="32" width="90" height="5" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>WAREHOUSE</text>
			<font family="Helvetica" style="B" size="7.5" color="{COLOR_ORANGE}"/>
		</box>
		<box x="15" y="37.5" width="90" height="6" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>{WAREHOUSE_NAME}</text>
			<font family="Helvetica" style="B" size="11" color="{COLOR_TEXT}"/>
		</box>
		<box x="15" y="44" width="90" height="10" border="{BORDER}" horizalign="Left" vertalign="Top">
			<text>{WAREHOUSE_ADDRESS}</text>
			<font family="Helvetica" style="N" size="8.5" color="{COLOR_TEXT}"/>
		</box>

		<rectangle x1="112" y1="31" x2="195" y2="54" radius="2" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_SOFT}"/>
		</rectangle>
		<fill type="N"/>
		<font family="Helvetica" style="N" size="8" color="{COLOR_GREY}"/>
		<box x="116" y="32.5" width="32" height="5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Report number</text></box>
		<box x="116" y="37.5" width="32" height="5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Count date</text></box>
		<box x="116" y="42.5" width="32" height="5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Counted by</text></box>
		<box x="116" y="47.5" width="32" height="5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Valuation</text></box>
		<font family="Helvetica" style="B" size="8" color="{COLOR_TEXT}"/>
		<box x="146" y="32.5" width="46" height="5" border="{BORDER}" horizalign="Right" vertalign="Center"><text>{REPORT_NUMBER}</text></box>
		<box x="146" y="37.5" width="46" height="5" border="{BORDER}" horizalign="Right" vertalign="Center"><text>{COUNT_DATE}</text></box>
		<box x="146" y="42.5" width="46" height="5" border="{BORDER}" horizalign="Right" vertalign="Center"><text>{COUNTED_BY}</text></box>
		<box x="146" y="47.5" width="46" height="5" border="{BORDER}" horizalign="Right" vertalign="Center"><text>{VALUATION}</text></box>

		<box x="15" y="58" width="60" height="6" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>Stock list</text>
			<font family="Helvetica" style="B" size="10" color="{COLOR_DARK}"/>
		</box>
		<!-- Legend of the conditional styles -->
		<rectangle x1="98" y1="59.6" x2="101" y2="62.6" radius="0.5" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_ORANGE}"/>
		</rectangle>
		<rectangle x1="140" y1="59.6" x2="143" y2="62.6" radius="0.5" border="1111">
			<linestyle width="0.2" color="{COLOR_RED}"/>
			<fill type="S" color="{COLOR_RED_SOFT}"/>
		</rectangle>
		<fill type="N"/>
		<font family="Helvetica" style="N" size="7" color="{COLOR_GREY}"/>
		<box x="102" y="58" width="37" height="6" border="{BORDER}" horizalign="Left" vertalign="Center"><text>at or below the reorder level</text></box>
		<box x="144" y="58" width="51" height="6" border="{BORDER}" horizalign="Left" vertalign="Center"><text>out of stock - values in US dollars</text></box>
	</content>

	<!-- ********************************** -->

	<content id="stock_table">
		<!--
			Table "inv": 36 rows on the first page (from y 66), then it continues on new pages from y 37.
			On each page break it prints page_footer on the page left and page_header on the new page, then the header row again.
		-->
		<table id="inv" x="15" width="180" y_start="66" y_start_next="37" y_end="272" row_height="5.4" header_height="7"
		       page_header="page_header" page_footer="page_footer" border="OS" altfill="{COLOR_ZEBRA}">
			<!-- Data rows: the data provider of the datalist "stock" (SetDatalist in the PHP code) -->
			<datalist id="stock"/>

			<font family="Helvetica" style="N" size="7.5" color="{COLOR_TEXT}"/>
			<headerfont family="Helvetica" style="B" size="6.8" color="{COLOR_WHITE}"/>
			<headerfill color="{COLOR_DARK}"/>
			<outerlinestyle width="0.3" color="{COLOR_LINE}"/>
			<innerlinestyle width="0.4" color="{COLOR_DARK}"/>

			<columns>
				<!-- Row number: a value with placeholders instead of a field -->
				<column value="{inv.ROWNUM}" title="#" width="8" align="R">
					<font family="Helvetica" style="N" size="6.5" color="{COLOR_GREY}"/>
				</column>
				<column field="sku" title="SKU" width="19">
					<font family="Helvetica" style="B" size="7.2" color="{COLOR_DARK}"/>
				</column>
				<!-- Width *: the space left by the other columns. Long descriptions are truncated with ... -->
				<column field="description" title="DESCRIPTION" width="*"/>
				<column field="category" title="CATEGORY" width="21">
					<font family="Helvetica" style="N" size="7" color="{COLOR_GREY}"/>
				</column>
				<column field="qty" title="ON HAND" width="15" align="R" format="I" aggregate="sum">
					<!-- Conditional cell styles: applied in order, the last one that matches wins -->
					<style when="{inv.qty}&lt;={inv.reorder}" color="{COLOR_ORANGE}" fontstyle="B"/>
					<style when="{inv.qty}=0" color="{COLOR_RED}" fontstyle="B"/>
				</column>
				<column field="reorder" title="REORDER" width="15" align="R" format="I">
					<font family="Helvetica" style="N" size="7.5" color="{COLOR_GREY}"/>
				</column>
				<column field="unit_cost" title="UNIT COST" width="17" align="R" format="F2"/>
				<column field="value" title="VALUE" width="22" align="R" format="F2" aggregate="sum" totalformat="C2">
					<font family="Helvetica" style="B" size="7.5" color="{COLOR_TEXT}"/>
				</column>
				<column field="status" title="STATUS" width="19" align="C">
					<font family="Helvetica" style="B" size="6.8" color="{COLOR_GREEN}"/>
					<style when="{inv.status}=Reorder" color="{COLOR_ORANGE}"/>
					<style when="{inv.status}=Out of stock" color="{COLOR_RED}"/>
				</column>
			</columns>

			<!-- Conditional row style: out of stock items on a red background -->
			<rowstyle when="{inv.qty}=0" fill="{COLOR_RED_SOFT}"/>

			<!-- Totals row: the label fills the columns before the first column with a total (ON HAND) -->
			<totals label="TOTAL STOCK" align="R" height="7">
				<font family="Helvetica" style="B" size="7.5" color="{COLOR_DARK}"/>
				<fill color="{COLOR_SOFT}"/>
			</totals>
		</table>
	</content>

	<!-- ********************************** -->

	<!-- Printed after the table: the y are relative to the end of the table (+ gap) -->
	<content id="summary">
		<rectangle x1="15" y1="0" x2="57" y2="22" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<rectangle x1="61" y1="0" x2="103" y2="22" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<rectangle x1="107" y1="0" x2="149" y2="22" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<rectangle x1="153" y1="0" x2="195" y2="22" radius="1.5" border="1111">
			<linestyle width="0"/>
			<fill type="S" color="{COLOR_DARK}"/>
		</rectangle>
		<fill type="N"/>

		<font family="Helvetica" style="B" size="7" color="{COLOR_GREY}"/>
		<box x="18" y="2" width="38" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>ITEMS COUNTED</text></box>
		<box x="64" y="2" width="38" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>UNITS ON HAND</text></box>
		<box x="110" y="2" width="38" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>STOCK VALUE</text></box>
		<box x="156" y="2" width="38" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>ACTION REQUIRED</text>
			<font family="Helvetica" style="B" size="7" color="{COLOR_ACCENT}"/>
		</box>

		<!-- Variables set by the table: {inv.ROWCOUNT} rows, {inv.TOTAL.field} totals of the columns with an aggregate function -->
		<font family="Helvetica" style="B" size="12" color="{COLOR_TEXT}"/>
		<box x="18" y="7" width="38" height="8" border="{BORDER}" horizalign="Left" vertalign="Center"><text>{inv.ROWCOUNT}</text></box>
		<box x="64" y="7" width="38" height="8" border="{BORDER}" horizalign="Left" vertalign="Center" format="I"><text>{inv.TOTAL.qty}</text></box>
		<box x="110" y="7" width="38" height="8" border="{BORDER}" horizalign="Left" vertalign="Center" format="C2"><text>{inv.TOTAL.value}</text></box>
		<box x="156" y="7" width="38" height="8" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>{REORDER_COUNT} to reorder</text>
			<font family="Helvetica" style="B" size="12" color="{COLOR_WHITE}"/>
		</box>

		<font family="Helvetica" style="N" size="6.8" color="{COLOR_GREY}"/>
		<box x="18" y="15.5" width="38" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>stock keeping units</text></box>
		<box x="64" y="15.5" width="38" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>all bin locations</text></box>
		<box x="110" y="15.5" width="38" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>at {VALUATION_SHORT}</text></box>
		<box x="156" y="15.5" width="38" height="4" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>{OUT_OF_STOCK_COUNT} items out of stock</text>
			<font family="Helvetica" style="N" size="6.8" color="b8c2cf"/>
		</box>
	</content>

	<!-- ********************************** -->

	<!-- Printed after the table at a fixed position (top="248"): the y are absolute -->
	<content id="signatures">
		<box x="15" y="248" width="120" height="5" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>STOCK COUNT APPROVAL</text>
			<font family="Helvetica" style="B" size="7.5" color="{COLOR_ORANGE}"/>
		</box>
		<rectangle x1="15" y1="254" x2="71" y2="272" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<rectangle x1="77" y1="254" x2="133" y2="272" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<rectangle x1="139" y1="254" x2="195" y2="272" radius="1.5" border="1111">
			<linestyle width="0.3" color="{COLOR_LINE}"/>
			<fill type="S" color="{COLOR_WHITE}"/>
		</rectangle>
		<fill type="N"/>

		<font family="Helvetica" style="B" size="7" color="{COLOR_DARK}"/>
		<box x="18" y="255" width="50" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Counted by</text></box>
		<box x="80" y="255" width="50" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Checked by (inventory control)</text></box>
		<box x="142" y="255" width="50" height="4.5" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Approved by (warehouse manager)</text></box>

		<line x="18" y="267" width="50" height="1">
			<orientation>HorizontallyTop</orientation>
			<linestyle width="0.3" color="{COLOR_GREY}"/>
		</line>
		<line x="80" y="267" width="50" height="1">
			<orientation>HorizontallyTop</orientation>
			<linestyle width="0.3" color="{COLOR_GREY}"/>
		</line>
		<line x="142" y="267" width="50" height="1">
			<orientation>HorizontallyTop</orientation>
			<linestyle width="0.3" color="{COLOR_GREY}"/>
		</line>
		<font family="Helvetica" style="N" size="6.5" color="{COLOR_GREY}"/>
		<box x="18" y="267.3" width="50" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Signature and date</text></box>
		<box x="80" y="267.3" width="50" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Signature and date</text></box>
		<box x="142" y="267.3" width="50" height="4" border="{BORDER}" horizalign="Left" vertalign="Center"><text>Signature and date</text></box>
	</content>

	<!-- ********************************** -->

	<!-- Printed by the table on each page it leaves (page_footer attribute), and by the section on the last page -->
	<content id="page_footer">
		<line x="15" y="279" width="180" height="1">
			<orientation>HorizontallyTop</orientation>
			<linestyle width="0.3" color="{COLOR_LINE}"/>
		</line>
		<box x="15" y="280.5" width="140" height="5" border="{BORDER}" horizalign="Left" vertalign="Center">
			<text>{COMPANY_NAME} - Stock inventory report {REPORT_NUMBER} - {WAREHOUSE_NAME}</text>
			<font family="Helvetica" style="I" size="7" color="{COLOR_GREY}"/>
		</box>
		<box x="150" y="280.5" width="45" height="5" border="{BORDER}" horizalign="Right" vertalign="Center">
			<text>Page {PAGEINDEX} of {PAGECOUNT}</text>
			<font family="Helvetica" style="B" size="7.5" color="{COLOR_DARK}"/>
		</box>
	</content>

</pdf>
