Ejemplo n.º 1
0
 /**
  *
  */
 protected function trackingAction()
 {
     $id = $this->getRequest()->getParam('id');
     $proformaInvoice = ProformaInvoiceQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the ProformaInvoice with id {$id}"));
     $this->view->proformaInvoiceLogs = ProformaInvoiceLogQuery::create()->whereAdd('id_proforma_invoice', $id)->find();
     $this->view->users = UserQuery::create()->find()->toCombo();
 }
Ejemplo n.º 2
0
 /**
  *
  * @param int $idRequisition
  * @return boolean
  */
 private function configureProformaInvoicesAndPurchaseOrderByRequisition($idRequisition)
 {
     if (!$this->proformaInvoiceByRequisition instanceof ProformaInvoiceCollection) {
         $requisitionEntries = RequisitionEntryQuery::create()->whereAdd(RequisitionEntry::ID_REQUISITION, $idRequisition)->find();
         $proformaInvoiceQuery = ProformaInvoiceQuery::create();
         $proformaInvoiceQuery->where()->end()->setAND();
         $proformaInvoiceQuery->where()->setOR();
         while ($requisitionEntry = $requisitionEntries->read()) {
             $proformaInvoiceQuery->whereAdd('ProformaInvoiceEntry.' . ProformaInvoiceEntry::REQUISITION_IDS, $requisitionEntry->getIdRequisitionEntry(), BaseQuery::LIKE);
         }
         $this->proformaInvoiceByRequisition = $proformaInvoiceQuery->find();
         $this->purchaseOrderByRequisition = PurchaseOrderQuery::create()->whereAdd('PurchaseOrderEntry.' . PurchaseOrderEntry::BASE_ENTRY, $this->getProformaInvoiceByRequisition()->getPrimaryKeys())->find();
     }
 }
Ejemplo n.º 3
0
 /**
  *
  * @param int $idProformaInvoice
  * @param int $idEvent
  */
 private function getMissingProformaInformation($idProformaInvoice, $idEvent)
 {
     $event = EventQuery::create()->findByPKOrThrow($idEvent, $this->i18n->_("Event with id {$idEvent} not found."));
     $proformaInvoice = ProformaInvoiceQuery::create()->findByPKOrThrow($idProformaInvoice, $this->i18n->_("ProformaInvoice with id {$idProformaInvoice} not found."));
     $supplier = SapSupplierQuery::create()->findByPKOrThrow($proformaInvoice->getIdSupplier(), $this->i18n->_("SapSupplier with id {$proformaInvoice->getIdSupplier()} not found."));
     $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $proformaInvoice->getIdProformaInvoice())->find();
     if (count($proformaInvoiceEntries->getDistinctRequisitionEntryIdsToArray()) > 0) {
         $requisitionEntries = RequisitionEntryQuery::create()->whereAdd(RequisitionEntry::ID_REQUISITION_ENTRY, $proformaInvoiceEntries->getDistinctRequisitionEntryIdsToArray())->find();
     }
     $paymentTerms = ProformaInvoicePaymentTermQuery::create()->whereAdd(ProformaInvoicePaymentTerm::ID_PROFORMA_INVOICE, $proformaInvoice->getIdProformaInvoice())->whereAdd(ProformaInvoicePaymentTerm::ID_EVENT, $event->getIdEvent())->find();
     $programmedPayments = new ProformaInvoiceProgrammedPaymentCollection();
     while ($paymentTerm = $paymentTerms->valid()) {
         $proformaInvoicePaymentTerm = $paymentTerms->read();
         $proformaInvoiceMissingProgrammedPayment = ProformaInvoiceProgrammedPaymentFactory::createFromArray(array('id_proforma_invoice_programmed_payment' => 'VPIPP' . $proformaInvoicePaymentTerm->getIdProformaInvoicePayment(), 'id_proforma_invoice_payment_term' => $proformaInvoicePaymentTerm->getIdProformaInvoicePayment(), 'pieces' => $proformaInvoicePaymentTerm->getPieces(), 'id_proforma_invoice' => $proformaInvoicePaymentTerm->getIdProformaInvoice(), 'line' => $proformaInvoicePaymentTerm->getLine(), 'id_programmed_payment' => 'VPP' . $proformaInvoicePaymentTerm->getIdProformaInvoicePayment(), 'id_currency' => $proformaInvoicePaymentTerm->getCurrency(), 'id_company' => $proformaInvoice->getIdSupplier(), 'type' => ProgrammedPayment::$TypePayment['ProformaInvoice'], 'ammount' => $proformaInvoicePaymentTerm->getPayment(), 'folio' => 'Not Available', 'due_date' => 'Not Available', 'status' => ProgrammedPayment::$TypeStatus['Virtual']));
         $programmedPayments->append($proformaInvoiceMissingProgrammedPayment);
     }
     $response = array("docNum" => $proformaInvoice->getSapDocumentNumber(), "docEntry" => $proformaInvoice->getIdProformaInvoice(), "createDate" => $proformaInvoice->getDocDate(), "supplier" => $supplier->getCardCode(), "supplierName" => $supplier->getCardname(), "event" => $event->getName());
     while ($proformaInvoiceEntries->valid()) {
         $proformaInvoiceEntry = $proformaInvoiceEntries->read();
         $paymentTerm = $paymentTerms->filterByProformaInvoiceEntry($proformaInvoiceEntry)->getOne();
         $programmedPayment = $programmedPayments->filterByPaymentTerm($paymentTerm)->getOne();
         $entryIds = $proformaInvoiceEntry->getRequisitionIdsToArray();
         if (count($entryIds) > 0) {
             $entries = $requisitionEntries->filter(function (RequisitionEntry $entry) use($entryIds) {
                 return in_array($entry->getIdRequisitionEntry(), $entryIds);
             });
         } else {
             $entries = new RequisitionEntryCollection();
         }
         $response["entries"][] = array("line" => $proformaInvoiceEntry->getLine(), "product" => $proformaInvoiceEntry->getIdProduct(), "quantity" => $proformaInvoiceEntry->getQuantity(), "price" => $proformaInvoiceEntry->getPrice(), "currency" => $proformaInvoiceEntry->getCurrency(), "requisitions" => $entries->isEmpty() ? "-" : implode($entries->getDistinctRequisitions()), "ammount" => $programmedPayment->getAmmount(), "credits" => 0, "pendingBalance" => $programmedPayment->getAmmount());
     }
     return $response;
 }
