Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            PaySlipRPT01 rpt = new PaySlipRPT01();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnShow_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet dsGeneral = new DataSet();

                BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();

                dsGeneral = myReports.GetSupplierPaymentForPaySlipGeneral(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                dsGeneral.Tables[0].TableName = "GetSupplierPaymentForPaySlipGeneral";
                //dataSetReport.WriteXml("PaymentSlip.xml");

                DataSet dsGreenLeaf = myReports.GetSupplierPaymentForPaySlipGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                dsGreenLeaf.Tables[0].TableName = "GetSupplierPaymentForPaySlipGreenLeaf";
                // NewDt.WriteXml("DayGreenLeaf.xml");

                DataSet dsThisMonthIssues = myReports.GetSupplierPaymentForPaySlipThisMonthIssues(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                dsThisMonthIssues.Tables[0].TableName = "GetSupplierPaymentForPaySlipThisMonthIssues";
                //Newdt1.WriteXml("SalaryItems.xml");
                //GetCashBalance

                PaySlipRPT01 myaclist = new PaySlipRPT01();


                #region Payslip Paper Selection
                PrintDocument pDoc    = new PrintDocument();
                int           paperNo = 0;
                for (int j = 0; j < pDoc.PrinterSettings.PaperSizes.Count; j++)
                {
                    if (pDoc.PrinterSettings.PaperSizes[j].PaperName.Equals("lol1"))
                    {
                        paperNo = (int)pDoc.PrinterSettings.PaperSizes[j].RawKind;
                        break;
                    }
                }
                // myaclist.PrintOptions.PrinterName = "EPSON LQ-2190 ESC/P2";

                myaclist.PrintOptions.PaperSize   = (CrystalDecisions.Shared.PaperSize)paperNo;
                myaclist.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
                #endregion
                //BoughtleafPayslipRPT
                //DataSet FinalDs = new DataSet();
                //FinalDs.Tables.Add(dsGeneral.Tables[0]);
                //FinalDs.Tables.Add(dsGreenLeaf.Tables[0]);
                //FinalDs.Tables.Add(dsThisMonthIssues.Tables[0]);


                //myaclist.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;
                //myaclist.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;
                // myaclist.SetDataSource(dsGeneral.Tables[0]);
                //myaclist.SetDataSource(dsGreenLeaf.Tables[0]);
                // myaclist.SetDataSource(dsThisMonthIssues.Tables[0]);
                myaclist.Database.Tables["GetSupplierPaymentForPaySlipGeneral"].SetDataSource(dsGeneral.Tables[0]);
                myaclist.Database.Tables["GetSupplierPaymentForPaySlipGreenLeaf"].SetDataSource(dsGreenLeaf.Tables[0]);
                myaclist.Database.Tables["GetSupplierPaymentForPaySlipThisMonthIssues"].SetDataSource(dsThisMonthIssues.Tables[0]);
                //myaclist.Subreports["Leaf"].SetDataSource(NewDt);
                //myaclist.Subreports["Item"].SetDataSource(Newdt1);
                ReportViewer myReportViewer = new ReportViewer();
                //myaclist.SetParameterValue("year", cmbYear.Text);
                //myaclist.SetParameterValue("month", cmbMonth.Text);
                myReportViewer.crystalReportViewer1.ReportSource     = myaclist;
                myReportViewer.crystalReportViewer1.DisplayGroupTree = true;
                myReportViewer.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }