• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente
 

Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente

on

  • 1,331 views

 

Statistics

Views

Total Views
1,331
Views on SlideShare
1,331
Embed Views
0

Actions

Likes
0
Downloads
71
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente Document Transcript

    • Formulario de Registro de Boleta de Venta CODIFICACIÓN En el espacio principal del formulario: Option Explicit Dim cn As ADODB.Connection Dim rsVentas As ADODB.Recordset Dim rsDetalle As ADODB.Recordset Dim rsArticulos As ADODB.Recordset Dim codigo As String Dim regreso As Integer En el formulario mismo: Private Sub Form_Load() Set cn = New ADODB.Connection Set rsVentas = New ADODB.Recordset With cn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source=d:sisventasdataventas.mdb" .Open End With rsVentas.Open "select * from ventas", cn, adOpenStatic, adLockOptimistic If rsVentas.RecordCount >= 1 Then rsVentas.MoveLast End If cNum_mov = Right(String(5, "0") & Trim(Str(Val(rsVentas.Fields("num_mov")) + 1)), 6) rsVentas.Close Dim cTip_doc As String cTip_doc = "B"
    • rsVentas.Open "select * from ventas Where tip_doc like'" + Trim(cTip_doc) & "%" & "' order by num_doc", cn, adOpenStatic, adLockOptimistic If rsVentas.RecordCount >= 1 Then rsVentas.MoveLast End If 'genera automaticamente el codigo de la factura incrementando 1 txtNum_bol = Right(String(5, "0") & Trim(Str(Val(rsVentas.Fields("num_doc")) + 1)), 6) 'muestra automaticamente la factura actual txtFec_emi.Text = Date Exit Sub End Sub En el botón de Cmdcliente: Private Sub cmdcliente_Click() frmVen_cli.Show End Sub En el botón Agregar: Private Sub cmdAgregar_Click() frmVen_art.Show End Sub En el botón Quitar: Private Sub cmdQuitar_Click() Dim enc As Integer Dim asub As Currency enc = lvwVenta.SelectedItem.Index Dim y, borrado As Integer borrado = 0 'Guardar de nuevo los datos que no fueron borrados For y = 1 To cont
    • If y = enc Then codigo = xCod_art(y) regreso = xCantidad(y) xCod_art(y) = xCod_art(y + 1) xDescripcion(y) = xDescripcion(y + 1) xCantidad(y) = xCantidad(y + 1) xPrecio(y) = xPrecio(y + 1) xSubtotal(y) = xSubtotal(y + 1) borrado = 1 End If If borrado = 1 Then xCod_art(y) = xCod_art(y + 1) xDescripcion(y) = xDescripcion(y + 1) xCantidad(y) = xCantidad(y + 1) xPrecio(y) = xPrecio(y + 1) xSubtotal(y) = xSubtotal(y + 1) End If Next y cont = cont - 1 lvwVenta.ListItems.Clear For y = 1 To cont Dim nuevo As ListItem Set nuevo = lvwVenta.ListItems.Add(, , xCod_art(y)) nuevo.SubItems(1) = xDescripcion(y) MsgBox xDescripcion(y) nuevo.SubItems(2) = xCantidad(y) nuevo.SubItems(3) = xPrecio(y) nuevo.SubItems(4) = xSubtotal(y) asub = asub + xSubtotal(y) Next y 'Calcula el subtotal, IGV y total Static subt As Currency txtSubTotal.Text = asub txtIgv.Text = Val(txtSubTotal.Text) * 0.19 txtTotal.Text = Val(txtSubTotal.Text) + Val(txtIgv.Text) 'Ubicar con el posicion correspondiente para guardar el stock Set rsArticulos = New Recordset rsArticulos.Open "select * from articulos", cn, adOpenStatic, adLockOptimistic rsArticulos.MoveFirst rsArticulos.Find "cod_art='" & codigo & " ' " rsArticulos.Fields("stock") = rsArticulos.Fields("stock") + regreso rsArticulos.Update End Sub
    • En el botón Guardar: Private Sub cmdGrabar_Click() 'Guardar los datos en la tabla Ventas rsVentas.AddNew rsVentas.Fields("num_mov") = cNum_mov rsVentas.Fields("tip_mov") = "S" rsVentas.Fields("tip_doc") = "B" rsVentas.Fields("num_doc") = txtNum_bol.Text rsVentas.Fields("cod_cli") = txtCod_cli.Text rsVentas.Fields("fec_emi") = txtFec_emi.Text rsVentas.Fields("cod_ven") = txtCod_ven.Text rsVentas.Update 'Guardar los datos en la tabla detalle Set rsDetalle = New Recordset rsDetalle.Open "select * from detalle", cn, adOpenStatic, adLockOptimistic Dim x As Integer For x = 1 To cont With rsDetalle .AddNew .Fields("num_mov") = txtNum_bol.Text .Fields("cod_art") = xCod_art(x) .Fields("cantidad") = xCantidad(x) .Fields("precio") = xPrecio(x) .Update End With Next x cmdGrabar.Enabled = False cmdQuitar.Enabled = False cmdAgregar.Enabled = False cont = 0 Unload Me Exit Sub End Sub
    • En el botón Cmdvendedor: Private Sub cmdVendedor_Click() frmVen_ven.Show End Sub En el botón Cerrar: Private Sub Command1_Click() End End Sub Formulario de Mantenimiento de Clientes CODIFICACIÓN En el espacio principal de formulario Public nNew As Integer Option Explicit Dim cn As ADODB.Connection Dim rsClientes As ADODB.Recordset
    • En el formulario mismo Private Sub Form_Load() Set cn = New ADODB.Connection Set rsClientes = New ADODB.Recordset With cn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source=d:sisventasdataventas.mdb" .Open End With rsClientes.ActiveConnection = cn rsClientes.Open "Select * from clientes", cn, adOpenStatic, adLockOptimistic llenacontroles llenalista nNew = 1 End Sub En el botón nuevo Private Sub cmdNuevo_Click() frmMan_cli.Width = 9210 limpia desactivaBotones activatext If rsClientes.RecordCount = 0 Then txtCod_cli = "C0001" Else rsClientes.MoveLast txtCod_cli.Text = "C" & Right("0000" & Trim(Str(Val(Right(rsClientes.Fields("cod_cli"), 4)) + 1)), 4) End If txtApe_cli.SetFocus nNew = 1 End Sub En el botón modificar Private Sub cmdModificar_Click() Dim cCod_cli As String cCod_cli = ListView1.SelectedItem.Text rsClientes.MoveFirst rsClientes.Find "cod_cli='" + Trim(cCod_cli) + "'" desactivaBotones
    • activatext llenacontroles txtApe_cli.SetFocus nNew = 2 frmMan_cli.Width = 9210 End Sub En el botón Eliminar Private Sub cmdEliminar_Click() Dim cCod_cli As String cCod_cli = ListView1.SelectedItem.Text rsClientes.MoveFirst rsClientes.Find "cod_cli='" + Trim(cCod_cli) + "'" Dim res As String res = MsgBox("Está seguro de eliminar al cliente:" + Chr(13) + rsClientes.Fields("ape_cli") & ", " & rsClientes.Fields("nom_cli"), vbQuestion + vbYesNo + vbDefaultButton2, "Eliminación del Cliente") If res = 6 Then rsClientes.Delete rsClientes.MoveFirst llenalista End If End Sub En el botón Salir Private Sub cmdCerrar_Click() Unload Me End Sub Otros dentro de la codificación Private Sub limpia() txtApe_cli.Text = "" txtNom_cli.Text = "" txtDni.Text = "" txtTelefono.Text = "" txtDireccion.Text = "" txtMail.Text = "" End Sub
    • Private Sub desactivaBotones() cmdNuevo.Enabled = False cmdModificar.Enabled = False cmdEliminar.Enabled = False cmdCerrar.Enabled = False cmdGuardar.Enabled = True cmdCancelar.Enabled = True End Sub Private Sub activaBotones() cmdNuevo.Enabled = True cmdModificar.Enabled = True cmdEliminar.Enabled = True cmdCerrar.Enabled = True cmdGuardar.Enabled = False cmdCancelar.Enabled = False End Sub Private Sub activatext() txtApe_cli.Locked = False txtNom_cli.Locked = False txtDni.Locked = False txtTelefono.Locked = False txtDireccion.Locked = False txtMail.Locked = False End Sub Private Sub desactivatext() txtApe_cli.Locked = True txtNom_cli.Locked = True txtDni.Locked = True txtTelefono.Locked = True txtDireccion.Locked = True txtMail.Locked = True End Sub Private Sub cmdCancelar_Click() activaBotones desactivatext frmMan_cli.Width = 5850 End Sub Private Sub llenacontroles() If rsClientes.EOF Then Exit Sub End If If rsClientes.BOF Then Exit Sub If IsNull(rsClientes("cod_cli")) Then txtCod_cli.Text = ""
    • Else txtCod_cli.Text = rsClientes.Fields("cod_cli") End If If IsNull(rsClientes("ape_cli")) Then txtApe_cli.Text = "" Else txtApe_cli.Text = rsClientes.Fields("ape_cli") End If If IsNull(rsClientes("nom_cli")) Then txtNom_cli.Text = "" Else txtNom_cli.Text = rsClientes.Fields("nom_cli") End If If IsNull(rsClientes("telefono")) Then txtTelefono.Text = "" Else txtTelefono.Text = rsClientes.Fields("telefono") End If If IsNull(rsClientes("dni")) Then txtDni.Text = "" Else txtDni.Text = rsClientes.Fields("dni") End If If IsNull(rsClientes("direccion")) Then txtDireccion.Text = "" Else txtDireccion.Text = rsClientes.Fields("direccion") End If If IsNull(rsClientes("mail")) Then txtMail.Text = "" Else txtMail.Text = rsClientes.Fields("mail") End If End Sub Public Sub SoloNumeros(KeyAscii As Integer) Select Case KeyAscii Case 8, 46 Case Is < 48, Is > 57 KeyAscii = 0 End Select End Sub Private Sub txtApe_cli_LostFocus() txtApe_cli.Text = UCase(txtApe_cli) End Sub
    • Private Sub txtnom_cli_LostFocus() txtNom_cli.Text = UCase(txtNom_cli) End Sub Private Sub txtdni_KeyPress(KeyAscii As Integer) Call SoloNumeros(KeyAscii) End Sub Private Sub txtTelefono_KeyPress(KeyAscii As Integer) Call SoloNumeros(KeyAscii) End Sub Private Sub llenalista() ListView1.ListItems.Clear Dim nuevo As ListItem Dim i As Integer For i = 1 To rsClientes.RecordCount Set nuevo = frmMan_cli.ListView1.ListItems.Add(, , rsClientes.Fields("cod_cli")) nuevo.SubItems(1) = rsClientes.Fields("ape_cli") & ", " & rsClientes.Fields("nom_cli") nuevo.SubItems(2) = rsClientes.Fields("dni") rsClientes.Move (1) Next i End Sub Private Sub txtBus_Change() Dim cBus As String cBus = txtBus.Text Set rsClientes = New Recordset rsClientes.Open "select * from clientes where ape_cli like'" + Trim(cBus) & "%" & "'", cn, adOpenStatic, adLockOptimistic llenalista End Sub