public function commissionAction() { $request = $this->getRequest(); $commissionselection = new Connect_Form_Commission(); $this->view->commissionselection = $commissionselection; if ($request->isPost()) { $formdata = $request->getPost(); $commissionselection->populate($formdata); if ($commissionselection->isValid($formdata)) { $startdate = new Zend_Date('01/' . $commissionselection->getElement('commission_startmonth')->getValue() . '/' . $commissionselection->getElement('commission_startyear')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); $enddate = new Zend_Date('01/' . $commissionselection->getElement('commission_endmonth')->getValue() . '/' . $commissionselection->getElement('commission_endyear')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); // Move end date forward one month and back one day to get to the last day of the month $enddate->add(1, Zend_Date::MONTH); $enddate->sub(1, Zend_Date::DAY); $report = new Datasource_Connect_Mi_InsuranceSales(); $this->view->reportdata = $report->commissionForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->headLink()->appendStylesheet('/assets/connect/css/print.css', 'print'); $this->render('commission_report'); } } }