Ejemplo n.º 4
0
 /**
  * 
  * 
  */
 public function getQuarantineListResultsAction()
 {
     $page = $this->getRequest()->getParam('page') ?: 1;
     $warehouseEntries = WarehouseEntranceQuery::create()->whereAdd(WarehouseEntrance::ID_FOLIO_IMPORT, null, WarehouseEntranceQuery::NOT_EQUAL)->whereAdd(WarehouseEntrance::ID_FOLIO_IMPORT, '0', WarehouseEntranceQuery::NOT_EQUAL)->find();
     $params = $this->getRequest()->getParams();
     $params['id_purchase_order'] = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::SAP_DOCUMENT_NUMBER, $params['sap_document_number'])->fetchOne();
     if (empty($params['id_purchase_order']) && !empty($params['sap_document_number'])) {
         $params['id_purchase_order'] = -1;
     }
     $warehouseEntryProductQuery = WarehouseEntranceProductQuery::create()->whereAdd(WarehouseEntranceProduct::ID_PURCHASE_ORDER, null, WarehouseEntranceProductQuery::NOT_EQUAL)->whereAdd(WarehouseEntranceProduct::STATUS, WarehouseEntranceProduct::$Status['Quarantine'], WarehouseEntranceProductQuery::EQUAL)->whereAdd(WarehouseEntranceProduct::ID_WAREHOUSE_ENTRANCE, $warehouseEntries->getPrimaryKeys(), WarehouseEntranceProductQuery::IN)->filter($params)->orderBy(WarehouseEntranceProduct::ID_WAREHOUSE_ENTRANCE, 'DESC')->findByPage($page, $this->getMaxPerPage());
     $purchaseOrderCollection = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $warehouseEntryProductQuery->getPurchaseOrderIds(), PurchaseOrderQuery::IN)->find();
     $purchaseOrderEntryCollection = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrderCollection->getPrimaryKeys(), PurchaseOrderEntryQuery::IN)->find();
     $i = 0;
     $this->getCatalog('QuarantineCatalog')->beginTransaction();
     while ($warehouseEntryLine = $warehouseEntryProductQuery->read()) {
         $warehouseEntry = WarehouseEntranceQuery::create()->whereAdd(WarehouseEntrance::ID_WAREHOUSE_ENTRANCE, $warehouseEntryLine->getIdWarehouseEntrance())->findOne();
         if (TransferLineLogQuery::create()->whereAdd(TransferLineLog::BASEENTRY, $warehouseEntryLine->getIdWarehouseEntrance())->whereAdd(TransferLineLog::BASELINE, $warehouseEntryLine->getIdWarehouseEntranceProduct())->count()) {
             $transferLine = TransferLineLogQuery::create()->whereAdd(TransferLineLog::BASEENTRY, $warehouseEntryLine->getIdWarehouseEntrance())->whereAdd(TransferLineLog::BASELINE, $warehouseEntryLine->getIdWarehouseEntranceProduct())->findOne();
             $warehouseEntryLines[$i]['warehouse'] = WarehouseStoreQuery::create()->whereAdd(WarehouseStore::CODE, $transferLine->getWhsCode())->findOne()->getName();
         } else {
             $warehouseEntryLines[$i]['warehouse'] = $this->i18n->_('Not Available');
         }
         $claimReport = $this->getClaimReport($warehouseEntryLine->getIdWarehouseEntrance(), $warehouseEntryLine->getIdWarehouseEntranceProduct());
         $folioImport = $this->getWarehouseEntryFolioImport($warehouseEntry->getIdFolioImport());
         $quarantine = $this->getQuarantine($warehouseEntryLine->getIdWarehouseEntrance(), $warehouseEntryLine->getIdWarehouseEntranceProduct());
         $product = ProductQuery::create()->findByPK($warehouseEntryLine->getIdProduct());
         $warehouseEntryLines[$i]['id_warehouse_entrance_product'] = $warehouseEntryLine->getIdWarehouseEntranceProduct();
         $warehouseEntryLines[$i]['id_warehouse_entrance'] = $warehouseEntry->getIdWarehouseEntrance();
         $warehouseEntryLines[$i]['id_folio_import'] = $folioImport->getIdFolioImport();
         $warehouseEntryLines[$i]['folio_import'] = $folioImport->getFolio();
         if (PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $warehouseEntryLine->getIdPurchaseOrder())->find()->count()) {
             $purchaseOrder = PurchaseOrderQuery::create()->findByPK($warehouseEntryLine->getIdPurchaseOrder());
         } else {
             $purchaseOrder = new PurchaseOrder();
         }
         $purchaseOrderEntry = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->whereAdd(PurchaseOrderEntry::LINE, (string) $warehouseEntryLine->getBaseLine())->findOneOrElse(new PurchaseOrderEntry());
         $proformaInvoice = ProformaInvoiceQuery::create()->whereAdd(ProformaInvoice::ID_PROFORMA_INVOICE, $purchaseOrderEntry->getBaseEntry())->findOneOrElse(new ProformaInvoice());
         $warehouseEntryLines[$i]['proforma_invoice'] = $proformaInvoice->getSapDocumentNumber();
         $warehouseEntryLines[$i]['purchase_order'] = $purchaseOrder->getSapDocumentNumber();
         $warehouseEntryLines[$i]['item_code'] = $product->getItemCode();
         $warehouseEntryLines[$i]['item_name'] = $product->getItemName();
         $warehouseEntryLines[$i]['original_quantity'] = $warehouseEntryLine->getQuantity();
         $warehouseEntryLines[$i]['current_quantity'] = $currentQuantity = $quarantine->getQuantity();
         if ($warehouseEntryLine->getLineStatus() == 'C') {
             // 				$warehouseEntryLines[$i]['cancelled'] = true;
             // 				$warehouseEntryLines[$i]['status'] = 'Cancelled';
             // 				$warehouseEntryLines[$i]['statusRow'] = ' ';
         } else {
             $warehouseEntryLines[$i]['cancelled'] = false;
             if (!$currentQuantity) {
                 $warehouseEntryLines[$i]['status'] = 'Debugged';
                 $warehouseEntryLines[$i]['statusRow'] = 'success';
             } else {
                 $warehouseEntryLines[$i]['status'] = $warehouseEntryLine->getStatusName();
                 $warehouseEntryLines[$i]['statusRow'] = 'warning';
             }
         }
         $warehouseEntryLines[$i]['quarantine'] = $warehouseEntryLine->getStatusName();
         $warehouseEntryLines[$i]['claimed_amount'] = $claimReport->getClaimedAmount();
         $warehouseEntryLines[$i]['final_amount'] = $claimReport->getFinalAmount();
         $warehouseEntryLines[$i]['claim_report_status'] = $claimReport->getStatusName();
         $warehouseEntryLines[$i]['allow_debug'] = TransferLineLogQuery::create()->whereAdd(TransferLineLog::BASEENTRY, $warehouseEntryLine->getIdWarehouseEntrance())->whereAdd(TransferLineLog::BASELINE, $warehouseEntryLine->getIdWarehouseEntranceProduct())->count();
         if ($warehouseEntryLine->getStatus() == WarehouseEntranceProduct::$Status['Quarantine']) {
             $quarantineProduct = $this->getQuarantine($warehouseEntryLine->getIdWarehouseEntrance(), $warehouseEntryLine->getIdWarehouseEntranceProduct());
             $warehouseEntryLines[$i]['initial_quantity'] = $quarantineProduct->getQuantity();
         }
         $i++;
     }
     $this->getCatalog('QuarantineCatalog')->commit();
     die(json_encode($warehouseEntryLines));
 }
