Esempio n. 1
0
function getStandardReportData($filterHeaderArray, $outputType)
{
    $daoHandler = new DAO();
    require_once APP_BASEPATH . "/includes/Entities/Task/TaskCore.php";
    require_once APP_BASEPATH . "/includes/Entities/User/UserCore.php";
    require_once APP_BASEPATH . "/includes/Entities/FlowSettings/FlowSettingsCore.php";
    require_once APP_BASEPATH . "/includes/Entities/RequestMetadata/RequestMetadataCore.php";
    require_once $_SESSION["environment_path"] . "/customcode/RecepcionDocumentos/includes/Entities/DocumentoCabecera/DocumentoCabeceraCore.php";
    require_once $_SESSION["environment_path"] . "/customcode/RecepcionDocumentos/includes/Entities/DocumentoLinea/DocumentoLineaCore.php";
    require_once $_SESSION["environment_path"] . "/customcode/RecepcionDocumentos/includes/Entities/DistribucionCabecera/DistribucionCabeceraCore.php";
    require_once $_SESSION["environment_path"] . "/customcode/RecepcionDocumentos/includes/Entities/DistribucionLinea/DistribucionLineaCore.php";
    $flowSettingsHandler = new FlowSettingsCore();
    $handlerTaskCore = new TaskCore();
    $handlerRequestMetadataCore = new RequestMetadataCore();
    $flow = $_SESSION["user_flow"];
    $step = $flowSettingsHandler->getSettingValue($_SESSION["user_flow"], "RDE_STEP_PROC_CONTABLE");
    $sql = "select\t\tCONCAT(docc.estab, '-', docc.ptoEmi, '-', docc.secuencial) documento,\r\n\t\t\t\t\t\t\tdocc.fechaEmision fecha,\r\n\t\t\t\t\t\t\tdocc.tipo_doc,\r\n\t\t\t\t            docc.ruc ruc, \r\n\t\t\t\t            docc.razonSocial nombre,\r\n\t\t\t\t            docc.ef_id ef_id\r\n\r\n\t\t\t\tfrom \t\trde_documento docc\r\n\t\t\t\twhere \t\t?\r\n\t\t\t\tand \t\tdocc.tipo_doc = 'FAC' \t";
    // Build filters
    foreach ($filterHeaderArray as $headerRecord) {
        if ($headerRecord["field_filtered"] == 1) {
            if ($headerRecord["field_data_type"] != "date") {
                $sql .= " AND " . $headerRecord["field_filter_string"] . " BETWEEN " . $headerRecord["field_min"] . " AND " . $headerRecord["field_max"] . " ";
            } else {
                $start_date = $headerRecord["field_min"] . " 00:00:00";
                $end_date = $headerRecord["field_max"] . " 23:59:59";
            }
        }
    }
    $daoHandler->resetDAO();
    $daoHandler->setQuery($sql);
    $daoHandler->setParameter('i', 1);
    $reportData = $daoHandler->executeQuery();
    foreach ($reportData as &$record) {
        $record["numero_oc"] = $handlerRequestMetadataCore->getVariable($record["ef_id"], "RDE-NUMERO-OC");
        unset($record["ef_id"]);
    }
    return $reportData;
}
Esempio n. 2
0
function crearSolicitudTarea($tipo, $id, $fecha_inicio, $fecha_fin, $titulo, $descripcion, $encargado, $prioridad, $proyeccion, $url)
{
    LogController::logWebServiceIn('Llamada a web service: ' . __FILE__ . ' - ' . __FUNCTION__, compact('tipo', 'id', 'fecha_inicio', 'fecha_fin', 'titulo', 'descripcion', 'encargado', 'prioridad', 'proyeccion', 'url'));
    $returnMessage = "";
    $handlerAttachmentCore = new AttachmentCore();
    $handlerRequestCore = new RequestCore();
    $handlerUserCore = new UserCore();
    $handlerFlowSettingsCore = new FlowSettingsCore();
    // Tomar datos de aprobador
    $flow = Flow::find(FLOW_TAREAS);
    $creador = User::find($encargado);
    if ($creador) {
        $jefe = User::find($creador->user_reports_to);
        if (!$jefe) {
            $jefe = User::find($flow->flow_administrator);
        }
        // Crear solicitud
        $request_flow = $flow->flow_id;
        $request_id = $handlerRequestCore->getLastGeneralRequestId() + 1;
        $inner_request_id = $handlerRequestCore->getLastGeneralRequestId($request_flow) + 1;
        $request_name = "Aprobación: " . $titulo;
        $request_description = "Aprobación de tarea: " . $descripcion;
        $request_createdby = $creador->user_id;
        $request_assignedto = $jefe->user_id;
        $handlerRequestCore->createNewRequest($request_id, $inner_request_id, $request_flow, $request_name, $request_description, $request_createdby, $request_assignedto);
        Tarea::create(["ef_id" => $request_id, "ext_id" => $id, "tipo" => $tipo, "titulo" => $titulo, "descripcion" => $descripcion, "encargado" => $request_createdby, "aprobador_1" => $request_assignedto, "aprobador_2" => "", "fecha_inicio" => $fecha_inicio, "fecha_fin" => $fecha_fin, "prioridad" => $prioridad, "proyeccion" => $proyeccion]);
        RequestMetadataCore::set($request_id, "APR-DOBLE-APROBACION", "No");
        RequestMetadataCore::set($request_id, "APR-APROBADO", "No");
        RequestMetadataCore::set($request_id, "APR-COMENTARIO", "");
        //Tomar archivo de campo url y adjuntar
        if ($url != '') {
            $tmpFileName = basename($url);
            file_put_contents($tmpFileName, fopen($url, 'r'));
            $filetype = FlowSettingsCore::get($request_flow, "APR_FILE_ADJUNTO");
            $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetype, dirname(__FILE__) . "/" . $tmpFileName, $_SESSION["environment_path"], "admin", "Adjunto de tarea");
        }
    } else {
        $returnMessage = "ERROR: Usuario " . $encargado . " no existe en BPM. Imposible continuar";
    }
    return $returnMessage;
}
Esempio n. 3
0
function crearDocumentoYSolicitud($arrayCabecera, $arrayLineas, $tmpString, $rideContent, $rideExtension, $fullXml)
{
    $handlerRequestCore = new RequestCore();
    $handlerAttachmentCore = new AttachmentCore();
    $handlerRequestMetadataCore = new RequestMetadataCore();
    // Verificar el usuario creador / al que se asignará
    $creator = Responsable::whereRuc($arrayCabecera['ruc'])->lists('responsable')->implode(',');
    if (empty($creator)) {
        $creator = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_DEF_ASIGNACION");
    }
    if ($arrayCabecera["tipo_doc"] == "FAC") {
        $customStep = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_STEP_FACTURAS");
    } else {
        $customStep = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_STEP_OTROS");
        $creator = '';
    }
    // Crear solicitud por cada proveedor
    $request_flow = FLOW_RECEPCIONDOCUMENTOS;
    $request_id = $handlerRequestCore->getLastGeneralRequestId() + 1;
    $inner_request_id = $handlerRequestCore->getLastGeneralRequestId($request_flow) + 1;
    $request_name = $request_description = $arrayCabecera["tipo_doc"] . " - " . $arrayCabecera["razonSocial"];
    $request_createdby = "admin";
    $request_id = $handlerRequestCore->createNewRequest($request_id, $inner_request_id, $request_flow, $request_name, $request_description, $request_createdby, $creator, $customStep);
    // Crear documento
    $arrayCabecera['ef_id'] = $request_id;
    $documento = Documento::create($arrayCabecera);
    // Setear id_documento en líneas e insertar
    foreach ($arrayLineas as &$linea) {
        $linea['id_documento'] = $documento->id;
        DocumentoLinea::create($linea);
    }
    // Guardar archivos temporales en disco
    $xmlFile = dirname(__FILE__) . "/facturas/tmpAttachments/tmp.xml";
    $pdfFile = dirname(__FILE__) . "/facturas/tmpAttachments/tmp." . $rideExtension;
    $filetypeXml = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_FILE_XML");
    $filetypePdf = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_FILE_PDF");
    //file_put_contents($xmlFile, $tmpString);
    file_put_contents($xmlFile, $fullXml);
    $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetypeXml, $xmlFile, $_SESSION["environment_path"], "admin", "Documento XML");
    if (!empty($rideExtension) && !empty($rideContent)) {
        file_put_contents($pdfFile, $rideContent);
        $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetypePdf, $pdfFile, $_SESSION["environment_path"], "admin", "Documento PDF");
    }
    // Setear variables de solicitud
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-TIPO-DOCUMENTO", $arrayCabecera["tipo_doc"]);
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-NUM-DOCUMENTO", $arrayCabecera["estab"] . "-" . $arrayCabecera["ptoEmi"] . "-" . $arrayCabecera["secuencial"]);
    $handlerRequestMetadataCore->setVariable($request_id, "RDE-NOMBRE-PROVEEDOR", $arrayCabecera["razonSocial"]);
}
Esempio n. 4
0
function requisicionFinalizada($requestId)
{
    $messageArray = array("message_value" => "Solicitud finalizada con éxito!", "message_type" => "success");
    $request = Request::find($requestId);
    // Enviar mails
    $emails = [];
    $user = User::find(Request::find($requestId)->request_createdby);
    if ($user) {
        if (filter_var($user->user_email, FILTER_VALIDATE_EMAIL)) {
            $emails[] = ['email' => $user->user_email];
        }
    }
    $user = User::find(\RequestMetadataCore::get($requestId, "ADQ-APROBADOR-REQUISICION"));
    if ($user) {
        if (filter_var($user->user_email, FILTER_VALIDATE_EMAIL)) {
            $emails[] = ['email' => $user->user_email];
        }
    }
    $subject = "AVISO: Requisición finalizada";
    $requisicion = Requisicion::where('ef_id', $requestId)->first();
    MailController::sendGeneralMail($emails, $subject, view('Adquisiciones.Emails.requisicion_cancelada', compact('request', 'requisicion')));
    return $messageArray;
}
Esempio n. 5
0
require_once APP_BASEPATH . "/includes/Entities/User/UserCore.php";
require_once APP_BASEPATH . "/includes/Entities/Task/TaskCore.php";
require_once APP_BASEPATH . "/includes/Entities/Request/RequestCore.php";
require_once APP_BASEPATH . "/includes/Entities/RequestMetadata/RequestMetadataCore.php";
require_once APP_BASEPATH . "/includes/Entities/FlowSettings/FlowSettingsCore.php";
require_once APP_BASEPATH . "/includes/Entities/Attachment/AttachmentCore.php";
require_once APP_BASEPATH . "/includes/Entities/Filetype/FiletypeCore.php";
require_once $_SESSION["environment_path"] . "/customcode/Reclamos/includes/Entities/General/GeneralCore.php";
require_once $_SESSION["environment_path"] . "/customcode/Reclamos/includes/Entities/Clase/ClaseCore.php";
require_once $_SESSION["environment_path"] . "/customcode/Reclamos/includes/Entities/Reclamo/ReclamoCore.php";
require_once $_SESSION["environment_path"] . "/customcode/Reclamos/includes/Entities/ReclamoDetalle/ReclamoDetalleCore.php";
define("CURRENT_FLOW", "1");
$handlerRequestCore = new RequestCore();
$handlerReclamoCore = new ReclamoCore();
$handlerReclamoDetalleCore = new ReclamoDetalleCore();
$handlerRequestMetadataCore = new RequestMetadataCore();
$handlerFlowSettingsCore = new FlowSettingsCore();
$handlerAttachmentCore = new AttachmentCore();
$handlerFiletypeCore = new FiletypeCore();
$handlerGeneralCore = new GeneralCore();
$handlerClaseCore = new ClaseCore();
if ($_POST["cliente_pais"] == "ECU") {
    $tipo = "venta_local";
    $creador = $handlerFlowSettingsCore->getSettingValue(CURRENT_FLOW, "REC_PRO_USUARIO_VL");
    $asignado_a = $handlerFlowSettingsCore->getSettingValue(CURRENT_FLOW, "REC_PRO_USUARIO_VL");
} else {
    $tipo = "exportacion";
    $creador = $handlerFlowSettingsCore->getSettingValue(CURRENT_FLOW, "REC_PRO_USUARIO_EXP");
    $asignado_a = $handlerFlowSettingsCore->getSettingValue(CURRENT_FLOW, "REC_PRO_USUARIO_EXP");
}
$customStep = "";
 public function seleccionarCotizacionAjax()
 {
     $input = Request::createFromGlobals();
     // Poner la seleccionada en estado 'Recibido'
     $seleccionada = Cotizacion::with('lineas')->whereIdOrdencompra($input->id_ordencompra)->whereEstado('S')->first();
     if ($seleccionada) {
         if ($seleccionada->id != $input->id) {
             $seleccionada->estado = 'R';
             $seleccionada->save();
         }
     }
     // Seleccionar la línea nueva
     $cotizacion = Cotizacion::with('ordencompra.clase', 'lineas')->find($input->id);
     $cotizacion->estado = $cotizacion->estado == 'R' ? 'S' : 'R';
     $cotizacion->save();
     // Seleccionar aprobador
     $valor = $cotizacion->lineas->max('valor_con_descuento');
     // Colocar primer aprobador como default
     $reglas_aprobacion = explode(',', $cotizacion->ordencompra->clase->aprobador_ordencompra);
     $aprobador_array = explode('|', $reglas_aprobacion[0]);
     $aprobador = $aprobador_array[1];
     foreach ($reglas_aprobacion as $regla_aprobacion) {
         $regla_array = explode('|', $regla_aprobacion);
         if ($valor > $regla_array[0]) {
             $aprobador = $regla_array[1];
         }
     }
     // Setear metadato
     RequestMetadataCore::set($input->ef_id, 'ADQ-APROBADOR-ORDENCOMPRA', $aprobador);
 }
Esempio n. 7
0
function getHtmlDistribucion($cabeceraRecord)
{
    $handlerTaskCore = new TaskCore();
    $handlerUserCore = new UserCore();
    $flowSettingsHandler = new FlowSettingsCore();
    $handlerDocumentoCabeceraCore = new DocumentoCabeceraCore();
    $handlerDocumentoLineaCore = new DocumentoLineaCore();
    $handlerDistribucionCabeceraCore = new DistribucionCabeceraCore();
    $handlerDistribucionLineaCore = new DistribucionLineaCore();
    $handlerRequestMetadataCore = new RequestMetadataCore();
    $cabeceraData = $handlerDocumentoCabeceraCore->getRecordById($cabeceraRecord["id"]);
    $lineasData = $handlerDocumentoLineaCore->getRecordsByFieldFilter(array(array("field" => "id_documento", "type" => "i", "value" => $cabeceraRecord["id"])));
    $numero_req = $handlerRequestMetadataCore->getVariable($cabeceraRecord["ef_id"], "RDE-NUMERO-REQ");
    $numero_oc = $handlerRequestMetadataCore->getVariable($cabeceraRecord["ef_id"], "RDE-NUMERO-OC");
    $reclamo_seguro = $handlerRequestMetadataCore->getVariable($cabeceraRecord["ef_id"], "RDE-RECLAMO-SEGURO");
    $comentarios = $handlerRequestMetadataCore->getVariable($cabeceraRecord["ef_id"], "RDE-COMENTARIO");
    $dataPasosAprobador1 = $handlerTaskCore->getTaskDataByRequestFlowStep($cabeceraRecord["ef_id"], $_SESSION["user_flow"], $flowSettingsHandler->getSettingValue($_SESSION["user_flow"], "RDE_STEP_APROBACION_1"));
    $dataPasosAprobador2 = $handlerTaskCore->getTaskDataByRequestFlowStep($cabeceraRecord["ef_id"], $_SESSION["user_flow"], $flowSettingsHandler->getSettingValue($_SESSION["user_flow"], "RDE_STEP_APROBACION_2"));
    $aprobador1 = "";
    $aprobador2 = "";
    if (count($dataPasosAprobador1) > 0) {
        $dataAprobador1 = $handlerUserCore->getUserData($dataPasosAprobador1[0]["task_assignedto"]);
        $aprobador1 = $dataAprobador1["user_name"];
    }
    if (count($dataPasosAprobador2) > 0) {
        $dataAprobador2 = $handlerUserCore->getUserData($dataPasosAprobador2[0]["task_assignedto"]);
        $aprobador2 = $dataAprobador2["user_name"];
    }
    $lineasHtml = "";
    foreach ($lineasData as $linea) {
        $distribucionLineaHtml = '';
        if ($cabeceraRecord["tipo_distribucion"] == "detallada") {
            $lineasDistribucionData = $handlerDistribucionLineaCore->getRecordsByFieldFilter(array(array("field" => "id_documento_linea", "type" => "i", "value" => $linea["id"])));
            foreach ($lineasDistribucionData as $lineaDist) {
                $distribucionLineaHtml .= $lineaDist["cc_id"] . '  : ' . $lineaDist["porcentaje"] . '% ($ ' . number_format($lineaDist["valor_distribuido"], 2, '.', '') . ')<br />';
            }
        }
        $lineasHtml .= '<tr>';
        $lineasHtml .= '<td>' . $linea["descripcion"] . '</td>';
        $lineasHtml .= '<td>' . number_format($linea["cantidad"], 2, '.', '') . '</td>';
        $lineasHtml .= '<td>$ ' . number_format($linea["precioUnitario"], 2, '.', '') . '</td>';
        $lineasHtml .= '<td>' . $distribucionLineaHtml . '</td>';
        $lineasHtml .= '<td>$ ' . number_format($linea["precioTotalSinImpuesto"], 2, '.', '') . '</td>';
        $lineasHtml .= '</tr>';
    }
    $lineasHtml .= '<tr>
                            <td colspan="4" class="subtitle" style="text-align: right; background-color: #eee;">Subtotal IVA 12%</td>
                            <td>$ ' . number_format($cabeceraData["subtotalIva12"], 2, '.', '') . '</td>
                        </tr>';
    $lineasHtml .= '<tr>
                            <td colspan="4" class="subtitle" style="text-align: right; background-color: #eee;">IVA 12%</td>
                            <td>$ ' . number_format($cabeceraData["subtotalIva12"], 2, '.', '') . '</td>
                        </tr>';
    $lineasHtml .= '<tr>
                            <td colspan="4" class="subtitle" style="text-align: right; background-color: #eee;">Subtotal IVA 0%</td>
                            <td>$ ' . number_format($cabeceraData["subtotalIva0"], 2, '.', '') . '</td>
                        </tr>';
    $lineasHtml .= '<tr>
                            <td colspan="4" class="subtitle" style="text-align: right; background-color: #eee;">Subtotal Sin IVA</td>
                            <td>$ ' . number_format($cabeceraData["subtotalSinIva"], 2, '.', '') . '</td>
                        </tr>';
    $lineasHtml .= '<tr>
                            <td colspan="4" class="subtitle" style="text-align: right; background-color: #eee;">Importe Total</td>
                            <td>$ ' . number_format($cabeceraData["importeTotal"], 2, '.', '') . '</td>
                        </tr>';
    $distribucionGlobalHtml = '';
    if ($cabeceraData["distribucion"] == "global") {
        $cabeceraDistribucionData = $handlerDistribucionCabeceraCore->getRecordsByFieldFilter(array(array("field" => "id_documento", "type" => "i", "value" => $cabeceraData["id"])));
        if (count($cabeceraDistribucionData) > 0) {
            $distribucionGlobalHtml .= '<h3>Distribución global</h3> 
                                            <table style="width: 100%;">
                                                <tr style="background-color: #ddd;">
                                                    <td class="strong centered subtitle" style="width: 70%; font-weight: bold;">Centro de costo</td>
                                                    <td class="strong centered subtitle" style="width: 15%; font-weight: bold;">Porcentaje</td>
                                                    <td class="strong centered subtitle" style="width: 15%; font-weight: bold;">Valor distribuido</td>
                                                </tr>';
            foreach ($cabeceraDistribucionData as $cabecera) {
                $distribucionGlobalHtml .= '<tr>';
                $distribucionGlobalHtml .= '<td style="width: 70%;">' . $cabecera["cc_id"] . ' - ' . $cabecera["cc_nombre"] . '</td>';
                $distribucionGlobalHtml .= '<td style="width: 15%;">' . $cabecera["porcentaje"] . '</td>';
                $distribucionGlobalHtml .= '<td style="width: 15%;">$ ' . number_format($cabecera["valor_distribuido"], 2, '.', '') . '</td>';
                $distribucionGlobalHtml .= '</tr>';
            }
            $distribucionGlobalHtml .= ' </table>';
        }
    }
    $html = '	<table style="width: 100%;">
						<tr>
	                        <td><strong>Tipo: </strong></td>
	                        <td>Factura</td>
	                        <td><strong>Número: </strong></td>
	                        <td>' . $cabeceraRecord["factura"] . '</td>
	                        <td><strong>Fecha: </strong></td>
	                        <td>' . $cabeceraRecord["fecha"] . '</td>
	                    </tr>
	                    <tr>
	                        <td><strong>Proveedor: </strong></td>
	                        <td>' . $cabeceraRecord["proveedor"] . '</td>
	                        <td><strong>N° requisición: </strong></td>
	                        <td>' . $numero_req . '</td>
	                        <td><strong>N° orden de compra: </strong></td>
	                        <td>' . $numero_oc . '</td>
	                    </tr>

	                    <tr>
	                        <td><strong>Comentarios: </strong></td>
	                        <td colspan="5">' . $comentarios . '</td>
	                    </tr>

	                    <tr>
	                        <td colspan="6" class="unbordered">&nbsp;</td>
	                    </tr>
	                    <tr>
	                        <td colspan="6">
	                            
	                            <h3>Detalles de documento</h3>

	                            <table style="width: 100%;">
	                                <tr style="background-color: #ddd;">
	                                    <td><strong>Descripción</strong></td>
	                                    <td style="width: 10%;"><strong>Cantidad</strong></td>
	                                    <td style="width: 10%;"><strong>V. Uni</strong>.</td>
	                                    <td><strong>Distribución</strong></td>
	                                    <td style="width: 10%;"><strong>Total</strong></td>
	                                </tr>
	                                ' . $lineasHtml . '
	                            </table>

	                            <br /> 

	                            ' . $distribucionGlobalHtml . '

	                            <br /> 

	                        </td>
	                    </tr>
	                    <tr>
	                        <td colspan="6" class="unbordered">&nbsp;</td>
	                    </tr>
	                </table>

					';
    return $html;
}
 /**
  * Actualiza los datos de la requisición
  * @return type
  */
 public function actualizarRequisicion()
 {
     $input = Request::createFromGlobals();
     $aprobado = 'No';
     foreach ($input->lineas as $linea) {
         RequisicionLinea::find($linea['id'])->update(['cantidad' => $linea['cantidad'], 'observacion_aprobador' => $linea['observacion_aprobador'], 'estado' => $linea['estado']]);
         if ($linea['estado'] == 'A') {
             $aprobado = 'Si';
         }
     }
     \RequestMetadataCore::set($input->ef_id, "ADQ-REQ-APROBADA", $aprobado);
 }
