DOCUMENTACIÓN OXIPRO
Manual de instrucciones - Base de Datos
 
×
Menú
Índice
 

3.1.6. bd_insumos_movimientos_ordenescompra

 
Nombre de la tabla en Redash:
bd_insumos_movimientos_ordenescompra
Nombre de la tabla en BD:
bd_insumos_movimientos_ordenescompra
Descripción del objetivo de la Tabla:
 
Tipo de tabla:
Maestra - diaria
Fecha versión actual:
-------------------------------------------------------------------------------
Declaración SQL:
SELECT        DATE_FORMAT(mvdes.mvdes_date, '%Y%m%d') AS `agno_mes_dia`,
    mvdes.mvdesid,
    mvdes.mvdes_date,
       mvdes.estadoinsumos,
       mvdes.tipoinsumo,
       prod.productname,
       DATE_FORMAT(mvdes.mvdes_date, '%Y%m') AS `agno_mes`,
       yearweek(mvdes.mvdes_date, 0) AS `agno_semana`,
       CASE
           WHEN crminfofuente.setype = 'Sedes' THEN
                  (SELECT vtiger_sedes.sede
                   FROM vtiger_sedes
                   WHERE vtiger_sedes.sedesid = crminfofuente.crmid )
           WHEN crminfofuente.setype = 'PacientesII' THEN
                  (SELECT vtiger_pacientesii.identificador_paciente
                   FROM vtiger_pacientesii
                   WHERE vtiger_pacientesii.pacientesiiid = crminfofuente.crmid )
           WHEN crminfofuente.setype = 'Vendors' THEN
                  (SELECT vtiger_vendor.vendorname
                   FROM vtiger_vendor
                   WHERE vtiger_vendor.vendorid = crminfofuente.crmid)
           WHEN crminfofuente.setype = 'PlanillasTrabajo' THEN
                  (SELECT vtiger_planillastrabajo.identificador
                   FROM vtiger_planillastrabajo
                   WHERE vtiger_planillastrabajo.planillastrabajoid = crminfofuente.crmid)
           WHEN crminfofuente.setype = 'ActivosRetornables' THEN
                  (SELECT vtiger_activosretornables.nombre_activo
                   FROM vtiger_activosretornables
                   WHERE vtiger_activosretornables.activosretornablesid = crminfofuente.crmid)
           ELSE 'Otro'
       END AS Origen,
                     CASE
           WHEN crminfodestino.setype = 'Sedes' THEN
                  (SELECT vtiger_sedes.sede
                   FROM vtiger_sedes
                   WHERE vtiger_sedes.sedesid = crminfodestino.crmid )
           WHEN crminfodestino.setype = 'PacientesII' THEN
                  (SELECT vtiger_pacientesii.identificador_paciente
                   FROM vtiger_pacientesii
                   WHERE vtiger_pacientesii.pacientesiiid = crminfodestino.crmid)
           WHEN crminfodestino.setype = 'Vendors' THEN
                  (SELECT vtiger_vendor.vendorname
                   FROM vtiger_vendor
                   WHERE vtiger_vendor.vendorid = crminfodestino.crmid)
           WHEN crminfodestino.setype = 'PlanillasTrabajo' THEN
                  (SELECT vtiger_planillastrabajo.identificador
                   FROM vtiger_planillastrabajo
                   WHERE vtiger_planillastrabajo.planillastrabajoid = crminfodestino.crmid)
           WHEN crminfodestino.setype = 'ActivosRetornables' THEN
                  (SELECT vtiger_activosretornables.nombre_activo
                   FROM vtiger_activosretornables
                   WHERE vtiger_activosretornables.activosretornablesid = crminfodestino.crmid)
           ELSE 'Otro'
       END AS Destino,
       mvdes.mvdes_cantidad
INNER JOIN vtiger_products prod ON mvdes.mvdes_equipo = prod.productid
INNER JOIN vtiger_crmentity crminfofuente ON mvdes.mvdes_fuente = crminfofuente.crmid
INNER JOIN vtiger_crmentity crminfodestino ON mvdes.mvdes_destino = crminfodestino.crmid
inner join vtiger_crmentity crmsoporte on mvdes.soporte = crmsoporte.crmid
where   mvdes.tipoinsumo LIKE "%PRO%" and crmsoporte.setype = 'PurchaseOrder'
Tablas involucradas:
  •  vtiger_movequiposdes (Movimiento de productos).
  •  vtiger_products (Productos).
  •  vtiger_crmentity (Datos de creación).
  •  vtiger_activosretornables (Equipos Electricos).
  •  vtiger_planillastrabajo (Planillas de trabajo).
Columnas involucradas:
  •  DATE_FORMAT(mvdes.mvdes_date, '%Y%m%d') (Fecha del movimiento, año, mes y dia).
  •  mvdes.mvdesid (ID del movimiento).
  •  mvdes.mvdes_date (Fecha del movimiento).
  •  mvdes.estadoinsumos (Estado de insumos).
  •  mvdes.tipoinsumo (Tipo de insumo).
  •  mvdes.movequiposdesid (ID del movimiento).
  •  prod.productname (Nombre del producto).
  •  DATE_FORMAT(mvdes.mvdes_date, '%Y%m') (Fecha del movimiento, año y mes).
  •  yearweek(mvdes.mvdes_date, 0) (Fecha del movimiento, año y semana).
  •  #01 (Soporte).
  •  #02 (Origen).
  •  #03 (Destino).
  •   mvdes.mvdes_cantidad (Cantidad).
Ubicación (URL) en Redash:
Ubicación (RUTA) en base de datos:
206.189.187.192/CRM/Tables/bd_

insumos_movimientos_

ordenescompra
Especificaciones técnicas de los campos involucrados:
Tiempo de ejecución CRON:
Todos los dias, a la 01:10 horas.