public function findData($filters = array()) { $billAddr = array(); $shipAddr = array(); $oAddress = new AddressObject(); $langId = Zend_Registry::get('languageID'); $data = parent::findData($filters); if (!empty($data)) { $data = $data[0]; $first = $data['MP_FirstParent']; $second = $data['MP_SecondParent']; $data['MP_BirthDateDt'] = $data['MP_BirthDate']; $oParent = new ParentProfilesObject(); $firstPar = $oParent->getParentDetails($first, array('PP_GenericProfileId' => $first)); $secPar = $oParent->getParentDetails($second, array('PP_GenericProfileId' => $second)); if (!empty($firstPar)) { $firstLink = array($firstPar['RoleLabel'], $firstPar['GP_MemberID'], $firstPar['GP_FirstName'], $firstPar['GP_LastName'], $firstPar['PP_TaxReceipt']); $data['firstP'] = $firstLink; } if (!empty($secPar)) { $secLink = array($secPar['RoleLabel'], $secPar['GP_MemberID'], $secPar['GP_FirstName'], $secPar['GP_LastName'], $secPar['PP_TaxReceipt']); $data['secP'] = $secLink; } // $billId = $data['MP_BillingAddrId']; // $shipId = $data['MP_ShippingAddrId']; // // if (!empty($shipId)) // { // $shipAddr = $oAddress->getAll($langId, true, $shipId); // $shipAddr = $shipAddr[0]; // $shipAddr['MP_ShippingAddrId'] = $shipId; // } // // if (!empty($billId)) // { // $billAddr = $oAddress->getAll($langId, true, $billId); // $billAddr = $billAddr[0]; // $billAddr['MP_BillingAddrId'] = $billId; // } // // if (isset($shipAddr['A_Duplicate']) && !$shipAddr['A_Duplicate']) // $shipAddr['duplicate'] = 0; // // $data['addressFact'] = $billAddr; // $data['addressShipping'] = $shipAddr; $years = 0; if (isset($data['MP_BirthDate'])) { $years = $this->calculateAge($data['MP_BirthDate']); } $data['MP_Age'] = $years; } return $data; }
public function toExcelAction() { $this->filename = 'membersList.xls'; $this->type = 'Excel5'; $profile = new GenericProfilesObject(); $profile->setOrderBy('GP_LastName'); $member = new MemberProfilesObject(); $oRef = new ReferencesObject(); $oAddr = new AddressObject(); $oParent = new ParentProfilesObject(); $oParent = new ParentProfilesObject(); $this->select = $profile->getAll(null, false); $this->select->columns(array('lastName' => 'GP_LastName', 'firstName' => 'GP_FirstName', 'email' => 'GP_Email', 'member_id' => 'GP_MemberID')); $this->select->joinRight($member->getDataTableName(), $member->getDataId() . ' = ' . $profile->getDataId()); $this->select->joinLeft($oRef->getDataTableName(), $oRef->getDataId() . ' = MP_Section', array('R_TypeRef')); $this->select->joinLeft($oRef->getIndexTableName(), $oRef->getIndexId() . ' = ' . $oRef->getDataId(), array('section' => 'RI_Value')); $this->select->joinLeft($oParent->getDataTableName(), $oParent->getDataId() . ' = MP_FirstParent OR ' . $oParent->getDataId() . ' = MP_SecondParent'); // $this->select->joinLeft( // $oParent->getDataTableName(), // $oParent->getDataId() . ' = MP_SecondParent' // ); $this->select->joinLeft($oAddr->getDataTableName(), $oAddr->getDataId() . ' = PP_AddressId'); $this->select->joinLeft($oAddr->getIndexTableName(), $oAddr->getIndexId() . ' = ' . $oAddr->getDataId()); $this->select->joinLeft('CountriesIndex', 'CountriesIndex.CI_CountryID = A_CountryId', 'CI_Name'); $this->select->joinLeft('StatesIndex', 'SI_StateID = A_StateId', 'SI_Name'); $this->select->where('MP_Category in (45,46)'); $this->select->where('MP_YearsParticipate like "%' . date('Y', time()) . '%"'); $this->tables = array('GenericProfiles' => array('GP_LastName', 'GP_FirstName', 'GP_Email'), 'MemberProfiles' => array('MP_GenericProfileId', 'MP_Section'), $oRef->getDataTableName() => array('R_TypeRef'), $oRef->getIndexTableName() => array('RI_Value')); $this->fields = array('section' => array('width' => '250px'), 'CI_Name' => 'CI_Name', 'SI_Name' => 'SI_Name'); $this->fields = array_merge($this->fields, $profile->getDataColumns(), $member->getDataColumns(), $oAddr->getDataColumns(), $oAddr->getIndexColumns(), $oParent->getDataColumns(), $oRef->getIndexColumns()); unset($this->fields[$oRef->getDataId()]); unset($this->fields[$member->getDataId()]); unset($this->fields[$profile->getDataId()]); unset($this->fields['PP_AssuSocNum']); $this->filters = array(); parent::toExcelAction(); }