コード例 #1
0
 public function adicionar($array)
 {
     if (dbase_add_record($this->conexao, $array)) {
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: dbf.class.php プロジェクト: johnxth/sisfoapp
 function DBFAddRecord($add)
 {
     if (!is_array($add)) {
         die("Tipe data bukan Array");
     } else {
         $ret = dbase_add_record($this->DBFCon, $add) or die("Gagal Menyimpan Data");
     }
     return $ret;
 }
コード例 #3
0
ファイル: request.php プロジェクト: raprasad/iem
function addPoint($row, $lon, $lat, $name)
{
    global $shpFile, $dbfFile;
    // Create the shape
    $shp = ms_newShapeObj(MS_SHAPE_POINT);
    $pt = ms_newPointobj();
    $pt->setXY($lon, $lat, 0);
    $line = ms_newLineObj();
    $line->add($pt);
    $shp->add($line);
    $shpFile->addShape($shp);
    dbase_add_record($dbfFile, array($row["station"], $name, $row["years"], $row["cvalid"], $row["high"], $row["low"], $row["precip"], $row["max_precip"], $row["max_precip_yr"], $row["max_high"], $row["max_low"], $row["min_high"], $row["min_low"], $row["max_high_yr"], $row["max_low_yr"], $row["min_high_yr"], $row["min_low_yr"]));
}
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
ファイル: exportar_1.php プロジェクト: alejandrob1519/nwsp
 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);
         }
     }
 }
コード例 #6
0
ファイル: test_api.php プロジェクト: abbeet/server39
*  date modified    : Jan 2005
*                                                               
*  Info? Mail to info@cyane.nl
* 
* --------------------------------------------------------------
*
* R/W with api demonstration / compare with PHP integrated dbase functions
*
**/
require_once "api_conversion.php";
$fields = array(array("bool", DBFFIELD_TYPE_LOGICAL), array("memo", DBFFIELD_TYPE_MEMO), array("date", DBFFIELD_TYPE_DATE), array("number", DBFFIELD_TYPE_NUMERIC, 3, 0), array("string", DBFFIELD_TYPE_CHAR, 50));
$di = dbase_create("test/dbase.dbf", $fields);
$xi = xbase_create("test/xbase.dbf", $fields);
dbase_add_record($di, array("T", "abc", "20060120", 123, "string one"));
dbase_add_record($di, array("F", "def", "20060121", 321, "string two"));
dbase_add_record($di, array("F", "ghi", "20060121", 111, "string trio"));
xbase_add_record($xi, array("T", "abc", "20060120", 123, "string one"));
xbase_add_record($xi, array("F", "def", "20060121", 321, "string two"));
xbase_add_record($xi, array("F", "ghi", "20060121", 111, "string trio"));
dbase_close($di);
xbase_close($xi);
$di = dbase_open("test/dbase.dbf", 2);
$xi = xbase_open("test/xbase.dbf", 2);
dbase_delete_record($di, 2);
xbase_delete_record($xi, 2);
dbase_pack($di);
xbase_pack($xi);
dbase_close($di);
xbase_close($xi);
$di = dbase_open("test/dbase.dbf", 2);
$xi = xbase_open("test/xbase.dbf", 2);
コード例 #7
0
ファイル: dbf_createcha12.php プロジェクト: robocon/shs
					$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 �Դ�ش����
?>
コード例 #8
0
ファイル: exportando.php プロジェクト: alejandrob1519/nwsp
                 }
                 break;
             case 8:
                 $where = " a where e_salud = '" . $this->session->userdata('establecimiento') . "' and ano = " . $anio;
                 break;
             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');
コード例 #9
0
ファイル: dbf_createipd07.php プロジェクト: robocon/shs
		$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 �Դ�ش����
