Advertisement
Advertisement
| 12.28.2007 at 03:40PM PST, ID: 23048319 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: |
Private Sub cmdOK_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click 'The main event: connects to Timesheet Templates and fills in all of the info
Dim i = 0, x = 0
Dim strTimeSheet, strWorkSheetName, filename, fancy, strCell1, strCell2 As String
Dim sbExcelData As System.Text.StringBuilder
Dim aExcel As New Excel.Application
Dim aWorkbook As Excel.Workbook
Dim aWorkSheet As Excel.Worksheet
Dim aWorkRange As Excel.Range
Dim aProcesses() As Process = Process.GetProcesses
Dim checkDate As Date = calTimesheet.SelectionStart.Date
Dim endcheck As Date = checkDate.AddDays(14).Date
Me.Hide()
aExcel.Application.SheetsInNewWorkbook = 1
Select Case trigger
Case 1
path1 = "C:\Documents and Settings\" & username & "\TimeSheet\Templates\980Hourly.xls"
path2 = "C:\Documents and Settings\" & username & "\Timesheet\980Hourly.xls"
strTimeSheet = "980Hourly.xls"
strWorkSheetName = "980Hourly"
Case 2
path1 = "C:\Documents and Settings\" & username & "\TimeSheet\Templates\Salary.xls"
path2 = "C:\Documents and Settings\" & username & "\Timesheet\Salary.xls"
strTimeSheet = "Salary.xls"
strWorkSheetName = "Salaried"
Case 3
path1 = "C:\Documents and Settings\" & username & "\TimeSheet\Templates\Standard.xls"
path2 = "C:\Documents and Settings\" & username & "\Timesheet\Standard.xls"
strTimeSheet = "Standard.xls"
strWorkSheetName = "Standard"
End Select
Try
' Ensure that the target does not exist.
If System.IO.File.Exists(path2) Then
System.IO.File.Delete(path2)
End If
' Copy the file.
'System.IO.File.Copy(path1, path2)
Catch
Call killprocesses()
End Try
aExcel.Visible = False
Try
aWorkbook = aExcel.Workbooks.Open(path1)
aWorkSheet = CType(aWorkbook.Sheets(strWorkSheetName), Microsoft.Office.Interop.Excel.Worksheet)
aWorkSheet.Activate()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error!")
End Try
'The Following will fill the information in the timesheet for the User
Select Case trigger
Case 1 '9/80 Hourly
If Switch = False Then
aWorkSheet.Cells(41, 1) = txtEmpNum.Text
aWorkSheet.Cells(43, 4) = txtName.Text
End If
Do Until checkDate.Date = endcheck.Date 'This will cycle through each date starting from the Calendar objects Start Selection to the End Selection
Do Until x = 12 'Will look through all 12 of the Holidays and see if one of the days in checkDate is a Holiday
If checkDate.Date = arDate(x).Date Then 'If it is then it will Add "Holiday" to the cell above the date in the spreadsheet and gray out the day
doit(checkDate)
aWorkSheet.Cells(intRow, intCol) = "Holiday"
aWorkSheet.Cells(intRow, intCol).Font.Bold = True
aWorkSheet.Cells(intRow, intCol).Font.Underline = True
aWorkSheet.Cells(intRow, intCol).Font.Size = 10
aWorkSheet.Cells(intRow, intCol).HorizontalAlignment = 3
strCell1 = cellz & CStr(intRow + 3)
strCell2 = cellz & CStr(intRow + 10)
aWorkSheet.Range(strCell1, strCell2).Interior.Color = RGB(192, 192, 192)
Exit Do
Else
cellz = ""
End If
x = x + 1
Loop
x = 0
checkDate = checkDate.AddDays(1)
Loop
aWorkSheet.Cells(5, 2) = calTimesheet.SelectionStart.Date
aWorkSheet.Cells(43, 11) = Date.Today.Now.Date
Case 2 'Salary
If Switch = False Then
aWorkSheet.Cells(35, 1) = txtEmpNum.Text
aWorkSheet.Cells(37, 3) = txtName.Text
aWorkSheet.Cells(7, 2) = "X"
aWorkSheet.Cells.Range("E7", "H7").Value = "X"
aWorkSheet.Cells.Range("E17", "I17").Value = "X"
End If
aWorkSheet.Cells(5, 2) = calTimesheet.SelectionStart
aWorkSheet.Cells(37, 10) = Date.Today.Now.Date
Case 3 'Standard
If Switch = False Then
aWorkSheet.Cells(40, 1) = txtEmpNum.Text
aWorkSheet.Cells(40, 7) = txtName.Text
End If
aWorkSheet.Cells(5, 2) = calTimesheet.SelectionStart.AddDays(2)
End Select
filename = "C:\Documents and Settings\" & username & "\Timesheet\" & strTimeSheet
aExcel.ActiveWorkbook.SaveAs(filename)
aExcel.ActiveWorkbook.Close()
Call Settings()
System.Diagnostics.Process.Start("Excel.EXE", filename)
End
End Sub
|