Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: karina22
 | Femeie 25 ani Bucuresti cauta Barbat 25 - 54 ani |
|
Mrrrr
AdMiN
 Inregistrat: acum 18 ani
Postari: 2247
|
|
The following code takes into account month start and end dates thus needs the code in this topic to make sure leap years are taken into consideration properly:
I'm not going to post the SAP part with SAP VBS commands, only the surrounding VBS code that verifies if SAP is open then extracts month start and end from month number and year, then the end HTML part creating a simple GUI with month and year text boxes and 3 SAP option radio buttons.
<head> <title>Cherestea</title>
<HTA:APPLICATION APPLICATIONNAME="Cherestea" SCROLL="no" BORDER="dialog" SINGLEINSTANCE="yes" WINDOWSTATE="normal" ICON="magnify.exe" > </head>
<script LANGUAGE="VBScript"> Sub Window_onLoad window.resizeTo 320,300 End Sub </script>
<script language="VBScript"> Sub Cherestea
Dim strMonth Dim strYear Dim LeapYear
Dim strDateStart Dim strDateEnd Dim strMaterial
' ################################# VERIFICA DACA E SAP DESCHIS <---- START
If Not IsObject(application) Then On Error Resume Next Set SapGuiAuto = GetObject("SAPGUI") If SapGuiAuto is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If On Error Resume Next Set application = SapGuiAuto.GetScriptingEngine If application is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If End If
If Not IsObject(connection) Then On Error Resume Next Set connection = application.Children(0) If connection is Nothing Then MsgBox "Deschide mai intai SAP" Exit Sub End If End If
If Not IsObject(session) Then Set session = connection.Children(0) End If
If IsObject(WScript) Then WScript.ConnectObject session, "on" WScript.ConnectObject application, "on" End If
' ################################# VERIFICA DACA E SAP DESCHIS <---- SFARSIT
strMonth = TextBoxMonth.value
If strMonth = 0 or strMonth > 12 Then MsgBox "Nu ai introdus nici o luna / luna inexistenta" Set session = Nothing WScript.Quit End If
strYear = TextBoxYear.value
If strYear = 0 Then MsgBox "Nu ai introdus nici un an" Set session = Nothing WScript.Quit End If
strDateStart = "01." & strMonth & "." & strYear
Select Case strMonth
Case 01 strDateEnd = "31." & strMonth & "." & strYear
Case 03 strDateEnd = "31." & strMonth & "." & strYear
Case 04 strDateEnd = "30." & strMonth & "." & strYear
Case 05 strDateEnd = "31." & strMonth & "." & strYear
Case 06 strDateEnd = "30." & strMonth & "." & strYear
Case 07 strDateEnd = "31." & strMonth & "." & strYear
Case 08 strDateEnd = "31." & strMonth & "." & strYear
Case 09 strDateEnd = "30." & strMonth & "." & strYear
Case 10 strDateEnd = "31." & strMonth & "." & strYear
Case 11 strDateEnd = "30." & strMonth & "." & strYear
Case 12 strDateEnd = "31." & strMonth & "." & strYear
Case 02 LeapYear = 0 If strYear Mod 4 = 0 then LeapYear = 1 If strYear Mod 100 = 0 then LeapYear = 0 If strYear Mod 400 = 0 then LeapYear = 1
If LeapYear = 0 Then strDateEnd = "28." & strMonth & "." & strYear
ElseIf LeapYear = 1 Then strDateEnd = "29." & strMonth & "." & strYear End if Case Else Set session = Nothing WScript.Quit End Select
' ############### ' SAP PART GOES HERE ' SAP PART WAS RECORDED FROM SAP TO VBS FILE WITH SAP'S OWN RECORDER ' ###############
End Sub </script>
<body>
Scrie luna si anul, selecteaza achizitie, consum sau transfer (neselectat pentru toate miscarile) si apoi apasa pe buton.<p>
Luna: <input type="text" name="TextBoxMonth" size="10" maxLength="2" style="background-color=yellow;"> & Anul: <input type="text" name="TextBoxYear" size="10" maxLength="4" style="background-color=yellow;"><p> <center> <input type="radio" name="RadioOption" value="1" style="background-color=yellow;"> 1. Achizitie (NIR)<BR> <input type="radio" name="RadioOption" value="2" style="background-color=yellow;"> 2. Consum (BC)<BR> <input type="radio" name="RadioOption" value="3" style="background-color=yellow;"> 3. Transfer (BT)<P>
</b></font> <input type="button" value="Introdu in SAP" name="run_button" onClick="Cherestea" style="background-color=yellow;"> </center><p>
</body>
|
_______________________________________

|
|
pus acum 3 ani |
|