/
Jct_Payroll_Conveyance_Voucher_Print.aspx.cs
123 lines (114 loc) · 5 KB
/
Jct_Payroll_Conveyance_Voucher_Print.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Payroll_Jct_Payroll_Conveyance_Voucher_Print : System.Web.UI.Page
{
Connection obj = new Connection();
Functions obj1 = new Functions();
int requestID;
int CheckEligile = 0;
string jctsr_no;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//ViewState["YEARMONTH"] = Request.QueryString["YEARMONTH"].ToString();
//ViewState["empcode"] = Request.QueryString["empcode"].ToString();
//ViewState["YEARMONTH"] = "201810";
//ViewState["empcode"] = "9000000334";
//requestID = Convert.ToInt32(Request.QueryString["requestid"]);
CheckEligibility();
if (CheckEligile == 0)
{
string sql = "Jct_Payroll_Converyance_Voucher_Print_Header";
SqlCommand cmd = new SqlCommand(sql, obj.Connection());
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add("@Srno", SqlDbType.Int).Value = requestID;
//cmd.Parameters.Add("@YearMonth", SqlDbType.Int).Value = ViewState["YEARMONTH"];
//cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = Session["Empcode"];
cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = "9000000443";
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
//lblPlant.Text = dr["Plant"].ToString();
//lblLocation.Text = dr["Location"].ToString();
lblDepartment.Text = dr["Department"].ToString();
lbldesignation.Text = dr["Designation"].ToString();
lblEmployeeName.Text = dr["EmployeeName"].ToString();
lblEmployeecode.Text = dr["EmployeeCode"].ToString();
//lblCardNo.Text = dr["CardNo"].ToString();
lblPrintdate.Text = dr["PrintDate"].ToString();
//lblFromp.Text = dr["FromDate"].ToString();
//lblTodatep.Text = dr["ToDate"].ToString();
lblEmployeeName0.Text = dr["Period"].ToString();
}
}
else
{
string script = "alert(No data available!!');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "ServerControlScript", script, true);
return;
}
dr.Close();
BindLIst();
}
}
}
public void CheckEligibility()
{
try
{
string sql = "Jct_Payroll_reimbursement_Voucher_Print";
SqlCommand cmd = new SqlCommand(sql, obj.Connection());
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = Session["EmpCode"];
//cmd.Parameters.Add("@YearMonth", SqlDbType.Int).Value = ViewState["YEARMONTH"];
//cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = Session["Empcode"];
cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = "9000000443";
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
}
}
dr.Close();
}
catch (Exception ex)
{
CheckEligile = 1;
string Scrpt = "alert('" + ex.Message + "');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "ServerControlScript", Scrpt, true);
}
}
public void BindLIst()
{
SqlCommand cmd = new SqlCommand("Jct_Payroll_Converyance_Voucher_Print_Detail", obj.Connection());
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add("@YearMonth", SqlDbType.Int).Value = ViewState["YEARMONTH"];
//cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = Session["Empcode"];
cmd.Parameters.Add("@EmployeeCode", SqlDbType.VarChar, 10).Value = "9000000443";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Width = new Unit("150px");
e.Row.Cells[1].Width = new Unit("200px");
e.Row.Cells[2].Width = new Unit("200px");
//e.Row.Cells[3].Width = new Unit("150px");
}
}
}