elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


  Mostrar Temas
Páginas: [1] 2 3
1  Programación / Programación Visual Basic / imrimir varias hojas con numero de pagina en: 24 Noviembre 2022, 16:16 pm
Hola necesito imprimir varias paginas  con numero de pagina

en la facturacion de venta

el problema esta en cuanto imprimo lo hace todo seguido y hay un formato, cuando llega al final de la hoja y pasa a la siguiente el formato no lo hace
subo el ejemplo


https://workupload.com/file/4XXRNywJuA8

gracias
2  Programación / Programación Visual Basic / apertura y cierre de saldo en: 4 Octubre 2022, 12:50 pm
Hola Serapis

he conseguido arreglar el programa de facturacion o sea ahora puedo hacer compras y ventas, bueno el de compras estaba practicamente eho, he tenido que hacer el de ventas. funciona todo bien

ahora solo faltaria hacer apertura de saldo y cierre para cada dia, un ejemplo una idea con codigo yo ya lo adaptaria.

muchas gracias
3  Programación / Programación Visual Basic / problema con hacer el carrito de almacen en: 13 Julio 2022, 13:48 pm
hola serapis
estoy intentando de hacer el carrito de la compra de facturacion, pero lo quiero adaptar para hacer el carrito de articulos de almacen para poder comprar, Editar y eliminar articulos, para control de varios almacenes.

el menu principal seria

archivo = crear almacen, abrir almacen, cerrar almacen

edicion = comprar articulos, editar articulo,  eliminar articulos



en el list1 seria

Codigo  Stock     Articulo                impuesto    Uda.caja      Umbral    Pedido   En Oferta     



seria de mucha utilidad si me pudiese hacer la version del formulario frmalmacen

seria hacer el carrito de la compra de articulos

me hago un lio con las funciones
el programa no para de darme errores

muchas gracias
4  Programación / Programación Visual Basic / leer archivo combo en: 5 Junio 2022, 15:20 pm
tengo un pequeño problema del programa Facturacion
a la hora de crear nueva facturacion va bien
a la hora de leer la informacion parece que lee pero no me lee la informacion en el formulario frmcompra del combo donde tiene que ir los articulos de leer la facturacion.

si yo creo varias facturaciones siempre en combo me lee la misma facturacion

el codigo del combo es el siguiente

Código
  1.  
  2.  
  3. Private Sub CmbArticulo_Click()
  4.    Dim Id As Integer
  5.  
  6.    If (CmbArticulo.ListIndex >= 0) Then
  7.        Id = CmbArticulo.ItemData(CmbArticulo.ListIndex)
  8.        RegArt = FrmAlmacen.ArticuloByCode(Id)
  9.        With RegArt
  10.            TxtUnidades.Text = CStr(.UnidadesPorCaja)
  11.            Call EstablecerValorImpuestos(.PrecioUnitario, .ImpuestoIVA)
  12.  
  13.            If (.IdOferta > 0) Then
  14.                LabOferta.Caption = "¿Está en oferta?:     SI"
  15.                Id = FrmOfertas.BuscarPorCodigo(.IdOferta, RegOfer)
  16.            Else
  17.                LabOferta.Caption = "¿Está en oferta?:     NO"
  18.                TxtDescuento.Text = "- 0.0"
  19.                Call VaciarRegOferta
  20.            End If
  21.        End With
  22.  
  23.        Call Totalizar
  24.    End If
  25. End Sub
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  



como puedo leer si son diferentes facturaciones y que vaya al combo del formulario frmcompra


gracias
5  Programación / Programación Visual Basic / poner tanto por ciento en el grafico circular en: 30 Marzo 2022, 12:30 pm
estoy haciendo un pequeño programa con el cual hay unos datos fijos y quisiera poner esos datos en el grafico circular hay cuatro datos pero hay un quinto dato que falta dibujar  que es la variable z1 en el grafico y poner el dato en el grafico.

en el programa faltaria controlar el indice de introducir los datos que empezara por 1,2,3,4,5, etc


el ejemplo que tengo hasta ahora es el siguiente:


Código
  1.  
  2.  
  3. Option Explicit
  4. Private Type departamento
  5. d As Date
  6. w As Double
  7. x As Double
  8. y As Double
  9. z As Double
  10. zl As Double
  11. End Type
  12.  
  13. Dim dpto As departamento
  14. Dim NumRecs As Long
  15.  
  16. Private Sub Command1_Click()
  17. 'Grafico
  18. DrawPie
  19. End Sub
  20.  
  21. Private Sub DrawPiePiece(lColor As Long, ByVal fStart As Double, ByVal fEnd As Double)
  22.  Const PI As Double = 3.14159265359
  23.  Const CircleEnd As Double = -2 * PI
  24.  Dim dStart As Double
  25.  Dim dEnd As Double
  26.  
  27.  Picture2.FillColor = lColor
  28.  Picture2.FillStyle = 0
  29.  dStart = fStart * (CircleEnd / 100)
  30.  dEnd = fEnd * (CircleEnd / 100)
  31.  Picture2.Circle (170, 150), 100, , dStart, dEnd
  32. End Sub
  33.  
  34. Private Sub DrawPie()
  35.  Dim Disp As Single, Alq As Single, i As Byte, Vt As Integer, Ang1 As Single, Ang2 As Single
  36.  
  37.  Picture2.Cls
  38.  
  39.  Picture2.AutoRedraw = True
  40.  Picture2.BackColor = &H8000000E
  41.  Picture2.ScaleMode = vbPixels
  42.  
  43.  
  44.  Dim xx As Double
  45.  Dim yy As Double
  46.  Dim zz As Double
  47.  Dim uu As Double
  48.  
  49.  
  50.  With dpto
  51.    If .w = 0 Then MsgBox "No hay registros para" & DateTime.Date & "para ser mostrado"
  52.        Text1.Text = .d
  53.        If .w > 0 Then
  54.        xx = (.x * 100) / .w
  55.        yy = xx + (.y * 100) / .w
  56.        zz = yy + (.z * 100) / .w
  57.        uu = zz + (.zl * 100) / .w
  58.  
  59.        Call DrawPiePiece(QBColor(1), 0.001, xx)
  60.        Call DrawPiePiece(QBColor(6), xx, yy)
  61.        Call DrawPiePiece(QBColor(3), yy, zz)
  62.        Call DrawPiePiece(QBColor(5), zz, uu)
  63.    End If
  64.  
  65.  End With
  66. End Sub
  67.  
  68. Private Sub Command2_Click()
  69. 'Guardar
  70. With dpto
  71.      .d = Date
  72.      .w = 650
  73.      .x = 301
  74.      .y = 39
  75.      .z = 109
  76.      .zl = 201
  77.    End With
  78.  
  79.    NumRecs = 1
  80.    Open App.Path & "\PieData.dat" For Random As #1 Len = 64
  81.      Put #1, 1, NumRecs
  82.      Put #1, NumRecs + 1, dpto
  83.    Close #1
  84. End Sub
  85.  
  86. Private Sub Command3_Click()
  87. 'Leer
  88. If FileLen(App.Path & "\PieData.dat") > 60 Then
  89.    Open App.Path & "\PieData.dat" For Random As #1 Len = 64
  90.      Get #1, 1, NumRecs
  91.      Get #1, NumRecs + 1, dpto
  92.    Close #1
  93.    DrawPie
  94.  End If
  95. End Sub
  96.  
  97. Private Sub Command4_Click()
  98. End
  99. End Sub
  100.  
  101. Private Sub Command5_Click()
  102. Picture2.Cls
  103. End Sub
  104.  
  105.  
  106.  
  107.  




gracias
6  Programación / Programación Visual Basic / Problema hacer Menu en: 5 Febrero 2022, 13:51 pm
Hola soy corlo

estoy haciendo un formulario menu mdi principal aqui no hay problema
cuando hago el primer menu fichero no hay problema
pero cuando hago el segundo menu  clientes los botones de nuevo, editar,eliminar,imprimir me van al formulario mdi
hay alguna manera de que los botones me vaya al menu clientes con su respectivo codigo.
si voy haciendo mas menus los botones de los respectivos menus me van ha ir al formulario principal mdi y todo el codigo tambien.
gracias
7  Programación / Programación Visual Basic / Guardar list2 y leer list1 en: 15 Diciembre 2021, 17:59 pm
Hola soy corlo

