Crystal Report - CODIGO

 
Vista:

CODIGO

Publicado por mati (56 intervenciones) el 30/05/2005 17:55:21
Hola yo tengo el suiguiente codigo
Case "TUnidadesOrdenado por maquinas"

CryReport.WindowTitle = "Listado Tiempo\Maquina"
CryReport.ReportFileName = App.Path & "\listados\articulo_maquina2.rpt"
CryReport.Formulas(0) = "NombreEmpresa=" & "'" & MDIGestion.Caption & "'"
CryReport.Formulas(1) = "DesdeMaquina=" & "'" & TxtTexto(1).Text & "'"
CryReport.Formulas(2) = "HastaMaquina=" & "'" & TxtTexto(2).Text & "'"
CryReport.Formulas(3) = "DesdeArticulo=" & "'" & TxtTexto(3).Text & "'"
CryReport.Formulas(4) = "HastaArticulo=" & "'" & TxtTexto(4).Text & "'"
CryReport.Destination = Destino


'MsgBox (CryReport.SelectionFormula)
If Len(TxtTexto(2).Text) <> 0 Then




cod_maq_primero = ""
cod_maq_ultimo = ""

strSQL = "Select distinct(codart) as codigo_articulo From tunidad where TUnidad.CodMaq>= " & "'" & TxtTexto(1).Text & "'" & " and TUnidad.CodMaq<= " & "'" & TxtTexto(2).Text & "'" & " and TUnidad.CodArt>=" & "'" & TxtTexto(3).Text & "'" & " and TUnidad.CodArt<= " & "'" & TxtTexto(4).Text & "'"

'order by Codmaq,codart"
'strSQL = "Select * From Tunidad where TUnidad.CodMaq>= " & "'" & txtTexto(1).Text & "'" & " and TUnidad.CodMaq<= " & "'" & txtTexto(2).Text & "'"
'where TUnidad.CodMaq>= " & "'" & TxtTexto(1).Text & "'" & " and TUnidad.CodMaq<= " & "'" & TxtTexto(2).Text & "'" & " and TUnidad.CodArt>=" & "'" & TxtTexto(3).Text & "'" & " and TUnidad.CodArt<= " & "'" & TxtTexto(4).Text & "'"
'and " & "'" & "TUnidad.CodMaq=TxtTexto(2).Text " & "'" & " and " & "'" & TUnidad.CodArt=TxtTexto(3).Text " & "'" & " and " & "'" & TUnidad.CodArt=TxtTexto(4).Text"
MsgBox (strSQL)
strSQL1 = "Select count(distinct(codart)) as num_registro From tunidad where TUnidad.CodMaq>= " & "'" & TxtTexto(1).Text & "'" & " and TUnidad.CodMaq<= " & "'" & TxtTexto(2).Text & "'" & " and TUnidad.CodArt>=" & "'" & TxtTexto(3).Text & "'" & " and TUnidad.CodArt<= " & "'" & TxtTexto(4).Text & "'"
'where TUnidad.CodMaq>= " & "'" & TxtTexto(1).Text & "'" & " and TUnidad.CodMaq<= " & "'" & TxtTexto(2).Text & "'" & " and TUnidad.CodArt>=" & "'" & TxtTexto(3).Text & "'" & " and TUnidad.CodArt<= " & "'" & TxtTexto(4).Text & "' group by codmaq"
'where TUnidad.CodMaq= " & "'" & TxtTexto(1).Text & "'" & " and TUnidad.CodMaq= " & "'" & TxtTexto(2).Text & "'" & " and TUnidad.CodArt=" & "'" & TxtTexto(3).Text & "'" & " and TUnidad.CodArt= " & "'" & TxtTexto(4).Text & "'"
MsgBox (strSQL1)
Set Registro = Nothing: Registro.Open strSQL, Connection, adOpenKeyset, adLockPessimistic
Set Registro1 = Nothing: Registro1.Open strSQL1, Connection, adOpenKeyset, adLockPessimistic
i = 1
cont_pag = 0
If Registro1!num_registro > 5 Then

'Do Until Registro1.EOF
Do Until Registro.EOF
i = i + 1

