Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptBDOListing rpt = new rptBDOListing();

            rpt.Site = this.Site;
            return(rpt);
        }
Esempio n. 2
0
        public void loadBDOReport()
        {
            using (SqlConnection con = new SqlConnection(global.connectString()))
            {
                con.Open();

                CrystalDecisions.Shared.TableLogOnInfo li;

                //===============================================
                //          GETTING BANK INFO
                //===============================================
                adapter = new SqlDataAdapter("SELECT * FROM Bank WHERE Bank_Code ='BDO'", con);
                DataTable dt = new DataTable();
                adapter.Fill(dt);


                //===============================================
                //          STRING QUERY
                //===============================================
                int icount = 0;
                purpose = "";
                foreach (ListViewItem lItem in listView1.Items)
                {
                    if (lItem.Checked == true)
                    {
                        icount = icount + 1;
                    }
                }

                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    if (listView1.Items[i].Checked == true)
                    {
                        purpose += "'" + getBetween(listView1.Items[i].Text, "-") + "'";
                        if (i != icount - 1)
                        {
                            purpose += " , ";
                        }
                    }
                }

                string         str      = "select distinct account_No,sum(Amount) as Amount,Name FROM ATM where Bank_Code='" + cmbBank.Text + "' and Deposited is null and purpose in (" + purpose + ") GROUP BY Account_No,Name Order by Name ASC";
                SqlDataAdapter adapter1 = new SqlDataAdapter(str, con);
                DataTable      dt1      = new DataTable();
                DataSet        ds       = new DataSet();



                string contactPerson = dt.Rows[0].ItemArray[7].ToString();
                string bnkName       = dt.Rows[0].ItemArray[1].ToString();
                string branchName    = dt.Rows[0].ItemArray[2].ToString();

                ReportsForms.rptBDOListing cr  = new ReportsForms.rptBDOListing();
                ReportsForms.rptBDO        rpt = new ReportsForms.rptBDO();

                li = new TableLogOnInfo();

                li.ConnectionInfo.IntegratedSecurity = false;

                adapter1.Fill(ds, "ATM");
                dt = ds.Tables["ATM"];
                cr.SetDataSource(ds.Tables["ATM"]);

                //cr.SetDatabaseLogon("sa", "SYSADMIN", "192.168.255.176", "PECCI-NEW");
                cr.SetDatabaseLogon(global.username, global.pass, global.datasource, global.initialCatalog);

                cr.SetParameterValue("maincontactperson", contactPerson);
                cr.SetParameterValue("mainbankName", bnkName);
                cr.SetParameterValue("mainbranch", branchName);

                try
                {
                    string num = txtDepositAmount.Text;

                    string word;


                    if (txtDepositAmount.Text == "")
                    {
                        txtDepositAmount.Text = "";
                    }
                    else
                    {
                        number = decimal.Parse(num.ToString());

                        if (number.ToString() == "0")
                        {
                            MessageBox.Show("The number in currency fomat is \nZero Only");
                        }
                        else
                        {
                            word = Classes.clsSavingsDataEntry.ConvertToWords(number.ToString());
                        }
                    }


                    Console.ReadKey();
                }
                catch (System.Exception ex)
                {
                }


                string Msg = Classes.clsSavingsDataEntry.ConvertToWords(number.ToString()) + " (P " + txtDepositAmount.Text + ")";

                cr.SetParameterValue("mainmsg", Msg);
                cr.SetParameterValue("mainaccntNumber", txtAccountNo.Text);
                cr.SetParameterValue("mainpurpose", "loans/savings/refund");
                string dref = DateTime.Now.ToString("yyyy-MM-dd");
                cr.SetParameterValue("mainrefno", "Reference No: BDO" + dref.Replace("-", "") + txtTrans.Text);

                //Signature
                cr.SetParameterValue("mainsig1Name", sig1name.Text);
                cr.SetParameterValue("mainsig1pos", sig1pos.Text);
                cr.SetParameterValue("mainsig2name", sig2name.Text);
                cr.SetParameterValue("mainsig2pos", sig2pos.Text);
                cr.SetParameterValue("mainsig3name", sig3name.Text);
                cr.SetParameterValue("mainsig3pos", sig3pos.Text);


                rpt.crystalReportViewer1.ReportSource = cr;
                rpt.ShowDialog();
            }
        }