Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. public function getProductoBarcode($barcode,$aviso,$recibo){
  2.  
  3.  
  4.         $producto = MaestrobarCode::getProductoByBarcode($barcode);
  5.  
  6.  
  7.         if ($producto->codigo != ''){
  8.             $productoExiste = 1;
  9.  
  10.             $productoValido = CompAvisoDespachoDetalle::getDetalleByAviso($aviso, $producto->codigo, $producto->unidad_id);
  11.             $inspeccion = ReciboInspeccion::getByReciboCodigo($recibo,$producto->codigo);
  12.  
  13.             if( (int) $productoValido->id > 0 ) {
  14.  
  15.                 if ($inspeccion > 0){
  16.                     $inspeccionCount = 1;
  17.                 }else{
  18.                     $inspeccionCount = 0;
  19.                 }
  20.  
  21.                 $productoValidoRecepcion = 1;
  22.                 $cantidadInput = 1;
  23.  
  24.             }else{
  25.  
  26.                 $productoValido = CompAvisoDespachoDetalle::getDetalleByAviso($aviso, $producto->codigo);
  27.  
  28.  
  29.                 if( (int) $productoValido->id > 0 ) {
  30.  
  31.                     $producto_aviso = MaestroProducto::getProductoByCodigoUnidad($productoValido->codigo_producto,$productoValido->unidad_producto);
  32.  
  33.                     if( $producto_aviso->factor == $producto->factor ) {
  34.                         $cantidadInput = 1;
  35.                     }else {
  36.                         $cantidadInput = 2;
  37.                     }
  38.  
  39.                     $productoValidoRecepcion = 1;
  40.  
  41.  
  42.                 }else {
  43.                     $productoValidoRecepcion = 0;
  44.                 }
  45.                 $inspeccionCount = 0;
  46.             }
  47.         }else{
  48.             $productoExiste = 0;
  49.             $productoValidoRecepcion = 0;
  50.             $inspeccionCount = 0;
  51.         }
  52.  
  53.         return [
  54.             "producto" => $producto,
  55.             "productoExiste" => $productoExiste,
  56.             "productoValido" => $productoValidoRecepcion,
  57.             "cantidadInput" => $cantidadInput,
  58.             "inspeccionCount" => $inspeccionCount
  59.         ];
  60.  
  61.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement