Sistema de Ventas Parte - Mantenimiento de Clientes - Proforma [Hervert Navarro Vela]

29
Ado .NET Proyecto : Sistema de Ventas Flujo de Formularios 1. Mantenimiento de Clientes Click en el botón : UserLinuxPlug – Hervert Navarro Vela - 17 - [email protected] 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 3

description

SISTEMA DE VENTAS

Transcript of Sistema de Ventas Parte - Mantenimiento de Clientes - Proforma [Hervert Navarro Vela]

Ado .NET

Proyecto : Sistema de Ventas

Flujo de Formularios

1. Mantenimiento de Clientes

Click en el botón :

UserLinuxPlug – Hervert Navarro Vela - 17 - [email protected]

1

123456

789

101112

1314

15

2

Ado .NET

Juridico :

UserLinuxPlug – Hervert Navarro Vela - 18 - [email protected]

3

17181920

21222324252627282930313233

4

Ado .NET

2. Proforma:

Enviar datos a proforma

Nuevo Cliente : Llama al mantenimiento de ClientesCliente Existente :

Nota : En todas las consultas la información se envía al hacer doble click en la fila del datagrid.

Codificación del Formulario Mantenimiento de Clientes

UserLinuxPlug – Hervert Navarro Vela - 19 - [email protected]

5

3435363738

3940414243

4445

464748495051525354

6

Ado .NET

Modulo : Variables.vb

Imports System.Data.SqlClientModule Variables Public cadsql$ Public estado% = 0 Public vima% = 0 Public i%, b%, f%, c%, cj%, pro%, ct%'son las variables para la matriz Public alfa% = 0 Public beta% = 0 Public remision% = 0 Public asa% = 0 Sub sololetras_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If e.KeyChar.IsLetter(e.KeyChar) Then e.Handled = False ElseIf e.KeyChar.IsControl(e.KeyChar) Then e.Handled = False ElseIf e.KeyChar.IsSeparator(e.KeyChar) Then e.Handled = False Else MsgBox("Solo letras") e.Handled = True End If End Sub

UserLinuxPlug – Hervert Navarro Vela - 20 - [email protected]

7

55565758596061626364656667686970717273747576777879808182

8

Ado .NET

Sub solonumeros_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If e.KeyChar.IsDigit(e.KeyChar) Then e.Handled = False ElseIf e.KeyChar.IsControl(e.KeyChar) Then e.Handled = False Else MsgBox("Solo Numeros") e.Handled = True End If End SubEnd Module

Formulario : MClientes.vb

Option Explicit OffImports LibreriaMantenimientoPublic Class MClientes

Dim clase As New ClaseMetodos

#Region "variables" Private estado% = 0 Public coddep$, codpro$, coddis$ Dim total%, pos% Dim cod$, apep$, apem$, nom$, dni$, email$, dir$, tel$, ob$, depa$, prov$, dist$ Dim cadsql$, tip$ Dim razon$, ruc$, conta$#End Region

#Region "Procedimientos" Sub mostrarprov(ByVal nomdep$) Me.cbprovincia.Items.Clear() clase.datos.Clear() clase.verdatos("select iddepartamento from departamentos where nomdepartamento='" & nomdep & "'") coddep = clase.datos.Tables("x").Rows(0).Item(0) clase.verdatos("select nomprovincia from provincias where iddepartamento='" & coddep & "'")

For p = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbprovincia.Items.Add(clase.datos.Tables("x").Rows(p).Item(0)) Next ' MsgBox(coddep) End Sub Sub mostrardist(ByVal nompro$) Me.cbdistrito.Items.Clear() clase.datos.Clear() clase.verdatos("select idprovincia from Provincias where

nomprovincia='" & nompro & "'") codpro = clase.datos.Tables("x").Rows(0).Item(0) clase.verdatos("select nomdistrito from Distritos where idprovincia='" & codpro & "'") For p = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbdistrito.Items.Add(clase.datos.Tables("x").Rows(p).Item(0)) NextEnd Sub

Sub llenarcombos()

UserLinuxPlug – Hervert Navarro Vela - 21 - [email protected]

9

838485868788899091929394

95

96979899100101

102103

104105106107108109110111112113

114115116117118119120121122123124125126127128129130131132133134135136137138139140141

142143

10

Ado .NET

Me.cbdepar.Items.Clear() Me.cbprovincia.Items.Clear() Me.cbdistrito.Items.Clear() clase.verdatos("select * from Departamentos ORDER BY NOMDEPARTAMENTO") For a = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbdepar.Items.Add(clase.datos.Tables("x").Rows(a).Item(1)) Nextclase.verdatos("select * from provincias ORDER BY NOMPROVINCIA") For a = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbprovincia.Items.Add(clase.datos.Tables("x").Rows(a).Item(1)) Next clase.verdatos("select * from distritos ORDER BY NOMDISTRITO ") For a = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbdistrito.Items.Add(clase.datos.Tables("x").Rows(a).Item(1)) Next End Sub

Sub LIMPIARTEXTOS() For Each o In Me.GroupBox2.Controls If TypeOf o Is TextBox Then o.clear() End If Next Me.txtdir.Text = "" Me.cbdepar.Text = "" Me.cbprovincia.Text = "" Me.cbdistrito.Text = "" End Sub Sub autogenera() Dim ncliente$ clase.datos.Clear() clase.verdatos("Select * from Clientes") ncliente = clase.datos.Tables("x").Rows.Count + 1 Me.txtCodigo.Text = Mid("C0000", 1, 6 - Len(Str(ncliente))) & (ncliente + 1).ToString Me.txtapp.Focus() End Sub Sub Ver() If total = 0 Then MsgBox("Tabla Vacia", MsgBoxStyle.Information) OCULTARBOTONES(False) DESACTIVARBOTONES(False) Else With clase.datos.Tables("x").Rows(pos) Me.txtCodigo.Text = .Item(0) Me.txttipo.Text = .Item(1) Me.txtapp.Text = .Item(2) Me.txtapm.Text = .Item(3) Me.txtnom.Text = .Item(4) Me.txtdni.Text = .Item(5) Me.txtdir.Text = .Item(6) Me.txttel.Text = .Item(7) Me.txtob.Text = .Item(8) Me.txtemail.Text = .Item(9) Me.cbdepar.Text = .Item(10) Me.cbprovincia.Text = .Item(11) Me.cbdistrito.Text = .Item(12) End With Me.btnmensaje.Text = "Registro...>" + (pos + 1).ToString + Space(2) + "de..>" + Space(2) + total.ToString

UserLinuxPlug – Hervert Navarro Vela - 22 - [email protected]

11

144145146147148149150151152153154155156157158159160

161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204

12

Ado .NET

End If End Sub Sub OCULTARBOTONES(ByVal valor As Boolean) For Each o In Me.GroupBox6.Controls If TypeOf o Is Button Then o.enabled = valor End If Next End Sub Sub DESACTIVARBOTONES(ByVal valor As Boolean) For Each o In Me.Controls If TypeOf o Is Button Then If o.name = "nuevo" Or o.name = "actualiza" Then o.enabled = Not valor Else o.enabled = valor End If End If Next End Sub Sub ACTUALIZAR() clase.datos.Clear() clase.verdatos("SELECT dbo.clientes.idcliente, dbo.clientes.idtipo, dbo.clientes.apematerno, dbo.clientes.apepaterno, dbo.clientes.nombres, dbo.clientes.dni," & _" dbo.clientes.direccion, dbo.clientes.telefono, dbo.clientes.observaciones, dbo.clientes.email, dbo.departamentos.nomdepartamento, " & _" dbo.provincias.nomprovincia, dbo.distritos.nomdistrito" & _" FROM dbo.clientes INNER JOIN" & _" dbo.departamentos ON dbo.clientes.Iddepartamento = dbo.departamentos.Iddepartamento INNER JOIN" & _" dbo.provincias ON dbo.clientes.idprovincia = dbo.provincias.idprovincia AND " & _" dbo.departamentos.Iddepartamento = dbo.provincias.Iddepartamento INNER JOIN" & _" dbo.distritos ON dbo.clientes.iddistrito = dbo.distritos.iddistrito AND dbo.provincias.idprovincia = dbo.distritos.idprovincia" & _" where dbo.clientes.idtipo='T1'") total = clase.datos.Tables("x").Rows.Count pos = 0 Ver() End Sub#End Region

#Region "Procedimiento2" Sub ACTUALIZAR2() clase.datos.Clear() clase.verdatos(" SELECT dbo.clientes.idcliente, dbo.clientes.idtipo, dbo.departamentos.nomdepartamento, dbo.provincias.nomprovincia, dbo.distritos.nomdistrito, " & _" dbo.clientes.razonsocial, dbo.clientes.contacto, dbo.clientes.ruc, dbo.clientes.observaciones, dbo.clientes.direccion" & _" FROM dbo.clientes INNER JOIN" & _" dbo.departamentos ON dbo.clientes.Iddepartamento = dbo.departamentos.Iddepartamento INNER JOIN" & _" dbo.provincias ON dbo.clientes.idprovincia = dbo.provincias.idprovincia AND " & _" dbo.departamentos.Iddepartamento = dbo.provincias.Iddepartamento INNER JOIN" & _

UserLinuxPlug – Hervert Navarro Vela - 23 - [email protected]

13

205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248

249250251252253254255256257258259260261262263264

14

Ado .NET

" dbo.distritos ON dbo.clientes.iddistrito = dbo.distritos.iddistrito AND dbo.provincias.idprovincia = dbo.distritos.idprovincia where dbo.clientes.idtipo='T2'") total = clase.datos.Tables("x").Rows.Count pos = 0 Ver2() End Sub Sub Ver2() If total = 0 Then MsgBox("Tabla Vacia", MsgBoxStyle.Information) OCULTARBOTONES(False) DESACTIVARBOTONES(False) Else With clase.datos.Tables("x").Rows(pos) Me.txtCodigo.Text = .Item(0) Me.txttipo.Text = .Item(1) Me.txtrazon.Text = .Item(5) Me.txtconta.Text = .Item(6) Me.txtruc.Text = .Item(7) Me.txtdir.Text = .Item(9) Me.txtob.Text = .Item(8) Me.cbdepar.Text = .Item(2) Me.cbprovincia.Text = .Item(3) Me.cbdistrito.Text = .Item(4) End With Me.btnmensaje.Text = "Registro...>" + (pos + 1).ToString + Space(2) + "de..>" + Space(2) + total.ToString End If End Sub Dim o As New Object Sub LIMPIARTEXTOS2() For Each o In Me.GroupBox3.Controls If TypeOf o Is TextBox Then o.clear() End If Next Me.txtdir.Text = "" Me.cbdepar.Text = "" Me.cbprovincia.Text = "" Me.cbdistrito.Text = "" End Sub#End Region Private Sub MClientes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Height = 112 clase.conectar("(local)", "sisventas_HNV", "sa", "123") End Sub

Private Sub cbdepar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbdepar.SelectedIndexChanged If estado = 0 Then mostrarprov(Me.cbdepar.Text) End If End Sub

Private Sub cbprovincia_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbprovincia.SelectedIndexChanged If estado = 0 Then mostrardist(Me.cbprovincia.Text)

UserLinuxPlug – Hervert Navarro Vela - 24 - [email protected]

15

265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311

312313314315316317318319

320321322323324325

16

Ado .NET

End If End Sub Private Sub cbdistrito_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbdistrito.SelectedIndexChanged If estado = 0 Then clase.datos.Clear() clase.verdatos("select * from Distritos where idprovincia='" & codpro & "' and nomdistrito='" & Me.cbdistrito.Text & "'")

coddis = clase.datos.Tables("x").Rows(0).Item(0) End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles siguiente.Click If Me.tipo.Text = "Natural" Then If pos < clase.datos.Tables("x").Rows.Count - 1 Then pos += 1 Ver() Else MsgBox("Final") End If ElseIf Me.tipo.Text = "Juridico" Then If pos < clase.datos.Tables("x").Rows.Count - 1 Then pos += 1 Ver2() Else MsgBox("Final") End If End If End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles primero.Click If Me.tipo.Text = "Natural" Then pos = 0 Ver() ElseIf Me.tipo.Text = "Juridico" Then pos = 0 Ver2() End If End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ultimo.Click If Me.tipo.Text = "Natural" Then pos = clase.datos.Tables("x").Rows.Count - 1 Ver() ElseIf Me.tipo.Text = "Juridico" Then pos = clase.datos.Tables("x").Rows.Count - 1 Ver2() End If End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles anterior.Click If Me.tipo.Text = "Natural" Then If pos > 0 Then pos -= 1 Ver()

UserLinuxPlug – Hervert Navarro Vela - 25 - [email protected]

17

326327328329330331332333334335

336337338339340341342343344345346347348349350351352353354355356357

358359360361362363364365366367368

369370371372373374375376377378379

380381382383384385386

18

Ado .NET

Else MsgBox("Inicio") End If ElseIf Me.tipo.Text = "Juridico" Then If pos > 0 Then pos -= 1 Ver2() Else MsgBox("Inicio") End If End If End Sub

Private Sub tipo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tipo.SelectedIndexChanged If Me.tipo.Text = "Natural" Then Me.GroupBox2.Visible = True Me.GroupBox3.Visible = False clase.verdatos("SELECT dbo.clientes.idcliente, dbo.clientes.idtipo, dbo.clientes.apematerno, dbo.clientes.apepaterno, dbo.clientes.nombres, dbo.clientes.dni," & _" dbo.clientes.direccion, dbo.clientes.telefono, dbo.clientes.observaciones, dbo.clientes.email, dbo.departamentos.nomdepartamento, " & _" dbo.provincias.nomprovincia, dbo.distritos.nomdistrito" & _" FROM dbo.clientes INNER JOIN" & _" dbo.departamentos ON dbo.clientes.Iddepartamento = dbo.departamentos.Iddepartamento INNER JOIN" & _" dbo.provincias ON dbo.clientes.idprovincia = dbo.provincias.idprovincia AND " & _" dbo.departamentos.Iddepartamento = dbo.provincias.Iddepartamento INNER JOIN" & _" dbo.distritos ON dbo.clientes.iddistrito = dbo.distritos.iddistrito AND dbo.provincias.idprovincia = dbo.distritos.idprovincia" & _" where dbo.clientes.idtipo='T1'")ACTUALIZAR()Me.Height = 496

ElseIf Me.tipo.Text = "Juridico" Then Me.GroupBox2.Visible = False Me.GroupBox3.Visible = True clase.verdatos("SELECT dbo.clientes.idcliente, " & _ "dbo.clientes.idtipo, dbo.departamentos.nomdepartamento, " & _ "dbo.provincias.nomprovincia, dbo.distritos.nomdistrito, " & _ " dbo.clientes.razonsocial, dbo.clientes.contacto, " & _ "dbo.clientes.ruc, dbo.clientes.observaciones" & _ " FROM dbo.clientes INNER JOIN" & _ " dbo.departamentos ON " & _ " dbo.clientes.Iddepartamento = dbo.departamentos.Iddepartamento " & _ " INNER JOIN" & _ " dbo.provincias ON " & _ " dbo.clientes.idprovincia = dbo.provincias.idprovincia AND " & _ " dbo.departamentos.Iddepartamento = dbo.provincias.Iddepartamento " & _ " INNER JOIN dbo.distritos ON " & _ " dbo.clientes.iddistrito = dbo.distritos.iddistrito AND " & _ " dbo.provincias.idprovincia = dbo.distritos.idprovincia" & _ " where dbo.clientes.idtipo='T2'") ACTUALIZAR2()

UserLinuxPlug – Hervert Navarro Vela - 26 - [email protected]

19

387388389390391392393394395396397398

399400401402403404405406407408409410411412413414415416417418419420421422423424

425426427428429430431432433434435436437438439440441442443444445446447

20

Ado .NET

Me.Height = 496 End If End Sub Private Sub nuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nuevo.Click If Me.tipo.Text = "Natural" Then If nuevo.Text = "Nuevo" Then estado = 0 LIMPIARTEXTOS() If Me.tipo.Text = "Natural" Then Me.txttipo.Text = "T1" Else Me.txttipo.Text = "T2" End If llenarcombos() autogenera() Me.txtapp.Focus() OCULTARBOTONES(False) Me.btnmensaje.Text = "Ingrese Registro" DESACTIVARBOTONES(False) Me.nuevo.Text = "Grabar" Me.nuevo.ImageIndex = 7 Me.actualiza.Text = "Cancelar" Me.actualiza.ImageIndex = 8 Else 'datos.Clear() cod = Me.txtCodigo.Text apep = Me.txtapp.Text apem = Me.txtapm.Text nom = Me.txtnom.Text dni = Me.txtdni.Text email = Me.txtemail.Text dir = Me.txtdir.Text tel = Me.txttel.Text ob = Me.txtob.Text depa = Me.cbdepar.Text prov = Me.cbprovincia.Text dist = Me.cbdistrito.Text tip = Me.txttipo.Text cadsql = "insert into clientes values ('" & cod & "','" & tip & "','" & razon & "','" & apep & "','" & apem & "','" & nom & "','" & dni & "','" & conta & "','" & ruc & "','" & dir & "','" & coddep & "','" & codpro & "','" & coddis & "','" & tel & "','" & email & "','" & ob & "')" clase.ejecutarsql(cadsql) estado = 1 ACTUALIZAR() MsgBox("Registro Insertado") OCULTARBOTONES(True) DESACTIVARBOTONES(True) Me.nuevo.Enabled = True Me.actualiza.Enabled = True Me.nuevo.Text = "Nuevo" Me.nuevo.ImageIndex = 0 Me.actualiza.Text = "Actualizar" Me.actualiza.ImageIndex = 1 End If ElseIf Me.tipo.Text = "Juridico" Then If nuevo.Text = "Nuevo" Then estado = 0

UserLinuxPlug – Hervert Navarro Vela - 27 - [email protected]

21

448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508

22

Ado .NET

LIMPIARTEXTOS2() If Me.tipo.Text = "Natural" Then Me.txttipo.Text = "T1" Else Me.txttipo.Text = "T2" End If llenarcombos() autogenera() Me.txtapp.Focus() OCULTARBOTONES(False) Me.btnmensaje.Text = "Ingrese Registro" DESACTIVARBOTONES(False) Me.nuevo.Text = "Grabar" Me.nuevo.ImageIndex = 7 Me.actualiza.Text = "Cancelar" Me.actualiza.ImageIndex = 8 Else 'datos.Clear() cod = Me.txtCodigo.Text razon = Me.txtrazon.Text conta = Me.txtconta.Text ruc = Me.txtruc.Text ob = Me.txtob.Text depa = Me.cbdepar.Text dir = Me.txtdir.Text prov = Me.cbprovincia.Text dist = Me.cbdistrito.Text tip = Me.txttipo.Text '''''''' apep = "-" : apem = "-" nom = "-" : dni = "-" email = "-" : tel = "-" ''''''''' cadsql = "insert into clientes values ('" & cod & "','" & tip & "','" & razon & "','" & apep & "','" & apem & "','" & nom & "','" & dni & "','" & conta & "','" & ruc & "','" & dir & "','" & coddep & "','" & codpro & "','" & coddis & "','" & tel & "','" & email & "','" & ob & "')" clase.ejecutarsql(cadsql) estado = 1 ACTUALIZAR2() MsgBox("Registro Insertado") OCULTARBOTONES(True) DESACTIVARBOTONES(True) Me.nuevo.Enabled = True Me.actualiza.Enabled = True Me.nuevo.Text = "Nuevo" Me.nuevo.ImageIndex = 0 Me.actualiza.Text = "Actualizar" Me.actualiza.ImageIndex = 1 End If End If End Sub

Private Sub actualiza_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles actualiza.Click If Me.tipo.Text = "Natural" Then If Me.actualiza.Text = "Actualizar" Then If (MsgBox("esta seguro de editar", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Aviso") = MsgBoxResult.Yes) Then cod = Me.txtCodigo.Text

UserLinuxPlug – Hervert Navarro Vela - 28 - [email protected]

23

509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561

562563564565566567568569

24

Ado .NET

apep = Me.txtapp.Text apem = Me.txtapm.Text nom = Me.txtnom.Text dni = Me.txtdni.Text email = Me.txtemail.Text dir = Me.txtdir.Text tel = Me.txttel.Text ob = Me.txtob.Text depa = Me.cbdepar.Text prov = Me.cbprovincia.Text dist = Me.cbdistrito.Text tip = Me.txttipo.Text mostrardist(Me.cbprovincia.Text) mostrarprov(Me.cbdepar.Text)

clase.verdatos("select iddistrito from Distritos where idprovincia='" & codpro & "'")

Dim p% For p = 0 To clase.datos.Tables("x").Rows.Count - 1 coddis = clase.datos.Tables("x").Rows(p).Item(0) Next

cadsql = "update clientes set idtipo='" & tip & "',razonsocial='" & razon & "',apepaterno='" & apep & "',apematerno='" & apem & "',nombres='" & nom & "',dni='" & dni & "',contacto='" & conta & "',ruc='" & ruc & "',direccion='" & dir & "',iddepartamento='" & coddep & "',idprovincia='" & codpro & "',iddistrito='" & coddis & "',telefono='" & tel & "',email='" & email & "',observaciones='" & ob & "' where idcliente='" & cod & "'"

clase.ejecutarsql(cadsql) estado = 1 ACTUALIZAR() MsgBox("registro Aditado", MsgBoxStyle.Information, "Actualizado") Else MsgBox("Edicion Anulada", MsgBoxStyle.Critical, "Anulado") ACTUALIZAR() End If Else MsgBox("Inserccion Anulada", MsgBoxStyle.Critical, "Anulada") estado = 1 Me.actualiza.Text = "Actualizar" Me.actualiza.ImageIndex = 3 Me.nuevo.Text = "Nuevo" Me.nuevo.ImageIndex = 0 OCULTARBOTONES(True) DESACTIVARBOTONES(True) Me.nuevo.Enabled = True Me.actualiza.Enabled = True ACTUALIZAR() End If ElseIf Me.tipo.Text = "Juridico" Then If Me.actualiza.Text = "Actualizar" Then If (MsgBox("esta seguro de editar",

MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Aviso") = MsgBoxResult.Yes) Then

cod = Me.txtCodigo.Text razon = Me.txtrazon.Text conta = Me.txtconta.Text ruc = Me.txtruc.Text ob = Me.txtob.Text dir = Me.txtdir.Text

UserLinuxPlug – Hervert Navarro Vela - 29 - [email protected]

25

570571572573574575576577578579580581582583584585586587588589

590591592593594595596597

598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630

26

Ado .NET

depa = Me.cbdepar.Text prov = Me.cbprovincia.Text dist = Me.cbdistrito.Text tip = Me.txttipo.Text mostrardist(Me.cbprovincia.Text) mostrarprov(Me.cbdepar.Text) clase.verdatos("select iddistrito from Distritos where idprovincia='" & codpro & "'") Dim p% For p = 0 To clase.datos.Tables("x").Rows.Count - 1 coddis = clase.datos.Tables("x").Rows(p).Item(0) Next

cadsql = "update clientes set idtipo='" & tip & "',razonsocial='" & razon & "',apepaterno='" & apep & "',apematerno='" & apem & "',nombres='" & nom & "',dni='" & dni & "',contacto='" & conta & "',ruc='" & ruc & "',direccion='" & dir & "',iddepartamento='" & coddep & "',idprovincia='" & codpro & "',iddistrito='" & coddis & "',telefono='" & tel & "',email='" & email & "',observaciones='" & ob & "' where idcliente='" & cod & "'" clase.ejecutarsql(cadsql) estado = 1 ACTUALIZAR2()MsgBox("registro Aditado", MsgBoxStyle.Information, "Actualizado") ElseMsgBox("Edicion Anulada", MsgBoxStyle.Critical, "Anulado") ACTUALIZAR2() End If ElseMsgBox("Inserccion Anulada", MsgBoxStyle.Critical, "Anulada") estado = 1 Me.actualiza.Text = "Cancelar" Me.actualiza.ImageIndex = 3 Me.nuevo.Text = "Nuevo" Me.nuevo.ImageIndex = 0 OCULTARBOTONES(True) DESACTIVARBOTONES(True) Me.nuevo.Enabled = True Me.actualiza.Enabled = True ACTUALIZAR2() End If End If End Sub

Private Sub eliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles eliminar.Click If Me.tipo.Text = "Natural" Then If MsgBox("esta seguro ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Aviso") = MsgBoxResult.Yes Then cod = Me.txtCodigo.Text cadsql = "delete from clientes where idcliente='" & cod & "'" clase.ejecutarsql(cadsql) MsgBox("Registro eliminado", MsgBoxStyle.Exclamation, "Eliminado") ACTUALIZAR() End If ElseIf Me.tipo.Text = "Juridico" Then If MsgBox("esta seguro ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Aviso") = MsgBoxResult.Yes Then cod = Me.txtCodigo.Text

UserLinuxPlug – Hervert Navarro Vela - 30 - [email protected]

27

631632633634635636637638639640641642

643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673

674675676677678679680681682683684685686687688689690691

28

Ado .NET

cadsql = "delete from clientes where idcliente='" & cod & "'" clase.ejecutarsql(cadsql) MsgBox("Registro eliminado", MsgBoxStyle.Exclamation, "Eliminado") ACTUALIZAR2() End If End If End Sub

Private Sub consultar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles consultar.Click Dim ce As New Cons_Clientes ce.ShowDialog() End Sub Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Timer1.Enabled = True End Sub Dim pro As New Proforma Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked cod = Me.txtCodigo.Text apep = Me.txtapp.Text apem = Me.txtapm.Text nom = Me.txtnom.Text dni = Me.txtdni.Text email = Me.txtemail.Text dir = Me.txtdir.Text tel = Me.txttel.Text ob = Me.txtob.Text depa = Me.cbdepar.Text prov = Me.cbprovincia.Text dist = Me.cbdistrito.Text tip = Me.txttipo.Text matriz(asa, 0) = cod pro.txtnombres.Text = nom + " " + apep + " " + apem pro.txtdireccion.Text = dir pro.txttelefono.Text = tel Me.Hide() pro.ShowDialog()

End Sub Dim cont% = 0, t% Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If cont = 0 Then t += 1 Me.Opacity = t / 100 If t = 100 Then Me.Timer1.Enabled = False cont = 1 End If Else t -= 1 Me.Opacity = t / 100 If t = 1 Then Me.Close() End If End If

UserLinuxPlug – Hervert Navarro Vela - 31 - [email protected]

29

692693694695696697698699700

701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733

734735736737738739740741742743744745746747748749750751752

30

Ado .NET

End Sub '----Validar Private Sub txtdni_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtdni.KeyPress solonumeros_KeyPress(Me, e) End Sub Private Sub txtapp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtapp.KeyPress sololetras_KeyPress(Me, e) End Sub Private Sub txtapm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtapm.KeyPress sololetras_KeyPress(Me, e) End Sub Private Sub txtnom_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnom.KeyPress sololetras_KeyPress(Me, e) End Sub Private Sub txttel_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txttel.KeyPress solonumeros_KeyPress(Me, e) End Sub

Private Sub txtruc_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtruc.KeyPress solonumeros_KeyPress(Me, e) End SubEnd Class

UserLinuxPlug – Hervert Navarro Vela - 32 - [email protected]

31

753754755756757758759760761762763764765766767768769770771772773774

775776777778779780

781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812

32

Ado .NET

Codificación del Formulario Proforma

[proforma.vb]

1. Declarar las siguientes variables en el módulo :

'------------------------------ Public nombresclientes$ Public estadoproforma% = 0 Public codclientep$ Public tipoclientep$ Public codigotipo$

'------------------------------------

2. Cambiar la codificación del link Enviar datos a proforma del formulario MClientes.vb.

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

cod = Me.txtCodigo.Text apep = Me.txtapp.Text apem = Me.txtapm.Text nom = Me.txtnom.Text dir = Me.txtdir.Text tel = Me.txttel.Text estadoproforma = 1 pro.tbdireccion.Text = dir pro.tbtelefono.Text = tel codclientep = cod tipoclientep = Me.tipo.Text.Trim If tipoclientep = "Natural" Then codigotipo = "T1" pro.tbnombres.Text = nom + " " + apep + " " + apem Else codigotipo = "T2" pro.tbnombres.Text = Me.txtrazon.Text End If Me.Hide() pro.ShowDialog()

End Sub

3. Crear el formulario proforma .vb.

UserLinuxPlug – Hervert Navarro Vela - 33 - [email protected]

33

813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870

34

Ado .NET

4. Codificar el formulario proforma.vb

Option Explicit OffImports LibreriaMantenimientoImports System.Data.SqlClient

Public Class Proforma

'--------------------------------------------------------------------- Private tabla As New DataTable Private subtotal%, igv%, total%, dsto%, dst%, pn% Private ig%, tl%, treg%, l%, q%, pos% Private cod$, nom$, ape$, ama$, raz$, dir$, ruc$, dni$ Private tipo$, tel$, ema$, obs$, contac$ Private pos2% = -1 Private npro$, nreg1$ Dim clase As New ClaseMetodos Private fecha As Date '-----------------------------------------------------------------------

UserLinuxPlug – Hervert Navarro Vela - 34 - [email protected]

35

871872873874875876877878879880881882883884885886887888889890891

893894895896897898899900901902903904905906907908909

910911912913914915916917918919920921

36

Ado .NET

Function generarcodigo() As String clase.verdatos("select * from proforma") Dim nreg1% = clase.datos.Tables("x").Rows.Count Return Mid("P000000", 1, 8 - Len(Str(nreg1))) + Trim(Str(nreg1 + 1)) End Function

Private Sub Proforma_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load clase.conectar("(local)", "sisventas_HNV", "", "") Bloquea(True) Me.Label23.Text = ususistema tabla.Columns.Add("Item") tabla.Columns.Add("cantidad") tabla.Columns.Add("Descripcion") tabla.Columns.Add("P. Unit") tabla.Columns.Add("Dsto") tabla.Columns.Add("Importe") 'Me.Label23.Text = ususistema fecha = CDate(Mid(Me.DateTimePicker1.Value, 1, 10)) Me.DataGrid1.CaptionText = "Detalle de Productos" Me.DataGrid1.DataSource = tabla Me.StatusBar1.Text = Now() ''''' Me.cbproducto.Items.Clear() clase.verdatos("select * from Producto") For p = 0 To clase.datos.Tables("x").Rows.Count - 1 Me.cbproducto.Items.Add(clase.datos.Tables("x").Rows(p).Item(2)) Next End Sub Dim o As New Object Sub Bloquea(ByVal valor As Boolean) For Each o In Me.GroupBox2.Controls If TypeOf o Is TextBox Then o.readonly = valor End If Next For Each o In Me.GroupBox4.Controls If TypeOf o Is TextBox Then o.readonly = valor End If Next Me.DateTimePicker1.Enabled = Not valor Me.DataGrid1.Enabled = Not valor Me.DataGrid1.ReadOnly = True Me.cbproducto.Enabled = Not valor End Sub Sub desactivarbotones(ByVal valor As Boolean) For x = 0 To Me.ToolBar1.Buttons.Count - 1 If x = 4 Or x = 5 Then Me.ToolBar1.Buttons(x).enabled = Not valor Else Me.ToolBar1.Buttons(x).enabled = valor End If Next End Sub Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick Select Case Me.ToolBar1.Buttons.IndexOf(e.Button) Case 0 'nuevo pos = 0 Dim f As New Formu_tipoCliente f.ShowDialog() Case 1 'buscar Dim bp As New Cons_Proforma bp.ShowDialog() Case 2 'eliminar Try 'eliminado detalle boleta Dim cmdeliminadetalleproforma As New SqlCommand(elimina_detaproforma, clase.con) cmdeliminadetalleproforma.CommandType = CommandType.StoredProcedure Dim elidetpro As Object = New SqlParameter("@cdp", Me.lblnroproforma.Text) cmdeliminadetalleproforma.Parameters.Add(elidetpro) cmdeliminadetalleproforma.ExecuteNonQuery() : cmdeliminadetalleproforma.Dispose()

UserLinuxPlug – Hervert Navarro Vela - 35 - [email protected]

37

922923924925926

927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996

38

Ado .NET

'eliminando boleta Dim cmdeliminaboleta As New SqlCommand(elimina_proforma, clase.con) cmdeliminaboleta.CommandType = CommandType.StoredProcedure Dim elipro As Object = New SqlParameter("@cp", Me.lblnroproforma.Text) cmdeliminaboleta.Parameters.Add(elipro) cmdeliminaboleta.ExecuteNonQuery() : cmdeliminaboleta.Dispose() Catch ex As Exception MsgBox(ex.Message.ToString) End Try Case 3 'reportar Dim rp As New Reporte rp.ShowDialog() Case 6 'salir Me.Hide() Case 4 'Grabar '********************************* usua = Trim(Me.Label23.Text) dst = CInt(Trim(Me.TextBox9.Text)) 'descuento pn = CInt(Trim(Me.TextBox8.Text)) ' pago neto ig = CInt(Trim(Me.TextBox11.Text)) 'igv 'dir = Trim(Me.txtdireccion.Text) 'direccion tl = CInt(Trim(Me.TextBox7.Text)) 'total usua = "hnv" '************Varaible Global*********************** If tipoclientep = "Natural" Then Try npro = generarcodigo() Me.lblnroproforma.Text = npro 'numero factura

cadsql = "insert into proforma values('" & npro & "','" & codclientep & "','" & fecha & "','" & usua & "','" & tl & "')"

clase.ejecutarsql(cadsql) Dim y% For y = 0 To Me.DataGrid1.VisibleRowCount - 1 clase.datos.Clear() clase.verdatos("select * from producto") Dim codproducto$ clase.verdatos("select * from producto where nombreprod='" &

Me.DataGrid1.Item(y, 2) & "'") codproducto = clase.datos.Tables("x").Rows(0).Item(0) Dim ivgp%, tlp% igvp = (Val(Me.DataGrid1.Item(y, 1)) * Val(Me.DataGrid1.Item(y, 3))) –

Val(Me.DataGrid1.Item(y, 4)) tlp = igvp cadsql = "insert into detaproforma values('" & npro & "','" & codproducto & "','" &

Val(Me.DataGrid1.Item(y, 1)) & "','" & Val(Me.DataGrid1.Item(y, 4)) & "','" & Val(Me.DataGrid1.Item(y, 5)) & "','" & igvp & "','" & "" & "')"

clase.ejecutarsql(cadsql) Next MsgBox("Proforma Grabada Correctamente - Cliente Natural") Catch ex As Exception 'MsgBox(ex.Message.ToString) End Try Else Try npro = generarcodigo() Me.lblnroproforma.Text = npro 'numero factura cadsql = "insert into proforma values('" & npro & "','" & codclientep & "','" & fecha & "','"

& usua & "','" & tl & "')" clase.ejecutarsql(cadsql) Dim y% For y = 0 To Me.DataGrid1.VisibleRowCount - 1 clase.datos.Clear() clase.verdatos("select * from producto") Dim codproducto$ clase.verdatos("select * from producto where nombreprod='" &

Me.DataGrid1.Item(y, 2) & "'") codproducto = clase.datos.Tables("x").Rows(0).Item(0) cadsql = "insert into detaproforma values('" & npro & "','" & codproducto & "','" & Val(Me.DataGrid1.Item(y, 1)) & "','" & Val(Me.DataGrid1.Item(y, 4)) & "','" &

Val(Me.DataGrid1.Item(y, 5)) & "','" & igvp & "','" & "" & "')" clase.ejecutarsql(cadsql) Next MsgBox("Proforma Grabada Correctamente - Cliente Juridico")

UserLinuxPlug – Hervert Navarro Vela - 36 - [email protected]

39

997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071

40

Ado .NET

Catch ex As Exception 'MsgBox(ex.Message.ToString) End Try desactivarbotones(True) End If estadoproforma = 0 tabla.Clear() Bloquea(True) nuevo() desactivarbotones(True)

Case 5 'Cancelar tabla.Clear() Bloquea(True) MsgBox("Inserción anulada") nuevo() desactivarbotones(True) estadoproforma = 0 End Select End Sub Sub nuevo() For Each o In Me.GroupBox2.Controls If TypeOf o Is TextBox Then o.clear() End If Next For Each o In Me.GroupBox5.Controls If TypeOf o Is TextBox Then o.clear() End If Next For Each o In Me.GroupBox4.Controls If TypeOf o Is TextBox Then o.clear() End If Next Me.cbproducto.Text = "" Me.tbnombres.Focus() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.StatusBar1.Text = Now() End Sub Sub calcular() subtotal += Val(Me.tbprecio.Text) * Val(Me.tbcantidad.Text) igv = subtotal * 0.19 total = subtotal + igv Me.TextBox9.Text = dsto Me.TextBox8.Text = subtotal Me.TextBox11.Text = igv Me.TextBox7.Text = total End Sub Private Sub TextBox5_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbcantidad.KeyDown If e.KeyCode = Keys.Enter Then

If pos < 50 Then Dim posexiste% = -1 With Me.DataGrid1 For x = 0 To .VisibleRowCount - 1 If Me.cbproducto.Text.Trim = .Item(x, 2) Then posexiste = x End If Next End With If posexiste = -1 Then Me.BindingContext(tabla).AddNew() With Me.DataGrid1 .Item(pos, 0) = (pos + 1).ToString .Item(pos, 1) = Me.tbcantidad.Text .Item(pos, 2) = Me.cbproducto.Text .Item(pos, 3) = Me.tbprecio.Text .Item(pos, 4) = Me.tbdescuento.Text .Item(pos, 5) = Val(tbprecio.Text) * Val(tbcantidad.Text) - Val(tbdescuento.Text)

UserLinuxPlug – Hervert Navarro Vela - 37 - [email protected]

41

1072107310741075107610771078107910801081

108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126

11271128112911301131113211331134113511361137113811391140114111421143114411451146

42

Ado .NET

End With dsto += Val(tbdescuento.Text) calcular() pos += 1 Else Me.DataGrid1.Item(posexiste, 1) = Str(Val(Me.DataGrid1.Item(posexiste, 1)) + Val(Me.tbcantidad.Text)) Me.DataGrid1.Item(posexiste, 5) = Val(Me.DataGrid1.Item(posexiste, 1)) * Val(Me.DataGrid1.Item(posexiste, 3)) - Val(Me.tbdescuento.Text) calcular() End If Else MsgBox("No + Productos") End If End If End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbproducto.SelectedIndexChanged clase.verdatos("select * from producto") Me.tbprecio.Text = clase.datos.Tables("x").Rows(Me.cbproducto.SelectedIndex).Item(3) Me.tbdescuento.Text = clase.datos.Tables("x").Rows(Me.cbproducto.SelectedIndex).Item(4) Me.tbcantidad.ReadOnly = False Me.tbcantidad.BackColor = Color.Red Me.tbcantidad.Clear() : Me.tbcantidad.Focus() End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.DoubleClick pos2 = Me.DataGrid1.CurrentRowIndex End Sub

Private Sub DateTimePicker1_CloseUp(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.CloseUp fecha = CDate(Mid(Me.DateTimePicker1.Value, 1, 10)) End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim mc As New MClientes mc.Show() End Sub Private Sub Proforma_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated If estadoproforma = 1 Then desactivarbotones(False) Me.cbproducto.Enabled = True Me.lblnroproforma.Text = generarcodigo() ElseIf estadoproforma = 2 Then Me.tbnombres.Text = nombresclientes ElseIf codigotipo <> "" Then Me.lblnroproforma.Text = generarcodigo() Bloquea(False) nuevo() desactivarbotones(False) End If End Sub Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click Dim mc As New MClientes mc.ShowDialog() End Sub Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click Dim cn As New Cons_Pro_Clientes cn.ShowDialog() End Sub

End Class5. Crear el formulario formuTipoCliente.vb.

UserLinuxPlug – Hervert Navarro Vela - 38 - [email protected]

43

1147114811491150115111521153115411551156115711581159116011611162

11631164116511661167116811691170117111721173

11741175117611771178

11791180118111821183

118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213

12141215

12161217121812191220

44

Ado .NET

Public Class Formu_tipoCliente

Dim cont% Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick cont += 1 If cont <= 10 Then Me.Button1.Visible = Not Me.Button1.Visible Else Me.Timer1.Enabled = False Me.Close() End If End Sub

Private Sub RadioButton1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Me.Timer1.Enabled = True codigotipo = "T1" tipoclientep = "Natural" End Sub

Private Sub RadioButton2_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged Me.Button1.ImageIndex = 1 Me.Timer1.Enabled = True codigotipo = "T2" tipoclientep = "Juridico" End Sub

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Me.Close() End SubEnd Class

6. Crear el formulario cons_Pro_Clientes.vb.

Imports LibreriaMantenimientoPublic Class Cons_Pro_Clientes

Private vista As New DataViewDim clase As New ClaseMetodos Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click Me.Hide() End Sub

UserLinuxPlug – Hervert Navarro Vela - 39 - [email protected]

45

122112221223122412251226

122712281229123012311232123312341235123612371238

1239124012411242124312441245

12461247124812491250125112521253

125412551256125712581259

1260126112621263126412651266126712681269127012711272127312741275127612771278127912801281

1282128312841285128612871288

1289

46

Ado .NET

Private Sub Cons_Pro_Clientes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load clase.conectar("(local)", "sisventas_HNV", "", "") : Me.Height = 88 clase.verdatos("SELECT dbo.clientes.idcliente, dbo.clientes.razonsocial, " & _ "dbo.clientes.apematerno, dbo.clientes.apepaterno, " & _ "dbo.clientes.nombres, dbo.clientes.dni, dbo.clientes.contacto, " & _ "dbo.clientes.ruc, dbo.clientes.direccion, dbo.clientes.telefono, " & _ "dbo.distritos.nomdistrito, dbo.provincias.nomprovincia, " & _ "dbo.departamentos.nomdepartamento, dbo.clientes.email, " & _ "dbo.clientes.observaciones fROM dbo.clientes INNER JOIN " & _ "dbo.departamentos ON dbo.clientes.Iddepartamento = dbo.departamentos.Iddepartamento " & _ "INNER JOIN dbo.distritos ON dbo.clientes.iddistrito = dbo.distritos.iddistrito " & _ " INNER JOIN dbo.provincias ON dbo.clientes.idprovincia = dbo.provincias.idprovincia " & _ "AND dbo.departamentos.Iddepartamento = dbo.provincias.Iddepartamento " & _ "AND dbo.distritos.idprovincia = dbo.provincias.idprovincia where clientes.idtipo = '" & codigotipo & "'") Me.DataGrid1.SetDataBinding(clase.datos, "x") End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Select Case True Case Me.RadioButton1.Checked = True vista.Table = clase.datos.Tables("x") vista.RowFilter = "idcliente like '" & Me.TextBox1.Text & "%'" Me.DataGrid1.DataSource = vista Me.DataGrid1.Update() Case Me.RadioButton2.Checked = True vista.Table = clase.datos.Tables("x") vista.RowFilter = "nombres like '" & Me.TextBox1.Text & "%'" Me.DataGrid1.DataSource = vista Me.DataGrid1.Update() Case Me.RadioButton3.Checked = True vista.Table = clase.datos.Tables("x") vista.RowFilter = "razonsocial like '" & Me.TextBox1.Text & "%'" Me.DataGrid1.DataSource = vista Me.DataGrid1.Update() End Select End Sub

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Enter Then estado = 1 matriz(c, 0) = DataGrid1.Item(c, 0) matriz(c, 1) = DataGrid1.Item(c, 1) matriz(c, 2) = DataGrid1.Item(c, 2) matriz(c, 3) = DataGrid1.Item(c, 3) matriz(c, 4) = DataGrid1.Item(c, 4) matriz(c, 5) = DataGrid1.Item(c, 5) matriz(c, 6) = DataGrid1.Item(c, 6) matriz(c, 7) = DataGrid1.Item(c, 7) matriz(c, 8) = DataGrid1.Item(c, 8) matriz(c, 9) = DataGrid1.Item(c, 9) matriz(c, 10) = DataGrid1.Item(c, 10) matriz(c, 11) = DataGrid1.Item(c, 11) matriz(c, 12) = DataGrid1.Item(c, 12) matriz(c, 13) = DataGrid1.Item(c, 13) matriz(c, 14) = DataGrid1.Item(c, 14) Me.Hide() End If End Sub Private Sub RadioButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Click Me.TextBox1.Clear() : Me.TextBox1.Focus() : Me.Height = 296 End Sub Private Sub RadioButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton2.Click Me.TextBox1.Clear() : Me.TextBox1.Focus() : Me.Height = 296 End Sub Private Sub RadioButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton3.Click Me.TextBox1.Clear() : Me.TextBox1.Focus() : Me.Height = 296 End Sub

UserLinuxPlug – Hervert Navarro Vela - 40 - [email protected]

47

1290129112921293129412951296129712981299130013011302130313041305130613071308

130913101311131213131314131513161317131813191320132113221323132413251326132713281329

13301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364

48

Ado .NET

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.DoubleClick estadoproforma = 2 If tipoclientep = "Natural" Then codclientep = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 0) nombresclientes = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 4) + " " + _ Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 3) + " " + _ Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 2) Else nombresclientes = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 1) codclientep = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 0) End If Me.Close() End SubEnd Class

UserLinuxPlug – Hervert Navarro Vela - 41 - [email protected]

49

1365136613671368136913701371137213731374137513761377137813791380

1381

50