ahora en pantalla principal hay list1 y list2

en el list2 es donde se va entrando los articulos desde el formulario y en el list1 es donde se guardan los datos del list2 al list1 para poder sumar el contado y tarjeta de credito

A la hora de entrar los datos al list2 desde el formulario lo hace bien, el problema es para guardar todos los datos del list2 a una fila del list1 asi sucesivamente con numero de ticket 1,2,3, etc del list1


a la hora de guardar seria:Command2_click()

N de ticket, fecha y hora, metodo de pago, total en el list1


en el metodo de pago esta en la pantalla principal no desde el formulario




a la hora de leer seria list1_click()
N ticket, Fecha y hora, Producto, Precio Unitario, cantidad, subtotal, total, en el list2



Gracias


8  Programación / Programación Visual Basic / sumar list1 en: 3 Diciembre 2021, 00:44 am
Hola soy colro

necesito sumar el total contado y el total tarjeta de credito
 consigo sumar el total del list1
pongo el codigo

Código
  1.  
  2. Case 1  ' Leer fichero de facturación
  3.            FrmFile.Show 1
  4.            Dim h As Integer
  5.             Dim totalcontado As Integer
  6.                Dim totaltcredito As Integer
  7.                totalcontado = 0: totaltcredito = 0
  8.            If (Len(FrmFile.File) > 0) Then
  9.                If (LeerFacturacion(App.Path & "\" & FrmFile.File) = True) Then
  10.                    Call Activar(True)
  11.  
  12.                    For h = 0 To List1.ListCount - 1
  13.  
  14.                     If reg2.MetodoDePago = "0" Then
  15.                     totalcontado = totalcontado + Val(Split(List1.List(h), vbTab)(6))
  16.                    End If
  17.                    If reg2.MetodoDePago = "1" Then
  18.                    totaltcredito = totaltcredito + Val(Split(List1.List(h), vbTab)(6))
  19.                    End If
  20.                    Next h
  21.                    txttotal.Text = Format(totalcontado, "#,##0.00")
  22.                    Txttotal1.Text = Format(totaltcredito, "#,##0.00")
  23.  
  24.                Else
  25.                    Call Activar(False)
  26.                End If
  27.            End If
  28.  
  29.  
  30.  






Gracias
9  Programación / Programación Visual Basic / leer datos en archivo secuencial en: 22 Noviembre 2021, 16:41 pm
Hola soy corlo

estoy haciendo una mini aplicacion de guardar datos de factura y leerlos por pantalla, en archivo secuencial.

guardar datos lo hace bien

el problema esta en leer los datos de la factura en pantalla
el archivo es 1.txt y hay lo siguiente:


==============================
           COMPROBANTE DE VENTA
==============================
TICKET Nº: 1                    TIPO : CONTADO
FECHA : 20/11/2021          HORA : 20:30:59
-------------------------------------------------------
R.U.C/C.I : a
CLIENTE   : a
===============================
CANTIDAD  PRODUCTO     PRECIO       SUBTOTAL
===============================
12               r              8          96
3              k              1.5        4,5
===============================
              TOTAL :                           100,50
               -------------------------------------------

          GRACIAS POR SU COMPRA!



me sale todo mezclado


el código que tengo hasta ahora es el siguiente:


Código
  1.  
  2. Option Explicit
  3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  4. Private Const LB_SETTABSTOPS = &H192
  5. Dim I As Integer
  6. Dim orden As Integer 'numero de ticket
  7. Dim fecha As Date 'para leer la fecha
  8. Dim hora As Date 'para leer la hora
  9. Dim contado As String 'para contado
  10. Dim credito As String 'para  credito
  11. Dim cedu1 As String ' para el RUC/C.I
  12. Dim nom1 As String ' para el cliente
  13. 'abajo son datos del list1
  14. Dim cantidad As Integer
  15. Dim producto As String * 12
  16. Dim preciox As String * 8
  17. Dim subtot As Double
  18. 'varible del total
  19. Dim tot As Double
  20. Private Sub Command4_Click()
  21. End
  22. End Sub
  23.  
  24. Private Sub Command5_Click()
  25. 'Nuevo registro
  26. '//recuperar el dato.
  27. Open App.Path & "\Numero1.txt" For Input As #1
  28. Do While Not EOF(1)
  29. Input #1, orden
  30. Loop
  31. Close #1
  32. Txtnum = orden + 1
  33.  
  34.  
  35.  
  36.      List1.Clear
  37.     txtCedula1.Text = ""
  38.     txtNombre1.Text = ""
  39.     total.Text = ""
  40.     txtCedula1.SetFocus
  41.  
  42.  
  43. End Sub
  44.  
  45.  
  46.  
  47. Private Sub Command6_Click()
  48. 'Guardar Factura
  49.  
  50. Dim cantidadtotal As Double
  51. Dim k As Integer
  52.  
  53.  
  54. orden = Txtnum.Text
  55. On Error GoTo salir
  56.  
  57.  
  58.  
  59.  
  60.  
  61.    Open App.Path & "\Numero1.txt" For Append As #1
  62.  
  63.    Print #1, Txtnum
  64.    Close #1
  65.  
  66. Dim bmx As String
  67. bmx = App.Path + "\" + Txtnum + ".txt"
  68.  
  69.  Open bmx For Append As #1
  70.  
  71.  
  72.  Txtnum = orden
  73.  
  74.  
  75.  
  76.    Print #1,
  77.  
  78.    Print #1,
  79.  
  80.    Print #1,
  81.  
  82.  
  83.    Print #1, Tab(1); String(44, "=")
  84.    Print #1, Tab((44 - Len("COMPROBANTE DE VENTA")) \ 2); "COMPROBANTE DE VENTA"
  85.    Print #1, Tab(1); String(44, "=")
  86.  
  87.    If Option1.Value = True Then
  88.        Print #1, Tab(1); "TICKET Nº: " & Txtnum.Text; Tab(44 - Len("TIPO : CONTADO")); "TIPO : CONTADO"
  89.    Else
  90.        Print #1, Tab(1); "TICKET Nº: " & Txtnum.Text; Tab(44 - Len("TIPO : CREDITO")); "TIPO : CREDITO"
  91.    End If
  92.  
  93.    Print #1, Tab(1); "FECHA : " & Date; Tab(44 - Len("HORA : " & Time)); "HORA : " & Time
  94.  
  95.    Print #1, Tab(1); String(44, "-")
  96.  
  97.    Print #1, Tab(1); "R.U.C/C.I : " & txtCedula1.Text
  98.    Print #1, Tab(1); "CLIENTE   : " & txtNombre1.Text
  99.  
  100.    Print #1, Tab(1); String(44, "=")
  101.    Print #1, Tab(1); "CANTIDAD"; Tab(11); "PRODUCTO"; Tab(24); "PRECIO"; Tab(37); "SUBTOTAL"
  102.    Print #1, Tab(1); String(44, "=")
  103.  
  104.  
  105. For k = 0 To List1.ListCount - 1
  106. Print #1, List1.List(k)
  107. Next k
  108.  
  109.  
  110.  
  111.    Print #1, Tab(1); String(44, "=")
  112.    Print #1, Tab(15); "TOTAL : "; Tab(43 - Len(Format(total.Text, "#,##0.00"))); Format(total.Text, "#,##0.00")
  113.    Print #1, Tab(16); "-----------------------------"
  114.  
  115.  
  116.  
  117.    Print #1,
  118.    Print #1, Tab((44 - Len("GRACIAS POR SU COMPRA!")) \ 2); "GRACIAS POR SU COMPRA!"
  119.  
  120.    For I = 1 To 10
  121.        Print #1,
  122.    Next I
  123.  
  124.    Close #1
  125.  
  126.  
  127.  Option1.Value = False
  128. Option2.Value = False
  129.  
  130. txtCedula1.Text = ""
  131. txtNombre1.Text = ""
  132.    List1.Clear
  133. cant.Text = ""
  134. prod.Text = ""
  135. precio.Text = ""
  136. subtotal.Text = ""
  137. total.Text = ""
  138. cant.SetFocus
  139.  
  140.    Exit Sub
  141.  
  142. salir:
  143.  
  144. Dim msgb
  145.  
  146. msgb = MsgBox("Error Nº : [ " & Err.Number & " ]" & " " & Err.Description, vbOKCancel + vbInformation)
  147.  
  148.  
  149. End Sub
  150.  
  151.  
  152.  
  153. Private Sub Command7_Click()
  154. 'Leer Factura
  155. Dim tabs(0 To 3) As Long
  156.    tabs(0) = 20
  157.    tabs(1) = 60
  158.    tabs(2) = 95
  159.    tabs(3) = 138
  160.    ' Set the tabs.
  161.    SendMessage List1.hwnd, LB_SETTABSTOPS, 4, tabs(1)
  162.  
  163.  
  164.  
  165. Dim str As String
  166. Dim thj As String
  167. Dim plo As Boolean
  168. Dim j As Integer
  169. Dim h As Integer
  170. On Error GoTo lo
  171. List1.Clear
  172. thj = App.Path + "\" + Txtnum.Text + ".txt"
  173. If Dir(thj) <> "" Then
  174. Open thj For Input As #1
  175.  
  176. Input #1, orden
  177. Txtnum.Text = orden
  178. Input #1, fecha
  179. Label4.Caption = fecha
  180. Input #1, hora
  181. Label5.Caption = hora
  182. Input #1, contado
  183. Input #1, credito
  184.  
  185. Input #1, cedu1, nom1
  186.  
  187. txtCedula1.Text = cedu1
  188. txtNombre1.Text = nom1
  189.  
  190. While Not EOF(1)
  191.  
  192. Input #1, cantidad, producto, preciox, subtot
  193. cant.Text = cantidad
  194. prod.Text = producto
  195. precio.Text = preciox
  196. subtotal.Text = subtot
  197. List1.AddItem cantidad & vbTab & producto & vbTab & preciox & vbTab & subtot
  198. Wend
  199.  
  200. j = 0
  201.   For h = 0 To List1.ListCount - 1
  202. j = j + Val(Split(List1.List(h), vbTab)(3))
  203. Next h
  204. total.Text = j
  205.  
  206.  
  207.  
  208. Close #1
  209. End If
  210.  
  211. If contado= contado Then
  212. Option1.Value = True
  213. Else
  214.  
  215. If credito = credito Then
  216. Option2.Value = True
  217.  
  218. End If
  219. End If
  220.  
  221.  
  222.  
  223.  
  224.  
  225. Exit Sub
  226. lo:
  227. If Not plo = True Then
  228. MsgBox "La Factura no existe, gracias", vbCritical
  229. End If
  230. End Sub
  231.  
  232. Private Sub Command8_Click()
  233. 'Agregar
  234. Dim h As Integer
  235. Dim j As Double
  236.  
  237. cantidad = cant.Text
  238. producto = prod.Text
  239. preciox = precio.Text
  240. subtot = subtotal.Text
  241.  
  242. List1.AddItem cantidad & vbTab & producto & vbTab & preciox & vbTab & subtot
  243. j = 0
  244.   For h = 0 To List1.ListCount - 1
  245. j = j + Split(List1.List(h), vbTab)(3)
  246. Next h
  247. total.Text = Format(j, "#,##0.00")
  248. cant.Text = ""
  249. prod.Text = ""
  250. precio.Text = ""
  251. subtotal.Text = ""
  252. cant.SetFocus
  253. End Sub
  254.  
  255. Private Sub Form_Load()
  256. Dim tabs(0 To 3) As Long
  257.  
  258.    tabs(0) = 20
  259.    tabs(1) = 123
  260.    tabs(2) = 237
  261.    tabs(3) = 370
  262.  
  263.    SendMessage List1.hwnd, LB_SETTABSTOPS, 4, tabs(1)
  264.  
  265. Option1.Value = False
  266. Option2.Value = False
  267.  
  268. Open App.Path & "\Numero1.txt" For Append As #1
  269. Close #1
  270. Open App.Path & "\Numero1.txt" For Append As #1
  271. Close #1
  272.  
  273. '//recuperar el dato.
  274. Open App.Path & "\Numero1.txt" For Input As #1
  275. Do While Not EOF(1)
  276. Input #1, orden
  277. Loop
  278. Close #1
  279. Txtnum = orden + 1
  280.  
  281. End Sub
  282.  
  283. Private Sub List1_Click()
  284. Text1.Text = Mid(List1.Text, 1, InStr(1, List1.Text, " ") - 1)
  285. Text2.Text = Mid(List1.Text, InStr(1, List1.Text, " ") + 1)
  286. I = List1.ListIndex
  287. End Sub
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294. Private Sub Option1_Click()
  295. Option2.Value = False
  296. End Sub
  297.  
  298. Private Sub Option2_Click()
  299. Option1.Value = False
  300. End Sub
  301.  
  302. Private Sub precio_KeyUp(KeyCode As Integer, Shift As Integer)
  303. subtotal.Text = cant.Text * Val(precio.Text)
  304. End Sub
  305.  
  306. Private Sub Timer1_Timer()
  307. Label4.Caption = Date
  308. Label5.Caption = Format(Time, "hh:mm:ss")
  309. End Sub
  310.  
  311.  
  312.  




Gracias


10  Programación / Programación Visual Basic / eliminar registro en: 9 Noviembre 2021, 19:14 pm
Hola soy corlo
estoy haciendo una mini aplicacion en añadir datos a los textbox ,  para luego leer los datos con el combo y una opcion para eliminar los datos.

añadir los datos: lo hace bien
leer los datos: lo hace bien
eliminar los datos: elimina el dato en el combo pero no elimina los datos de los textbox
no se que hago mal
paso el codigo que tengo hasta ahora

en un formulario

Código:

Option Explicit


Private Sub Boton_añadir_Click()
totalregistros = totalregistros + 1
If totalregistros > 50 Then
MsgBox "lista completa", 16, "error"
Else
agenda(totalregistros).Nombre = Nom.Text
agenda(totalregistros).apellidos = Ape.Text
agenda(totalregistros).telefono = Tel.Text
agenda(totalregistros).Edad = Val(Edad.Text)

Combo2.AddItem Nom.Text
End If
Nom.SetFocus
End Sub

Private Sub Boton_eliminar_Click()
Dim b As String

b = MsgBox("Eliminar Registro:" + Nom.Text, 3 + 32, "Eliminar")
If b = vbYes Then



If Combo2.ListIndex <> -1 Then




Combo2.RemoveItem (Combo2.ListIndex)



End If

totalregistros = totalregistros - 1

agenda(totalregistros).Nombre = Nom.Text
agenda(totalregistros).apellidos = Ape.Text
agenda(totalregistros).telefono = Tel.Text
agenda(totalregistros).Edad = Val(Edad.Text)





End If
Nom.Text = ""
Ape.Text = ""
Tel.Text = ""
Edad.Text = ""
End Sub

Private Sub Boton_fin_Click()
End
End Sub





Private Sub Botonnuevo_Click()
Nom.Text = ""
Ape.Text = ""
Tel.Text = ""
Edad.Text = ""
Nom.SetFocus

End Sub





Private Sub Combo2_Click()
Dim n As Integer
n = Combo2.ListIndex + 1

Nom.Text = agenda(n).Nombre
Ape.Text = agenda(n).apellidos
Tel.Text = agenda(n).telefono
Edad.Text = Val(agenda(n).Edad)



End Sub

Private Sub Ape_GotFocus()
Ape.SelStart = 0
Ape.SelLength = Len(Ape.Text)
End Sub

Private Sub Edad_GotFocus()
Edad.SelStart = 0
Edad.SelLength = Len(Edad.Text)
End Sub

Private Sub Nom_GotFocus()
Nom.SelStart = 0
Nom.SelLength = Len(Nom.Text)
End Sub
Private Sub Tel_GotFocus()
Tel.SelStart = 0
Tel.SelLength = Len(Tel.Text)
End Sub



Private Sub Form_Load()
totalregistros = 0
End Sub







y en un modulo


Código:

Type registro
Nombre As String * 15
apellidos As String * 25
telefono As String * 15
Edad As String * 3
End Type
Global agenda(1 To 50) As registro
Global totalregistros As Integer









gracias
Páginas: [1] 2 3
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines