コード例 #1
0
ファイル: PLTransaction.php プロジェクト: uzerpllp/uzerp
 function getRemittance(&$_data = array(), &$model = array(), &$extra = array(), &$errors = array())
 {
     // load the model
     $supplier = DataObjectFactory::Factory('PLSupplier');
     $supplier->load($this->plmaster_id);
     $_data['email_subject'] = $supplier->name . ' Remittance ' . $this->transaction_date;
     $_data['filename'] = 'Remittance-' . $this->id;
     // get the payment method
     $plpayment = DataObjectFactory::Factory('PLPayment');
     $plpayment->load($this->cross_ref);
     // get the remittance list
     $pltransactions = new PLAllocationCollection(DataObjectFactory::Factory('PLAllocation'));
     $pltransactions->remittanceList($this->id);
     $model = array($supplier, $pltransactions);
     // set date
     // a bit messy nesting in so many functions
     $extra['date'] = un_fix_date(fix_date(date(DATE_FORMAT)));
     // set company name
     $company = DataObjectFactory::Factory('Company');
     $company->load(COMPANY_ID);
     $extra['company_name'] = $company->name;
     // set company address
     $company_address = array('name' => $company->name);
     $output = array();
     $parts = array("street1", "street2", "street3", "town", "county", "postcode", "country");
     $address = $company->getAddress();
     foreach ($parts as $part) {
         if (!is_null($address->{$part})) {
             $output[$part] = $address->{$part};
         }
     }
     $company_address += $output;
     $extra['company_address'] = $company_address;
     // set the company details
     $email = $company->getContactDetail('E', 'REMITTANCE');
     if (empty($email)) {
         $email = $company->getContactDetail('E');
     }
     $_data['replyto'] = $email;
     $extra['company_details'] = array('tel' => 'Tel: ' . $company->getContactDetail('T'), 'fax' => 'Fax: ' . $company->getContactDetail('F'), 'email' => 'Email: ' . $email, 'vat_number' => 'VAT Number: ' . $company->vatnumber, 'company_number' => 'Company Number: ' . $company->companynumber);
     // set supplier address
     $supplier_address = array('name' => $supplier->name);
     $output = array();
     $parts = array("street1", "street2", "street3", "town", "county", "postcode", "country");
     $address = $supplier->getBillingAddress();
     foreach ($parts as $part) {
         if (!is_null($address->{$part})) {
             $output[$part] = $address->{$part};
         }
     }
     $supplier_address += $output;
     $extra['supplier_address'] = $supplier_address;
     // set document details
     $document_reference = array();
     $document_reference[]['line'] = array('label' => 'Payment Date', 'value' => un_fix_date($this->transaction_date));
     $document_reference[]['line'] = array('label' => 'Payment Value', 'value' => bcmul($this->gross_value, -1, 2));
     $document_reference[]['line'] = array('label' => 'Currency', 'value' => $plpayment->currency);
     $document_reference[]['line'] = array('label' => 'Payment Method', 'value' => $plpayment->payment_type);
     $extra['document_reference'] = $document_reference;
 }
コード例 #2
0
 public function remittance_list()
 {
     $pltransactions = new PLAllocationCollection();
     $pltransactions->remittanceList($this->_data['id']);
     $this->view->set('pltrans', $pltransactions);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $this->sidebarIndex($sidebarlist);
     $this->sidebarAllPayments($sidebarlist);
     $sidebarlist['viewpayment'] = array('tag' => 'View Payment List', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $this->_data['payment_id']));
     $sidebar->addList('actions', $sidebarlist);
     $sidebarlist = array();
     $sidebarlist['reprint_remittance'] = array('tag' => 'Reprint Remittance', 'link' => array('modules' => $this->_modules, 'controller' => 'pltransactions', 'action' => 'printDialog', 'printaction' => 'print_single_remittance', 'filename' => 'remittance_' . fix_date(date(DATE_FORMAT)), 'id' => $this->_data['id']));
     $sidebar->addList('reports', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }