Esempio n. 1
3
 public function prueba()
 {
     $conex = dbase_open('C:\\mficha.DBF', 0);
     //return dbase_get_header_info($conex);
     $total_registros = dbase_numrecords($conex);
     for ($i = 1; $i <= $total_registros; $i++) {
         echo dbase_get_record($conex, $i)[0] . '<br>';
     }
 }
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;
}
Esempio n. 3
0
 public function convert()
 {
     $delayed_objects = array();
     $num_records = dbase_numrecords($this->_link);
     for ($i = 1; $i <= $num_records; $i++) {
         $record = dbase_get_record($this->_link, $i);
         if ('skip_record' === ($obj = $this->_parseRecord($record))) {
             continue;
         }
         if ('delay_object' === $this->_insertObject($obj)) {
             $delayed_objects[] = $obj;
         }
     }
     foreach ($delayed_objects as $obj) {
         $this->_insertObject($obj, true);
     }
     //var_export($this->_region_abbrs);
     //var_export($this->_local_abbrs);
     return $this;
 }
Esempio n. 4
0
 /**
  * Places a row from the result set into the given array
  *
  * Formating of the array and the data therein are configurable.
  * See DB_result::fetchInto() for more information.
  *
  * This method is not meant to be called directly.  Use
  * DB_result::fetchInto() instead.  It can't be declared "protected"
  * because DB_result is a separate object.
  *
  * @param resource $result    the query result resource
  * @param array    $arr       the referenced array to put the data in
  * @param int      $fetchmode how the resulting array should be indexed
  * @param int      $rownum    the row number to fetch (0 = first row)
  *
  * @return mixed  DB_OK on success, NULL when the end of a result set is
  *                 reached or on failure
  *
  * @see DB_result::fetchInto()
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum === null) {
         $rownum = $this->res_row[(int) $result]++;
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @dbase_get_record_with_names($this->connection, $rownum);
         if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
             $arr = array_change_key_case($arr, CASE_LOWER);
         }
     } else {
         $arr = @dbase_get_record($this->connection, $rownum);
     }
     if (!$arr) {
         return null;
     }
     if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
         $this->_rtrimArrayValues($arr);
     }
     if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
         $this->_convertNullArrayValuesToEmpty($arr);
     }
     return DB_OK;
 }
Esempio n. 5
0
 function fetchInto($res, &$row, $fetchmode, $rownum = null)
 {
     if ($rownum === null) {
         $rownum = $this->res_row[$res]++;
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $row = @dbase_get_record_with_names($this->connection, $rownum);
     } else {
         $row = @dbase_get_record($this->connection, $rownum);
     }
     if (!$row) {
         return null;
     }
     return DB_OK;
 }
Esempio n. 6
0
 public function buscar($id)
 {
     return dbase_get_record($this->conexao, $id);
 }
Esempio n. 7
0
<?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);
}
Esempio n. 8
0
         if ($en_tete[$i] == $tabchamps[$k]) {
             $tabindice[] = $i;
         }
     }
 }
 affiche_debug("<table border=\"1\">\n");
 affiche_debug("<tr><td>Num.</td><td>ABSTYPE</td><td>ELENOET</td><td>ABSDATD</td><td>ABSDATF</td><td>ABSSEQD</td><td>ABSSEQF</td><td>ABSHEUR</td><td>ABSJUST</td><td>ABSMOTI</td><td>ABSACTI</td></tr>\n");
 //=========================
 // AJOUT: boireaus 20071202
 $previous_eleve = "";
 //=========================
 $nb_reg_no = 0;
 $nb_record = 0;
 for ($k = 1; $k < $nblignes + 1; $k++) {
     //                echo "<tr><td>$k</td>\n";
     $ligne = dbase_get_record($fp, $k);
     for ($i = 0; $i < count($tabchamps); $i++) {
         $affiche[$i] = dbase_filter(trim($ligne[$tabindice[$i]]));
     }
     // premier tri sur les dates
     if ($affiche[2] >= $datedebut and $affiche[3] <= $datefin) {
         if ($temp = array_search($affiche[1], $tab)) {
             affiche_debug("<tr>\n");
             affiche_debug("<td>{$k}</td>\n");
             for ($loop = 0; $loop < count($affiche); $loop++) {
                 affiche_debug("<td>{$affiche[$loop]}</td>\n");
             }
             affiche_debug("</tr>\n");
             // Pour que les erreurs s'affichent au bon niveau:
             affiche_debug("<tr>\n");
             affiche_debug("<td colspan='11'>\n");
Esempio n. 9
0
 function execute()
 {
     $toFix = false;
     $archiveDBFname = $this->path;
     $variables = new Variables();
     $MySQLconnect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     if (!($DFBconnect = dbase_open($archiveDBFname, 0))) {
         //only reading
         return false;
     }
     //Connection to DBF error
     //get number of rows of dbf table
     $numRows = dbase_numrecords($DFBconnect);
     //get number of files of dbf table
     $numFields = dbase_numfields($DFBconnect);
     //the DBF registers begins with 1
     for ($x = 1; $x <= $numRows; $x++) {
         $DBFrow = dbase_get_record($DFBconnect, $x);
         //Get DBF archive rows
         $this->DB[$x - 1] = $DBFrow;
     }
     /*$host_ftp = "localhost";
     		$user_ftp = "root";
     		$pass_ftp = "";
     		
     		// Faz a conexão com o Servidor
     		$ftp_con = ftp_connect($host_ftp);
     		// Efetua o login com o usuário e senha informados
     		$ftp_log = ftp_login($ftp_con,$user_ftp,$pass_ftp);
     		
     		// Deleta o arquivo informado
     		if(!ftp_delete($ftp_con, $archiveDBFname))
     			die("ERRO CRITICO FTP!");
     		
     		// Encerramos a conexão de FTP previamente estabelecida
     		ftp_close($ftp_con);*/
     /*echo(decoct(777)."<br/>");
     		$temp = stat($archiveDBFname);
     		echo(octdec($temp["mode"])."<br/>");
     		echo(octdec(fileperms($archiveDBFname)));
     		if(!unlink($archiveDBFname))
     			die("ERRO CRITICO!");
     			
     		die("OK");*/
     //unlink($archiveDBFname)
     if (!$MySQLconnect->start()) {
         echo "Impossible to star connection in Handler.";
     }
     if (strlen($this->folhaType) > 0) {
         $row = mysql_fetch_assoc($MySQLconnect->execute("SELECT codigo_fol FROM Folhas where nome='{$this->folhaType}'"));
         $code = $row["codigo_fol"];
     }
     for ($x = 0; $x < $numRows; $x++) {
         switch ($this->tableId) {
             case "dcr":
                 $aux = array("INSERT INTO Cargos (cargo, descricao_cargo , tipo, vencimento) VALUES ('" . $this->DB[$x][0] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][1])) . "', '" . $this->DB[$x][2] . "', " . $this->DB[$x][3] . ")");
                 break;
             case "dlt":
                 $aux = array("INSERT INTO Lotacoes (lotacao, descricao_lotacao , secretaria) VALUES ('" . $this->DB[$x][0] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][1])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][2])) . "')");
                 break;
             case "especial":
                 $aux = array("INSERT INTO Especialidades (codigo_esp, descricao_especialidade , cargo) VALUES ('" . $this->DB[$x][0] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][1])) . "', '" . $this->DB[$x][2] . "')");
                 break;
             case "eventos":
                 $aux = array("INSERT INTO Eventos (codigo_eve, descricao_evento, IRRF, IPMT, FAL, FIXO, TEMP, valor_eve, GRAT, FGTS, desconto, nivel_eve, INSS) VALUES ('" . $this->DB[$x][0] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][1])) . "',  '" . $this->DB[$x][2] . "',  '" . $this->DB[$x][3] . "',  '" . $this->DB[$x][4] . "',  '" . $this->DB[$x][5] . "',  '" . $this->DB[$x][6] . "',  " . $this->DB[$x][7] . ",  '" . $this->DB[$x][8] . "',  '" . $this->DB[$x][9] . "',  " . $this->DB[$x][10] . ", '" . $this->DB[$x][11] . "', '" . $this->DB[$x][12] . "')");
                 break;
             case "cadastro":
                 $date = explode("-", $_SESSION["day"]);
                 $query = "SELECT * FROM Cadastros WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "' AND codigo_fol=" . $code;
                 $result = $MySQLconnect->execute($query);
                 $cont = $MySQLconnect->counterResult($result);
                 if ($code == 1) {
                     if ($cont > 0) {
                         $aux = array("UPDATE Cadastros SET cargo='" . $this->DB[$x][8] . "', lotacao='" . $this->DB[$x][1] . "', data_admissao='" . $this->dateFormater($this->DB[$x][4]) . "', vinculo='" . $this->DB[$x][5] . "', previdencia'" . $this->DB[$x][7] . "', nivel='" . $this->DB[$x][9] . "', dep_imp_re='" . $this->DB[$x][11] . "', hora_sem='" . $this->DB[$x][13] . "', instrucao='" . $this->DB[$x][14] . "', data_afastamento='" . $this->dateFormater($this->DB[$x][18]) . "', sindical='" . $this->DB[$x][19] . "', dp_sal_fam='" . $this->DB[$x][20] . "', hora_ponto='" . $this->DB[$x][21] . "', vale_transporte='" . $this->DB[$x][22] . "', data_promocao='" . $this->dateFormater($this->DB[$x][24]) . "', tipo='" . $this->DB[$x][27] . "', situacao='" . $this->DB[$x][28] . "', descontar='" . $this->DB[$x][29] . "', receber='" . $this->DB[$x][30] . "', funcao='" . $this->DB[$x][31] . "', maior_360='" . $this->DB[$x][33] . "', prof_40h='" . $this->DB[$x][34] . "', vlt_ver='" . $this->DB[$x][35] . "', val_niv=" . $this->valueFormater($this->DB[$x][36]) . ", data_FGTS='" . $this->dateFormater($this->DB[$x][37]) . "', permanente='" . $this->DB[$x][38] . "', remuneracao_bruto=" . $this->valueFormater($this->DB[$x][39]) . ", vencimento=" . $this->valueFormater($this->DB[$x][40]) . ", flag='" . $this->DB[$x][41] . "', entrada='" . $this->DB[$x][42] . "', liquido=" . $this->valueFormater($this->DB[$x][45]) . ", sobregrat='" . $this->DB[$x][46] . "', assistencia='" . $this->DB[$x][47] . "', medico='" . $this->DB[$x][48] . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Pessoal SET nome='" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', sexo='" . $this->DB[$x][12] . "', CPF='" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', PIS_PASEP='" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  data_nascimento='" . $this->dateFormater($this->DB[$x][17]) . "', ultimo_nome='" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE RG SET identidade='" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', orgao_expedidor='" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Inf_Bancaria SET conta='" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', banco='" . $this->DB[$x][43] . "',  numero='" . addslashes(zkl($this->xkey, $this->DB[$x][44])) . "' WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "' AND codigo_fol=" . $code . "");
                     } else {
                         $aux = array("INSERT INTO Cadastros (matricula, cargo, lotacao, data_admissao, vinculo, previdencia, nivel, dep_imp_re, hora_sem, instrucao, data_afastamento, sindical, dp_sal_fam, hora_ponto, vale_transporte, data_promocao, tipo, situacao, descontar, receber, funcao, maior_360, prof_40h, vlt_ver, val_niv, data_FGTS, permanente, remuneracao_bruto, vencimento, flag, entrada, liquido, sobregrat, assistencia, medico, senha, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->DB[$x][8] . "', '" . $this->DB[$x][1] . "', '" . $this->dateFormater($this->DB[$x][4]) . "', '" . $this->DB[$x][5] . "', '" . $this->DB[$x][7] . "', '" . $this->DB[$x][9] . "', '" . $this->DB[$x][11] . "', '" . $this->DB[$x][13] . "', '" . $this->DB[$x][14] . "', '" . $this->dateFormater($this->DB[$x][18]) . "', '" . $this->DB[$x][19] . "', '" . $this->DB[$x][20] . "', '" . $this->DB[$x][21] . "', '" . $this->DB[$x][22] . "', '" . $this->dateFormater($this->DB[$x][24]) . "', '" . $this->DB[$x][27] . "', '" . $this->DB[$x][28] . "', '" . $this->DB[$x][29] . "', '" . $this->DB[$x][30] . "', '" . $this->DB[$x][31] . "', '" . $this->DB[$x][33] . "', '" . $this->DB[$x][34] . "', '" . $this->DB[$x][35] . "', " . $this->valueFormater($this->DB[$x][36]) . ", '" . $this->dateFormater($this->DB[$x][37]) . "', '" . $this->DB[$x][38] . "', " . $this->valueFormater($this->DB[$x][39]) . ", " . $this->valueFormater($this->DB[$x][40]) . ", '" . $this->DB[$x][41] . "', '" . $this->DB[$x][42] . "', " . $this->valueFormater($this->DB[$x][45]) . ", '" . $this->DB[$x][46] . "', '" . $this->DB[$x][47] . "', '" . $this->DB[$x][48] . "', '" . $this->passwordMaker() . "', " . $code . ")", "INSERT INTO Pessoal (matricula, nome, sexo, CPF, PIS_PASEP, data_nascimento, ultimo_nome, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', '" . $this->DB[$x][12] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  '" . $this->dateFormater($this->DB[$x][17]) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', " . $code . ")", "INSERT INTO RG (matricula, identidade, orgao_expedidor, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', " . $code . ")", "INSERT INTO Inf_Bancaria (matricula, conta, banco, numero, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', '" . $this->DB[$x][43] . "',  '" . addslashes(zkl($this->xkey, $this->DB[$x][44])) . "', " . $code . ")");
                     }
                 } else {
                     if ($code == 2) {
                         if ($cont > 0) {
                             $aux = array("UPDATE Cadastros SET cargo='" . $this->DB[$x][10] . "', lotacao='" . $this->DB[$x][1] . "', data_admissao='" . $this->dateFormater($this->DB[$x][4]) . "', vinculo='" . $this->DB[$x][5] . "', previdencia'" . $this->DB[$x][7] . "', nivel='" . $this->DB[$x][11] . "', dep_imp_re='" . $this->DB[$x][13] . "', hora_sem='" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', instrucao='" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "', data_afastamento='" . $this->dateFormater($this->DB[$x][20]) . "', sindical='" . $this->DB[$x][21] . "', dp_sal_fam='" . $this->DB[$x][22] . "', hora_ponto='" . $this->DB[$x][23] . "', vale_transporte='" . $this->DB[$x][24] . "', data_promocao='" . $this->dateFormater($this->DB[$x][26]) . "', tipo='" . $this->DB[$x][29] . "', situacao='" . $this->DB[$x][30] . "', descontar='" . $this->DB[$x][31] . "', receber='" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', funcao='" . $this->DB[$x][33] . "', maior_360='" . $this->DB[$x][35] . "', prof_40h='" . $this->DB[$x][36] . "', vlt_ver='" . $this->DB[$x][37] . "', val_niv=0, data_FGTS='" . $this->dateFormater($this->DB[$x][38]) . "', permanente='" . $this->DB[$x][40] . "', remuneracao_bruto=" . $this->valueFormater($this->DB[$x][39]) . ", vencimento=0, flag='" . $this->DB[$x][41] . "', entrada='" . $this->DB[$x][42] . "', liquido=" . $this->valueFormater($this->DB[$x][45]) . ", sobregrat='" . $this->DB[$x][8] . "', assistencia='" . $this->DB[$x][9] . "', medico='" . $this->DB[$x][46] . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Pessoal SET nome='" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', sexo='" . $this->DB[$x][14] . "', CPF='" . $this->DB[$x][17] . "', PIS_PASEP='" . $this->DB[$x][18] . "',  data_nascimento='" . $this->dateFormater($this->DB[$x][19]) . "', ultimo_nome='" . $this->DB[$x][34] . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE RG SET identidade='" . $this->DB[$x][27] . "', orgao_expedidor='" . $this->DB[$x][28] . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Inf_Bancaria SET conta='" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', banco='" . $this->DB[$x][43] . "',  numero='" . addslashes(zkl($this->xkey, $this->DB[$x][44])) . "' WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "' AND codigo_fol=" . $code . "");
                         } else {
                             $aux = array("INSERT INTO Cadastros (matricula, cargo, lotacao, data_admissao, vinculo, previdencia, nivel, dep_imp_re, hora_sem, instrucao, data_afastamento, sindical, dp_sal_fam, hora_ponto, vale_transporte, data_promocao, tipo, situacao, descontar, receber, funcao, maior_360, prof_40h, vlt_ver, val_niv, data_FGTS, permanente, remuneracao_bruto, vencimento, flag, entrada, liquido, sobregrat, assistencia, medico, senha, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->DB[$x][10] . "', '" . $this->DB[$x][1] . "', '" . $this->dateFormater($this->DB[$x][4]) . "', '" . $this->DB[$x][5] . "', '" . $this->DB[$x][7] . "', '" . $this->DB[$x][11] . "', '" . $this->DB[$x][13] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "', '" . $this->dateFormater($this->DB[$x][20]) . "', '" . $this->DB[$x][21] . "', '" . $this->DB[$x][22] . "', '" . $this->DB[$x][23] . "', '" . $this->DB[$x][24] . "', '" . $this->dateFormater($this->DB[$x][26]) . "', '" . $this->DB[$x][29] . "', '" . $this->DB[$x][30] . "', '" . $this->DB[$x][31] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', '" . $this->DB[$x][33] . "', '" . $this->DB[$x][35] . "', '" . $this->DB[$x][36] . "', '" . $this->DB[$x][37] . "', 0, '" . $this->dateFormater($this->DB[$x][38]) . "', '" . $this->DB[$x][40] . "', " . $this->valueFormater($this->DB[$x][39]) . ", 0, '" . $this->DB[$x][41] . "', '" . $this->DB[$x][42] . "', " . $this->valueFormater($this->DB[$x][45]) . ", '" . $this->DB[$x][8] . "', '" . $this->DB[$x][9] . "', '" . $this->DB[$x][46] . "', '" . $this->passwordMaker() . "', " . $code . ")", "INSERT INTO Pessoal (matricula, nome, sexo, CPF, PIS_PASEP, data_nascimento, ultimo_nome, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', '" . $this->DB[$x][14] . "', '" . $this->DB[$x][17] . "', '" . $this->DB[$x][18] . "',  '" . $this->dateFormater($this->DB[$x][19]) . "', '" . $this->DB[$x][34] . "', " . $code . ")", "INSERT INTO RG (matricula, identidade, orgao_expedidor, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->DB[$x][27] . "', '" . $this->DB[$x][28] . "', " . $code . ")", "INSERT INTO Inf_Bancaria (matricula, conta, banco, numero, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', '" . $this->DB[$x][43] . "',  '" . addslashes(zkl($this->xkey, $this->DB[$x][44])) . "', " . $code . ")");
                         }
                     } else {
                         if ($code == 3) {
                             if ($cont > 0) {
                                 $aux = array("UPDATE Cadastros SET cargo='" . $this->DB[$x][8] . "', lotacao='" . $this->DB[$x][1] . "', data_admissao='" . $this->dateFormater($this->DB[$x][4]) . "', vinculo='" . $this->DB[$x][5] . "', previdencia'" . $this->DB[$x][7] . "', nivel='" . $this->DB[$x][9] . "', dep_imp_re='" . $this->DB[$x][11] . "', hora_sem='" . $this->DB[$x][13] . "', instrucao='" . $this->DB[$x][14] . "', data_afastamento='" . $this->dateFormater($this->DB[$x][18]) . "', sindical='" . $this->DB[$x][19] . "', dp_sal_fam='" . $this->DB[$x][20] . "', hora_ponto='" . $this->DB[$x][21] . "', vale_transporte='" . $this->DB[$x][22] . "', data_promocao='" . $this->dateFormater($this->DB[$x][24]) . "', tipo='" . $this->DB[$x][27] . "', situacao='" . $this->DB[$x][30] . "', descontar='" . $this->DB[$x][31] . "', receber='" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', funcao='" . $this->DB[$x][33] . "', maior_360='" . $this->DB[$x][35] . "', prof_40h='" . $this->DB[$x][36] . "', vlt_ver='" . $this->DB[$x][37] . "', 0, data_FGTS='" . $this->dateFormater($this->DB[$x][44]) . "', permanente='" . $this->DB[$x][41] . "', remuneracao_bruto=" . $this->valueFormater($this->DB[$x][42]) . ", 0, 'z', 'z', liquido=" . $this->valueFormater($this->DB[$x][40]) . ", sobregrat='" . $this->DB[$x][43] . "', assistencia='" . $this->DB[$x][45] . "', 'z', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Pessoal SET nome='" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', sexo='" . $this->DB[$x][12] . "', CPF='" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', PIS_PASEP='" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  data_nascimento='" . $this->dateFormater($this->DB[$x][17]) . "', ultimo_nome='" . $this->DB[$x][34] . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE RG SET identidade='" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', orgao_expedidor='" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Inf_Bancaria SET conta='" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', banco='" . $this->DB[$x][38] . "',  numero='" . $this->DB[$x][39] . "' WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "' AND codigo_fol=" . $code . "");
                             } else {
                                 $aux = array("INSERT INTO Cadastros (matricula, cargo, lotacao, data_admissao, vinculo, previdencia, nivel, dep_imp_re, hora_sem, instrucao, data_afastamento, sindical, dp_sal_fam, hora_ponto, vale_transporte, data_promocao, tipo, situacao, descontar, receber, funcao, maior_360, prof_40h, vlt_ver, val_niv, data_FGTS, permanente, remuneracao_bruto, vencimento, flag, entrada, liquido, sobregrat, assistencia, medico, senha, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->DB[$x][8] . "', '" . $this->DB[$x][1] . "', '" . $this->dateFormater($this->DB[$x][4]) . "', '" . $this->DB[$x][5] . "', '" . $this->DB[$x][7] . "', '" . $this->DB[$x][9] . "', '" . $this->DB[$x][11] . "', '" . $this->DB[$x][13] . "', '" . $this->DB[$x][14] . "', '" . $this->dateFormater($this->DB[$x][18]) . "', '" . $this->DB[$x][19] . "', '" . $this->DB[$x][20] . "', '" . $this->DB[$x][21] . "', '" . $this->DB[$x][22] . "', '" . $this->dateFormater($this->DB[$x][24]) . "', '" . $this->DB[$x][27] . "', '" . $this->DB[$x][30] . "', '" . $this->DB[$x][31] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', '" . $this->DB[$x][33] . "', '" . $this->DB[$x][35] . "', '" . $this->DB[$x][36] . "', '" . $this->DB[$x][37] . "', 0, '" . $this->dateFormater($this->DB[$x][44]) . "', '" . $this->DB[$x][41] . "', " . $this->valueFormater($this->DB[$x][42]) . ", 0, 'z', 'z', " . $this->valueFormater($this->DB[$x][40]) . ", '" . $this->DB[$x][43] . "', '" . $this->DB[$x][45] . "', 'z', '" . $this->passwordMaker() . "', " . $code . ")", "INSERT INTO Pessoal (matricula, nome, sexo, CPF, PIS_PASEP, data_nascimento, ultimo_nome, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', '" . $this->DB[$x][12] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  '" . $this->dateFormater($this->DB[$x][17]) . "', '" . $this->DB[$x][34] . "', " . $code . ")", "INSERT INTO RG (matricula, identidade, orgao_expedidor, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', " . $code . ")", "INSERT INTO Inf_Bancaria (matricula, conta, banco, numero, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', '" . $this->DB[$x][38] . "',  '" . $this->DB[$x][39] . "', " . $code . ")");
                             }
                         } else {
                             if ($code == 4) {
                                 if ($cont > 0) {
                                     $aux = array("UPDATE Cadastros SET cargo='" . $this->DB[$x][8] . "', lotacao='" . $this->DB[$x][1] . "', data_admissao='" . $this->dateFormater($this->DB[$x][4]) . "', vinculo='" . $this->DB[$x][5] . "', previdencia'" . $this->DB[$x][7] . "', nivel='" . $this->DB[$x][9] . "', dep_imp_re='" . $this->DB[$x][11] . "', hora_sem='" . $this->DB[$x][13] . "', instrucao='" . $this->DB[$x][14] . "', data_afastamento='" . $this->dateFormater($this->DB[$x][18]) . "', sindical='" . $this->DB[$x][19] . "', dp_sal_fam='" . $this->DB[$x][20] . "', hora_ponto='" . $this->DB[$x][21] . "', vale_transporte='" . $this->DB[$x][22] . "', data_promocao='" . $this->dateFormater($this->DB[$x][24]) . "', tipo='" . $this->DB[$x][27] . "', situacao='" . $this->DB[$x][28] . "', descontar='" . $this->DB[$x][29] . "', receber='" . $this->DB[$x][30] . "', funcao='" . $this->DB[$x][31] . "', maior_360='" . $this->DB[$x][33] . "', prof_40h='" . $this->DB[$x][34] . "', vlt_ver='" . $this->DB[$x][35] . "', 0, data_FGTS='" . $this->dateFormater($this->DB[$x][36]) . "', permanente='z', remuneracao_bruto=" . $this->valueFormater($this->DB[$x][44]) . ", vencimento=0, flag='z', entrada='" . $this->DB[$x][37] . "', liquido=" . $this->valueFormater($this->DB[$x][38]) . ", sobregrat='" . $this->DB[$x][41] . "', assistencia='" . $this->DB[$x][42] . "', medico='z', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Pessoal SET nome='" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', sexo='" . $this->DB[$x][12] . "', CPF='" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', PIS_PASEP='" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  data_nascimento='" . $this->dateFormater($this->DB[$x][17]) . "', ultimo_nome='" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE RG SET identidade='" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', orgao_expedidor='" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', codigo_fol=" . $code . " WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "'", "UPDATE Inf_Bancaria SET conta='" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', banco='" . $this->DB[$x][39] . "',  numero='" . $this->DB[$x][40] . "' WHERE matricula='" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "' AND codigo_fol=" . $code . "");
                                 } else {
                                     $aux = array("INSERT INTO Cadastros (matricula, cargo, lotacao, data_admissao, vinculo, previdencia, nivel, dep_imp_re, hora_sem, instrucao, data_afastamento, sindical, dp_sal_fam, hora_ponto, vale_transporte, data_promocao, tipo, situacao, descontar, receber, funcao, maior_360, prof_40h, vlt_ver, val_niv, data_FGTS, permanente, remuneracao_bruto, vencimento, flag, entrada, liquido, sobregrat, assistencia, medico, senha, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->DB[$x][8] . "', '" . $this->DB[$x][1] . "', '" . $this->dateFormater($this->DB[$x][4]) . "', '" . $this->DB[$x][5] . "', '" . $this->DB[$x][7] . "', '" . $this->DB[$x][9] . "', '" . $this->DB[$x][11] . "', '" . $this->DB[$x][13] . "', '" . $this->DB[$x][14] . "', '" . $this->dateFormater($this->DB[$x][18]) . "', '" . $this->DB[$x][19] . "', '" . $this->DB[$x][20] . "', '" . $this->DB[$x][21] . "', '" . $this->DB[$x][22] . "', '" . $this->dateFormater($this->DB[$x][24]) . "', '" . $this->DB[$x][27] . "', '" . $this->DB[$x][28] . "', '" . $this->DB[$x][29] . "', '" . $this->DB[$x][30] . "', '" . $this->DB[$x][31] . "', '" . $this->DB[$x][33] . "', '" . $this->DB[$x][34] . "', '" . $this->DB[$x][35] . "', 0, '" . $this->dateFormater($this->DB[$x][36]) . "', 'z', " . $this->valueFormater($this->DB[$x][44]) . ", 0, 'z', '" . $this->DB[$x][37] . "', " . $this->valueFormater($this->DB[$x][38]) . ", '" . $this->DB[$x][41] . "', '" . $this->DB[$x][42] . "', 'z', '" . $this->passwordMaker() . "', " . $code . ")", "INSERT INTO Pessoal (matricula, nome, sexo, CPF, PIS_PASEP, data_nascimento, ultimo_nome, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][3])) . "', '" . $this->DB[$x][12] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][15])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][16])) . "',  '" . $this->dateFormater($this->DB[$x][17]) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][32])) . "', " . $code . ")", "INSERT INTO RG (matricula, identidade, orgao_expedidor, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][25])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][26])) . "', " . $code . ")", "INSERT INTO Inf_Bancaria (matricula, conta, banco, numero, codigo_fol) VALUES ('" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][6])) . "', '" . $this->DB[$x][39] . "',  '" . $this->DB[$x][40] . "', " . $code . ")");
                                 }
                             }
                         }
                     }
                 }
                 break;
             case "calculo":
                 $date = explode("-", $_SESSION["day"]);
                 $query = "SELECT * FROM Calculos WHERE matricula='" . $this->DB[$x][0] . "' AND fol_codigo=" . $code . " AND data BETWEEN '" . $date[2] . "-" . $date[1] . "-01' and '" . $date[2] . "-" . $date[1] . "-31' AND eve_codigo='" . $this->DB[$x][1] . "' AND valor='" . $this->valueFormater($this->DB[$x][2]) . "'";
                 $result = $MySQLconnect->execute($query);
                 if ($MySQLconnect->counterResult($result) > 0) {
                     $aux = array("UPDATE Calculos SET valor=" . $this->valueFormater($this->DB[$x][2]) . " WHERE matricula='" . $this->DB[$x][0] . "' AND fol_codigo=" . $code . " AND eve_codigo='" . $this->DB[$x][1] . "' AND data BETWEEN '" . $date[2] . "-" . $date[1] . "-01' and '" . $date[2] . "-" . $date[1] . "-31'");
                 } else {
                     $aux = array("INSERT INTO Calculos (valor, fol_codigo, eve_codigo, matricula, data) VALUES (" . $this->valueFormater($this->DB[$x][2]) . ", " . $code . ", '" . $this->DB[$x][1] . "', '" . addslashes(zkl($this->xkey, $this->DB[$x][0])) . "', '" . $this->dateFormater2($_SESSION["day"]) . "')");
                 }
                 break;
         }
         /*foreach($aux as $query){
         			echo $query."<br>";
         		}*/
         foreach ($aux as $query) {
             if (!$MySQLconnect->execute($query)) {
                 /*echo $query."<br>";
                 		die();*/
                 $toFix = true;
                 $this->DB[$x][$numFields] = "true";
             } else {
                 $this->DB[$x][$numFields] = "false";
             }
         }
     }
     //$MySQLconnect->close();
     dbase_close($DFBconnect);
     unlink($archiveDBFname);
     if ($toFix and $this->tableId != "cadastro" and $this->tableId != "calculo") {
         $this->fixProblems($numFields, $numRows);
     } else {
         header("Location: ../importDocuments.php?upl=true&tab={$this->tableId}");
     }
 }
Esempio n. 10
0
 function fetch_array($query, $arraytype = CDE_NUM)
 {
     $this->error = "";
     //Set the errors to none
     if ($this->debug) {
         $this->debugmsg("Fetching array on " . $this->dbtype . " database....", "blue");
         $this->debugmsg($query, "purple");
     }
     switch ($this->dbtype) {
         /* Firebird Functionality */
         case "firebird":
             if ($arraytype == 0) {
                 $query = ibase_fetch_assoc($query);
             } else {
                 if ($arraytype == 1) {
                     $query = ibase_fetch_row($query);
                 } else {
                     $query1 = ibase_fetch_assoc($query);
                     $query2 = ibase_fetch_row($query);
                     $query = array_merge($query1, $query2);
                 }
             }
             break;
             /* SQLite Functionality */
         /* SQLite Functionality */
         case "sqlite":
             $query = sqlite_fetch_array($query, $arraytype);
             break;
             /*DBASE - this uses the record counter - currentrecord */
         /*DBASE - this uses the record counter - currentrecord */
         case "dbase":
             if ($this->currentrecord <= $this->num_rows($none)) {
                 $query = dbase_get_record($this->dbh, $this->currentrecord);
                 $this->currentrecord++;
             } else {
                 $query = false;
             }
             if ($query) {
                 foreach ($query as $name => $value) {
                     $value = str_replace("'", "''", $value);
                     $query[$name] = trim($value);
                 }
             }
             break;
             /* MYSQL Functionality */
         /* MYSQL Functionality */
         case "mysql":
             if ($arraytype == "CDE_NUM") {
                 $myarr = MYSQL_NUM;
             } elseif ($arraytype == "CDE_ASSOC") {
                 $myarr = MYSQL_ASSOC;
             } else {
                 $myarr = MYSQL_BOTH;
             }
             $query = mysql_fetch_array($query, $myarr);
             break;
             /* Oracle Functionality */
         /* Oracle Functionality */
         case "oracle":
             $query = oci_fetch_array($query, $arraytype);
             break;
             /* MSSQL Functionality */
         /* MSSQL Functionality */
         case "mssql":
             $query = mssql_fetch_array($query, $arraytype);
             break;
         case "pgsql":
             $query = pg_fetch_array($query, $arraytype);
             break;
     }
     if ($this->debug) {
         $this->debugmsg("Fetched array on " . $this->dbtype . " database....", "green");
         $this->debugmsg($this->pre_r($query), "purple");
     }
     return $query;
 }
