コード例 #1
0
 /**
  *
  * there must be a transaction opened
  *
  * @author joseluis
  * @param int $idWarehouseEntrance
  * @return \Application\Model\Bean\WarehouseEntranceClaimReport $claimReport
  */
 private function getClaimReport($idWarehouseEntry, $warehouseEntryLine)
 {
     if (WarehouseEntranceClaimReportQuery::create()->whereAdd(WarehouseEntranceClaimReport::ID_WAREHOUSE_ENTRANCE, $idWarehouseEntry)->whereAdd(WarehouseEntranceClaimReport::ID_WAREHOUSE_ENTRANCE_PRODUCT, $warehouseEntryLine)->count()) {
         $claimReport = WarehouseEntranceClaimReportQuery::create()->whereAdd(WarehouseEntranceClaimReport::ID_WAREHOUSE_ENTRANCE, $idWarehouseEntry)->whereAdd(WarehouseEntranceClaimReport::ID_WAREHOUSE_ENTRANCE_PRODUCT, $warehouseEntryLine)->findOne();
     } else {
         $claimReport = new WarehouseEntranceClaimReport();
         $claimReport->setClaimedAmount(0);
         $claimReport->setIdWarehouseEntrance($idWarehouseEntry);
         $claimReport->setIdWarehouseEntranceProduct($warehouseEntryLine);
         $this->getCatalog('WarehouseEntranceClaimReportCatalog')->create($claimReport);
     }
     return $claimReport;
 }
コード例 #2
0
 public function exportToExcelAction()
 {
     $report = new SimpleListReport();
     $params = $this->getRequest()->getParams();
     $params['description'] = '%' . $params['description'] . '%';
     $warehouseEntranceClaimReports = WarehouseEntranceClaimReportQuery::create()->whereAdd(WarehouseEntranceClaimReport::DESCRIPTION, null, WarehouseEntranceClaimReportQuery::IS_NOT_NULL)->orderBy(WarehouseEntranceClaimReport::ID_WAREHOUSE_ENTRANCE_QUARANTINE_CLAIM_REPORT, WarehouseEntranceClaimReportQuery::DESC)->filter($params)->find();
     $i = 0;
     $tableTitle = 'Claim Report Summary';
     $filename = 'claim_report';
     $tableHeaders = array('Id Claim Report', 'Invoice Number', 'Description', 'Claimed Amount', 'Final Amount', 'Status');
     while ($warehouseEntranceClaimReport = $warehouseEntranceClaimReports->read()) {
         $tableContent[$i][] = $warehouseEntranceClaimReport->getIdWarehouseEntranceQuarantineClaimReport();
         $tableContent[$i][] = $warehouseEntranceClaimReport->getInvoiceNumber();
         $tableContent[$i][] = $warehouseEntranceClaimReport->getDescription();
         $tableContent[$i][] = $warehouseEntranceClaimReport->getClaimedAmount() ? $warehouseEntranceClaimReport->getClaimedAmount() : 'N/S';
         $tableContent[$i][] = $warehouseEntranceClaimReport->getFinalAmount() ? $warehouseEntranceClaimReport->getFinalAmount() : 'N/S';
         $tableContent[$i][] = $warehouseEntranceClaimReport->getStatusName();
         $i++;
     }
     $report->setFilename($filename);
     $report->setTableContent($tableContent);
     $report->setTableHeaders($tableHeaders);
     $report->setTableTitle($tableTitle);
     $report->createSpreadsheet();
     die;
 }