'MsgBox (Registro1!num_registro)
'MsgBox (Registro!num_registro)
MsgBox (Registro!codigo_maquina)
Registro.MoveNext
If i = 1 Then
cod_maq_primero = Registro!codigo_articulo
End If

'i = Registro1!num_registro
If i = 9 Then
If cod_maq_ultimo = "" Then
'cod_maq_primero = Registro!codigo_maquina
cod_maq_ultimo = Registro!codigo_articulo
CryReport.SelectionFormula = "{TUnidad.CodMaq}>=" & "'" & TxtTexto(1).Text & "'" & " and {TUnidad.CodMaq}<=" & "'" & TxtTexto(2).Text & "'" & " and {TUnidad.CodArt}>=" & "'" & TxtTexto(3).Text & "'" & " and {TUnidad.CodArt}<=" & "'" & cod_maq_ultimo & "'"
MsgBox (CryReport.SelectionFormula)
CryReport.PrintReport
i = 0
Else
'cod_maq_primero = cod_maq_ultimo
cod_maq_ultimo = Registro!codigo_articulo
CryReport.SelectionFormula = "{TUnidad.CodMaq}>=" & "'" & TxtTexto(1).Text & "'" & " and {TUnidad.CodMaq}<=" & "'" & TxtTexto(2).Text & "'" & " and {TUnidad.CodArt}>=" & "'" & cod_maq_primero & "'" & " and {TUnidad.CodArt}<=" & "'" & cod_maq_ultimo & "'"
MsgBox (CryReport.SelectionFormula)
CryReport.PrintReport
i = 0
End If
End If
Loop
End If
If i > 1 And i < 9 Then
CryReport.SelectionFormula = "{TUnidad.CodMaq}>=" & "'" & TxtTexto(1).Text & "'" & " and {TUnidad.CodMaq}<=" & "'" & TxtTexto(2).Text & "'" & " and {TUnidad.CodArt}>=" & "'" & cod_maq_primero & "'" & " and {TUnidad.CodArt}<=" & "'" & TxtTexto(4).Text & "'"
MsgBox (CryReport.SelectionFormula)
CryReport.PrintReport
End If

If i = 1 Then
CryReport.SelectionFormula = "{TUnidad.CodMaq}>=" & "'" & TxtTexto(1).Text & "'" & " and {TUnidad.CodMaq}<=" & "'" & TxtTexto(4).Text & "'" & " and {TUnidad.CodArt}>=" & "'" & TxtTexto(3).Text & "'" & " and {TUnidad.CodArt}<=" & "'" & TxtTexto(4).Text & "'"
MsgBox (CryReport.SelectionFormula)
CryReport.PrintReport
End If

Bien con este codigo lo que hago es qe si los registros de un informe no me entran en una misma pagina hago diferentes informes yo lo que quiero es hacer una nueva hoja al infome en lugar de un nuevo informe eso se puede hacer.
No lo puedo hacer desde crystal en nueva pagina porque tengo tablas cruzadas y en detalle no hay nada en ncabezado de informes eso no funcion
Muxas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:CODIGO

Publicado por Gerardo (571 intervenciones) el 31/05/2005 01:25:29
Hola Mati.

Tu informe lo estás haciendo con el objeto "Cross-tab" de Crystal Report?, eh hecho un reporte con este objeto para ver ke sucede y visualmente (y es ke no tengo impresora, jeje) observo ke cuando las columnas rebazan el ancho de la hoja, se imprimen las siguientes columnas en una siguiente hoja a la derecha, y supongo ke dicha o dichas hojas se deben imprimir, sin ke tu debas a través de código indicarselo.

Si puedes, enviame tu información o parte (la necesaria), si es en SQL Server (a través de un backup) o en access y tu reporte, ahhh y tu código y un ejemplo de como kieres ke se impriman tus datos.

Saludos.

PD. Si decides enviarme lo ke te he pedido, x favor hazlo al siguiente correo: [email protected]
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CODIGO

Publicado por mati (56 intervenciones) el 31/05/2005 19:04:12
Hola Gerardo ya te mande lo que pude no se si te valdra de algo.
Un saludo y gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar