Hi All,
I have been developing crystal reports (windows application) for my organisation's salary slip. I have created the design and all and the same is working fine too. But the problem is that, I get around 1500 peoples records and the crystal report shows me only 62 peoples salary slips.
I am using SQL query to fetch the records. Then store the output in and dataset and then pass this dataset as a report source to my crystal report.
Below is my code....
private void frmReport_Load(object sender, EventArgs e)
{
string month = frmMain.Month;
string year = frmMain.Year;
string location = frmMain.Location;
string dept = frmMain.Dept;
string str = "";
str = "Select PaySlipForTheMonth,EmpID, EmpName, Designation, Department, Location, Gender, EmpLevel [Level], ";
str += "Arrears30Days, DOJ,PAN, ModeOfPayment, BankACNo, PFNo, ESICNo, Paydays, Arrears31Days, ";
str += "LoginHoursShortfallDays,RtBasicSalary,BasicSalary,ArrearBasicSalary,RtHRA,HRA,ArrearHRA,RtConveyance, ";
str += "Conveyance,ArrearConveyance,RtCCA,CCA,ArrearCCA,RtAttendanceIncentive,AttendanceIncentive, ";
str += "ArrearAttendanceIncentive,RtPerformanceAllowance,PerformanceAllowance,ArrearPerformanceAllowance, ";
str += "RtRetentionBonus,RetentionBonus,ArrearRetentionBonus,RtRBSSAllowance,RBSSAllowance,ArrearRBSSAllowance, ";
str += "RtBonus,Bonus,ArrearBonus,RtIncentive,Incentive,ArrearIncentive,RtReferalBonus,ReferalBonus, ";
str += "ArrearReferalBonus,RtOtherEarnings,OtherEarnings,ArrearOtherEarning,RtStipend,Stipend,ArrearStipend, ";
str += "ProvidentFund,ESIC,LoginHourDeduction,OtherDeduction,Recovery,TDS,MLWF,PTAX,SalaryAdvance,RtGrossPay, ";
str += "GrossPay,ArrearGrossPay,TotGrossPay,GrossDeduction,NetPay,InWords,Month,Year ";
str += "from Salary_Slip where EmpName <> '' and Location = '" + location + "' and ";
str += "MONTH = " + month + " and YEAR=" + year + "";
if (dept != "All")
{
str += "and Department = '" + dept +"'";
}
cmd.CommandText = str;
cmd.Connection = con;
cmd.Connection.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
ReportSalary report = new ReportSalary();
report.SetDataSource(ds);
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.Refresh();
}