Autor
|
Tema: Ayuda con Listview (evitar duplicados en lista de facturación) plis!!! (Leído 6,950 veces)
|
GhostLT
Desconectado
Mensajes: 82
To know the truth,you must risk everything
|
Es necesario consultar 3 campos en el listview para determinar que no esta repetido (material,medidaancho y medidalargo) si estos 3 son verdadero entonces que me mande un mensaje que ya esta en la lista
Private Sub cmdagregar_Click() 'validar que esten seleccionados los campos If txtmaterial.Text = "" Then MsgBox " Seleccione el tipo de Material", vbInformation, "Aviso": Exit Sub If Combo2.Text = "" Then MsgBox "Seleccione Medida de Largo", vbInformation, "Aviso": Exit Sub If Combo3.Text = "" Then MsgBox "Seleccione la Cantidad a Imprimir", vbInformation, "Aviso": Exit Sub If Combo1.Text = "" Then MsgBox "Desea Aplicar Descuento", vbInformation, "Aviso": Exit Sub If txtentrega.Text = "" Then MsgBox "Seleccione Fecha de Entrega", vbInformation, "Aviso": Exit Sub 'validar que el producto no se encuentre ya en el detalle Dim i As Long Dim j As Long With ListView1 .View = lvwList For i = 1 To .ListItems.Count For j = i + 1 To .ListItems.Count If .ListItems.item(i).ListItems.item(i).SubItems(1) And .ListItems.item(i).SubItems(2) = .ListItems.item(j) And _ .ListItems.item(j).SubItems(1) And .ListItems.item(j).SubItems(2) Then MsgBox "Esa Información ya existe en la lista de Facturación", vbInformation, "Aviso": Exit Sub End If If j = .ListItems.Count Then Exit For End If Next
With RsTemporalFacturaPlotter .Requery .AddNew !material = txtmaterial.Text !medidaancho = CDbl(txtancho.Text) !medidalargo = CDbl(txtlargo.Text) !cantidad = txtcantidad.Text !descuento = CDbl(txtdescuento.Text) !importe = CDbl(txtimporte.Text) !semana = lblsemana.Caption !Hora = lblhora.Caption .Update End With agregar 'llena el listview1 con los datos que meti 'calcular los totales txtsubtotal.Text = Sumar 'suma toda la lista de precios del campo precio del listview1 txtiva.Text = txtsubtotal.Text * 0.1 txttotal.Text = txtsubtotal.Text + txtsubtotal.Text * 0.1 limpiar 'limpia todo el pedo End Sub
Gracias por su atención
|
|
|
En línea
|
There is some fiction in you truth, and some truth in you fiction
|
|
|
GhostLT
Desconectado
Mensajes: 82
To know the truth,you must risk everything
|
Uff!!! porfin encontre la solución Private Sub cmdagregar_Click() 'validar que esten seleccionados los campos 'If txtmaterial.Text = "" Then MsgBox " Seleccione el tipo de Material", vbInformation, "Aviso": Exit Sub If Combo2.Text = "" Then MsgBox "Seleccione Medida de Largo", vbInformation, "Aviso": Exit Sub If Combo3.Text = "" Then MsgBox "Seleccione la Cantidad a Imprimir", vbInformation, "Aviso": Exit Sub If Combo1.Text = "" Then MsgBox "Desea Aplicar Descuento", vbInformation, "Aviso": Exit Sub If txtentrega.Text = "" Then MsgBox "Seleccione Fecha de Entrega", vbInformation, "Aviso": Exit Sub '------------------------------validar que la info del detalle de la venta no sea igual---- var1 = txtmaterial.Text + txtancho.Text + Combo2.Text Dim Registros As Integer Registros = ListView1.ListItems.Count
For x = 1 To Registros With ListView1 var2 = ListView1.ListItems.item(x) & ListView1.ListItems.item(x).ListSubItems(1) & ListView1.ListItems.item(x).ListSubItems(2) & " mts" End With If var1 = var2 Then MsgBox "Esta Información ya ha sido agregado a esta compra anteriormente", vbInformation, "Aviso": limpiar: Exit Sub Next
'grabar en TemporalFacturaPlotter With RsTemporalFacturaPlotter .Requery .AddNew !material = txtmaterial.Text !medidaancho = CDbl(txtancho.Text) !medidalargo = CDbl(txtlargo.Text) !cantidad = txtcantidad.Text !descuento = CDbl(txtdescuento.Text) !importe = CDbl(txtimporte.Text) !semana = lblsemana.Caption !Hora = lblhora.Caption .Update End With agregar 'llena el listview1 con los datos que meti 'calcular los totales txtsubtotal.Text = Sumar 'suma toda la lista de precios del campo precio del listview1 txtiva.Text = txtsubtotal.Text * 0.1 txttotal.Text = txtsubtotal.Text + txtsubtotal.Text * 0.1 limpiar 'limpia todo el pedo End Sub 'End Function Private Function Sumar() As Double Dim i As Integer 'Recorre todos los items y para sumar los SubItems For i = 1 To ListView1.ListItems.Count Sumar = Sumar + CDbl(ListView1.ListItems.item(i).ListSubItems(7)) Next i End Function
|
|
|
En línea
|
There is some fiction in you truth, and some truth in you fiction
|
|
|
cassiani
Desconectado
Mensajes: 978
« Anterior | Próximo »
|
recuerda las etiquetas GeShi me llamo la atensión este bloque: With ListView1 var2 = ListView1.ListItems.item(x) & ListView1.ListItems.item(x).ListSubItems(1) & _ ListView1.ListItems.item(x).ListSubItems(2) & " mts" End With usas el With ... End With, pero sigues haciendo referencia al objeto, en este caso el ListView1, recuerda que le usas para ejecutar una serie de declaraciones que hagan referencia repetida a un solo objeto. With ListView1 var2 = .ListItems.item(x) & .ListItems.item(x).ListSubItems(1) & .ListItems.item(x).ListSubItems(2) & " mts" End With *http://msdn.microsoft.com/en-us/library/wc500chb(VS.71).aspx ah que abajo si lo usaste .. o.O
|
|
« Última modificación: 25 Septiembre 2009, 17:22 pm por cΔssiΔnі »
|
En línea
|
|
|
|
GhostLT
Desconectado
Mensajes: 82
To know the truth,you must risk everything
|
Primero que nada GRACIAS!!! por mencionar las etiquetas geSHI no tenia idea como le hacian, apartir de ahora las voy a implementar para una mejor comprensión y con respecto a la info del with es cierto intentaré poner mas cuidado.
|
|
|
En línea
|
There is some fiction in you truth, and some truth in you fiction
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
ayuda con programa en c y winapi que lista los directorios en un listview
Programación C/C++
|
suchil
|
1
|
3,155
|
7 Agosto 2011, 16:23 pm
por escabe
|
|
|
[SOLUCIONADO] ¿Como evitar el efecto Flashing de un listview?
.NET (C#, VB.NET, ASP)
|
Eleкtro
|
3
|
3,253
|
1 Enero 2013, 00:23 am
por spiritdead
|
|
|
vb.net - Items Duplicados y no duplicados de Un Listview
.NET (C#, VB.NET, ASP)
|
OscarCadenas_91
|
2
|
3,555
|
12 Febrero 2015, 13:55 pm
por OscarCadenas_91
|
|
|
Evitar temas duplicados
Sugerencias y dudas sobre el Foro
|
Usuario Invitado
|
7
|
4,482
|
9 Abril 2015, 02:44 am
por El_Andaluz
|
|
|
Evitar datos duplicados en listview
.NET (C#, VB.NET, ASP)
|
nolasco281
|
9
|
10,527
|
10 Mayo 2015, 15:42 pm
por DarK_FirefoX
|
|