/** * Обновляет справочник банков, используя указанный файл или файл из папки data. * * Необходимо расширение dbase. Установить расширение dbase можно так: sudo pecl install dbase * * @param null $file * @return int */ public function actionIndex($file = null) { if (!extension_loaded('dbase')) { $this->stdout("Для работы скрипта обновления необходимо установить расширение dbase\n", Console::FG_RED); return 1; } if ($file === null) { $file = Yii::getAlias(dirname(__FILE__) . '/../data/bnkseek.dbf'); } else { $file = Yii::getAlias($file); } if (!file_exists($file)) { $this->stdout("Файл {$file} не найден!\n", Console::FG_RED); return 1; } if ($this->confirm("Обновить справочник банков России, используя файл {$file}?")) { $this->stdout('Выполняю обновление...' . "\n"); $db = dbase_open($file, 0); if (!$db) { $this->stdout("Не удалось открыть файл как базу данный dbase!\n", Console::FG_RED); return 1; } $current_db_records_count = Bank::find()->count(); $data_records_count = dbase_numrecords($db); $data_updated = false; $this->stdout("Количество банков в текущем справочнике - {$current_db_records_count}.\n"); $this->stdout("Количество банков в файле - {$data_records_count}.\n"); for ($i = 1; $i <= $data_records_count; $i++) { $rec = dbase_get_record_with_names($db, $i); /** @var Bank $model */ $model = Yii::createObject(['class' => Bank::className(), 'bik' => $rec["NEWNUM"], 'okpo' => $rec["OKPO"], 'full_name' => iconv('CP866', 'utf-8', $rec["NAMEP"]), 'short_name' => iconv('CP866', 'utf-8', $rec["NAMEN"]), 'ks' => $rec["KSNP"], 'city' => iconv('CP866', 'utf-8', $rec["NNP"]), 'zip' => (int) $rec["IND"], 'address' => iconv('CP866', 'utf-8', $rec["ADR"]), 'tel' => iconv('CP866', 'utf-8', $rec["TELEF"])]); foreach ($model->getAttributes() as $key => $value) { $model->{$key} = trim($value); } /** @var Bank $exist */ $exist = Bank::findOne($model->bik); if (!$exist) { $this->stdout("Добавлен новый банк: {$model->bik} {$model->short_name}\n"); $data_updated = true; $model->save(false); } else { if ($exist->getAttributes() != $model->getAttributes()) { $exist->setAttributes($model->getAttributes()); $this->stdout("Обновлены данные банка: {$exist->bik} {$exist->short_name}\n"); $data_updated = true; $exist->save(false); } } } dbase_close($db); if ($data_updated) { $this->stdout('Справочник банков успешно обновлен!' . "\n", Console::FG_GREEN); } else { $this->stdout('В справочник банков не было внесено изменений.' . "\n", Console::FG_GREEN); } } return 0; }
public function __destruct() { if ($this->shp) { fclose($this->shp); } if ($this->dbf) { dbase_close($this->dbf); } }
function subedbff($file = 'TRABAJAD.DBF') { //nota:hay que modificar el upload_max_file_size=100M del php.ini //nota:cambiar el tamanano de pres.nacinal a 15 caracteres //nota:cambiar tamano de carg.descrip a tamano de 100 set_time_limit(3600); $this->load->dbforge(); $this->load->dbutil(); $filea = explode('.', $file); $name = $filea[0]; $ext = $filea[1]; $uploadsdir = getcwd() . '/uploads/'; $filedir = $uploadsdir . $file; $tabla = strtoupper($ext . $name); if (extension_loaded('dbase')) { $db = dbase_open($filedir, 0); $this->dbforge->drop_table($tabla); if ($db) { $cols = dbase_numfields($db); $rows = dbase_numrecords($db); $row = dbase_get_record_with_names($db, 10); foreach ($row as $key => $value) { $fields[trim($key)] = array('type' => 'TEXT'); } //print_r($fields); //exit(); $this->dbforge->add_field($fields); $this->dbforge->create_table($tabla); $insert = array(); for ($i = 0; $i <= $rows; $i++) { $r = dbase_get_record_with_names($db, $i); foreach ($row as $key => $value) { $a = utf8_encode(trim($r[trim($key)])); $insert[trim($key)] = $a; } $this->db->insert($tabla, $insert); } echo $i; dbase_close($db); } else { echo "No pudo abrir el archivo"; } } else { echo 'Debe cargar las librerias dbase para poder usar este modulo'; } }
function mspti() { $this->layout = 'ajax'; $this->autoRender = FALSE; // database "definition" $def = array(array("KDYYSMSPTI", "C", 7), array("KDPTIMSPTI", "C", 6), array("NMPTIMSPTI", "C", 50), array("ALMT1MSPTI", "C", 30), array("ALMT2MSPTI", "C", 30), array("KOTAAMSPTI", "C", 20), array("KDPOSMSPTI", "C", 5), array("TELPOMSPTI", "C", 20), array("FAKSIMSPTI", "C", 20), array("TGPTIMSPTI", "D"), array("NOMSKMSPTI", "C", 30), array("EMAILMSPTI", "C", 40), array("HPAGEMSPTI", "C", 40), array("TGAWLMSPTI", "D")); $epsbed_file = EPSBED_DIR . 'MSPTI.dbf'; if (!dbase_create($epsbed_file, $def)) { echo "Error, can't create the database\n"; exit; } else { $db = dbase_open($epsbed_file, 2); if ($db) { $this->loadModel('Configuration'); $yys = $this->Configuration->getPTI(); $yys['YYS_KODE'] = ''; dbase_add_record($db, array($yys['YYS_KODE'], $yys['PTI_KODE'], $yys['PTI_NAMA'], $yys['PTI_ALAMAT_1'], $yys['PTI_ALAMAT_2'], $yys['PTI_KOTA'], $yys['PTI_KODE_POS'], $yys['PTI_TELEPON'], $yys['PTI_FAX'], str_replace('-', '/', $yys['PTI_TANGGAL_SK']), $yys['PTI_NOMOR_SK'], $yys['PTI_EMAIL'], $yys['PTI_WEBSITE'], str_replace('-', '/', $yys['PTI_TANGGAL_BERDIRI']))); echo "<a href='files/epsbed/MSPTI.dbf'>Download file MSPTI.dbf</a>"; dbase_close($db); } } }
default: if ($this->session->userdata('institucion') != 'A') { $where = " a where ano = " . $anio . " and substr(e_salud,7,1) = '" . $this->session->userdata('institucion') . "'"; } else { $where = " a where ano = " . $anio; } break; } $row = $this->frontend_model->exportarCobertura($param1, $where, $puntero, $limite); foreach ($row as $data) { dbase_add_record($dbh, array($data->ANO, $data->SEMANA, '0', $data->COD_EST, $data->EST_NOT, $data->REGION, $data->RED, '', $data->MICRORED, $data->SITUACION, $data->FGENERA, $data->HORANOT)); $contador = $contador + 1; } break; } dbase_close($dbh); if ($puntero >= $maximo) { //Actualizando el registro de auditoria $this->mantenimiento_model->auditoriaOperador($this->session->userdata('usuario'), 'Descarga de ' . $namet . '_sp.dbf'); /// descarga del dbf generado $filename = $ruta_db; if (file_exists($filename)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); if ($namet != "cobertura") { header('Content-Disposition: attachment; filename=' . $namet . '_sp.dbf'); } else { header('Content-Disposition: attachment; filename=' . $namet . '.dbf'); } header('Content-Transfer-Encoding: binary'); header('Expires: 0');
dbase_close($db16); } //if db }else{ $db16 = dbase_open($dbname16, 2); if ($db16) { dbase_add_record($db16, array( $hcode16, $hn16, $an16, $newclinic, $personid, $newdateserv, $drugcode16, // drugcode $drugname16, $amount16, $saleprice, $unitprice, $code24, $unit, $packing, $newseq, $reasondefault, $pano)); dbase_close($db16); } //if db } // if $reason } // while //---------------End Dataset16---------------// } // if check box �Դ�ش���� ?>
public function __destruct() { dbase_close($this->db); }
function subedbf($file = 'DATONO02.DBF', $insertar = true) { set_time_limit(3600); $this->load->dbforge(); $this->load->dbutil(); $filea = explode('.', $file); $name = $filea[0]; $ext = $filea[1]; $uploadsdir = getcwd() . '/uploads/'; $filedir = $uploadsdir . $file; $tabla = strtoupper($ext . $name); if (extension_loaded('dbase')) { $db = @dbase_open($filedir, 0); $this->dbforge->drop_table($tabla); if ($db) { $cols = @dbase_numfields($db); $rows = @dbase_numrecords($db); $row = @dbase_get_record_with_names($db, 10); print_r($row); count($row); if (is_array($row) > 0) { foreach ($row as $key => $value) { $fields[trim($key)] = array('type' => 'TEXT'); } //print_r($fields); //exit(); @$this->dbforge->add_field($fields); @$this->dbforge->create_table($tabla); if ($insertar) { $insert = array(); for ($i = 0; $i <= $rows; $i++) { $r = @dbase_get_record_with_names($db, $i); foreach ($row as $key => $value) { $a = @utf8_encode(trim($r[trim($key)])); $insert[trim($key)] = $a; } @$this->db->insert($tabla, $insert); echo 1; } } @dbase_close($db); } } else { echo "No pudo abrir el archivo"; } } else { echo 'Debe cargar las librerias dbase para poder usar este modulo'; } }
$newtimedsc = $newtimedc[0].$newtimedc[1]; // TIMEDSC �����ù�����Ң����� $dischs=$rows7["dcstatus"]; // DISCHS �����ù�����Ң����� $discht=substr($rows7["dctype"],0,1); // DISCHT �����ù�����Ң����� $warddsc=substr($rows7["bedcode"],0,2); // WARDDSC �����ù�����Ң����� $adm_w=$rows7["adm_w"]; // ADM_W �����ù�����Ң����� $ucc7="1"; // UCC �����ù�����Ң����� $db7 = dbase_open($dbname7, 2); if ($db7) { dbase_add_record($db7, array( $hn7, $an7, $newdateadm, $newtimeadm, $newdatedsc, $newtimedsc, $dischs, $discht, $warddsc, $dept, $adm_w, $ucc7)); dbase_close($db7); } //if db } //while //--------------------End DataSet7-------------------------// } // if check box �Դ�ش���� ?>
if (!is_file("/var/webtmp/{$filePre}.zip")) { $shpFname = "/var/webtmp/{$filePre}"; @unlink($shpFname . ".shp"); @unlink($shpFname . ".shx"); @unlink($shpFname . ".dbf"); @unlink($shpFname . ".zip"); $shpFile = ms_newShapeFileObj($shpFname, MS_SHP_POINT); $dbfFile = dbase_create($shpFname . ".dbf", array(array("ID", "C", 6), array("NAME", "C", 50), array("NETWORK", "C", 20), array("BEGINTS", "C", 16))); for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) { $pt = ms_newPointobj(); $pt->setXY($row["longitude"], $row["latitude"], 0); $shpFile->addPoint($pt); dbase_add_record($dbfFile, array($row["id"], $row["name"], $row["network"], substr($row["archive_begin"], 0, 16))); } unset($shpFile); dbase_close($dbfFile); chdir("/var/webtmp/"); copy("/mesonet/www/apps/iemwebsite/data/gis/meta/4326.prj", $filePre . ".prj"); popen("zip " . $filePre . ".zip " . $filePre . ".shp " . $filePre . ".shx " . $filePre . ".dbf " . $filePre . ".prj", 'r'); } $table .= "Shapefile Generation Complete.<br>"; $table .= "Please download this <a href=\"/tmp/" . $filePre . ".zip\">zipfile</a>."; chdir("/mesonet/www/apps/iemwebsite/htdocs/sites/"); } else { if ($format == "awips") { if (!$nohtml) { $table .= "<pre>\n"; } for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) { $table .= sprintf("%s|%s|%-30s|%4.1f|%2.5f|%3.5f|GMT|||1||||\n", $row["id"], $row["id"], $row["name"], $row["elevation"], $row["latitude"], $row["longitude"]); }
echo "<br>"; echo "xbase<br>"; echo "index = {$xi} <br>"; echo "column count = " . xbase_numfields($xi) . " <br>"; echo "record count = " . xbase_numrecords($xi) . " <br>"; echo "<table>"; for ($i = 0; $i < xbase_numrecords($xi); $i++) { echo "<tr>"; $r = xbase_get_record_with_names($xi, $i + 1); foreach ($r as $c => $v) { echo "<td> {$c}={$v} </td>"; } echo "</tr>"; } echo "</table>"; dbase_close($di); xbase_close($xi); echo "<br><br>"; $table =& new XBaseTable("test/dbase.dbf"); $table->open(); echo "name: " . $table->name . "<br />"; echo "version: " . $table->version . "<br />"; echo "foxpro: " . ($table->foxpro ? "yes" : "no") . "<br />"; echo "modifyDate: " . date("r", $table->modifyDate) . "<br />"; echo "recordCount: " . $table->recordCount . "<br />"; echo "headerLength: " . $table->headerLength . "<br />"; echo "recordByteLength: " . $table->recordByteLength . "<br />"; echo "inTransaction: " . ($table->inTransaction ? "yes" : "no") . "<br />"; echo "encrypted: " . ($table->encrypted ? "yes" : "no") . "<br />"; echo "mdxFlag: " . ord($table->mdxFlag) . "<br />"; echo "languageCode: " . ord($table->languageCode) . "<br />";
function DBFClose() { return dbase_close($this->DBFCon); }
mysql_query("delete from d_item where ThAng='{$ta}' and kdsatker='{$kdsatkerunit}' "); $i = 0; $no == 0; while ($i <= $jml) { $vdata = dbase_get_record_with_names($data, $i); $thang = $vdata["THANG"]; $kdsatker = $vdata["KDSATKER"]; $jumlah = $vdata['JUMLAH']; if ($kdsatker == $kdsatkerunit and $thang == $ta) { echo 'kode satker sesuia'; $no == $no + 1; mysql_query("insert into d_item(ThAng,kdsatker,jumlah)\r\n values('{$ta}','{$kdsatker}','{$jumlah}')"); } $i++; } dbase_close($data); $datadipa = mysql_query("select * from d_item where ThAng='{$ta}' and kdsatker='{$kodesatker}'"); $jumlahdata = mysql_num_rows($datadipa); if ($jumlahdata = 0) { } } else { // header("location:../setup/logup2.php"); } // header("location:Upload_Dipa.php"); } if ($_REQUEST['batal']) { header("location:Upload_Dipa.php"); } ?> <LINK href="../css/style.css" type=text/css rel=stylesheet>
function writeDbf($dbfFileName, $dbfFieldList, $valueList) { $defList = array(); foreach ($dbfFieldList as $name => $def) { $defList[] = array_merge(array(substr($name, 0, 10)), $def); } pm_logDebug(3, $defList, 'defList'); $dbfFile = dbase_create($dbfFileName, $defList); //array(array('PROG_ID', 'N', 5, 0))); foreach ($valueList as $row) { pm_logDebug(3, $row, 'row'); dbase_add_record($dbfFile, $row); } dbase_close($dbfFile); }
<?php $db = false; if (!empty($argc)) { $file = end($argv); $db = dbase_open($file, 0); } if ($db) { $iconvFrom = '866'; $iconvTo = 'UTF-8'; $delimetr = ','; $info = dbase_get_header_info($db); $fields = dbase_numfields($db); $fieldsCount = sizeof($fields); $records = dbase_numrecords($db); //for ($i = 1; $i <= 10; $i++) { # test for ($i = 1; $i <= $records; $i++) { $row = dbase_get_record($db, $i); $line = array(); for ($j = 0; $j < $fields; $j++) { $line[] = addslashes(iconv($iconvFrom, $iconvTo, trim($row[$j]))); } echo implode($delimetr, $line); echo PHP_EOL; } dbase_close($db); }
$newclinic=$clinic1.$clinic.$clinic2; // CLINIC ãªéµÑÇá»Ã¹Õé¹Óà¢éÒ¢éÍÁÙÅ //SEQ $lenvn=strlen($vn3); if($lenvn=="1"){ $newvn="00".$vn3; }else if($lenvn=="2"){ $newvn="0".$vn3; }else if($lenvn=="3"){ $newvn=$vn3; } $newseq=$newdateopd.$newvn.$newrowid; // SEQ ãªéµÑÇá»Ã¹Õé¹Óà¢éÒ¢éÍÁÙÅ $ucc3="1"; // UCC ãªéµÑÇá»Ã¹Õé¹Óà¢éÒ¢éÍÁÙÅ $db3 = dbase_open($dbname3, 2); if ($db3) { dbase_add_record($db3, array( $hn3, $newclinic, $newdateopd, $newtimeopd, $newseq, $ucc3)); dbase_close($db3); } //if db } //while //--------------------End DataSet3-------------------------// } // if check box »Ô´ÊØ´·éÒ ?>
public function index() { if ($this->input->post()) { $maximo = 0; $puntero = 0; $limite = 1000; if ($this->form_validation->run("exportar/exportar")) { $qry = $this->input->post('query'); switch ($this->input->post('baseExport')) { case 1: $namet = 'noti'; $param1 = 'individual'; switch ($this->session->userdata('nivel')) { case 4: $where = " a left join diagno b on a.diagnostic=b.cie_10 left join tematicos c on b.clave=c.codigo where a.ano = " . $this->input->post('anoExport') . " and c.codigo = '" . $this->session->userdata('equipo') . "'"; break; case 5: $where = " a where ano = " . $this->input->post('anoExport') . " and sub_reg_nt = '" . $this->session->userdata('diresa') . "'"; break; case 6: $where = " a where ano = " . $this->input->post('anoExport') . " and sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "'"; break; case 7: $where = " a where ano = " . $this->input->post('anoExport') . " and sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and microred = '" . $this->session->userdata('microred') . "'"; break; case 8: $where = " a where e_salud = '" . $this->session->userdata('establecimiento') . "' and ano = " . $this->input->post('anoExport'); break; default: $where = " a where ano = " . $this->input->post('anoExport'); break; } $row = $this->frontend_model->exportarInd($param1, $where); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } $maximo = count($row); break; case 2: $namet = 'eda'; $param1 = 'edas'; switch ($this->session->userdata('nivel')) { case 4: if ($this->session->userdata('equipo') == "EDAS") { $where = " where ano = " . $this->input->post('anoExport'); } else { $where = ""; } break; case 5: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and ano = " . $this->input->post('anoExport'); break; case 6: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and ano = " . $this->input->post('anoExport'); break; case 7: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and microred = '" . $this->session->userdata('microred') . "' and ano = " . $this->input->post('anoExport'); break; case 8: $where = " where e_salud = '" . $this->session->userdata('establecimiento') . "' and ano = " . $this->input->post('anoExport'); break; default: $where = " where ano = " . $this->input->post('anoExport'); break; } $row = $this->frontend_model->exportarEda($param1, $where); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } $maximo = count($row); break; case 3: $namet = 'ira'; $param1 = 'iras'; switch ($this->session->userdata('nivel')) { case 4: if ($this->session->userdata('equipo') == "IRAS") { $where = " where ano = " . $this->input->post('anoExport'); } else { $where = ""; } break; case 5: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and ano = " . $this->input->post('anoExport'); break; case 6: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and ano = " . $this->input->post('anoExport'); break; case 7: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and microred = '" . $this->session->userdata('microred') . "' and ano = " . $this->input->post('anoExport'); break; case 8: $where = " where e_salud = '" . $this->session->userdata('establecimiento') . "' and ano = " . $this->input->post('anoExport'); break; default: $where = " where ano = " . $this->input->post('anoExport'); break; } $row = $this->frontend_model->exportarIra($param1, $where); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } $maximo = count($row); break; case 4: $namet = 'feb'; $param1 = 'febriles'; switch ($this->session->userdata('nivel')) { case 4: if ($this->session->userdata('equipo') == "IRAS" or $this->session->userdata('equipo') == "METAX") { $where = " where a.ano = " . $this->input->post('anoExport'); } else { $where = ""; } break; case 5: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and ano = " . $this->input->post('anoExport'); break; case 6: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and ano = " . $this->input->post('anoExport'); break; case 7: $where = " where sub_reg_nt = '" . $this->session->userdata('diresa') . "' and red = '" . $this->session->userdata('red') . "' and microred = '" . $this->session->userdata('microred') . "' and ano = " . $this->input->post('anoExport'); break; case 8: $where = " where e_salud = '" . $this->session->userdata('establecimiento') . "' and ano = " . $this->input->post('anoExport'); break; default: $where = " where ano = " . $this->input->post('anoExport'); break; } $row = $this->frontend_model->exportarFebriles($param1, $where); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } $maximo = count($row); break; } set_time_limit(180); $usuario = $this->session->userdata('usuario'); $NombreArchivo = $usuario . date("dmYHis") . ".dbf"; $ruta_dbO = getcwd() . "/public/images/" . $namet . "_sp.dbf"; $ruta_db = getcwd() . "/uploads/{$NombreArchivo}"; copy($ruta_dbO, $ruta_db) or die("no se pudo generar el molde"); } } if ($maximo != 0) { // Abrir un el archivo dbase $dbh = dbase_open($ruta_db, 2) or die("¡Error! No se pudo abrir el archivo de base de datos dbase '{$ruta_db}'."); switch ($this->input->post('baseExport')) { case 1: $row = $this->frontend_model->exportarInd($param1, $where, $puntero, $limite); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } foreach ($row as $data) { dbase_add_record($dbh, array($data->ANO, $data->SEMANA, $data->DIAGNOSTIC, $data->TIPO_DX, $data->SUBREGION, $data->UBIGEO, $data->LOCALCOD, $data->LOCALIDAD, $data->APEPAT, $data->APEMAT, $data->NOMBRES, $data->EDAD, $data->TIPO_EDAD, $data->SEXO, $data->PROTEGIDO, $data->FECHA_INI, $data->FECHA_DEF, $data->FECHA_NOT, $data->FECHA_INV, $data->SUB_REG_NT, $data->RED, $data->MICRORED, $data->E_SALUD, $data->SEMANA_NOT, $data->AN_NOTIFIC, $data->FECHA_ING, $data->FICHA_INV, $data->TIPO_NOTI, $data->CLAVE, $data->IMPORTADO, $data->MIGRADO, $data->VERIFICA, $data->DNI, $data->MUESTRA, $data->HC, $data->ESTADO, $data->TIP_ZONA, $data->COD_PAIS, $data->TIPO_ID, $data->DIRECCION, $data->ETNIAPROC, $data->ETNIAS, $data->PROCEDE, $data->OTROPROC)); } break; case 2: $row = $this->frontend_model->exportarEda($param1, $where, $puntero, $limite); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } foreach ($row as $data) { dbase_add_record($dbh, array($data->ANO, $data->SEMANA, $data->SUB_REG_NT, $data->RED, $data->MICRORED, $data->E_SALUD, $data->UBIGEO, $data->DAA_C1, $data->DAA_C1_4, $data->DAA_C5, $data->DAA_D1, $data->DAA_D1_4, $data->DAA_D5, $data->DAA_H1, $data->DAA_H1_4, $data->DAA_H5, $data->COL_C1, $data->COL_C1_4, $data->COL_C5, $data->COL_D1, $data->COL_D1_4, $data->COL_D5, $data->COL_H1, $data->COL_H1_4, $data->COL_H5, $data->DIS_C1, $data->DIS_C1_4, $data->DIS_C5, $data->DIS_D1, $data->DIS_D1_4, $data->DIS_D5, $data->DIS_H1, $data->DIS_H1_4, $data->DIS_H5, $data->COP_T1, $data->COP_T1_4, $data->COP_T5, $data->COP_P1, $data->COP_P1_4, $data->COP_P5, $data->COP_S1, $data->COP_S1_4, $data->COP_S5, $data->FECHA_ING, $data->CLAVE, $data->MIGRADO, $data->VERIFICA, $data->ETAPA, $data->ESTADO, $data->ETNIAPROC, $data->ETNIAS, $data->PROCEDE, $data->OTROPROC)); } break; case 3: $row = $this->frontend_model->exportarIra($param1, $where, $puntero, $limite); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } foreach ($row as $data) { dbase_add_record($dbh, array($data->ANO, $data->SEMANA, $data->SUB_REG_NT, $data->RED, $data->MICRORED, $data->E_SALUD, $data->UBIGEO, $data->IRA_M2, $data->IRA_2_11, $data->IRA_1_4A, $data->NEU_2_11, $data->NEU_1_4A, $data->HOS_M2, $data->HOS_2_11, $data->HOS_1_4A, $data->NGR_M2, $data->NGR_2_11, $data->NGR_1_4A, $data->DIH_M2, $data->DIH_2_11, $data->DIH_1_4A, $data->DEH_M2, $data->DEH_2_11, $data->DEH_1_4A, $data->SOB_2A, $data->SOB_2_4A, $data->FECHA_ING, $data->CLAVE, $data->MIGRADO, $data->VERIFICA, $data->ETAPA, $data->IRA_5_9A, $data->IRA_60A, $data->NEU_5_9A, $data->NEU_60A, $data->HOS_5_9A, $data->HOS_60A, $data->NGR_5_9A, $data->NGR_60A, $data->DIH_5_9A, $data->DIH_60A, $data->DEH_5_9A, $data->DEH_60A, $data->SOB_5_9A, $data->SOB_60A, $data->ESTADO, $data->LOCALCOD, $data->NEU_10_19, $data->NEU_20_59, $data->HOS_10_19, $data->HOS_20_59, $data->DIH_10_19, $data->DIH_20_59, $data->DEH_10_19, $data->DEH_20_59, $data->ETNIAPROC, $data->ETNIAS, $data->PROCEDE, $data->OTROPROC)); } break; case 4: $row = $this->frontend_model->exportarFebriles($param1, $where, $puntero, $limite); if (count($row) == 0) { $this->session->set_flashdata('info', 'No hay información para el nivel solicitado'); redirect(site_url('exportar/exportar'), 301); } foreach ($row as $data) { dbase_add_record($dbh, array($data->ANO, $data->SEMANA, $data->SUB_REG_NT, $data->RED, $data->MICRORED, $data->E_SALUD, $data->UBIGEO, $data->FEB_M1, $data->FEB_1_4, $data->FEB_5_9, $data->FEB_10_19, $data->FEB_20_59, $data->FEB_M60, $data->FECHA_ING, $data->CLAVE, '', '', '', '', $data->FEB_TOT, $data->FECHA_NOT, $data->FECHA_ATE, $data->TOT_ATEN)); } break; } dbase_close($dbh); $puntero = $puntero + $limite; if ($puntero > $maximo) { /// descarga del dbf generado $filename = $ruta_db; if (file_exists($filename)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $namet . '_sp.dbf'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($filename)); ob_clean(); flush(); readfile($filename); } else { echo "el fichero no se creo"; } unlink($filename); //Actualizando el registro de auditoria $this->mantenimiento_model->auditoriaOperador($this->session->userdata('usuario'), 'Descarga de ' . $namet . '_sp.dbf'); $this->layout->view('exportar'); } else { redirect(site_url("exportar/index"), 301); } } else { if (!empty($this->session_id)) { $this->layout->view('exportar'); } else { redirect(site_url("index/login"), 301); } } }
echo "<td bgcolor=\"#00FF80\">".$affiche[$i]."</td>\n"; } */ affiche_debug("</td>\n"); affiche_debug("</tr>\n"); } /* } else { for($i = 0; $i < count($tabchamps); $i++) { echo "<td>".$affiche[$i]."</td>\n"; } */ } //echo "</tr>\n"; } dbase_close($fp); //echo "</table>\n"; // On affiche le tableau de la classe : $tab_session = serialize($tab); $retard_session = serialize($retard); $abs_session = serialize($abs); $abs_nj_session = serialize($abs_nj); $_SESSION['tab_session'] = $tab_session; $_SESSION['retard_session'] = $retard_session; $_SESSION['abs_session'] = $abs_session; $_SESSION['abs_nj_session'] = $abs_nj_session; echo "<p>Tableau récapitulatif des absences pour la période du <b>" . $jourd . "/" . $moisd . "/" . $anneed . "</b> au <b>" . $jourf . "/" . $moisf . "/" . $anneef . "</b></p>\n"; echo "<p><b>Attention </b>: les données ne sont pas encore enregistrées dans la base GEPI.</p>\n"; echo "<form enctype=\"multipart/form-data\" action=\"import_absences_gep.php\" method=\"post\" name=\"form_absences\">\n"; echo add_token_field(); echo "<p align=\"center\"><input type=submit value=\"Enregistrer les données dans la base GEPI\" /></p>\n";
public function fechar() { dbase_close($this->conexao); $this->conexao = NULL; }
function adicionaTemaGeoRSS($servico, $dir_tmp, $locaplic, $canal) { $xml = simplexml_load_file($servico); $conta = 0; foreach ($xml->channel as $c) { if ($conta == $canal) { $canal = $c; } } $nos = $canal->item; //verifica se o canal faz referencia a elementos externos //se sim, usa todos os elementos do xml no lugar do canal foreach ($canal->items as $t) { foreach ($t->xpath('rdf:Seq') as $x) { foreach ($x->xpath('rdf:li') as $z) { $nos = $xml->item; } } } $resultado = array(); $tipog = ""; foreach ($nos as $item) { $env = array(); //define o tipo if ($item->xpath('geo:lat')) { $tipog = "geo"; } if ($item->xpath('georss:point')) { $tipog = "georsspoint"; } if ($item->xpath('georss:where')) { $tipog = "envelope"; } if ($tipog == "envelope") { foreach ($item->xpath('georss:where') as $w) { foreach ($w->xpath('gml:Envelope') as $e) { //$lc = $e->xpath('gml:lowerCorner'); $lc = (string) $e->children('gml', TRUE)->lowerCorner; //$uc = $e->xpath('gml:upperCorner'); $uc = (string) $e->children('gml', TRUE)->upperCorner; $lc = explode(" ", $lc); $uc = explode(" ", $uc); if (is_numeric($lc[0])) { $ymin = $lc[0]; $ymax = $uc[0]; $xmin = $lc[1]; $xmax = $uc[1]; if ($ymin != "") { $env = array($xmin, $ymin, $xmax, $ymax); } } } } } if ($tipog == "geo") { if ($item->xpath('geo:lon')) { $x = (string) $item->children('geo', TRUE)->lon; } else { $x = (string) $item->children('geo', TRUE)->long; } //$y = $item->xpath('geo:lat'); $y = (string) $item->children('geo', TRUE)->lat; $env = array($y, $x); } if ($tipog == "georsspoint") { //$temp = $item->xpath('georss:point'); $temp = (string) $item->children('georss', TRUE)->point; $env = explode(" ", $temp); } if (count($env) > 0) { $resultado[] = array(ixml($item, "title"), ixml($item, "link"), ixml($item, "description"), ixml($item, "category"), $env); } } //cria o shapefile com os dados if (count($resultado) > 0) { //para manipular dbf include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php"; $diretorio = dirname($this->arquivo); $tipol = MS_SHP_POLYGON; if ($tipog == "georsspoint") { $tipol = MS_SHP_POINT; } if ($tipog == "geo") { $tipol = MS_SHP_POINT; } $novonomelayer = nomeRandomico(10) . "georss"; $nomeshp = $diretorio . "/" . $novonomelayer; $novoshpf = ms_newShapefileObj($nomeshp, $tipol); $def[] = array("TITULO", "C", "254"); $def[] = array("LINK", "C", "254"); $def[] = array("DESC", "C", "254"); $def[] = array("CATEGORIA", "C", "254"); if (!function_exists(dbase_create)) { $db = xbase_create($nomeshp . ".dbf", $def); xbase_close($db); } else { $db = dbase_create($nomeshp . ".dbf", $def); dbase_close($db); } //acrescenta os pontos no novo shapefile $dbname = $nomeshp . ".dbf"; $db = xbase_open($dbname, 2); $reg = array(); $novoshpf = ms_newShapefileObj($nomeshp . ".shp", -2); //acrescenta os shapes foreach ($resultado as $r) { $pts = $r[4]; if ($tipol == MS_SHP_POLYGON) { $shp = ms_newShapeObj(MS_SHP_POLYGON); $linha = ms_newLineObj(); $linha->addXY($pts[0], $pts[3]); $linha->addXY($pts[2], $pts[3]); $linha->addXY($pts[2], $pts[1]); $linha->addXY($pts[0], $pts[1]); $linha->addXY($pts[0], $pts[3]); } else { $shp = ms_newShapeObj(MS_SHP_POINT); $linha = ms_newLineObj(); $linha->addXY($pts[1], $pts[0]); } $shp->add($linha); $novoshpf->addShape($shp); $reg = array($r[0], $r[1], $r[2], $r[3]); xbase_add_record($db, $reg); $reg = array(); } xbase_close($db); if ($tipog == "georsspoint" || $tipog == "geo") { $tipol = MS_LAYER_POINT; } else { $tipol = MS_LAYER_POLYGON; } $layer = criaLayer($this->mapa, $tipol, MS_DEFAULT, "GeoRSS", "SIM"); $layer->set("data", $nomeshp . ".shp"); $layer->set("name", basename($nomeshp)); $layer->setmetadata("DOWNLOAD", "sim"); $layer->setmetadata("TEMALOCAL", "SIM"); //evita problemas no modo tile if ($this->v > 5) { $layer->setprocessing("LABEL_NO_CLIP=True"); $layer->setprocessing("POLYLINE_NO_CLIP=True"); } if ($tipol == MS_LAYER_POLYGON) { $classe = $layer->getclass(0); $estilo = $classe->getstyle(0); $estilo->set("symbolname", "p4"); $estilo->set("size", 5); $cor = $estilo->color; $cor->setrgb(255, 0, 0); $coro = $estilo->outlinecolor; $coro->setrgb(255, 0, 0); } //$layer->set("transparency",50); $layer->setmetadata("nomeoriginal", basename($nomeshp)); //echo $tipol; return "ok"; } return "erro"; }
/** * Export data * @return boolean */ function export() { $def = array(array('o_id', 'N', 10, 0), array('o_uid', 'N', 10, 0), array('o_date', 'D'), array('o_state', 'N', 1, 0), array('o_ip', 'C', 32), array('o_lastname', 'C', 155), array('o_firstnam', 'C', 155), array('o_adress', 'C', 155), array('o_zip', 'C', 30), array('o_town', 'C', 155), array('o_country', 'C', 3), array('o_telephon', 'C', 30), array('o_email', 'C', 155), array('o_articles', 'N', 10, 0), array('o_total', 'N', 10, 2), array('o_shipping', 'N', 10, 2), array('o_bill', 'L'), array('o_password', 'C', 155), array('o_text', 'C', 155), array('o_cancel', 'C', 155), array('c_id', 'N', 10, 0), array('c_prod_id', 'N', 10, 0), array('c_qte', 'N', 10, 0), array('c_price', 'N', 10, 2), array('c_o_id', 'N', 10, 0), array('c_shipping', 'N', 10, 2), array('c_pass', 'C', 155)); /* * Correspondances * cmd_id o_id * cmd_uid o_uid * cmd_date o_date * cmd_state o_state * cmd_ip o_ip * cmd_lastname o_lastname * cmd_firstname o_firstnam * cmd_adress o_adress * cmd_zip o_zip * cmd_town o_town * cmd_country o_country * cmd_telephone o_telephon * cmd_email o_email * cmd_articles_count o_articles * cmd_total o_total * cmd_shipping o_shipping * cmd_bill o_bill * cmd_password o_password * cmd_text o_text * cmd_cancel o_cancel * caddy_id c_id * caddy_product_id c_prod_id * caddy_qte c_qte * caddy_price c_price * caddy_cmd_id c_o_id * caddy_shipping c_shipping * caddy_pass c_pass */ if (!dbase_create($this->folder . DIRECTORY_SEPARATOR . $this->filename, $def)) { $this->success = false; return false; } $dbf = dbase_open($this->folder . DIRECTORY_SEPARATOR . $this->filename, 2); if ($dbf === false) { $this->success = false; return false; } $criteria = new CriteriaCompo(); $criteria->add(new Criteria('cmd_id', 0, '<>')); $criteria->add(new Criteria('cmd_state', $this->orderType, '=')); $criteria->setSort('cmd_date'); $criteria->setOrder('DESC'); $orders = $this->handlers->h_myshop_commands->getObjects($criteria); foreach ($orders as $order) { $carts = array(); $carts = $this->handlers->h_myshop_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '=')); foreach ($carts as $cart) { dbase_add_record($dbf, array($order->getVar('cmd_id'), $order->getVar('cmd_uid'), date('Ymd', strtotime($order->getVar('cmd_date'))), $order->getVar('cmd_state'), $order->getVar('cmd_ip'), $order->getVar('cmd_lastname'), $order->getVar('cmd_firstname'), $order->getVar('cmd_adress'), $order->getVar('cmd_zip'), $order->getVar('cmd_town'), $order->getVar('cmd_country'), $order->getVar('cmd_telephone'), $order->getVar('cmd_email'), $order->getVar('cmd_articles_count'), $order->getVar('cmd_total'), $order->getVar('cmd_shipping'), $order->getVar('cmd_bill'), $order->getVar('cmd_password'), $order->getVar('cmd_text'), $order->getVar('cmd_cancel'), $cart->getVar('caddy_id'), $cart->getVar('caddy_product_id'), $cart->getVar('caddy_qte'), $cart->getVar('caddy_price'), $cart->getVar('caddy_cmd_id'), $cart->getVar('caddy_shipping'), $cart->getVar('caddy_pass'))); } } dbase_close($dbf); $this->success = true; return true; }
function createDBF($fullpath_filename, $field_structure, $data, $file_mode = '0') { # Constants for dbf field types /* L = BOOLEAN C = CHAR D = DATE N = NUMBER */ # Constants for dbf file mode /* '0' = 'READ_ONLY'; '1' = 'WRITE_ONLY'; '2' = 'READ_WRITE'; */ # Path to dbf file $db_file = $fullpath_filename; if (is_dir($db_file)) { unlink($db_file); } # create dbf file using the $create = dbase_create($db_file, $field_structure); # open dbf file for reading and writing $id = @dbase_open($db_file, $file_mode) or die("Could not open dbf file <i>{$db_file}</i>."); if (is_array($data)) { foreach ($data as $dt) { dbase_add_record($id, $dt) or die("Could not add record {$dt['0']} to dbf file <i>{$db_file}</i>."); } } # close the dbf file dbase_close($id); }
round($monthly_premium), round($monthly_insure_include), round($pay), round($worker_insure_include), round($employer_insure_value), round($unemployment_insure_value), '27', NULL, NULL ); $file = "DSKKAR00.DBF" ; $db_path = "../../../HRProcess/".$file ; $dbi = dbase_open($db_path,2); dbase_add_record($dbi, $record2); dbase_close($dbi); if (file_exists("../../../HRProcess/"."DSKKAR".$res[0]['cost_center_id'].".DBF")) { unlink("../../../HRProcess/"."DSKKAR".$res[0]['cost_center_id'].".DBF"); } //.............rename a file ............................ $directory ="../../../HRProcess/" ; foreach (glob($directory."*.DBF") as $filename) { $file = realpath($filename); rename($file, str_replace("DSKKAR00","DSKKAR".$res[0]['cost_center_id'],$file)); } //........................................................... echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">';
$rowidop=$rowsop["row_id"]; $newrowid = substr($rowidop,3,4); $vn=$rowsop["vn"]; $lenvn=strlen($vn); if($lenvn=="1"){ $newvn="00".$vn; }else if($lenvn=="2"){ $newvn="0".$vn; }else if($lenvn=="3"){ $newvn=$vn; } $newseq=$newdatecha.$newvn.$newrowid; // SEQ �����ù�����Ң����� $db12 = dbase_open($dbname12, 2); if ($db12) { dbase_add_record($db12, array( $hnopacc, $anopacc, $newdatecha, $chrgitem12, $amountopacc, $personid, $newseq)); dbase_close($db12); } //if db } //while //---------------End Dataset12---------------// } // if check box �Դ�ش���� ?>
function _closeDBFFile() { if ($this->DBFFile) { dbase_close($this->DBFFile); $this->DBFFile = NULL; } }
function volcarDBF($db = "ctw10005") { $results = array(); $mFile = $db . date("Ymd") . ".txt"; //Abrir el Archivo para Escribir $TFile = fopen(PATH_TMP . $mFile, "a"); $pathdbase = CTW_PATH . vLITERAL_SEPARATOR . $db . ".dbf"; //$db = dbase_open($ipdbase . $dirdbase . $nombredb . $db, 0); $rs = dbase_open($pathdbase, 0); //echo $pathdbase; $results[SYS_MSG] .= "Abrir {$pathdbase} <br />"; $num_rows = dbase_numrecords($rs); //$o_num_rows = dbase_numrecords ($rs); if ($num_rows > 100000) { //$num_rows = 100000; //Eliminar la Consulta a 50000 } $results[SYS_MSG] .= "Numero de Filas {$num_rows} <br />"; if (isset($rs)) { $results[SYS_MSG] .= "Cerrando " . dbase_get_header_info($rs) . " <br />"; for ($i = 1; $i <= $num_rows; $i++) { //$field = dbase_get_record_with_names($rs, $i); $field = dbase_get_record($rs, $i); $lim = sizeof($field); $strW = ""; for ($a = 0; $a < $lim; $a++) { if ($a == 0) { $strW .= trim($field[$a]); } else { $strW .= STD_LITERAL_DIVISOR . trim($field[$a]); } } $strW .= "\n"; @fwrite($TFile, $strW); //if (dbase_delete_record ($rs, $i)) { // print "Registro $i Marcado para Eliminar de un total de $o_num_rows; se Busco $field[$key]. <br >"; //break; # Exit the loop //} } } else { //dbase_get_header_info($rs); } //dbase_pack($rs); //$results[SYS_MSG] .= " <br />"; dbase_close($rs); $results[SYS_MSG] .= "Cerrando {$pathdbase} <br />"; fclose($TFile); $results[SYS_MSG] .= "Cerrando {$mFile} <br />"; return $results; }
} $vDB = GetDB(); list($vTable, $vFilter, $vOrder) = ConstructQuery($vDB, $_GET); $vCaseID = 'not an id'; $vCase = array(); $vRecords = $vDB->Select($vTable, '*', $vFilter, $vOrder); while ($vRecord = $vRecords->Fetch()) { $vRecCaseID = $vRecord['case_id']; if ($vCaseID !== $vRecCaseID) { $vCaseID = $vRecCaseID; $vCase = $vDB->GetById('emst_cases', $vCaseID); } if ($vCase['paytype'] == $_GET['paytype']) { OutSurgery($vDBF, $vCase, $vRecord, $vService); } } dbase_close($vDBF); $vHandle = fopen($DBFName, 'rb'); header('Content-type: application/octet-stream'); header('Content-Disposition: inline; filename=stats.dbf'); header('Content-length: ' . filesize($DBFName)); header('Expires: ' . gmdate('D, d M Y H:i:s', mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d'), date('Y'))) . ' GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); while (!feof($vHandle) && connection_status() == 0) { print fread($vHandle, 1024 * 8); flush(); } fclose($vHandle); unlink($DBFName);
private function _closeDBFFile() { if ($this->dbf) { dbase_close($this->dbf); $this->dbf = null; } }
/** * Disconnects from the database server * * @return bool TRUE on success, FALSE on failure */ function disconnect() { $ret = @dbase_close($this->connection); $this->connection = null; return $ret; }
$newrowid = substr($rowidop,3,4); $vn=$rowsop["vn"]; $lenvn=strlen($vn); if($lenvn=="1"){ $newvn="00".$vn; }else if($lenvn=="2"){ $newvn="0".$vn; }else if($lenvn=="3"){ $newvn=$vn; } $newseq=$newdateopd.$newvn.$newrowid; // SEQ Ц╙И╣ягА╩ц╧уИ╧сЮ╒Ир╒Имаые $db6 = dbase_open($dbname6, 2); if ($db6) { dbase_add_record($db6, array( $hn6, $newdateopd, $newclinic, $oper6, $newdropid, $personid, $newseq)); dbase_close($db6); } //if db } //while //--------------------End DataSet6-------------------------// } // if check box ╩т╢йь╢╥Ирб ?>