コード例 #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 = PurchaseOrderFolioQuery::create()->filter($post)->count();
     $this->view->purchaseOrderFolios = $purchaseOrderFolios = PurchaseOrderFolioQuery::create()->filter($post)->page($page, $this->getMaxPerPage())->find();
     $this->view->paginator = $this->createPaginator($total, $page);
     $this->view->purchaseOrders = \Application\Query\PurchaseOrderQuery::create()->find()->toCombo();
     $this->view->files = \Application\Query\FileQuery::create()->find()->toCombo();
 }
コード例 #2
0
 /**
  *
  * @param int $id
  * @param int $status
  * @param bool $notLike
  * @return array $purchaseOrders
  */
 private function getPurchaseOrders($idFolioImport, $status = null, $in = true)
 {
     $id = $idFolioImport;
     if ($status == null) {
         $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->count();
         $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->find();
     } else {
         if ($in) {
             $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::IN)->count();
             $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::IN)->find();
         } else {
             $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::NOT_EQUAL)->count();
             $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $id)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::NOT_EQUAL)->find();
         }
     }
     if ($query) {
         $i = 0;
         while ($purchaseOrder = $purchaseOrderQuery->read()) {
             try {
                 $purchaseOrderEntryQuery = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->find();
                 $price = 0;
                 $cbm = 0;
                 $individual_packs = 0;
                 $cartons = 0;
                 $quantity = 0;
                 $weight = 0;
                 $valuable = array();
                 $j = 0;
                 $packingList = PurchaseOrderFileQuery::create()->whereAdd(PurchaseOrderFile::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->whereAdd(PurchaseOrderFile::DOCUMENT_TYPE, PurchaseOrderFile::$DocumentType['PackingList'])->count();
                 $commercialInvoice = PurchaseOrderFileQuery::create()->whereAdd(PurchaseOrderFile::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->whereAdd(PurchaseOrderFile::DOCUMENT_TYPE, PurchaseOrderFile::$DocumentType['CommercialInvoice'])->count();
                 if ($packingList) {
                     $purchaseOrders[$i]['packing_list'] = true;
                 } else {
                     $purchaseOrders[$i]['packing_list'] = false;
                 }
                 if ($commercialInvoice) {
                     $purchaseOrders[$i]['commercial_invoice'] = true;
                 } else {
                     $purchaseOrders[$i]['commercial_invoice'] = false;
                 }
                 while ($purchaseOrderEntry = $purchaseOrderEntryQuery->read()) {
                     $product = ProductQuery::create()->findByPK($purchaseOrderEntry->getIdProduct());
                     if ($product->getMcParts()) {
                         $cartonsEntry = ceil($purchaseOrderEntry->getQuantity() / $product->getMcParts());
                     } else {
                         $cartonsEntry = $this->i18n->_('Edit Master Carton Parts');
                     }
                     $volume = $product->getMcFront() * $product->getMcHeight() * $product->getMcDepth() / 1000000;
                     $cbm += $cartonsEntry * $volume;
                     $weight += $cartonsEntry * $product->getMcWeight();
                     $price += $purchaseOrderEntry->getQuantity() * $purchaseOrderEntry->getPrice();
                     $cartons += $cartonsEntry;
                     $quantity += $purchaseOrderEntry->getQuantity();
                     $entries[$j]['id_product'] = $product->getItemCode();
                     $entries[$j]['status'] = $this->getPurchaseOrderEntryStatus($purchaseOrderEntry->getStatus());
                     $entries[$j]['important'] = $product->getImportant();
                     $entries[$j]['item_code'] = $product->getItemCode();
                     $entries[$j]['product'] = $product->getItemName();
                     $entries[$j]['price'] = $purchaseOrderEntry->getPrice();
                     $entries[$j]['amount'] = $purchaseOrderEntry->getAmount();
                     $entries[$j]['cartons'] = $cartonsEntry;
                     $entries[$j]['quantity'] = $purchaseOrderEntry->getQuantity();
                     $entries[$j]['weight'] = $product->getMcWeight() * $cartonsEntry;
                     $entries[$j]['volume'] = number_format($volume * $cartonsEntry, 2);
                     if (FreightFareQuery::create()->whereAdd(FreightFare::ID_FREIGHT_FARE, $product->getDefaultFreightFare())->count()) {
                         $idFreightType = FreightFareQuery::create()->findByPK($product->getDefaultFreightFare())->getIdFreightType();
                         $entries[$j]['default_shipping'] = FreightTypeQuery::create()->findByPK($idFreightType)->getName();
                     }
                     if (FileQuery::create()->whereAdd(File::ID_FILE, $product->getImportPermit())->count()) {
                         $importPermit = FileQuery::create()->findByPK($product->getImportPermit());
                         if ($importPermit) {
                             $entries[$j]['import_permit'] = true;
                         } else {
                             $entries[$j]['import_permit'] = false;
                         }
                     } else {
                         $entries[$j]['import_permit'] = false;
                     }
                     $entries[$j]['row_status'] = 'success';
                     $purchaseOrders[$i]['row_status'] = 'success';
                     $important = $product->getImportant();
                     if (!$entries[$j]['import_permit']) {
                         $entries[$j]['row_status'] = 'error';
                         $purchaseOrders[$i]['row_status'] = 'error';
                         $entries[$j]['label'] = $this->i18n->_('This product, does not have an Import Clearance Document.');
                         $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order has entries without Import Clearance.');
                     } else {
                         if (!$purchaseOrders[$i]['commercial_invoice']) {
                             $purchaseOrders[$i]['row_status'] = 'error';
                             $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order, does not have a Commercial Invoice Document.');
                         } else {
                             if (!$purchaseOrders[$i]['packing_list']) {
                                 $purchaseOrders[$i]['row_status'] = 'error';
                                 $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order, does not have a Packing List Document.');
                             } else {
                                 if ($important) {
                                     $entries[$j]['row_status'] = 'warning';
                                     $purchaseOrders[$i]['row_status'] = 'warning';
                                     $entries[$j]['label'] = $this->i18n->_('This product is small and valuable.');
                                     $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order has small and valuable stuff.');
                                 } else {
                                     $entries[$j]['row_status'] = 'success';
                                     $purchaseOrders[$i]['row_status'] = 'success';
                                 }
                             }
                         }
                     }
                     $j++;
                 }
                 //Checks if the entry has important stuff
                 if (count($valuable) == 1) {
                     $purchaseOrders[$i]['importance'] = $valuable[1];
                 } else {
                     $flag = 0;
                     $value = $valuable[1];
                     for ($j = 2; $j <= count($valuable); $j++) {
                         if ($valuable[$j] != $value) {
                             $value = 2;
                             break;
                         }
                     }
                     $purchaseOrders[$i]['importance'] = $value;
                 }
                 switch ($purchaseOrders[$i]['importance']) {
                     case '1':
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('Yes');
                         break;
                     case '2':
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('Mixed');
                         break;
                     default:
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('No');
                 }
             } catch (Exception $e) {
                 var_dump($e->getMessage());
             }
             // 			$purchaseOrders[$i]['id_purchase_order_folio'] = PurchaseOrderFolioQuery::create()
             // 			->whereAdd(PurchaseOrderFolio::ID_PURCHASE_ORDER, $purchaseOrder['id_purchase_order'])
             // 			->whereAdd(PurchaseOrderFolio::ID_FOLIO_IMPORT, $idFolioImport)
             // 			->findOne()->getIdPurchaseOrderFolio();
             $cartons = 0;
             $quantity = 0;
             $weight = 0;
             $cbm = 0;
             $price = 0;
             foreach ($entries as $entry) {
                 $cartons += intval($entry['cartons']);
                 $quantity += intval($entry['quantity']);
                 $weight += $entry['weight'];
                 $cbm += $entry['volume'];
                 $price += $entry['price'] * $entry['quantity'];
             }
             $purchaseOrders[$i]['entries'] = $entries;
             $purchaseOrders[$i]['cartons'] = $cartons;
             $purchaseOrders[$i]['quantity'] = $quantity;
             $purchaseOrders[$i]['weight'] = $weight;
             $purchaseOrders[$i]['cbm'] = number_format($cbm, 2);
             $purchaseOrders[$i]['price'] = $price;
             $purchaseOrders[$i]['id_purchase_order'] = $purchaseOrder->getIdPurchaseOrder();
             $purchaseOrders[$i]['courtyard_arrival_date'] = $purchaseOrder->getIdCourtyard();
             $i++;
         }
         return $purchaseOrders;
     } else {
         return null;
     }
 }
コード例 #3
0
 public function detailsSupplierAction()
 {
     $idNpd = $this->getRequest()->getParam('idNpd');
     $id = $this->getRequest()->getParam('id');
     $npdSheetSupplierQuery = NpdSheetSupplierQuery::create()->innerJoinNpdSheet()->whereAdd('NpdSheetSupplier.id_supplier', $id);
     if ($idNpd) {
         $npdSheetSupplierQuery->whereAdd('NpdSheetSupplier.id_npd_sheet', $idNpd);
     }
     $npdSuppliers = $npdSheetSupplierQuery->find();
     foreach ($npdSuppliers as $npdSupplier) {
         $NPDSheetSupplierFilesQuery = FileQuery::create()->addColumns(array("File.*"))->innerJoinNpdSheetSupplier()->whereAdd('NpdSheetSupplier.' . NpdSheetSupplier::ID_NPD_SHEET, $npdSupplier->getIdNpdSheet())->whereAdd("NpdSheetSupplier." . NpdSheetSupplier::ID_NPD_SUPPLIER, $npdSupplier->getIdNpdSupplier())->fetchAll();
         //     		while ($file = $NPDSheetSupplierFilesQuery->read()) {
         //     			$filesArray[] = array( "id" => $file->getIdFile());
         //     		}
     }
     die(Zend_Json::encode($NPDSheetSupplierFilesQuery));
 }
コード例 #4
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'PurchaseOrderFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_purchase_order_file']) && !empty($fields['id_purchase_order_file'])) {
         $criteria->add(PurchaseOrderFile::ID_PURCHASE_ORDER_FILE, $fields['id_purchase_order_file']);
     }
     if (isset($fields['id_purchase_order']) && !empty($fields['id_purchase_order'])) {
         $criteria->add(PurchaseOrderFile::ID_PURCHASE_ORDER, $fields['id_purchase_order']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(PurchaseOrderFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(PurchaseOrderFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #5
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'InspectionFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_inspection_file']) && !empty($fields['id_inspection_file'])) {
         $criteria->add(InspectionFile::ID_INSPECTION_FILE, $fields['id_inspection_file']);
     }
     if (isset($fields['id_inspection']) && !empty($fields['id_inspection'])) {
         $criteria->add(InspectionFile::ID_INSPECTION, $fields['id_inspection']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(InspectionFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(InspectionFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #6
0
ファイル: NpdSheetQuery.php プロジェクト: Eximagen/sochi
 /**
  * @author Jose Luis Suarez Nieto
  * @author Pablo
  * @param int $id
  * @param string $type
  * @return NpdSheetQuery
  */
 private static function getNpdSheetFileQuery($id, $type = 1)
 {
     return FileQuery::create()->addColumns(array("File.*"))->innerJoinNpdSheet()->whereAdd("File." . File::TYPE, $type, self::EQUAL)->whereAdd("NpdSheet." . NpdSheet::ID_NPD_SHEET, $id);
 }
コード例 #7
0
 public function deleteFileAction()
 {
     $idFile = $this->getRequest()->getParam('idFile');
     $idCustomsBroker = $this->getRequest()->getParam('idCustomsBroker');
     $customsBroker = CustomsBrokerQuery::create()->findByPKOrThrow($idCustomsBroker, $this->i18n->_('It does not exist customsBroker whit id' . $idCustomsBroker));
     try {
         $this->getCustomsBrokerCatalog()->beginTransaction();
         $customsBroker->setIdLastFeeFile(null);
         $this->getCustomsBrokerCatalog()->update($customsBroker);
         $file = FileQuery::create()->findByPKOrThrow($idFile, $this->i18n->_('It does not exist File whit id' . $idFile));
         $this->getCatalog('FileCatalog')->deleteById($file->getIdFile());
         $this->getCustomsBrokerCatalog()->commit();
         is_dir(unlink('public/' . $file->getContent()));
         die(json_encode('ok'));
     } catch (Exception $e) {
         die(json_encode('error'));
     }
 }
コード例 #8
0
 /**
  *
  * @return array
  */
 public function listAction()
 {
     $this->view->page = $page = $this->getRequest()->getParam('page') ?: 1;
     $this->view->contentTitle = $this->i18n->_("Proforma invoice List");
     $this->view->post = $post = $this->getRequest()->getParams();
     $this->view->filters = $this->createFilterForUrl($post);
     //echo "xxxx:".$post['id_supplier'];
     if (isset($post['id_supplier']) && !empty($post['id_supplier'])) {
         $this->view->suppliers = $suppliers = SapSupplierQuery::create()->whereAdd(SapSupplier::CARDCODE, $post['id_supplier'])->find();
     } else {
         $accessRole = $this->getUser()->getAccessRole();
         //print_r($accessRole);
         $accessRoleManager = new AccessRoleManager();
         $this->view->suppliers = $suppliers = $accessRoleManager->getAssociateSuppliers($accessRole);
         $post['id_supplier'] = $suppliers->getPrimaryKeys();
     }
     //unset($post['id_supplier']);
     //print_r($post);
     $total = ProformaInvoiceQuery::create()->filter($post)->count();
     $this->view->proformasInvoice = $proformasInvoice = ProformaInvoiceQuery::create()->filter($post)->addDescendingOrderBy(ProformaInvoice::CREATION_DATE)->findByPage($page, $this->getMaxPerPage());
     // To prevent errors in filter form
     if (is_array($post['id_supplier'])) {
         unset($post['id_supplier']);
     }
     $this->view->allProformaInvoiceEntries = $allProformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $proformasInvoice->getPrimaryKeys(), ProformaInvoiceEntryQuery::IN)->find();
     $this->view->allProformaInvoiceFiles = $allProformaInvoiceFiles = ProformaInvoiceFileQuery::create()->whereAdd(ProformaInvoiceFile::ID_PROFORMA_INVOICE, $proformasInvoice->getPrimaryKeys(), ProformaInvoiceFileQuery::IN)->find();
     $this->view->inspections = $inspections = InspectionQuery::create()->whereAdd(Inspection::ID_PROFORMA_INVOICE, $proformasInvoice->getPrimaryKeys(), InspectionQuery::IN)->find();
     $this->view->types = ProformaInvoiceFile::$Types;
     $this->view->files = $files = FileQuery::create()->whereAdd(File::ID_FILE, $allProformaInvoiceFiles->getIdFiles(), FileQuery::IN)->find();
     $this->view->products = $products = ProductQuery::create()->whereAdd(Product::ITEM_CODE, $allProformaInvoiceEntries->getIdProducts(), ProductQuery::IN)->find();
     $this->view->currencies = $currencies = CurrencyQuery::create()->find();
     $this->view->courtyards = $courtyards = CourtyardQuery::create()->whereAdd(Courtyard::ID_COURTYARD, $proformasInvoice->getDistinctCourtyards(), CourtyardQuery::IN)->find();
     $this->view->portsCustom = $portCustoms = PortCustomQuery::create()->whereAdd(PortCustom::ID_PORT_CUSTOM, $courtyards->getDistinctPortCustoms(), PortCustomQuery::IN)->find();
     $this->view->forwarders = $forwarders = ForwarderQuery::create()->whereAdd(Forwarder::ID_FORWARDER, $courtyards->getDistinctForwarders(), ForwarderQuery::IN)->find();
     $this->view->countries = $countries = array("" => "All") + CountryQuery::create()->find()->toCombo();
     $this->view->status = array("" => "All") + array_flip(ProformaInvoice::$Status);
     $this->view->warehousesStores = $warehousesStores = WarehouseStoreQuery::create()->find();
     $this->view->setTpl("Index");
     $this->view->paginator = $this->createPaginator($total, $page);
 }
コード例 #9
0
 public function rateAction()
 {
     $this->view->action = 'update';
     $this->view->address = new Address();
     $idLine = $this->getRequest()->getParam('idLine');
     $idProformaInvoice = $this->getRequest()->getParam('id');
     $ratings = self::$ratings;
     $this->view->ratings = array('' => '**' . $this->i18n->_('Select') . '**') + $ratings;
     $inspectionsQuery = InspectionQuery::create()->whereAdd(Inspection::ID_PROFORMA_INVOICE, $idProformaInvoice)->whereAdd(Inspection::ID_PROFORMA_INVOICE_ENTRY, $idLine)->whereAdd(Inspection::STATUS, Inspection::$Status['Innactive'], baseQuery::NOT_EQUAL)->find();
     $proformaInvoice = ProformaInvoiceQuery::create()->findByPK($idProformaInvoice);
     //$idS = PurchaseOrderQuery::create()->findByPK($idPo)->getIdSupplier();
     $supplier = SapSupplierQuery::create()->findByPK($proformaInvoice->getIdSupplier());
     //die(print_r($supplier));
     $this->view->supplier = $supplier;
     $rate = $supplier->getQuality();
     $requiredInspection = array();
     if ($rate == 2) {
         $requiredInspection[3] = self::$inspectionsArray[3];
         $requiredInspection[4] = self::$inspectionsArray[4];
     }
     if ($rate == 3) {
         $requiredInspection[4] = self::$inspectionsArray[4];
     }
     $inspects = $inspectionsQuery->toArray();
     foreach ($inspects as $inspect) {
         $idInspections[] = $inspect['id_inspection'];
     }
     $files = FileQuery::create()->innerJoinInspection()->addColumns(array('Inspection.' . Inspection::ID_INSPECTION, 'File.*'))->whereAdd('Inspection.' . Inspection::ID_INSPECTION, $idInspections, BaseQuery::IN)->fetchAll();
     $inspectors = \Application\Query\InspectorQuery::create()->innerJoinPerson()->addColumns(array('Inspector.*', 'Person.*'))->find();
     $inspectors = $inspectors->map(function (Inspector $inspector) {
         return array($inspector->getIdInspector() => $inspector->getFullName());
     });
     $this->view->inspectors = array('' => 'Select Inspector') + $inspectors;
     $this->view->requiredInspections = $requiredInspection;
     $this->view->inspections = $inspectionsQuery;
     $this->view->inspectionsTypes = self::$inspectionsTypes;
     $this->view->idEntry = $idLine;
     $this->view->idProformaInvoice = $idProformaInvoice;
     $this->view->files = $files;
 }
コード例 #10
0
 public function downloadFileAction()
 {
     $id = $this->getRequest()->getParam('id');
     $file = FileQuery::create()->findByPK($id);
     $filePath = 'public/' . $file->getContent();
     // 		echo $filePath;die;
     header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
     readfile($filePath);
     exit;
 }
コード例 #11
0
ファイル: NpdSheetController.php プロジェクト: Eximagen/sochi
 /**
  * @author Pablo
  */
 public function benchmarkingAction()
 {
     $npd = NpdSheetQuery::create()->findByPKOrThrow($npdId = $this->getRequest()->getParam('id'), $this->i18n->_("The NPD Sheet with ID {$npdId} wasn't found"));
     $npdSuppliers = NpdSheetSupplierQuery::create()->whereAdd(NpdSheetSupplier::ID_NPD_SHEET, $npd->getIdNpdSheet())->find();
     $npdSuppliersIds = NpdSheetSupplierQuery::create()->whereAdd(NpdSheetSupplier::ID_NPD_SHEET, $npd->getIdNpdSheet())->addColumn(NpdSheetSupplier::ID_SUPPLIER)->fetchCol();
     $supplierBudgets = SupplierBudgetQuery::create()->whereAdd(SupplierBudget::ID_NPD_SUPPLIER, $npdSuppliers->getPrimaryKeys(), SupplierBudgetQuery::IN)->find();
     $benchmarking = array();
     foreach ($supplierBudgets as $supplierBudget) {
         $moq = $supplierBudget->getMoq();
         $npdSupplierId = $supplierBudget->getIdNpdSupplier();
         $leadTime = $supplierBudget->getLeadTime();
         if (!is_array($benchmarking[$moq])) {
             $benchmarking[$moq] = array();
         }
         $benchmarking[$moq][$npdSupplierId] = array('price' => $supplierBudget->getPrice(), 'leadTime' => $supplierBudget->getLeadTime(), 'percent' => $supplierBudget->getPrice() / $npd->getPrice() * 100 - 100 . '%', 'favorite' => $supplierBudget->getFavorite(), 'isAuthorized' => $supplierBudget->getIsAuthorized(), 'supplierBudgetId' => $supplierBudget->getIdSupplierBudget());
         ksort($benchmarking);
     }
     //die(print_r($benchmarking));
     // 		echo '<pre>';
     $supplierImages = array();
     foreach ($npdSuppliers as $npdSupplier) {
         $supplierImages[$npdSupplier->getIdNpdSheet()] = FileQuery::create()->innerJoinNpdSheetSupplier()->whereAdd('NpdSheetSupplier.' . NpdSheetSupplier::ID_NPD_SHEET, $npd->getIdNpdSheet())->whereAdd('NpdSheetSupplier.' . NpdSheetSupplier::ID_NPD_SUPPLIER, $npdSupplier->getIdNpdSupplier())->whereAdd(File::TYPE, File::$typeFile['typeImage'])->find();
         $NPDSheetSupplierFilesQuery = NpdSheetSupplierQuery::create()->addColumns(array("File.*"))->innerJoinFile()->whereAdd("NpdSheetSupplier." . NpdSheetSupplier::ID_NPD_SUPPLIER, $npdSupplier->getIdNpdSupplier())->fetchAll();
         $supplierImages2[$npdSupplier->getIdNpdSheet()] = $NPDSheetSupplierFilesQuery;
     }
     // 		print_r($supplierImages);
     // 		print_r($supplierImages2);
     // 		die;
     $files = FileQuery::create()->innerJoinNpdSheet()->whereAdd('NpdSheet.' . NpdSheet::ID_NPD_SHEET, $npd->getIdNpdSheet())->find();
     $npdImages = array();
     $npdFiles = array();
     $npdLinks = array();
     foreach ($files as $file) {
         switch ($file->getType()) {
             case File::$typeFile['typeImage']:
                 $npdImages[] = $file;
                 break;
             case File::$typeFile['typeFile']:
                 $npdFiles[] = $file;
                 break;
             case File::$typeFile['typeLink']:
                 $npdLinks[] = $file;
                 break;
         }
     }
     if ($npd->getIdSubfamily()) {
         $subFamily = SubFamilyQuery::create()->findByPK($npd->getIdSubfamily())->getName();
     } else {
         $subFamily = $this->i18n->_("Any");
     }
     $suppliers = SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $npdSuppliersIds, SapSupplierQuery::IN)->find();
     $temporalSuppliers = array();
     $temporalSuppliersQuery = TemporalSupplierQuery::create()->whereAdd(TemporalSupplier::ID_TEMPORAL_SAP, $npdSuppliersIds, TemporalSupplierQuery::IN)->find();
     while ($temporalSupplier = $temporalSuppliersQuery->read()) {
         $supplier = new SapSupplier();
         $supplier->setCardCode($temporalSupplier->getIdTemporalSap());
         $supplier->setCardname($temporalSupplier->getName());
         $suppliers->append($supplier);
     }
     // 		echo '<pre>';
     // 		print_r($suppliers);
     // 		die;
     $this->view->subFamily = $subFamily;
     $this->view->family = $family = FamilyQuery::create()->findByPK($npd->getIdFamily());
     $this->view->productGroup = ProductGroupQuery::create()->findByPK($family->getIdProductGroup());
     $this->view->suppliers = $suppliers->toObjectArray();
     $this->view->npd = $npd;
     $this->view->benchmarking = $benchmarking;
     $this->view->npdSuppliers = $npdSuppliers;
     $this->view->supplierBudgets = $supplierBudgets;
     $this->view->supplierImages = $supplierImages;
     $this->view->npdImages = $npdImages;
     $this->view->npdFiles = $npdFiles;
     $this->view->npdLinks = $npdLinks;
     $this->view->incoterms = \Application\Query\IncotermQuery::create()->find()->toCombo();
     $this->view->ports = \Application\Query\PortCustomQuery::create()->find()->toCombo();
     $this->view->contentTitle = $this->i18n->_('NPD Benchmarking');
 }
コード例 #12
0
ファイル: BookingController.php プロジェクト: Eximagen/sochi
 private function getPurchaseOrders($idFolioImport, $status = null, $in = true)
 {
     $id = $idFolioImport;
     $purchaseOrderFolioQuery = PurchaseOrderFolioQuery::create()->addColumn(PurchaseOrderFolio::ID_PURCHASE_ORDER)->whereAdd(PurchaseOrderFolio::ID_FOLIO_IMPORT, $id);
     if ($status == null) {
         $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->count();
         $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->fetchAll();
     } else {
         if ($in) {
             $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::IN)->count();
             $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::IN)->fetchAll();
         } else {
             $query = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::NOT_EQUAL)->count();
             $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrderFolioQuery, PurchaseOrderQuery::IN)->whereAdd(PurchaseOrder::STATUS, PurchaseOrder::$Status[$status], PurchaseOrderQuery::NOT_EQUAL)->fetchAll();
         }
     }
     if ($query) {
         $i = 0;
         foreach ($purchaseOrderQuery as $purchaseOrder) {
             try {
                 $purchaseOrderEntryQuery = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $purchaseOrder['id_purchase_order'])->fetchAll();
                 $price = 0;
                 $cbm = 0;
                 $individual_packs = 0;
                 $cartons = 0;
                 $quantity = 0;
                 $weight = 0;
                 $valuable = array();
                 $j = 0;
                 $packingList = PurchaseOrderFileQuery::create()->whereAdd(PurchaseOrderFile::ID_PURCHASE_ORDER, $purchaseOrder['id_purchase_order'])->whereAdd(PurchaseOrderFile::DOCUMENT_TYPE, PurchaseOrderFile::$DocumentType['PackingList'])->count();
                 $commercialInvoice = PurchaseOrderFileQuery::create()->whereAdd(PurchaseOrderFile::ID_PURCHASE_ORDER, $purchaseOrder['id_purchase_order'])->whereAdd(PurchaseOrderFile::DOCUMENT_TYPE, PurchaseOrderFile::$DocumentType['CommercialInvoice'])->count();
                 if ($packingList) {
                     $purchaseOrders[$i]['packing_list'] = true;
                 } else {
                     $purchaseOrders[$i]['packing_list'] = false;
                 }
                 if ($commercialInvoice) {
                     $purchaseOrders[$i]['commercial_invoice'] = true;
                 } else {
                     $purchaseOrders[$i]['commercial_invoice'] = false;
                 }
                 foreach ($purchaseOrderEntryQuery as $purchaseOrderEntry) {
                     $product = ProductQuery::create()->findByPK($purchaseOrderEntry['id_product'])->toArray();
                     if (!empty($product['mc_parts'])) {
                         $cartonsEntry = ceil($purchaseOrderEntry['quantity'] / $product['mc_parts']);
                     } else {
                         $this->setFlash('warning', $this->i18n->_("You must edit MC Parts, it cannot be cero."));
                         $this->_redirect('product/edit/id/' . $product['id_product']);
                     }
                     $volume = $product['mc_front'] * $product['mc_height'] * $product['mc_depth'] / 1000000;
                     $cbm += $cartonsEntry * $volume;
                     $weight += $cartonsEntry * $product['mc_weight'];
                     $price += $purchaseOrderEntry['quantity'] * $purchaseOrderEntry['price'];
                     $cartons += $cartonsEntry;
                     $quantity += $purchaseOrderEntry['quantity'];
                     $entries[$j]['id_product'] = $product['id_product'];
                     $entries[$j]['status'] = $this->getPurchaseOrderEntryStatus($purchaseOrderEntry['status']);
                     $entries[$j]['important'] = $product['important'];
                     $entries[$j]['item_code'] = $product['item_code'];
                     $entries[$j]['product'] = $product['item_name'];
                     $entries[$j]['price'] = $purchaseOrderEntry['price'];
                     $entries[$j]['amount'] = $purchaseOrderEntry['quantity'] * $purchaseOrderEntry['price'];
                     $entries[$j]['cartons'] = $cartonsEntry;
                     $entries[$j]['quantity'] = $purchaseOrderEntry['quantity'];
                     $entries[$j]['weight'] = $product['mc_weight'] * $cartonsEntry;
                     $entries[$j]['volume'] = number_format($volume * $cartonsEntry, 2);
                     $entries[$j]['default_shipping'] = FreightTypeQuery::create()->findByPK($product['default_freight_fare'])->getName();
                     if (!empty($product['import_permit'])) {
                         $importPermit = FileQuery::create()->findByPK($product['import_permit']);
                         if ($importPermit) {
                             $entries[$j]['import_permit'] = true;
                         } else {
                             $entries[$j]['import_permit'] = false;
                         }
                     } else {
                         $entries[$j]['import_permit'] = false;
                     }
                     $entries[$j]['row_status'] = 'success';
                     $purchaseOrders[$i]['row_status'] = 'success';
                     if (!$entries[$j]['import_permit']) {
                         $entries[$j]['row_status'] = 'error';
                         $purchaseOrders[$i]['row_status'] = 'error';
                         $entries[$j]['label'] = $this->i18n->_('This product, does not have an Import Clearance Document.');
                         $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order has entries without Import Clearance.');
                     } else {
                         if (!$purchaseOrders[$i]['commercial_invoice']) {
                             $purchaseOrders[$i]['row_status'] = 'error';
                             $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order, does not have a Commercial Invoice Document.');
                         } else {
                             if (!$purchaseOrders[$i]['packing_list']) {
                                 $purchaseOrders[$i]['row_status'] = 'error';
                                 $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order, does not have a Packing List Document.');
                             } else {
                                 if ($product['important']) {
                                     $entries[$j]['row_status'] = 'warning';
                                     $purchaseOrders[$i]['row_status'] = 'warning';
                                     $entries[$j]['label'] = $this->i18n->_('This product is small and valuable.');
                                     $purchaseOrders[$i]['label'] = $this->i18n->_('This Purchase Order has small and valuable stuff.');
                                 } else {
                                     $entries[$j]['row_status'] = 'success';
                                     $purchaseOrders[$i]['row_status'] = 'success';
                                 }
                             }
                         }
                     }
                     $j++;
                 }
                 //Checks if the entry has important stuff
                 if (count($valuable) == 1) {
                     $purchaseOrders[$i]['importance'] = $valuable[1];
                 } else {
                     $flag = 0;
                     $value = $valuable[1];
                     for ($j = 2; $j <= count($valuable); $j++) {
                         if ($valuable[$j] != $value) {
                             $value = 2;
                             break;
                         }
                     }
                     $purchaseOrders[$i]['importance'] = $value;
                 }
                 switch ($purchaseOrders[$i]['importance']) {
                     case '1':
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('Yes');
                         break;
                     case '2':
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('Mixed');
                         break;
                     default:
                         $purchaseOrders[$i]['importance'] = $this->i18n->_('No');
                 }
             } catch (Exception $e) {
                 var_dump($e->getMessage());
             }
             $purchaseOrders[$i]['id_purchase_order_folio'] = PurchaseOrderFolioQuery::create()->whereAdd(PurchaseOrderFolio::ID_PURCHASE_ORDER, $purchaseOrder['id_purchase_order'])->whereAdd(PurchaseOrderFolio::ID_FOLIO_IMPORT, $idFolioImport)->findOne()->getIdPurchaseOrderFolio();
             $cartons = 0;
             $quantity = 0;
             $weight = 0;
             $cbm = 0;
             $price = 0;
             foreach ($entries as $entry) {
                 $cartons += intval($entry['cartons']);
                 $quantity += intval($entry['quantity']);
                 $weight += $entry['weight'];
                 $cbm += $entry['volume'];
                 $price += $entry['price'] * $entry['quantity'];
             }
             $purchaseOrders[$i]['entries'] = $entries;
             $purchaseOrders[$i]['cartons'] = $cartons;
             $purchaseOrders[$i]['quantity'] = $quantity;
             $purchaseOrders[$i]['weight'] = $weight;
             $purchaseOrders[$i]['cbm'] = number_format($cbm, 2);
             $purchaseOrders[$i]['price'] = $price;
             $purchaseOrders[$i]['id_purchase_order'] = $purchaseOrder['id_purchase_order'];
             $purchaseOrders[$i]['courtyard_arrival_date'] = $purchaseOrder['courtyard_arrival_date'];
             $i++;
         }
         return $purchaseOrders;
     } else {
         return null;
     }
 }
