public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptBPIListing rpt = new rptBPIListing(); rpt.Site = this.Site; return(rpt); }
public void loadBPIReport() { //=====Move to tempBPI movetoTempBPI(); CrystalDecisions.Shared.TableLogOnInfo li; //Get BPI Bank Information using (SqlConnection con = new SqlConnection(global.connectString())) { con.Open(); adapter = new SqlDataAdapter("SELECT * FROM Bank WHERE Bank_Code ='BPI'", con); DataTable dt = new DataTable(); adapter.Fill(dt); //========================================================================== // Ceiling //========================================================================== SqlDataAdapter adapterCeiling = new SqlDataAdapter("select min(Amount) from tempBPI", con); DataTable dtCeling = new DataTable(); adapterCeiling.Fill(dtCeling); //========================================================================== // Get the total sum of accnt no //========================================================================== SqlDataAdapter adapterAccntNo = new SqlDataAdapter("SELECT sum(CONVERT(BIGINT,accntNo)) from TempBPI ", con); DataTable dtAccnt = new DataTable(); adapterAccntNo.Fill(dtAccnt); //========================================================================== // Get the total sum of amount //========================================================================== SqlDataAdapter adpAmount = new SqlDataAdapter("SELECT sum(amount) from TempBPI ", con); DataTable dtAmount = new DataTable(); adpAmount.Fill(dtAmount); 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.rptBPIListing cr = new ReportsForms.rptBPIListing(); ReportsForms.rptBPI rpt = new ReportsForms.rptBPI(); li = new TableLogOnInfo(); li.ConnectionInfo.IntegratedSecurity = false; //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); //==============param for listing cr.SetParameterValue("paramCompanyCode", txtCompanyCOde.Text); cr.SetParameterValue("paramBatch", txtTrans.Text); cr.SetParameterValue("paramAccntNo", txtAccountNo.Text); cr.SetParameterValue("paramCeiling", Convert.ToDecimal(dtCeling.Rows[0].ItemArray[0].ToString()).ToString("#,0.00")); cr.SetParameterValue("paramTotal", Convert.ToDecimal(dtAmount.Rows[0].ItemArray[0].ToString()).ToString("#,0.00")); cr.SetParameterValue("paramAccntSum", Convert.ToInt64(dtAccnt.Rows[0].ItemArray[0].ToString())); 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: BPI" + 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(); } }