Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private DataSet GetData()
- {
- string select = "SELECT DISTINCT OrganisationId,OrganisationName,StaffId,StaffName,Department,Position,TaxIdNumber, SessionId,Month,Year,BasicSalary,TransAllowance,UtilityAllowance," +
- "HousingAllowance,Gratuities,Pension,(TaxExempts + MonthlyTaxDue) AS TotalDeduction,(GrossIncome - (TaxExempts + MonthlyTaxDue)) AS NetPay,OtherStatutoryDeductions,TaxExempts,MonthlyTaxDue,YearlyTaxdue, " +
- "GrossIncome FROM IncomeTax WHERE (OrganisationId = @OrganisationId AND Month = @Month AND Year = @Year) GROUP BY StaffID";
- using (SQLiteConnection con = new SQLiteConnection(connstring))
- {
- using (SQLiteCommand cmd = new SQLiteCommand(select))
- {
- using (SQLiteDataAdapter sda = new SQLiteDataAdapter())
- {
- cmd.Connection = con;
- sda.SelectCommand = cmd;
- cmd.CommandType = CommandType.Text;
- cmd.CommandTimeout = 9000000;
- cmd.Parameters.Add("@OrganisationId", DbType.String, 50).Value = txtOrgId.Text.ToUpper();
- cmd.Parameters.Add("@StaffId", DbType.String, 50).Value = txtStaffId.Text.ToUpper();
- cmd.Parameters.Add("@Month", DbType.String, 50).Value = cboMonthSearch.SelectedItem.ToString().ToUpper();
- cmd.Parameters.Add("@Year", DbType.String, 50).Value = cboYearSearch.SelectedItem.ToString().ToUpper();
- DataSet dsCustomers = new DataSet1();
- sda.Fill(dsCustomers, "After2011PaySlip");
- if (dsCustomers.Tables[4].Rows.Count == 0)
- {
- reportViewer1.Visible = false;
- MessageBox.Show("Records not found!");
- }
- else
- {
- reportViewer1.Visible = true;
- }
- return dsCustomers;
- }
- }
- }
- }
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- DataSet dsCustomers = GetData();
- ReportDataSource datasource = new ReportDataSource("DataSet1", dsCustomers.Tables[4]);
- this.reportViewer1.LocalReport.DataSources.Clear();
- reportViewer1.ProcessingMode = ProcessingMode.Local;
- // the ReportPath is relative to the page displaying the ReportViewer
- reportViewer1.LocalReport.ReportPath =
- "After2011PaySlipReport.rdlc";
- this.reportViewer1.LocalReport.DataSources.Add(datasource);
- this.reportViewer1.RefreshReport();
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement