function admin_generate($qcId)
 {
     App::import('Model', 'QualifyingCirculation');
     $qualifyingCirculationObj = new QualifyingCirculation();
     $qcOptions = array('contain' => array('PrintingCenter', 'PrintingCenter.Membership'), 'conditions' => array('QualifyingCirculation.active' => 1, 'QualifyingCirculation.id' => $qcId));
     $qc = $qualifyingCirculationObj->find('first', $qcOptions);
     $pubId = $qc['PrintingCenter']['Membership']['publication_id'];
     $editionId = $qc['PrintingCenter']['Membership']['edition_id'];
     $regularPeriodId = $qc['QualifyingCirculation']['regular_period_id'];
     App::import('Model', 'Membership');
     $membershipObj = new Membership();
     $memOptions = array('contain' => array('PrintingCenter.id'), 'conditions' => array('Membership.active' => 1, 'Membership.publication_id' => $pubId, 'Membership.edition_id' => $editionId), 'fields' => array('Membership.id', 'Membership.certificate_group_id'));
     $members = $membershipObj->find('all', $memOptions);
     $printingCenterIds = Set::extract('/PrintingCenter/id', $members);
     $certificateGroups = Set::extract('/Membership/certificate_group_id', $members);
     if (!empty($certificateGroups[0])) {
         $membershipObj = new Membership();
         $memOptions = array('contain' => array('PrintingCenter.id'), 'conditions' => array('Membership.active' => 1, 'Membership.certificate_group_id' => $certificateGroups), 'fields' => array('Membership.id'));
         $members = $membershipObj->find('all', $memOptions);
         $printingCenterIds = Set::extract('/PrintingCenter/id', $members);
     }
     $qualifyingCirculationObj = new QualifyingCirculation();
     // qualifying_circulation_status_id needs to be in Under Consideration, Approved 1, Approved 2, Approved 3, Certified
     $qcOptions = array('contain' => array('NonQualifyingCirculation', 'PrintingCenter', 'PrintingCenter.Membership', 'PrintingCenter.Membership', 'Combo', 'CoverPrice'), 'conditions' => array('QualifyingCirculation.active' => 1, 'QualifyingCirculation.regular_period_id' => $regularPeriodId, 'QualifyingCirculation.printing_center_id' => $printingCenterIds, 'QualifyingCirculation.qualifying_circulation_status_id' => array(3, 4, 5, 6, 11)));
     $allQC = $qualifyingCirculationObj->find('all', $qcOptions);
     $publicationIds = Set::extract('/PrintingCenter/Membership/publication_id', $allQC);
     $this->data['OutgoingCertificate']['publication_id'] = $publicationIds[0];
     $languageIds = Set::extract('/PrintingCenter/Membership/language_id', $allQC);
     $this->data['OutgoingCertificate']['language_id'] = $languageIds[0];
     $frequencyTypeIds = Set::extract('/PrintingCenter/Membership/frequency_type_id', $allQC);
     $this->data['OutgoingCertificate']['frequency_type_id'] = $frequencyTypeIds[0];
     $this->data['OutgoingCertificate']['regular_period_id'] = $regularPeriodId;
     App::import('Model', 'HoldingCompany');
     $objHoldingCompany = new HoldingCompany();
     $qcHC = array('conditions' => array('HoldingCompany.active' => 1, 'HoldingCompany.membership_id' => $allQC[0]['PrintingCenter']['Membership']['id']));
     $holdingCompany = $objHoldingCompany->find('first', $qcHC);
     $this->data['OutgoingCertificate']['address'] = $holdingCompany['Address']['address_line_1'] . ' ' . $holdingCompany['Address']['address_line_2'] . ', ' . $holdingCompany['City']['city_name'] . ', ' . $holdingCompany['District']['district_name'] . ', ' . $holdingCompany['State']['state_name'] . ' - ' . $holdingCompany['Address']['pin'];
     $this->data['OutgoingCertificate']['published_printed'] = '';
     // pending
     $this->data['OutgoingCertificate']['single_copy'] = implode(', ', Set::extract('/QualifyingCirculation/single_copy', $allQC));
     $this->data['OutgoingCertificate']['auditors'] = '';
     // pending
     $this->data['OutgoingCertificate']['previous_1_regular_period_id'] = $regularPeriodId - 1;
     $this->data['OutgoingCertificate']['previous_2_regular_period_id'] = $regularPeriodId - 2;
     $this->data['OutgoingCertificate']['combo_copy'] = implode(', ', Set::extract('/QualifyingCirculation/combo_copy', $allQC));
     $this->data['OutgoingCertificate']['total_qualifying_sales'] = array_sum(Set::extract('/QualifyingCirculation/total_monthly_qualifying_circulation', $allQC));
     $this->data['OutgoingCertificate']['total_number_of_publishing_days'] = array_sum(Set::extract('/QualifyingCirculation/total_number_of_publishing_days', $allQC));
     $this->data['OutgoingCertificate']['average_total_qualifying_sales'] = array_sum(Set::extract('/QualifyingCirculation/total_ss_sa_average_monthly_qualifying_circulation_1', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_single_copy_sales'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_single_copy_sales', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_combo_sales_copies'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_combo_sales_copies', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_single_copy_subscription'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_single_copy_subscription', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_joint_subscription_copies'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_joint_subscription_copies', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_institutional_subscription_copies'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_institutional_subscription_copies', $allQC));
     $this->data['OutgoingCertificate']['ss_sa_institutional_sale_copies'] = array_sum(Set::extract('/QualifyingCirculation/ss_sa_institutional_sale_copies', $allQC));
     $this->data['OutgoingCertificate']['total_ss_sa_average_monthly_qualifying_circulation_1'] = array_sum(Set::extract('/QualifyingCirculation/total_ss_sa_average_monthly_qualifying_circulation_1', $allQC));
     $this->data['OutgoingCertificate']['date_issue'] = date('d-m-Y');
     $this->data['OutgoingCertificate']['single_nnr_10'] = array_sum(Set::extract('/QualifyingCirculation/single_nnr_10', $allQC));
     $this->data['OutgoingCertificate']['single_nnr_20'] = array_sum(Set::extract('/QualifyingCirculation/single_nnr_20', $allQC));
     $this->data['OutgoingCertificate']['single_nnr_100'] = array_sum(Set::extract('/QualifyingCirculation/single_nnr_100', $allQC));
     $this->data['OutgoingCertificate']['single_nnr_below_nnr_within_qualifying'] = array_sum(Set::extract('/QualifyingCirculation/single_nnr_below_nnr_within_qualifying', $allQC));
     $this->data['OutgoingCertificate']['combo_nnr_10'] = array_sum(Set::extract('/QualifyingCirculation/combo_nnr_10', $allQC));
     $this->data['OutgoingCertificate']['combo_nnr_20'] = array_sum(Set::extract('/QualifyingCirculation/combo_nnr_20', $allQC));
     $this->data['OutgoingCertificate']['combo_nnr_100'] = array_sum(Set::extract('/QualifyingCirculation/combo_nnr_100', $allQC));
     $this->data['OutgoingCertificate']['combo_nnr_below_nnr_within_qualifying'] = array_sum(Set::extract('/QualifyingCirculation/combo_nnr_below_nnr_within_qualifying', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_single_nil'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_single_nil', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_single_50'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_single_50', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_single_100'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_single_100', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_combo_nil'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_combo_nil', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_combo_50'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_combo_50', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_combo_100'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_combo_100', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_instn_nil'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_instn_nil', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_instn_50'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_instn_50', $allQC));
     $this->data['OutgoingCertificate']['nss_incentive_instn_100'] = array_sum(Set::extract('/QualifyingCirculation/nss_incentive_instn_100', $allQC));
     $this->data['OutgoingCertificate']['instn_airlines'] = array_sum(Set::extract('/QualifyingCirculation/instn_airlines', $allQC));
     $this->data['OutgoingCertificate']['instn_body_corporates'] = array_sum(Set::extract('/QualifyingCirculation/instn_body_corporates', $allQC));
     $this->data['OutgoingCertificate']['instn_edu_inst'] = array_sum(Set::extract('/QualifyingCirculation/instn_edu_inst', $allQC));
     $this->data['OutgoingCertificate']['instn_hotels'] = array_sum(Set::extract('/QualifyingCirculation/instn_hotels', $allQC));
     $this->data['OutgoingCertificate']['instn_libraries'] = array_sum(Set::extract('/QualifyingCirculation/instn_libraries', $allQC));
     $this->data['OutgoingCertificate']['instn_others'] = array_sum(Set::extract('/QualifyingCirculation/instn_others', $allQC));
     $this->data['OutgoingCertificate']['total_corporates_average_monthly_qualifying_circulation'] = array_sum(Set::extract('/QualifyingCirculation/total_corporates_average_monthly_qualifying_circulation', $allQC));
     $this->data['OutgoingCertificate']['single_non_qualifying_sales_other_than_nnr'] = array_sum(Set::extract('/NonQualifyingCirculation/single_non_qualifying_sales_other_than_nnr', $allQC));
     $this->data['OutgoingCertificate']['combo_non_qualifying_sales_other_than_nnr'] = array_sum(Set::extract('/NonQualifyingCirculation/combo_non_qualifying_sales_other_than_nnr', $allQC));
     $this->data['OutgoingCertificate']['subscription_non_qualifying_sales_other_than_nnr'] = array_sum(Set::extract('/NonQualifyingCirculation/subscription_non_qualifying_sales_other_than_nnr', $allQC));
     $this->data['OutgoingCertificate']['institutional_non_qualifying_sales_other_than_nnr'] = array_sum(Set::extract('/NonQualifyingCirculation/institutional_non_qualifying_sales_other_than_nnr', $allQC));
     $this->data['OutgoingCertificate']['single_single_copy_sales'] = array_sum(Set::extract('/NonQualifyingCirculation/single_single_copy_sales', $allQC));
     $this->data['OutgoingCertificate']['combo_combo_sales_copies'] = array_sum(Set::extract('/NonQualifyingCirculation/combo_combo_sales_copies', $allQC));
     $this->data['OutgoingCertificate']['subscription_single_copy_subscription'] = array_sum(Set::extract('/NonQualifyingCirculation/subscription_single_copy_subscription', $allQC));
     $this->data['OutgoingCertificate']['subscription_joint_subscription_copies'] = array_sum(Set::extract('/NonQualifyingCirculation/subscription_joint_subscription_copies', $allQC));
     $this->data['OutgoingCertificate']['institutional_institutional_subscription_copies'] = array_sum(Set::extract('/NonQualifyingCirculation/institutional_institutional_subscription_copies', $allQC));
     $this->data['OutgoingCertificate']['institutional_institutional_sale_copies'] = array_sum(Set::extract('/NonQualifyingCirculation/institutional_institutional_sale_copies', $allQC));
     $this->data['OutgoingCertificate']['free_copies_free_copies'] = array_sum(Set::extract('/NonQualifyingCirculation/free_copies_free_copies', $allQC));
     debug($this->OutgoingCertificate->invalidFields());
     $this->OutgoingCertificate->save($this->data);
     $outgoingCertificateId = $this->OutgoingCertificate->getInsertID();
     foreach ($allQC as $k => $qcForm) {
         $data = array();
         $data['OutgoingCertificateDetail']['id'] = null;
         $data['OutgoingCertificateDetail']['outgoing_certificate_id'] = $outgoingCertificateId;
         $data['OutgoingCertificateDetail']['edition_id'] = $qcForm['PrintingCenter']['Membership']['edition_id'];
         $data['OutgoingCertificateDetail']['printing_center_id'] = $qcForm['PrintingCenter']['id'];
         $data['OutgoingCertificateDetail']['total_qualifying_sales'] = $qcForm['QualifyingCirculation']['total_monthly_qualifying_circulation'];
         $data['OutgoingCertificateDetail']['total_number_of_publishing_days'] = $qcForm['QualifyingCirculation']['total_number_of_publishing_days'];
         $data['OutgoingCertificateDetail']['average_total_qualifying_sales'] = $qcForm['QualifyingCirculation']['total_ss_sa_average_monthly_qualifying_circulation_1'];
         $this->OutgoingCertificate->OutgoingCertificateDetail->save($data);
         debug($this->OutgoingCertificate->OutgoingCertificateDetail->invalidFields());
         foreach ($qcForm['CoverPrice'] as $kCoverPrice => $CoverPriceDetails) {
             $dataCoverprices['OutgoingCertificateCoverprice']['id'] = null;
             $dataCoverprices['OutgoingCertificateCoverprice']['outgoing_certificate_id'] = $outgoingCertificateId;
             $dataCoverprices['OutgoingCertificateCoverprice']['edition_id'] = $qcForm['PrintingCenter']['Membership']['edition_id'];
             $dataCoverprices['OutgoingCertificateCoverprice']['printing_center_id'] = $qcForm['PrintingCenter']['id'];
             $dataCoverprices['OutgoingCertificateCoverprice']['cover_price_id'] = $CoverPriceDetails['id'];
             $dataCoverprices['OutgoingCertificateCoverprice']['no_of_publishing_days'] = $CoverPriceDetails['no_of_publishing_days'];
             $dataCoverprices['OutgoingCertificateCoverprice']['cover_price'] = $CoverPriceDetails['cover_price'];
             $dataCoverprices['OutgoingCertificateCoverprice']['total_copies'] = $CoverPriceDetails['total_copies'];
             $dataCoverprices['OutgoingCertificateCoverprice']['copies_per_publishing_day'] = $CoverPriceDetails['copies_per_publishing_day'];
             $dataCoverprices['OutgoingCertificateCoverprice']['single_combo_other_variant'] = $CoverPriceDetails['single_combo_other_variant'];
             $this->OutgoingCertificate->OutgoingCertificateCoverprice->save($dataCoverprices);
             debug($this->OutgoingCertificate->OutgoingCertificateCoverprice->invalidFields());
         }
         $dataCombo = array();
         foreach ($qcForm['Combo'] as $ck => $comboForm) {
             $comboName = trim($comboForm['combo_name']);
             $dataCombo[$comboName]['OutgoingCertificateCombo']['id'] = null;
             $dataCombo[$comboName]['OutgoingCertificateCombo']['combo_id'] = $comboForm['id'];
             $dataCombo[$comboName]['OutgoingCertificateCombo']['combo_name'] = $comboName;
             $dataCombo[$comboName]['OutgoingCertificateCombo']['outgoing_certificate_id'] = $outgoingCertificateId;
             $dataCombo[$comboName]['OutgoingCertificateCombo']['cover_price'] .= $comboForm['cover_price'] . ', ';
             $dataCombo[$comboName]['OutgoingCertificateCombo']['combo'] += $comboForm['combo'];
         }
     }
     foreach ($dataCombo as $combo_name => $comboDetails) {
         $comboDetails['OutgoingCertificateCombo']['cover_price'] = trim($comboDetails['OutgoingCertificateCombo']['cover_price']);
         $comboDetails['OutgoingCertificateCombo']['cover_price'] = substr($comboDetails['OutgoingCertificateCombo']['cover_price'], 0, strlen($comboDetails['OutgoingCertificateCombo']['cover_price']) - 1);
         $this->OutgoingCertificate->OutgoingCertificateCombo->save($comboDetails);
     }
     $resOutgoingCertificateCoverprice = $this->OutgoingCertificate->OutgoingCertificateCoverprice->find('all', array('contain' => array('Edition', 'PrintingCenter.PrintedAt'), 'conditions' => array('OutgoingCertificateCoverprice.outgoing_certificate_id' => $outgoingCertificateId)));
     $editionIds = array_unique(Set::extract('/Edition/id', $resOutgoingCertificateCoverprice));
     foreach ($editionIds as $k => $editionIdToBeSearched) {
         $edition = array_unique(Set::extract('/Edition[id=' . $editionIdToBeSearched . ']/city_name', $resOutgoingCertificateCoverprice));
         $printedAt = array_unique(Set::extract('/Edition[id=' . $editionIdToBeSearched . ']/../PrintingCenter/PrintedAt/city_name', $resOutgoingCertificateCoverprice));
         $editionDetails[] = $edition[0] . ' Edition Printed At ' . implode(', ', $printedAt);
     }
     //        $this->OutgoingCertificate->find('first', array('conditions' => array('OutgoingCertificate.id' => $outgoingCertificateId)))
     $this->data['OutgoingCertificate']['id'] = $outgoingCertificateId;
     $this->data['OutgoingCertificate']['published_printed'] = implode('; ', $editionDetails);
     $this->OutgoingCertificate->save($this->data);
     debug($this->OutgoingCertificate->invalidFields());
 }
 function client_print_for_approval()
 {
     $qualifying_circulation_id = $this->params['named']['qualifying_circulation_id'];
     $printing_centers = $this->Session->read('Auth.PrintingCenter');
     $printing_center_ids = Set::extract('/id', $printing_centers);
     App::import('Model', 'QualifyingCirculation');
     $QualifyingCirculation = new QualifyingCirculation();
     $options = array('conditions' => array('QualifyingCirculation.id' => $qualifying_circulation_id, 'QualifyingCirculation.printing_center_id' => $printing_center_ids));
     $qualifyingCirculation = $QualifyingCirculation->find('first', $options);
     App::import('Model', 'Address');
     $objAddress = new Address();
     $options = array('conditions' => array('Address.id' => $qualifyingCirculation['DuplicateCopy']['0']['address_id']));
     $addr = $objAddress->find('first', $options);
     $qualifyingCirculation['DuplicateCopy'][0]['Address'] = $addr['Address'];
     $qualifyingCirculation['DuplicateCopy'][0]['City'] = $addr['City'];
     $qualifyingCirculation['DuplicateCopy'][0]['State'] = $addr['State'];
     $qualifyingCirculation['DuplicateCopy'][0]['Zone'] = $addr['Zone'];
     $qualifyingCirculation['DuplicateCopy'][0]['Country'] = $addr['Country'];
     // Printing Center Details
     App::import('Model', 'PrintingCenter');
     $objPrintingCenter = new PrintingCenter();
     $optionsPrintingCenter = array('contain' => array('Address', 'Membership', 'PrintedAt', 'Membership.Publication', 'Membership.Edition'), 'conditions' => array('PrintingCenter.id' => $qualifyingCirculation['PrintingCenter']['id']));
     $printingCenter = $objPrintingCenter->find('first', $optionsPrintingCenter);
     unset($qualifyingCirculation['PrintingCenter']['PrintingCenter']);
     unset($qualifyingCirculation['PrintingCenter']['QualifyingCirculation']);
     unset($qualifyingCirculation['PrintingCenter']['CreatedBy']);
     unset($qualifyingCirculation['PrintingCenter']['ModifiedBy']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['User']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['Address']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['Proposer1Representative']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['Proposer2Representative']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['CreatedBy']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['ModifiedBy']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['MembershipPayment']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['PrintingCenter']);
     unset($qualifyingCirculation['PrintingCenter']['Membership']['Representative']);
     // HoldingCompany.Address
     App::import('Model', 'HoldingCompany');
     $objHoldingCompany = new HoldingCompany();
     $optionsHoldingCompany = array('contain' => array('Address'), 'conditions' => array('HoldingCompany.id' => $printingCenter['Membership']['HoldingCompany'][0]['id']));
     $holdingCompany = $objHoldingCompany->find('first', $optionsHoldingCompany);
     // PrintingCenterAuditorBranch
     App::import('Model', 'PrintingCenterAuditorBranch');
     $objPrintingCenterAuditorBranch = new PrintingCenterAuditorBranch();
     $optionsPrintingCenterAuditorBranch = array('contain' => array('AuditorBranch', 'AuditorBranch.AuditorFirm'), 'conditions' => array('PrintingCenterAuditorBranch.printing_center_id' => $printingCenter['PrintingCenter']['id'], 'PrintingCenterAuditorBranch.regular_period_id' => $qualifyingCirculation['QualifyingCirculation']['regular_period_id']));
     $printingCenterAuditorBranch = $objPrintingCenterAuditorBranch->find('first', $optionsPrintingCenterAuditorBranch);
     $options = array('conditions' => array('Address.id' => $printingCenterAuditorBranch['AuditorBranch']['Address']['id']), 'contain' => array('Country', 'Zone', 'State', 'District', 'City'));
     $addr = $objAddress->find('first', $options);
     $printingCenterAuditorBranch['AuditorBranch']['Address'] = $addr['Address'];
     $printingCenterAuditorBranch['AuditorBranch']['Address']['Country'] = $addr['Country'];
     $printingCenterAuditorBranch['AuditorBranch']['Address']['Zone'] = $addr['Zone'];
     $printingCenterAuditorBranch['AuditorBranch']['Address']['State'] = $addr['State'];
     $printingCenterAuditorBranch['AuditorBranch']['Address']['District'] = $addr['District'];
     $printingCenterAuditorBranch['AuditorBranch']['Address']['City'] = $addr['City'];
     App::import('Model', 'SaleType');
     App::import('Model', 'TradeTerm');
     $SaleType = new SaleType();
     $TradeTerm = new TradeTerm();
     $saleTypes = $SaleType->find('list');
     $subscriptionTypes = $TradeTerm->SubscriptionType->find('list');
     App::import('Model', 'City');
     $objCities = new City();
     $cities = $objCities->find('all', array('conditions' => array('City.id' => Set::extract('/city_id', $qualifyingCirculation['WhiteForm']))));
     $this->set(compact('saleTypes', 'subscriptionTypes', 'qualifyingCirculation', 'cities', 'printingCenter', 'holdingCompany', 'printingCenterAuditorBranch'));
 }
예제 #3
0
 function _getQcToNamed()
 {
     App::import('Model', 'QualifyingCirculation');
     $QualifyingCirculation = new QualifyingCirculation();
     $qc = $QualifyingCirculation->query("SELECT \n                                            QualifyingCirculation.id, QualifyingCirculation.printing_center_id, \n                                            QualifyingCirculation.regular_period_id, PrintingCenter.id, \n                                            PrintingCenter.printed_at_id, PrintedAt.city_name, PrintedAt.id, PrintingCenter.membership_id,\n                                            Publication.publication_name, Edition.city_name, Edition.id\n                                            FROM qualifying_circulations as `QualifyingCirculation` \n                                            LEFT JOIN printing_centers as `PrintingCenter` on QualifyingCirculation.printing_center_id = PrintingCenter.id \n                                            LEFT JOIN cities as `PrintedAt` on PrintingCenter.printed_at_id = PrintedAt.id \n                                            LEFT JOIN memberships as `Membership` on PrintingCenter.membership_id = Membership.id \n                                            LEFT JOIN cities as `Edition` on Membership.edition_id = Edition.id \n                                            LEFT JOIN publications as `Publication` on Membership.publication_id = Publication.id\n                                            ");
     foreach ($qc as $k => $v) {
         $qualifyingCirculations[$v['QualifyingCirculation']['id']] = "{$v['Publication']['publication_name']} - {$v['Edition']['city_name']} - {$v['PrintedAt']['city_name']} ({$v['QualifyingCirculation']['id']})";
     }
     return $qualifyingCirculations;
 }