VB icon

Human Resources Information System (HRIS), HR Software, HRMS, HRDB

Email
Submitted on: 8/8/2015 6:05:36 AM
By: Kazi Md. Shakawat Hossain  
Level: Intermediate
User Rating: By 1 Users
Compatibility: VB.NET
Views: 6461
 
     Human Resource Information System (HRIS) is a software or solution to manage an organization's workforce in a systematic way with the help of historical and projected data. It is a highly customizable software that can meet every requirement of an organization’s HR functions. The mission of HRIS is to provide technical assistant to Human Resources Division so that it meet Human Resources’ automation, data, records and information management requirements. It’s primary focus is on establishing integrated systems for the administration and deployment of strategic Human Resource information, programs, and services! Focus on what matters Put an end to all the hassle. Stop shuffling paperwork. Use your time to empower your employees, create a vision for the future, and make your organization more strategic and systematic with the support of Information Technology. Kazi Software Solutions PABX: +880-2-9827001 - 10 (Ext: 3610) Mobile: +88 01716 017 126, +88 01682 330 792 For more info, please visit our pages; http://www.facebook.com/KaziSoftwareSolutions http://kazisoftwaresolutions.weebly.com/ Email : kazi_shakawat@yahoo.com NB: we help students by providing Source Codes for their thesis/project purpose.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Human Resources Information System (HRIS), HR Software, HRMS, HRDB
// Description:Human Resource Information System (HRIS) is a software or solution to manage an organization's workforce in a systematic way with the help of historical and projected data.
It is a highly customizable software that can meet every requirement of an organization’s HR functions.
The mission of HRIS is to provide technical assistant to Human Resources Division so that it meet Human Resources’ automation, data, records and information management requirements. 
It’s primary focus is on establishing integrated systems for the administration and deployment of strategic Human Resource information, programs, and services!
Focus on what matters Put an end to all the hassle. Stop shuffling paperwork.
Use your time to empower your employees, create a vision for the future, and make your organization more strategic and systematic with the support of Information Technology.
Kazi Software Solutions
PABX: +880-2-9827001 - 10 (Ext: 3610) 
Mobile: +88 01716 017 126, +88 01682 330 792
For more info, please visit our pages;
http://www.facebook.com/KaziSoftwareSolutions
http://kazisoftwaresolutions.weebly.com/
Email : kazi_shakawat@yahoo.com
NB: we help students by providing Source Codes for their thesis/project purpose.
// By: Kazi Md. Shakawat Hossain
//**************************************

Imports VB = Microsoft.VisualBasic
Imports System.Data.OleDb
Imports System.Drawing.Printing
Imports System.IO
Imports System.Globalization
Public Class frm_EmployeeMaster
Dim dSet As DataSet = New DataSet
Dim AllEmpDT As DataTable
Dim dsFillGrid As New DataSet
Dim provider As CultureInfo = CultureInfo.InvariantCulture
Dim Scharge As Integer
Dim TAmount As Double = 0
Dim TSalary As Double = 0
Dim FullID As String
Dim EmpNo As Integer
Dim EducationChange As Boolean = False
Dim DependantChange As Boolean = False
Dim EmpHistoryChange As Boolean = False
Dim SelectedColumn, SearchTable As String
Dim SearchColumn As String = "Full_Name"
Dim arrImage() As Byte
Dim strPhotoName As String'To store Selected Photo Name
Public ModeSet As String 'Add/Edit
' TO store employee no
Public RsOccupation As New DataSet 'Profession
Dim btnMode As String 'NEW/EDIT
Dim RsDegree As New DataSet 'Degree
Dim RsInstitute As New DataSet 'Institute
Dim RsBoard As New DataSet 'Board
Dim RsMajor As New DataSet 'Major
Dim RsTraining As New DataSet 'Training
Dim strSQL As String
Dim CheckPass As Boolean ' Checkdata
Dim Trans As SqlClient.SqlTransaction
Private Sub frm_EmployeeMaster_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call FillCmb()
DisableControls(Me)
End Sub
Sub FillCmb()
Try
'Function to fill a related combo's
Fill_cmbBox(0, "SELECT Desig_Code, Desig_Name FROM Desig_Master WHERE Status='Active' Order By Desig_Name ASC", cmb_Designation, "Desig_Code", "Desig_Name", -1)
' Fill_cmbBox(0, "SELECT SubDept_Code,SD_Name FROM Sub_Dept_Master WHERE Status='Active' ORDER BY SD_Name", cmb_SubDepartment, "SubDept_Code", "SD_Name", -1)
Fill_cmbBox(0, "SELECT Division_Code,Division_Name FROM Division_Master WHERE Status='Active' Order By Division_Name", cmb_Division, "Division_Code", "Division_Name", -1)
Fill_cmbBox(0, "SELECT Dept_Code,Dept_Name FROM Dept_Master WHERE Status='Active' Order By Dept_Name", cmb_Department, "Dept_Code", "Dept_Name", -1)
Fill_cmbBox(0, "SELECT G_Code,G_Name FROM Grade_Master WHERE Status='Active' Order By G_Name", cmb_Grade, "G_Code", "G_Name", -1)
'Fill_cmbBox(0, "SELECT DISTINCT Institute Name FROM Emp_Professional", cmb_InstituteName, "Institute Name", "Institute Name", -1)
Fill_cmbBox(0, "SELECT JL_Code, JL_Name FROM Job_Location_Master WHERE Status='Active' Order By JL_Name", cmb_Job_Location, "JL_Code", "JL_Name", -1)
'Fill_cmbBox(0, "SELECT Cat_Code,Cat_Name FROM Category_Master WHERE Status='A' Order By Cat_Name", cmb_Category, "Cat_Code", "Cat_Name", -1)
'Fill_cmbBox(0, "SELECT Religion_code, Religion_name from Religion_Master WHERE Status='A' ORDER BY Religion_Name", cmb_Religion, "Religion_code", "Religion_name", -1)
Fill_cmbBox(0, "SELECT DISTINCT Nationality FROM Emp_Personal ORDER BY Nationality", cmb_Country, "Natioality", "Nationality", -1)
'Fill_cmbBox(0, "SELECT Country_Code, Country_Name FROM Country_Master WHERE Status='A' ORDER BY Country_Name", cmb_PCountry, "Country_code", "Country_name", -1)
'Fill_cmbBox(0, "SELECT Emp_No FROM Replacement_Master WHERE R_Status='N' ORDER BY Emp_No", cmb_EID, "Emp_No", "Emp_No", -1)
Fill_cmbBox(0, "SELECT DISTINCT Degree_Name FROM Emp_Education ORDER BY Degree_Name", cmb_EDegree, "Degree_Name", "Degree_name", -1)
Fill_cmbBox(0, "SELECT DISTINCT Institute_Name FROM Emp_Education ORDER BY Institute_Name", cmb_EInstitute, "Institute_name", "Institute_Name", -1)
Fill_cmbBox(0, "SELECT DISTINCT Board_University FROM Emp_Education ORDER BY Board_University", cmb_EBoard, "Board_University", "Board_University", -1)
Fill_cmbBox(0, "SELECT DISTINCT Major_Area FROM Emp_Education ORDER BY Major_Area", cmb_EMajor, "Major_Area", "Major_Area", -1)
Fill_cmbBox(0, "SELECT Emp_Personal.Emp_No, Emp_Personal.Emp_No + ' - ' + Emp_Personal.Full_Name + ' - ' + Desig_Master.Desig_Name AS EmpInfo FROM Emp_Personal INNER JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No LEFT OUTER JOIN Desig_Master ON Emp_Professional.Desig_Code = Desig_Master.Desig_Code WHERE Emp_Professional.Status='Active' Order By Emp_Personal.Emp_No ASC", Me.cmb_Supervisor, "Emp_Personal.Emp_No", "EmpInfo", -1)
Fill_cmbBox(0, "SELECT Emp_Personal.Emp_No, Emp_Personal.Emp_No + ' - ' + Emp_Personal.Full_Name + ' - ' + Desig_Master.Desig_Name AS EmpInfo FROM Emp_Personal INNER JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No LEFT OUTER JOIN Desig_Master ON Emp_Professional.Desig_Code = Desig_Master.Desig_Code WHERE Emp_Professional.Status='Active' Order By Emp_Personal.Emp_No ASC", Me.cmb_Reviewer, "Emp_Personal.Emp_No", "EmpInfo", -1)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub txt_Emp_No_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt_Emp_No.KeyDown
If e.KeyCode = Keys.Enter Then
Call Emp()
End If
End Sub
Sub Emp()
'Try
If Trim(Me.txt_Emp_No.Text) = "" Then
Exit Sub
End If
Dim rsEmp As SqlClient.SqlDataReader
strSQL = "SELECT Emp_Professional.*, Emp_Personal.*, Division_Master.Division_Name, Dept_Master.Dept_Name, Desig_Master.Desig_Name, Grade_Master.G_Name, Emp_Financial.*, Job_Location_Master.JL_Name, Grade_Master.Service_Celling FROM Emp_Financial RIGHT OUTER JOIN Division_Master RIGHT OUTER JOIN Emp_Professional ON Division_Master.Division_Code = Emp_Professional.Division_Code LEFT OUTER JOIN Emp_Personal ON Emp_Professional.Emp_No = Emp_Personal.Emp_No LEFT OUTER JOIN Dept_Master ON Emp_Professional.Dept_Code = Dept_Master.Dept_Code LEFT OUTER JOIN Desig_Master ON Emp_Professional.Desig_Code = Desig_Master.Desig_Code LEFT OUTER JOIN Grade_Master ON Emp_Professional.G_Code = Grade_Master.G_Code ON Emp_Financial.Emp_No = Emp_Professional.Emp_No LEFT OUTER JOIN Job_Location_Master ON Emp_Professional.J_Code = Job_Location_Master.JL_Code WHERE Emp_Professional.Emp_No='" & Me.txt_Emp_No.Text & "'"
rsEmp = OpnDataReader(strSQL)
With rsEmp
.Read()
If Not .HasRows = True Then
MsgBox("Invalid Employee ID !", MsgBoxStyle.Critical + MsgBoxStyle.Information, "Wrong data")
.Close()
Exit Sub
End If
If (.Item("Status")) = "In-active" Then
If (MsgBox("This Associate has been " & (.Item("ROL")) & " w.e.f: " & Format((.Item("DOS")), "MMMM dd, yyyy") & " . Do you wish to see the information?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "Separated Associate !")) = MsgBoxResult.Cancel Then
Me.txt_Emp_No.Text = ""
.Close()
Exit Sub
End If
End If
EmpNo = Val(Me.txt_Emp_No.Text)
Me.cmb_Title.Text = CheckNull(.Item("Title"))
Me.txt_FirstName.Text = CheckNull(.Item("F_Name"))
Me.txt_MiddleName.Text = CheckNull(.Item("M_Name"))
Me.txt_LastName.Text = CheckNull(.Item("L_Name"))
Me.cmb_RType.Text = CheckNull(.Item("Relation"))
Me.txt_Gardian_Name.Text = CheckNull(.Item("Guardian_Name"))
Me.txt_Present_ALine1.Text = CheckNull(.Item("Present_ALine1"))
Me.txt_Present_Aline2.Text = CheckNull(.Item("Present_ALine2"))
Me.txt_Present_Phone.Text = CheckNull(.Item("Phone"))
Me.txt_Present_Mobile.Text = CheckNull(.Item("Mobile"))
Me.txt_PEmail.Text = CheckNull(.Item("EEmail"))
Me.txt_Permanent_ALine1.Text = CheckNull(.Item("Permanent_ALine1"))
Me.txt_Permanent_ALine2.Text = CheckNull(.Item("Permanent_ALine2"))
Me.txt_Permanent_Phone.Text = CheckNull(.Item("Phone_Resident"))
Me.txt_MDOB.Text = .Item("DOB")
Me.txt_MDOJ.Text = .Item("DOJ")
Me.cmb_Sex.Text = CheckNull(.Item("Sex"))
Me.cmb_Religion.Text = CheckNull(.Item("Religion"))
Me.cmb_Nationality.Text = CheckNull(.Item("Nationality"))
Me.cmb_Blood_Group.Text = CheckNull(.Item("Blood_Group"))
Me.cmb_Marital_Status.Text = CheckNull(.Item("Marital_Status"))
Me.txt_NationalID.Text = CheckNull(.Item("National_ID"))
Me.txt_ECName1.Text = CheckNull(.Item("ECName1"))
Me.txt_ECRelation1.Text = CheckNull(.Item("ECRelation1"))
Me.txt_ECAddress1.Text = CheckNull(.Item("ECAddress1"))
Me.txt_ECPhone1.Text = CheckNull(.Item("ECPhone1"))
Me.txt_ECMobile1.Text = CheckNull(.Item("ECMobile1"))
Me.txt_ECName2.Text = CheckNull(.Item("ECName2"))
Me.txt_ECRelation2.Text = CheckNull(.Item("ECRelation2"))
Me.txt_ECAddress2.Text = CheckNull(.Item("ECAddress2"))
Me.txt_ECPhone2.Text = CheckNull(.Item("ECPhone2"))
Me.txt_ECMobile2.Text = CheckNull(.Item("ECMobile2"))
Me.txt_SpouseName.Text = CheckNull(.Item("Spouse_Name"))
If Not IsDBNull(.Item("Annivarsery_Date")) Then
Me.txt_MADT.Text = (.Item("Annivarsery_Date"))
Else
Me.txt_MADT.Text = " / /"
End If
Me.txt_SpouseOccopation.Text = CheckNull(.Item("Spouse_Occupation"))
Me.cmb_Division.Text = CheckNull(.Item("Division_Name"))
Me.cmb_Department.Text = CheckNull(.Item("Dept_Name"))
' Me.cmb_SubDepartment.Text = CheckNull(.Item("SD_Name"))
Me.cmb_Designation.Text = CheckNull(.Item("Desig_Name"))
Me.cmb_Job_Location.Text = CheckNull(.Item("JL_Name"))
Me.cmb_Grade.Text = CheckNull(.Item("G_Name"))
Me.cmb_Category.Text = CheckNull(.Item("Category"))
Me.txt_Remarks.Text = CheckNull(.Item("Remarks"))
Me.cmb_JobStatus.Text = CheckNull(.Item("Job_Status"))
Me.txt_LockerNo.Text = CheckNull(.Item("Locker_No"))
Me.cmb_Supervisor.SelectedValue = CheckNull(.Item("Supervisor_ID"))
Me.cmb_Reviewer.SelectedValue = CheckNull(.Item("Reviewer_ID"))
Me.txt_Probation.Text = CheckNull(.Item("Prob"))
Me.cmb_Period.SelectedItem = CheckNull(.Item("P_Period"))
Me.cmb_Medical_Status.Text = CheckNull(.Item("M_Status"))
Me.txt_LCB.Text = CheckNull(.Item("Last_Changed_By"))
If Not IsDBNull(.Item("Last_Changed_Date")) Then
Me.txt_LCD.Text = CheckNull(Format(.Item("Last_Changed_Date"), "dddd, MMMM dd, yyyy hh:mm:ss tt"))
Else
Me.txt_LCD.Text = ""
End If
If Not IsDBNull(.Item("DOC")) Then
Me.txt_MDOC.Text = (.Item("DOC"))
Else
Me.txt_MDOC.Text = " / /"
End If
If Not IsDBNull(.Item("CED")) Then
Me.txt_MCED.Text = (.Item("CED"))
Else
Me.txt_MCED.Text = " / /"
End If
If Not IsDBNull(.Item("NCD")) Then
Me.txt_MNCD.Text = (.Item("NCD"))
Else
Me.txt_MNCD.Text = " / /"
End If
If Not IsDBNull(.Item("DOS")) Then
Me.txt_MDOS.Text = (.Item("DOS"))
Else
Me.txt_MDOS.Text = " / /"
End If
Me.cmb_InstituteName.Text = CheckNull(.Item("Institute_Name"))
Me.cmb_Separation_Reason.Text = CheckNull(.Item("ROL"))
Me.cmb_LE.Text = CheckNull(.Item("LE"))
Me.cmb_Staffof.Text = CheckNull(.Item("Staff_of"))
Me.cmb_Status.Text = CheckNull(.Item("Status"))
Me.txt_Basic.Text = CheckNull(.Item("Basic"))
Me.txt_HouseRent.Text = CheckNull(.Item("House_Rent"))
Me.txt_Conveyance.Text = CheckNull(.Item("Conveyance"))
Me.txt_FM.Text = CheckNull(.Item("Family_Medical"))
Me.txt_ServiceCharge.Text = CheckNull(.Item("Service_Charge"))
Me.txt_Percetage.Text = CheckNull(.Item("SC_Percentage"))
Me.txt_Aoincome.Text = CheckNull(.Item("Additional_Other_Income"))
'Me.txt_SCC.Text = CheckNull(.Item("Service_Celling"))
Me.txt_CHR.Text = CheckNull(.Item("Hourly_Rate"))
Me.txt_AccountNo.Text = CheckNull(.Item("Account_No"))
Me.txt_Contract.Text = CheckNull(.Item("Contract"))
Me.cmb_CPeriod.Text = CheckNull(.Item("C_Period"))
Me.chk_GShift.Checked = CheckNull(.Item("General_Shift"))
Me.chk_OT.Checked = CheckNull(.Item("Overtime"))
Me.chk_Uniform.Checked = CheckNull(.Item("Uniform"))
'Call calculation()
'Display_Photo
If Not IsDBNull(.Item("Emp_Photo")) Then
Me.pbx_EmpPhoto.Image = RetrieveImageDB(.Item("Emp_Photo"))
Else
Me.pbx_EmpPhoto.Image = Nothing
strPhotoName = ""
End If
rsEmp.Close()
End With
Me.dgv_Training.DataSource = Nothing
strSQL = "SELECT Emp_Training.Emp_No, Training_Master.Training_Code, Training_Master.Training_Name, CONVERT(Varchar,Emp_Training.From_Date,103) AS From_Date, CONVERT(Varchar,Emp_Training.To_Date,103) AS To_Date, Emp_Training.Duration, Emp_Training.Conducted_By, Emp_Training.Sponsored_By, Emp_Training.Certificate, Emp_Training.Credit_Points, Emp_Training.Remarks, Emp_Training.Status FROM Emp_Training INNER JOIN Training_Master ON Emp_Training.Training_Code = Training_Master.Training_Code WHERE Emp_Training.Status='Active' AND Emp_Training.Emp_No='" & Me.txt_Emp_No.Text & "' ORDER BY From_Date DESC"
dSet = OpnDataSet(strSQL)
Me.dgv_Training.AutoGenerateColumns = False
Me.dgv_Training.DataSource = dSet.Tables(0)
Me.col_TCode.DataPropertyName = "Training_Code"
Me.col_TPName.DataPropertyName = "Training_Name"
Me.col_TFD.DataPropertyName = "From_Date"
Me.col_TTD.DataPropertyName = "To_Date"
Me.Col_TDuration.DataPropertyName = "Duration"
Me.col_TConducted_by.DataPropertyName = "Conducted_By"
Me.col_TSponsored_By.DataPropertyName = "Sponsored_By"
Me.col_TCredit_Points.DataPropertyName = "Credit_Points"
Me.col_TCertified.DataPropertyName = "Certificate"
Me.dgv_FinancialHistory.DataSource = Nothing
strSQL = "SELECT * FROM Financial_History WHERE Status='Active' AND Emp_No='" & Me.txt_Emp_No.Text & "' ORDER BY Effective_Date DESC"
dSet = OpnDataSet(strSQL)
Me.dgv_FinancialHistory.DataSource = dSet.Tables(0)
strSQL = "SELECT Emp_Financial.*, Emp_Professional.Status FROM Emp_Professional LEFT OUTER JOIN Emp_Financial ON Emp_Professional.Emp_No =Emp_Financial.Emp_No WHERE Emp_Professional.Emp_No='" & Me.txt_Emp_No.Text & "'"
dSet = OpnDataSet(strSQL)
Me.cmb_PaymentBy.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Payment_By"))
Me.cmb_BankName.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Bank_Name"))
Me.txt_AccountNo.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Account_No"))
Me.txt_CHR.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Hourly_Rate"))
If CheckNull(dSet.Tables(0).Rows(0).Item("Salary_Stop")).ToString = "True" Then
Me.chk_SalaryStop.Checked = True
Else
Me.chk_SalaryStop.Checked = False
End If
Me.txt_SSReason.Text = CheckNull(dSet.Tables(0).Rows(0).Item("SS_Reason"))
If Not IsDBNull(dSet.Tables(0).Rows(0).Item("Salary_Stop_Month")) Then
Me.dtp_SSMonth.Value = dSet.Tables(0).Rows(0).Item("Salary_Stop_Month")
End If
Me.txt_SSReason.Text = CheckNull(dSet.Tables(0).Rows(0).Item("SS_Reason"))
Me.txt_Basic.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Basic"))
Me.txt_HouseRent.Text = CheckNull(dSet.Tables(0).Rows(0).Item("House_Rent"))
Me.txt_Conveyance.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Conveyance"))
Me.txt_FM.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Family_Medical"))
Me.txt_Aoincome.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Additional_Other_Income"))
Me.txt_SCC.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Service_Charge"))
Me.txt_Percentage.Text = CheckNull(dSet.Tables(0).Rows(0).Item("SC_Percentage"))
Me.cmb_Currency.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Salary_Currency"))
Me.txt_TotalSalary.Text = Format(Val(Me.txt_Basic.Text) + Val(Me.txt_HouseRent.Text) + Val(Me.txt_Conveyance.Text) + Val(Me.txt_FM.Text), "#######0.00")
Me.txt_GrossSalary.Text = Format(Val(Me.txt_TotalSalary.Text) + Val(Me.txt_Aoincome.Text) + Val(Me.txt_SCC.Text), "#######0.00")
Me.txt_Remarks.Text = CheckNull(dSet.Tables(0).Rows(0).Item("Remarks"))
strSQL = "SELECT * FROM Emp_Education WHERE Emp_No='" & Me.txt_Emp_No.Text & "' AND EStatus='Active' ORDER BY Passing_Year DESC"
dSet = OpnDataSetWN(strSQL, "EmpEducation", Trans)
If dSet.Tables("EmpEducation").Rows.Count > 0 Then
For r As Integer = 0 To dSet.Tables("EmpEducation").Rows.Count - 1
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("ECode")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Degree_Name")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Institute_Name")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Board_University")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Passing_Year")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Major_Area")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("Div_Grade")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("EmpEducation").Rows(r).Item("EStatus")
dgvRow.Cells.Add(dgvCell)
Me.dgv_Education.Rows.Add(dgvRow)
Next
End If
dSet.Tables.Remove("EmpEducation")
strSQL = "SELECT * FROM Dependant_Master WHERE Emp_No='" & Me.txt_Emp_No.Text & "' AND DStatus='Active' ORDER BY Code ASC"
dSet = OpnDataSetWN(strSQL, "Dependant", Trans)
If dSet.Tables("Dependant").Rows.Count > 0 Then
For r As Integer = 0 To dSet.Tables("Dependant").Rows.Count - 1
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("Code")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("DName")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("DRelation")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("DDOB")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("DOccupation")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Dependant").Rows(r).Item("DStatus")
dgvRow.Cells.Add(dgvCell)
Me.dgv_Dependant.Rows.Add(dgvRow)
Next
End If
dSet.Tables.Remove("Dependant")
strSQL = "SELECT * FROM Employment_Records WHERE Emp_No='" & Me.txt_Emp_No.Text & "' AND PStatus='Active' ORDER BY From_Date DESC"
dSet = OpnDataSetWN(strSQL, "Employment", Trans)
If dSet.Tables("Employment").Rows.Count > 0 Then
For r As Integer = 0 To dSet.Tables("Employment").Rows.Count - 1
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("PCode")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("Organization_Name")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("Position_Held")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("From_Date")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("To_Date")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("Left_Reason")
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = dSet.Tables("Employment").Rows(r).Item("PStatus")
dgvRow.Cells.Add(dgvCell)
Me.dgv_EmpHistory.Rows.Add(dgvRow)
Next
End If
dSet.Tables.Remove("Employment")
Me.dgv_Dependant.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Me.dgv_Education.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Me.dgv_Emp.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Me.dgv_EmpHistory.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Me.dgv_Training.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Me.txt_Emp_No.Enabled = False
' Catch ex As Exception
'MsgBox(ex.Message)
'End Try
End Sub
Public Function RetrieveImageDB(ByRef img As Byte()) As Image
Dim ms As New System.IO.MemoryStream(img)
RetrieveImageDB = System.Drawing.Image.FromStream(ms)
ms.Close()
End Function
Private Function CheckData() As Boolean
CheckData = False
If Trim(Me.cmb_Title.Text) = "" Then
MsgBox("Employee Title can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Title.Focus()
Exit Function
End If
If Trim(Me.txt_FirstName.Text) = "" And Trim(Me.txt_MiddleName.Text) = "" And Trim(Me.txt_LastName.Text) = "" Then
MsgBox("Employee Name can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.txt_FirstName.Focus()
Exit Function
End If
If Trim(Me.cmb_Religion.Text) = "" Then
MsgBox("Employee Religion can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Religion.Focus()
Exit Function
End If
If Trim(Me.cmb_Sex.Text) = "" Then
MsgBox("Employee Sex can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Sex.Focus()
Exit Function
End If
If Trim(Me.cmb_Marital_Status.Text) = "" Then
MsgBox("Employee Marital Status can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Marital_Status.Focus()
Exit Function
End If
If Me.txt_MDOB.Text = " / /" Then
MsgBox("Employee Date of birth can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.txt_MDOB.Focus()
Exit Function
End If
If Me.txt_MDOJ.Text = " / /" Then
MsgBox("Employee Joining Date can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.txt_MDOJ.Focus()
Exit Function
End If
If Trim(Me.cmb_Designation.Text) = "" Then
MsgBox("Employee Designation can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Designation.Focus()
Exit Function
End If
If Trim(Me.cmb_Category.Text) = "" Then
MsgBox("Employee Category can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Category.Focus()
Exit Function
End If
If Trim(Me.cmb_Grade.Text) = "" Then
MsgBox("Employee Grade can not be blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Grade.Focus()
Exit Function
End If
If Trim(Me.cmb_Division.Text) = "" Then
MsgBox("Employee Division can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Division.Focus()
Exit Function
End If
If Trim(Me.cmb_Department.Text) = "" Then
MsgBox("Employee Department can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Department.Focus()
Exit Function
End If
'If Trim(Me.cmb_SubDepartment.Text) = "" Then
'MsgBox("Employee Section can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
'Me.cmb_SubDepartment.Focus()
'Exit Function
'End If
If Trim(Me.cmb_Job_Location.Text) = "" Then
MsgBox("Employee Job Location can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.cmb_Job_Location.Focus()
Exit Function
End If
If Trim(Me.cmb_Category.Text) = "Casual" Then
If Val(Me.txt_CHR.Text) <= 0 Then
MsgBox("Casual working hour rate can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.txt_CHR.Focus()
Exit Function
End If
End If
If Trim(Me.cmb_Status.Text) = "" Then
MsgBox("Employee Status can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tbc_OtherDetails.Select()
Me.cmb_Status.Focus()
Exit Function
ElseIf Trim(Me.cmb_Status.Text) = "Active" Then
If Me.txt_MDOS.Text <> " / /" Then
MsgBox("Separation date should be blank when Status is Active", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tbc_OtherDetails.Select()
Me.txt_MDOS.Focus()
Exit Function
ElseIf Trim(Me.cmb_Separation_Reason.Text) <> "" Then
MsgBox("Separation reason should be blank when Status is Active", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tbc_OtherDetails.Select()
Me.cmb_Separation_Reason.Focus()
Exit Function
End If
ElseIf Trim(Me.cmb_Status.Text) = "In-active" Then
If Me.txt_MDOS.Text = " / /" Then
MsgBox("Separation Date can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tbc_OtherDetails.Select()
Me.txt_MDOS.Focus()
Exit Function
ElseIf Trim(Me.cmb_Separation_Reason.Text) = "" Then
MsgBox("Separation Reason can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tbc_OtherDetails.Select()
Me.cmb_Separation_Reason.Focus()
Exit Function
End If
End If
If Trim(Me.cmb_Supervisor.Text) = "" Then
MsgBox("Employee Supervisor can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tOtherDetails.Select()
Me.cmb_Supervisor.Focus()
Exit Function
End If
If Trim(Me.cmb_Reviewer.Text) = "" Then
MsgBox("Employee Reviewer can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tOtherDetails.Select()
Me.cmb_Reviewer.Focus()
Exit Function
End If
If Trim(Me.cmb_LE.Text) = "" Then
MsgBox("Employee Sourcing can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
Me.tOtherDetails.Select()
Me.cmb_LE.Focus()
Exit Function
End If
'If Me.cmb_Category.Text = "Permanent" Then
'If Me.txt_MDOC.Text = " / /" Then
'MsgBox("Confirmation Date can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
'Me.txt_MDOS.Focus()
' Exit Function
' End If
' If Trim(Me.cmb_JobStatus.Text) = "" Then
' MsgBox("Employee Job Status can not be blank", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
' Me.tOtherDetails.Select()
' Me.cmb_JobStatus.Focus()
' Exit Function
' End If
' End If
'If btnMode = "NEW" Then
'If Me.rb_New.Checked = False And Me.rb_Replament.Checked = Falase Then
'MsgBox("Is this new position or replacement, please check.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
'Me.tbc_OtherDetails.Focus()
'Me.rb_Replament.Focus()
'Exit Function
'ElseIf Me.rb_Replament.Checked = True Then
'If Me.cmb_EID.Text = "" Then
'MsgBox("Replacement employee name can not blank.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Blank field")
'Me.tbc_OtherDetails.Focus()
'Me.cmb_EID.Focus()
'Exit Function
'End If
'End If
'End If
CheckData = True
End Function
Private Sub Save_Photo(ByRef StrRegNo As String)
Try
Dim strSQL As String = "SET DATEFORMAT DMY UPDATE Emp_Personal SET Emp_Photo = @Picture WHERE Emp_No = '" & Me.txt_Emp_No.Text & "'"
Dim cmdTemp As New SqlClient.SqlCommand
Dim prm1 As New SqlClient.SqlParameter
With cmdTemp
.Connection = ConConnect
.CommandType = System.Data.CommandType.Text
.CommandText = strSQL
prm1 = .Parameters.Add("@Picture", SqlDbType.Image)
prm1.Value = arrImage
prm1.Direction = ParameterDirection.Input
.ExecuteNonQuery()
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub dgv_Training_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_Training.CellEndEdit
If Not Me.dgv_Training.CurrentCell.ToString = Me.dgv_Training.CurrentRow.Cells(10).ToString Or Me.dgv_Training.CurrentCell.ToString = Me.dgv_Training.CurrentRow.Cells(8).ToString Then
System.Windows.Forms.SendKeys.Send("{Enter}")
End If
End Sub
Private Sub cmd_Browse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Browse.Click
Try
Me.OpenFileDialog1.Filter = "JPG Files(*.JPG)|*.JPG|JPEG Files(*.JPEG)|*.JPEG|BITMAP FILES (*.BMP)|*.BMP"
Me.OpenFileDialog1.ShowDialog()
If Trim(Me.OpenFileDialog1.FileName) = Space(0) Then
Exit Sub
End If
strPhotoName = Me.OpenFileDialog1.FileName
Me.pbx_EmpPhoto.Image = Me.pbx_EmpPhoto.Image.FromFile(strPhotoName)
Dim ms As New System.IO.MemoryStream
Me.pbx_EmpPhoto.Image.Save(ms, Me.pbx_EmpPhoto.Image.RawFormat)
arrImage = ms.GetBuffer
ms.Close()
Exit Sub
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub txt_MDOC_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MDOC.LostFocus
DateValidation(Me.txt_MDOC)
End Sub
Private Sub txt_MCED_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MCED.LostFocus
DateValidation(Me.txt_MCED)
End Sub
Private Sub txt_MDOS_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MDOS.LostFocus
DateValidation(Me.txt_MDOS)
End Sub
Public Sub btnNew_Click()
'Fill_cmbBox(0, "SELECT Emp_No FROM Replacement_Master WHERE R_Status='N' ORDER BY Emp_No", cmb_EID, "Emp_No", "Emp_No", -1)
EnableControls(Me)
Me.txt_Emp_No.Enabled = False
btnMode = "NEW"
Call ClearContent()
Me.dgv_Education.Rows.Clear()
Me.dgv_EmpHistory.Rows.Clear()
Me.dgv_Dependant.Rows.Clear()
Me.rb_New.Checked = True
Me.cmb_Status.SelectedIndex = 0
Me.cmb_Status.Enabled = False
End Sub
Sub ClearContent()
Me.dgv_Education.Rows.Clear()
Call FillCmb()
For Each ctl As Control In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
ElseIf TypeOf ctl Is ComboBox Then
ctl.Text = ""
ElseIf TypeOf ctl Is MaskedTextBox Then
ctl.Text = " / /"
End If
Next
Me.cmb_Sex.SelectedIndex = -1
Me.cmb_Blood_Group.SelectedIndex = -1
Me.cmb_Medical_Status.SelectedIndex = -1
Me.cmb_Period.SelectedIndex = -1
Me.cmb_LE.SelectedIndex = -1
Me.cmb_Staffof.SelectedIndex = -1
Me.cmb_Separation_Reason.SelectedIndex = -1
Me.cmb_Status.SelectedIndex = -1
Me.cmb_Supervisor.SelectedIndex = -1
Me.cmb_Reviewer.SelectedIndex = -1
Me.txt_Probation.Text = "6"
Me.cmb_Period.SelectedIndex = 1
Me.txt_MDOS.Text = " / /"
Me.chk_GShift.Checked = False
Me.chk_OT.Checked = False
Me.chk_Replace.Checked = False
Me.chk_Uniform.Checked = False
Me.pbx_EmpPhoto.Image = Nothing
Me.cmb_EID.SelectedIndex = -1
Me.txt_Designation.Text = ""
Me.txt_FullName.Text = ""
Me.txt_OldDOS.Text = ""
Me.cmb_Religion.SelectedIndex = -1
Me.cmb_Marital_Status.SelectedIndex = -1
Me.cmb_Category.SelectedIndex = -1
Me.cmb_InstituteName.SelectedIndex = -1
Me.cmb_Title.SelectedIndex = -1
Me.txt_AccountNo.Text = ""
Me.txt_TotalSalary.Text = "0.00"
Me.txt_GrossSalary.Text = "0.00"
Me.txt_Basic.Text = "0.00"
Me.txt_HouseRent.Text = "0.00"
Me.txt_Conveyance.Text = "0.00"
Me.txt_FM.Text = "0.00"
Me.txt_Aoincome.Text = "0.00"
Me.txt_Percetage.Text = "0.00"
Me.txt_ServiceCharge.Text = "0.00"
Me.txt_SCC.Text = "0.00"
Me.txt_CHR.Text = ""
Me.txt_Remarks.Text = ""
Me.dgv_FinancialHistory.DataSource = Nothing
Me.txt_Present_ALine1.Text = ""
Me.txt_Present_Aline2.Text = ""
Me.txt_Present_Mobile.Text = ""
Me.txt_Present_Phone.Text = ""
Me.txt_PEmail.Text = ""
Me.txt_Permanent_ALine1.Text = ""
Me.txt_Permanent_ALine2.Text = ""
Me.txt_Permanent_Phone.Text = ""
Me.txt_Contract.Text = ""
Me.cmb_CPeriod.SelectedIndex = -1
Me.txt_Probation.Text = ""
Me.cmb_Period.SelectedIndex = -1
Me.txt_Remarks.Text = ""
Me.cmb_Job_Location.SelectedIndex = -1
' Me.cmb_SubDepartment.SelectedIndex = -1
Me.cmb_JobStatus.SelectedIndex = -1
Me.cmb_CPeriod.SelectedIndex = -1
Me.cmb_Medical_Status.SelectedIndex = -1
Me.txt_ECRelation1.Text = ""
Me.txt_ECAddress1.Text = ""
Me.txt_ECPhone1.Text = ""
Me.txt_ECMobile1.Text = ""
Me.txt_ECName2.Text = ""
Me.txt_ECRelation2.Text = ""
Me.txt_ECAddress2.Text = ""
Me.txt_ECPhone2.Text = ""
Me.txt_ECMobile2.Text = ""
Me.txt_SpouseName.Text = ""
Me.txt_MADT.Text = " / /"
Me.txt_SpouseOccopation.Text = ""
Me.txt_DependantName.Text = ""
Me.cmb_DRelation.SelectedIndex = -1
Me.txt_MDDOB.Text = " / /"
Me.cmb_DOccupation.SelectedIndex = -1
Me.cmb_DStatus.SelectedIndex = 0
Me.dgv_Dependant.DataSource = Nothing
Me.cmb_EBoard.SelectedIndex = -1
Me.cmb_EDegree.SelectedIndex = -1
Me.cmb_EInstitute.SelectedIndex = -1
Me.cmb_EYear.SelectedIndex = -1
Me.cmb_EMajor.SelectedIndex = -1
Me.txt_EDiv.Text = ""
Me.cmb_EStatus.SelectedIndex = 0
Me.dgv_Education.DataSource = Nothing
Me.txt_Organization.Text = ""
Me.txt_Position.Text = ""
Me.txt_MPFD.Text = " / /"
Me.txt_MPTD.Text = " / /"
Me.txt_LeavingReason.Text = ""
Me.dgv_EmpHistory.DataSource = Nothing
Me.txt_LockerNo.Text = ""
Me.cmb_Nationality.Text = "Bangladeshi"
Me.cmb_Medical_Status.Text = "Fit"
Me.txt_LCB.Text = ""
Me.txt_LCD.Text = ""
Me.chk_GShift.Checked = False
Me.chk_OT.Checked = False
Me.chk_Uniform.Checked = False
EducationChange = False
' dSet.Tables.Clear()
Me.pbx_EmpPhoto.Image = Nothing
strPhotoName = ""
Me.dgv_Training.DataSource = Nothing
Me.cmb_Title.Focus()
Me.pbx_EmpPhoto.Image = Nothing
End Sub
Public Sub btnEdit_Click()
EnableControls(Me)
Me.txt_Emp_No.Enabled = True
btnMode = "EDIT"
Call ClearContent()
Me.dgv_Education.Rows.Clear()
Me.dgv_Dependant.Rows.Clear()
Me.dgv_EmpHistory.Rows.Clear()
Me.rb_New.Checked = False
Me.rb_Replament.Checked = False
'Fill_cmbBox(0, "SELECT Emp_No FROM Replacement_Master ORDER BY Emp_No", cmb_EID, "Emp_No", "Emp_No", -1)
' Me.gb_JoiningSource.Enabled = False
Me.cmb_Status.Enabled = True
Me.txt_Emp_No.Focus()
End Sub
Public Sub btnSave_Click()
If CheckData() = False Then 'If Data is not Correct then Exit
Exit Sub
End If
Dim FullID As String = ""
Dim EmpNo As Integer = 0
Dim TDT As DateTime = GetServerDateTime()
Select Case btnMode
Case Is = "NEW"
If Me.cmb_Category.Text = "" Then
MsgBox("Please select employee category to proceed!!!", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Blank Info")
Me.cmb_Category.Focus()
Exit Sub
End If
If MsgBox("Are you sure to save the record?", MsgBoxStyle.Question + MsgBoxStyle.OkCancel, "Confirmation") = MsgBoxResult.Cancel Then
Exit Sub
End If
If Me.cmb_Category.SelectedIndex = 0 Then
EmpNo = Val(Find_Value2("SELECT MAX(Emp_No) FROM Emp_Professional WHERE Emp_Professional.Category='Permanent'", Trans))
If EmpNo = Nothing Then
EmpNo = 1
Else
EmpNo = EmpNo + 1
FullID = Format(EmpNo, "0###")
End If
ElseIf Me.cmb_Category.SelectedIndex = 1 Then
EmpNo = Val(Find_Value2("SELECT MAX(Emp_No) FROM Emp_Professional WHERE Emp_Professional.Category='Contractual'", Trans))
If EmpNo = Nothing Then
EmpNo = 1
FullID = 7001
Else
EmpNo = EmpNo + 1
FullID = EmpNo
End If
ElseIf Me.cmb_Category.SelectedIndex = 2 Then
EmpNo = Val(Find_Value2("SELECT MAX(Emp_No) FROM Emp_Professional WHERE Emp_Professional.Category='Casual'", Trans))
If EmpNo = Nothing Then
EmpNo = 9000
FullID = 9000
Else
EmpNo = EmpNo + 1
FullID = EmpNo
End If
ElseIf Me.cmb_Category.SelectedIndex = 3 Then
EmpNo = Val(Find_Value2("SELECT MAX(CONVERT(int, Right(Emp_No,4))) FROM Emp_Professional WHERE Emp_Professional.Category='Trainee'", Trans))
If EmpNo = Nothing Then
EmpNo = "1"
FullID = "T-0001"
Else
EmpNo = EmpNo + 1
FullID = "T-" & Format(EmpNo, "00##")
End If
End If
Dim FullName As String = ""
If Trim(Me.txt_FirstName.Text) = "" Then
FullName = FullName
Else
FullName = Me.txt_FirstName.Text
End If
If Trim(Me.txt_MiddleName.Text) = "" Then
FullName = FullName
Else
FullName = FullName & " " & Me.txt_MiddleName.Text
End If
If Trim(Me.txt_LastName.Text) = "" Then
FullName = FullName
Else
FullName = FullName & " " & Me.txt_LastName.Text
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Emp_Personal(Emp_No, Title, F_Name, M_Name, L_Name, Full_Name"
strSQL = strSQL & ", Relation, Guardian_Name, Present_ALine1, Present_ALine2, Phone, Mobile, EEmail"
strSQL = strSQL & ", Permanent_Aline1, Permanent_ALine2, Phone_Resident, DOB, Sex, Religion, Nationality"
strSQL = strSQL & ", Blood_Group, Marital_Status, National_ID, ECName1, ECRelation1, ECAddress1, ECPhone1, ECMobile1"
strSQL = strSQL & ", ECName2, ECRelation2, ECAddress2, ECPhone2, ECMobile2, Spouse_Name, Annivarsery_Date, Spouse_Occupation)"
strSQL = strSQL & " VALUES ("
strSQL = strSQL & "'" & FullID & "'"
strSQL = strSQL & "," & IIf(Me.cmb_Title.Text = "", "Null", "'" & Me.cmb_Title.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_FirstName.Text = "", "Null", "'" & Trim(Me.txt_FirstName.Text) & "'")
strSQL = strSQL & "," & IIf(Me.txt_MiddleName.Text = "", "Null", "'" & Trim(Me.txt_MiddleName.Text) & "'")
strSQL = strSQL & "," & IIf(Me.txt_LastName.Text = "", "Null", "'" & Trim(Me.txt_LastName.Text) & "'")
strSQL = strSQL & "," & IIf(FullName = "", "Null", "'" & Trim(FullName) & "'")
strSQL = strSQL & "," & IIf(Me.cmb_RType.Text = "", "Null", "'" & Me.cmb_RType.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Gardian_Name.Text = "", "Null", "'" & Me.txt_Gardian_Name.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Present_ALine1.Text = "", "Null", "'" & Me.txt_Present_ALine1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Present_Aline2.Text = "", "Null", "'" & Me.txt_Present_Aline2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Present_Phone.Text = "", "Null", "'" & Me.txt_Present_Phone.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Present_Mobile.Text = "", "Null", "'" & Me.txt_Present_Mobile.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_PEmail.Text = "", "Null", "'" & Me.txt_PEmail.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Permanent_ALine1.Text = "", "Null", "'" & Me.txt_Permanent_ALine1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Permanent_ALine2.Text = "", "Null", "'" & Me.txt_Permanent_ALine2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_Permanent_Phone.Text = "", "Null", "'" & Me.txt_Permanent_Phone.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_MDOB.Text = " / /", "Null", "'" & Me.txt_MDOB.Text & "'")
strSQL = strSQL & "," & IIf(Me.cmb_Sex.Text = "", "Null", "'" & Me.cmb_Sex.Text & "'")
strSQL = strSQL & "," & IIf(Me.cmb_Religion.Text = "", "Null", "'" & Me.cmb_Religion.Text & "'")
strSQL = strSQL & "," & IIf(Me.cmb_Nationality.Text = "", "Null", "'" & Me.cmb_Nationality.Text & "'")
strSQL = strSQL & "," & IIf(Me.cmb_Blood_Group.Text = "", "Null", "'" & Me.cmb_Blood_Group.Text & "'")
strSQL = strSQL & "," & IIf(Me.cmb_Marital_Status.Text = "", "Null", "'" & Me.cmb_Marital_Status.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_NationalID.Text = "", "Null", "'" & Me.txt_NationalID.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECName1.Text = "", "Null", "'" & Me.txt_ECName1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECRelation1.Text = "", "Null", "'" & Me.txt_ECRelation1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECAddress1.Text = "", "Null", "'" & Me.txt_ECAddress1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECPhone1.Text = "", "Null", "'" & Me.txt_ECPhone1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECMobile1.Text = "", "Null", "'" & Me.txt_ECMobile1.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECName2.Text = "", "Null", "'" & Me.txt_ECName2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECRelation2.Text = "", "Null", "'" & Me.txt_ECRelation2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECAddress2.Text = "", "Null", "'" & Me.txt_ECAddress2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECPhone2.Text = "", "Null", "'" & Me.txt_ECPhone2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_ECMobile2.Text = "", "Null", "'" & Me.txt_ECMobile2.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_SpouseName.Text = "", "Null", "'" & Me.txt_SpouseName.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_MADT.Text = " / /", "Null", "'" & Me.txt_MADT.Text & "'")
strSQL = strSQL & "," & IIf(Me.txt_SpouseOccopation.Text = "", "Null", "'" & Me.txt_SpouseOccopation.Text & "'") & ")"
ExecSqlStatement(strSQL, Trans)
strSQL = "SET DATEFORMAT DMY INSERT INTO Emp_Professional(Emp_No, Division_Code, Dept_Code, Desig_Code, J_Code, G_Code, DOJ, DOC, NCD, CED,DOS,Category, Supervisor_ID, Reviewer_ID, LE, Job_Status"
strSQL = strSQL & ", Locker_No, Contract, C_Period, Prob, P_Period, M_Status, Staff_of, Institute_Name, ROL, Remarks, General_Shift, Overtime, Uniform, Status, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ("
strSQL = strSQL & "'" & FullID & "'"
strSQL = strSQL & ", " & IIf(Me.cmb_Division.Text = "", "Null", "" & Me.cmb_Division.SelectedValue & "")
strSQL = strSQL & ", " & IIf(Me.cmb_Department.Text = "", "Null", "" & Me.cmb_Department.SelectedValue & "")
strSQL = strSQL & ", " & IIf(Me.cmb_Designation.Text = "", "Null", "" & Me.cmb_Designation.SelectedValue & "")
strSQL = strSQL & ", " & IIf(Me.cmb_Job_Location.Text = "", "Null", "" & Me.cmb_Job_Location.SelectedValue & "")
'strSQL = strSQL & ", " & IIf(Me.cmb_SubDepartment.Text = "", "Null", "" & Me.cmb_SubDepartment.SelectedValue & "")
strSQL = strSQL & ", " & IIf(Me.cmb_Grade.Text = "", "Null", "" & Me.cmb_Grade.SelectedValue & "")
strSQL = strSQL & ", " & IIf(Me.txt_MDOJ.Text = " / /", "Null", "'" & Me.txt_MDOJ.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_MDOC.Text = " / /", "Null", "'" & Me.txt_MDOC.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_MNCD.Text = " / /", "Null", "'" & Me.txt_MNCD.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_MCED.Text = " / /", "Null", "'" & Me.txt_MCED.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_MDOS.Text = " / /", "Null", "'" & Me.txt_MDOS.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Category.Text = "", "Null", "'" & Me.cmb_Category.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Supervisor.Text = "", "Null", "'" & Me.cmb_Supervisor.SelectedValue & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Reviewer.Text = "", "Null", "'" & Me.cmb_Reviewer.SelectedValue & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_LE.Text = "", "Null", "'" & Me.cmb_LE.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_JobStatus.Text = "", "Null", "'" & Me.cmb_JobStatus.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_LockerNo.Text = "", "Null", "'" & Me.txt_LockerNo.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_Contract.Text = "", "Null", "" & Me.txt_Contract.Text & "")
strSQL = strSQL & ", " & IIf(Me.cmb_CPeriod.Text = "", "Null", "'" & Me.cmb_CPeriod.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_Probation.Text = "", "Null", "" & Me.txt_Probation.Text & "")
strSQL = strSQL & ", " & IIf(Me.cmb_Period.Text = "", "Null", "'" & Me.cmb_Period.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Medical_Status.Text = "", "Null", "'" & Me.cmb_Medical_Status.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Staffof.Text = "", "Null", "'" & Me.cmb_Staffof.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_InstituteName.Text = "", "Null", "'" & Me.cmb_InstituteName.Text & "'")
strSQL = strSQL & ", " & IIf(Me.cmb_Separation_Reason.Text = "", "Null", "'" & Me.cmb_Separation_Reason.Text & "'")
strSQL = strSQL & ", " & IIf(Me.txt_Remarks.Text = "", "Null", "'" & Me.txt_Remarks.Text & "'")
strSQL = strSQL & ", " & IIf(Me.chk_GShift.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", " & IIf(Me.chk_OT.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", " & IIf(Me.chk_Uniform.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", " & IIf(Me.cmb_Status.Text = "", "Null", "'" & Me.cmb_Status.Text & "'")
strSQL = strSQL & ",'" & UserID & "'"
strSQL = strSQL & ",'" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
strSQL = "SET DATEFORMAT DMY INSERT INTO Emp_Financial(Emp_No, Grade_Code, Case_of, Effective_Date, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ("
strSQL = strSQL & "'" & FullID & "'"
strSQL = strSQL & ", " & IIf(Me.cmb_Grade.SelectedIndex = -1, "Null", "" & Me.cmb_Grade.SelectedValue & "")
strSQL = strSQL & ", 'New Joining'"
strSQL = strSQL & ", " & IIf(Me.txt_MDOJ.Text = " / /", "Null", "'" & Me.txt_MDOJ.Text & "'")
strSQL = strSQL & ", '" & UserID & "'," & "'" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
Me.txt_Emp_No.Text = FullID
Dim Ucode As Integer = Find_Value2("SELECT MAX(User_No) FROM User_Master", Trans)
If Ucode = Nothing Then
Ucode = 1
Else
Ucode = Ucode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO User_Master(User_No, Emp_No, User_Group, U_Password, Status"
strSQL = strSQL & ", Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES (" & Ucode & ""
strSQL = strSQL & "," & IIf(Me.txt_Emp_No.Text = "", "Null", "'" & Me.txt_Emp_No.Text & "'")
strSQL = strSQL & ", 7"
strSQL = strSQL & "," & IIf(Me.txt_Emp_No.Text = "", "Null", "'" & Me.txt_Emp_No.Text & "'")
strSQL = strSQL & ", 'Active'"
strSQL = strSQL & ",'" & UserID & "'"
strSQL = strSQL & ",'" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
For i As Integer = 0 To Me.dgv_Education.Rows.Count - 1
If Me.dgv_Education.Item(0, i).Value.ToString = "" Then
Dim Ecode As Integer = Val(Find_Value2("SELECT MAX(ECode) FROM Emp_Education", Trans))
If Ecode = Nothing Then
Ecode = 1
Else
Ecode = Ecode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Emp_Education (Emp_No, Ecode, Degree_Name, Institute_Name, Board_University, Passing_Year, Major_Area, Div_Grade, EStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & Ecode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(1, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(2, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(3, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(4, i).Value.ToString = "", "null", "" & Me.dgv_Education.Item(4, i).Value.ToString & "")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(5, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(6, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(6, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(7, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(7, i).Value.ToString & "'")
strSQL = strSQL & ",'" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
For i As Integer = 0 To Me.dgv_Dependant.Rows.Count - 1
If Me.dgv_Dependant.Item(0, i).Value.ToString = "" Then
Dim Dcode As Integer = Val(Find_Value2("SELECT MAX(Code) FROM Dependant_Master", Trans))
If Dcode = Nothing Then
Dcode = 1
Else
Dcode = Dcode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Dependant_Master (Emp_No, Code, DName, DRelation, DDOB, DOccupation, DStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & Dcode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(1, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(2, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(3, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(4, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(4, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(5, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ",'" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
For i As Integer = 0 To Me.dgv_EmpHistory.Rows.Count - 1
If Me.dgv_EmpHistory.Item(0, i).Value.ToString = "" Then
Dim EHcode As Integer = Val(Find_Value2("SELECT MAX(PCode) FROM Employment_Records", Trans))
If EHcode = Nothing Then
EHcode = 1
Else
EHcode = EHcode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Employment_Records (Emp_No, PCode, Organization_Name, Position_Held, From_Date, To_Date, Left_Reason, PStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & EHcode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(1, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(2, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(3, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(4, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(4, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(5, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ", 'Active', '" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
MsgBox("Informaton entered into the system successfully.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Confirmation")
DisableControls(Me)
If Trim(strPhotoName) <> Space(0) Then 'Update Employee Photo
Save_Photo(Trim(EmpNo))
End If
Case Is = "EDIT"
' Try
If MsgBox("Are you sure to update the record?", MsgBoxStyle.Question + MsgBoxStyle.OkCancel, "Confirmation") = MsgBoxResult.Cancel Then
Exit Sub
End If
Dim FullName As String = ""
If Trim(Me.txt_FirstName.Text) = "" Then
FullName = FullName
Else
FullName = Me.txt_FirstName.Text
End If
If Trim(Me.txt_MiddleName.Text) = "" Then
FullName = FullName
Else
FullName = FullName & " " & Me.txt_MiddleName.Text
End If
If Trim(Me.txt_LastName.Text) = "" Then
FullName = FullName
Else
FullName = FullName & " " & Me.txt_LastName.Text
End If
strSQL = "SET DATEFORMAT DMY UPDATE Emp_Personal SET"
strSQL = strSQL & " Title= " & IIf(Me.cmb_Title.Text = "", "Null", "'" & Me.cmb_Title.Text & "'")
strSQL = strSQL & ", F_Name=" & IIf(Me.txt_FirstName.Text = "", "Null", "'" & Trim(Me.txt_FirstName.Text) & "'")
strSQL = strSQL & ", M_Name=" & IIf(Me.txt_MiddleName.Text = "", "Null", "'" & Trim(Me.txt_MiddleName.Text) & "'")
strSQL = strSQL & ", L_Name=" & IIf(Me.txt_LastName.Text = "", "Null", "'" & Trim(Me.txt_LastName.Text) & "'")
strSQL = strSQL & ", Full_Name=" & IIf(FullName = "", "Null", "'" & Trim(FullName) & "'")
strSQL = strSQL & ", Relation=" & IIf(Me.cmb_RType.Text = "", "Null", "'" & Me.cmb_RType.Text & "'")
strSQL = strSQL & ", Guardian_Name=" & IIf(Me.txt_Gardian_Name.Text = "", "Null", "'" & Me.txt_Gardian_Name.Text & "'")
strSQL = strSQL & ", Present_ALine1=" & IIf(Me.txt_Present_ALine1.Text = "", "Null", "'" & Me.txt_Present_ALine1.Text & "'")
strSQL = strSQL & ", Present_ALine2=" & IIf(Me.txt_Present_Aline2.Text = "", "Null", "'" & Me.txt_Present_Aline2.Text & "'")
strSQL = strSQL & ", Phone=" & IIf(Me.txt_Present_Phone.Text = "", "Null", "'" & Me.txt_Present_Phone.Text & "'")
strSQL = strSQL & ", Mobile=" & IIf(Me.txt_Present_Mobile.Text = "", "Null", "'" & Me.txt_Present_Mobile.Text & "'")
strSQL = strSQL & ", EEmail=" & IIf(Me.txt_PEmail.Text = "", "Null", "'" & Me.txt_PEmail.Text & "'")
strSQL = strSQL & ", Permanent_Aline1=" & IIf(Me.txt_Permanent_ALine1.Text = "", "Null", "'" & Me.txt_Permanent_ALine1.Text & "'")
strSQL = strSQL & ", Permanent_ALine2=" & IIf(Me.txt_Permanent_ALine2.Text = "", "Null", "'" & Me.txt_Permanent_ALine2.Text & "'")
strSQL = strSQL & ", Phone_Resident=" & IIf(Me.txt_Permanent_Phone.Text = "", "Null", "'" & Me.txt_Permanent_Phone.Text & "'")
strSQL = strSQL & ", DOB=" & IIf(Me.txt_MDOB.Text = " / /", "Null", "'" & Me.txt_MDOB.Text & "'")
strSQL = strSQL & ", Sex=" & IIf(Me.cmb_Sex.Text = "", "Null", "'" & Me.cmb_Sex.Text & "'")
strSQL = strSQL & ", Religion=" & IIf(Me.cmb_Religion.Text = "", "Null", "'" & Me.cmb_Religion.Text & "'")
strSQL = strSQL & ", Nationa, lity=" & IIf(Me.cmb_Nationality.Text = "", "Null", "'" & Me.cmb_Nationality.Text & "'")
strSQL = strSQL & ", Blood_Group=" & IIf(Me.cmb_Blood_Group.Text = "", "Null", "'" & Me.cmb_Blood_Group.Text & "'")
strSQL = strSQL & ", Marital_Status=" & IIf(Me.cmb_Marital_Status.Text = "", "Null", "'" & Me.cmb_Marital_Status.Text & "'")
strSQL = strSQL & ", National_ID=" & IIf(Me.txt_NationalID.Text = "", "Null", "'" & Me.txt_NationalID.Text & "'")
strSQL = strSQL & ", ECName1=" & IIf(Me.txt_ECName1.Text = "", "Null", "'" & Me.txt_ECName1.Text & "'")
strSQL = strSQL & ", ECRelation1=" & IIf(Me.txt_ECRelation1.Text = "", "Null", "'" & Me.txt_ECRelation1.Text & "'")
strSQL = strSQL & ", ECAddress1=" & IIf(Me.txt_ECAddress1.Text = "", "Null", "'" & Me.txt_ECAddress1.Text & "'")
strSQL = strSQL & ", ECPhone1=" & IIf(Me.txt_ECPhone1.Text = "", "Null", "'" & Me.txt_ECPhone1.Text & "'")
strSQL = strSQL & ", ECMobile1=" & IIf(Me.txt_ECMobile1.Text = "", "Null", "'" & Me.txt_ECMobile1.Text & "'")
strSQL = strSQL & ", ECName2=" & IIf(Me.txt_ECName2.Text = "", "Null", "'" & Me.txt_ECName2.Text & "'")
strSQL = strSQL & ", ECRelation2=" & IIf(Me.txt_ECRelation2.Text = "", "Null", "'" & Me.txt_ECRelation2.Text & "'")
strSQL = strSQL & ", ECAddress2=" & IIf(Me.txt_ECAddress2.Text = "", "Null", "'" & Me.txt_ECAddress2.Text & "'")
strSQL = strSQL & ", ECPhone2=" & IIf(Me.txt_ECPhone2.Text = "", "Null", "'" & Me.txt_ECPhone2.Text & "'")
strSQL = strSQL & ", ECMobile2=" & IIf(Me.txt_ECMobile2.Text = "", "Null", "'" & Me.txt_ECMobile2.Text & "'")
strSQL = strSQL & ", Spouse_Name=" & IIf(Me.txt_SpouseName.Text = "", "Null", "'" & Me.txt_SpouseName.Text & "'")
strSQL = strSQL & ", Annivarsery_Date=" & IIf(Me.txt_MADT.Text = " / /", "Null", "'" & Me.txt_MADT.Text & "'")
strSQL = strSQL & ", Spouse_Occupation=" & IIf(Me.txt_SpouseOccopation.Text = " / /", "Null", "'" & Me.txt_SpouseOccopation.Text & "'")
strSQL = strSQL & " WHERE Emp_No='" & Me.txt_Emp_No.Text & "'"
ExecSqlStatement(strSQL, Trans)
strSQL = "SET DATEFORMAT DMY UPDATE Emp_Professional SET"
strSQL = strSQL & " Division_Code= " & IIf(Me.cmb_Division.SelectedIndex = -1, "Null", "" & Me.cmb_Division.SelectedValue & "")
strSQL = strSQL & ", Dept_Code= " & IIf(Me.cmb_Department.Text = "", "Null", "" & Me.cmb_Department.SelectedValue & "")
strSQL = strSQL & ", Desig_Code= " & IIf(Me.cmb_Designation.Text = "", "Null", "" & Me.cmb_Designation.SelectedValue & "")
strSQL = strSQL & ", J_Code= " & IIf(Me.cmb_Job_Location.Text = "", "Null", "" & Me.cmb_Job_Location.SelectedValue & "")
'strSQL = strSQL & ", G_Code= " & IIf(Me.cmb_Grade.Text = "", "Null", "" & Me.cmb_Grade.SelectedValue & "")
strSQL = strSQL & ", DOJ=" & IIf(Me.txt_MDOJ.Text = " / /", "Null", "'" & Me.txt_MDOJ.Text & "'")
strSQL = strSQL & ", DOC=" & IIf(Me.txt_MDOC.Text = " / /", "Null", "'" & Me.txt_MDOC.Text & "'")
strSQL = strSQL & ", CED=" & IIf(Me.txt_MCED.Text = " / /", "Null", "'" & Me.txt_MCED.Text & "'")
strSQL = strSQL & ", NCD=" & IIf(Me.txt_MNCD.Text = " / /", "Null", "'" & Me.txt_MNCD.Text & "'")
strSQL = strSQL & ", DOS=" & IIf(Me.txt_MDOS.Text = " / /", "Null", "'" & Me.txt_MDOS.Text & "'")
strSQL = strSQL & ", Category= " & IIf(Me.cmb_Category.Text = "", "Null", "'" & Me.cmb_Category.Text & "'")
strSQL = strSQL & ", Contract= " & IIf(Me.txt_Contract.Text = "", "Null", "" & Me.txt_Contract.Text & "")
strSQL = strSQL & ", C_Period= " & IIf(Me.cmb_CPeriod.Text = "", "Null", "'" & Me.cmb_CPeriod.Text & "'")
strSQL = strSQL & ", Prob= " & IIf(Me.txt_Probation.Text = "", "Null", "" & Me.txt_Probation.Text & "")
strSQL = strSQL & ", P_Period= " & IIf(Me.cmb_Period.Text = "", "Null", "'" & Me.cmb_Period.Text & "'")
strSQL = strSQL & ", Locker_No= " & IIf(Me.txt_LockerNo.Text = "", "Null", "'" & Me.txt_LockerNo.Text & "'")
strSQL = strSQL & ", Supervisor_ID= " & IIf(Me.cmb_Supervisor.Text = "", "Null", "'" & Me.cmb_Supervisor.SelectedValue & "'")
strSQL = strSQL & ", Reviewer_ID= " & IIf(Me.cmb_Reviewer.Text = "", "Null", "'" & Me.cmb_Reviewer.SelectedValue & "'")
strSQL = strSQL & ", LE= " & IIf(Me.cmb_LE.Text = "", "Null", "'" & Me.cmb_LE.Text & "'")
strSQL = strSQL & ", Job_Status= " & IIf(Me.cmb_JobStatus.Text = "", "Null", "'" & Me.cmb_JobStatus.Text & "'")
strSQL = strSQL & ", Remarks= " & IIf(Me.txt_Remarks.Text = "", "Null", "'" & Me.txt_Remarks.Text & "'")
strSQL = strSQL & ", M_Status= " & IIf(Me.cmb_Medical_Status.Text = "", "Null", "'" & Me.cmb_Medical_Status.Text & "'")
strSQL = strSQL & ", Staff_of= " & IIf(Me.cmb_Staffof.Text = "", "Null", "'" & Me.cmb_Staffof.Text & "'")
strSQL = strSQL & ", ROL= " & IIf(Me.cmb_Separation_Reason.Text = "", "Null", "'" & Me.cmb_Separation_Reason.Text & "'")
strSQL = strSQL & ", Institute_Name= " & IIf(Me.cmb_InstituteName.Text = "", "Null", "'" & Me.cmb_InstituteName.Text & "'")
strSQL = strSQL & ", General_Shift= " & IIf(Me.chk_GShift.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", Overtime= " & IIf(Me.chk_OT.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", Uniform= " & IIf(Me.chk_Uniform.Checked = True, "'True'", "'False'")
strSQL = strSQL & ", Status= " & IIf(Me.cmb_Status.Text = "", "Null", "'" & Me.cmb_Status.Text & "'")
strSQL = strSQL & ", Last_Changed_By='" & UserID & "'"
strSQL = strSQL & ", Last_Changed_Date='" & GetServerDateTime() & "'"
strSQL = strSQL & " WHERE Emp_No='" & Me.txt_Emp_No.Text & "'"
ExecSqlStatement(strSQL, Trans)
'strSQL = "SET DATEFORMAT DMY UPDATE Emp_Financial SET"
'strSQL = strSQL & " Bank_Name= " & IIf(Me.cmb_BankName.Text = "", "null", "'" & Me.cmb_BankName.Text & "'")
'strSQL = strSQL & ", Account_No= " & IIf(Me.txt_AccountNo.Text = "", "null", "'" & Me.txt_AccountNo.Text & "'")
'strSQL = strSQL & ", Basic= " & IIf(Me.txt_Basic.Text = "", "null", "" & Me.txt_Basic.Text & "")
'strSQL = strSQL & ", House_Rent= " & IIf(Me.txt_HouseRent.Text = "", "null", "" & Me.txt_HouseRent.Text & "")
'strSQL = strSQL & ", Conveyance= " & IIf(Me.txt_Conveyance.Text = "", "null", "" & Me.txt_Conveyance.Text & "")
'strSQL = strSQL & ", Family_Medical= " & IIf(Me.txt_FM.Text = "", "null", "" & Me.txt_FM.Text & "")
'strSQL = strSQL & ", Service_Charge= " & IIf(Me.txt_ServiceCharge.Text = "", "null", "" & Me.txt_ServiceCharge.Text & "")
'strSQL = strSQL & ", Additional_Other_Income= " & IIf(Me.txt_Aalowance.Text = "", "null", "" & Me.txt_Aalowance.Text & "")
'strSQL = strSQL & ", Hourly_Rate= " & IIf(Me.txt_CHR.Text = "", "null", "" & Me.txt_CHR.Text & "")
'strSQL = strSQL & ", SC_Percentage= " & IIf(Me.txt_Percetage.Text = "", "null", "" & Me.txt_Percetage.Text & "")
'strSQL = strSQL & " WHERE Emp_No='" & Me.txt_Emp_No.Text & "'"
'ExecSqlStatement(strSQL, Trans)
strSQL = "SET DATEFORMAT DMY UPDATE User_Master SET"
strSQL = strSQL & " Status= " & IIf(Me.cmb_Status.Text = "", "Null", "'" & Me.cmb_Status.Text & "'")
strSQL = strSQL & " WHERE Emp_No='" & Me.txt_Emp_No.Text & "'"
ExecSqlStatement(strSQL, Trans)
For i As Integer = 0 To Me.dgv_Education.Rows.Count - 1
If Me.dgv_Education.Item(0, i).Value.ToString = "" Then
Dim Ecode As Integer = Val(Find_Value2("SELECT MAX(ECode) FROM Emp_Education", Trans))
If Ecode = Nothing Then
Ecode = 1
Else
Ecode = Ecode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Emp_Education (Emp_No, Ecode, Degree_Name, Institute_Name, Board_University, Passing_Year, Major_Area, Div_Grade, EStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & Ecode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(1, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(2, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(3, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(4, i).Value.ToString = "", "null", "" & Me.dgv_Education.Item(4, i).Value.ToString & "")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(5, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(6, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(6, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Education.Item(7, i).Value.ToString = "", "null", "'" & Me.dgv_Education.Item(7, i).Value.ToString & "'")
strSQL = strSQL & ",'" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
 
For i As Integer = 0 To Me.dgv_Dependant.Rows.Count - 1
If Me.dgv_Dependant.Item(0, i).Value.ToString = "" Then
Dim Dcode As Integer = Val(Find_Value2("SELECT MAX(Code) FROM Dependant_Master", Trans))
If Dcode = Nothing Then
Dcode = 1
Else
Dcode = Dcode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Dependant_Master (Emp_No, Code, DName, DRelation, DDOB, DOccupation, DStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & Dcode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(1, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(2, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(3, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(4, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(4, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_Dependant.Item(5, i).Value.ToString = "", "Null", "'" & Me.dgv_Dependant.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ",'" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
For i As Integer = 0 To Me.dgv_EmpHistory.Rows.Count - 1
If Me.dgv_EmpHistory.Item(0, i).Value.ToString = "" Then
Dim EHcode As Integer = Val(Find_Value2("SELECT MAX(PCode) FROM Employment_Records", Trans))
If EHcode = Nothing Then
EHcode = 1
Else
EHcode = EHcode + 1
End If
strSQL = "SET DATEFORMAT DMY INSERT INTO Employment_Records (Emp_No, PCode, Organization_Name, Position_Held, From_Date, To_Date, Left_Reason, PStatus, Encoded_By, Encoded_Date)"
strSQL = strSQL & " VALUES ( "
strSQL = strSQL & "'" & Me.txt_Emp_No.Text & "'"
strSQL = strSQL & ", " & EHcode & ""
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(1, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(1, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(2, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(2, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(3, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(3, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(4, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(4, i).Value.ToString & "'")
strSQL = strSQL & ", " & IIf(Me.dgv_EmpHistory.Item(5, i).Value.ToString = "", "Null", "'" & Me.dgv_EmpHistory.Item(5, i).Value.ToString & "'")
strSQL = strSQL & ", 'Active', '" & UserID & "','" & GetServerDateTime() & "')"
ExecSqlStatement(strSQL, Trans)
End If
Next
MsgBox("Informaton updated into the system successfully.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Confirmation")
If Trim(strPhotoName) <> Space(0) Then 'Update Employee Photo
Save_Photo(Trim(EmpNo))
End If
DisableControls(Me)
' Catch ex As Exception
'MsgBox(ex.Message)
' End Try
End Select
dSet.Tables.Clear()
dc.Close()
End Sub
Private Sub dgv_Education_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_Education.CellDoubleClick
If MsgBox("Are you sure to remove this information from degree list?", MsgBoxStyle.YesNo, "Confirmation") = MsgBoxResult.No Then
Exit Sub
Else
If Not Me.dgv_Education.Item(0, Me.dgv_Education.CurrentRow.Index).Value.ToString = "" Then
strSQL = "SET DATEFORMAT DMY UPDATE Emp_Education SET"
strSQL = strSQL & " EStatus= 'In-active'"
strSQL = strSQL & ", Last_Changed_By='" & UserID & "'"
strSQL = strSQL & ", Last_Changed_Date='" & GetServerDateTime() & "'"
strSQL = strSQL & " WHERE ECode=" & Me.dgv_Education.Item(0, Me.dgv_Education.CurrentRow.Index).Value & ""
ExecSqlStatement(strSQL, Trans)
MsgBox("This degree inactivated in the system.", MsgBoxStyle.OkOnly, "Confirmation")
Me.dgv_Education.Rows.Remove(Me.dgv_Education.CurrentRow)
Else
Me.dgv_Education.Rows.Remove(Me.dgv_Education.CurrentRow)
End If
End If
End Sub
Private Sub rb_New_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rb_New.CheckedChanged
If Me.rb_New.Checked = True Then
Me.gb_RDetails.Visible = False
End If
End Sub
Private Sub rb_Replament_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rb_Replament.CheckedChanged
If Me.rb_Replament.Checked = True Then
Me.gb_RDetails.Visible = True
Me.cmb_EID.SelectedIndex = -1
Me.txt_FullName.Text = ""
Me.txt_Designation.Text = ""
Me.txt_OldDOS.Text = ""
End If
End Sub
Private Sub cmb_EID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_EID.SelectedIndexChanged
strSQL = "SELECT Emp_Personal.Full_Name, Designation_Master.Desig_Name, Emp_Professional.DOS FROM Emp_Personal INNER JOIN Replacement_Master ON Emp_Personal.Emp_No = Replacement_Master.Emp_No INNER JOIN Designation_Master INNER JOIN Emp_Professional ON Designation_Master.Desig_Code = Emp_Professional.Desig_Code ON Emp_Personal.Emp_No = Emp_Professional.Emp_No WHERE Replacement_Master.Emp_No='" & Me.cmb_EID.Text & "'"
dSet = OpnDataSet(strSQL)
If dSet.Tables(0).Rows.Count > 0 Then
Me.txt_FullName.Text = dSet.Tables(0).Rows(0).Item("Full_Name")
Me.txt_Designation.Text = dSet.Tables(0).Rows(0).Item("Desig_Name")
Me.txt_OldDOS.Text = dSet.Tables(0).Rows(0).Item("DOS").ToString
End If
End Sub
Private Sub cmb_EDegree_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_EDegree.KeyDown
If e.KeyCode = Keys.Enter Then
Me.cmb_EInstitute.Focus()
End If
End Sub
Private Sub cmb_EInstitute_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_EInstitute.KeyDown
If e.KeyCode = Keys.Enter Then
Me.cmb_EBoard.Focus()
End If
End Sub
Private Sub cmb_EBoard_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_EBoard.KeyDown
If e.KeyCode = Keys.Enter Then
Me.cmb_EYear.Focus()
End If
End Sub
Private Sub cmb_EMajor_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_EMajor.KeyDown
If e.KeyCode = Keys.Enter Then
Me.txt_EDiv.Focus()
End If
End Sub
Private Sub txt_EDiv_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt_EDiv.KeyDown
If e.KeyCode = Keys.Enter Then
Me.cmd_EAdd.Focus()
End If
End Sub
Private Sub cmb_EYear_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_EYear.KeyDown
If e.KeyCode = Keys.Enter Then
Me.cmb_EMajor.Focus()
End If
End Sub
Private Sub txt_Emp_No_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_Emp_No.KeyPress
If Char.IsLower(e.KeyChar) Then
Me.txt_Emp_No.SelectedText = Char.ToUpper(e.KeyChar)
e.Handled = True
End If
End Sub
Private Sub txt_Contract_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_Contract.KeyPress
e.Handled = TrapKey(Asc(e.KeyChar))
End Sub
Private Sub dgv_Emp_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_Emp.CellDoubleClick
If Me.dgv_Emp.Rows.Count > 0 Then
Me.txt_Emp_No.Text = Me.dgv_Emp.Item(0, Me.dgv_Emp.CurrentRow.Index).Value.ToString
Me.txt_Emp_No.Enabled = False
Me.txt_Search.Text = ""
Me.gb_Employee.Visible = False
Call Emp()
End If
End Sub
Private Sub dgv_Emp_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgv_Emp.ColumnHeaderMouseClick
If Not e.ColumnIndex = 0 Then
Me.lbl_Search.Text = "Search by " & Me.dgv_Emp.Columns.Item(e.ColumnIndex).HeaderText
SearchColumn = Me.dgv_Emp.Columns.Item(e.ColumnIndex).DataPropertyName
End If
End Sub
Private Sub cmd_Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Search.Click
Call AllEmp()
SearchColumn = "Full_Name"
Me.txt_Search.Focus()
End Sub
Private Sub cmb_Copy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_Copy.Click
Me.txt_Permanent_ALine1.Text = Trim(Me.txt_Present_ALine1.Text)
Me.txt_Permanent_ALine2.Text = Trim(Me.txt_Present_Aline2.Text)
End Sub
Private Sub txt_MNCD_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MNCD.LostFocus
DateValidation(Me.txt_MNCD)
End Sub
Private Sub cmb_Category_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_Category.SelectedIndexChanged
Select Case btnMode
Case Is = "NEW"
If Me.cmb_Category.Text = "Permanent" Then
Me.txt_MDOC.Text = CDate(Me.txt_MDOJ.Text).AddMonths(6)
End If
Case Is = "EDIT"
If Not Me.cmb_Category.Text = "Contractual" Then
Me.txt_MNCD.Text = " / /"
' Me.txt_MNCD.Enabled = False
Else
' Me.txt_MNCD.Enabled = True
strSQL = "SELECT NCD FROM Emp_Professional WHERE Emp_Professional.Emp_No='" & Me.txt_Emp_No.Text & "'"
dSet = OpnDataSet(strSQL, Trans)
If Not dSet.Tables(0).Rows.Count > 0 Then
MsgBox("Invalid Employee ID", MsgBoxStyle.Critical + MsgBoxStyle.Information, "Wrong data")
Else
Me.txt_MNCD.Enabled = True
If Not IsDBNull(dSet.Tables(0).Rows(0).Item("NCD")) Then
Me.txt_MNCD.Text = (dSet.Tables(0).Rows(0).Item("NCD"))
End If
End If
End If
End Select
If Me.cmb_Category.Text = "Casual" Then
Me.txt_CHR.Enabled = True
Else
Me.txt_CHR.Enabled = False
End If
End Sub
Private Sub txt_Search_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_Search.KeyPress
If Me.rb_Active.Checked = True Then
strSQL = "SELECT Emp_Professional.Emp_No, Emp_Professional.Category, Full_Name, Emp_Personal.F_Name, Emp_Personal.M_Name,Emp_Personal.L_Name, Dept_Master.Dept_Name, Desig_Master.Desig_Name"
strSQL = strSQL & " FROM Dept_Master RIGHT JOIN (Desig_Master RIGHT JOIN (Emp_Personal RIGHT JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No) ON Desig_Master.Desig_Code = Emp_Professional.Desig_Code) ON Dept_Master.Dept_Code = Emp_Professional.Dept_Code WHERE Emp_Professional.Status='Active' AND " & SearchColumn & " like '%" & Me.txt_Search.Text & "%' ORDER BY Emp_Professional.Emp_No ASC"
ElseIf Me.rb_Inactive.Checked = True Then
strSQL = "SELECT Emp_Professional.Emp_No, Emp_Professional.Category, Full_Name, Emp_Personal.F_Name, Emp_Personal.M_Name,Emp_Personal.L_Name, Dept_Master.Dept_Name, Desig_Master.Desig_Name"
strSQL = strSQL & " FROM Dept_Master RIGHT JOIN (Desig_Master RIGHT JOIN (Emp_Personal RIGHT JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No) ON Desig_Master.Desig_Code = Emp_Professional.Desig_Code) ON Dept_Master.Dept_Code = Emp_Professional.Dept_Code WHERE Emp_Professional.Status='In-active' AND " & SearchColumn & " like '%" & Me.txt_Search.Text & "%' ORDER BY Emp_Professional.Emp_No ASC"
ElseIf Me.rb_AllStatus.Checked = True Then
strSQL = "SELECT Emp_Professional.Emp_No, Emp_Professional.Category, Full_Name, Emp_Personal.F_Name, Emp_Personal.M_Name,Emp_Personal.L_Name, Dept_Master.Dept_Name, Desig_Master.Desig_Name"
strSQL = strSQL & " FROM Dept_Master RIGHT JOIN (Desig_Master RIGHT JOIN (Emp_Personal RIGHT JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No) ON Desig_Master.Desig_Code = Emp_Professional.Desig_Code) ON Dept_Master.Dept_Code = Emp_Professional.Dept_Code WHERE " & SearchColumn & " like '%" & Me.txt_Search.Text & "%' ORDER BY Emp_Professional.Emp_No ASC"
End If
dSet = OpnDataSet(strSQL)
Me.dgv_Emp.AutoGenerateColumns = False
Me.dgv_Emp.DataSource = dSet.Tables(0)
Me.col_ID.DataPropertyName = "Emp_No"
Me.FName.DataPropertyName = "F_Name"
Me.MName.DataPropertyName = "M_Name"
Me.LName.DataPropertyName = "L_Name"
Me.col_Name.DataPropertyName = "Full_Name"
Me.col_Designation.DataPropertyName = "Desig_Name"
Me.col_Dept.DataPropertyName = "Dept_Name"
Me.col_Category.DataPropertyName = "Category"
End Sub
Sub AllEmp()
strSQL = "SELECT Emp_Professional.Emp_No, Emp_Professional.Category, Full_Name, Emp_Personal.F_Name, Emp_Personal.M_Name,Emp_Personal.L_Name, Dept_Master.Dept_Name, Desig_Master.Desig_Name"
strSQL = strSQL & " FROM Dept_Master RIGHT JOIN (Desig_Master RIGHT JOIN (Emp_Personal RIGHT JOIN Emp_Professional ON Emp_Personal.Emp_No = Emp_Professional.Emp_No) ON Desig_Master.Desig_Code = Emp_Professional.Desig_Code) ON Dept_Master.Dept_Code = Emp_Professional.Dept_Code WHERE Emp_Professional.Status='Active' ORDER BY Emp_Professional.Emp_No ASC"
dSet = OpnDataSet(strSQL)
Me.dgv_Emp.AutoGenerateColumns = False
Me.dgv_Emp.DataSource = dSet.Tables(0)
Me.AllEmpDT = dSet.Tables(0)
Me.col_ID.DataPropertyName = "Emp_No"
Me.FName.DataPropertyName = "F_Name"
Me.MName.DataPropertyName = "M_Name"
Me.LName.DataPropertyName = "L_Name"
Me.col_Name.DataPropertyName = "Full_Name"
Me.col_Designation.DataPropertyName = "Desig_Name"
Me.col_Dept.DataPropertyName = "Dept_Name"
Me.col_Category.DataPropertyName = "Category"
Me.gb_Employee.Visible = True
End Sub
Private Sub cmd_Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Close.Click
Me.txt_Search.Text = ""
Me.dgv_Emp.DataSource = Nothing
Me.rb_Active.Checked = True
Me.gb_Employee.Visible = False
Me.txt_Emp_No.Focus()
End Sub
Private Sub txt_MDOB_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MDOB.LostFocus
DateValidation(txt_MDOB)
End Sub
Private Sub txt_MDOJ_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MDOJ.LostFocus
DateValidation(txt_MDOJ)
End Sub
Private Sub txt_MADT_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MADT.LostFocus
DateValidation(txt_MADT)
End Sub
Private Sub btn_AddDependant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_AddDependant.Click
If Trim(Me.txt_DependantName.Text) = "" Then
MsgBox("Please enter name to Continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.txt_DependantName.Focus()
Exit Sub
End If
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = ""
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_DependantName.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_DRelation.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_MDDOB.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_DOccupation.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = "Active"
dgvRow.Cells.Add(dgvCell)
Me.dgv_Dependant.Rows.Add(dgvRow)
Me.txt_DependantName.Text = ""
Me.cmb_DRelation.SelectedIndex = -1
Me.txt_MDDOB.Text = " / /"
Me.cmb_DOccupation.SelectedIndex = -1
Me.cmb_DStatus.SelectedIndex = 0
Me.txt_DependantName.Focus()
End Sub
Private Sub dgv_Dependant_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_Dependant.CellDoubleClick
If MsgBox("Are you sure to remove this information from dependant list?", MsgBoxStyle.YesNo, "Confirmation") = MsgBoxResult.No Then
Exit Sub
Else
If Not Me.dgv_Dependant.Item(0, Me.dgv_Dependant.CurrentRow.Index).Value.ToString = "" Then
strSQL = "SET DATEFORMAT DMY UPDATE Dependant_Master SET"
strSQL = strSQL & " DStatus= 'In-active'"
strSQL = strSQL & ", Last_Changed_By='" & UserID & "'"
strSQL = strSQL & ", Last_Changed_Date='" & GetServerDateTime() & "'"
strSQL = strSQL & " WHERE Code=" & Me.dgv_Dependant.Item(0, Me.dgv_Dependant.CurrentRow.Index).Value & ""
ExecSqlStatement(strSQL, Trans)
Me.dgv_Dependant.Rows.Remove(Me.dgv_Dependant.CurrentRow)
MsgBox("This dependant inactivated in the dependant list.", MsgBoxStyle.OkOnly, "Confirmation")
Else
Me.dgv_Dependant.Rows.Remove(Me.dgv_Dependant.CurrentRow)
End If
End If
End Sub
Private Sub txt_MDDOB_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MDDOB.LostFocus
DateValidation(Me.txt_MDDOB)
End Sub
Private Sub cmd_EAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_EAdd.Click
If Trim(Me.cmb_EDegree.Text) = "" Then
MsgBox("Please enter a degree name to continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.cmb_EDegree.Focus()
Exit Sub
End If
If Trim(Me.cmb_EInstitute.Text) = "" Then
MsgBox("Please enter an institute name to continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.cmb_EInstitute.Focus()
Exit Sub
End If
If Trim(Me.cmb_EBoard.Text) = "" Then
MsgBox("Please enter board name to continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.cmb_EBoard.Focus()
Exit Sub
End If
If Trim(Me.cmb_EYear.Text) = "" Then
MsgBox("Please enter passing year to continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.cmb_EYear.Focus()
Exit Sub
End If
If Trim(Me.cmb_EStatus.Text) = "" Then
MsgBox("Please enter status to continue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.cmb_EStatus.Focus()
Exit Sub
End If
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = ""
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_EDegree.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_EInstitute.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_EBoard.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_EYear.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.cmb_EMajor.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_EDiv.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = "Active"
dgvRow.Cells.Add(dgvCell)
Me.dgv_Education.Rows.Add(dgvRow)
Me.cmb_EDegree.SelectedIndex = -1
Me.cmb_EInstitute.SelectedIndex = -1
Me.cmb_EBoard.SelectedIndex = -1
Me.cmb_EYear.SelectedIndex = -1
Me.cmb_EMajor.SelectedIndex = -1
Me.txt_EDiv.Text = ""
Me.cmb_EDegree.Focus()
End Sub
Private Sub txt_MPFD_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MPFD.LostFocus
DateValidation(Me.txt_MPFD)
End Sub
Private Sub txt_MPTD_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_MPTD.LostFocus
DateValidation(Me.txt_MPTD)
End Sub
Private Sub cmd_EHistoryAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_EHistoryAdd.Click
If Trim(Me.txt_Organization.Text) = "" Then
MsgBox("Please enter organization name to ontinue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.txt_Organization.Focus()
Exit Sub
End If
If Trim(Me.txt_Position.Text) = "" Then
MsgBox("Please enter position name to ontinue.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Data")
Me.txt_Position.Focus()
Exit Sub
End If
Dim dgvRow As New DataGridViewRow
Dim dgvCell As DataGridViewCell
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = ""
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_Organization.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_Position.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_MPFD.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_MPTD.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = Me.txt_LeavingReason.Text
dgvRow.Cells.Add(dgvCell)
dgvCell = New DataGridViewTextBoxCell()
dgvCell.Value = "Active"
dgvRow.Cells.Add(dgvCell)
'
Me.dgv_EmpHistory.Rows.Add(dgvRow)
Me.txt_Organization.Text = ""
Me.txt_Position.Text = ""
Me.txt_MPFD.Text = " / /"
Me.txt_MPTD.Text = " / /"
Me.txt_LeavingReason.Text = ""
Me.txt_Organization.Focus()
End Sub
Private Sub dgv_EmpHistory_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_EmpHistory.CellDoubleClick
If MsgBox("Are you sure to remove this information from employment history list?", MsgBoxStyle.YesNo, "Confirmation") = MsgBoxResult.No Then
Exit Sub
Else
If Not Me.dgv_EmpHistory.Item(0, Me.dgv_EmpHistory.CurrentRow.Index).Value.ToString = "" Then
strSQL = "SET DATEFORMAT DMY UPDATE Employment_Records SET"
strSQL = strSQL & " PStatus= 'In-active'"
strSQL = strSQL & ", Last_Changed_By='" & UserID & "'"
strSQL = strSQL & ", Last_Changed_Date='" & GetServerDateTime() & "'"
strSQL = strSQL & " WHERE PCode=" & Me.dgv_EmpHistory.Item(0, Me.dgv_EmpHistory.CurrentRow.Index).Value & ""
ExecSqlStatement(strSQL, Trans)
Me.dgv_EmpHistory.Rows.Remove(Me.dgv_EmpHistory.CurrentRow)
MsgBox("This employment history inactivated in the system.", MsgBoxStyle.OkOnly, "Confirmation")
Else
Me.dgv_EmpHistory.Rows.Remove(Me.dgv_EmpHistory.CurrentRow)
End If
End If
End Sub
 
Private Sub txt_Emp_No_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_Emp_No.TextChanged
End Sub
End Class


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.