public function exportToExcelAction() { $params = $this->getRequest()->getParams(); if (!empty($params['name'])) { $params['name'] = '%' . $params['name'] . '%'; } $query = PaymentTermQuery::create()->filter($params)->find(); $columnsWidth = array('mini', 'medium', 'biggest', 'small'); $headers = array('ID', 'Name', 'Description', 'Status'); foreach ($query as $key => $object) { $events = PaymentTermQuery::create()->whereAdd('PaymentTerm.' . PaymentTerm::ID_PAYMENT_TERM, $object->getIdPaymentTerm())->addColumns(array('PaymentTerm2Event.percent', 'Event.name'))->innerJoinEvent()->fetchAll(); $paymentTermEvent = ''; foreach ($events as $event) { $paymentTermEvent .= $event['name'] . '-' . $event['percent'] . "% \r"; } $content[$key][] = $object->getIdPaymentTerm(); $content[$key][] = utf8_encode($object->getName()); $content[$key][] = $paymentTermEvent; $content[$key][] = $object->getStatusName(); } $title = $this->i18n->_('Payment Terms Report'); $filename = 'payment_terms_report'; $report = new SimpleListReport(); $report->setTableHeaders($headers); $report->setTableContent($content); $report->setTableTitle($title); $report->setFilename($filename); $report->setTableColumnsWidth($columnsWidth); $report->createSpreadsheet(); }
/** * */ public function exportToExcelAction() { $post = $this->getRequest()->getParams(); $post['id_transit'] = "%" . $post['id_transit'] . "%"; $freightFares = FreightFareQuery::create()->filter($post)->find(); $i = 1; while ($freightFare = $freightFares->read()) { $port = \Application\Query\PortCustomQuery::create()->whereAdd(PortCustom::ID_PORT_CUSTOM, $freightFare->getFobPort())->findOne(); $destination = \Application\Query\PortCustomQuery::create()->whereAdd(PortCustom::ID_PORT_CUSTOM, $freightFare->getDestinationPort())->findOne(); $freightTYpe = FreightTypeQuery::create()->whereAdd(FreightType::ID_FREIGHT_TYPE, $freightFare->getIdFreightType())->findOne(); $forwarder = ForwarderQuery::create()->whereAdd(Forwarder::ID_FORWARDER, $freightFare->getIdForwarder())->findOne(); $currency = \Application\Query\CurrencyQuery::create()->whereAdd(\Application\Model\Bean\Currency::CURRCODE, $freightFare->getIdCurrency())->findOne(); $data[$i] = array($freightFare->getIdFreightFare(), $freightFare->getIdTransit(), $port->getName(), $destination->getName(), $freightTYpe->getName(), $freightFare->getNotes(), $freightFare->getTt(), $freightFare->getFrecuency(), $forwarder->getName(), $freightFare->getGoodThrough(), $freightFare->getUnitName(), $freightFare->getUNitCost(), $freightFare->getPeak(), $freightFare->getStatusName()); $i++; } $header = array($this->i18n->_('ID'), $this->i18n->_('ID-Transit'), $this->i18n->_('FOB Port'), $this->i18n->_('Destination Port'), $this->i18n->_('Freight Type'), $this->i18n->_('Notes'), $this->i18n->_('Transit Time'), $this->i18n->_('Frecuency'), $this->i18n->_('Forwarder'), $this->i18n->_('Good Through'), $this->i18n->_('Unit'), $this->i18n->_('Unit Cost'), $this->i18n->_('Peak/Unit'), $this->i18n->_('Status')); $title = $this->i18n->_('Freight Fares Report'); $fileName = $this->i18n->_('Freight_fares_report'); $tableColumnsWidth = array('mini', 'medium', 'medium', 'medium', 'medium', 'medium', 'medium', 'medium', 'medium', 'medium', 'mini', 'mini', 'mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); }
/** * * Enter description here ... */ public function exportToExcelAction() { $post = $this->getRequest()->getParams(); $brands = BrandQuery::create()->filter($post)->find(); if (!$brands->isEmpty()) { $i = 1; while ($brand = $brands->read()) { $data[$i] = array($brand->getCode(), $brand->getName(), $brand->getDataSource(), $brand->getUserSign()); $i++; } $header = array($this->i18n->_('Code'), $this->i18n->_('Name'), $this->i18n->_('DataSource'), $this->i18n->_('UserSign')); $title = $this->i18n->_('Brands Report'); $fileName = $this->i18n->_('Brands_report'); $tableColumnsWidth = array('mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); } else { $filter = $this->createFilterForUrl($post); $this->setFlash("error", $this->i18n->_('No records')); $this->_redirect('brand/list'); } }
/** * */ public function exportToExcelAction() { $params = $this->getRequest()->getParams(); $customsCodes = CustomsTariffCodeQuery::create()->filter($params)->find(); //die(print_r($post)); if (!$customsCodes->isEmpty()) { $i = 1; while ($customsCode = $customsCodes->read()) { $data[$i] = array($customsCode->getCode(), $customsCode->getName(), $customsCode->getPercent(), $customsCode->getStatusName()); $i++; } $header = array($this->i18n->_('Code'), $this->i18n->_('Description'), $this->i18n->_('Percent'), $this->i18n->_('Status')); $title = $this->i18n->_('Custom Codes'); $fileName = $this->i18n->_('Custom Codes Report'); $tableColumnsWidth = array('mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); } else { $filter = $this->createFilterForUrl($post); $this->setFlash("error", $this->i18n->_('No records')); $this->_redirect('customs-tariff-code/list'); } }
/** * * Enter description here ... */ public function exportToExcelAction() { $post['id_product_group'] = urldecode($this->getRequest()->getParam('id_product_group')); $post['id_family'] = urldecode($this->getRequest()->getParam('id_family')); $post['status'] = $this->getRequest()->getParam('status'); $families = FamilyQuery::create()->filter($post)->find(); if (!$families->isEmpty()) { $i = 1; while ($family = $families->read()) { if (ProductGroupQuery::create()->whereAdd(ProductGroup::ID_PRODUCT_GROUP, $family->getIdProductGroup())->count()) { $productGroup = ProductGroupQuery::create()->whereAdd(ProductGroup::ID_PRODUCT_GROUP, $family->getIdProductGroup())->findOne(); } else { $productGroup = new ProductGroup(); } $data[$i] = array($productGroup->getCode() . '-' . $productGroup->getName(), $family->getName(), $family->getCode(), $family->getStatusName()); $i++; } $header = array($this->i18n->_('Product Group'), $this->i18n->_('Family'), $this->i18n->_('Code'), $this->i18n->_('Status')); $title = $this->i18n->_('Family Report'); $fileName = $this->i18n->_('Family_report'); $tableColumnsWidth = array('medium', 'medium', 'mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); } else { $filter = $this->createFilterForUrl($post); $this->setFlash("error", $this->i18n->_('No records')); $this->_redirect('family/list'); } }
/** * */ public function exportToExcelAction() { $post['status'] = $this->getRequest()->getParam('status'); $post['name'] = "%" . utf8_decode($this->getRequest()->getParam('name')) . "%"; $forwarders = ForwarderQuery::create()->filter($post)->find(); if (!$forwarders->isEmpty()) { $i = 1; while ($forwarder = $forwarders->read()) { $data[$i] = array($forwarder->getIdForwarder(), $forwarder->getName(), $forwarder->getStatusName()); $i++; } $header = array($this->i18n->_('ID'), $this->i18n->_('Name'), $this->i18n->_('Status')); $title = $this->i18n->_('Forwarders Report'); $fileName = $this->i18n->_('Forwarders_report'); $tableColumnsWidth = array('mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); } else { $filter = $this->createFilterForUrl($post); $this->setFlash("warning", $this->i18n->_('No records were found')); $this->_redirect('forwarder/list'); } }
/** * */ public function exportToExcelAction() { $params = $this->getRequest()->getParams(); if (!empty($params['name'])) { $params['name'] = '%' . $params['name'] . '%'; } $query = WarehouseQuery::create()->filter($params)->find(); $report = new SimpleListReport(); $columnsWidth = array('', 'biggest', ''); $headers = array('ID', 'Name', 'Status'); foreach ($query as $key => $object) { $content[$key][] = $object->getIdWarehouse(); $content[$key][] = utf8_encode($object->getName()); $content[$key][] = $object->getStatusName(); } $title = $this->i18n->_('Warehouses Report'); $filename = 'warehouses_report'; $report->setTableHeaders($headers); $report->setTableContent($content); $report->setTableTitle($title); $report->setFilename($filename); $report->setTableColumnsWidth($columnsWidth); $report->createSpreadsheet(); }
public function exportToExcelPendingProductAction() { $post['id_product_group'] = urldecode($this->getRequest()->getParam('id_product_group')); $post['reference'] = urldecode($this->getRequest()->getParam('reference')); $post['status'] = $this->getRequest()->getParam('status'); $npdsheets = NpdSheetQuery::create()->filter($post)->addDescendingOrderBy(NpdSheet::ID_NPD_SHEET)->whereAdd(NpdSheet::STATUS, NpdSheet::$Status['Pending Product'])->find(); if (!$npdsheets->isEmpty()) { $i = 1; while ($npdsheet = $npdsheets->read()) { $productGroup = ProductGroupQuery::create()->whereAdd(ProductGroup::ID_PRODUCT_GROUP, $npdsheet->getIdProductGroup())->findOne(); $family = FamilyQuery::create()->whereAdd(Family::ID_FAMILY, $npdsheet->getIdFamily())->findOne(); $subfamily = SubfamilyQuery::create()->whereAdd(Subfamily::ID_SUBFAMILY, $npdsheet->getIdSubfamily())->findOne(); $npdSupplier = NpdSheetSupplierQuery::create()->innerJoinNpdSheet()->whereAdd('NpdSheetSupplier.id_npd_sheet', $npdsheet->getIdNpdSheet())->find()->getPrimaryKeys(); if ($npdSupplier) { $authorizedPrice = SupplierBudgetQuery::create()->innerJoinNpdSheetSupplier()->whereAdd('SupplierBudget.id_npd_supplier', $npdSupplier, Criteria::IN)->whereAdd('SupplierBudget.is_authorized', 1)->findOne(); } if (!$authorizedPrice) { $authorizedPrice = new SupplierBudget(); } if (NpdSheetSupplierQuery::create()->whereAdd(NpdSheetSupplier::ID_NPD_SUPPLIER, $authorizedPrice->getIdNpdSupplier())->count()) { $npdSupplier = NpdSheetSupplierQuery::create()->whereAdd(NpdSheetSupplier::ID_NPD_SUPPLIER, $authorizedPrice->getIdNpdSupplier())->findOne(); } else { $npdSupplier = null; } if ($npdSupplier) { if (SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $npdSupplier->getIdSupplier())->count()) { $supplier = SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $npdSupplier->getIdSupplier())->findOne()->getSupplierCardCodeWithCardName(); } } $data[$i] = array($npdsheet->getIdNpdSheet(), $npdsheet->getStatusName(), $npdsheet->getReference(), $npdsheet->getCreationDateAsZendDate()->get('YYYY-MM-dd'), $productGroup->getCode() . '-' . $productGroup->getName(), $family->getCode() . '-' . $family->getName(), $subfamily ? $subfamily->getCode() . '-' . $subfamily->getName() : $this->i18n->_('Not Available'), $npdsheet->getName(), $npdsheet->getPrice(), $authorizedPrice->getPrice(), $supplier ? $supplier : null); $i++; } $header = array($this->i18n->_('ID'), $this->i18n->_('Status'), $this->i18n->_('Reference'), $this->i18n->_('Creation date'), $this->i18n->_('Product Group'), $this->i18n->_('Family'), $this->i18n->_('Subfamily'), $this->i18n->_('Product'), $this->i18n->_('Target Price'), $this->i18n->_('Authorized Price'), $this->i18n->_('Prefered Supplier')); $title = $this->i18n->_('NPDs Report'); $fileName = $this->i18n->_('Npds_report'); $tableColumnsWidth = array('mini'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($data); $report->setFilename($fileName); $report->setTableColumnsWidth($tableColumnsWidth); $report->createSpreadsheet(); } else { $filter = $this->createFilterForUrl($post); $this->setFlash("warning", $this->i18n->_('No records found')); $this->_redirect('npd-sheet/pending-product'); } }
/** * */ public function exportToExcelSentSamplesAction() { $params = $this->getRequest()->getParams(); $sampleShipmentQuery = SampleShipmentQuery::create()->addDescendingOrderBy(SampleShipment::ID_SAMPLE_SHIPMENT)->filter($params)->find(); $i = 1; while ($sampleShipment = $sampleShipmentQuery->read()) { $content[$i] = array('Guide', $sampleShipment->getGuide(), '', '', '', '', ''); $i++; $content[$i] = array('Courier', $sampleShipment->getCourier(), '', '', '', '', ''); $i++; $content[$i] = array('Shipment Date', $sampleShipment->getShipmentDate(), '', '', '', '', ''); $i++; $content[$i] = array('Notes', $sampleShipment->getNote(), '', '', '', '', ''); $i++; $content[$i] = array('', '', '', '', '', '', ''); $i++; $content[$i] = array('Id Npd Sheet', 'Description', 'Supplier', 'Color', 'Quantity', 'Cost', 'Ammount'); $i++; $sampleQuery = SampleQuery::create()->whereAdd(Sample::ID_SAMPLE_SHIPMENT, $sampleShipment->getIdSampleShipment())->find(); while ($sample = $sampleQuery->read()) { $npd = NpdSheetQuery::create()->findByPK($sample->getIdNpdSheet()); if (ColorQuery::create()->whereAdd(Color::ID_COLOR, $sample->getIdColor())->count()) { $color = ColorQuery::create()->findByPK($sample->getIdColor()); } else { $color = new Color(); $color->setName('Any'); } $content[$i] = array($sample->getIdNpdSheet(), $npd->getDescription(), $sample->getIdSupplier(), $color->getName(), $sample->getQuantity(), '$' . number_format($sample->getCost(), 4) . $npd->getIdCurrency(), '$' . number_format($sample->getTotalAmmount(), 4) . $npd->getIdCurrency()); $i++; } $content[$i] = array('', '', '', '', '', 'Total', '$' . number_format($sampleQuery->getTotalAmmount(), 4) . $npd->getIdCurrency()); $i++; $content[$i] = array('', '', '', '', '', '', ''); $i++; $content[$i] = array('', '', '', '', '', '', ''); $i++; } $header = array('', '', '', '', '', '', ''); $tableColumnsWidth = array('small', 'medium', 'small', 'small', 'small', 'medium', 'medium'); // $content $title = $this->i18n->_('Sent Samples Report'); $fileName = $this->i18n->_('sent_samples_report'); $report = new SimpleListReport(); $report->setTableTitle($title); $report->setTableHeaders($header); $report->setTableContent($content); $report->setTableColumnsWidth($tableColumnsWidth); $report->setFilename($fileName); $report->createSpreadsheet(); }