📄 wage.cs
字号:
this.groupBox2.Location = new System.Drawing.Point(16, 16);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(568, 120);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "工资查询";
//
// label6
//
this.label6.Location = new System.Drawing.Point(160, 24);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 23);
this.label6.TabIndex = 45;
this.label6.Text = "有效日期";
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 24);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(48, 23);
this.label7.TabIndex = 37;
this.label7.Text = "职工号";
//
// label8
//
this.label8.Location = new System.Drawing.Point(224, 24);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(24, 23);
this.label8.TabIndex = 36;
this.label8.Text = "从";
//
// dateTimePicker4
//
this.dateTimePicker4.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dateTimePicker4.Location = new System.Drawing.Point(424, 24);
this.dateTimePicker4.Name = "dateTimePicker4";
this.dateTimePicker4.Size = new System.Drawing.Size(120, 21);
this.dateTimePicker4.TabIndex = 42;
this.dateTimePicker4.Value = new System.DateTime(2003, 12, 20, 0, 0, 0, 0);
//
// dateTimePicker3
//
this.dateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dateTimePicker3.Location = new System.Drawing.Point(256, 24);
this.dateTimePicker3.Name = "dateTimePicker3";
this.dateTimePicker3.Size = new System.Drawing.Size(120, 21);
this.dateTimePicker3.TabIndex = 41;
this.dateTimePicker3.Value = new System.DateTime(2003, 12, 20, 0, 0, 0, 0);
//
// label14
//
this.label14.Location = new System.Drawing.Point(384, 24);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(24, 16);
this.label14.TabIndex = 40;
this.label14.Text = "到";
//
// textEmployeeID2
//
this.textEmployeeID2.Location = new System.Drawing.Point(56, 24);
this.textEmployeeID2.Name = "textEmployeeID2";
this.textEmployeeID2.Size = new System.Drawing.Size(80, 21);
this.textEmployeeID2.TabIndex = 38;
this.textEmployeeID2.Text = "";
//
// btnSearchCancel
//
this.btnSearchCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearchCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnSearchCancel.Image")));
this.btnSearchCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSearchCancel.Location = new System.Drawing.Point(208, 80);
this.btnSearchCancel.Name = "btnSearchCancel";
this.btnSearchCancel.Size = new System.Drawing.Size(56, 24);
this.btnSearchCancel.TabIndex = 106;
this.btnSearchCancel.Text = "取消";
this.btnSearchCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnWageSearch
//
this.btnWageSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnWageSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnWageSearch.Image")));
this.btnWageSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnWageSearch.Location = new System.Drawing.Point(304, 80);
this.btnWageSearch.Name = "btnWageSearch";
this.btnWageSearch.Size = new System.Drawing.Size(56, 24);
this.btnWageSearch.TabIndex = 107;
this.btnWageSearch.Text = "查找";
this.btnWageSearch.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnWageSearch.Click += new System.EventHandler(this.btnWageSearch_Click);
//
// btnWageExport
//
this.btnWageExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnWageExport.Image = ((System.Drawing.Image)(resources.GetObject("btnWageExport.Image")));
this.btnWageExport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnWageExport.Location = new System.Drawing.Point(400, 80);
this.btnWageExport.Name = "btnWageExport";
this.btnWageExport.Size = new System.Drawing.Size(56, 24);
this.btnWageExport.TabIndex = 108;
this.btnWageExport.Text = "导出";
this.btnWageExport.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnWageExport.Click += new System.EventHandler(this.btnWageExport_Click);
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Image = ((System.Drawing.Image)(resources.GetObject("btnExit.Image")));
this.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExit.Location = new System.Drawing.Point(704, 448);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(56, 24);
this.btnExit.TabIndex = 94;
this.btnExit.Text = "退出";
this.btnExit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// lblTotalWage
//
this.lblTotalWage.BackColor = System.Drawing.SystemColors.Window;
this.lblTotalWage.Font = new System.Drawing.Font("楷体_GB2312", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.lblTotalWage.ForeColor = System.Drawing.Color.Blue;
this.lblTotalWage.Location = new System.Drawing.Point(392, 368);
this.lblTotalWage.Name = "lblTotalWage";
this.lblTotalWage.Size = new System.Drawing.Size(176, 23);
this.lblTotalWage.TabIndex = 125;
this.lblTotalWage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBasicWage
//
this.textBasicWage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBasicWage.Enabled = false;
this.textBasicWage.Location = new System.Drawing.Point(400, 136);
this.textBasicWage.Name = "textBasicWage";
this.textBasicWage.Size = new System.Drawing.Size(72, 21);
this.textBasicWage.TabIndex = 126;
this.textBasicWage.Text = "";
//
// label24
//
this.label24.Location = new System.Drawing.Point(328, 376);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(56, 24);
this.label24.TabIndex = 127;
this.label24.Text = "工资总计";
//
// textAbsence
//
this.textAbsence.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textAbsence.Enabled = false;
this.textAbsence.Location = new System.Drawing.Point(88, 96);
this.textAbsence.Name = "textAbsence";
this.textAbsence.Size = new System.Drawing.Size(32, 21);
this.textAbsence.TabIndex = 63;
this.textAbsence.Text = "";
//
// textAbsenceMoney
//
this.textAbsenceMoney.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textAbsenceMoney.Enabled = false;
this.textAbsenceMoney.Location = new System.Drawing.Point(192, 96);
this.textAbsenceMoney.Name = "textAbsenceMoney";
this.textAbsenceMoney.Size = new System.Drawing.Size(32, 21);
this.textAbsenceMoney.TabIndex = 62;
this.textAbsenceMoney.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(144, 104);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 23);
this.label3.TabIndex = 61;
this.label3.Text = "罚款¥";
//
// label21
//
this.label21.Location = new System.Drawing.Point(24, 104);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(64, 23);
this.label21.TabIndex = 60;
this.label21.Text = "缺勤天数";
//
// Wage
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(776, 501);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Wage";
this.Text = "工资管理";
this.Load += new System.EventHandler(this.Wage_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Buttons_Control(bool isValid)
{
if(isValid)
{
this.btnApply.Enabled=true;
this.btnCancel.Enabled=true;
}
else
{
this.btnApply.Enabled=false;
this.btnCancel.Enabled=false;
}
}
private void btnApply_Click(object sender, System.EventArgs e)
{
string employeeid=this.textEmployeeID.Text;
decimal basicwage=Convert.ToDecimal(this.textBasicWage.Text);
decimal bonus=this.numericUpDown2.Value;
int lateminus=Convert.ToInt16(this.textLateMoney.Text);
int earlyleaveminus=Convert.ToInt16(this.textLeaveEarlyMoney.Text);
int sickleave=Convert.ToInt16(this.textSickLeaveMoney.Text);
int affairleave=Convert.ToInt16(this.textAffairLeaveMoney.Text);
int reward=Convert.ToInt16(this.textRewardMoeny.Text);
int totalwage=Convert.ToInt16(this.textTotalWage.Text);
string begindate=this.dateTimePicker1.Text;
string enddate=this.dateTimePicker2.Text;
this.commandStr="insert into wage(EmployeeID,BasicWage,Bonus,LateMinus,EarlyLeaveMinus,SickLeaveMinus,AffairLeaveMinus,RewardAndPunish,TotalWage,BeginDate,EndDate) values(";
this.commandStr+="'"+employeeid+"',"+basicwage+","+bonus+","+lateminus+","+earlyleaveminus+","+sickleave+","+affairleave+","+reward+","+totalwage+",'"+begindate+"','"+enddate+"')";
this.Command1.CommandText=this.commandStr;
try
{
this.Connection1.Open();
this.Command1.ExecuteNonQuery();
}
catch(Exception E)
{
this.ErrorHandle(E);
}
finally
{
this.Connection1.Close();
}
}
private int Get_CheckLate()
{
int count=0;
System.DateTime beginDate=Convert.ToDateTime(this.dateTimePicker1.Text);
System.DateTime endDate=Convert.ToDateTime(this.dateTimePicker2.Text);
System.DateTime checkDate;
this.commandStr="select Date from CheckInRecord where EmployeeID="+"'"+this.textEmployeeID.Text+"'"+" and CheckType="+"'"+"迟到"+"'";
this.Command1.CommandText=this.commandStr;
try
{
this.Connection1.Open();
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
checkDate=Convert.ToDateTime(DataReader1[0]);
if(checkDate<=endDate&checkDate>=beginDate)
{
count+=1;
}
}
}
catch(Exception E)
{
this.ErrorHandle(E);
}
finally
{
this.DataReader1.Close();
this.Connection1.Close();
}
/*if(o.Equals(DBNull.Value))
{
count=0;
}
else
{
count=Convert.ToInt16(o);
}*/
this.textLateCount.Text=count.ToString();
this.textLateMoney.Text=Convert.ToString(count*50);
return count*50;
}
private int Get_Absence()
{
int count=0;
System.DateTime beginDate=Convert.ToDateTime(this.dateTimePicker1.Text);
System.DateTime endDate=Convert.ToDateTime(this.dateTimePicker2.Text);
System.DateTime checkDate;
this.commandStr="select Date from CheckInRecord where EmployeeID="+"'"+this.textEmployeeID.Text+"'"+" and CheckType="+"'"+"缺勤"+"'";
this.Command1.CommandText=this.commandStr;
try
{
this.Connection1.Open();
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
checkDate=Convert.ToDateTime(DataReader1[0]);
if(checkDate<=endDate&checkDate>=beginDate)
{
count+=1;
}
}
this.DataReader1.Close();
this.commandStr="select Date from CheckOutRecord where EmployeeID="+"'"+this.textEmployeeID.Text+"'"+" and CheckType="+"'"+"缺勤"+"'";
this.Command1.CommandText=this.commandStr;
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
checkDate=Convert.ToDateTime(DataReader1[0]);
if(checkDate<=endDate&checkDate>=beginDate)
{
count+=1;
}
}
}
catch(Exception E)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -