<?xml version="1.0" encoding="UTF-8"?>
<Report>
	<!-- $Id$ -->
	<Title><var var="WT_I18N::translate('Vital records')" /></Title>
	<Description><var var="WT_I18N::translate('A report of vital records for a given date or place.')" /></Description>
	<Input name="name" lookup="NAME" type="text"><var var="WT_I18N::translate('Name')" /></Input>
	<Input name="bdmplace" lookup="PLAC" type="text"><var var="WT_I18N::translate('Place')" /></Input>
	<Input name="birthdate1" lookup="DATE" type="text"><var var="WT_I18N::translate('Birth Date range start')" /></Input>
	<Input name="birthdate2" lookup="DATE" type="text"><var var="WT_I18N::translate('Birth Date range end')" /></Input>
	<Input name="deathdate1" lookup="DATE" type="text"><var var="WT_I18N::translate('Death Date range start')" /></Input>
	<Input name="deathdate2" lookup="DATE" type="text"><var var="WT_I18N::translate('Death Date range end')" /></Input>
	<Input name="sortby" type="select" default="BIRT:DATE" options="NAME=>WT_I18N::translate('sort by name')|BIRT:DATE=>WT_I18N::translate('sort by date of birth')|DEAT:DATE=>WT_I18N::translate('sort by date of death')"><var var="WT_I18N::translate('Sort order')" /></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>WT_I18N::translate_c('paper size','Letter')|A3=>WT_I18N::translate_c('paper size', 'A3')|A4=>WT_I18N::translate_c('paper size','A4')|legal=>WT_I18N::translate_c('paper size','Legal')"><var var="WT_I18N::translate('Page size')" /></Input>
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>WT_I18N::translate_c('font name', 'Arial')|dejavusans=>WT_I18N::translate_c('font name', 'DejaVu')|helvetica=>WT_I18N::translate_c('font name', 'Helvetica')"><var var="WT_I18N::translate('Font')"/></Input>

	<!-- Header -->
	<Style name="header" font="$fonts" size="15" style="b" />
	<!-- Page numbers text -->
	<Style name="pagenum" font="$fonts" size="8"/>
	<!-- Standard text -->
	<Style name="text" font="$fonts" size="9"/>
	<!-- Generated by style - required style name by the generator -->
	<Style name="genby" font="$fonts" size="8" />
	<!-- Date text -->
	<Style name="date" font="$fonts" size="8"/>
	<Style name="small" font="$fonts" size="7"/>
	<Style name="label" font="$fonts" size="10" style="b" />

	<Doc pageSize="$pageSize" orientation="landscape">
		<Header>
			<Cell align="center" newline="1" style="label"><var var="WT_I18N::translate('Vital records')" /></Cell>
			<Cell align="center" newline="1" style="header">
				<if condition="$name!=''">
				    <var var="name" /> 
				</if>
				<if condition="$bdmplace!=''">
					<var var="bdmplace" />
				</if>
			</Cell>
			<Cell align="rightrtl" height="10" newline="1" style="pagenum"><var var="WT_I18N::translate('Page')" /> <PageNum /> <var var="WT_I18N::translate('of')" /> <TotalPages /></Cell>
			<!-- Name -->
			<SetVar name="fill" value="" />
			<if condition="$sortby=='NAME'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<TextBox bgcolor="$fill" border="1" height="12" width="205">
				<Text style="label"><var var="WT_I18N::translate('Name')" /></Text>
			</TextBox>
			<!-- Birth -->
			<SetVar name="fill" value="" />
			<if condition="$sortby=='BIRT:DATE'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<TextBox bgcolor="$fill" border="1" height="12" width="165">
				<Text style="label">
					<var var="WT_I18N::translate('Birth')" />  
					<if condition="$birthdate1!='' or $birthdate2!=''">
						[
						<if condition="$birthdate1!=''">
							<var var="birthdate1" />
						</if>
						-
						<if condition="$birthdate2!=''">
							<var var="birthdate2" />
						</if>
						]
					</if>
				</Text>
			</TextBox>
			<!-- Marrige -->
			<SetVar name="fill" value="" />
			<if condition="$sortby=='MARR:DATE'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<TextBox bgcolor="$fill" border="1" height="12" width="165">
				<Text style="label"><var var="WT_I18N::translate('Marriage')" /></Text>
			</TextBox>
			<!-- Death -->
			<SetVar name="fill" value="" />
			<if condition="$sortby=='DEAT:DATE'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<TextBox bgcolor="$fill" border="1" height="12" newline="1">
				<Text style="label">
					<var var="WT_I18N::translate('Death')" />  
					<if condition="$deathdate1!='' or $deathdate2!=''">
						[
						<if condition="$deathdate1!=''">
							<var var="deathdate1" />
						</if>
						-
						<if condition="$deathdate2!=''">
							<var var="deathdate2" />
						</if>
						]
					</if>
				</Text>
			</TextBox>
		</Header>

		<Body>
			<SetVar name="filter1" value="" />
			<if condition="$bdmplace!=''">
				<SetVar name="filter1" value=":PLAC CONTAINS $bdmplace" />
				<!-- todo: print only if BDM place is the searched place - use OR - search also on marriage place and date -->
			</if>

			<List list="individual" filter1="$filter1" filter2="BIRT:DATE GTE $birthdate1" filter3="BIRT:DATE LTE $birthdate2" filter4="DEAT:DATE GTE $deathdate1" filter5="DEAT:DATE LTE $deathdate2" filter6="NAME CONTAINS $name" sortby="$sortby">
				<SetVar name="spid" value="@ID" />

				<TextBox width="205" height="46">
					<Text style="text">
						<GetPersonName id="" /><br />
					</Text>
					<Text style="small">
						   <var var="WT_I18N::translate('Father')" />
						: <Gedcom id="@FAMC"><GetPersonName id="@HUSB" /></Gedcom>
						<br />   <var var="WT_I18N::translate('Mother')" />
						: <Gedcom id="@FAMC"><GetPersonName id="@WIFE" /></Gedcom>
					</Text>
				</TextBox>

				<TextBox width="165" height="46" border="0">
					<SetVar name="moreB" value="0" />
					<Text style="small">
						<RepeatTag tag="BIRT">
							<if condition="$moreB==1">
								<br />
							</if>
							<var var="WT_I18N::translate('Date')" />
							: <GedcomValue tag="BIRT:DATE" />
							<br />  <var var="WT_I18N::translate('Place')" />
							: <GedcomValue tag="BIRT:PLAC" />
							<br />  <var var="WT_I18N::translate('Source')" />
							: <RepeatTag tag="BIRT:SOUR">
								<Gedcom id="@SOUR">
									<GedcomValue tag="TITL" />
								</Gedcom>
							</RepeatTag>
							<SetVar name="moreB" value="1" />
						</RepeatTag>
					</Text>
				</TextBox>

				<TextBox width="165" height="46" border="0">
					<SetVar name="more" value="0" />
					<RepeatTag tag="FAMS">
						<Text style="small">
							<Gedcom id="@FAMS">
								<if condition="$more==1">
									<br />
									---------------------------
									<br />
								</if>
								<!-- todo: print the dates, places and sources of all the FAM MARR records -->
								<var var="WT_I18N::translate('Date')" />
								: <GedcomValue tag="MARR:DATE" />
								<br />  <var var="WT_I18N::translate('Place')" />
								: <GedcomValue tag="MARR:PLAC" />
								<br />  <var var="WT_I18N::translate('Source')" />
								: <RepeatTag tag="MARR:SOUR">
									<Gedcom id="@SOUR">
										<GedcomValue tag="TITL" /> 
									</Gedcom>
								</RepeatTag>
								<br />
								<var var="WT_I18N::translate('Spouse')" />
								: 
								<if condition="$spid==@WIFE">
									<GetPersonName id="@HUSB" />
								</if>
								<if condition="$spid==@HUSB">
									<GetPersonName id="@WIFE" />
								</if>
								<SetVar name="more" value="1" />
							</Gedcom>
						</Text>
					</RepeatTag>
				</TextBox>

				<TextBox border="0" height="46" newline="1">
					<SetVar name="moreD" value="0" />
					<Text style="small">
						<RepeatTag tag="DEAT">
							<if condition="$moreD==1">
								<br />
							</if>
							<var var="WT_I18N::translate('Date')" />
							: <GedcomValue tag="DEAT:DATE" />
							<br />  <var var="WT_I18N::translate('Place')" />
							: <GedcomValue tag="DEAT:PLAC" />
							<br />  <var var="WT_I18N::translate('Source')" />
							: <RepeatTag tag="DEAT:SOUR">
								<Gedcom id="@SOUR">
									<GedcomValue tag="TITL" /> 
								</Gedcom>
							</RepeatTag>
							<SetVar name="moreD" value="1" />
						</RepeatTag>
						<RepeatTag tag="BURI:CEME">
							<br /><var var="WT_I18N::translate('Cemetery')" />
							: <GedcomValue tag="CEME" />
						</RepeatTag>
					</Text>
				</TextBox>
				<Line />
			</List>

			<Cell align="rightrtl" height="24" newline="1" style="label"><br />
				<var var="WT_I18N::translate('Total individuals')" />
				: <ListTotal />
			</Cell>
		</Body>
		<Footer>
			<Cell align="rightrtl" newline="1" style="date"><Now /></Cell>
		</Footer>
	</Doc>
</Report>
