/**
  * 
  * 
  * @author Erick Guevara Martínez
  * @param PurchaseOrderEntryCollection $purchaseOrderEntries
  * @param PurchaseOrderPaymentTermCatalog $paymentTermCatalog
  * @return \Application\Model\Collection\PurchaseOrderPaymentTermCollection
  */
 public function createPaymentTerms(PurchaseOrderEntryCollection $purchaseOrderEntries)
 {
     $proformaInvoiceEntriesQuery = ProformaInvoiceEntryQuery::create();
     $proformaInvoiceEntriesQuery->where()->setOR();
     while ($purchaseOrderEntries->valid()) {
         $purchaseOrderEntry = $purchaseOrderEntries->read();
         $where = "(" . ProformaInvoiceEntry::ID_PROFORMA_INVOICE . " = " . $purchaseOrderEntry->getBaseEntry() . " AND " . ProformaInvoiceEntry::LINE . " = " . $purchaseOrderEntry->getBaseLine() . ")";
         $proformaInvoiceEntriesQuery->whereAdd("", null, null, $where, BaseQuery::AS_FIELD);
     }
     $purchaseOrderEntries->rewind();
     $proformaInvoiceEntries = $proformaInvoiceEntriesQuery->find();
     $PIPaymentTerms = ProformaInvoicePaymentTermQuery::create()->whereAdd(ProformaInvoicePaymentTerm::ID_PROFORMA_INVOICE_ENTRY, $proformaInvoiceEntries->getPrimaryKeys())->find();
     $POPaymentTerms = new PurchaseOrderPaymentTermCollection();
     while ($purchaseOrderEntries->valid()) {
         $purchaseOrderEntry = $purchaseOrderEntries->read();
         $proformaInvoiceEntry = $proformaInvoiceEntries->getByIdProformaInvoiceAndLine($purchaseOrderEntry->getBaseEntry(), $purchaseOrderEntry->getBaseLine());
         $paymentTerms = $PIPaymentTerms->filterByProformaInvoiceEntry($proformaInvoiceEntry);
         while ($paymentTerms->valid()) {
             $paymentTerm = $paymentTerms->read();
             $payment = $purchaseOrderEntry->getQuantity() * $paymentTerm->getPayment() / $paymentTerm->getPieces();
             $POPaymentTerm = PurchaseOrderPaymentTermFactory::createFromArray(array(PurchaseOrderPaymentTerm::AMOUNT => $payment, PurchaseOrderPaymentTerm::CURRENCY => $purchaseOrderEntry->getCurrency(), PurchaseOrderPaymentTerm::ID_EVENT => $paymentTerm->getIdEvent(), PurchaseOrderPaymentTerm::ID_PURCHASE_ORDER => $purchaseOrderEntry->getIdPurchaseOrder(), PurchaseOrderPaymentTerm::ID_PURCHASE_ORDER_ENTRY => $purchaseOrderEntry->getIdPurchaseOrderEntry(), PurchaseOrderPaymentTerm::ID_PROFORMA_INVOICE_PAYMENT_TERM => $paymentTerm->getIdProformaInvoicePayment(), PurchaseOrderPaymentTerm::LINE => $purchaseOrderEntry->getLine(), PurchaseOrderPaymentTerm::PIECES => $purchaseOrderEntry->getQuantity(), PurchaseOrderPaymentTerm::STATUS => PurchaseOrderPaymentTerm::$Status["Active"]));
             $this->getPurchaseOrderPaymentTermsCatalog()->create($POPaymentTerm);
             $POPaymentTerms->append($POPaymentTerm);
         }
     }
     return $POPaymentTerms;
 }
