Crystal Report - Imprimir guias de factura

 
Vista:

Imprimir guias de factura

Publicado por Noel (3 intervenciones) el 25/09/2006 17:40:13
Resulta que tengo una factura que imprime con crystal report 4.6 me imprime bien
pero al imprimir la guia no me sale ningun dato y eso que es el mismo codigo y los mismos botones y el mismo archivo de .rpt que por supuesto los .rpt tienen distintos nombres y tiene los mismos campos en la base de datos pero con distintos nombres las tablas
este es el codigo

FACTURA:

Private Sub Imprimir_Click()
Set Reg = Dbs.OpenRecordset("select * from clientes where nombre = '" & Text5 & "' ")
If Reg.EOF Then
Flag = 1
MsgBox "cliente incorrecto"
End If
If Reg.EOF Then
Flag = 1
MsgBox "nombre de obra incorrecto"
End If

If Option3.Value = True Then
If Text35 = "" Then
Flag = 1
MsgBox "Debe ingresar Transportista"
Else
Set Reg = Dbs.OpenRecordset("select * from transportista where nombre = '" & Text35 & "' ")
If Reg.EOF Then
Flag = 1
MsgBox "Nombre de transportista incorrecto"
End If
End If
End If
If Not IsDate(Fec1) Then
Flag = 1
MsgBox "Fecha factura incorrecta"
End If
If Not Fec2 = "__/__/__" Then
If Not IsDate(Fec2) Then
Flag = 1
MsgBox "fecha vencimiento incorrecta"
End If
End If
For L = 0 To 11
If Not Cod(L) = "" Then
Fam = Left(Cod(I).Text, 3)
Grupo = Mid(Cod(I).Text, 4, 3)
Item = " "
Set Reg = Dbs.OpenRecordset("select * from articulos where familia = '" & Fam & "' and grupo = '" & Grupo & "' and item = '" & Item & "' ")
If Reg.BOF Then
Flag = 1
MsgBox "Codigo no existe"
End If
If Can(L) = "" Then
Flag = 1
MsgBox "Cantidad inexistente"
End If
If Not IsNumeric(Can(L)) Then
Flag = 1
MsgBox "Cantidad debe ser numérico"
End If
End If
Next L
If Flag = 0 Then
Folio = Val(Text33)
Set Reg = Dbs.OpenRecordset("select * from factura_encab where numero = " & Folio & " ")
Reg.AddNew
Reg("numero") = Folio
Reg("fecha") = Fec1
If Fec2 <> "__/__/__" Then
Reg("fecha_venc") = Fec2
End If
Reg("cliente") = Val(Text12)
If Text14 <> "" Then
Set Reg1 = Dbs.OpenRecordset("select * from obra where nombre = '" & Text14 & "' ")
Reg("obra") = Reg("cliente")
End If
If Text35 <> "" Then
Set Reg1 = Dbs.OpenRecordset("select * from transportista where nombre = '" & Text35 & "' ")
Reg("transportista") = Reg1("rut_num")
End If
If Option1 Then
Reg("contado") = True
Else
Reg("contado") = False
End If
If Option3 Then
Reg("puesto_obra") = True
Else
Reg("puesto_obra") = False
End If
Reg("sub_total") = Val(Text10)
If Text17 <> "" Then Reg("descuento") = Val(Text17)
If Text51 <> "" Then Reg("flete") = Val(Text51)
Reg("neto") = Val(Text19)
Reg("iva") = Val(Text50.Text)
Reg("total") = Val(Text23)
Reg.Update
Reg.Close
Set Reg = Dbs.OpenRecordset("select * from numero")
Reg.Edit
Reg("numero") = Val(Text33)
Reg.Update
Set Reg = Dbs.OpenRecordset("select * from factura")
For L = 0 To 11
If Not Cod(L) = "" Then
Reg.AddNew
Reg("numero") = Folio
Reg("linea") = L + 1
Reg("Familia") = Left(Cod(L), 3)
Reg("Grupo") = Mid(Cod(L), 4, 3)
Reg("Item") = " "
If OC(L) <> "" Then Reg("ocompra") = Val(OC(L))
Reg("cantidad") = CDbl(Can(L))
Reg("unitario") = CDbl(Valo(L))
Reg("total") = CDbl(Tot(L))
Reg.Update
Fam = Left(Cod(L), 3)
Grupo = Mid(Cod(L), 4, 3)
Item = " "
Set Reg1 = Dbs.OpenRecordset("select * from articulos where familia = '" & Fam & "' and grupo = '" & Grupo & "' and item = '" & Item & "' ")
Reg1.Edit
Reg1("Saldo") = Reg1("Saldo") - Can(L).Text
Reg1.Update
End If
Next L
Folio = Folio + 1
Text33 = Format(Folio, "000000")
Limpia
Form1.Reporte.ReportFileName = "c:\sistmat\factura.rpt"

