<vn>
<vn-group>
	<db-form id="ticket" on-ready="onTicketReady">
		<db-model property="model" id="ticket-data" conn="conn" batch="batch">
			CALL myTicket_get(#ticket)
		</db-model>
	</db-form>
</vn-group>
<div id="report" class="sheet">
	<h2>
		@<htk-text column="id" form="ticket"/>
	</h2>
	<div class="header">
		<div>
			<p>
				<t>Preparation</t> <htk-text form="ticket" column="shipped" format="%D"/>
			</p>
			<p>
				<t>Delivery</t> <htk-text form="ticket" column="landed" format="%D"/>
			</p>
			<p>
				<span id="method"></span> <htk-text form="ticket" column="agency"/>
			</p>
		</div>
		<div class="address">
			<p>
				<htk-text form="ticket" column="nickname"/>
			</p>
			<p>
				<htk-text form="ticket" column="street"/>
			</p>
			<p>
				<htk-text form="ticket" column="postalCode"/> 
				<htk-text form="ticket" column="city"/> 
				(<htk-text form="ticket" column="province"/>)
			</p>
		</div>
		<div class="total">
			<p class="important">
				<t>Total</t> 
				<htk-text format="%.2d€" form="ticket" column="taxBase"/>
			</p>
			<p class="important">
				<t>Total + tax</t> 
				<htk-text format="%.2d€" form="ticket" column="total"/>
			</p>
		</div>
	</div>
	<htk-grid>
		<db-model property="model" id="movements" conn="conn" batch="batch">
			CALL myTicket_getRows(#ticket)
		</db-model>
		<htk-column-spin title="_Ref" column="itemFk"/>
		<htk-column-spin title="_Amount" column="quantity"/>
		<htk-column-text title="_Item" column="concept"/>
		<htk-column-text title="_S1" column="size"/>
		<htk-column-text title="_Cat" column="category"/>
		<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
		<htk-column-spin title="_Disc" column="discount" unit="%" renderer="discountRenderer"/>
		<htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="subtotalRenderer"/>
	</htk-grid>
	<htk-grid id="services">
		<db-model
			property="model"
			id="services"
			conn="conn"
			batch="batch"
			on-status-changed="onServicesChanged">
			CALL myTicket_getServices(#ticket)
		</db-model>
		<htk-column-text title="_Service" column="description"/>
		<htk-column-spin title="_Amount" column="quantity"/>
		<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
		<htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="serviceSubtotal"/>
	</htk-grid>
	<htk-grid id="packages" class="packages">
		<db-model
			property="model"
			conn="conn"
			batch="batch"
			on-status-changed="onPackagesChanged">
				CALL myTicket_getPackages(#ticket)
		</db-model>
		<htk-column-spin title="_Ref" column="id"/>
		<htk-column-spin title="_Amount" column="quantity"/>
		<htk-column-text title="_Packaging" column="name"/>
	</htk-grid>
</div>
</vn>
