El fragmento de código es
- Code: Select all Expand view RUN
- function query01(nanio,nrad,oDlg)
local cServer := "localhost\SQLEXPRESS"
local cUser := "SA"
local oRsd,qry
local cPassword := "590014"
local cDatabase := "ESAPAH",ctable3
local cTable
local oRs,oRs2
local ctable2
local oclip
oClip := TClipBoard():New( 1, oDlg )
if nrad=1
qry:=" AND ID_TIPODESERVICIO=1" //SERVICIO FIJO
else
qry:=" AND ID_TIPODESERVICIO=2" //SERVICIO MEDIDO
endif
ctable:= "SELECT TIPODETOMA, LIMITEINFERIOR, LIMITESUPERIOR, TB_TIPODETOMA.ID_TIPODETOMA as idtipot "+;
"FROM TB_CUOTASERVICIOMEDIDO "+;
"INNER JOIN TB_TIPODETOMA ON TB_CUOTASERVICIOMEDIDO.ID_TIPODETOMA = TB_TIPODETOMA.ID_TIPODETOMA "+;
"WHERE YEAR(FECHAINICIAL) ="+trans(nanio,'9999')+;
" GROUP BY TIPODETOMA,LIMITEINFERIOR,LIMITESUPERIOR,TB_TIPODETOMA.ID_TIPODETOMA "+;
"ORDER BY TB_TIPODETOMA.ID_TIPODETOMA, LIMITEINFERIOR "
oRsd:=FW_OpenRecordSet( oCn, cTable )
FW_AdoExportToDBF( oRsd, "prueba.dbf", .f.)
use prueba.dbf exclusive
while !oRsd:eof()
append blank
replace field->tipodetoma with oRsd:fields('tipodetoma'):value
replace field->idtipot with oRsd:fields('idtipot'):value
replace field->limiteinfe with oRsd:fields('limiteinferior'):value
replace field->limitesupe with oRsd:fields('limitesuperior'):value
oRsd:movenext()
enddo
go Top
oclip:open()
while !eof()
ctable2:="[SELECT SUM(M3) AS METROS, COUNT(TB_FACTURACION.NOCLIENTE) AS CLIENTES, SUM(AGUA - AGUA_DESCUENTO) AS IMPORTES, ID_TIPODETOMA,"+;
"TB_FACTURACION.AÑO, TB_FACTURACION.MES FROM TB_FACTURACION INNER JOIN TB_CLASIFICAPADRON ON TB_FACTURACION.NOCLIENTE ="+;
"TB_CLASIFICAPADRON.NOCLIENTE AND TB_FACTURACION.AÑO= TB_CLASIFICAPADRON.AÑO AND TB_FACTURACION.MES = TB_CLASIFICAPADRON.MES"+;
" WHERE TB_FACTURACION.año="+alltrim(trans(nanio,'9999'))+" AND ID_TIPODETOMA ="+alltrim(trans(field->IDTIPOT,'9'))+;
"AND (M3 >="+alltrim(trans(field->limiteinfe,'9999999'))+" AND M3 <="+alltrim(trans(field->limitesupe,'9999999'))+;
" AND TB_FACTURACION.FACTURADO = 1) AND ID_TIPODESERVICIO="+trans(nrad,'9')+;
" GROUP BY ID_TIPODETOMA,TB_FACTURACION.año, TB_FACTURACION.MES]"
ctable2:=hb_oemtoansi( hb_utf8tostr( ctable2 ) )
oClip:SetText( ctable2 )
oRs2:=FW_OpenRecordSet( oCn, cTable2,4,3 )
skip 1
enddo
oclip:close()
oclip:end()
close databases
oCn:Close()
el error es
fwh2008 harbour 3.2.0dev