Пример #1
0
 /**
  *
  * @return array
  */
 public function listAction()
 {
     $this->view->page = $page = $this->getRequest()->getParam('page') ?: 1;
     if ($this->getRequest()->isPost()) {
         $this->view->post = $post = $this->getRequest()->getParams();
     }
     $total = ContactQuery::create()->filter($post)->count();
     $this->view->contacts = $contacts = ContactQuery::create()->filter($post)->page($page, $this->getMaxPerPage())->find();
     $this->view->paginator = $this->createPaginator($total, $page);
     $this->view->people = \Application\Query\PersonQuery::create()->find()->toCombo();
     $this->view->companies = \Application\Query\CompanyQuery::create()->find()->toCombo();
 }
Пример #2
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'Forwarder')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_forwarder']) && !empty($fields['id_forwarder'])) {
         $criteria->add(Forwarder::ID_FORWARDER, $fields['id_forwarder']);
     }
     if (isset($fields['id_company']) && !empty($fields['id_company'])) {
         $criteria->add(Forwarder::ID_COMPANY, $fields['id_company']);
     }
     if (isset($fields['name']) && !empty($fields['name'])) {
         $criteria->add(Forwarder::NAME, $fields['name']);
     }
     if (isset($fields['last_fee']) && !empty($fields['last_fee'])) {
         $criteria->add(Forwarder::LAST_FEE, $fields['last_fee']);
     }
     if (isset($fields['status']) && !empty($fields['status'])) {
         $criteria->add(Forwarder::STATUS, $fields['status']);
     }
     $criteria->endPrefix();
 }
Пример #3
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'CustomsBroker')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_customs_broker']) && !empty($fields['id_customs_broker'])) {
         $criteria->add(CustomsBroker::ID_CUSTOMS_BROKER, $fields['id_customs_broker']);
     }
     if (isset($fields['id_company']) && !empty($fields['id_company'])) {
         $criteria->add(CustomsBroker::ID_COMPANY, $fields['id_company']);
     }
     if (isset($fields['id_last_fee_file']) && !empty($fields['id_last_fee_file'])) {
         $criteria->add(CustomsBroker::ID_LAST_FEE_FILE, $fields['id_last_fee_file']);
     }
     if (isset($fields['payment']) && !empty($fields['payment'])) {
         $criteria->add(CustomsBroker::PAYMENT, $fields['payment']);
     }
     if (isset($fields['status']) && !empty($fields['status'])) {
         $criteria->add(CustomsBroker::STATUS, $fields['status']);
     }
     $criteria->endPrefix();
 }
Пример #4
0
 /**
  *
  */
 public function exportToExcelAction()
 {
     $post['name'] = utf8_decode($this->getRequest()->getParam('name'));
     $post['name'] = '%' . $post['name'] . '%';
     $post['status'] = $this->getRequest()->getParam('status');
     $post['sap_id_bussiness_associate'] = $this->getRequest()->getParam('sap_id_bussiness_associate') . '%';
     $customsBrokers = CustomsBrokerQuery::create()->filter($post)->find();
     if (!$customsBrokers->isEmpty()) {
         $i = 1;
         while ($customsBroker = $customsBrokers->read()) {
             $address = AddressQuery::create()->innerJoinCompany()->whereAdd('Address2Company.id_company', $customsBroker->getIdCompany())->find()->getOne();
             $company = CompanyQuery::create()->innerJoinAddress()->whereAdd('Company2Address.id_company', $customsBroker->getIdCompany())->find()->getOne();
             $country = \Application\Query\CountryQuery::create()->whereAdd(\Application\Model\Bean\Country::CODE, $address->getCountry())->find()->getOne();
             $data[$i] = array($company->getSapIdBussinessassociate(), $customsBroker->getName(), $country ? $country->getName() : null, $address->getState(), $address->getStreet(), $address->getSettlement(), $address->getDistrict(), $address->getCity(), $address->getZipCode(), $customsBroker->getStatusName());
             $i++;
         }
         $header = array($this->i18n->_('SAP ID Business Associate'), $this->i18n->_('Name'), $this->i18n->_('Country'), $this->i18n->_('State'), $this->i18n->_('Street'), $this->i18n->_('Settlement'), $this->i18n->_('District'), $this->i18n->_('City'), $this->i18n->_('Zip Code'), $this->i18n->_('Status'));
         $title = $this->i18n->_('Customs Brokers Report');
         $filename = 'customs_brokers_report';
         $customsBrokersReport = new SimpleListReport();
         $customsBrokersReport->setTableHeaders($header);
         $customsBrokersReport->setTableContent($data);
         $customsBrokersReport->setTableTitle($title);
         $customsBrokersReport->setFilename($filename);
         $customsBrokersReport->createSpreadsheet();
     } else {
         $filter = $this->createFilterForUrl($post);
         $this->setFlash("error", $this->i18n->_('No records'));
         $this->_redirect('customs-broker/list');
     }
 }
Пример #5
0
 /**
  *
  */
 public function reactivateAction()
 {
     $id = $this->getRequest()->getParam('id');
     $company = CompanyQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Company with id {$id}"));
     try {
         $this->getCompanyCatalog()->beginTransaction();
         $company->setStatus(Company::$Status['Active']);
         $this->getCompanyCatalog()->update($company);
         $this->getCompanyCatalog()->commit();
         $this->setFlash('ok', $this->i18n->_("Se reactivo correctamente el Company"));
     } catch (Exception $e) {
         $this->getCompanyCatalog()->rollBack();
         $this->setFlash('error', $this->i18n->_($e->getMessage()));
     }
     $this->_redirect('company/list');
 }
Пример #6
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'Supplier')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_supplier']) && !empty($fields['id_supplier'])) {
         $criteria->add(Supplier::ID_SUPPLIER, $fields['id_supplier']);
     }
     if (isset($fields['id_payment_term']) && !empty($fields['id_payment_term'])) {
         $criteria->add(Supplier::ID_PAYMENT_TERM, $fields['id_payment_term']);
     }
     if (isset($fields['id_default_port']) && !empty($fields['id_default_port'])) {
         $criteria->add(Supplier::ID_DEFAULT_PORT, $fields['id_default_port']);
     }
     if (isset($fields['id_company']) && !empty($fields['id_company'])) {
         $criteria->add(Supplier::ID_COMPANY, $fields['id_company']);
     }
     if (isset($fields['id_invoice_address']) && !empty($fields['id_invoice_address'])) {
         $criteria->add(Supplier::ID_INVOICE_ADDRESS, $fields['id_invoice_address']);
     }
     if (isset($fields['card_name']) && !empty($fields['card_name'])) {
         $criteria->add(Supplier::CARD_NAME, $fields['card_name']);
     }
     if (isset($fields['rfc']) && !empty($fields['rfc'])) {
         $criteria->add(Supplier::RFC, $fields['rfc']);
     }
     if (isset($fields['type_person']) && !empty($fields['type_person'])) {
         $criteria->add(Supplier::TYPE_PERSON, $fields['type_person']);
     }
     if (isset($fields['paydays']) && !empty($fields['paydays'])) {
         $criteria->add(Supplier::PAYDAYS, $fields['paydays']);
     }
     if (isset($fields['id_currency']) && !empty($fields['id_currency'])) {
         $criteria->add(Supplier::ID_CURRENCY, $fields['id_currency']);
     }
     if (isset($fields['id_final_grand_risk']) && !empty($fields['id_final_grand_risk'])) {
         $criteria->add(Supplier::ID_FINAL_GRAND_RISK, $fields['id_final_grand_risk']);
     }
     if (isset($fields['id_approval_status']) && !empty($fields['id_approval_status'])) {
         $criteria->add(Supplier::ID_APPROVAL_STATUS, $fields['id_approval_status']);
     }
     if (isset($fields['quality']) && !empty($fields['quality'])) {
         $criteria->add(Supplier::QUALITY, $fields['quality']);
     }
     if (isset($fields['consistency']) && !empty($fields['consistency'])) {
         $criteria->add(Supplier::CONSISTENCY, $fields['consistency']);
     }
     if (isset($fields['time']) && !empty($fields['time'])) {
         $criteria->add(Supplier::TIME, $fields['time']);
     }
     if (isset($fields['type_supplier']) && !empty($fields['type_supplier'])) {
         $criteria->add(Supplier::TYPE_SUPPLIER, $fields['type_supplier']);
     }
     $criteria->endPrefix();
 }