?>
コード例 #10
0
 public function exportarDbf($maximo, $contador, $puntero, $limite, $anio, $ruta_db)
 {
     $where = $this->session->userdata('where');
     $numRows = $this->mantenimiento_transito->getCantidad($where);
     if ($ruta_db != '0') {
         $ruta_db = str_replace("L", "/", $ruta_db);
     } else {
         $ruta_db = "";
     }
     if ($maximo == 0) {
         if ($numRows->cantidad == 0) {
             redirect(site_url('modulotransito/exportar'), 301);
         }
         $maximo = $numRows->cantidad;
         $limite = ceil($maximo / 10);
         $usuario = $this->session->userdata('usuario');
         $NombreArchivo = $usuario . date("dmYHis") . ".dbf";
         $ruta_dbO = getcwd() . "/basefuente/lesacctra.dbf";
         $ruta_db = getcwd() . '/uploads/' . $NombreArchivo;
         copy($ruta_dbO, $ruta_db) or die("no se pudo generar el molde");
         // Abrir 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);
         $row = $this->mantenimiento_transito->getDataDbf($where, $puntero, $limite);
         foreach ($row as $data) {
             dbase_add_record($dbh, array($data->fuen_finc, $data->hce, $data->hch, $data->ref_es, $data->referi, $data->ap_nm1, $data->ap_nm2, $data->nom_les, $data->cod_dir, $data->diresa, $data->red, $data->microred, $data->cod_eess, $data->eess, $data->dni, $data->edad, $data->tipo_edad, $data->sexo, $data->depar, $data->prov, $data->dis, $data->ubigeo, $data->tipo_loc, $data->direccion, $data->ing_eess, $data->hora, $data->dx1, $data->dx2, $data->dx3, $data->fech_egre, $data->cond_egr, $data->refer, $data->rehab, $data->fec_accd, $data->hor_accid, $data->lug_accid, $data->tipo_loc1, $data->depar_acc, $data->prov_acc, $data->dist_acc, $data->ubigeo_ac, $data->via_accd, $data->tp_accd, $data->movil, $data->nomovil, $data->veh_moto, $data->veh_nomoto, $data->peaton, $data->ub_les, $data->trasl_les, $data->tp_moto, $data->tp_nomoto, $data->tp_condi, $data->nom_condc1, $data->ape_condc, $data->nom_condc2, $data->ed_cond, $data->sex_cond, $data->lic_conduc, $data->comisar, $data->dep_com, $data->prov_com, $data->dist_com, $data->ubigeo_com, $data->alcoh, $data->num_pol, $data->num_plac, $data->nom_duepol, $data->aseg, $data->otroaseg, $data->ano, $data->estado, $data->fichanum, $data->tpa_otro, $data->evento));
             $contador = $contador + 1;
         }
         dbase_close($dbh);
         $puntero = $puntero + $limite;
         $ruta_db = str_replace("\\", "L", $ruta_db);
         $ruta_db = str_replace("/", "L", $ruta_db);
         redirect("modulotransito/exportarDbf" . "/" . $maximo . "/" . $contador . "/" . $puntero . "/" . $limite . "/" . $anio . "/" . $ruta_db, 301);
     } else {
         // Abrir 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);
         $row = $this->mantenimiento_transito->getDataDbf($where, $puntero, $limite);
         foreach ($row as $data) {
             dbase_add_record($dbh, array($data->fuen_finc, $data->hce, $data->hch, $data->ref_es, $data->referi, $data->ap_nm1, $data->ap_nm2, $data->nom_les, $data->cod_dir, $data->diresa, $data->red, $data->microred, $data->cod_eess, $data->eess, $data->dni, $data->edad, $data->tipo_edad, $data->sexo, $data->depar, $data->prov, $data->dis, $data->ubigeo, $data->tipo_loc, $data->direccion, $data->ing_eess, $data->hora, $data->dx1, $data->dx2, $data->dx3, $data->fech_egre, $data->cond_egr, $data->refer, $data->rehab, $data->fec_accd, $data->hor_accid, $data->lug_accid, $data->tipo_loc1, $data->depar_acc, $data->prov_acc, $data->dist_acc, $data->ubigeo_ac, $data->via_accd, $data->tp_accd, $data->movil, $data->nomovil, $data->veh_moto, $data->veh_nomoto, $data->peaton, $data->ub_les, $data->trasl_les, $data->tp_moto, $data->tp_nomoto, $data->tp_condi, $data->nom_condc1, $data->ape_condc, $data->nom_condc2, $data->ed_cond, $data->sex_cond, $data->lic_conduc, $data->comisar, $data->dep_com, $data->prov_com, $data->dist_com, $data->ubigeo_com, $data->alcoh, $data->num_pol, $data->num_plac, $data->nom_duepol, $data->aseg, $data->otroaseg, $data->ano, $data->estado, $data->fichanum, $data->tpa_otro, $data->evento));
             $contador = $contador + 1;
         }
         dbase_close($dbh);
         if ($puntero >= $maximo) {
             $filename = $ruta_db;
             if (file_exists($filename)) {
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/octet-stream');
                 header('Content-Disposition: attachment; filename=lesacctra.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);
             redirect('modulotransito/exportar', refresh);
         } else {
             $puntero = $puntero + $limite;
             $ruta_db = str_replace("\\", "L", $ruta_db);
             $ruta_db = str_replace("/", "L", $ruta_db);
             redirect("modulotransito/exportarDbf" . "/" . $maximo . "/" . $contador . "/" . $puntero . "/" . $limite . "/" . $anio . "/" . $ruta_db, 301);
         }
     }
 }
コード例 #11
0
ファイル: exportar_2.php プロジェクト: alejandrob1519/nwsp
 public function index()
 {
     if ($this->input->post()) {
         if ($this->form_validation->run("exportar/exportar")) {
             switch ($this->input->post('baseExport')) {
                 case 1:
                     $namet = 'noti';
                     $param1 = 'individual';
                     $where = " a where ano = " . $this->input->post('anoExport');
                     break;
                 case 2:
                     $namet = 'eda';
                     $param1 = 'edas';
                     $where = " where ano = " . $this->input->post('anoExport');
                     break;
                 case 3:
                     $namet = 'ira';
                     $param1 = 'iras';
                     $where = " where ano = " . $this->input->post('anoExport');
                     break;
                 case 4:
                     $namet = 'feb';
                     $param1 = 'febriles';
                     $where = " where ano = " . $this->input->post('anoExport');
                     break;
             }
             $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");
             // 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);
                     if (count($row) == 0) {
                         $this->session->set_flashdata('info', 'No hay información para el nivel solicitado');
                         redirect(site_url('backend/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);
                     if (count($row) == 0) {
                         $this->session->set_flashdata('info', 'No hay información para el nivel solicitado');
                         redirect(site_url('backend/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);
                     if (count($row) == 0) {
                         $this->session->set_flashdata('info', 'No hay información para el nivel solicitado');
                         redirect(site_url('backend/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);
                     if (count($row) == 0) {
                         $this->session->set_flashdata('info', 'No hay información para el nivel solicitado');
                         redirect(site_url('backend/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);
             /// 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);
             					exit;
             				}else{
             					echo "el fichero no se creo";
             				}*/
             $nombre = $usuario . date("dmYHis") . ".zip";
             $ruta = getcwd() . "/uploads/";
             ini_set('memory_limit', '-1');
             $this->zip->read_file($filename);
             $this->zip->archive($ruta . $nombre);
             $this->zip->download($nombre);
             //force_download($namet.'_sp.dbf', $filename);
             unlink($filename);
             //Actualizando el registro de auditoria
             $this->mantenimiento_model->auditoriaOperador($this->session->userdata('usuario'), 'Descarga de ' . $namet . '_sp.dbf');
         }
     }
     if (!empty($this->session_id)) {
         $this->layout->view('exportar');
     } else {
         redirect(site_url("backend/index/login"), 301);
     }
 }
コード例 #12
0
ファイル: dbf_createiop10.php プロジェクト: robocon/shs
					$newdropid = $rowsinp["codedoctor"];
			}
			
			//datetime
			$datetime10=$rows10["icddate"];
			$date =explode("/",$datetime10);
			$newdate=$date[2]-543;
			$newdatein =$newdate.$date[1].$date[0];  //  DATEIN �����ù�����Ң�����
			//echo "$datetime10 --> $date --> $newdatein </br>";
			
			$newtimein = "1300";  //  TIMEOPD �����ù�����Ң�����						
			
			$db10 = dbase_open($dbname10, 2);
				if ($db10) {
					  dbase_add_record($db10, array(
						  $aniop, 	
						  $oper10, 	
						  $optype, 
						  $newdropid, 		
						  $newdatein, 						  
						  $newtimein, 		
						  $dateout, 							  
						  $timeout));   
							dbase_close($db10);
						}  //if db		
				} //while	
		}  // if num
//---------------End Dataset10---------------//

}  // if check box �Դ�ش����
?>
コード例 #13
0
ファイル: dbf_createadp14.php プロジェクト: robocon/shs
						$newseq=$newdcdate.$newvn.$newrowid;  //  SEQ �����ù�����Ң�����
						$qty = $rowsds["amount"];	
						$rate =$rowsds["dsprice"];
						$chrgitemip ="11";
						$code ="XXXXXX";
												
						if($ands !="" && $rate != 0){
						//echo "DSY--->$ands/$qty/$rate/$newseq </br>";								
						$db14 = dbase_open($dbname14, 2);
							if ($db14) {
								dbase_add_record($db14, array(
									$hn14, //
									$an14, //
									$newdcdate,  //
									$chrgitemip,  //
									$code,
									$qty,
									$rate,
									$newseq,
									$cagcode, 	
									$dose, 																																  				  
									$catype));     
									dbase_close($db14);
								}  //if db			
							}   //if check an				
						}  // while
					} // if part			
			}  //while						
					
}  //while

//---------------End Dataset14---------------//
コード例 #14
0
ファイル: classe_analise.php プロジェクト: edmarmoretti/i3geo
 function incmapageometrias($dir_tmp, $imgdir, $lista, $tipoLista = "stringArquivos")
 {
     $dir = $dir_tmp . "/" . $imgdir . "/";
     $tituloTema = " geometria";
     if ($tipoLista == "stringArquivos") {
         $lista = explode(",", $lista);
         $shapes = array();
         $valoresoriginais = array();
         foreach ($lista as $l) {
             $geos = $this->unserializeGeo($dir . $l);
             // pega todas as geometrias
             foreach ($geos["dados"] as $geo) {
                 // echo $geo["wkt"]."<br>";
                 $shapes[] = ms_shapeObjFromWkt(str_replace("'", "", $geo["wkt"]));
                 foreach ($geo["valores"] as $v) {
                     $valorestemp[] = $v["item"] . "=" . $v["valor"];
                 }
                 $valoresoriginais[] = implode(" ", $valorestemp);
             }
         }
     }
     if ($tipoLista == "arraywkt") {
         $shapes = array();
         $valoresoriginais = array();
         foreach ($lista as $l) {
             $shapes[] = ms_shapeObjFromWkt($l);
         }
     }
     if ($tipoLista == "marcadores") {
         $shapes = array();
         $valoresoriginais = array();
         foreach ($lista as $l) {
             $valoresoriginais[] = $l["nome"];
             $p = explode(" ", $l["ext"]);
             $l = "POLYGON ((" . $p[0] . " " . $p[1] . "," . $p[0] . " " . $p[3] . "," . $p[2] . " " . $p[3] . "," . $p[2] . " " . $p[1] . "," . $p[0] . " " . $p[1] . "))";
             $shapes[] = ms_shapeObjFromWkt($l);
         }
         $tituloTema = " marcadores";
     }
     // verifica o tipo
     if (count($shapes) == 0) {
         return "erro.";
     }
     $tiposhape = $shapes[0]->type;
     $tiposhapefile = MS_SHP_POLYGON;
     if ($tiposhape == 0) {
         $tiposhapefile = MS_SHP_MULTIPOINT;
     }
     if ($tiposhape == 1) {
         $tiposhapefile = MS_SHP_ARC;
     }
     // cria o shapefile
     if ($this->dbaseExiste == false) {
         include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
     }
     $diretorio = dirname($this->arquivo);
     $novonomelayer = nomeRandomico();
     $nomeshp = $diretorio . "/" . $novonomelayer;
     $l = criaLayer($this->mapa, $tiposhape, MS_DEFAULT, "Ins", "SIM");
     $novoshpf = ms_newShapefileObj($nomeshp, $tiposhapefile);
     $def[] = array("ID", "C", "250");
     if ($this->dbaseExiste == false) {
         $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";
     if ($this->dbaseExiste == false) {
         $db = xbase_open($dbname, 2);
     } else {
         $db = dbase_open($dbname, 2);
     }
     $conta = 0;
     foreach ($shapes as $s) {
         $reg = array();
         $reg[] = $valoresoriginais[$conta];
         if ($this->dbaseExiste == false) {
             xbase_add_record($db, $reg);
         } else {
             dbase_add_record($db, $reg);
         }
         $novoshpf->addshape($s);
         $conta = $conta + 1;
     }
     if ($this->dbaseExiste == false) {
         xbase_close($db);
     } else {
         dbase_close($db);
     }
     $l->set("opacity", 80);
     $l->setmetadata("tema", $novonomelayer . $tituloTema);
     $l->setmetadata("TEMALOCAL", "SIM");
     $l->setmetadata("DOWNLOAD", "sim");
     $l->set("data", $nomeshp);
     $l->set("name", $novonomelayer);
     $classe = $l->getclass(0);
     $estilo = $classe->getstyle(0);
     if ($tiposhape == 0) {
         $estilo->set("symbolname", "ponto");
         $estilo->set("size", 6);
     }
     $cor = $estilo->color;
     $cor->setrgb(255, 210, 0);
     $cor = $estilo->outlinecolor;
     $cor->setrgb(255, 0, 0);
     $this->salva();
     return $novonomelayer;
 }
コード例 #15
0
ファイル: funcoes_gerais.php プロジェクト: edmarmoretti/i3geo
function criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand = TRUE, $prj = "", $projetaToMap = true, $shapesSel = false)
{
    include dirname(__FILE__) . "/../ms_configura.php";
    $versao = versao();
    $versao = $versao["principal"];
    //para manipular dbf
    if (file_exists($locaplic . "/pacotes/phpxbase/api_conversion.php")) {
        include_once $locaplic . "/pacotes/phpxbase/api_conversion.php";
    } else {
        include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
    }
    $map = @ms_newMapObj($map_file);
    $nameMapfile = $map->name;
    substituiConObj($map, $postgis_mapa);
    $layer = $map->getlayerbyname($tema);
    //e necessario abrir ou nao vai projetar
    $layer->open();
    $prjMapa = $map->getProjection();
    $prjTema = $layer->getProjection();
    if ($prjTema != "") {
        $projInObj = new projectionObj($prjTema);
        $projOutObj = new projectionObj($prjMapa);
    } else {
        $projInObj = "";
        $projOutObj = "";
        $projetaToMap = false;
    }
    $layer->set("template", "none.htm");
    $diretorio = dirname($dir_tmp);
    $tipol = MS_SHP_POINT;
    if ($layer->type == MS_LAYER_LINE) {
        $tipol = MS_SHP_ARC;
    }
    if ($layer->type == MS_LAYER_POLYGON) {
        $tipol = MS_SHP_POLYGON;
    }
    if ($nomeRand == true) {
        $novonomelayer = $tema . "_" . nomeRandomico(5);
    } else {
        $novonomelayer = $tema;
    }
    $novonomelayer = str_replace(".", "-", $novonomelayer);
    $nomeshp = $dir_tmp . "/" . $nameMapfile . "_" . $novonomelayer;
    if (file_exists($nomeshp . ".shp")) {
        return $nomeshp;
    }
    $novoshpf = ms_newShapefileObj($nomeshp, $tipol);
    //se for do tipo features
    $data = $layer->data;
    $resultadoFinal = true;
    if ($data == "") {
        $def[] = array("ID", "C", "50");
        $reg[] = 0;
        if (!function_exists("dbase_create")) {
            $db = xbase_create($nomeshp . ".dbf", $def);
            xbase_add_record($db, $reg);
            xbase_close($db);
        } else {
            $db = dbase_create($nomeshp . ".dbf", $def);
            dbase_add_record($db, $reg);
            dbase_close($db);
        }
        if ($versao >= 6) {
            $shape = $layer->getshape(new resultObj(0));
        } else {
            $s = $layer->getfeature(0, -1);
            $result = $layer->getResult(0);
            $shpi = $result->shapeindex;
            $shape = $layer->getfeature($shpi, -1);
        }
        $novoshpf = ms_newShapefileObj($nomeshp . ".shp", -2);
        $novoshpf->addShape($shape);
        $resultadoFinal = true;
    } else {
        if ($shapesSel == false) {
            $shapesSel = retornaShapesSelecionados($layer, $map_file, $map, false);
        }
        $items = pegaItens($layer);
        // cria o dbf
        $def = array();
        $cni = 0;
        foreach ($items as $ni) {
            $temp = strtoupper($ni);
            $temp = substr($temp, 0, 8) . $cni;
            //
            //nao tem como descobrir o tamanho e tipo do campo
            //
            $def[] = array($temp, "C", "254");
            $cni = $cni + 1;
        }
        if (!function_exists("dbase_create")) {
            $db = xbase_create($nomeshp . ".dbf", $def);
        } else {
            $db = dbase_create($nomeshp . ".dbf", $def);
        }
        $dbname = $nomeshp . ".dbf";
        $reg = array();
        $novoshpf = ms_newShapefileObj($nomeshp . ".shp", -2);
        $res_count = count($shapesSel);
        if ($res_count > 0) {
            for ($i = 0; $i < $res_count; ++$i) {
                $shape = $shapesSel[$i];
                if ($projetaToMap == true) {
                    $shape->project($projInObj, $projOutObj);
                }
                foreach ($items as $ni) {
                    $vreg = $shape->values[$ni];
                    if (strlen($vreg) > 255) {
                        $vreg = substr($vreg, 0, 255);
                    }
                    $reg[] = $vreg;
                }
                $novoshpf->addShape($shape);
                if (!function_exists("dbase_create")) {
                    xbase_add_record($db, $reg);
                } else {
                    dbase_add_record($db, $reg);
                }
                $reg = array();
            }
            if (!function_exists("dbase_create")) {
                xbase_close($db);
            } else {
                dbase_close($db);
            }
            //
            //verifica a quantidade de registros no final
            //
            if (function_exists("dbase_open")) {
                $db = dbase_open($nomeshp . ".dbf", 0);
            } else {
                $db = xbase_open($nomeshp . ".dbf", 0);
            }
            if (function_exists("dbase_numrecords")) {
                $record_numbers = dbase_numrecords($db);
            } else {
                $record_numbers = xbase_numrecords($db);
            }
            if (function_exists("dbase_close")) {
                dbase_close($db);
            } else {
                xbase_close($db);
            }
            if ($record_numbers != $res_count) {
                if (file_exists($nomeshp . ".dbf")) {
                    unlink($nomeshp . ".dbf");
                }
                if (file_exists($nomeshp . ".shp")) {
                    unlink($nomeshp . ".shp");
                }
                if (file_exists($nomeshp . ".shx")) {
                    unlink($nomeshp . ".shx");
                }
                if (file_exists($nomeshp . ".prj")) {
                    unlink($nomeshp . ".prj");
                }
                $resultadoFinal = false;
            }
        } else {
            $resultadoFinal = false;
        }
    }
    if ($resultadoFinal == false) {
        return false;
    } else {
        //gera o arquivo prj
        if ($prj != "") {
            gravaDados(array($prj), $nomeshp . ".prj");
        } elseif ($projetaToMap == false) {
            $nomePrjOriginal = str_replace(".shp", ".prj", $layer->data);
            $nomeDestino = $nomeshp . ".prj";
            if (file_exists($nomePrjOriginal) && !file_exists($nomeDestino)) {
                copy($nomePrjOriginal, $nomeDestino);
            }
        }
        return $nomeshp;
    }
}
コード例 #16
0
ファイル: export.shp.php プロジェクト: sukma279/GIS
 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);
 }
コード例 #17
0
ファイル: mantenimiento.php プロジェクト: enderochoa/tortuga
 function crea_orden_pago()
 {
     $this->load->dbforge();
     if (extension_loaded('dbase')) {
         $item_orden = array(array('nro_op', 'N', 8, 0), array('orden_nro', 'C', 8), array('tipo_pres', 'C', 20), array('fecha_op', 'C', 10), array('benef_op', 'C', 50), array('cedb_op', 'C', 15), array('autor1_op', 'C', 50), array('compr_op', 'C', 20), array('monto_op', 'N', 10, 2), array('descrip_op', 'C', 1000));
         if (!dbase_create('/tmp/orden_pago.dbf', $item_orden)) {
             echo "Error, can't create the database\n";
         } else {
             $item_orden = dbase_open('/tmp/orden_pago.dbf', 2);
             $query = "SELECT a.numero,a.numero numero2,a.fondo,a.fecha,c.nombre,c.rif,c.contacto,a.compromiso,a.total2,a.observa\n\t\t\t\tFROM v_pagos a \n\t\t\t\tJOIN sprv c ON a.cod_prov=c.proveed\n\t\t\t\tLEFT JOIN v_presaldo b ON a.codigoadm=b.codigoadm AND a.fondo=b.fondo AND a.codigopres=b.codigo\n\t\t\t\tWHERE MID(status,2,1) IN (2,3) \n\t\t\t\tGROUP BY a.numero";
             $mSQL = $this->db->query($query);
             $datos = array();
             foreach ($mSQL->result() as $row) {
                 $datos[0] = $row->numero;
                 $datos[1] = $row->numero2;
                 $datos[2] = $row->fondo;
                 $datos[3] = $row->fecha;
                 $datos[4] = $row->nombre;
                 $datos[5] = $row->rif;
                 $datos[6] = $row->contacto;
                 $datos[7] = $row->compromiso;
                 $datos[8] = $row->total2;
                 $datos[9] = $row->observa;
                 dbase_add_record($item_orden, $datos);
             }
             dbase_close($item_orden);
         }
     }
     $this->load->helper('download');
     $data = file_get_contents("/tmp/orden_pago.dbf");
     // Read the file's contents
     $name = 'orden_pago.dbf';
     force_download($name, $data);
     unlink("/tmp/orden_pago.dbf");
 }
コード例 #18
0
ファイル: dbf_createoop06.php プロジェクト: robocon/shs
			$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 ╩т╢йь╢╥Ирб
?>
コード例 #19
0
ファイル: dbf_createdru16.php プロジェクト: robocon/shs
						$newreason, 																																		  				  
						$pano));     
						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 �Դ�ش����
コード例 #20
0
ファイル: jkdbase.inc.php プロジェクト: relipse/jkdbase-php
 /**
  * Add a new record to the database
  * If it is an associative array, you must use get_empty_record() 
  * to ensure that everything is empty EXCEPT those in $row
  *
  * TODO: After it gets added, how do we know without doing a search?
  * @param array $row an array of rows
  * @param bool $fillempty do we populate the array with empty values? (using the header_info)
  * @return bool true on added, false on failure (dbase_add_record() result)
  */
 public function add($row, $fillempty = true)
 {
     $this->add_info = array();
     if (is_assoc_array($row)) {
         if ($fillempty) {
             $new_row = $this->get_empty_record();
             $this->add_info['invalid_key_count'] = 0;
             //copy all values to the $new_row
             foreach ($new_row as $k => $v) {
                 if (isset($row[$k])) {
                     $new_row[$k] = $row[$k];
                 } else {
                     $this->add_info['invalid_key_count']++;
                 }
             }
             //ok now $row should ONLY contain valid data
             $row = $new_row;
         }
         //we can't add a deleted row, therefore:
         unset($row["deleted"]);
         // drop the field
         $this->add_info['associative_row'] = $row;
         // then convert to numeric to store:
         $rarr = array();
         foreach ($row as $i => $vl) {
             $rarr[] = $vl;
         }
         $row = $rarr;
         $this->add_info['row'] = $row;
     }
     //end if an associative array
     //first convert record to a normal array (if it is associative)
     $this->add_info['added'] = dbase_add_record($this->db, $row);
     return $this->add_info['added'];
 }
コード例 #21
0
ファイル: create_dbfopd-date.php プロジェクト: robocon/shs
		$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 »Ô´ÊØ´·éÒÂ
?>
コード例 #22
0
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);
}
コード例 #23
0
 /**
  * Converte um tipo de regiao em shapefile
  * @param codigo do tipo de regiao
  * @return nome do arquivo criado
  */
 function regiao2shp($codigo_tipo_regiao)
 {
     $regiao = $this->listaTipoRegiao($codigo_tipo_regiao);
     $dados = $this->obtemDadosTabelaDB($regiao["codigo_estat_conexao"], $regiao["esquemadb"], $regiao["tabela"], "sim");
     $tipol = $this->listaPropGeoRegiao($codigo_tipo_regiao);
     include_once dirname(__FILE__) . "/../../classesphp/classe_shp.php";
     $s = new SHP();
     //st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON
     //echo MS_SHP_POINT.", ".MS_SHP_ARC.", ".MS_SHP_POLYGON.", ".MS_SHP_MULTIPOINT;
     //1, 3, 5, 8
     $conv[0] = 1;
     $conv[1] = 3;
     $conv[2] = 5;
     //cria as colunas
     $cni = 0;
     foreach ($dados["colunas"] as $t) {
         $temp = strtoupper($t["field"]);
         if (strlen($temp) > 10) {
             $temp = substr($temp, 0, 8) . $cni++;
         }
         if ($t["type"] == "varchar" || $t["type"] == "char" || $t["type"] == "character varying" || $t["type"] == "character" || $t["type"] == "text") {
             $def[] = array($temp, "C", "254");
         } else {
             if ($t["lengthvar"] < 0) {
                 $t["lengthvar"] = 0;
             }
             $def[] = array($temp, "N", $t["length"], $t["lengthvar"]);
         }
     }
     $nomeshp = $this->dir_tmp . "/regiao{$codigo_tipo_regiao}" . "_" . $this->nomeRandomico();
     $dbaseExiste = false;
     if (function_exists("dbase_create")) {
         $dbaseExiste = true;
     }
     //para manipular dbf
     if ($dbaseExiste == false) {
         include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
         $db = xbase_create($nomeshp . ".dbf", $def);
     } else {
         $db = dbase_create($nomeshp . ".dbf", $def);
     }
     $dbname = $nomeshp . ".dbf";
     $reg = array();
     $novoshpf = ms_newShapefileObj($nomeshp . ".shp", $conv[$tipol["st_dimension"]]);
     $cols = $dados["colunas"];
     $nc = count($dados["colunas"]);
     foreach ($dados["linhas"] as $l) {
         $reg = array();
         for ($i = 0; $i < $nc; $i++) {
             if ($cols[$i]["type"] != "geometry" && $cols[$i]["type"] != "geography") {
                 $reg[] = $l[$i];
             } else {
                 $reg[] = 0;
                 if ($cols[$i]["field"] == $regiao["colunageo"]) {
                     $shape = ms_shapeObjFromWkt($l[$i]);
                 }
             }
         }
         $novoshpf->addShape($shape);
         if ($dbaseExiste == false) {
             xbase_add_record($db, $reg);
         } else {
             dbase_add_record($db, $reg);
         }
     }
     if ($this->dbaseExiste == false) {
         xbase_close($db);
     } else {
         dbase_close($db);
     }
     return $nomeshp;
 }