예제 #2
0
 public function updatePaymentEntriesIdsAction()
 {
     $paymentTerms = ProformaInvoicePaymentTermQuery::create()->whereAdd(ProformaInvoicePaymentTerm::ID_PROFORMA_INVOICE_ENTRY, "", ProformaInvoicePaymentTermQuery::IS_NULL)->find();
     $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->find();
     $proformaInvoiceProgrammedPayments = ProformaInvoiceProgrammedPaymentQuery::create()->whereAdd(ProformaInvoiceProgrammedPayment::ID_PROFORMA_INVOICE_ENTRY, "", ProformaInvoiceProgrammedPaymentQuery::IS_NULL)->find();
     $this->getProformaInvoicePaymentTermCatalog()->beginTransaction();
     try {
         while ($paymentTerms->valid()) {
             $paymentTerm = $paymentTerms->read();
             $proformaInvoiceEntry = $proformaInvoiceEntries->getByIdProformaInvoiceAndLine($paymentTerm->getIdProformaInvoice(), $paymentTerm->getLine());
             if ($proformaInvoiceEntry->getIdProformaInvoiceEntry() > 0) {
                 $paymentTerm->setIdProformaInvoiceEntry($proformaInvoiceEntry->getIdProformaInvoiceEntry());
                 $this->getProformaInvoicePaymentTermCatalog()->update($paymentTerm);
                 $programmedPayments = $proformaInvoiceProgrammedPayments->filterByPaymentTerm($paymentTerm);
                 while ($programmedPayments->valid()) {
                     $programmedPayment = $programmedPayments->read();
                     $programmedPayment->setIdProformaInvoiceEntry($proformaInvoiceEntry->getIdProformaInvoiceEntry());
                     $this->getProformaInvoiceProgrammedPaymentCatalog()->update($programmedPayment);
                 }
             }
         }
         $this->getProformaInvoicePaymentTermCatalog()->commit();
         die("FIN");
     } catch (Exception $e) {
         die("<pre>" . print_r($e, true));
     }
 }
 /**
  *
  * @param int $idPurchaseOrder
  * @param int $idEvent
  */
 private function getMissingPurchaseInformation($idPurchaseOrder, $idEvent)
 {
     $purchaseOrder = PurchaseOrderQuery::create()->findByPKOrThrow($idPurchaseOrder, $this->i18n->_("PurchaseOrder with id {$idPurchaseOrder} not found."));
     $supplier = SapSupplierQuery::create()->findByPKOrThrow($purchaseOrder->getIdSupplier(), $this->i18n->_("SapSupplier with id {$purchaseOrder->getIdSupplier()} not found."));
     $event = EventQuery::create()->findByPKOrThrow($idEvent, $this->i18n->_("Event with id {$idEvent} not found."));
     $purchaseOrderEntries = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->find();
     $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $purchaseOrderEntries->getDisctinctProformaInvoiceIds())->find();
     $paymentTerms = PurchaseOrderPaymentTermQuery::create()->whereAdd(PurchaseOrderPaymentTerm::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->whereAdd(ProformaInvoicePaymentTerm::ID_EVENT, $event->getIdEvent())->find();
     $purchasePayments = new PurchaseOrderProgrammedPaymentCollection();
     while ($purchaseOrderPaymentTerm = $paymentTerms->read()) {
         $purchaseOrderMissingProgrammedPayment = PurchaseOrderProgrammedPaymentFactory::createFromArray(array('id_purchase_order_programmed_payment' => 'VPOPP' . $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'id_proforma_invoice_payment_term' => $purchaseOrderPaymentTerm->getIdProformaInvoicePaymentTerm(), 'id_purchase_order_payment_term' => $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'pieces' => $purchaseOrderPaymentTerm->getPieces(), 'id_purchase_order' => $purchaseOrderPaymentTerm->getIdPurchaseOrder(), 'line' => $purchaseOrderPaymentTerm->getLine(), 'id_purchase_order_entry' => $purchaseOrderPaymentTerm->getIdPurchaseOrderEntry(), 'id_programmed_payment' => 'VPP' . $purchaseOrderPaymentTerm->getIdPurchaseOrderPaymentTerm(), 'id_currency' => $purchaseOrderPaymentTerm->getCurrency(), 'id_company' => $purchaseOrder->getIdSupplier(), 'type' => ProgrammedPayment::$TypePayment['PurchaseOrder'], 'ammount' => $purchaseOrderPaymentTerm->getAmount(), 'folio' => 'Not Available', 'due_date' => 'Not Available', 'status' => ProgrammedPayment::$TypeStatus['Virtual']));
         $purchasePayments->append($purchaseOrderMissingProgrammedPayment);
     }
     $response = array("docNum" => $purchaseOrder->getSapDocumentNumber(), "docEntry" => $purchaseOrder->getIdPurchaseOrder(), "createDate" => $purchaseOrder->getDeliveryEstimateDate(), "supplier" => $supplier->getCardCode(), "supplierName" => $supplier->getCardname(), "event" => $event->getName());
     while ($purchaseOrderEntries->valid()) {
         $purchaseOrderEntry = $purchaseOrderEntries->read();
         $proformaInvoiceEntry = $proformaInvoiceEntries->getByIdProformaInvoiceAndLine($purchaseOrderEntry->getBaseEntry(), $purchaseOrderEntry->getBaseLine());
         $programmedPayment = $purchasePayments->filterByPurchaseOrderEntry($purchaseOrderEntry)->getOne();
         $response["entries"][] = array("line" => $purchaseOrderEntry->getLine(), "product" => $purchaseOrderEntry->getIdProduct(), "quantity" => $purchaseOrderEntry->getQuantity(), "price" => $purchaseOrderEntry->getPrice(), "currency" => $purchaseOrderEntry->getCurrency(), "requisitions" => implode($proformaInvoiceEntry->getRequisitionIdsToArray()), "PI_Line" => $purchaseOrderEntry->getBaseEntry() . "/" . $purchaseOrderEntry->getBaseLine(), "ammount" => $programmedPayment->getAmmount(), "credits" => 0, "pendingBalance" => $programmedPayment->getAmmount());
     }
     return $response;
 }
 /**
  * 
  * @return \Application\Model\Collection\ProformaInvoiceEntryCollection
  */
 public function getProformaInvoiceEntryCollection()
 {
     if (!$this->proformaInvoiceEntryCollection instanceof ProformaInvoiceEntryCollection) {
         $this->proformaInvoiceEntryCollection = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $this->getPurchaseOrderEntryCollection()->getDisctinctProformaInvoiceIds())->find();
     }
     return $this->proformaInvoiceEntryCollection;
 }
예제 #5
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');
 }
예제 #6
0
 /**
  *
  * @return array
  */
 public function updateAction()
 {
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         $idProformaInvoice = $params['id_proforma_invoice'];
         $filePrePro = '2';
         $fileDuPro = '3';
         $filePreShip = '4';
         try {
             $this->getInspectionCatalog()->beginTransaction();
             $inspection = InspectionQuery::create()->findByPK($params['id_inspection']);
             InspectionFactory::populate($inspection, $params);
             if ($inspection->getResult() == 1 || $inspection->getResult() == 4) {
                 $inspection->setStatus(Inspection::$Status["Inactive"]);
             } else {
                 if ($inspection->getResult() == 2) {
                     $inspection->setStatus(Inspection::$Status["Rescheduled"]);
                 }
             }
             $date = new Zend_Date();
             $inspection->setDateOn($date->get('Y-M-d'));
             $this->getInspectionCatalog()->update($inspection);
             $this->newLogForUpdate($inspection);
             if ($params['id_inspection_type'] == $filePrePro) {
                 $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry());
             }
             if ($params['id_inspection_type'] == $fileDuPro) {
                 $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry());
             }
             if ($params['id_inspection_type'] == $filePreShip) {
                 $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry());
             }
             $proformaInvoiceEntry = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $inspection->getIdProformaInvoice())->whereAdd(ProformaInvoiceEntry::LINE, $inspection->getIdProformaInvoiceEntry())->findOne();
             $this->getInspectionCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("The inspection has been updated"));
         } catch (Exception $e) {
             $this->getInspectionCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('inspection/rate/id/' . $inspection->getIdProformaInvoice() . "/idLine/" . $inspection->getIdProformaInvoiceEntry());
 }
