Pessoal,
Na linha 2302 tem exibido esse erro no arquivo grid_leitura_detalhe_grid.class.php
Fatal error: Cannot use object of type ADORecordSet_pdo as array in C:\Program Files\NetMake\v8\wwwroot\scriptcase\app\SisGem\grid_leitura_detalhe\grid_leitura_detalhe_grid.class.php on line 2302
Não estou conseguindo entender o motivo, tem como me ajudar?
$check_table = ‘leitura’;
2239| $check_where = “leit_instalacao = '” . $this->sc_temp_pinstalacao . “’”
2240| . " and leit_reg = ‘" . $this->sc_temp_preg . "’ AND leit_data < ‘" .$this->leit_data . "’";
2241| $check_sql = ‘SELECT leit_leitura,dados_const,dados_diais,leit_siglcad’
2242| . ’ FROM ’ . $check_table
2243| . ’ inner join dados on (dados.dados_instalacao=leitura.leit_instalacao and dados.dados_reg=leitura.leit_reg)’
2244| . ’ WHERE ’ . $check_where
2245| . ’ order by leit_data DESC LIMIT 1’;
2246| echo $check_sql.’’;
2247|
2248| $nm_select = $check_sql;
2249| $_SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = $nm_select;
2250| $_SESSION[‘scriptcase’][‘sc_sql_ult_conexao’] = ‘’;
2251| if ($this->rs = $this->Db->Execute($nm_select))
2252| { }
2253| elseif (isset($GLOBALS[“NM_ERRO_IBASE”]) && $GLOBALS[“NM_ERRO_IBASE”] != 1)
2254| {
2255| $this->rs = false;
2256| $this->rs_erro = $this->Db->ErrorMsg();
2257| }
2258| ;
2259| if (false == $this->rs )
2260| {
2261|
2262| }
2263| elseif ($this->rs->EOF)
2264| {
2265|
2266| $nm_select = “SELECT dados_const from dados where dados_instalacao=’” . $this->sc_temp_pinstalacao . “’ and dados_reg =’” . $this->sc_temp_preg . “’”;
2267| $_SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = $nm_select;
2268| $_SESSION[‘scriptcase’][‘sc_sql_ult_conexao’] = ‘’;
2269| $this->dataset = array();
2270| if ($rx = $this->Db->Execute($nm_select))
2271| {
2272| $y = 0;
2273| $nm_count = $rx->FieldCount();
2274| while (!$rx->EOF)
2275| {
2276| for ($x = 0; $x < $nm_count; $x++)
2277| {
2278| $this->dataset[$y] [$x] = $rx->fields[$x];
2279| }
2280| $y++;
2281| $rx->MoveNext();
2282| }
2283| $rx->Close();
2284| }
2285| elseif (isset($GLOBALS[“NM_ERRO_IBASE”]) && $GLOBALS[“NM_ERRO_IBASE”] != 1)
2286| {
2287| $this->dataset = false;
2288| $this->dataset_erro = $this->Db->ErrorMsg();
2289| }
2290| ;
2291| $this->consumo = ($this->leit_leitura * $this->dataset[0][0]);
2292| }
2293| else
2294| {
2295| if ($this->leit_oc == ‘137’ && $this->rs[0][2] == ‘4’ && $this->rs[0][3] ==‘01’) {
2296| $this->consumo = ($this->leit_leitura - $this->rs[0][0]) * $this->rs[0][1] +10000; }
2297| elseif ($this->leit_oc == ‘137’ && $this->rs[0][2] == ‘5’ && $this->rs[0][3] ==‘01’) {
2298| $this->consumo = ($this->leit_leitura - $this->rs[0][0]) * $this->rs[0][1] +100000;}
2299| elseif ($this->leit_oc == ‘137’ && $this->rs[0][2] == ‘6’ && $this->rs[0][3] ==‘01’) {
2300| $this->consumo = ($this->leit_leitura - $this->rs[0][0]) * $this->rs[0][1] +1000000; }
2301| elseif ($this->rs[0][3] == ‘02’) {
2302| $this->consumo =0;
2303| }
2304| else {
2305| $this->consumo = ($this->leit_leitura - $this->rs[0][0]) * $this->rs[0][1];
2306| }
2307|
2308| }
Eu estou fazendo assim:
$check_table = ‘leitura’;
$check_where = “leit_instalacao = '” . [pinstalacao] . “’”
. " and leit_reg = ‘" . [preg] . "’ AND leit_data < ‘" .{leit_data}. "’";
$check_sql = ‘SELECT leit_leitura,dados_const,dados_diais,leit_siglcad’
. ’ FROM ’ . $check_table
. ’ inner join dados on (dados.dados_instalacao=leitura.leit_instalacao and dados.dados_reg=leitura.leit_reg)’
. ’ WHERE ’ . $check_where
. ’ order by leit_data DESC LIMIT 1’;
echo $check_sql.’’;
sc_select(rs, $check_sql);
if (false == {rs})
{
// Error while accessing database
}
elseif ({rs}->EOF) //registro não encontrado
{
sc_lookup(dataset, “SELECT dados_const from dados where dados_instalacao=’” . [pinstalacao] . “’ and dados_reg =’” . [preg] . “’” );
{consumo} = ({leit_leitura} * {dataset[0][0]});
}
else //registro encontrado
{
if ({leit_oc} == ‘137’ && {rs[0][2]} == ‘4’ && {rs[0][3]} ==‘01’) {
{consumo} = ({leit_leitura} - {rs[0][0]}) * {rs[0][1]} +10000; }
elseif ({leit_oc} == ‘137’ && {rs[0][2]} == ‘5’ && {rs[0][3]} ==‘01’) {
{consumo} = ({leit_leitura} - {rs[0][0]}) * {rs[0][1]} +100000;}
elseif ({leit_oc} == ‘137’ && {rs[0][2]} == ‘6’ && {rs[0][3]} ==‘01’) {
{consumo} = ({leit_leitura} - {rs[0][0]}) * {rs[0][1]} +1000000; }
elseif ({rs[0][3]} == ‘02’) {
{consumo}=0;
}
else {
{consumo} = ({leit_leitura} - {rs[0][0]}) * {rs[0][1]};
}
}