コード例 #1
0
ファイル: ExpTicket.php プロジェクト: ahumadamob/siris
 /**
  * Get Ticket Corte Caja
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @param \Tesoreria\Models\Registracion $objRegistracion
  * @return \Siris\Models\Ticket[]
  */
 public static function getTicketCorteCaja($serviceLocator, $objRegistracion = null)
 {
     self::init($serviceLocator);
     $usuario = $objRegistracion->getUsuario();
     $usuarioAprobador = $objRegistracion->getUsuarioAutorizador();
     $fechaHora = explode(" ", $objRegistracion->getFechaSistema());
     $fecha = date("d-m-Y", strtotime($fechaHora[0]));
     $fecha = str_replace("-", "/", $fecha);
     $hora = explode(":", $fechaHora[1]);
     $hora = $hora[0] . ":" . $hora[1];
     $nroTrx = str_pad($objRegistracion->getNroTrxTerminal(), 9, "0", STR_PAD_LEFT);
     $montoTotal = number_format($objRegistracion->getMonto(), 0, ",", ".");
     $hash = chunk_split($objRegistracion->getHashControl(), 5, ' ');
     $terminal = $objRegistracion->getEntidad($serviceLocator);
     $condicionCorte = 'origen = ' . $terminal->getId();
     $resultSetFajos = ExpStoresProcedures::findItems($serviceLocator, Constants::MA_BA_FAJOS, $condicionCorte);
     $last = end($resultSetFajos);
     $nroCorte = $last->nro_corte;
     $cantFajos = number_format($last->it_cantidad, 2, ",", ".");
     $montoPorFajo = number_format($last->monto, 2, ",", ".");
     $destino = self::$maestroBaseDao->getById($last->owner);
     $nroAgencia = $terminal->getPadre($serviceLocator)->getCodigo();
     $nroTerminal = $terminal->getCodigo();
     $texto[] = "             CORTE DE CAJA              ";
     $texto[] = "";
     $texto[] = "Nro.Agencia  " . $nroAgencia . "  -  Nro.Terminal  " . $nroTerminal;
     $texto[] = "";
     $texto[] = "Fecha           Hora         Transaccion";
     $texto[] = $fecha . "      " . $hora . "          " . $nroTrx;
     $texto[] = "Usuario:  " . $usuario;
     $texto[] = "Usuario aprobador:  " . $usuarioAprobador;
     $texto[] = "========================================";
     $texto[] = "Nro. Corte:       " . $nroCorte;
     $texto[] = "Tipo:             Efectivo              ";
     //TODO: cambiara cuando se agregue el corte por cheques
     $texto[] = "Cant. Fajos:      " . $cantFajos;
     $texto[] = "Pesos por fajo:   \$" . $montoPorFajo;
     $texto[] = "Destino:          " . $destino->getNombre();
     $texto[] = "";
     $texto[] = "TOTAL EFECTIVO:   \$" . $montoTotal;
     $texto[] = "";
     $texto[] = "Control:  " . $hash;
     $texto[] = "========================================";
     $ticket = new Ticket();
     $ticket->texto = $texto;
     return array($ticket);
 }