function respaldo($tables = '*') { $return = ''; $this->loadModel('Nomina'); $nomina = new Nomina(); $modelName = $nomina; $dataSource = $nomina->getDataSource(); $databaseName = $dataSource->getSchemaName(); // Do a short header $return .= '-- Database: `' . $databaseName . '`' . "\n"; $return .= '-- Generation time: ' . date('D jS M Y H:i:s') . "\n\n\n"; if ($tables == '*') { $tables = array(); $result = $nomina->query('SHOW TABLES'); foreach ($result as $resultKey => $resultValue) { $tables[] = current($resultValue['TABLE_NAMES']); } } else { $tables = is_array($tables) ? $tables : explode(',', $tables); } // Run through all the tables foreach ($tables as $table) { $tableData = $nomina->query('SELECT * FROM ' . $table); $return .= 'DROP TABLE IF EXISTS ' . $table . ';'; $createTableResult = $nomina->query('SHOW CREATE TABLE ' . $table); $createTableEntry = current(current($createTableResult)); $return .= "\n\n" . $createTableEntry['Create Table'] . ";\n\n"; // Output the table data foreach ($tableData as $tableDataIndex => $tableDataDetails) { $return .= 'INSERT INTO ' . $table . ' VALUES('; foreach ($tableDataDetails[$table] as $dataKey => $dataValue) { if (is_null($dataValue)) { $escapedDataValue = 'NULL'; } else { // Convert the encoding $escapedDataValue = mb_convert_encoding($dataValue, "UTF-8", "ISO-8859-1"); // Escape any apostrophes using the datasource of the model. $escapedDataValue = $nomina->getDataSource()->value($escapedDataValue); } $tableDataDetails[$table][$dataKey] = $escapedDataValue; } $return .= implode(',', $tableDataDetails[$table]); $return .= ");\n"; } $return .= "\n\n\n"; } // Set the default file name $fileName = $databaseName . '-backup-' . date('Y-m-d_H-i-s') . '.sql'; // Serve the file as a download $this->autoRender = false; $this->response->type('Content-Type: text/x-sql'); $this->response->download($fileName); $this->response->body($return); }
function GetDetail($CfdiPath) { $CfdiType = $this->GetCfdiType($CfdiPath); if (strcasecmp($CfdiType, "0") == 0) { echo "\n Xml desconocido " . basename($CfdiPath); return 0; } switch ($CfdiType) { /* Factura de Proveedor/Cliente */ case 'Factura': return Proveedor::GetDetail($CfdiPath); case 'Nomina': return Nomina::GetDetail($CfdiPath); default: return 0; } }
$t_lph = 0; $t_inasistencia = 0; $t_descuento = 0; $t_deducciones = 0; $t_neto = 0; ?> <?php $criteria = new CDbCriteria(); $criteria->condition = 'fecha=:fecha'; $criteria->params = array(':fecha' => $model); $criteria->with = array('obra'); $criteria->order = 'obra.nombre_obra'; $model2 = Nomina::model()->findAll($criteria); //print_r($model2); foreach ($model2 as $data) { ?> <?php ?> <?php echo $data->empleado->nro_cuenta != "" ? '<tr>' : '<tr bgcolor="yellow">'; ?> <td><?php echo $data->obra->nombre_obra; ?> </td> <td><?php echo $data->persona->nombre . ' ' . $data->persona->apellido; ?>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Nomina the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Nomina::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function pdfNomina($mes, $quincena) { Configure::write('debug', 2); $this->loadModel('Empleado'); $this->loadModel('Nomina'); $empleado = new Empleado(); $nomina = new Nomina(); $this->set('nominas', $nomina->find('all', array('conditions' => array('Nomina.mes' => $mes, 'Nomina.quincena' => $quincena)))); }
$respuesta = array('raiz' => $arreglo); $respuesta = json_encode($respuesta); echo $respuesta; } $datos->Close(); } else { $arreglo[0]['mensaje'] = obtenerMensaje('OPERACION_FALLIDA'); $arreglo[0]['valido'] = false; $respuesta = array('raiz' => $arreglo); $respuesta = json_encode($respuesta); echo $respuesta; } unset($objConfiguracion); break; case 'obtenerDatosNomina': $objNomina = new Nomina(); $objNomina->codemp = $_SESSION['la_empresa']['codemp']; $objNomina->servidor = $_SESSION['sigesp_servidor']; $objNomina->usuario = $_SESSION['sigesp_usuario']; $objNomina->clave = $_SESSION['sigesp_clave']; $objNomina->basedatos = $_SESSION['sigesp_basedatos']; $objNomina->gestor = $_SESSION['sigesp_gestor']; $objNomina->tipoconexionbd = 'ALTERNA'; $datos = $objNomina->leer(); if ($objNomina->valido) { if (!$datos->EOF) { $varJson = generarJson($datos); echo $varJson; } else { $arreglo[0]['codsis'] = ''; $arreglo[0]['valido'] = true;
function actualizarNomina() { global $conexionbd; $consulta = "UPDATE sno_nomina " . " SET anocurnom = '" . substr($this->fecinimen, 0, 4) . "', " . " fecininom = '" . $this->fecinisem . "'," . " peractnom = '001' " . " WHERE codemp = '{$this->codemp}' " . " AND tippernom = 0 " . " AND codnom = '" . $this->valornuevo . "'"; $result = $conexionbd->Execute($consulta); $consulta = "UPDATE sno_nomina " . " SET anocurnom = '" . substr($this->fecinimen, 0, 4) . "', " . " fecininom = '" . $this->fecinimen . "'," . " peractnom = '001' " . " WHERE codemp = '{$this->codemp}' " . " AND tippernom <> 0 " . " AND codnom = '" . $this->valornuevo . "'"; $result = $conexionbd->Execute($consulta); $result->Close(); $objNomina = new Nomina(); $objNomina->codemp = $this->codemp; $objNomina->codnom = $this->valornuevo; $objNomina->tippernom = $this->tippernom; $objNomina->fecininom = $this->fecinimen; if ($this->tippernom == 0) { $objNomina->fecininom = $this->fecinisem; } $objNomina->generarPeriodos(); }