public function pdftransactionAction() { $app = $this->view->baseUrl(); $word = explode('/', $app); $projname = $word[1]; $Date = $this->_request->getParam('field1'); $branch = $this->_request->getParam('field2'); $officer = $this->_request->getParam('field3'); $resulttitle = $this->_request->getParam('result'); $branchname = new Overduelist_Model_Overduelist(); $dateconvertor = new App_Model_dateConvertor(); $this->view->date1 = $dateconvertor->normalformat($Date); $this->view->field1 = $Date; $result = $branchname->getbanknames($branch); $this->view->val = 10; $bankname = $branchname->getbanknames($branch); foreach ($bankname as $bankname1) { $this->view->bankname = $bankname1['name']; } $officename = $branchname->getofficername($officer); foreach ($officename as $officename1) { $this->view->officername = $officename1['name']; } $pdf = new Zend_Pdf(); $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); $pdf->pages[] = $page; // Image $image_name = "/var/www/" . $projname . "/public/images/logo.jpg"; $image = Zend_Pdf_Image::imageWithPath($image_name); //$page->drawImage($image, 25, 770, 570, 820); $page->drawImage($image, 30, 770, 130, 820); $page->setLineWidth(1)->drawLine(25, 25, 570, 25); //bottom horizontal $page->setLineWidth(1)->drawLine(25, 25, 25, 820); //left vertical $page->setLineWidth(1)->drawLine(570, 25, 570, 820); //right vertical $page->setLineWidth(1)->drawLine(570, 820, 25, 820); //top horizontal //set the font $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $text = array("Over due list", "Account Number", "Number of overdue", "Age(in days)", "OverDue Amount", "Total", "Outstanding Balance", "From Date:", "To Date:", "There is not Outstanding Balance in between two dates"); $x1 = 80; $x2 = 250; $x3 = 220; $x4 = 320; $x6 = 450; $y1 = 700; $page->drawLine(50, 740, 550, 740); $page->drawLine(50, 720, 550, 720); $page->drawText($text[0], $x2, 770); $page->drawText($text[1], $x1, 725); $page->drawText($text[2], $x3, 725); $page->drawText($text[3], $x4, 725); if ($this->view->officername) { $page->drawText("Loan officer: " . $this->view->officername, $x6, 745); } if ($this->view->bankname) { $page->drawText("Bank: " . $this->view->bankname, $x6, 755); } $page->drawText("As of " . $this->view->date1, $x6, 765); $page->drawText("Amount in Rs", $x1, 745); $page->drawText($text[4], $x6, 725); $arrayLoan = $branchname->search($Date, $branch, $officer); $this->view->loanView = $arrayLoan; $outstanding_amount = "0"; foreach ($arrayLoan as $loanduelist) { $outstanding_amount += $loanduelist['overdue']; $page->drawText($loanduelist['account_number'], $x1, $y1); $pos = $dateconvertor->position($loanduelist['totalinstallments'], $x4 - 20); $page->drawText($loanduelist['totalinstallments'], $pos + 2, $y1); $pos = $dateconvertor->position($dateconvertor->dateDiff($loanduelist['installment_date'], $Date), $x6 - 70); $page->drawText($dateconvertor->dateDiff($loanduelist['installment_date'], $Date), $pos + 2, $y1); $pos = $dateconvertor->position(sprintf("%4.2f", $loanduelist['overdue']), 540); $page->drawText(sprintf("%4.2f", $loanduelist['overdue']), $pos + 2, $y1); //$page->drawText($loanduelist['overdue'],$x6, $y1); $y1 -= 15; } $page->drawLine(50, $y1, 550, $y1); $y2 = $y1 - 10; $page->drawText($text[5], $x1, $y2); $pos = $dateconvertor->position(sprintf("%4.2f", $outstanding_amount), 540); $page->drawText(sprintf("%4.2f", $outstanding_amount), $pos + 2, $y1 - 10); // $page->drawText($outstanding_amount, $x6, $y2); $y3 = $y2 - 5; $page->drawLine(50, $y3, 550, $y3); $pdfData = $pdf->render(); $pdf->save('/var/www/' . $projname . '/reports/overduelist.pdf'); $path = '/var/www/' . $projname . '/reports/overduelist.pdf'; chmod($path, 0777); //$this->_redirect('/reports/loandue'); }