/** * Apertura * * Abrir el periodo de pago */ public function apertura() { // Comenzar transaccion $this->db->trans_start(); $fecha_inicio = $this->input->post('fecha_inicio_periodo_pago'); // Crear una fecha de cierre // -Debe ser igual al ultimo dia del mes de la fecha de inicio $sql_fecha_inicio = to_sql($fecha_inicio); $str_fecha_inicio = strtotime($sql_fecha_inicio); $sql_fecha_cierre = date("Y-m-d", strtotime("last day of this month", $str_fecha_inicio)); $str_fecha_cierre = strtotime($sql_fecha_cierre); // Abrir periodo de pago $this->db->set('fecha_inicio_periodo_pago', $str_fecha_inicio); $this->db->set('fecha_final_periodo_pago', $str_fecha_cierre); $this->db->set('perioro_pago_abierto', TRUE); $this->db->set('fondo_horario', number_to_mysql($this->input->post('fondo_horario'))); $this->db->where('periodo_pago_id', 1); $this->db->update('periodo_pago'); // Terminar transaccion $this->db->trans_complete(); return $this->db->trans_status(); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { $this->db->set('fk_categoria_operario_id', $this->input->post('fk_categoria_operario_id')); $this->db->set('tarifa_menor', number_to_mysql($this->input->post('tarifa_menor'))); $this->db->set('tarifa_mayor', number_to_mysql($this->input->post('tarifa_mayor'))); $this->db->set('tarifa_completa', number_to_mysql($this->input->post('tarifa_completa'))); if ($this->input->post('tarifa_interrupcion')) { $this->db->set('tarifa_interrupcion', number_to_mysql($this->input->post('tarifa_interrupcion'))); } else { $this->db->set('tarifa_interrupcion', 0.0); } if ($this->input->post('tarifa_horario_escala')) { $this->db->set('tarifa_horario_escala', number_to_mysql($this->input->post('tarifa_horario_escala'))); } else { $this->db->set('tarifa_horario_escala', NULL); } $this->db->where('tarifa_pago_id', $id); return $this->db->update('tarifa_pago'); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { $this->db->set('codigo', $this->input->post('codigo')); $this->db->set('fk_lugar_carga_id', $this->input->post('fk_lugar_carga_id')); $this->db->set('fk_lugar_descarga_id', $this->input->post('fk_lugar_descarga_id')); $this->db->set('km_recorridos', number_to_mysql($this->input->post('km_recorridos'))); $this->db->set('PU', number_to_mysql($this->input->post('PU'))); $this->db->set('C', number_to_mysql($this->input->post('C'))); $this->db->set('A', number_to_mysql($this->input->post('A'))); $this->db->set('T', number_to_mysql($this->input->post('T'))); $this->db->set('CM', number_to_mysql($this->input->post('CM'))); $this->db->set('CT', number_to_mysql($this->input->post('CT'))); $this->db->set('TM', number_to_mysql($this->input->post('TM'))); $this->db->set('CV', number_to_mysql($this->input->post('CV'))); $this->db->where('carga_descarga_id', $id); return $this->db->update('carga_descarga'); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { // Comenzar transaccion $this->db->trans_start(); // Actualizar lugar de carga $this->db->set('lugar_carga', $this->input->post("lugar_carga")); $this->db->where('m_lugar_carga_id', $id); $this->db->update('m_lugar_carga'); // Eliminar todas las capacidades de bombeo para este lugar de carga $this->db->where('fk_lugar_carga_id', $id); $this->db->delete('capacidad_bombeo_lugar_carga'); // Agregar capacida de bombeo $arr_pro = $this->input->post('productos'); foreach ($arr_pro as $key => $value) { if ($value != "" && $value != 0.0) { $this->db->set('fk_producto_id', $key); $this->db->set('fk_lugar_carga_id', $id); $this->db->set('capacidad_bombeo', number_to_mysql($value)); $this->db->insert('capacidad_bombeo_lugar_carga'); } } // Terminar transaccion $this->db->trans_complete(); // Comprobar si la transaccion fue correcta return $this->db->trans_status(); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { // Comenzar transaccion $this->db->trans_start(); // Actualizar lugar de descarga $this->db->set('lugar_descarga', $this->input->post("lugar_descarga")); if ($this->input->post("capacidad_bombeo_turbina_cliente")) { $this->db->set('capacidad_bombeo_turbina_cliente', number_to_mysql($this->input->post("capacidad_bombeo_turbina_cliente"))); } if ($this->input->post("velocidad_media_a_k")) { $this->db->set("velocidad_media_a_k", number_to_mysql($this->input->post("velocidad_media_a_k"))); } if ($this->input->post("velocidad_media_d")) { $this->db->set("velocidad_media_d", number_to_mysql($this->input->post("velocidad_media_d"))); } $this->db->where('m_lugar_descarga_id', $id); $this->db->update('m_lugar_descarga'); // Eliminar la relacion de lugares de descarga y productos $this->db->where('fk_lugar_descarga_id', $id); $this->db->delete('lugar_descarga_producto'); // Agregar productos y lugares de descarga $productos = $this->input->post("productos"); $data = array(); foreach ($productos as $key => $value) { $data[] = array("fk_lugar_descarga_id" => $id, "fk_producto_id" => $value); } $this->db->insert_batch('lugar_descarga_producto', $data); // Terminar transaccion $this->db->trans_complete(); // Comprobar si la transaccion fue correcta return $this->db->trans_status(); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { $this->db->set('categoria', $this->input->post('categoria')); $this->db->set('nomenclador', strtoupper($this->input->post('nomenclador'))); $this->db->set('min_capacidad_carga', number_to_mysql($this->input->post('min_capacidad_carga'))); $this->db->set('max_capacidad_carga', number_to_mysql($this->input->post('max_capacidad_carga'))); $this->db->where('m_categoria_operario_id', $id); return $this->db->update('m_categoria_operario'); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { $this->db->set('clave', $this->input->post('clave')); $this->db->set('sigla', strtoupper($this->input->post('sigla'))); $this->db->set('valor', number_to_mysql($this->input->post('valor'))); $this->db->set('unidad_medida', $this->input->post('unidad_medida')); $this->db->where('m_claves_siscont_id', $id); return $this->db->update('m_claves_siscont'); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { $importe_viaje = 0; $importe_viaje_progresivo_incrementado = 0; $importe_viaje = $this->math->X($this->input->post('fk_capacidad_carga_id'), number_to_mysql($this->input->post('km_recorridos_carga')), $this->input->post('litros_entregados'), $this->input->post('fk_producto_id'), $this->input->post('fk_modo_descarga_id'), $this->input->post('fk_carga_descarga_id'), $this->input->post('numero_de_entregas'), $this->input->post('fk_operario_id')); $cumplimiento_norma = $this->math->Y($this->input->post('fk_operario_id'), $importe_viaje, number_to_mysql($this->input->post('horas_de_viaje'))); // Comenzar transaccion $this->db->trans_start(); // Obtener datos del periodo de pago $pp = $this->periodo_pago_m->get_all(); $fipp = $pp->fecha_inicio_periodo_pago; $ffpp = $pp->fecha_final_periodo_pago; // ENTRADA // Datos requeridos $this->db->set('fk_operario_id', $this->input->post('fk_operario_id')); $this->db->set('fecha_incidencia', to_sql($this->input->post('fecha_incidencia'))); $this->db->set('fecha_captacion', to_sql($this->input->post('fecha_captacion'))); $this->db->set('fecha_inicio_periodo_pago', $fipp); $this->db->set('fecha_final_periodo_pago', $ffpp); // Datos generales if ($this->input->post('fk_capacidad_carga_id')) { $this->db->set('fk_capacidad_carga_id', $this->input->post('fk_capacidad_carga_id')); } else { $this->db->set('fk_capacidad_carga_id', NULL); } if ($this->input->post('fk_producto_id')) { $this->db->set('fk_producto_id', $this->input->post('fk_producto_id')); } else { $this->db->set('fk_producto_id', NULL); } if ($this->input->post('hoja_de_ruta')) { $this->db->set('hoja_de_ruta', $this->input->post('hoja_de_ruta')); } else { $this->db->set('hoja_de_ruta', NULL); } // Vinculacion if ($this->input->post('fk_carga_descarga_id')) { $this->db->set('fk_carga_descarga_id', $this->input->post('fk_carga_descarga_id')); } else { $this->db->set('fk_carga_descarga_id', NULL); } if ($this->input->post('km_recorridos_carga')) { $this->db->set('km_recorridos_carga', number_to_mysql($this->input->post('km_recorridos_carga'))); } else { $this->db->set('km_recorridos_carga', NULL); } if ($this->input->post('litros_entregados')) { $this->db->set('litros_entregados', $this->input->post('litros_entregados')); } else { $this->db->set('litros_entregados', NULL); } if ($this->input->post('fk_modo_descarga_id')) { $this->db->set('fk_modo_descarga_id', $this->input->post('fk_modo_descarga_id')); } else { $this->db->set('fk_modo_descarga_id', NULL); } if ($this->input->post('horas_de_viaje')) { $this->db->set('horas_de_viaje', number_to_mysql($this->input->post('horas_de_viaje'))); } else { $this->db->set('horas_de_viaje', NULL); } if ($this->input->post('numero_de_viajes')) { $this->db->set('numero_de_viajes', $this->input->post('numero_de_viajes')); // Calcular destajo progresivo /*$destajo_progresivo = $this->math->R( $this->input->post('fk_capacidad_carga_id'), $this->input->post('numero_de_viajes'));*/ // Calcular destajo progresivo (incrementado 2014) $destajo_progresivo = $this->math->R1($this->input->post('fk_capacidad_carga_id'), $this->input->post('numero_de_viajes'), to_sql($this->input->post('fecha_incidencia')), $this->input->post('hoja_de_ruta'), true); if ($destajo_progresivo !== FALSE) { $importe_viaje_progresivo_incrementado = $destajo_progresivo; } } else { $this->db->set('numero_de_viajes', NULL); } if ($this->input->post('numero_de_entregas')) { $this->db->set('numero_de_entregas', $this->input->post('numero_de_entregas')); } else { $this->db->set('numero_de_entregas', NULL); } if ($this->input->post('pago_feriado')) { $this->db->set('pago_feriado', 1); } else { $this->db->set('pago_feriado', 0); } // Sin vinculacion if ($this->input->post('horas_ausencia')) { $this->db->set('horas_ausencia', number_to_mysql($this->input->post('horas_ausencia'))); } else { $this->db->set('horas_ausencia', NULL); } if ($this->input->post('fk_causa_ausencia_id')) { $this->db->set('fk_causa_ausencia_id', $this->input->post('fk_causa_ausencia_id')); } else { $this->db->set('fk_causa_ausencia_id', NULL); } if ($this->input->post('observaciones')) { $this->db->set('observaciones', $this->input->post('observaciones')); } else { $this->db->set('observaciones', ""); } if ($this->input->post('horas_interrupto')) { $this->db->set('horas_interrupto', number_to_mysql($this->input->post('horas_interrupto'))); } else { $this->db->set('horas_interrupto', NULL); } if ($this->input->post('horas_no_vinculado')) { $this->db->set('horas_no_vinculado', number_to_mysql($this->input->post('horas_no_vinculado'))); } else { $this->db->set('horas_no_vinculado', NULL); } if ($this->input->post('horas_nocturnidad_corta')) { $this->db->set('horas_nocturnidad_corta', number_to_mysql($this->input->post('horas_nocturnidad_corta'))); // Calcular cuantia horario para nocturnidad corta y almacenar dicho campo $chnc = $this->math->G("CHNC"); $chnc *= number_to_mysql($this->input->post('horas_nocturnidad_corta')); $this->db->set('cuantia_horaria_nocturnidad_corta', $chnc); } else { $this->db->set('horas_nocturnidad_corta', NULL); } if ($this->input->post('horas_nocturnidad_larga')) { $this->db->set('horas_nocturnidad_larga', number_to_mysql($this->input->post('horas_nocturnidad_larga'))); // Calcular cuantia horario para nocturnidad larga y almacenar dicho campo $chnl = $this->math->G("CHNL"); $chnl *= number_to_mysql($this->input->post('horas_nocturnidad_larga')); $this->db->set('cuantia_horaria_nocturnidad_larga', $chnl); } else { $this->db->set('horas_nocturnidad_larga', NULL); } if ($this->input->post('horas_capacitacion')) { $this->db->set('horas_capacitacion', number_to_mysql($this->input->post('horas_capacitacion'))); } else { $this->db->set('horas_capacitacion', NULL); } if ($this->input->post('horas_movilizacion')) { $this->db->set('horas_movilizacion', number_to_mysql($this->input->post('horas_movilizacion'))); } else { $this->db->set('horas_movilizacion', NULL); } if ($this->input->post('horas_feriado')) { $this->db->set('horas_feriado', number_to_mysql($this->input->post('horas_feriado'))); } else { $this->db->set('horas_feriado', NULL); } // Pago feriado if ($this->input->post('pago_feriado')) { // El importe debe pagarse doble $importe_viaje *= 2; $importe_viaje_progresivo_incrementado *= 2; } // Modo de descarga Turbina del equipo if ($this->input->post('fk_modo_descarga_id') && $this->input->post('fk_modo_descarga_id') == 5) { // El importe debe multiplicarse por el coeficiente CDTMA $cdtma = $this->math->G('CDTMA'); $importe_viaje *= $cdtma; $importe_viaje_progresivo_incrementado *= $cdtma; } // Importe del viaje $this->db->set('importe_viaje', $importe_viaje); $this->db->set('importe_viaje_progresivo_i', $importe_viaje_progresivo_incrementado); // Cumplimiento de la norma $this->db->set('cumplimiento_norma', $cumplimiento_norma); $this->db->where('entrada_id', $id); $this->db->update('entrada'); // Terminar transaccion $this->db->trans_complete(); return $this->db->trans_status(); }
/** * Editar * * Editar el elemento del modulo * @return bool */ public function editar($id = '') { // Comenzar transaccion $this->db->trans_start(); // Borrar capacidad bombeo segun capacidad de carga $this->db->where('fk_capacidad_carga_id', $id); $this->db->delete('capacidad_bombeo_equipo'); // Actualizar la capacidad de carga $this->db->set('fk_equipo_id', $this->input->post('fk_equipo_id')); if ($this->input->post('fk_cuna_id')) { $this->db->set('fk_cuna_id', $this->input->post('fk_cuna_id')); } else { $this->db->set('fk_cuna_id', NULL); } if ($this->input->post('viajes_promedio')) { $this->db->set('viajes_promedio', number_to_mysql($this->input->post('viajes_promedio'))); } if ($this->input->post('entregas_promedio')) { $this->db->set('entregas_promedio', number_to_mysql($this->input->post('entregas_promedio'))); } $this->db->set('capacidad_carga', number_to_mysql($this->input->post('capacidad_carga'))); $this->db->set('tipo_de_producto', $this->input->post('tipo_de_producto')); $this->db->where('m_capacidad_carga_id', $id); $this->db->update('m_capacidad_carga'); // Insertar capacidad de bombeo $capacidad_bombeo = $this->input->post('capacidad_bombeo'); if ($capacidad_bombeo) { foreach ($capacidad_bombeo as $key => $value) { $this->db->set('fk_capacidad_carga_id', $id); $this->db->set('fk_modo_descarga_id', $key); $this->db->set('capacidad_bombeo', number_to_mysql($value)); $this->db->insert('capacidad_bombeo_equipo'); } } // Terminar transaccion $this->db->trans_complete(); return $this->db->trans_status(); }