Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptItemSL rpt = new rptItemSL();

            rpt.Site = this.Site;
            return(rpt);
        }
Пример #2
0
        private void btnPriview_Click(object sender, EventArgs e)
        {
            if (radioAll.Checked == true)
            {
                SqlConnection  connection = ConnectDB.GetSqlConnection();
                string         query      = " select a.Groups,L.Ledgers,L.Address,L.Mobile,a.Credit,a.Debit,a.Narration,a.Item,a.DQty,a.WQty,a.Unit,a.Date  from Accounts a inner join Ledgers L on a.Ledgers_ID=L.LNo where a.Groups = N'" + cmbGroups.Text + "' and a.Ledgers_ID= N'" + txtLI.Text + "' and a.Item = N'" + cmbItem.Text + "' order by a.Date";
                SqlDataAdapter ad1        = new SqlDataAdapter(query, connection);
                string         query1     = "select * from Company";

                SqlDataAdapter ad = new SqlDataAdapter(query1, connection);
                DSItemSL       DS = new DSItemSL();
                ad.Fill(DS, "Company");
                ad1.Fill(DS, "Accounts");
                rptItemSL cr = new rptItemSL();
                //cr.SetDataSource(DS);
                cr.SetDataSource(DS);
                Print f2 = new Print();
                f2.Show();
                f2.crystalReportViewer1.ReportSource = cr;
                f2.crystalReportViewer1.Refresh();
            }
            if (radioRanged.Checked == true)
            {
                SqlConnection  connection = ConnectDB.GetSqlConnection();
                string         query      = " select a.Groups,L.Ledgers,L.Address,L.Mobile,a.Credit,a.Debit,a.Narration,a.Item,a.DQty,a.WQty,a.Unit,a.Date  from Accounts a inner join Ledgers L on a.Ledgers_ID=L.LNo where a.Groups = N'" + cmbGroups.Text + "' and a.Ledgers_ID= N'" + txtLI.Text + "' and a.Item = N'" + cmbItem.Text + "' and (Convert(Datetime,a.Date,103) between Convert(Datetime,'" + From.Text + "',103) and Convert(Datetime,'" + To.Text + "',103)) order by a.Date ";
                SqlDataAdapter ad1        = new SqlDataAdapter(query, connection);
                string         query1     = "select * from Company";

                SqlDataAdapter ad = new SqlDataAdapter(query1, connection);
                DSItemSL       DS = new DSItemSL();
                ad.Fill(DS, "Company");
                ad1.Fill(DS, "Accounts");
                rptItemSLs cr = new rptItemSLs();
                //cr.SetDataSource(DS);
                cr.SetDataSource(DS);
                Print f2 = new Print();
                f2.Show();
                ParameterFieldDefinitions crParameterFieldDefinitions;

                ParameterFieldDefinition crParameterFieldDefinition1;
                ParameterFieldDefinition crParameterFieldDefinition2;
                //ParameterFieldDefinition crParameterFieldDefinition3;
                //ParameterFieldDefinition crParameterFieldDefinition4;

                ParameterValues crParameterValues1 = new ParameterValues();
                ParameterValues crParameterValues2 = new ParameterValues();
                //ParameterValues crParameterValues3 = new ParameterValues();
                //ParameterValues crParameterValues4 = new ParameterValues();

                ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();
                ParameterDiscreteValue crParameterDiscreteValue2 = new ParameterDiscreteValue();
                //ParameterDiscreteValue crParameterDiscreteValue3 = new ParameterDiscreteValue();
                //ParameterDiscreteValue crParameterDiscreteValue4 = new ParameterDiscreteValue();

                crParameterDiscreteValue1.Value = From.Text;
                crParameterDiscreteValue2.Value = To.Text;
                //crParameterDiscreteValue3.Value = txtDueAmount.Text;
                //crParameterDiscreteValue4.Value = txtPaid.Text;

                crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;

                crParameterFieldDefinition1 = crParameterFieldDefinitions["From"];
                crParameterFieldDefinition2 = crParameterFieldDefinitions["To"];
                //crParameterFieldDefinition3 = crParameterFieldDefinitions["Due Amount"];
                //crParameterFieldDefinition4 = crParameterFieldDefinitions["Paid"];

                crParameterValues1 = crParameterFieldDefinition1.CurrentValues;
                crParameterValues2 = crParameterFieldDefinition2.CurrentValues;
                //crParameterValues3 = crParameterFieldDefinition3.CurrentValues;
                //crParameterValues4 = crParameterFieldDefinition4.CurrentValues;

                crParameterValues1.Add(crParameterDiscreteValue1);
                crParameterValues2.Add(crParameterDiscreteValue2);
                //crParameterValues3.Add(crParameterDiscreteValue3);
                //crParameterValues4.Add(crParameterDiscreteValue4);

                crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);
                crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2);

                f2.crystalReportViewer1.ReportSource = cr;
                f2.crystalReportViewer1.Refresh();
            }
        }