Esempio n. 9
0
 public function updateReclamo()
 {
     $input = Request::createFromGlobals();
     $flow = Flow::find(FLOW_RECLAMOS);
     $reclamo = Reclamo::find($input->id);
     $reclamo->update(['reclamo_clase' => $input->reclamo_clase, 'reclamo_region' => $input->reclamo_region, 'reclamo_descripcion' => $input->reclamo_descripcion, 'contacto_nombre' => $input->contacto_nombre, 'contacto_telefono' => $input->contacto_telefono, 'contacto_email' => $input->contacto_email, 'visita_requiere' => $input->visita_requiere, 'visita_descripcion' => $input->visita_descripcion, 'visita_responsable' => $input->visita_responsable, 'visita_fecha' => $input->visita_fecha, 'analisis_descripcion' => $input->analisis_descripcion, 'analisis_responsable' => $input->analisis_responsable, 'analisis_fecha' => $input->analisis_fecha, 'decision_decision' => $input->decision_decision, 'decision_monto' => $input->decision_monto, 'decision_descripcion' => $input->decision_descripcion, 'decision_responsable' => $input->decision_responsable, 'decision_fecha' => $input->decision_fecha, 'nc_descripcion' => $input->nc_descripcion, 'nc_responsable' => $input->nc_responsable, 'nc_fecha' => $input->nc_fecha]);
     // Actualizar cantidad y lote de líneas
     foreach ($input->lineas as $linea) {
         ReclamoDetalle::find($linea['id'])->update(['cantidad_reclamo' => $linea['cantidad_reclamo'], 'lote_reclamo' => $linea['lote_reclamo']]);
     }
     // Traer usuario responsable
     $responsable_id = $flow->flow_administrator;
     $rules = json_decode(\FlowSettingsCore::get(FLOW_RECLAMOS, "REC_PRO_REGLAS_RESPONSABLE"));
     foreach ($rules as $clase) {
         if ($clase->clase == $reclamo->reclamo_clase) {
             foreach ($clase->responsables as $responsable) {
                 if ($responsable->region == $reclamo->reclamo_region) {
                     $responsable_id = $responsable->responsable;
                     break;
                 }
             }
         }
     }
     // Traer usuario aprobador
     $aprobador_id = $flow->flow_administrator;
     $monto = !empty($reclamo->decision_monto) ? $reclamo->decision_monto : 0;
     $rules = json_decode(\FlowSettingsCore::get(FLOW_RECLAMOS, "REC_PRO_REGLAS_MONTOS"));
     foreach ($rules as $clase) {
         if ($clase->clase == $reclamo->reclamo_clase) {
             foreach ($clase->regiones as $region) {
                 if ($region->region == $reclamo->reclamo_region) {
                     foreach ($region->aprobadores as $aprobador) {
                         if ($monto >= $aprobador->monto) {
                             $aprobador_id = $aprobador->aprobador;
                         }
                     }
                 }
             }
         }
     }
     \RequestMetadataCore::set($reclamo->ef_id, "REC-USUARIO-SEGUIMIENTO", $responsable_id);
     \RequestMetadataCore::set($reclamo->ef_id, "REC-USUARIO-APROBACION", $aprobador_id);
 }