Esempio n. 11
0
 public function get_row($recnum)
 {
     return dbase_get_record($this->_handler, $recnum);
 }
Esempio n. 12
0
    echo 'row before inserting is: ';
    print_r($row);
    // Replace the record
    dbase_replace_record($db, $row, 1);
    echo 'trying record num 1: ';
    $rec = dbase_get_record($db, 1);
    $nf = dbase_numfields($db);
    for ($i = 0; $i < $nf; $i++) {
        echo $rec[$i], "\n";
    }
    echo 'deleting row 2. before deletion: ';
    $rec = dbase_get_record($db, 2);
    $nf = dbase_numfields($db);
    for ($i = 0; $i < $nf; $i++) {
        echo $rec[$i], "\n";
    }
    echo dbase_delete_record($db, 2);
    echo 'before db pack';
    echo dbase_pack($db);
    echo 'after pack, trying to fetch record 2';
    $rec = dbase_get_record($db, 2);
    $nf = dbase_numfields($db);
    for ($i = 0; $i < $nf; $i++) {
        echo $rec[$i], "\n";
    }
    dbase_close($db);
}
?>


Esempio n. 13
0
function ProcessDBF($AName)
{
    $vResult = 0;
    $vHandle = dbase_open($AName, 0);
    if ($vHandle === FALSE) {
        throw new Exception('Невозможно открыть файл базы данных');
    }
    try {
        $vFieldList = GetFieldList($vHandle);
        $vSurgeryIDIdx = FindFieldIdx($vFieldList, 'MYSURGERYID', false);
        $vCaseIDIdx = FindFieldIdx($vFieldList, 'MYCASEID');
        $vDateIdx = FindFieldIdx($vFieldList, 'DATEIN');
        $vSendIdx = FindFieldIdx($vFieldList, 'SEND');
        $vErrorIdx = FindFieldIdx($vFieldList, 'ERROR');
        $vCnt = dbase_numrecords($vHandle);
        for ($i = 1; $i <= $vCnt; $i++) {
            $vRecord = dbase_get_record($vHandle, $i);
            ProcessDBFRecord(trim(@$vRecord[$vSurgeryIDIdx]), trim(@$vRecord[$vCaseIDIdx]), DBF2Date(trim(@$vRecord[$vDateIdx])), trim(@$vRecord[$vSendIdx]), iconv('CP866', 'UTF-8', trim(@$vRecord[$vErrorIdx])));
            $vResult++;
        }
    } catch (Exception $e) {
        dbase_close($vHandle);
        throw $e;
    }
    dbase_close($vHandle);
    return $vResult;
}
function ImportSaldosCW()
{
    //Elimina los Datos de la DB del Catalogo
    $sqlDelC = "DELETE FROM contable_saldos";
    my_query($sqlDelC);
    $rechazados = 0;
    $aceptados = 0;
    /**
     * Genera le Nuevo esquema de Naturaleza Contable
     */
    $pathdbase = CTW_PATH . vLITERAL_SEPARATOR . "CTW10005.dbf";
    $rs = dbase_open($pathdbase, 0);
    $results[SYS_MSG] .= "Abrir {$pathdbase} <br />";
    $num_rows = dbase_numrecords($rs);
    if ($num_rows > 100000) {
        //$num_rows = 1000000;
    }
    $results[SYS_MSG] .= "Numero de Filas {$num_rows} <br />";
    //Conversion del Tipo de Movimientos
    if (isset($rs)) {
        for ($i = 1; $i <= $num_rows; $i++) {
            $field = dbase_get_record($rs, $i);
            if (trim($field[0]) != "" and trim($field[0]) != 0) {
                $cuenta = trim($field[0]);
                if ($cuenta == "_CUADRE") {
                    $cuenta = CUENTA_DE_CUADRE;
                }
                $sql = "INSERT INTO contable_saldos(cuenta, \n    \t\t\t\tejercicio, tipo, saldo_inicial, imp1, imp2, imp3, imp4, imp5, imp6, imp7, imp8, imp9, imp10, imp11, imp12, imp13, imp14, captado) \n    \t\t\t\t\t\t\t\t\t\t\t\t\tVALUES({$cuenta}, \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[1]) . ", " . trim($field[2]) . ",\n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[3]) . ", " . trim($field[4]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[5]) . ", " . trim($field[6]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[7]) . ", " . trim($field[8]) . ",\n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[9]) . ", " . trim($field[10]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[11]) . ", " . trim($field[12]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[13]) . ", " . trim($field[14]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[15]) . ", " . trim($field[16]) . ", \n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[17]) . ", '" . trim($field[18]) . "')";
                my_query($sql);
                $aceptados++;
            } else {
                $rechazados++;
            }
        }
    } else {
        $results[SYS_MSG] .= "No se Pudo Abrir la DB";
    }
    dbase_close($rs);
    $results[SYS_MSG] .= "{$aceptados} Registros fueron Agregados a la Base de Datos <br />";
    $results[SYS_MSG] .= "{$rechazados} Registros fueron rechazados por no Contener Valores Validos <br />";
    $results[SYS_MSG] .= "Cerrando {$pathdbase} <br />";
    return $results;
}
Esempio n. 15
0
 private function gravaDbf($importacaoID)
 {
     $this->load->model('tbhandle/Handle_model', 'handle');
     $dados = $this->import->get_by_id($importacaoID);
     $arquivo = 'C:/xampp/htdocs/new_s4w/arquivos/' . $dados->locatarioID . "/" . $dados->clienteID . "/" . $dados->obraID . "/" . $dados->etapaID . "/" . $dados->subetapaID . "/" . $dados->importacaoNr . "/" . $dados->arquivo;
     $dbcon = dbase_open($arquivo, 0) or die("Não foi possível abrir o arquivo dbf");
     $n = 0;
     $dbrows = dbase_numrecords($dbcon);
     for ($c = 1; $c <= $dbrows; $c++) {
         $dbreg = dbase_get_record($dbcon, $c);
         // pega o contéudo da linha (registro)
         $attibutes[$c] = array('PROJETO' => 1, 'HANDLE' => 'NÃO SEI', 'FLG_REC' => $dbreg[0], 'NUM_COM' => $dbreg[1], 'DES_COM' => $dbreg[2], 'LOT_COM' => $dbreg[3], 'DLO_COM' => $dbreg[4], 'CLI_COM' => $dbreg[5], 'IND_COM' => $dbreg[6], 'DT1_COM' => $dbreg[7], 'DT2_COM' => $dbreg[8], 'NUM_DIS' => $dbreg[9], 'DES_DIS' => $dbreg[10], 'NOM_DIS' => $dbreg[11], 'REV_DIS' => $dbreg[12], 'DAT_DIS' => $dbreg[13], 'TRA_PEZ' => $dbreg[14], 'SBA_PEZ' => $dbreg[15], 'DES_SBA' => $dbreg[16], 'TIP_PEZ' => $dbreg[17], 'MAR_PEZ' => $dbreg[18], 'MBU_PEZ' => $dbreg[19], 'DES_PEZ' => $dbreg[20], 'POS_PEZ' => $dbreg[21], 'NOT_PEZ' => $dbreg[22], 'ING_PEZ' => $dbreg[23], 'MAX_LEN' => $dbreg[24], 'QTA_PEZ' => $dbreg[25], 'QT1_PEZ' => $dbreg[26], 'MCL_PEZ' => $dbreg[27], 'COD_PEZ' => $dbreg[28], 'COS_PEZ' => $dbreg[29], 'NOM_PRO' => $dbreg[30], 'LUN_PRO' => $dbreg[31], 'LAR_PRO' => $dbreg[32], 'SPE_PRO' => $dbreg[33], 'MAT_PRO' => $dbreg[34], 'TIP_BUL' => $dbreg[35], 'DIA_BUL' => $dbreg[36], 'LUN_BUL' => $dbreg[37], 'PRB_BUL' => $dbreg[38], 'PUN_LIS' => $dbreg[39], 'SUN_LIS' => $dbreg[40], 'PRE_LIS' => $dbreg[41], 'FLG_DWG' => $dbreg[42], 'obra' => $dados->obraID, 'id' => 0, 'fklote' => 0, 'fkestagio' => $dados->subetapaID, 'grp' => $dbreg[46], 'nome_file1' => $dados->arquivo, 'nome_file2' => '', 'nome_file3' => '', 'nome_file4' => '', 'fketapa' => $dados->etapaID, 'CATEPERFIL' => $dbreg[48], 'fkImportacao' => $importacaoID, 'fkpreparacao' => 0, 'fkmedicao' => 0);
     }
     if ($this->handle->insert($attibutes)) {
         return true;
     }
     return false;
 }
Esempio n. 16
0
<?php

// Path to dbase file
$db_path = "/tmp/base/shbase.dbf";
// Open dbase file
$dbh = dbase_open($db_path, 0) or die("Error! Could not open dbase database file '{$db_path}'.");
// Get column information
$column_info = dbase_get_header_info($dbh);
// Display information
print_r($column_info);
if ($dbh) {
    $record_numbers = dbase_numrecords($dbh);
    for ($i = 1; $i <= $record_numbers; $i++) {
        $row = dbase_get_record_with_names($dbh, $i);
        print_r($row);
        $row = dbase_get_record($dbh, $i);
        print_r($row);
        break;
    }
    $row = dbase_get_record($dbh, 9);
    print_r($row);
}
?>