Ejemplo n.º 5
0
 public function purchaseOrder(PurchaseOrder $purchaseOrder, PurchaseOrderEntryCollection $purchaseOrderEntries)
 {
     $proformaInvoicePk = $purchaseOrderEntries->getOne()->getBaseEntry() ? $purchaseOrderEntries->getOne()->getBaseEntry() : 0;
     if (ProformaInvoiceQuery::create()->whereAdd(ProformaInvoice::ID_PROFORMA_INVOICE, $purchaseOrderEntries->getOne()->getBaseEntry())->count()) {
         $proformaInvoice = ProformaInvoiceQuery::create()->findByPK($purchaseOrderEntries->getOne()->getBaseEntry());
     } else {
         $proformaInvoice = new ProformaInvoice();
     }
     $purchaseOrder->setIdDestinationCountry($proformaInvoice->getIdDestinationCountry());
     $parameters["purchaseOrderSachi"] = $purchaseOrder->toSAPArray();
     $parameters["purchaseOrderSachi"]["Lines"] = $purchaseOrderEntries->toSAPArray();
     // 		echo '<pre>';
     // 		print_r($parameters);
     // 		die;
     $this->createLogrequest($parameters);
     return $this->soapClient->purchaseOrder($parameters);
 }
Ejemplo n.º 6
0
 /**
  * This action convert a requisition to purchase order
  *
  * @author Erick Guevara Mart�nez
  * @return array
  * Created October 15th, 2012
  */
 public function createAction()
 {
     if ($this->getRequest()->isPost()) {
         //die("<pre>".print_r($this->getRequest()->getParams(), true));
         $folio = $this->getRequest()->getParam("folio");
         $comments = $this->getRequest()->getParam("comments");
         $lines = $this->getRequest()->getParam("line");
         foreach ($lines as $line) {
             if ($line["checked"]) {
                 $idProformaInvoice[] = $line["id_proforma_invoice"];
             }
         }
         $proformasInvoice = ProformaInvoiceQuery::create()->whereAdd(ProformaInvoice::ID_PROFORMA_INVOICE, $idProformaInvoice, ProformaInvoiceQuery::IN)->find();
         $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $proformasInvoice->getPrimaryKeys(), ProformaInvoiceEntryQuery::IN)->whereAdd(ProformaInvoiceEntry::STATUS, ProformaInvoiceEntry::$Status["End Production"])->find();
         $supplier = SapSupplierQuery::create()->findByPKOrThrow($proformasInvoice->current()->getIdSupplier(), $this->i18n->_("The Supplier with id {$proformasInvoice->current()->getIdSupplier()} does not exist"));
         $date = \Zend_Date::now();
         $purchaseOrder = PurchaseOrderFactory::createFromArray(array('id_purchase_order' => "0", 'id_supplier' => $supplier->getCardCode(), 'purchase_order_date' => $date->get("yyyy-MM-dd"), 'delivery_estimate_date' => $date->get("yyyy-MM-dd"), 'invoice_number' => $folio, 'id_currency' => $proformasInvoice->current()->getIdCurrency(), 'comments' => $comments, 'groupnum' => $supplier->getGroupnum(), 'status' => PurchaseOrder::$Status["New"], 'id_courtyard' => $proformasInvoice->current()->getIdCourtyard(), 'id_folio_import' => -1));
         $purchaseOrderEntries = new PurchaseOrderEntryCollection();
         $linesCount = 0;
         foreach ($lines as $line) {
             if ($line["checked"]) {
                 $proformaInvoiceEntry = $proformaInvoiceEntries->getByPK($line["line"]);
                 $purchaseOrderEntry = PurchaseOrderEntryFactory::createFromArray(array('id_purchase_order_entry' => "0", 'line' => $linesCount, "vis_order" => $linesCount, "id_product" => $proformaInvoiceEntry->getIdProduct(), "quantity" => $line["quantity"], "price" => $proformaInvoiceEntry->getPrice(), "id_warehouse_store" => $proformaInvoiceEntry->getIdWarehouseStore(), "tax_code" => $proformaInvoiceEntry->getTaxCode(), 'lead_time' => $proformaInvoiceEntry->getLeadTime(), 'status' => PurchaseOrderEntry::$Status["New"], 'base_line' => $proformaInvoiceEntry->getLine(), 'base_entry' => $proformaInvoiceEntry->getIdProformaInvoice()));
                 $purchaseOrderEntries->append($purchaseOrderEntry);
                 $linesCount++;
             }
         }
         $SAPConnectionClient = new SAPConnectorClient();
         $result = $SAPConnectionClient->purchaseOrder($purchaseOrder, $purchaseOrderEntries);
         if ($result->purchaseOrderResult->code == 200) {
             try {
                 $this->getPurchaseOrderCommercialInvoiceCatalog()->beginTransaction();
                 $filePath = "files/purchase-order/" . $result->purchaseOrderResult->id;
                 $uploadPath = 'public/' . $filePath;
                 $fileUploader = new FileUploader("commercial_invoice_file");
                 $fileUploader->saveFile($uploadPath, false);
                 $commercialInvoiceFile = PurchaseOrderFileFactory::createFromArray(array(PurchaseOrderFile::CONTENT => $filePath . $fileUploader->getFileName(), PurchaseOrderFile::TYPE => File::$typeFile["typeFile"], PurchaseOrderFile::DOCUMENT_TYPE => PurchaseOrderFile::$DocumentType["CommercialInvoice"], PurchaseOrderFile::ID_PURCHASE_ORDER => $result->purchaseOrderResult->id));
                 $this->getPurchaseOrderFileCatalog()->create($commercialInvoiceFile);
                 if ($_FILES["packing_list_file"]["name"] != "") {
                     $fileUploader = new FileUploader("packing_list_file");
                     $fileUploader->saveFile($uploadPath, false);
                     $packingListFile = PurchaseOrderFileFactory::createFromArray(array(PurchaseOrderFile::CONTENT => $filePath . $fileUploader->getFileName(), PurchaseOrderFile::TYPE => File::$typeFile["typeFile"], PurchaseOrderFile::DOCUMENT_TYPE => PurchaseOrderFile::$DocumentType["PackingList"], PurchaseOrderFile::ID_PURCHASE_ORDER => $result->purchaseOrderResult->id));
                     $this->getPurchaseOrderFileCatalog()->create($packingListFile);
                 }
                 $purchaseOrderCommercialInvoice = PurchaseOrderCommercialInvoiceFactory::createFromArray(array(PurchaseOrderCommercialInvoice::ID_PURCHASE_ORDER => $result->purchaseOrderResult->id, PurchaseOrderCommercialInvoice::COMMERCIAL_INVOICE_NUMBER => $folio));
                 $this->getPurchaseOrderCommercialInvoiceCatalog()->create($purchaseOrderCommercialInvoice);
                 $purchaseOrder = PurchaseOrderQuery::create()->findByPKOrThrow($purchaseOrderCommercialInvoice->getIdPurchaseOrder(), $this->i18n->_("The purchase order with id{$purchaseOrderEntry->getIdPurchaseOrder()} does not exist"));
                 $purchaseOrderEntries = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrderCommercialInvoice->getIdPurchaseOrder())->find();
                 $purchaseOrderPaymentManager = new PurchaseOrderPaymentsManager();
                 $purchaseOrderPaymentManager->createPaymentTerms($purchaseOrderEntries);
                 $docNum = PurchaseOrderQuery::create()->findByPK($result->purchaseOrderResult->id)->getSapDocumentNumber();
                 $this->setFlash('ok', $this->i18n->_("The purchase Order with DocNum {$docNum} was saved correctly"));
                 $this->newLogForCreate($purchaseOrder);
                 $this->newLogForUploadCI($purchaseOrder);
                 $this->getEventDispatcherService()->dispatchPurchaseOrderEvent($purchaseOrder, PurchaseOrderEvent::PURCHASEORDER_INSPECTION_PASSED, $purchaseOrderEntries);
                 $this->getEventDispatcherService()->dispatchPurchaseOrderEvent($purchaseOrder, PurchaseOrderEvent::PURCHASEORDER_CREATED, $purchaseOrderEntries);
                 $this->getPurchaseOrderCommercialInvoiceCatalog()->commit();
             } catch (Exception $e) {
                 $this->getPurchaseOrderCommercialInvoiceCatalog()->rollBack();
                 $this->setFlash('error', $this->i18n->_($e->getMessage()));
             }
         } else {
             $this->setFlash('error', $result->purchaseOrderResult->code . " - " . $result->purchaseOrderResult->message);
         }
     }
     $this->_redirect('purchase-order/list');
 }
Ejemplo n.º 7
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;
 }