Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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....


C#
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();

        }
Posted
Comments
thatraja 7-Jan-14 2:01am    
how much records you're getting in your dataset?
Vreeti 7-Jan-14 3:27am    
almost around 1500..
thatraja 7-Jan-14 4:17am    
Have you used any formulas in your report?
Vreeti 8-Jan-14 2:53am    
Yes, I had used to calculate the sum.
thatraja 8-Jan-14 2:54am    
Include those details in your question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900