コード例 #13
0
 public function toExcelAction()
 {
     $id = $this->getRequest()->getParam("id");
     $focusGroup = FocusGroupQuery::create()->findByPKOrThrow($id, $this->i18n->_("The FocusGroup with id {$id} wasn't found"));
     $poll = PollQuery::create()->findByPKOrThrow($focusGroup->getIdPoll(), $this->i18n->_("The Poll with id {$focusGroup->getIdPoll()} wasn't found"));
     $participants = RespondentQuery::create()->innerJoinFocusGroup()->whereAdd('FocusGroup.' . FocusGroup::ID_FOCUS_GROUPS, $focusGroup->getIdFocusGroups())->find();
     $npds = NpdSheetQuery::create()->innerJoinFocusGroup()->whereAdd('FocusGroup.' . FocusGroup::ID_FOCUS_GROUPS, $focusGroup->getIdFocusGroups(), BaseQuery::EQUAL)->find()->toObjectArray();
     $images = array();
     $suppliers = array();
     foreach ($npds as $npd) {
         $npdSupplier = NpdSheetSupplierQuery::create()->whereAdd(NpdSheetSupplier::ID_NPD_SHEET, $npd->getIdNpdSheet())->findOne();
         if ($npdSupplier) {
             $supplier = SapSupplierQuery::create()->findByPK($npdSupplier->getIdSupplier());
         }
         $query = FileQuery::create()->addColumns(array("File.*"))->innerJoinNpdSheetSupplier()->whereAdd("File." . File::TYPE, $type, FileQuery::EQUAL)->whereAdd("NpdSheetSupplier." . NpdSheetSupplier::ID_NPD_SHEET, $npd->getIdNpdSheet());
         if ($supplier) {
             $query->whereAdd("NpdSheetSupplier." . NpdSheetSupplier::ID_SUPPLIER, $supplier->getIdSupplier());
             $suppliers[$npd->getIdNpdSheet()] = $supplier;
         }
         $images[$npd->getIdNpdSheet()] = $query->findOne();
         if (!$images[$npd->getIdNpdSheet()]) {
             if (null != ($npdImages = NpdSheetQuery::getNpdSheetFileObjects($npd->getIdNpdSheet(), File::$typeFile["typeImage"]))) {
                 $images[$npd->getIdNpdSheet()] = $npdImages->getOne();
             }
         }
     }
     $questions = QuestionQuery::create()->innerJoinPoll()->whereAdd("PollQuestions.id_poll", $poll->getIdPoll(), BaseQuery::EQUAL)->orderBy("PollQuestions.order")->find();
     $colors = ColorQuery::create()->find()->toCombo();
     require_once 'PHPExcel.php';
     $objPHPExcel = new PHPExcel();
     $activeSheet = $objPHPExcel->setActiveSheetIndex(0);
     $activeSheet->mergeCells('A1:A2')->setCellValue('A1', $this->i18n->_('NPD ID'))->mergeCells('B1:B2')->setCellValue('B1', $this->i18n->_('Supplier'))->mergeCells('C1:C2')->setCellValue('C1', $this->i18n->_('Image'))->mergeCells('D1:D2')->setCellValue('D1', $this->i18n->_('Description'))->mergeCells('E1:E2')->setCellValue('E1', $this->i18n->_('MX Price'));
     $i = 5;
     foreach ($participants as $participant) {
         $last = $i + $questions->count() - 1;
         $activeSheet->mergeCells($this->getExcelColumn($i) . '1:' . $this->getExcelColumn($last) . '1');
         $activeSheet->setCellValue($this->getExcelColumn($i) . '1', $participant->getName());
         foreach ($questions as $question) {
             $activeSheet->setCellValue($this->getExcelColumn($i) . '2', $question->getDescription());
             $i++;
         }
     }
     $i = 3;
     foreach ($npds as $npd) {
         $activeSheet->setCellValue("A{$i}", $npd->getIdNpdSheet());
         if ($suppliers[$npd->getIdNpdSheet()]) {
             $activeSheet->setCellValue("B{$i}", $suppliers[$npd->getIdNpdSheet()]->getName());
         }
         if ($images[$npd->getIdNpdSheet()]) {
             $link = new PHPExcel_Cell_Hyperlink();
             $link->setUrl($this->getFullBaseUrl() . '/' . $images[$npd->getIdNpdSheet()]->getContent());
             $activeSheet->setCellValue("C{$i}", $this->getFullBaseUrl() . '/' . $images[$npd->getIdNpdSheet()]->getContent())->setHyperlink("C{$i}", $link);
         }
         $activeSheet->setCellValue("D{$i}", $npd->getDescription());
         $activeSheet->setCellValue("E{$i}", $npd->getPrice());
         $j = 5;
         foreach ($participants as $participant) {
             $questions->rewind();
             while ($question = $questions->read()) {
                 if ($pollResponse = PollResponseQuery::create()->whereAdd(PollResponse::ID_FOCUS_GROUP, $focusGroup->getIdFocusGroups())->whereAdd(PollResponse::ID_POLL, $focusGroup->getIdPoll())->whereAdd(PollResponse::ID_NPD_SHEET, $npd->getIdNpdSheet())->whereAdd(PollResponse::ID_RESPONDENT, $participant->getIdRespondent())->whereAdd(PollResponse::ID_QUESTION, $question->getIdQuestion())->findOne()) {
                     $q = new Question();
                     if ($question->getIdType() == Question::$Type['Yes/No']) {
                         switch ($pollResponse->getResponse()) {
                             case "true":
                                 $pollResponse->setResponse('Si');
                                 break;
                             case "false":
                                 $pollResponse->setResponse('No');
                                 break;
                         }
                     }
                     if ($question->getIdType() == Question::$Type['Multiple']) {
                         $multipleResponseQuery = QuestionMultipleResponseQuery::create()->whereAdd(QuestionMultipleResponse::ID_QUESTION, $question->getIdQuestion())->find();
                         while ($multipleResponse = $multipleResponseQuery->read()) {
                             if ($pollResponse->getResponse() == $multipleResponse->getIdResponse()) {
                                 $pollResponse->setResponse($multipleResponse->getDescription());
                             }
                         }
                     }
                     $activeSheet->setCellValue($this->getExcelColumn($j) . $i, $pollResponse->getResponse());
                 }
                 $j++;
             }
         }
         $i++;
     }
     header("Content-Type: application/vnd.ms-excel");
     header("Content-Disposition: attachment; filename=\"{$focusGroup->getName()}.xlsx\"");
     header("Cache-Control: max-age=0");
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save("php://output");
     exit;
 }
コード例 #14
0
ファイル: -ProductController.php プロジェクト: Eximagen/sochi
 /**
  *
  * @return array
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     $product = ProductQuery::create()->findByPK($id)->toArray();
     $product['prepend'] = substr($product['ItemCode'], 0, 4);
     $product['key'] = substr($product['ItemCode'], 4, 3);
     if (ProductGroupQuery::create()->whereAdd(ProductGroup::CODE, $product['product_group_code'])->count()) {
         $product['id_product_group'] = $productGroup = ProductGroupQuery::create()->whereAdd(ProductGroup::CODE, $product['product_group_code'])->findOne()->getIndex();
     } else {
         $this->setFlash('warning', $this->i18n->_('This product (' . $id . ') cannot be edited because there is not a Product Group associated with it'));
         $this->_redirect('product/list');
     }
     $product['id_family'] = $family = FamilyQuery::create()->whereAdd(Family::ID_PRODUCT_GROUP, $product['id_product_group'])->whereAdd(Family::CODE, $product['family_code']);
     if (!$family->count()) {
         $this->setFlash('error', "It does not exist a Product group 2 with code {$product['family_code']} for Product Group " . ProductGroupQuery::create()->whereAdd(ProductGroup::CODE, $product['product_group_code'])->findOne()->getName());
         $this->_redirect('product/list');
     }
     $product['id_family'] = $family = $family->findOne()->getIndex();
     $subfamilyCode = $product['subfamily_code'];
     $itemQuery = ProductQuery::create()->whereAdd(Product::ITEM_CODE, substr($id, 0, 9), ProductQuery::LIKE)->find();
     $colors = ColorQuery::create()->find();
     $i = 0;
     $product['brand_code'] = BrandQuery::create()->findByPK($product['id_brand'])->getName();
     while ($item = $itemQuery->read()) {
         $itemCode = $item->getItemCode();
         $colorCode = substr($itemCode, -2);
         $items[$i]['idProduct'] = $item->getItemCode();
         $items[$i]['idColor'] = $colors->getByCodeOrEmpty($colorCode)->getIdColor();
         $items[$i]['colorCode'] = $colorCode;
         $items[$i]['status'] = $item->getStatus();
         $items[$i]['itemName'] = $item->getItemName();
         $items[$i]['itemCode'] = $item->getItemCode();
         $items[$i]['vim'] = $item->getIndividualVim();
         $i++;
     }
     if (!empty($product['CardCode'])) {
         $supplier = SapSupplierQuery::create()->findByPKOrThrow($product['CardCode'], $this->i18n->_("The Supplier with id {$product['CardCode']} does not exist."));
     } else {
         $supplier = new Supplier();
     }
     if (!empty($product['U_PCS_Def_Freight_Fa'])) {
         $this->view->freightFare = $this->getFreightInformation($product['U_PCS_Def_Freight_Fa']);
     }
     if (!empty($product['CstGrpCode'])) {
         $customTariffCode = CustomsTariffCodeQuery::create()->findByPK($product['CstGrpCode']);
         $product['percent'] = $customTariffCode->getPercent();
         $product['tariff_remarks'] = "";
     }
     if ($product['U_PCS_Impor_per_id'] > 0) {
         $this->view->importPermitFile = FileQuery::create()->findByPKOrThrow($product['U_PCS_Impor_per_id'], $this->i18n->_("The File with id {$product['U_PCS_Impor_per_id']} does not exist."));
     }
     $npdFileQuery = \Application\Query\FileQuery::create()->innerJoinNpdSheet()->whereAdd('NpdSheet.id_npd_sheet', $product["id_npd_sheet"])->whereAdd('File.Type', file::$typeFile["typeFile"])->findOne();
     if ($npdFileQuery) {
         $filePath = $npdFileQuery->getContent();
         $idFile = $npdFileQuery->getIdFile();
     }
     $subfamilyQuery = SubfamilyQuery::create()->whereAdd(Subfamily::ID_FAMILY, $product['id_family'])->whereAdd(Subfamily::CODE, $subfamilyCode)->findOne();
     $product["id_subfamily"] = $subfamilyQuery ? $subfamilyQuery->getIdSubfamily() : null;
     $currency = CurrencyQuery::create()->whereAdd(Currency::CURRCODE, $product["Currency"])->findOne();
     $this->view->npdSheetFile = $filePath;
     $this->view->id = $id;
     $this->view->items = $items;
     $this->view->itemCount = $i;
     $this->view->product = $product;
     $this->view->brands = $this->getBrands();
     $this->view->countries = $this->getCountries();
     $this->view->currencies = $this->getCurrencies();
     $this->view->families = $families = $this->getFamilies($product['id_product_group']);
     $this->view->subfamilies = $this->getSubFamilies($product['id_family'], $product['subfamily_code']);
     $this->view->productGroups = $productGroups = $this->getProductGroup();
     $this->view->supplier = $supplier->toArray();
     $this->view->years = $this->getLastYears();
     $this->view->defaultShipping = $this->getDefaultShipping();
     $this->view->incoterms = $this->getIncoterms();
     $this->view->customsTariffCodes = $this->getCustomsTariffCode();
     $this->view->colors = $this->getColors();
     $this->view->status = $this->getStatus();
     $this->view->currency = $currency;
     $this->view->contentTitle = $this->i18n->_('Edit Product');
     $this->view->edit = true;
     $this->view->action = 'update';
     $this->view->setTpl("Form");
     //die("<pre>".print_r($product,true)."</pre>");
 }
コード例 #15
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'FolioImportFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_folio_import_file']) && !empty($fields['id_folio_import_file'])) {
         $criteria->add(FolioImportFile::ID_FOLIO_IMPORT_FILE, $fields['id_folio_import_file']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(FolioImportFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['id_folio_import']) && !empty($fields['id_folio_import'])) {
         $criteria->add(FolioImportFile::ID_FOLIO_IMPORT, $fields['id_folio_import']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(FolioImportFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #16
0
ファイル: BookingFileQuery.php プロジェクト: Eximagen/sochi
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'BookingFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_booking_file']) && !empty($fields['id_booking_file'])) {
         $criteria->add(BookingFile::ID_BOOKING_FILE, $fields['id_booking_file']);
     }
     if (isset($fields['id_booking']) && !empty($fields['id_booking'])) {
         $criteria->add(BookingFile::ID_BOOKING, $fields['id_booking']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(BookingFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(BookingFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #17
0
ファイル: SupplierFileQuery.php プロジェクト: Eximagen/sochi
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'SupplierFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_supplier_file']) && !empty($fields['id_supplier_file'])) {
         $criteria->add(SupplierFile::ID_SUPPLIER_FILE, $fields['id_supplier_file']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(SupplierFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['id_supplier']) && !empty($fields['id_supplier'])) {
         $criteria->add(SupplierFile::ID_SUPPLIER, $fields['id_supplier']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(SupplierFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #18
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'WarehouseEntranceFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_warehouse_entrance_file']) && !empty($fields['id_warehouse_entrance_file'])) {
         $criteria->add(WarehouseEntranceFile::ID_WAREHOUSE_ENTRANCE_FILE, $fields['id_warehouse_entrance_file']);
     }
     if (isset($fields['id_warehouse_entrance']) && !empty($fields['id_warehouse_entrance'])) {
         $criteria->add(WarehouseEntranceFile::ID_WAREHOUSE_ENTRANCE, $fields['id_warehouse_entrance']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(WarehouseEntranceFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(WarehouseEntranceFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }
コード例 #19
0
 /**
  * build fromArray
  * @param Query $query
  * @param array $fields
  * @param string $prefix
  */
 public static function build(Query $query, $fields, $prefix = 'ProductPrintingAreaFile')
 {
     parent::build($query, $fields);
     $criteria = $query->where();
     $criteria->prefix($prefix);
     if (isset($fields['id_product_printing_area_file']) && !empty($fields['id_product_printing_area_file'])) {
         $criteria->add(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA_FILE, $fields['id_product_printing_area_file']);
     }
     if (isset($fields['id_product_printing_area']) && !empty($fields['id_product_printing_area'])) {
         $criteria->add(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA, $fields['id_product_printing_area']);
     }
     if (isset($fields['id_file']) && !empty($fields['id_file'])) {
         $criteria->add(ProductPrintingAreaFile::ID_FILE, $fields['id_file']);
     }
     if (isset($fields['document_type']) && !empty($fields['document_type'])) {
         $criteria->add(ProductPrintingAreaFile::DOCUMENT_TYPE, $fields['document_type']);
     }
     $criteria->endPrefix();
 }