Public nomcontrol As String Public tituloinforme As String Private

Anuncio
Public nomcontrol As String
Public tituloinforme As String
Private Sub banko_Click()
datbanko.Show
End Sub
Private Sub adelante_Click()
If Menu.general.Recordset.RecordCount > 0 Then
With Menu.general.Recordset
.MoveNext
If .EOF Then .MoveLast
End With
estableceregistros
End If
End Sub
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum,
ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal
pRecordset As ADODB.Recordset)
On Error Resume Next
Adodc1.Caption = "Registro " & Adodc1.Recordset.AbsolutePosition & " de " &
CStr(Adodc1.Recordset.RecordCount)
If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF And
Adodc1.Recordset.AbsolutePosition > 0 Then
verestado
End If
If cif.Text <> "" Then
cif.Text = ""
End If
If sinonimos.Text <> "" Then
sinonimos.Clear
End If
If comercialbool Then
If mercado.Text <> "" Then
mercado.Text = ""
End If
ElseIf mercadobool = True Then
If combocomercial.Text <> "" Then
combocomercial.Text = ""
End If
End If
If datos.facturas Then
lcf
activabotones (0)
datos.facturas = False
End If
If datos.contratos Then
lcc
activabotonescontratos (0)
datos.contratos = False
End If
If cazados.Enabled = True Then
cazados.Enabled = False
End If
'dale alegría a la regilla
regilla.RowSel = 1
regilla.RowSel = 1
End Sub
Private Sub atras_Click()
If Menu.general.Recordset.RecordCount > 0 Then
With Menu.general.Recordset
.MovePrevious
If .BOF Then .MoveFirst
End With
estableceregistros
End If
End Sub
Private Sub atrascontratos_Click()
If Menu.general2.Recordset.RecordCount > 0 Then
With Menu.general2.Recordset
Menu.general2.Recordset.MovePrevious
If .BOF Then .MoveFirst
End With
estableceregistroscontratos
End If
End Sub
Private Sub bavanzada_Click()
busavan.Show
End Sub
Private Sub bcif_Click()
If codigocli.Text <> "" Then
'cif.Text = ""
genera_nif
End If
End Sub
Private Sub bcomercial_Click()
On Error Resume Next
Dim sql3 As String
If combocomercial.Text = "" And codigocli.Text <> "" Then
sql3 = " select a.first_name as Nombre, a.last_name as Apellido from addressee a,
salesmen s, employees e,salesmen_customers sc,customers c Where c.number=" & "'"
& codigocli.Text & "'" & "and c.id=sc.customerid and sc.salesmanid= s.id and
s.employeeid=e.id And e.addresseeid = a.adressee_id"
general.RecordSource = sql3
esperar 1
general.Refresh
If general.Recordset.EOF And general.Recordset.BOF Or
general.Recordset.RecordCount <= 0 Then
MsgBox "No exsite Nif/Cif para este cliente", vbOKOnly, "¡¡Atención!!"
esperar 0
Exit Sub
End If
combocomercial.Text = general.Recordset.Fields(1).Value & "," &
general.Recordset.Fields(0).Value
esperar 0
End If
End Sub
Private Sub bdatbanko_Click()
datbanko.Show
End Sub
Private Sub bhistorico_Click()
historico.Show
End Sub
Private Sub bmercado_Click()
On Error GoTo error23
Dim sql As String
If mercado.Text = "" Then
If codigocli.Text <> "" Then
sql = "select b.name from branches b, customer_branches cb, customers c where
c.number= " & "'" & codigocli.Text & "'" & "and c.id=cb.customerid and
cb.branchid=b.id"
esperar 1
general.RecordSource = sql
general.Refresh
'comprueo si existen registros en el recodset
'********************************
If general.Recordset.EOF Or general.Recordset.BOF Then
MsgBox "No tiene mercado definido para este cliente", vbOKOnly, "Error..."
esperar 0
Exit Sub
End If
'*******************************
mercado.Text = general.Recordset.Fields(0).Value
general.Recordset.Close
Else
MsgBox "No existe código de cliente para realizar la búsqueda.", vbOKOnly, "Error..."
Exit Sub
End If
esperar 0
End If
Exit Sub
error23:
MsgBox Err.Description & "Nº error:" & Err.Number, vbOKOnly, "Error..."
Exit Sub
End Sub
Private Sub botonsin_Click()
generar_sinonimos
End Sub
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'PROCEDIMINETO PRINCIPAL PARA LA BÚSQUEDA DE CLIENTES
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
'*****************************************************
Private Sub buscar_Click()
On Error GoTo error1
'Dejamos la variable SQL vacia
sql = ""
'Borramos los posibles sinonomos de sinonimos.
If sinonimos.ListCount > 0 Then
sinonimos.Clear
End If
'Comprobar si hay datos en los controles.
'VALIDADICIÓN DE DATOS
If codigocli.Text <> "" And (Len(codigocli.Text) > 10 Or Len(codigocli.Text) < 3)
Then
MsgBox "Código de cliente con número de dígitos erróneo.", vbOKOnly, "Error..."
codigocli.SetFocus
Exit Sub
End If
'si se inserta el código del cliente.
If codigocli.Text <> "" Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia,a.postcode as
Código_postal,a.telno as Telefono,a.faxno as Fax,c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes,c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado FROM CUSTOMERS c, ADDRESSEE a WHERE c.addresseeid= a.adressee_id
and c.number = " & "'" & codigocli.Text & "'" & " order by a.last_name"
buscar_registros "Error, no existen clientes con ese código.", nada
If nada Then
bloquea_controles 0
Exit Sub
End If
tituloinforme = "listado de clientes por Código"
'si se inserta el telefono
ElseIf telefono.Text <> "" Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia,a.postcode as
Código_postal,a.telno as Telefono,a.faxno as Fax,c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes,c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden,c.customerstateid as
Estado FROM ADDRESSEE a, CUSTOMERS c WHERE a.telno = " & "'" &
telefono.Text & "'" & " AND c.addresseeid=a.adressee_id" & " order by a.last_name"
buscar_registros "Error, no existen clientes para ese teléfono.", nada
If nada Then
bloquea_controles 0
Exit Sub
End If
tituloinforme = "Listados de clientes por teléfono"
'Si se inserta el nombre del comercial
ElseIf combocomercial.Text <> "" And mercado.Text = "" Then
buscarcodigocomercial (combocomercial.Text)
If Not ractivos Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia,a.postcode as
Código_postal,a.telno as Telefono,a.faxno as Fax,c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes,c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado from addressee a, salesmen_customers sc, customers c, salesmen s Where
sc.salesmanid=s.id and sc.customerid=c.id and c.addresseeid=a.adressee_id and
s.number= " & "'" & codigocomer & "'" & "and c.customerstateid= " & "2" & " order by
a.last_name"
buscar_registros "Error, no hay clientes para ese comercial.", nada
ElseIf ractivos Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia,a.postcode as
Código_postal,a.telno as Telefono,a.faxno as Fax,c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes,c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado from addressee a, salesmen_customers sc, customers c, salesmen s Where
sc.salesmanid=s.id and sc.customerid=c.id and c.addresseeid=a.adressee_id and
s.number= " & "'" & codigocomer & "'" & " and c.customerstateid= " & "1" & " order
by a.last_name"
buscar_registros "Error, no hay clientes activos para ese comercial.", nada
End If
If nada Then
bloquea_controles 0
Exit Sub
End If
comercialbool = True
tituloinforme = "Listado de clientes por comercical: " & combocomercial.Text
'Si se inserta algo por teclado
ElseIf teclado <> "" Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia, a.postcode as
Código_postal, a.telno as Telefono, a.faxno as Fax, c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes, c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado FROM g_orders g, customers c, addressee a Where g.headline like " & " '%" &
teclado.Text & "%'" & " and g.adlayoutid = -1 AND g.lastobjectid in
(2,3,4,10,13,14,15,16,17,18) AND g.customerid = c.id AND c.addresseeid =
a.adressee_id and g.adlayoutid = -1" & " order by a.last_name"
buscar_registros "Error, no existen clientes para ese atributo.", nada
If nada Then
bloquea_controles 0
Exit Sub
End If
tituloinforme = "Listado de clientes por teclado"
'si se inserta el mercado
ElseIf mercado.Text <> "" And combocomercial.Text = "" Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia, a.postcode as
Código_postal, a.telno as Telefono, a.faxno as Fax, c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes, c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado FROM customers c, addressee a, customer_branches cb, branches b Where
b.name like" & "'%" & mercado.Text & "%'" & "And c.id = cb.customerid and
cb.branchid=b.id and c.addresseeid=a.adressee_id" & " order by a.last_name"
buscar_registros "Error, no hay clientes en ese mercado.", nada
If nada Then
bloquea_controles 0
Exit Sub
End If
mercadobool = True
tituloinforme = "Listado de clientes por mercado: " & mercado.Text
'Si se inaserta tanto el comercial como el mercado
ElseIf mercado.Text <> "" And combocomercial.Text <> "" Then
MsgBox "Para esta búsqueda utilice el botón búsqueda avanzada, un poco más abajo",
vbOKOnly, "¡¡Atención!!"
tituloinforme = "listados de clientes por comercial(" & combocomercial.Text & " y
mercado(" & mercado.Text & ")"
'si se inserta el nombre del cliente.
ElseIf nombrec.Text <> "" Then
sql = "select a.contactperson as Persona_contacto,a.last_name as Nombre_cliente,
a.street as Dirección,a.city as Ciudad, a.stateabr as Provincia,a.postcode as
Código_postal,a.telno as Telefono,a.faxno as Fax,c.createat as Fecha_creación,
c.number as Código,a.countryabr as País,a.email as correo, c.numberofinsertions as
Numero_de_inserciones,c.numberofactiveinsertions as
Inserciones_activas,c.numberoforders as Numero_de_ordenes,c.numberofactiveorders
as Numero_de_ordenes_activas,c.lastinsertiondate as
Ultima_fecha_de_insercion,c.ordernumber as Numero_de_orden, c.customerstateid as
Estado FROM addressee a, customers c WHERE a.last_name Like " & " '%" &
nombrec.Text & "%'" & " AND c.addresseeid=a.adressee_id" & " order by a.last_name"
buscar_registros "Error, no existen clientes con ese nombre comercial.", nada
If nada Then
bloquea_controles 0
Exit Sub
End If
tituloinforme = "Listado de clientes por nombre: " & nombrec.Text
Else
MsgBox "Introduzca un dato de búsqueda.", vbOKOnly, "¡¡Atención!!"
End If
Exit Sub
'rutina de error:
error1:
If Err.Number = 3021 Then
MsgBox "Error, No existe el cliente con esa referencia de búsqueda", vbOKOnly,
"Error..."
ElseIf Err.Number = 13 Then
MsgBox "El tipo de dato introducido no es correcto.", vbOKOnly, "Error..."
ElseIf Err.Number = 91 Then
MsgBox "Error, No existe el cliente con esa referencia de búsqueda", vbOKOnly,
"Error..."
ElseIf Err.Number = -2147217908 Then
MsgBox "Error, No existe el cliente con esa referencia de búsqueda", vbOKOnly,
"Error..."
Exit Sub
End If
MsgBox Err.Number, vbOKOnly, "Número de error"
Resume Next
Exit Sub
End Sub
Private Sub datbank_Click()
datbanko.Show
End Sub
Private Sub clipot_WillMove(ByVal adReason As ADODB.EventReasonEnum,
adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error Resume Next
clipot.Caption = "Registro: " & CStr(clipot.Recordset.AbsolutePosition) & " de " &
clipot.Recordset.RecordCount
End Sub
Private Sub cazados_Click()
On Error Resume Next
Dim sqlcazados As String
If codigocazados.Text <> "" And cazadosfechainicio.Text <> "" And
cazadosfechafin.Text <> "" Then
sqlcazados = "select gi.orderid as Num_orden,gi.objectid as
Num_objeto,gi.appearancedate as Fecha_de_aparicion,gi.customerid as
Código_cliente,gi.createdat as Fecha_de_creación,gi.invoicerowtext as
Texto_factura,gi.invoicerowid as Línea_factura,gi.height as Alto,gi.width as Ancho,
gi.columns as Columnas,gi.netprice as Precio_neto,gi.repronumber as Cod_diseño from
g_insertions gi, customers c Where c.number = " & codigocazados.Text & "and
c.id=gi.customerid and gi.invoicingflag = 1 and gi.adlayoutid =-1 and gi.objectid in
(2,3,4,10,13,14,15,16,17,18,11,27) and gi.appearancedate between " & "'" &
Format(cazadosfechainicio.Text, "m-d-yy") & "'" & " and " & "'" &
Format(cazadosfechafin.Text, "m-d-yy") & "'" & " order by gi.appearancedate"
general.RecordSource = sqlfacturas
Menu.esperar 1
general.Refresh
'comprueo si existen registros en el recodset
'********************************
If general.Recordset.EOF Or general.Recordset.BOF Then
MsgBox "No tiene facturas definidas para este Código de cliente", vbOKOnly,
"Error..."
Menu.esperar 0
Exit Sub
End If
'*******************************
With regillafacturas
Set .DataSource = general.Recordset
.Refresh
.Redraw = True
'Esto lo pondrías en tu procedimiento de impresion
Call datos.initCrystalControl(Menu.CrystalReport1)
NombreReporte = datos.cadenaconexion & "\cazados.rpt"
tituloinforme = "Inserciones realizadas para: " & cazadosnombre.Text & " entre " &
cazadosfechainicio.Text & " y " & cazadosfechafin.Text
Call datos.Presentar_Informe(tituloinforme, NombreReporte, sqlcazados,
"UID=sa;PWD=noctamid;DSN=techserver", 0, "")
'//***********************************************************
Exit Sub
error13:
MsgBox Err.Description, vbOKOnly, "Error"
Exit Sub
Menu.esperar 0
Else
MsgBox "No ha introducido todos los datos necesarios para hacer la búsqueda",
vbOKOnly, "¡¡Atención!!"
End If
End Sub
Private Sub cazadosfechafin_LostFocus()
cazados.Enabled = True
End Sub
Private Sub Combocomercial_Click()
Dim valor As Double
valor = MsgBox("Clientes activos para " & combocomercial.Text, vbYesNo, "¿Clientes
activos?")
If valor = 6 Then
ractivos = True
Else
ractivos = False
End If
End Sub
Private Sub Command5_Click()
End Sub
Private Sub exportar_Click()
datos.exportar (Adodc1.object)
End Sub
Private Sub Exportarcazados_Click()
datos.exportar (general.object)
End Sub
Private Sub exportarcontratos_Click()
datos.exportar (general2.object)
End Sub
Private Sub exportarfacturas_Click()
datos.exportar (general.object)
End Sub
Private Sub Form_Load()
genera_comerciales
genera_mercado
inicializa_datos
End Sub
Sub buscarcodigocomercial(nombrecomerial As String)
On Error GoTo error10
Adodc2.Recordset.MoveFirst
Do While nombrecomerial <> Adodc2.Recordset.Fields(2).Value & ", " &
Adodc2.Recordset.Fields(1).Value And Not Adodc2.Recordset.EOF And Not
Adodc2.Recordset.BOF
Adodc2.Recordset.MoveNext
Loop
If datos.facturacioagentes Then
codigocomer = Adodc2.Recordset.Fields(3).Value
Else
codigocomer = Adodc2.Recordset.Fields(0).Value
End If
Exit Sub
error10:
If Err.Number = 3021 Then
MsgBox "Nombre de comercial no válido.", vbOKOnly, "Error..."
End If
Exit Sub
End Sub
Private Sub Imprimir_Click()
On Error GoTo error13
'Esto lo pondrías en tu procedimiento de impresion
Call datos.initCrystalControl(Menu.CrystalReport1)
NombreReporte = datos.cadenaconexion & "\clientes.rpt"
Call datos.Presentar_Informe(tituloinforme, NombreReporte, sql,
"UID=sa;PWD=noctamid;DSN=comercial", 0, "")
'//***********************************************************
Exit Sub
error13:
MsgBox Err.Description, vbOKOnly, "Error"
Exit Sub
End Sub
Private Sub Informe_Click()
On Error GoTo error29
'Esto lo pondrías en tu procedimiento de impresion
Call datos.initCrystalControl(Menu.CrystalReport1)
NombreReporte = datos.cadenaconexion & "\facturas.rpt"
Call datos.Presentar_Informe(tituloinforme, NombreReporte, sqlfacturas,
"UID=sa;PWD=noctamid;DSN=comercial", 0, "")
'//***********************************************************
Exit Sub
error29:
Resume Next
End Sub
Private Sub informecontratos_Click()
On Error Resume Next
'Esto lo pondrías en tu procedimiento de impresion
Call datos.initCrystalControl(Menu.CrystalReport1)
NombreReporte = datos.cadenaconexion & "\contratos.rpt"
tituloinforme = "Listado de ordenes para el cliente, " & nobreclicontratos.Text
Call datos.Presentar_Informe(tituloinforme, NombreReporte, sqlcontratos,
"UID=sa;PWD=noctamid;DSN=comercial", 0, "")
'//***********************************************************
End Sub
Private Sub Label1_Click()
End Sub
Private Sub limpiarpantalla_Click()
limpia_controles
limpiarpantalla.Enabled = False
buscar.Enabled = True
botonsin.Enabled = False
'bhistorico.Enabled = False
bcif.Enabled = False
bmercado.Enabled = False
bcomercial.Enabled = False
bavanzada.Enabled = True
lcf
lcc
activabotones (0)
activabotonescontratos (0)
End Sub
Private Sub menu_Click()
datbanko.Show
End Sub
Private Sub menu_acercade_Click()
acercade.Show
End Sub
Private Sub Menu_clipo_Click()
clipo.Show 1
End Sub
Private Sub menu_factagentes_Click()
facagentes.Show 1
End Sub
Private Sub menu_liscomercial_Click()
estadisticascomer.Show 1
End Sub
Private Sub menu_lismercado_Click()
estamercado.Show 1
End Sub
Private Sub menu_plantilla_Click()
On Error Resume Next
Dim ruta As String
ruta = Dir("excel.exe", vbArchive)
Shell ruta & "\" & "excel.exe", vbNormalFocus
End Sub
Private Sub menu_salir_Click()
On Error GoTo error20
datosmercado.Recordset.Close
general.Recordset.Close
Adodc2.Recordset.Close
Unload Menu
End
Exit Sub
error20:
If Err.Number = 361 Then
End
Exit Sub
End If
End
End Sub
Sub actualizaregilla(num As Integer)
On Error GoTo error7
With regilla
If num = 1 Then
.Refresh
.Redraw = True
ElseIf num = 0 Then
.Clear
.Refresh
.Redraw = True
End If
End With
Exit Sub
error7:
MsgBox Err.Description & " Nº error: " & Err.Number, vbOKOnly, "Error"
Resume Next
End Sub
Sub rellena_formulario()
On Error Resume Next
'establecemos todos los controles ligados al recorset que se asignó al control ADODC
Set fechacreacion.DataSource = Adodc1.Recordset
Set cif.DataSource = Adodc1.Recordset
Set comercial.DataSource = Adodc1.Recordset
Set publicación.DataSource = Adodc1.Recordset
Set direccion.DataSource = Adodc1.Recordset
Set nacionalidad.DataSource = Adodc1.Recordset
Set poblacion.DataSource = Adodc1.Recordset
Set codigopostal.DataSource = Adodc1.Recordset
Set provincia.DataSource = Adodc1.Recordset
Set fax.DataSource = Adodc1.Recordset
Set contacto.DataSource = Adodc1.Recordset
Set correo.DataSource = Adodc1.Recordset
Set fechains.DataSource = Adodc1.Recordset
Set codigocontrato.DataSource = Adodc1.Recordset
Set ordenesactivas.DataSource = Adodc1.Recordset
'controles de casados
Set codigocazados.DataSource = Adodc1.Recordset
Set cazadosnombre.DataSource = Adodc1.Recordset
Set direccioncazados.DataSource = Adodc1.Recordset
Set telefonocazados.DataSource = Adodc1.Recordset
'controles de facturas
Set codigoclifactura.DataSource = Adodc1.Recordset
Set direccionfactura.DataSource = Adodc1.Recordset
Set nombrefactura.DataSource = Adodc1.Recordset
Set telefonofactura.DataSource = Adodc1.Recordset
'controles contratos
Set codigocontratos.DataSource = Adodc1.Recordset
Set direccioncontratos.DataSource = Adodc1.Recordset
Set nobreclicontratos.DataSource = Adodc1.Recordset
Set telefonocontratos.DataSource = Adodc1.Recordset
' Los 6 controles de búsqueda por el momento
asignar_resto_de_controles_al_recordset
'asignar el campo a cada control
asignar_campos
End Sub
Sub inicializa_datos()
telefono.Text = ""
codigocli.Text = ""
nombrec.Text = ""
codigocomer = ""
sinonimos.Text = ""
mercado.Text = ""
combocomercial.Text = ""
cif.Text = ""
teclado.Text = ""
datos.cadenaconexion = App.Path
'datos de clientes potenciales
End Sub
Sub Activa_botones(num As Integer)
On Error Resume Next
If num = 0 Then
bhistorico.Enabled = False
exportar.Enabled = False
imprimir.Enabled = False
datbank.Enabled = False
botonsin.Enabled = False
limpiarpantalla.Enabled = False
buscar.Enabled = True
bcif.Enabled = False
bmercado.Enabled = False
bcomercial.Enabled = False
bavanzada.Enabled = True
verfacturas.Enabled = False
ElseIf num = 1 Then
bhistorico.Enabled = True
exportar.Enabled = True
imprimir.Enabled = True
bdatbanko.Enabled = True
botonsin.Enabled = True
limpiarpantalla.Enabled = True
buscar.Enabled = False
bcif.Enabled = True
bmercado.Enabled = True
bcomercial.Enabled = True
bultimafecha.Enabled = True
bavanzada.Enabled = False
verfacturas.Enabled = True
End If
End Sub
Sub asignar_resto_de_controles_al_recordset()
On Error Resume Next
If codigocli.Text <> "" Then
Set nombrec.DataSource = Adodc1.Recordset
nombrec.DataField = Adodc1.Recordset.Fields(1).Name
Set telefono.DataSource = Adodc1.Recordset
telefono.DataField = Adodc1.Recordset.Fields(6).Name
ElseIf nombrec.Text <> "" Then
Set telefono.DataSource = Adodc1.Recordset
telefono.DataField = Adodc1.Recordset.Fields(6).Name
Set codigocli.DataSource = Adodc1.Recordset
codigocli.DataField = Adodc1.Recordset.Fields(9).Name
ElseIf telefono.Text <> "" Then
Set nombrec.DataSource = Adodc1.Recordset
nombrec.DataField = Adodc1.Recordset.Fields(1).Name
Set codigocli.DataSource = Adodc1.Recordset
codigocli.DataField = Adodc1.Recordset.Fields(9).Name
ElseIf combocomercial.Text <> "" Or teclado.Text <> "" Or mercado.Text <> "" Then
Set nombrec.DataSource = Adodc1.Recordset
nombrec.DataField = Adodc1.Recordset.Fields(1).Name
Set telefono.DataSource = Adodc1.Recordset
telefono.DataField = Adodc1.Recordset.Fields(6).Name
Set codigocli.DataSource = Adodc1.Recordset
codigocli.DataField = Adodc1.Recordset.Fields(9).Name
End If
End Sub
Sub asignar_campos()
On Error GoTo errro15:
contacto.DataField = Adodc1.Recordset.Fields(0).Name
direccion.DataField = Adodc1.Recordset.Fields(2).Name
poblacion.DataField = Adodc1.Recordset.Fields(3).Name
provincia.DataField = Adodc1.Recordset.Fields(4).Name
codigopostal.DataField = Adodc1.Recordset.Fields(5).Name
telefono.DataField = Adodc1.Recordset.Fields(6).Name
fax.DataField = Adodc1.Recordset.Fields(7).Name
fechacreacion.DataField = Adodc1.Recordset.Fields(8).Name
'teclado
nacionalidad.DataField = Adodc1.Recordset.Fields(10).Name
correo.DataField = Adodc1.Recordset.Fields(11).Name
ordenesactivas.DataField = Adodc1.Recordset.Fields(15).Name
fechains.DataField = Adodc1.Recordset.Fields(16).Name
codigocontrato.DataField = Adodc1.Recordset.Fields(17).Name
'cazados
codigocazados.DataField = Adodc1.Recordset.Fields(9).Name
cazadosnombre.DataField = Adodc1.Recordset.Fields(1).Name
direccioncazados.DataField = Adodc1.Recordset.Fields(2).Name
telefonocazados.DataField = Adodc1.Recordset.Fields(6).Name
'facturas
nombrefactura.DataField = Adodc1.Recordset.Fields(1).Name
telefonofactura.DataField = Adodc1.Recordset.Fields(6).Name
codigoclifactura.DataField = Adodc1.Recordset.Fields(9).Name
direccionfactura.DataField = Adodc1.Recordset.Fields(2).Name
' contratos
codigocontratos.DataField = Adodc1.Recordset.Fields(9).Name
direccioncontratos.DataField = Adodc1.Recordset.Fields(2).Name
nobreclicontratos.DataField = Adodc1.Recordset.Fields(1).Name
telefonocontratos.DataField = Adodc1.Recordset.Fields(6).Name
Exit Sub
errro15:
MsgBox Err.Description, vbOKOnly, "Error..."
Exit Sub
End Sub
Sub generar_sinonimos()
On Error Resume Next
If sinonimos.Text = "" Then
Dim i As Integer
Dim sql2 As String
On Error Resume Next
sql2 = "select cs.synonym as sinonimos, c.number as codigo from customersynonyms
cs, customers c where c.id=cs.customerid and c.number= " & "'" & codigocli.Text & "'"
general.RecordSource = sql2
esperar 1
general.Refresh
'comprueo si existen registros en el recodset
'********************************
If general.Recordset.EOF Or general.Recordset.BOF Then
Exit Sub
End If
'*******************************
With sinonimos
general.Recordset.MoveFirst
For i = 1 To general.Recordset.RecordCount
.AddItem general.Recordset.Fields(0).Value
general.Recordset.MoveNext
Next i
.Text = .List(0)
.Refresh
End With
esperar 0
End If
Exit Sub
End Sub
Sub genera_comerciales()
Dim i As Integer
On Error GoTo error11
'inicializa conexiones a la base de datos para contener los nombres de los comerciales
sql = "select s.number as codcomercial, a.first_name as Nombre, a.last_name as
Apellido,s.id as identificador from addressee a, salesmen s, employees e Where
s.employeeid = e.id and s.number
in('1016','1012','05','1009','1013','1003','1008','1027','1006','04','1007','1011','1010','1014'
) And e.addresseeid = a.adressee_id ORDER BY a.last_name"
Adodc2.RecordSource = sql
Adodc2.Refresh
With combocomercial
Adodc2.Recordset.MoveFirst
For i = 1 To Adodc2.Recordset.RecordCount
.AddItem Adodc2.Recordset.Fields(2).Value & ", " &
Adodc2.Recordset.Fields(1).Value
Adodc2.Recordset.MoveNext
Next i
.Refresh
End With
Exit Sub
error11:
MsgBox Err.Description & " Nº error: " & Err.Number, vbOKOnly, "Error"
Resume Next
End Sub
Sub genera_nif()
On Error Resume Next
If cif.Text = "" Then
sql = "select i.taxnumber as CIF from invoices i where i.customernumber= " & "'" &
codigocli.Text & "'"
general.RecordSource = sql
esperar 1
general.Refresh
If general.Recordset.EOF And general.Recordset.BOF Or
general.Recordset.RecordCount <= 0 Then
MsgBox "No exsite Nif/Cif para este cliente", vbOKOnly, "¡¡Atención!!"
esperar 0
Exit Sub
End If
cif.Text = general.Recordset.Fields(0).Value
esperar 0
End If
End Sub
Sub buscar_registros(ByVal mensaje As String, nada As Boolean)
On Error GoTo error19
Adodc1.RecordSource = sql
esperar 1
Adodc1.Refresh
'comprueo si existen registros en el recodset
'********************************
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
MsgBox mensaje, vbOKOnly, "Error..."
nada = True
esperar 0
Exit Sub
End If
'*******************************
Set regilla.DataSource = Adodc1.Recordset
actualizaregilla (1)
rellena_formulario
Activa_botones (1)
bloquea_controles (1)
esperar 0
Exit Sub
error19:
MsgBox Err.Description, vbOKOnly, "Error..."
Exit Sub
End Sub
Sub verestado()
On Error Resume Next
If Adodc1.Recordset.Fields(18).Value = "1" Then
estadotexto.Text = "Activo."
ElseIf Adodc1.Recordset.Fields(18).Value = "2" Then
estadotexto.Text = "Pasivo."
ElseIf Adodc1.Recordset.Fields(18).Value = "3" Then
estadotexto.Text = "Para facturar."
End If
End Sub
Sub bloquea_controles(num As Integer)
On Error Resume Next
If num = 1 Then
telefono.Locked = True
mercado.Locked = True
nombrec.Locked = True
telefono.Locked = True
codigocli.Locked = True
combocomercial.Locked = True
teclado.Locked = True
fechains.Locked = True
ordenesactivas.Enabled = True
ElseIf num = 0 Then
telefono.Locked = False
mercado.Locked = False
nombrec.Locked = False
telefono.Locked = False
codigocli.Locked = False
combocomercial.Locked = False
teclado.Locked = False
fechains.Locked = False
Menu.Enabled = True
ordenesactivas.Enabled = False
End If
End Sub
Sub limpia_controles()
On Error Resume Next
'desligar controles del registro ADODC1
sql = ""
Adodc1.Recordset.Close
Set cif.DataSource = Adodc1.Recordset
Set publicación.DataSource = Adodc1.Recordset
Set direccion.DataSource = Adodc1.Recordset
Set nacionalidad.DataSource = Adodc1.Recordset
Set poblacion.DataSource = Adodc1.Recordset
Set codigopostal.DataSource = Adodc1.Recordset
Set provincia.DataSource = Adodc1.Recordset
Set fax.DataSource = Adodc1.Recordset
Set contacto.DataSource = Adodc1.Recordset
Set correo.DataSource = Adodc1.Recordset
Set fechains.DataSource = Adodc1.Recordset
Set codigocontrato.DataSource = Adodc1.Recordset
Set nombrec.DataSource = Adodc1.Recordset
Set codigocli.DataSource = Adodc1.Recordset
Set telefono.DataSource = Adodc1.Recordset
Set fechacreacion.DataSource = Adodc1.Recordset
Set regilla.DataSource = Adodc1.Recordset
Set ordenesactivas.DataSource = Adodc1.Recordset
'cazados
Set codigocazados.DataSource = Adodc1.Recordset
Set cazadosnombre.DataSource = Adodc1.Recordset
Set direccioncazados.DataSource = Adodc1.Recordset
Set telefonocazados.DataSource = Adodc1.Recordset
'controles de facturas
Set direccionfactura.DataSource = Adodc1.Recordset
Set codigoclifactura.DataSource = Adodc1.Recordset
Set nombrefactura.DataSource = Adodc1.Recordset
Set telefonofactura.DataSource = Adodc1.Recordset
'controles contratos
Set codigocontratos.DataSource = Adodc1.Recordset
Set direccioncontratos.DataSource = Adodc1.Recordset
Set nobreclicontratos.DataSource = Adodc1.Recordset
Set telefonocontratos.DataSource = Adodc1.Recordset
actualizaregilla 0
Adodc1.Caption = ""
telefono.Text = ""
mercado.Text = ""
nombrec.Text = ""
telefono.Text = ""
codigocli.Text = ""
cif.Text = ""
estadotexto.Text = ""
combocomercial.Text = ""
teclado.Text = ""
publicación.Text = ""
fechains.Text = ""
contacto.Text = ""
direccion.Text = ""
poblacion.Text = ""
provincia.Text = ""
codigopostal.Text = ""
fax.Text = ""
fechacreacion.Text = ""
teclado.Text = ""
nacionalidad.Text = ""
correo.Text = ""
codigocontrato.Text = ""
sinonimos.Text = ""
ordenesactivas.Text = ""
'cazados
codigocazados.Text = ""
cazadosnombre.Text = ""
direccioncazados.Text = ""
telefonocazados.Text = ""
'controles factura
direccionfactura.Text = ""
codigoclifactura.Text = ""
nombrefactura.Text = ""
telefonofactura.Text = ""
'controles contratos
codigocontratos.Text = ""
direccioncontratos.Text = ""
nobreclicontratos.Text = ""
telefonocontratos.Text = ""
bloquea_controles 0
End Sub
Sub genera_mercado()
On Error GoTo error21
Dim i As Integer
Dim sql As String
sql = "select b.name from branches b"
datosmercado.RecordSource = sql
datosmercado.Refresh
datosmercado.Recordset.MoveFirst
For i = 1 To datosmercado.Recordset.RecordCount
mercado.AddItem datosmercado.Recordset.Fields(0).Value
datosmercado.Recordset.MoveNext
Next i
Exit Sub
error21:
MsgBox Err.Description & "Nº error: " & Err.Number, vbOKOnly, "Error..."
Exit Sub
End Sub
Sub esperar(num As Integer)
On Error GoTo error24
If num = 1 Then
Screen.MousePointer = 11
Menu.Enabled = False
ElseIf num = 0 Then
Screen.MousePointer = 0
Menu.Enabled = True
End If
Exit Sub
error24:
MsgBox Err.Description & " Nº error: " & Err.Number, vbOKOnly, "Error..."
Exit Sub
End Sub
Private Sub primero_Click()
On Error Resume Next
If Menu.general.Recordset.RecordCount > 0 Then
Menu.general.Recordset.MoveFirst
estableceregistros
End If
End Sub
Private Sub primerocontratos_Click()
On Error Resume Next
If Menu.general2.Recordset.RecordCount > 0 Then
Menu.general2.Recordset.MoveFirst
estableceregistroscontratos
End If
End Sub
Private Sub regilla_Click()
On Error Resume Next
Adodc1.Recordset.AbsolutePosition = regilla.Row
End Sub
Private Sub regillacontratos_Click()
If datos.contratos Then
general2.Recordset.AbsolutePosition = regillacontratos.Row
End If
End Sub
Private Sub regillafacturas_Click()
If datos.facturas Then
Menu.general.Recordset.AbsolutePosition = regillafacturas.Row
End If
End Sub
Private Sub siguientecontratos_Click()
If Menu.general2.Recordset.RecordCount > 0 Then
With Menu.general2.Recordset
.MoveNext
If .EOF Then .MoveLast
End With
estableceregistroscontratos
End If
End Sub
Private Sub ultimo_Click()
If Menu.general.Recordset.RecordCount > 0 Then
Menu.general.Recordset.MoveLast
estableceregistros
End If
End Sub
Private Sub ultimocontratos_Click()
If Menu.general2.Recordset.RecordCount > 0 Then
Menu.general2.Recordset.MoveLast
estableceregistroscontratos
End If
End Sub
Private Sub vercontratos_Click()
On Error Resume Next
Dim sql As String
Dim sql2 As String
Dim suma As Long
If codigocontratos.Text = "" Then
MsgBox "no tiene codigo de cliente para ver los contratos", vbOKOnly, "¡¡Atención!!"
Exit Sub
End If
sql = "select go.createdat as Fecha_orden,go.ordernumber as Nº_orden,go.orderstateid
as Estado_orden,go.totalinsertions as Inserciones_totales,go.createdinsertions as
Inserciones_creadas,go.issuedinsertions as Inserciones_editadas,go.startobjectid as
Objeto_de_comienzo,go.startdate as fecha_de_comienzo,go.lastobjectid as
Último_objeto,go.lastdate as Última_fecha,go.repronumber as
Código_diseño,go.headline as Teclado,go.startissuenumber as
Edición_de_comienzo,go.nextissuenumber as Prósima_edición,go.lastissuenumber as
Última_edición,go.totalpricepublished as Precio_Total_publicado,go.totalpriceinvoiced
as Precio_total_facturado,go.totalpricecreated as
Precio_total_contratado,go.lastinserteddate as
Última_fecha_insercion,go.lastinsertedobjectid as
Último_objeto_de_insercion,go.lastinsertedissuenumber as
Última_edición_de_inserción from g_orders go, customers c where c.number= "
sql2 = "'" & codigocontratos.Text & "'" & "and c.id=go.customerid and go.adlayoutid =
-1 and go.adtypeid=2 order by go.createdat"
sqlcontratos = sql + sql2
general2.RecordSource = sqlcontratos
esperar 1
general2.Refresh
' comprueo si existen registros en el recodset
'********************************
If Menu.general2.Recordset.EOF Or Menu.general2.Recordset.BOF Then
MsgBox "El cliente no tiene definidos contratos", vbOKOnly, "Error..."
Menu.esperar 0
Exit Sub
End If
'*******************************
datos.contratos = True
With regillacontratos
Set .DataSource = general2.Recordset
.Refresh
.Redraw = True
suma = 0
general2.Recordset.MoveFirst
While Not general2.Recordset.EOF
suma = suma + general2.Recordset.Fields(17).Value
general2.Recordset.MoveNext
Wend
general2.Recordset.MoveFirst
totalcontratado.Text = CStr(suma)
End With
Menu.esperar 0
estableceregistroscontratos
asigna_controlescontratos
activabotonescontratos (1)
'*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
'Esto lo pondrías en tu procedimiento de impresion
Call datos.initCrystalControl(Menu.CrystalReport1)
NombreReporte = datos.cadenaconexion & "\contratos.rpt"
tituloinforme = "Listado de ordenes para el cliente, " & nobreclicontratos.Text
Call datos.Presentar_Informe(tituloinforme, NombreReporte, sqlcontratos,
"UID=sa;PWD=noctamid;DSN=comercial", 0, "")
'//***********************************************************
End Sub
'******************************
Private Sub verfacturas_Click()
On Error Resume Next
Dim suma As Long
Dim fecha As Date
Dim i As Integer
If codigoclifactura.Text <> "" And datos.facturas = False Then
sqlfacturas = "select i.invoicenumber as Nº_factura,i.street as Dirección,i.phone as
Teléfono,i.taxnumber as Cif,i.grossamount as Importe_neto,i.grossvatamount as
Iva,i.amounttopay as Importe_bruto,i.invoicedate as Fecha_factura,i.settlementdate as
Vencimiento,i.invoicetypeid as Forma_pago, i.paymentstateid as Estado_factura from
invoices i where i.customernumber= " & "'" & codigoclifactura.Text & "'" & "order by
i.invoicedate"
general.RecordSource = sqlfacturas
Menu.esperar 1
general.Refresh
'comprueo si existen registros en el recodset
'********************************
If general.Recordset.EOF Or general.Recordset.BOF Then
MsgBox "No tiene facturas definidas para este Código de cliente", vbOKOnly,
"Error..."
Menu.esperar 0
Exit Sub
End If
'*******************************
datos.facturas = True
general.Recordset.MoveFirst
For i = 0 To general.Recordset.RecordCount - 1
If general.Recordset.Fields(10).Value = 0 Then
regillafacturas.TextArray(faÍndice(i + 1, 10)) = "No pagado."
ElseIf general.Recordset.Fields(10).Value = 1 Then
regillafacturas.TextArray(faÍndice(i + 1, 10)) = "pagado a plazo."
ElseIf general.Recordset.Fields(10).Value = 2 Then
regillafacturas.TextArray(faÍndice(i + 1, 10)) = "Pagado."
End If
If general.Recordset.Fields(9).Value = 1 Then
regillafacturas.TextArray(faÍndice(i + 1, 9)) = "Factura."
ElseIf general.Recordset.Fields(9).Value = 2 Then
regillafacturas.TextArray(faÍndice(i + 1, 9)) = "Abono."
ElseIf general.Recordset.Fields(9).Value = 3 Then
regillafacturas.TextArray(faÍndice(i + 1, 9)) = "Cancelación."
ElseIf general.Recordset.Fields(9).Value = 4 Then
regillafacturas.TextArray(faÍndice(i + 1, 9)) = "Reentrada."
End If
general.Recordset.MoveNext
Next i
general.Recordset.MoveFirst
With regillafacturas
Set .DataSource = general.Recordset
.ColWidth(1) = 1000
.ColWidth(2) = 0
.ColWidth(3) = 0
.ColWidth(4) = 0
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1500
.ColWidth(8) = 1500
.ColWidth(9) = 1500
.ColWidth(10) = 1000
.ColWidth(11) = 1500
.Refresh
.Redraw = True
suma = 0
general.Recordset.MoveFirst
While Not general.Recordset.EOF
suma = suma + general.Recordset.Fields(4).Value
general.Recordset.MoveNext
Wend
general.Recordset.MoveFirst
impototal.Text = CStr(suma)
End With
Menu.esperar 0
estableceregistros
asigna_controles
activabotones (1)
Else
MsgBox "Ya ha ejecutado esta consulta...", vbOKOnly, "¡¡Atención!!"
End If
End Sub
Sub activabotones(ByVal num As Integer)
On Error Resume Next
If num = 1 Then
primero.Enabled = True
atras.Enabled = True
adelante.Enabled = True
ultimo.Enabled = True
exportarfacturas.Enabled = True
informe.Enabled = True
ElseIf num = 0 Then
primero.Enabled = False
atras.Enabled = False
adelante.Enabled = False
ultimo.Enabled = False
exportarfacturas.Enabled = False
informe.Enabled = False
End If
End Sub
Sub asigna_controles()
On Error Resume Next
Set numfactura.DataSource = general.Recordset
Set direccion.DataSource = general.Recordset
Set telefonofactura.DataSource = general.Recordset
Set impob.DataSource = general.Recordset
Set impon.DataSource = general.Recordset
Set ivafactura.DataSource = general.Recordset
Set fecha.DataSource = general.Recordset
Set ciffactura.DataSource = general.Recordset
numfactura.DataField = general.Recordset.Fields(0).Name
direccion.DataField = general.Recordset.Fields(1).Name
telefonofactura.DataField = general.Recordset.Fields(2).Name
impob.DataField = general.Recordset.Fields(6).Name
impon.DataField = general.Recordset.Fields(4).Name
ivafactura.DataField = general.Recordset.Fields(5).Name
fecha.DataField = general.Recordset.Fields(7).Name
ciffactura.DataField = general.Recordset.Fields(3).Name
End Sub
Sub estableceregistros()
registro.Text = CStr(general.Recordset.AbsolutePosition)
de.Text = CStr(general.Recordset.RecordCount)
End Sub
Sub estableceregistroscontratos()
registrocontrato.Text = CStr(general2.Recordset.AbsolutePosition)
decontrato.Text = CStr(general2.Recordset.RecordCount)
End Sub
Sub asigna_controlescontratos()
On Error Resume Next
Set fechaordencontrato.DataSource = general2.Recordset
Set numorden.DataSource = general2.Recordset
Set estadoorden.DataSource = general2.Recordset
Set insercionestotales.DataSource = general2.Recordset
Set insercionescreadas.DataSource = general2.Recordset
Set insercioneseditadas.DataSource = general2.Recordset
Set objetoinicio.DataSource = general2.Recordset
Set fechainicio.DataSource = general2.Recordset
Set ultimoobjeto.DataSource = general2.Recordset
Set ultimafecha.DataSource = general2.Recordset
Set codigodiseño.DataSource = general2.Recordset
Set tecladoorden.DataSource = general2.Recordset
Set ediciondeinicio.DataSource = general2.Recordset
Set proximaedicion.DataSource = general2.Recordset
Set ultimaedicion.DataSource = general2.Recordset
Set preciopublicado.DataSource = general2.Recordset
Set preciofacturado.DataSource = general2.Recordset
Set preciocontratado.DataSource = general2.Recordset
Set ultimafechacontrato.DataSource = general2.Recordset
Set ultimoobjetocontrato.DataSource = general2.Recordset
Set ultimaedicioncontrato.DataSource = general2.Recordset
fechaordencontrato.DataField = general2.Recordset.Fields(0).Name
numorden.DataField = general2.Recordset.Fields(1).Name
estadoorden.DataField = general2.Recordset.Fields(2).Name
insercionestotales.DataField = general2.Recordset.Fields(3).Name
insercionescreadas.DataField = general2.Recordset.Fields(4).Name
insercioneseditadas.DataField = general2.Recordset.Fields(5).Name
objetoinicio.DataField = general2.Recordset.Fields(6).Name
fechainicio.DataField = general2.Recordset.Fields(7).Name
ultimoobjeto.DataField = general2.Recordset.Fields(8).Name
ultimafecha.DataField = general2.Recordset.Fields(9).Name
codigodiseño.DataField = general2.Recordset.Fields(10).Name
tecladoorden.DataField = general2.Recordset.Fields(11).Name
ediciondeinicio.DataField = general2.Recordset.Fields(12).Name
proximaedicion.DataField = general2.Recordset.Fields(13).Name
ultimaedicion.DataField = general2.Recordset.Fields(14).Name
preciopublicado.DataField = general2.Recordset.Fields(15).Name
preciofacturado.DataField = general2.Recordset.Fields(16).Name
preciocontratado.DataField = general2.Recordset.Fields(17).Name
ultimafechacontrato.DataField = general2.Recordset.Fields(18).Name
ultimoobjetocontrato.DataField = general2.Recordset.Fields(19).Name
ultimaedicioncontrato.DataField = general2.Recordset.Fields(20).Name
End Sub
Sub activabotonescontratos(ByVal num As Integer)
On Error Resume Next
If num = 1 Then
primerocontratos.Enabled = True
atrascontratos.Enabled = True
siguientecontratos.Enabled = True
ultimocontratos.Enabled = True
exportarcontratos.Enabled = True
informecontratos.Enabled = True
ElseIf num = 0 Then
primerocontratos.Enabled = False
atrascontratos.Enabled = False
siguientecontratos.Enabled = False
ultimocontratos.Enabled = False
exportarcontratos.Enabled = False
informecontratos.Enabled = False
End If
End Sub
Sub lcf()
On Error Resume Next
'desligar controles del registro general
Menu.general.Recordset.Close
Menu.general = Nothing
Set numfactura.DataSource = general.Recordset
Set direccion.DataSource = general.Recordset
Set telefonofactura.DataSource = general.Recordset
Set impob.DataSource = general.Recordset
Set impon.DataSource = general.Recordset
Set ivafactura.DataSource = general.Recordset
Set fecha.DataSource = general.Recordset
Set ciffactura.DataSource = general.Recordset
' limpia controles
numfactura.Text = ""
direccion.Text = ""
impob.Text = ""
impon.Text = ""
ivafactura.Text = ""
fecha.Text = ""
ciffactura.Text = ""
impototal.Text = ""
With regillafacturas
.Clear
.Refresh
.Redraw = True
End With
registro.Text = ""
de.Text = ""
End Sub
Sub lcc()
On Error Resume Next
Menu.general2.Recordset.Close
Menu.general2 = Nothing
Set fechaordencontrato.DataSource = general2.Recordset
Set numorden.DataSource = general2.Recordset
Set estadoorden.DataSource = general2.Recordset
Set insercionestotales.DataSource = general2.Recordset
Set insercionescreadas.DataSource = general2.Recordset
Set insercioneseditadas.DataSource = general2.Recordset
Set objetoinicio.DataSource = general2.Recordset
Set fechainicio.DataSource = general2.Recordset
Set ultimoobjeto.DataSource = general2.Recordset
Set ultimafecha.DataSource = general2.Recordset
Set codigodiseño.DataSource = general2.Recordset
Set tecladoorden.DataSource = general2.Recordset
Set ediciondeinicio.DataSource = general2.Recordset
Set proximaedicion.DataSource = general2.Recordset
Set ultimaedicion.DataSource = general2.Recordset
Set preciopublicado.DataSource = general2.Recordset
Set preciofacturado.DataSource = general2.Recordset
Set preciocontratado.DataSource = general2.Recordset
Set ultimafechacontrato.DataSource = general2.Recordset
Set ultimoobjetocontrato.DataSource = general2.Recordset
Set ultimaedicioncontrato.DataSource = general2.Recordset
fechaordencontrato.Text = ""
numorden.Text = ""
estadoorden.Text = ""
insercionestotales.Text = ""
insercionescreadas.Text = ""
insercioneseditadas.Text = ""
objetoinicio.Text = ""
fechainicio.Text = ""
ultimoobjeto.Text = ""
ultimafecha.Text = ""
codigodiseño.Text = ""
tecladoorden.Text = ""
ediciondeinicio.Text = ""
proximaedicion.Text = ""
ultimaedicion.Text = ""
preciopublicado.Text = ""
preciofacturado.Text = ""
preciocontratado.Text = ""
ultimafechacontrato.Text = ""
ultimoobjetocontrato.Text = ""
ultimaedicioncontrato.Text = ""
totalcontratado.Text = ""
With regillacontratos
.Clear
.Refresh
.Redraw = True
End With
registrocontrato.Text = ""
decontrato.Text = ""
End Sub
Function faÍndice(fila As Integer, col As Integer) As Long
faÍndice = fila * regillafacturas.Cols + col
End Function
Descargar