<?xml version="1.0" encoding="UTF-8"?>
<PGVReport>
<!-- $Id$ -->
	<PGVRTitle><PGVRvar var="i18n::translate('Ahnentafel Report')" /></PGVRTitle>
	<PGVRDescription>Prints an Ahnentafel report for the selected individual</PGVRDescription>
	<PGVRInput name="pid" lookup="INDI" type="text"><PGVRvar var="i18n::translate('Enter Individual ID')" /></PGVRInput>
	<PGVRInput name="maxgen" type="select" options="3,4,5,6,7,8,9,*"><PGVRvar var="i18n::translate('Generations')" /></PGVRInput>
	<PGVRInput name="sources" type="checkbox" default="1"><PGVRvar var="i18n::translate('Show sources?')" /></PGVRInput>
	<PGVRInput name="notes" type="checkbox" default="1"><PGVRvar var="i18n::translate('Show notes?')" /></PGVRInput>
	<PGVRInput name="pageSize" type="select" default="A4" options="letter,A3,A4,legal"><PGVRvar var="i18n::translate('Page size')" /></PGVRInput>
	<PGVRInput name="fonts" type="select" default="dejavusans" options="arialunicid0,dejavusans,helvetica"><PGVRvar var="i18n::translate('Font')"/></PGVRInput>
	
	<!-- Header -->
	<PGVRStyle name="header" font="$fonts" size="14" style="b" />
	<!-- Page numbers text -->
	<PGVRStyle name="pagenum" font="$fonts" size="8"/>
	<!-- Standard text -->
	<PGVRStyle name="text" font="$fonts" size="10"/>
	<!-- Links to sources - required style name by the generator -->
	<PGVRStyle name="footnotenum" font="$fonts" size="7"/>
	<!-- Source text - PGVRFootnoteTexts - required style name by the generator -->
	<PGVRStyle name="footnote" font="$fonts" size="8"/>
	<!-- Generated by style - required style name by the generator -->
	<PGVRStyle name="genby" font="$fonts" size="8" />
	<!-- Date Text-->
	<PGVRStyle name="date" font="$fonts" size="8"/>
	<!-- Note Text -->
	<PGVRStyle name="note" font="$fonts" size="9"/>
	<!-- Individual name -->
	<PGVRStyle name="name" font="$fonts" size="10" style="b" />
	<PGVRStyle name="subheader" font="$fonts" size="12" style="b" />

	<PGVRSetVar name="num" value="1" />
	<PGVRSetVar name="generation" value="0" />
	<PGVRSetVar name="empty_name" value="f" />
	<PGVRSetVar name="empty_start_value" value="0" />
	<!-- New Page for Sources controller if SOUR exist -->
	<PGVRSetVar name="source_exist" value="0" />

	<PGVRDoc pageSize="$pageSize">
		<PGVRHeader>
			<PGVRCell align="center" height="30" newline="1" style="header"><PGVRvar var="i18n::translate('Ahnentafel Report for ')" /><PGVRGetPersonName id="$pid" /></PGVRCell>
			<PGVRCell align="rightrtl" newline="1" style="pagenum"><PGVRvar var="i18n::translate('Page')" /> <PGVRPageNum /> <PGVRvar var="i18n::translate('of')" /> <PGVRTotalPages /></PGVRCell>
		</PGVRHeader>

		<PGVRBody>
			<PGVRRelatives id="$pid" group="direct-ancestors" sortby="none" maxgen="$maxgen" showempty="true">
				<PGVRSetVar name="gender" value="m" />
				<PGVRSetVar name="pronoun" value="i18n::translate('He ')" />
				<PGVRif condition="@SEX=='F'">
					<PGVRSetVar name="pronoun" value="i18n::translate('She ')" />
					<PGVRSetVar name="gender" value="f" />
				</PGVRif>
				<PGVRSetVar name="printPronoun" value=" " />
				<PGVRif condition="$generation!=@generation">
					<PGVRif condition="$empty_name=='t'" >
						<PGVRTextBox width="50" height="20">
							<PGVRSetVar name="empty_end_value" value="$num-1" />
							<PGVRText style="text"><PGVRvar var="empty_start_value" />-<PGVRvar var="empty_end_value" />.</PGVRText>
						</PGVRTextBox>
						<PGVRTextBox width="475" height="12" newline="1" >
							<PGVRText style="text"><br /></PGVRText>
						</PGVRTextBox>
						<PGVRTextBox width="25" height="20" newline="1">
							<PGVRText style="text"><br /></PGVRText>
						</PGVRTextBox>
						<PGVRSetVar name="empty_start_value" value="$num" />
					</PGVRif>
					<PGVRCell align="center" height="30" newline="1" style="subheader"><PGVRvar var="i18n::translate('Generation ')" /><PGVRGeneration /></PGVRCell>
					<PGVRSetVar name="generation" value="@generation" />
				</PGVRif>
				<PGVRSetVar name="indiname" value="@NAME" />
				<PGVRif condition="$indiname==''">
					<PGVRif condition="$empty_name=='f'">
						<PGVRSetVar name="empty_name" value="t" />
						<PGVRSetVar name="empty_start_value" value="$num" />
					</PGVRif>
				</PGVRif>
				<PGVRif condition="$indiname!=''">
					<PGVRif condition="$empty_name=='t'" >
						<PGVRTextBox width="50" height="20">
							<PGVRSetVar name="empty_end_value" value="$num-1" />
							<PGVRText style="text"><PGVRvar var="empty_start_value" />-<PGVRvar var="empty_end_value" />.</PGVRText>
						</PGVRTextBox>
						<PGVRTextBox width="475" height="12" newline="1">
							<PGVRText style="text"><br /></PGVRText>
						</PGVRTextBox>
						<PGVRTextBox width="25" height="20" newline="1">
							<PGVRText style="text"><br /></PGVRText>
						</PGVRTextBox>
						<PGVRSetVar name="empty_name" value="f" />
					</PGVRif>
					
					<!-- Generation counter -->
					<PGVRTextBox width="25" height="30">
						<PGVRText style="text"><PGVRvar var="num" />.</PGVRText>
					</PGVRTextBox>
					
					<!-- 	Sentence 1
							Individual, name... -->
					<PGVRTextBox height="12" newline="1">
						<PGVRText style="name"><PGVRGetPersonName id="" /> </PGVRText>
						<PGVRif condition="$sources==1">
							<!-- Level 1 Sourcees -->
							<PGVRRepeatTag tag="SOUR">
								<PGVRFootnote>
									<PGVRGedcom id="@SOUR">
										<PGVRGedcomValue tag="TITL" />
									</PGVRGedcom>
									<PGVRif condition="@PAGE!=''">: </PGVRif>
									<PGVRGedcomValue tag="SOUR:PAGE"/> <PGVRGedcomValue tag="SOUR:DATA:TEXT"/>
								</PGVRFootnote>
								<PGVRSetVar name="source_exist" value="1"/>
							</PGVRRepeatTag>
						</PGVRif>
						<!-- Individual, birth... -->
						<PGVRGedcom id="BIRT">
							<PGVRText style="text"><PGVRvar var="printPronoun" />
								<PGVRif condition="$gender=='m'">
									<PGVRvar var="i18n::translate_c('MALE', 'was born')" /> 
								</PGVRif>
								<PGVRif condition="$gender=='f'">
									<PGVRvar var="i18n::translate_c('FEMALE', 'was born')" /> 
								</PGVRif>
							</PGVRText>
							<PGVRif condition="$sources==1">
								<PGVRRepeatTag tag="BIRT:SOUR">
									<PGVRFootnote>
										<PGVRGedcom id="@SOUR">
											<PGVRGedcomValue tag="TITL" />
										</PGVRGedcom>
										<PGVRif condition="@PAGE!=''">: </PGVRif>
										<PGVRGedcomValue tag="PAGE" level="3"/> <PGVRGedcomValue tag="DATA:TEXT" level="3"/>
									</PGVRFootnote>
									<PGVRSetVar name="source_exist" value="1"/>
								</PGVRRepeatTag>
							</PGVRif>
							<PGVRif condition="@DATE!=''">
								<PGVRText style="text"><PGVRvar var=" " /> <PGVRGedcomValue tag="DATE" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="@PLAC!=''">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' in ')" /> <PGVRGedcomValue tag="PLAC" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="(@desc=='Y') or (@DATE=='' and @PLAC=='')">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' but the details are unknown')" /></PGVRText>
							</PGVRif>
							<PGVRText style="text">.</PGVRText>
							<PGVRSetVar name="printPronoun" value="$pronoun" />
						</PGVRGedcom>

						<!-- 	Sentence 2
								Individual, christened... -->
						<PGVRGedcom id="CHR">
							<PGVRText style="text">  <PGVRvar var="printPronoun" />
								<PGVRif condition="$gender=='m'">
									<PGVRvar var="i18n::translate_c('MALE', 'was christened')" /> 
								</PGVRif>
								<PGVRif condition="$gender=='f'">
									<PGVRvar var="i18n::translate_c('FEMALE', 'was christened')" /> 
								</PGVRif>
							</PGVRText>
							<PGVRif condition="$sources==1">
								<PGVRRepeatTag tag="CHR:SOUR">
									<PGVRFootnote>
										<PGVRGedcom id="@SOUR">
											<PGVRGedcomValue tag="TITL" />
										</PGVRGedcom>
										<PGVRif condition="@PAGE!=''">: </PGVRif>
										<PGVRGedcomValue tag="PAGE" level="3"/> <PGVRGedcomValue tag="DATA:TEXT" level="3"/>
									</PGVRFootnote>
									<PGVRSetVar name="source_exist" value="1"/>
								</PGVRRepeatTag>
							</PGVRif>
							<PGVRif condition="@DATE!=''">
								<PGVRText style="text"><PGVRvar var=" " /> <PGVRGedcomValue tag="DATE" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="@PLAC!=''">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' in ')" /> <PGVRGedcomValue tag="PLAC" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="(@desc=='Y') or (@DATE=='' and @PLAC=='')">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' but the details are unknown')" /></PGVRText>
							</PGVRif>
							<PGVRText style="text">.</PGVRText>
							<PGVRSetVar name="printPronoun" value="$pronoun" />
						</PGVRGedcom>
						<PGVRSetVar name="cpid" value="@ID" />
						<PGVRif condition="$cpid!=$spid">
							<PGVRGedcom id="@FAMS">
								<PGVRif condition="$cpid==@HUSB">
									<PGVRSetVar name="spid" value="@WIFE" />
								</PGVRif>
								<PGVRif condition="$cpid==@WIFE">
									<PGVRSetVar name="spid" value="@HUSB" />
								</PGVRif>
								<PGVRGedcom id="MARR">
									<PGVRif condition="$spid!='' and @DATE!='' and @PLAC!=''">
										<PGVRText style="text"><br /><PGVRvar var="printPronoun" />
											<PGVRif condition="$gender=='m'">
												<PGVRvar var="i18n::translate_c('MALE', 'married')" /> 
											</PGVRif>
											<PGVRif condition="$gender=='f'">
												<PGVRvar var="i18n::translate_c('FEMALE', 'married')" /> 
											</PGVRif>
										</PGVRText>
										<PGVRif condition="$sources==1">
											<PGVRRepeatTag tag="MARR:SOUR">
												<PGVRFootnote>
													<PGVRGedcom id="@SOUR">
														<PGVRGedcomValue tag="TITL" />
													</PGVRGedcom>
														<PGVRif condition="@PAGE!=''">: </PGVRif>
													<PGVRGedcomValue tag="PAGE" level="3"/> <PGVRGedcomValue tag="DATA:TEXT" level="3"/>
												</PGVRFootnote>
												<PGVRSetVar name="source_exist" value="1"/>
											</PGVRRepeatTag>
										</PGVRif>
										<PGVRif condition="$spid!=''">
											<PGVRText style="text"> <PGVRGetPersonName id="$spid" /></PGVRText>
										</PGVRif>
										<PGVRText style="text"> <PGVRvar var=" " /></PGVRText>								
										<PGVRif condition="@DATE!=''">
											<PGVRText style="text"><PGVRvar var=" " /> <PGVRGedcomValue tag="DATE" level="2" /><PGVRif condition="@PLAC==''"> </PGVRif></PGVRText>
										</PGVRif>
										<PGVRif condition="@PLAC!=''">
											<PGVRText style="text"><PGVRvar var="i18n::translate(' in ')" /> <PGVRGedcomValue tag="PLAC" level="2" /></PGVRText>
										</PGVRif>
										<PGVRif condition="((@desc=='Y') or (@DATE=='' and @PLAC=='')) and ($spid=='')">
											<PGVRText style="text"><PGVRvar var="i18n::translate(' but the details are unknown')" /></PGVRText>
										</PGVRif>
										<PGVRText style="text">.</PGVRText>
										<PGVRSetVar name="printPronoun" value="$pronoun" />
									</PGVRif>
								</PGVRGedcom>
							</PGVRGedcom>
						</PGVRif>
						<PGVRGedcom id="DEAT">
							<PGVRText style="text"><br /><PGVRvar var="printPronoun" />
								<PGVRif condition="$gender=='m'">
									<PGVRvar var="i18n::translate_c('MALE', 'died')" /> 
								</PGVRif>
								<PGVRif condition="$gender=='f'">
									<PGVRvar var="i18n::translate_c('FEMALE', 'died')" /> 
								</PGVRif>
							</PGVRText>
							<PGVRif condition="$sources==1">
								<PGVRRepeatTag tag="DEAT:SOUR">
									<PGVRFootnote>
										<PGVRGedcom id="@SOUR">
											<PGVRGedcomValue tag="TITL" />
										</PGVRGedcom>
										<PGVRif condition="@PAGE!=''">: </PGVRif>
										<PGVRGedcomValue tag="PAGE" level="3"/> <PGVRGedcomValue tag="DATA:TEXT" level="3"/>
									</PGVRFootnote>
									<PGVRSetVar name="source_exist" value="1"/>
								</PGVRRepeatTag>
							</PGVRif>
							<PGVRif condition="@DATE!=''">
								<PGVRText style="text"><PGVRvar var=" " /> <PGVRGedcomValue tag="DATE" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="@PLAC!=''">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' in ')" /> <PGVRGedcomValue tag="PLAC" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="(@desc=='Y') or (@DATE=='' and @PLAC=='')">
								<PGVRText style="text"> <PGVRvar var="i18n::translate(' but the details are unknown')" /></PGVRText>
							</PGVRif>
							<PGVRText style="text">.  </PGVRText>
							<PGVRSetVar name="printPronoun" value="$pronoun" />
						</PGVRGedcom>
						<PGVRGedcom id="BURI">
							<PGVRText style="text"><PGVRvar var="printPronoun" />
								<PGVRif condition="$gender=='m'">
									<PGVRvar var="i18n::translate_c('MALE', 'was buried')" /> 
								</PGVRif>
								<PGVRif condition="$gender=='f'">
									<PGVRvar var="i18n::translate_c('FEMALE', 'was buried')" /> 
								</PGVRif>
							</PGVRText>
							<PGVRif condition="$sources==1">
								<PGVRRepeatTag tag="BURI:SOUR">
									<PGVRFootnote>
										<PGVRGedcom id="@SOUR">
											<PGVRGedcomValue tag="TITL" />
										</PGVRGedcom>
										<PGVRif condition="@PAGE!=''">: </PGVRif>
										<PGVRGedcomValue tag="PAGE" level="3"/> <PGVRGedcomValue tag="DATA:TEXT" level="3"/>
									</PGVRFootnote>
									<PGVRSetVar name="source_exist" value="1"/>
								</PGVRRepeatTag>
							</PGVRif>
							<PGVRif condition="@DATE!=''">
								<PGVRText style="text"><PGVRvar var=" " /> <PGVRGedcomValue tag="DATE" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="@PLAC!=''">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' in ')" /> <PGVRGedcomValue tag="PLAC" level="2" /></PGVRText>
							</PGVRif>
							<PGVRif condition="(@desc=='Y') or (@DATE=='' and @PLAC=='')">
								<PGVRText style="text"><PGVRvar var="i18n::translate(' but the details are unknown')" /></PGVRText>
							</PGVRif>
							<PGVRText style="text">.</PGVRText>
							<PGVRSetVar name="printPronoun" value="$pronoun" />
						</PGVRGedcom>
					</PGVRTextBox>
					<PGVRif condition="$notes==1">
						<PGVRRepeatTag tag="NOTE">
							<PGVRTextBox height="3" newline="1" padding="0"/>
							<PGVRCell height="12" left="30" newline="1" style="note"><PGVRGedcomValue tag="NOTE"/></PGVRCell>
						</PGVRRepeatTag>
					</PGVRif>
					<PGVRTextBox height="10" newline="1" padding="0"/>
				</PGVRif>
				<PGVRSetVar name="num" value="$num+1" />
			</PGVRRelatives>
			<!-- if the sources were on, print the source citations as footnotes -->
			<PGVRif condition="($sources==1) and ($source_exist==1)">
				<PGVRNewPage/>
				<PGVRTextBox width="$width" height="20" newline="1">
					<PGVRText style="subheader"><PGVRvar var="i18n::translate('Sources')" /><br /><br /></PGVRText>
					<PGVRFootnoteTexts />
				</PGVRTextBox>
			</PGVRif>
		</PGVRBody>
		<PGVRFooter>
			<PGVRCell align="rightrtl" style="date"><PGVRNow /></PGVRCell>
		</PGVRFooter>
	</PGVRDoc>
</PGVReport>
