private function hentKullArray($hundId, $klubbId, $aar) { $hundListe = KullDatabase::hentAarbokAvkom($hundId, $klubbId, $aar, $this->database); $avkomListe = array(); foreach ($hundListe as $tmp) { if ($tmp['AARVF'] != "") { $tmp['AARVF'] = number_format($tmp['AARVF'], 1, ',', ''); } if ($tmp['AARJAKTL'] != "") { $tmp['AARJAKTL'] = number_format($tmp['AARJAKTL'], 1, ',', ''); } if ($tmp['AARFART'] != "") { $tmp['AARFART'] = number_format($tmp['AARFART'], 1, ',', ''); } if ($tmp['AARSTIL'] != "") { $tmp['AARSTIL'] = number_format($tmp['AARSTIL'], 1, ',', ''); } if ($tmp['AARSELVST'] != "") { $tmp['AARSELVST'] = number_format($tmp['AARSELVST'], 1, ',', ''); } if ($tmp['AARSOKBR'] != "") { $tmp['AARSOKBR'] = number_format($tmp['AARSOKBR'], 1, ',', ''); } if ($tmp['AARREV'] != "") { $tmp['AARREV'] = number_format($tmp['AARREV'], 1, ',', ''); } if ($tmp['AARSAMAR'] != "") { $tmp['AARSAMAR'] = number_format($tmp['AARSAMAR'], 1, ',', ''); } if ($tmp['TOTALVF'] != "") { $tmp['TOTALVF'] = number_format($tmp['TOTALVF'], 1, ',', ''); } if ($tmp['TOTALJAKTL'] != "") { $tmp['TOTALJAKTL'] = number_format($tmp['TOTALJAKTL'], 1, ',', ''); } if ($tmp['TOTALFART'] != "") { $tmp['TOTALFART'] = number_format($tmp['TOTALFART'], 1, ',', ''); } if ($tmp['TOTALSTIL'] != "") { $tmp['TOTALSTIL'] = number_format($tmp['TOTALSTIL'], 1, ',', ''); } if ($tmp['TOTALSELVST'] != "") { $tmp['TOTALSELVST'] = number_format($tmp['TOTALSELVST'], 1, ',', ''); } if ($tmp['TOTALSOKBR'] != "") { $tmp['TOTALSOKBR'] = number_format($tmp['TOTALSOKBR'], 1, ',', ''); } if ($tmp['TOTALREV'] != "") { $tmp['TOTALREV'] = number_format($tmp['TOTALREV'], 1, ',', ''); } if ($tmp['TOTALSAMAR'] != "") { $tmp['TOTALSAMAR'] = number_format($tmp['TOTALSAMAR'], 1, ',', ''); } $total = JaktproveDatabase::hentAarbokJaktproverTotalt($tmp['hundId'], $klubbId, $this->database); $tmp['TOTALSTART'] = $total['total']; $tmp['aar'] = $aar; $avkomFinnes = false; for ($i = 0; $i < sizeof($avkomListe); $i++) { if ($avkomListe[$i]['kullId'] == $tmp['kullId'] && ($avkomListe[$i]['partnerid'] == $tmp['hundMorId'] || $avkomListe[$i]['partnerid'] == $tmp['hundFarId'])) { $avkomFinnes = true; $avkomListe[$i]['liste'][] = $tmp; $avkomListe[$i]['antallvalper']++; } } if (!$avkomFinnes) { $avkom = array(); if ($hundId == $tmp['hundMorId']) { $avkom['partnernavn'] = $tmp['hundFarNavn']; $avkom['partnertittel'] = $tmp['hundFarTittel']; $avkom['partnerid'] = $tmp['hundFarId']; $avkom['morId'] = $tmp['hundMorId']; } else { $avkom['partnernavn'] = $tmp['hundMorNavn']; $avkom['partnertittel'] = $tmp['hundMorTittel']; $avkom['partnerid'] = $tmp['hundMorId']; $avkom['farId'] = $tmp['hundFarId']; } $avkom['kullfar'] = $tmp['hundFarNavn']; $avkom['kullmor'] = $tmp['hundMorNavn']; $avkom['fodt'] = Verktoy::konverterDatabaseTilDatDato($tmp['fodt']); $avkom['kullId'] = $tmp['kullId']; $avkom['liste'] = array(); $avkom['antallvalper'] = 1; $avkom['liste'][] = $tmp; $avkomListe[] = $avkom; } } $kullbokstav = "A"; for ($i = 0; $i < sizeof($avkomListe); $i++) { $avkomListe[$i]['kullbokstav'] = $kullbokstav++; if (isset($avkomListe[$i]['morId']) && $hundId == $avkomListe[$i]['morId']) { $far = HundDatabase::hentAarbokKullHund($avkomListe[$i]['partnerid'], $klubbId, $this->database); $mor = HundDatabase::hentAarbokKullHund($hundId, $klubbId, $this->database); } else { $far = HundDatabase::hentAarbokKullHund($hundId, $klubbId, $this->database); $mor = HundDatabase::hentAarbokKullHund($avkomListe[$i]['partnerid'], $klubbId, $this->database); } $avkomListe[$i]['kullfarfar'] = $far['hundFarNavn']; $avkomListe[$i]['kullfarmor'] = $far['hundMorNavn']; $avkomListe[$i]['kullmormor'] = $mor['hundFarNavn']; $avkomListe[$i]['kullmorfar'] = $mor['hundMorNavn']; $kull = null; if ($avkomListe[$i]['kullId'] != null) { $kull = KullDatabase::hentAarbokKullOppdretter($avkomListe[$i]['kullId'], $klubbId, $this->database); } if ($kull != null) { $avkomListe[$i]['OPPDRETTERNAVN'] = $kull['OPPDRETTERNAVN']; $avkomListe[$i]['OPPDRETTERADRESSE'] = $kull['OPPDRETTERADRESSE']; $avkomListe[$i]['OPPDRETTERPOSTNR'] = $kull['OPPDRETTERPOSTNR']; $avkomListe[$i]['OPPDRETTERSTED'] = $kull['OPPDRETTERSTED']; $avkomListe[$i]['OPPDRETTERTLF'] = $kull['OPPDRETTERTLF']; } } return $avkomListe; }