If vista.Value = 1 Then
Form1.Reporte.Destination = 0
Else
Form1.Reporte.Destination = 1
End If
Form1.Reporte.PrintReport

End If

End Sub

Y ESTE ES LA GUIA:

Private Sub Imprimir_Click()
Set Reg = Dbs.OpenRecordset("select * from clientes where nombre = '" & Text5 & "' ")
If Reg.EOF Then
Flag = 1
MsgBox "cliente incorrecto"
End If
If Reg.EOF Then
Flag = 1
MsgBox "nombre de obra incorrecto"
End If

If Option3.Value = True Then
If Text35 = "" Then
Flag = 1
MsgBox "Debe ingresar Transportista"
Else
Set Reg = Dbs.OpenRecordset("select * from transportista where nombre = '" & Text35 & "' ")
If Reg.EOF Then
Flag = 1
MsgBox "Nombre de transportista incorrecto"
End If
End If
End If
If Not IsDate(Fec1) Then
Flag = 1
MsgBox "Fecha factura incorrecta"
End If
If Not Fec2 = "__/__/__" Then
If Not IsDate(Fec2) Then
Flag = 1
MsgBox "fecha vencimiento incorrecta"
End If
End If
For L = 0 To 11
If Not Cod(L) = "" Then
Familia = Left(Cod(L), 3)
Grupo = Mid(Cod(L), 4, 3)
Item = " "
Set Reg = Dbs.OpenRecordset("select * from articulos where familia = '" & Familia & "' and grupo = '" & Grupo & "' and item = '" & Item & "' ")
If Reg.BOF Then
Flag = 1
MsgBox "Codigo no existe"
End If
If Can(L) = "" Then
Flag = 1
MsgBox "Cantidad inexistente"
End If
If Not IsNumeric(Can(L)) Then
Flag = 1
MsgBox "Cantidad debe ser numérico"
End If
End If
Next L
If Flag = 0 Then
Folio = Val(Text33)
Set Reg = Dbs.OpenRecordset("select * from guias_encab where numero = " & Folio & " ")
Reg.AddNew
Reg("numero") = Folio
Reg("fecha") = Fec1
If Fec2 <> "__/__/__" Then
Reg("fecha_venc") = Fec2
End If
Reg("cliente") = Val(Text12)
If Text14 <> "" Then
Set Reg1 = Dbs.OpenRecordset("select * from obra where nombre = '" & Text14 & "' ")
Reg("obra") = Reg("cliente")
End If
If Text35 <> "" Then
Set Reg1 = Dbs.OpenRecordset("select * from transportista where nombre = '" & Text35 & "' ")
Reg("transportista") = Reg1("rut_num")
End If
If Option1 Then
Reg("contado") = True
Else
Reg("contado") = False
End If
If Option3 Then
Reg("puesto_obra") = True
Else
Reg("puesto_obra") = False
End If
Reg("sub_total") = Val(Text10)
If Text17 <> "" Then Reg("descuento") = Val(Text17)
If Text51 <> "" Then Reg("flete") = Val(Text51)
Reg("neto") = Val(Text19)
Reg("iva") = Val(Text50.Text)
Reg("total") = Val(Text23)
Reg.Update
Reg.Close
Set Reg = Dbs.OpenRecordset("select * from guias")
For L = 0 To 11
If Not Cod(L) = "" Then
Reg.AddNew
Reg("numero") = Folio
Reg("linea") = L + 1
Reg("Familia") = Left(Cod(L), 3)
Reg("Grupo") = Mid(Cod(L), 4, 3)
Reg("Item") = " "
If OC(L) <> "" Then Reg("ocompra") = Val(OC(L))
Reg("cantidad") = CDbl(Can(L))
Reg("unitario") = CDbl(Valo(L))
Reg("total") = CDbl(Tot(L))
Reg.Update
Fam = Left(Cod(L), 3)
Grupo = Mid(Cod(L), 4, 3)
Item = " "
Set Reg1 = Dbs.OpenRecordset("select * from articulos where familia = '" & Fam & "' and grupo = '" & Grupo & "' and item = '" & Item & "' ")
Reg1.Edit
Reg1("Saldo") = Reg1("Saldo") - Can(L).Text
Reg1.Update
End If
Next L
Folio = Folio + 1
Text33 = Format(Folio, "000000")
Limpia
Form1.Reporte.ReportFileName = "c:\sistmat\guias.rpt"
If vista.Value = 1 Then
Form1.Reporte.Destination = 0
Else
Form1.Reporte.Destination = 1
End If
Form1.Reporte.PrintReport



End If

End Sub

POR FAVOR QUIERO AYUDA
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