コード例 #24
0
ファイル: autodebet1.php プロジェクト: anggadjava/sisfor
function file0()
{
    include_once "dwo.lib.php";
    //HdrExcl(HOME_FOLDER  .  DS . "tmp/cobacsv.csv");
    echo "<body bgcolor=#EEFFFF>";
    $dat = $_SESSION['AD' . $_SESSION['ADPOS']];
    $arr = explode('~', $dat);
    $mhsw = GetFields('mhsw', 'MhswID', $arr[0], "Nama, NamaBank, NomerRekening, ProdiID");
    $khs = GetFields('khs', 'KHSID', $arr[1], "TahunID, Biaya, Potongan, Bayar, Tarik, TotalSKS");
    //$krs  = GetaField('krs left outer join jadwal j on krs.JadwalID = j.JadwalID', "j.JenisJadwalID = 'R' and KHSID", $khs['KHSID'], 'count(krs.KRSID)');
    $krs = GetaField('krstemp k left outer join jadwal j on k.JadwalID=j.JadwalID', "k.TahunID='{$khs['TahunID']}' and k.MhswID='{$arr['0']}' and j.JenisJadwalID", 'R', "count(*)");
    $balance = $khs['Biaya'] - $khs['Bayar'] - $khs['Potongan'] + $khs['Tarik'];
    $bpm = GetFields('bayarmhsw', "TahunID='{$khs['TahunID']}' and Autodebet=1 and MhswID", $arr[0], '*');
    $bpmid = $bpm['BayarMhswID'];
    //echo "<h1>&raquo; $khs[TahunID] ($arr[1]) - $bpmid</h1>";
    echo "Processing: #" . $_SESSION['ADPOS'] . " : <b>" . $arr[0] . ' (' . $arr[1] . ")</b><hr>";
    // baca header
    $nmf = HOME_FOLDER . DS . "tmp/{$_SESSION['_Login']}.autodebet.hdr.csv";
    $f = fopen($nmf, 'r');
    $_hdr = fread($f, filesize($nmf));
    fclose($f);
    // ekstrak header
    $_arrhdr = explode(chr(13) . chr(10), $_hdr);
    $hdr = $_arrhdr[0];
    $arrhdr = explode(';', $hdr);
    $detail = GetDetailBPM($arr[0], $arr[1], $khs['TahunID'], $arrhdr);
    //$jumlahPrak = GetaField()
    $det = implode(';', $detail);
    $fak = substr($mhsw['ProdiID'], 0, 1);
    $jur = substr($mhsw['ProdiID'], 1, 1);
    $bpmnostrip = str_replace('-', '', $bpmid);
    //$nmf = HOME_FOLDER  .  DS . "tmp/$_SESSION[_Login].autodebet.csv";
    //$f = fopen($nmf, 'a');
    $isi = array($khs['TahunID'], $fak, $jur, $arr[0], $mhsw['Nama'], $balance, '', $detail[1], $detail[2], $detail[3], $detail[4], $detail[5], $detail[6], $detail[7], '0', $bpmnostrip, $khs['TotalSKS'], $krs);
    $namadbfisi = "autodebet/autodebet-{$_SESSION['tahun']}-{$_SESSION['prodi']}.dbf";
    $conn = dbase_open($namadbfisi, 2);
    dbase_add_record($conn, $isi);
    // hihihi...
    if ($_SESSION['ADPOS'] < $_SESSION['MaxData'] - 1) {
        echo "<script type='text/javascript'>window.onload=setTimeout('window.location.reload()', 2);</script>";
    } else {
        echo "<hr><p>Proses pembuatan file <b>Berhasil</b>. Silakan download file di:\r\n    <input type=button name='Download' value='Download File' onClick=\"location='downloaddbf.php?fn={$namadbfisi}'\">\r\n    </p>";
    }
    $_SESSION['ADPOS']++;
}
コード例 #25
0
ファイル: stats_dbf.php プロジェクト: uisluu/emst
function OutSurgery($ADBF, $ACase, $ASurgery, $AService)
{
    $vSMOList = locGetSMOList();
    $vDocSeries = trim(str_replace('-', ' ', $ACase['doc_series']));
    $vSpacePos = strpos($vDocSeries, ' ');
    if ($vSpacePos === false) {
        $vSerLeft = substr($vDocSeries, 0, 2);
        $vSerRight = substr($vDocSeries, 2);
    } else {
        $vSerLeft = substr($vDocSeries, 0, $vSpacePos);
        $vSerRight = substr($vDocSeries, $vSpacePos + 1);
    }
    $vBornDate = $ACase['born_date'];
    if (empty($vBornDate)) {
        $vBornDate = '0000-00-00';
    }
    $vBornDate = explode('-', $vBornDate);
    if ($vBornDate[0] == '0000') {
        $vBornDate[0] = '1901';
    }
    if ($vBornDate[1] == '00') {
        $vBornDate[1] = '01';
    }
    if ($vBornDate[2] == '00') {
        $vBornDate[2] = '01';
    }
    $vBornDate = implode('-', $vBornDate);
    $vSurgeryDate = $ASurgery['date'];
    //        Trace(@$ACase['insurance_company_id'].'=->'.@$vSMOList[$ACase['insurance_company_id']]);
    $vFirstDoctorId = $ACase['first_doctor_id'];
    $CurrDoctorId = $ASurgery['user_id'];
    $vRecord = array(FormatName($ACase['last_name']), FormatName($ACase['first_name']), FormatName($ACase['patr_name']), Date2DBF($vBornDate), $ACase['is_male'] ? 'м' : 'ж', 'э', strtoupper($ACase['polis_series']), strtoupper($ACase['polis_number']), '', '', $ACase['addr_reg_street'], '', '', $ACase['addr_reg_num'], $ACase['addr_reg_subnum'], $ACase['addr_reg_apartment'], 'аТрОт', CalcAge($vBornDate, $vSurgeryDate) >= 18 ? 'в' : 'д', Date2DBF($vSurgeryDate), Date2DBF($vSurgeryDate), '1', str_replace(' ', '', $ACase['diagnosis_mkb']), false, '', $ACase['doc_type_id'], $vSerLeft, $vSerRight, $ACase['doc_number'], FormatAddress(@$ACase['addr_reg_street'], @$ACase['addr_reg_num'], @$ACase['addr_reg_subnum'], @$ACase['addr_reg_apartment']), @$ACase['id'], 1, 0, 23, 'тр.' . @$ACase['id'], 118, 118, str_replace(' ', '', $ACase['diagnosis_mkb']), '', '', 16, 31, 31, 29, 1, 1, getUserEisCode($CurrDoctorId), getUserEisCode($vFirstDoctorId), '1', '1', 0, 0, 0, 0, 3, 5, 5, 0, 2, 0, 0, 0, 0);
    $vOutRecord = array();
    foreach ($vRecord as $vField) {
        $vOutRecord[] = iconv('UTF-8', 'CP866', $vField);
    }
    dbase_add_record($ADBF, $vOutRecord);
}
コード例 #26
0
 function _saveDBFData()
 {
     unset($this->DBFData["deleted"]);
     if ($this->recordNumber <= dbase_numrecords($this->DBFFile)) {
         if (!dbase_replace_record($this->DBFFile, array_values($this->DBFData), $this->recordNumber)) {
             $this->setError("I wasn't possible to update the information in the DBF file.");
         }
     } else {
         if (!dbase_add_record($this->DBFFile, array_values($this->DBFData))) {
             $this->setError("I wasn't possible to add the information to the DBF file.");
         }
     }
 }
コード例 #27
0
ファイル: insure_diskette.php プロジェクト: jafarkhani/rtfund
    					round($monthly_fee),
    					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));
		}
		
		
		//...........................................................
コード例 #28
0
ファイル: networks.php プロジェクト: muthulatha/iem
 if ($format == "shapefile") {
     /* Create SHP,DBF bases */
     $filePre = "{$network}_locs";
     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";
         }
コード例 #29
0
ファイル: dbase.php プロジェクト: naao/myshop
 /**
  * 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;
 }
コード例 #30
-3
ファイル: Mice.php プロジェクト: rico/miceminer-php
 /**
  * Export the data for a specific mouse over s specified time range to a dbase file
  *
  * @returns url of created dbase file
  */
 function exportToDbase($rfid, $from, $to)
 {
     $parameters['rfid'] = $rfid;
     $parameters['from'] = $from;
     $parameters['to'] = $to;
     $parameters["all"] = 1;
     list($summary, $data) = $this->getRfidData($parameters);
     if (sizeof($data) == 0) {
         return null;
     }
     // boxes
     $boxes = $summary['boxes'];
     // where to store the files
     $downloadXML = $this->configXML->xpath("//downloaddir");
     $downloadDir = implode('', $downloadXML);
     $downloadUrlXML = $this->configXML->xpath("//downloadurl");
     $downloadURL = implode('', $downloadUrlXML);
     // Adding data to dbf files
     // definition for the dbf files
     $def = array(array("ID", "N", 5, 0), array("RFID", "C", 10), array("YEAR", "C", 4), array("MONTH", "C", 2), array("TIME", "C", 8), array("DATETIME", "C", 19), array("BOX", "C", 2), array("ANTENNA", "C", 2), array("X", "N", 3, 0), array("Y", "N", 3, 0));
     // create a dbf_file
     //$dbf_file = $downloadDir.$rfid . "_" . $year . "_" . $month . ".dbf";
     // $dbf_file = "data_for_" . $rfid . "_" . $from . "_" . $to . ".csv";
     $filename = "data_for_" . $rfid . "_" . $from . "_" . $to . ".dbf";
     $dbf_file = $downloadDir . $filename;
     if (!dbase_create($dbf_file, $def)) {
         return "Error, can't create the database: {$dbf_file}\n";
     }
     // open dbf file for reading and writing
     $dbf_file = dbase_open($dbf_file, 2);
     //$fh = fopen ($downloadDir.$dbf_file, "w");
     // write data
     // the datasets have the form: [rfid, antenna, box, time]
     $id = 0;
     foreach ($data as $dataset) {
         list($rfid, $antenna, $unix_time) = $dataset;
         $box = substr($antenna, 0, 2);
         $datetime = date('Y-m-d H:i:s', $unix_time);
         $month = date('m', $unix_time);
         $year = date('Y', $unix_time);
         $time = date('H:i:s', $unix_time);
         $x = $boxes["{$box}"]['x'];
         $y = $boxes[$box]['y'];
         $dataset_converted = array($id, $rfid, $year, $month, $time, $datetime, $antenna, $box, $x, $y);
         $str = implode(',', $dataset_converted) . "\n";
         //fwrite($fh, $str);
         dbase_add_record($dbf_file, $dataset_converted) or die("Could not add record to dbf file {$dbase_file}.");
         $id++;
     }
     dbase_close($dbf_file);
     //fclose($fh);
     // returning url
     return $downloadURL . $filename;
 }