<?xml version="1.0" encoding="UTF-8"?>
<Report>
	<Title><var var="I18N::translate('Related individuals')" /></Title>
	<Description><var var="I18N::translate('A report of the individuals that are closely related to an individual.')" /></Description>
	<Input name="pid" lookup="INDI" type="text"><var var="I18N::translate('Individual')" /></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="NAME=>I18N::translate('sort by name')|BIRT:DATE=>I18N::translate('sort by date of birth')|DEAT:DATE=>I18N::translate('sort by date of death')"><var var="I18N::translate('Sort order')" /></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>I18N::translateContext('paper size','Letter')|A3=>I18N::translateContext('paper size', 'A3')|A4=>I18N::translateContext('paper size','A4')|legal=>I18N::translateContext('paper size','Legal')"><var var="I18N::translate('Page size')" /></Input>
	<!--
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>I18N::translateContext('font name', 'Arial')|dejavusans=>I18N::translateContext('font name', 'DejaVu')|helvetica=>I18N::translateContext('font name', 'Helvetica')"><var var="I18N::translate('Font')"/></Input>
	-->
	<SetVar name="fonts" value="dejavusans" />

	<!-- 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="195" />
	<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('Related individuals')" /></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=='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="$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="" /></Text>
						</Gedcom>
					</TextBox>
					<TextBox height="$height1" newline="1">
						<Gedcom id="@WIFE">
							<Text style="text"><GetPersonName id="" /></Text>
						</Gedcom>
					</TextBox>
				</Gedcom>
				<!-- one way or the other, we need a new line -->
				<if condition="@FAMC==''">
					<TextBox height="2" newline="1"/>
				</if>
				<RepeatTag tag="FAMS">
					<Gedcom id="@FAMS">
						<TextBox height="$height2" left="$width1" width="$widthB2">
							<if condition="$sex=='M'">
								<Text style="minibold"><var var="I18N::translate('Wife')" />: </Text>
								<Text style="mini"><GetPersonName id="@WIFE" /> <GedcomValue tag="MARR:DATE" />
								</Text>
							</if>
							<if condition="$sex=='F'">
								<Text style="minibold"><var var="I18N::translate('Husband')" />: </Text>
								<Text style="mini"><GetPersonName id="@HUSB" /> <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="" />
									</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>
