コード例 #1
0
        private void BtnPrint_Click(object sender, EventArgs e)
        {
            // LedgerGridView.ShowRibbonPrintPreview();
            payroll.FormReports.PrintReportViewer frm    = new payroll.FormReports.PrintReportViewer();
            Prints.PartyLedgerUpdated             Report = new Prints.PartyLedgerUpdated();
            Report.txtCompanyName.Text = GlobalVariables.CompanyName;
            Report.txtReportName.Text  = "Statement of Accounts";
            Report.txtDateRange.Text   = "From " + Convert.ToDateTime(_SelectRange.DtFrom.Text).ToString("dd-MM-yyyy") + " To " + Convert.ToDateTime(_SelectRange.DtEnd.Text).ToString("dd-MM-yyyy");


            int count = 0;

            foreach (DataRow dr in (_SelectRange.HelpGrid.DataSource as DataTable).Rows)
            {
                if (dr["Select"].ToString().ToUpper() == "TRUE")
                {
                    count++;
                }
            }

            if (count == 1)
            {
                Report.txtensumd.Visible = false;
                Report.txtenbal.Visible  = false;
                Report.txtensunc.Visible = false;
                Report.xrLine1.Visible   = false;
                Report.xrLabel16.Visible = false;
            }
            else
            {
                Report.txtensumd.Visible = true;
                Report.txtenbal.Visible  = true;
                Report.txtensunc.Visible = true;
                Report.xrLine1.Visible   = true;
                Report.xrLabel16.Visible = true;
            }
            Report.DataSource = dt;
            frm.documentViewer1.DocumentSource = Report;
            frm.ShowDialog();
        }
コード例 #2
0
        private void SimpleButton2_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ds = ProjectFunctions.GetDataSet("sp_GSTSaleDiffData '" + txtDocNo.Text + "' ,'" + Convert.ToDateTime(txtDocDate.Text).ToString("yyyy-MM-dd") + "'");

                if (ds.Tables[0].Rows.Count > 0)
                {
                    WindowsFormsApplication1.Prints.PartyReco rpt = new Prints.PartyReco
                    {
                        DataSource = ds
                    };

                    foreach (XRSubreport sub in rpt.AllControls <XRSubreport>())
                    {
                        sub.ReportSource.DataSource = ds;
                    }


                    if (ds.Tables[3].Rows.Count > 0)
                    {
                        ds.Tables[3].Columns.Add("Total", typeof(Decimal));
                        ds.Tables[3].Rows[0]["Total"] = Convert.ToDecimal(ds.Tables[1].Rows[4][1]) + Convert.ToDecimal(ds.Tables[2].Rows[4][1]);
                    }

                    ds.WriteXmlSchema("C:\\Temp\\abc.xml");
                    payroll.FormReports.PrintReportViewer frm = new payroll.FormReports.PrintReportViewer();
                    frm.documentViewer1.DocumentSource = rpt;
                    frm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError(ex.Message);
            }
        }