<?xml version="1.0" encoding="UTF-8"?>
<Report>
<!-- $Id$ -->
	<Title><var var="i18n::translate('Expanded Relatives Report')" /></Title>
	<Description>Prints a list of individuals related to a specific person</Description>
	<Input name="pid" lookup="INDI" type="text"><var var="i18n::translate('Enter Individual ID')" /></Input>
	<Input name="relatives" type="select" options="child-family=>i18n::translate('Parents and siblings')|spouse-family=>i18n::translate('Spouses and children')|direct-ancestors=>i18n::translate('Direct line ancestors')|ancestors=>i18n::translate('Direct line ancestors and their families')|descendants=>i18n::translate('Descendants')|all=>i18n::translate('All')"><var var="i18n::translate('Choose relatives')" /></Input>
	<Input name="sortby" type="select" default="BIRT:DATE" options="none=>i18n::translate('None')|ID=>i18n::translate('ID number')|NAME=>i18n::translate('Name')|BIRT:DATE=>i18n::translate('Date of birth')|DEAT:DATE=>i18n::translate('Date of death')"><var var="i18n::translate('Sort by')" /></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>i18n::translate_c('paper size','Letter')|A3=>i18n::translate_c('paper size', 'A3')|A4=>i18n::translate_c('paper size','A4')|legal=>i18n::translate_c('paper size','Legal')"><var var="i18n::translate('Page size')" /></Input>
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>i18n::translate_c('font name', 'Arial')|dejavusans=>i18n::translate_c('font name', 'DejaVu')|helvetica=>i18n::translate_c('font name', 'Helvetica')"><var var="i18n::translate('Font')"/></Input>

	<!-- Header -->
	<Style name="header" font="$fonts" size="14" />
	<!-- Page numbers text -->
	<Style name="pagenum" font="$fonts" size="8" />
	<!-- 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="text" font="$fonts" size="10" />
	<Style name="bold" font="$fonts" size="10" style="b" />
	<Style name="mini" font="$fonts" size="8" />
	<Style name="minibold" font="$fonts" size="8" style="b" />
	<Style name="label" font="$fonts" size="10" style="b" />

	<SetVar name="height1" value="14" />
	<SetVar name="height2" value="10" />
	<SetVar name="width1" value="45" />
	<SetVar name="width2" value="150" />
	<SetVar name="width3" value="120" />
	<SetVar name="width4" value="120" />
	<SetVar name="width5" value="150" />
	<SetVar name="width6" value="150" />
	<SetVar name="widthB2" value="280" />
	<SetVar name="widthB3" value="40" />
	<SetVar name="widthB4" value="375" />
	<SetVar name="leftbdp" value="$width1+$width2" />

	<Doc pageSize="$pageSize" orientation="landscape">
		<Header>
			<Cell align="center" height="20" newline="1" style="header"><var var="i18n::translate('Expanded Relatives Report')" /></Cell>
			<Cell align="rightrtl" newline="1" style="pagenum"><var var="i18n::translate('Page')" /> <PageNum /> <var var="i18n::translate('of')" /> <TotalPages /></Cell>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='ID'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<Cell bgcolor="$fill" border="1" height="$height1" style="label" width="$width1"> </Cell>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='NAME'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<Cell bgcolor="$fill" border="1" height="$height1" style="label" width="$width2"> <var var="i18n::translate('Name')" /></Cell>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='BIRT:DATE'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<Cell bgcolor="$fill" border="1" height="$height1" style="label" width="$width3"> <var var="i18n::translate('Birth')" /></Cell>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='DEAT:DATE'">
				<SetVar name="fill" value="#AAAAAA" />
			</if>
			<Cell bgcolor="$fill" border="1" height="$height1" style="label" width="$width4"> <var var="i18n::translate('Death')" /></Cell>

			<Cell border="1" height="$height1" style="label" width="$width5"> <var var="i18n::translate('Father')" /></Cell>
			<Cell border="1" height="$height1" newline="1" style="label"> <var var="i18n::translate('Mother')" /></Cell>
		</Header>

		<Body>
			<Relatives id="$pid" group="$relatives" sortby="$sortby">
				<SetVar name="sex" value="@SEX" />
				<!-- 1. Block -->
				<TextBox height="$height1" width="$width1">
					<Text style="bold"><GedcomValue tag="@id" /></Text>
				</TextBox>
				<TextBox height="$height1" width="$width2">
					<Text style="bold"><GetPersonName id="" /></Text>
				</TextBox>
				<TextBox height="$height1" width="$width3">
					<Text style="text"><GedcomValue tag="BIRT:DATE" truncate="20" /><br/></Text>
					<Text style="mini"><GedcomValue tag="BIRT:PLAC" /></Text>
				</TextBox>
				<TextBox height="$height1" width="$width4">
					<Text style="text"><GedcomValue tag="DEAT:DATE" truncate="20" /><br/></Text>
					<Text style="mini"><GedcomValue tag="DEAT:PLAC" /></Text>
				</TextBox>
				<!-- If FAMC is empty all lines will be ignored. So, don't place any newline break in here -->
				<Gedcom id="@FAMC">
					<TextBox height="$height1" width="$width5">
						<Gedcom id="@HUSB">
							<Text style="text"><GetPersonName id="" /> (<GedcomValue tag="@id" />)</Text>
						</Gedcom>
					</TextBox>
					<TextBox height="$height1" newline="1">
						<Gedcom id="@WIFE">
							<Text style="text"><GetPersonName id="" /> (<GedcomValue tag="@id" />)</Text>
						</Gedcom>
					</TextBox>
				</Gedcom>
				<!-- one way or the other, we need a new line -->
				<if condition="@FAMC==''">
					<TextBox height="2" newline="1"/>
				</if>
				<!-- 2. Block -->
<!--				<TextBox height="$height2" left="$leftbdp" width="$width3">
					<Text style="mini"><GedcomValue tag="BIRT:PLAC" /></Text>
				</TextBox>
				<TextBox height="$height2" newline="1" width="$width4">
					<Text style="mini"><GedcomValue tag="DEAT:PLAC" /></Text>
				</TextBox>
-->				<!-- 3. Block -->
				<RepeatTag tag="FAMS">
					<Gedcom id="@FAMS">
						<TextBox height="$height2" left="$width1" width="$widthB2">
							<if condition="$sex=='M'">
								<Text style="mini">
									<var var="i18n::translate('Family')" /> (<GedcomValue tag="@id" />) <var var="i18n::translate('with')" /> <GetPersonName id="@WIFE" /> (<Gedcom id="@WIFE"><GedcomValue tag="@id" /></Gedcom>) <GedcomValue tag="MARR:DATE" />
								</Text>
							</if>
							<if condition="$sex=='F'">
								<Text style="mini">
									<var var="i18n::translate('Family')" /> (<GedcomValue tag="@id" />) <var var="i18n::translate('with')" /> <GetPersonName id="@HUSB" /> (<Gedcom id="@HUSB"><GedcomValue tag="@id" /></Gedcom>) <GedcomValue tag="MARR:DATE" />
								</Text>
							</if>
						</TextBox>
						<TextBox height="$height2" width="50">
							<Text style="minibold"><var var="i18n::translate('Children')" />:</Text>
						</TextBox>
						<TextBox height="$height2" newline="1">
							<SetVar name="morechildren" value="0" />
							<RepeatTag tag="CHIL">
								<Gedcom id="@CHIL">
									<Text style="mini">
										<!-- Print this only when more than one child exist -->
										<if condition="$morechildren==1">, </if>
										<GetPersonName id="" /> (<GedcomValue tag="@id" />)
									</Text>
									<SetVar name="morechildren" value="1" />
								</Gedcom>
							</RepeatTag>
						</TextBox>
					</Gedcom>
				</RepeatTag>

				<!-- keep distance between line -->
				<TextBox height="2" newline="1" padding="0"/>
				<Line />
				<TextBox height="2" newline="1" padding="0"/>

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