예제 #7
0
 public function zoomInAction()
 {
     if ($this->getRequest()->isPost()) {
         $keyMother = $this->getRequest()->getParam("key_mother");
         $itemCode = $this->getRequest()->getParam("item_code");
         $products = ProductQuery::create()->find();
         $keyMotherProducts = $products->filterByKeyMother($keyMother);
         $restock = RestockQuery::create()->findOne();
         $allRestockEntries = RestockEntryQuery::create()->find();
         $restockEntries = $allRestockEntries->filterByArrayIdProduct($keyMotherProducts->getPrimaryKeys());
         $freightTypes = FreightTypeQuery::create()->actives()->find();
         $restockFinalResultsManager = new RestockFinalResultsManager($allRestockEntries, $products);
         $product = $products->getByPK($itemCode);
         $restockAbcClass = RestockAbcClassQuery::create()->find();
         $freightFares = FreightFareQuery::create()->find();
         $freightFare = $freightFares->getByPK($product->getDefaultFreightFare());
         $fobPort = PortCustomQuery::create()->findByPKOrElse($freightFare->getFobPort(), new PortCustom());
         $fobPortFreightFares = $freightFares->filterByFobPort($fobPort);
         $freightTypeList = $freightTypes->containsIndex($freightFare->getIdFreightType()) ? $freightTypes->getByPK($freightFare->getIdFreightType()) : new FreightType();
         if ($product->getIdSupplier() != "") {
             $supplier = SapSupplierQuery::create()->findByPK($product->getIdSupplier());
         } else {
             $supplier = new SapSupplier();
         }
         $keyMotherInfo["keyMother"] = $product->getKeyMother();
         $keyMotherInfo["PurchaseKeyMother"] = $restockFinalResultsManager->getTotalPurchaseByKeyMother($keyMother);
         $keyMotherInfo["catalog"] = $product->getCodPro();
         $keyMotherInfo["port"] = $fobPort->getName();
         $keyMotherInfo["freightList"] = $freightTypeList->getName();
         $keyMotherInfo["supplier"] = $supplier->getCardCode() . " - " . $supplier->getCardname();
         $keyMotherInfo["supplierPurchase"] = $restockFinalResultsManager->getTotalPurchaseByIdSupplier($supplier->getIdSupplier());
         $keyMotherInfo["fobPortPurchase"] = $restockFinalResultsManager->getTotalByIdFreigthFare($fobPortFreightFares->getPrimaryKeys());
         while ($restockEntries->valid()) {
             $restockEntry = $restockEntries->read();
             $product = $products->getByPK($restockEntry->getIdProduct());
             $restockInfo[$restockEntry->getIndex()]["idRestockEntry"] = $restockEntry->getIdRestockEntry();
             $restockInfo[$restockEntry->getIndex()]["mcParts"] = $product->getMcParts();
             $restockInfo[$restockEntry->getIndex()]["volume"] = $product->getVolume();
             $restockInfo[$restockEntry->getIndex()]["status"] = $product->getStatus();
             $restockInfo[$restockEntry->getIndex()]["itemCode"] = $product->getItemCode();
             $restockInfo[$restockEntry->getIndex()]["name"] = $product->getItemName();
             $restockInfo[$restockEntry->getIndex()]["onStock"] = $restockEntry->getInvRelat();
             $restockInfo[$restockEntry->getIndex()]["VIM"] = $product->getIndividualVim();
             $restockInfo[$restockEntry->getIndex()]["VIMMin"] = $restockEntry->getVimMin();
             $restockInfo[$restockEntry->getIndex()]["VIMMax"] = $restockEntry->getVimMax();
             $restockInfo[$restockEntry->getIndex()]["newQuantityMin"] = $restockEntry->getNewQuantityMin();
             $restockInfo[$restockEntry->getIndex()]["newImportMin"] = $restockEntry->getPriceMin();
             $restockInfo[$restockEntry->getIndex()]["newQuantityMax"] = $restockEntry->getNewQuantityMax();
             $restockInfo[$restockEntry->getIndex()]["newImportMax"] = $restockEntry->getPriceMax();
             $restockInfo[$restockEntry->getIndex()]["coverMin"] = $restockEntry->getMinCoverPercent();
             $restockInfo[$restockEntry->getIndex()]["coverMax"] = $restockEntry->getMaxCoverPercent();
             $restockInfo[$restockEntry->getIndex()]["ABCMin"] = $restockAbcClass->getByPK($restockEntry->getAbcMix())->getName();
             $restockInfo[$restockEntry->getIndex()]["desition"] = $restockEntry->getDesitionName();
             $restockInfo[$restockEntry->getIndex()]["lastFOB"] = $product->getCost();
             $restockInfo[$restockEntry->getIndex()]["targetFOB"] = $restockEntry->getMinTargetPrice();
             $restockInfo[$restockEntry->getIndex()]["quantityPurchase"] = $restockEntry->getPurchaseQuantity();
             $restockInfo[$restockEntry->getIndex()]["importPurchase"] = $restockEntry->getPurchasePrice();
             $restockInfo[$restockEntry->getIndex()]["quantityPercent"] = $restockEntry->getPurchaseQuantityPercernt();
             $restockInfo[$restockEntry->getIndex()]["importPercent"] = $restockEntry->getPurchasePricePercent();
             $restockInfo[$restockEntry->getIndex()]["quantitySetted"] = $restockEntry->getQuantity();
             $restockInfo[$restockEntry->getIndex()]["purchaseSetted"] = $restockFinalResultsManager->getTotalCartonsByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["importPurchaseSetted"] = $restockFinalResultsManager->getPurchaseSettedByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["isManual"] = $product->isManual();
             $restockInfo[$restockEntry->getIndex()]["cbm"] = $totalVolume = $restockFinalResultsManager->getTotalVolumeByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["suggestedFreight"] = implode(" / ", $freightTypes->getSuggestedFreights($totalVolume)->toCombo());
             $restockInfo[$restockEntry->getIndex()]["checked"] = $restockEntry->getChecked();
         }
         $requisitionEntries = RequisitionEntryQuery::create()->whereAdd(RequisitionEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), RequisitionEntryQuery::IN)->whereAdd(RequisitionEntry::STATUS, array(RequisitionEntry::$Status["Closed"], RequisitionEntry::$Status["Canceled"], RequisitionEntry::$Status["Inactive"]), RequisitionEntryQuery::NOT_IN)->find()->toArrayForZoomIn();
         $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), ProformaInvoiceEntryQuery::IN)->whereAdd(ProformaInvoiceEntry::LINE_STATUS, ProformaInvoiceEntry::$LineStatus["Open"])->find()->toArrayForZoomIn();
         $purchaseOrderEntries = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), PurchaseOrderEntryQuery::IN)->whereAdd(PurchaseOrderEntry::LINE_STATUS, PurchaseOrderEntry::$LineStatus["Open"])->find()->toArrayForZoomIn();
         $documents = array_merge(array_merge($requisitionEntries, $proformaInvoiceEntries), $purchaseOrderEntries);
         $currencies = CurrencyQuery::create()->find()->toArray();
         die(Zend_Json::encode(array("keyMother" => $keyMotherInfo, "restock" => $restockInfo, "documents" => $documents, "currecies" => $currencies)));
     }
 }