Пример #1
0
 /**
  * 
  * @return array
  */
 public function createAction()
 {
     extract($_POST);
     $folioImport = new FolioImport();
     $folioImport->setIdFolioImport($id_folio_import);
     $folioImport->setStatus(FolioImport::$Status['Assigned']);
     $this->getCatalog('FolioImportCatalog')->beginTransaction();
     try {
         $this->getCatalog('FolioImportCatalog')->update($folioImport);
     } catch (Exception $e) {
         print_r($folioImport->toArray());
         $this->getCatalog('FolioImportCatalog')->rollBack();
         die;
     }
     $booking = new Booking();
     $booking->setEta($eta);
     $booking->setEtaWarehouse($warehouse_eta);
     $booking->setEtd($etd);
     $booking->setTrackingNumber($tracking_number);
     $booking->setNameVessel($vessel_name);
     $booking->setCarrier($carrier);
     $booking->setContainerNumber($container_number);
     $booking->setCartons($cartons);
     $booking->setCubicMeters($bookingCbm);
     $booking->setWeight($bookingWeight);
     $booking->setSize($size);
     $booking->setIdFolioImport($id_folio_import);
     try {
         $this->getCatalog('BookingCatalog')->create($booking);
         //        	Notification for Compras about the invoices missing
         $this->getEventDispatcherService()->createBookingNotification($booking, BookingEvent::BOOKING_MISSING_INVOICE);
         //        	Notification for Compras about the BL Houses missing
         $this->getEventDispatcherService()->createBookingNotification($booking, BookingEvent::BOOKING_MISSING_BL_HOUSE);
         $folioImport = FolioImportQuery::create()->findByPK($booking->getIdFolioImport());
         $purchaseOrders = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_FOLIO_IMPORT, $folioImport->getIdFolioImport())->find();
         while ($purchaseOrders->valid()) {
             $purchaseOrder = $purchaseOrders->read();
             $this->getEventDispatcherService()->dispatchPurchaseOrderEvent($purchaseOrder, PurchaseOrderEvent::PURCHASEORDER_SHIPPED);
         }
     } catch (Exception $e) {
         echo 'booking';
         print_r($booking->toArray());
         $this->getCatalog('FolioImportCatalog')->rollBack();
         $this->setFlash('error', $this->i18n->_($this->CREATE_ERROR));
         $this->_redirect('folio-import/list');
     }
     $idBooking = $booking->getIdBooking();
     $itineraries = $this->getRequest()->getParam('itineraries');
     foreach ($itineraries as $value) {
         extract($value);
         $itinerary = new Itinerary();
         $itinerary->setIdBooking($idBooking);
         $itinerary->setOrigin($origin);
         $itinerary->setDestination($destination);
         $itinerary->setType($type);
         $itinerary->setDays($days);
         $itinerary->setEtd($etd);
         $itinerary->setEta($eta);
         try {
             $this->setFlash('ok', $this->i18n->_($this->CREATE_TRANSPORT_OK));
             $this->getCatalog('ItineraryCatalog')->create($itinerary);
         } catch (Exception $e) {
             $this->setFlash('error', $e);
             $this->getCatalog('ItineraryCatalog')->rollBack();
             $this->_redirect('folio-import/list');
         }
     }
     $this->setFlash('ok', $this->i18n->_($this->CREATE_OK));
     $this->getCatalog('FolioImportCatalog')->commit();
     $this->_redirect('folio-import/details/id/' . $id_folio_import);
 }
Пример #2
0
 /**
  * @return \Application\Model\Bean\FolioImportLog
  */
 private function newLog(FolioImport $folioImport, $eventType)
 {
     $now = \Zend_Date::now();
     $log = FolioImportLogFactory::createFromArray(array('id_folio_import' => $folioImport->getIdFolioImport(), 'id_user' => $this->getUser()->getBean()->getIdUser(), 'date_log' => $now->get('yyyy-MM-dd HH:mm:ss'), 'event_type' => $eventType, 'note' => ''));
     $this->getCatalog('FolioImportLogCatalog')->create($log);
     return $log;
 }
Пример #3
0
 private function createTaxesTable()
 {
     $border = false;
     $fill = false;
     $this->SetLineWidth(0.1);
     $this->SetFillColor(225, 225, 225);
     $cellHeight = $this->regularSize / 1.8;
     $customsValue = $this->totalCustomsValue;
     $totalIgi = $this->totalTariffMxp;
     $dta = $this->folioImport->getDta();
     // 		if ($this->getCurrency()=='MXN')
     $iva = ($customsValue + $totalIgi + $dta) * 0.16;
     // 		else
     // 			$iva = 0;
     $totalTaxes = $iva + $this->folioImport->getPrv() + $this->getAntidumpingDutyValues()->getTotalValue() + $this->folioImport->getRec() + $this->folioImport->getOtherCost() + $totalIgi + $dta;
     $this->SetFont($this->FontType, $this->titleStyle, $this->titleSize);
     $this->Cell(self::CellXXLarge, $cellHeight, 'Taxes Information', $border, 0, 'L');
     $this->Ln();
     $this->SetFont($this->FontType, $this->FontStyle, $this->regularSize);
     $this->Cell(self::CellMedium, $cellHeight, 'Customs Value', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($customsValue, 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'Total IGI', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($totalIgi, 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'CC Total', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($this->getAntidumpingDutyValues()->getTotalValue(), 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'DTA', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($dta, 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'IVA', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($iva, 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'PRV', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($this->folioImport->getPrv(), 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'REC', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($this->folioImport->getRec(), 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'Other Cost', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($this->folioImport->getOtherCost(), 4) . '', $border, 0, 'R');
     $this->Ln();
     $this->Cell(self::CellMedium, $cellHeight, 'Total Taxes', $border, 0, 'L');
     $this->Cell(self::CellLarge, $cellHeight, number_format($totalTaxes, 4) . '', $border, 0, 'R');
     $this->Ln();
 }