S
STARASOFT
Guest
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class frmRptsqlStoedProc : Form
{
private delegate IntPtr GetWindowHandleDelegate();
private static List<WeakReference> __ENCList = new List<WeakReference>();
private IContainer components;
[AccessedThroughProperty("CrystalReportViewer1")]
private CrystalReportViewer CrystalReportViewer1;
private ReportDocument cryRpt;
private PrintDocument printDocument1;
private CrystalDecisions.Shared.PaperSize pkzise;
private PrintDialog printDialog1;
private ReportDocument report;
private ParameterField crParamDef;
private ParameterFields crParamDefs;
private ParameterDiscreteValue paramDiscreteValue;
// private CRAXDRT.DatabaseFieldDefinition sTemp;
// private DatabaseTable crDBTab;
private int I;
private bool rptSort;
private int SortFieldInd;
private int sortAsc;
public frmRptsqlStoedProc()
{
base.Load += frmRptsqlStoedProc_Load;
base.Activated += frmRptsqlStoedProc_Activated;
base.FormClosed += frmRptsqlStoedProc_FormClosed;
lock (__ENCList)
{
__ENCList.Add(new WeakReference(this));
}
cryRpt = new ReportDocument();
report = new ReportDocument();
InitializeComponent();
}
[DebuggerNonUserCode]
protected override void Dispose(bool disposing)
{
try
{
if ((disposing && components != null) ? true : false)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
[System.Diagnostics.DebuggerStepThrough]
private void InitializeComponent()
{
this.CrystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
this.SuspendLayout();
//
// CrystalReportViewer1
//
this.CrystalReportViewer1.ActiveViewIndex = -1;
this.CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.CrystalReportViewer1.Cursor = System.Windows.Forms.Cursors.Default;
this.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.CrystalReportViewer1.Location = new System.Drawing.Point(0, 0);
this.CrystalReportViewer1.Name = "CrystalReportViewer1";
this.CrystalReportViewer1.Size = new System.Drawing.Size(907, 489);
this.CrystalReportViewer1.TabIndex = 0;
//
// frmRptsqlStoedProc
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(907, 489);
this.Controls.Add(this.CrystalReportViewer1);
this.Name = "frmRptsqlStoedProc";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Report";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
[DllImport("user32", CharSet = CharSet.Ansi, EntryPoint = "FindWindowA", ExactSpelling = true, SetLastError = true)]
private static extern long Findwindow([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpClassName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpWindowName);
private IntPtr GetWindowHandle()
{
if (InvokeRequired)
{
return (IntPtr)Invoke((GetWindowHandleDelegate)(() => GetWindowHandle()));
}
return Handle;
}
private void frmRptsqlStoedProc_Activated(object sender, EventArgs e)
{
}
private void frmRptsqlStoedProc_FormClosed(object sender, FormClosedEventArgs e)
{
Dispose();
Close();
}
private void frmRptsqlStoedProc_Load(object sender, EventArgs e)
{
TopMost = false;
Text = connection.strrptfile;
ParameterField crParamDef = new ParameterField();
ParameterField crParamDef1 = new ParameterField();
ParameterField crParamDef2 = new ParameterField();
ParameterField crParamDef3 = new ParameterField();
ParameterField crParamDef4 = new ParameterField();
ParameterField crParamDef5 = new ParameterField();
ParameterField crParamDef6 = new ParameterField();
ParameterField crParamDef7 = new ParameterField();
ParameterField crParamDef8 = new ParameterField();
ParameterField crParamDef9 = new ParameterField();
ParameterField crParamDef10 = new ParameterField();
ParameterField crParamDef11 = new ParameterField();
ParameterField crParamDef12 = new ParameterField();
ParameterField crParamDef13 = new ParameterField();
ParameterField crParamDef14 = new ParameterField();
report.Load(MyProject.Application.Info.DirectoryPath + "\\REPORTS\\" + connection.strrptfile);
int num = 0;
PrintDialog printDialog = new PrintDialog();
printDialog.AllowSelection = false;
ConnectionInfo crConnectionInfo = new ConnectionInfo();
ConnectionInfo connectionInfo = crConnectionInfo;
connectionInfo.ServerName = connection.strservername;
connectionInfo.DatabaseName = connection.strdbname;
connectionInfo.UserID = connection.struserid;
connectionInfo.Password = connection.strpassword;
connectionInfo = null;
IEnumerator enumerator = default(IEnumerator);
try
{
enumerator = report.Database.Tables.GetEnumerator();
while (enumerator.MoveNext())
{
CrystalDecisions.CrystalReports.Engine.Table crTable = (CrystalDecisions.CrystalReports.Engine.Table)enumerator.Current;
TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogonInfo);
}
}
finally
{
if (enumerator is IDisposable)
{
(enumerator as IDisposable).Dispose();
}
}
if ((Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLBILL.RPT", TextCompare: true) != 0) & (Operators.CompareString(Strings.UCase(connection.strrptfile), "PAYMENTRECEIPTTOPUP.RPT", TextCompare: true) != 0) & (Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLCOUNTER.RPT", TextCompare: true) != 0))
{
}
ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue1 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue2 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue3 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue4 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue5 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue6 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue7 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue8 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue9 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue10 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue11 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue12 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue13 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue14 = new ParameterDiscreteValue();
if (Operators.CompareString(crParamDef.ParameterFieldName, "@TableName", TextCompare: true) == 0)
{
myDiscreteValue.Value = RuntimeHelpers.GetObjectValue(connection.arrRptTables[1]);
crParamDef.CurrentValues.Add(myDiscreteValue);
crParamDefs.Add(crParamDef);
}
else if (Operators.CompareString(crParamDef1.ParameterFieldName, "date", TextCompare: true) == 0)
{
if (Operators.CompareString(connection.strrptfile, "crCustomizeSaleCost.rpt", TextCompare: true) != 0)
{
if (Information.IsDate(RuntimeHelpers.GetObjectValue(connection.arrRptPara[2])))
{
myDiscreteValue1.Value = Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[2]), "dd/mm/yyyy") + " To " + Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[3]), "dd/mm/yyyy");
crParamDef1.CurrentValues.Add(myDiscreteValue1);
crParamDefs.Add(crParamDef1);
}
else
{
myDiscreteValue1.Value = Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[3]), "dd/mm/yyyy") + " To " + Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[4]), "dd/mm/yyyy");
crParamDef1.CurrentValues.Add(myDiscreteValue1);
crParamDefs.Add(crParamDef1);
}
}
}
else if (Operators.CompareString(crParamDef2.ParameterFieldName, "itemcode", TextCompare: true) == 0)
{
if (Operators.CompareString(connection.strrptfile, "crCustomizeSaleCost.rpt", TextCompare: true) != 0)
{
if (Operators.CompareString(Strings.Trim(Conversions.ToString(connection.arrRptPara[1])), "", TextCompare: true) != 0)
{
if (!rptSort)
{
myDiscreteValue2.Value = Operators.ConcatenateObject(Operators.ConcatenateObject(connection.arrRptPara[1], " To "), connection.arrRptPara[2]);
crParamDef2.CurrentValues.Add(myDiscreteValue2);
crParamDefs.Add(crParamDef2);
}
else
{
myDiscreteValue2.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[1]);
crParamDef2.CurrentValues.Add(myDiscreteValue2);
crParamDefs.Add(crParamDef2);
}
}
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "rvno", TextCompare: true) == 0)
{
if ((double)connection.mrvno != Conversions.ToDouble("0"))
{
myDiscreteValue3.Value = Conversions.ToString(connection.mrvno);
crParamDef3.CurrentValues.Add(myDiscreteValue3);
crParamDefs.Add(crParamDef3);
}
else
{
myDiscreteValue3.Value = Conversions.ToString(connection.mrvno);
crParamDef3.CurrentValues.Add(myDiscreteValue3);
crParamDefs.Add(crParamDef3);
}
}
else if (Operators.CompareString(crParamDef4.ParameterFieldName, "@FromCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[0], "", TextCompare: true))
{
myDiscreteValue4.Value = Conversions.ToString(connection.arrRptPara[0]);
crParamDef4.CurrentValues.Add(myDiscreteValue4);
crParamDefs.Add(crParamDef4);
}
else
{
myDiscreteValue4.Value = "";
crParamDef4.CurrentValues.Add(myDiscreteValue4);
crParamDefs.Add(crParamDef4);
}
}
else if (Operators.CompareString(crParamDef5.ParameterFieldName, "@ToCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[1], "", TextCompare: true))
{
myDiscreteValue5.Value = Conversions.ToString(connection.arrRptPara[1]);
crParamDef5.CurrentValues.Add(myDiscreteValue5);
crParamDefs.Add(crParamDef5);
}
else
{
myDiscreteValue5.Value = "";
crParamDef5.CurrentValues.Add(myDiscreteValue5);
crParamDefs.Add(crParamDef5);
}
}
else if (Operators.CompareString(crParamDef6.ParameterFieldName, "@SupID", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[2], "", TextCompare: true))
{
myDiscreteValue6.Value = Conversions.ToString(connection.arrRptPara[2]);
crParamDef6.CurrentValues.Add(myDiscreteValue6);
crParamDefs.Add(crParamDef6);
}
else
{
myDiscreteValue6.Value = "";
crParamDef6.CurrentValues.Add(myDiscreteValue6);
crParamDefs.Add(crParamDef6);
}
}
else if (Operators.CompareString(crParamDef7.ParameterFieldName, "date", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[3], "", TextCompare: true))
{
myDiscreteValue7.Value = Conversions.ToString(connection.arrRptPara[3]);
crParamDef7.CurrentValues.Add(myDiscreteValue7);
crParamDefs.Add(crParamDef7);
}
else
{
myDiscreteValue7.Value = "";
crParamDef7.CurrentValues.Add(myDiscreteValue7);
crParamDefs.Add(crParamDef7);
}
}
else if (Operators.CompareString(crParamDef8.ParameterFieldName, "@FromDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[4], "", TextCompare: true))
{
myDiscreteValue8.Value = Conversions.ToDate(connection.arrRptPara[4]);
crParamDef8.CurrentValues.Add(myDiscreteValue8);
crParamDefs.Add(crParamDef8);
}
else
{
myDiscreteValue8.Value = Conversions.ToDate(connection.arrRptPara[4]);
crParamDef8.CurrentValues.Add(myDiscreteValue8);
crParamDefs.Add(crParamDef8);
}
}
else if (Operators.CompareString(crParamDef9.ParameterFieldName, "@ToDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[5], "", TextCompare: true))
{
myDiscreteValue9.Value = Conversions.ToDate(connection.arrRptPara[5]);
crParamDef9.CurrentValues.Add(myDiscreteValue9);
crParamDefs.Add(crParamDef9);
}
else
{
myDiscreteValue9.Value = Conversions.ToDate(connection.arrRptPara[5]);
crParamDef9.CurrentValues.Add(myDiscreteValue9);
crParamDefs.Add(crParamDef9);
}
}
else if (Operators.CompareString(crParamDef10.ParameterFieldName, "@StoreCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[6], "", TextCompare: true))
{
myDiscreteValue10.Value = Conversions.ToString(connection.arrRptPara[6]);
crParamDef10.CurrentValues.Add(myDiscreteValue10);
crParamDefs.Add(crParamDef10);
}
else
{
myDiscreteValue10.Value = "";
crParamDef10.CurrentValues.Add(myDiscreteValue10);
crParamDefs.Add(crParamDef10);
}
}
else if (Operators.CompareString(crParamDef11.ParameterFieldName, "@StationNo", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[7], "", TextCompare: true))
{
myDiscreteValue11.Value = Conversions.ToString(connection.arrRptPara[7]);
crParamDef11.CurrentValues.Add(myDiscreteValue11);
crParamDefs.Add(crParamDef11);
}
else
{
myDiscreteValue11.Value = "";
crParamDef11.CurrentValues.Add(myDiscreteValue11);
crParamDefs.Add(crParamDef11);
}
}
/* else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@SupplierCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[8], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[8]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@CatCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[9], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[9]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@Debit", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[10], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[10]);
}
else
{
myDiscreteValue3.Value = "";
}
}
*/
else if (Operators.CompareString(crParamDef12.ParameterFieldName, "@StoreName", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[30], "", TextCompare: true))
{
myDiscreteValue12.Value = Conversions.ToString(connection.arrRptPara[30]);
crParamDef12.CurrentValues.Add(myDiscreteValue12);
crParamDefs.Add(crParamDef12);
}
else
{
myDiscreteValue12.Value = "";
crParamDef12.CurrentValues.Add(myDiscreteValue12);
crParamDefs.Add(crParamDef12);
}
}
else if (Operators.CompareString(crParamDef13.ParameterFieldName, "@StoreNameFin", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[31], "", TextCompare: true))
{
myDiscreteValue13.Value = Conversions.ToString(connection.arrRptPara[31]);
crParamDef13.CurrentValues.Add(myDiscreteValue13);
crParamDefs.Add(crParamDef13);
}
else
{
myDiscreteValue13.Value = "";
crParamDef13.CurrentValues.Add(myDiscreteValue13);
crParamDefs.Add(crParamDef13);
}
}
/* else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@ABWORD", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[12], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[12]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTSErial_No", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[13], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[13]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTVoucherType", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[14], "", TextCompare: true))
{
myDiscreteValue3.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[14]);
}
else
{
myDiscreteValue3.Value = "0";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "AmountInWords", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[15], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[15]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "StoreName", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[16], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[16]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[17], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[17]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[17]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "EDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[18], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[18]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[18]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "EndDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[23], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[23]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[23]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SPDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[19], "", TextCompare: true))
{
myDiscreteValue3.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[19]);
}
else
{
myDiscreteValue3.Value = "0";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[20], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[20]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ECode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[21], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[21]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTPrintAll", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectEqual(connection.arrRptPara[22], "TRUE", TextCompare: true))
{
myDiscreteValue3.Value = true;
}
else
{
myDiscreteValue3.Value = false;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "BILLNO", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[29], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[29]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "BILLTYPE", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[28], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[28]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@Userid", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[33], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[33]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@AtNo", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[34], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversion.Val(RuntimeHelpers.GetObjectValue(connection.arrRptPara[34]));
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@strCond", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[35], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[35]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "FromDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[36], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[36]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[36]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ToDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[37], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[37]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[37]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "rpc", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[38], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[38]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SSCODE", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[39], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[39]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@FromTime", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[40], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[40]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@ToTime", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[41], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[41]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ntpur", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[42], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[42]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "taxas", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[43], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[43]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "optax", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[44], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[44]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ntaxas", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[45], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[45]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "totpur", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[46], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[46]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "mdate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[47], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[47]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "wh", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[48], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[48]);
}
else
{
myDiscreteValue3.Value = "";
}
}
*/
if ((Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLBILL.RPT", TextCompare: true) == 0) | (Operators.CompareString(Strings.UCase(connection.strrptfile), "PAYMENTRECEIPTTOPUP.RPT", TextCompare: true) == 0) | (Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLCOUNTER.RPT", TextCompare: true) == 0))
{
CrystalReportViewer1.Visible = false;
if (!connection.DISPLAYPRINTPROGRESS)
{
// CrystalReportViewer1.EnableProgressControl = false;
}
else
{
// CrystalReportViewer1.EnableProgressControl = true;
}
//CrystalReportViewer1.EnablePopupMenu = false;
if (!connection.DISPLAYPRINTPROGRESS)
{
// report.DisplayProgressDialog = false;
}
else
{
// report.DisplayProgressDialog = true;
}
// report.PrintOut(false, 1, Missing.Value, Missing.Value, Missing.Value);
Close();
return;
}
rptSort = false;
SortFieldInd = 1;
sortAsc = 0;
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.ParameterFieldInfo = crParamDefs;
MessageBox.Show("your report pm " + crParamDefs);
if (connection.NOGROUP)
{
// CrystalReportViewer1.EnableGroupTree = false;
// CrystalReportViewer1.EnableProgressControl = false;
// CrystalReportViewer1.EnableRefreshButton = false;
}
CrystalReportViewer1.Zoom(checked((short)connection.reportzoom));
}
private void CrystalReportViewer1_Enter(object sender, EventArgs e)
{
}
private void CrystalReportViewer1_Load(object sender, EventArgs e)
{
}
}
when i view report ask me for enter parameters...
I use multi reports in single report viewer
i try if parameter exist then file value pick form connection,(class)
Continue reading...
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class frmRptsqlStoedProc : Form
{
private delegate IntPtr GetWindowHandleDelegate();
private static List<WeakReference> __ENCList = new List<WeakReference>();
private IContainer components;
[AccessedThroughProperty("CrystalReportViewer1")]
private CrystalReportViewer CrystalReportViewer1;
private ReportDocument cryRpt;
private PrintDocument printDocument1;
private CrystalDecisions.Shared.PaperSize pkzise;
private PrintDialog printDialog1;
private ReportDocument report;
private ParameterField crParamDef;
private ParameterFields crParamDefs;
private ParameterDiscreteValue paramDiscreteValue;
// private CRAXDRT.DatabaseFieldDefinition sTemp;
// private DatabaseTable crDBTab;
private int I;
private bool rptSort;
private int SortFieldInd;
private int sortAsc;
public frmRptsqlStoedProc()
{
base.Load += frmRptsqlStoedProc_Load;
base.Activated += frmRptsqlStoedProc_Activated;
base.FormClosed += frmRptsqlStoedProc_FormClosed;
lock (__ENCList)
{
__ENCList.Add(new WeakReference(this));
}
cryRpt = new ReportDocument();
report = new ReportDocument();
InitializeComponent();
}
[DebuggerNonUserCode]
protected override void Dispose(bool disposing)
{
try
{
if ((disposing && components != null) ? true : false)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
[System.Diagnostics.DebuggerStepThrough]
private void InitializeComponent()
{
this.CrystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
this.SuspendLayout();
//
// CrystalReportViewer1
//
this.CrystalReportViewer1.ActiveViewIndex = -1;
this.CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.CrystalReportViewer1.Cursor = System.Windows.Forms.Cursors.Default;
this.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.CrystalReportViewer1.Location = new System.Drawing.Point(0, 0);
this.CrystalReportViewer1.Name = "CrystalReportViewer1";
this.CrystalReportViewer1.Size = new System.Drawing.Size(907, 489);
this.CrystalReportViewer1.TabIndex = 0;
//
// frmRptsqlStoedProc
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(907, 489);
this.Controls.Add(this.CrystalReportViewer1);
this.Name = "frmRptsqlStoedProc";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Report";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
[DllImport("user32", CharSet = CharSet.Ansi, EntryPoint = "FindWindowA", ExactSpelling = true, SetLastError = true)]
private static extern long Findwindow([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpClassName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpWindowName);
private IntPtr GetWindowHandle()
{
if (InvokeRequired)
{
return (IntPtr)Invoke((GetWindowHandleDelegate)(() => GetWindowHandle()));
}
return Handle;
}
private void frmRptsqlStoedProc_Activated(object sender, EventArgs e)
{
}
private void frmRptsqlStoedProc_FormClosed(object sender, FormClosedEventArgs e)
{
Dispose();
Close();
}
private void frmRptsqlStoedProc_Load(object sender, EventArgs e)
{
TopMost = false;
Text = connection.strrptfile;
ParameterField crParamDef = new ParameterField();
ParameterField crParamDef1 = new ParameterField();
ParameterField crParamDef2 = new ParameterField();
ParameterField crParamDef3 = new ParameterField();
ParameterField crParamDef4 = new ParameterField();
ParameterField crParamDef5 = new ParameterField();
ParameterField crParamDef6 = new ParameterField();
ParameterField crParamDef7 = new ParameterField();
ParameterField crParamDef8 = new ParameterField();
ParameterField crParamDef9 = new ParameterField();
ParameterField crParamDef10 = new ParameterField();
ParameterField crParamDef11 = new ParameterField();
ParameterField crParamDef12 = new ParameterField();
ParameterField crParamDef13 = new ParameterField();
ParameterField crParamDef14 = new ParameterField();
report.Load(MyProject.Application.Info.DirectoryPath + "\\REPORTS\\" + connection.strrptfile);
int num = 0;
PrintDialog printDialog = new PrintDialog();
printDialog.AllowSelection = false;
ConnectionInfo crConnectionInfo = new ConnectionInfo();
ConnectionInfo connectionInfo = crConnectionInfo;
connectionInfo.ServerName = connection.strservername;
connectionInfo.DatabaseName = connection.strdbname;
connectionInfo.UserID = connection.struserid;
connectionInfo.Password = connection.strpassword;
connectionInfo = null;
IEnumerator enumerator = default(IEnumerator);
try
{
enumerator = report.Database.Tables.GetEnumerator();
while (enumerator.MoveNext())
{
CrystalDecisions.CrystalReports.Engine.Table crTable = (CrystalDecisions.CrystalReports.Engine.Table)enumerator.Current;
TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogonInfo);
}
}
finally
{
if (enumerator is IDisposable)
{
(enumerator as IDisposable).Dispose();
}
}
if ((Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLBILL.RPT", TextCompare: true) != 0) & (Operators.CompareString(Strings.UCase(connection.strrptfile), "PAYMENTRECEIPTTOPUP.RPT", TextCompare: true) != 0) & (Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLCOUNTER.RPT", TextCompare: true) != 0))
{
}
ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue1 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue2 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue3 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue4 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue5 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue6 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue7 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue8 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue9 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue10 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue11 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue12 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue13 = new ParameterDiscreteValue();
ParameterDiscreteValue myDiscreteValue14 = new ParameterDiscreteValue();
if (Operators.CompareString(crParamDef.ParameterFieldName, "@TableName", TextCompare: true) == 0)
{
myDiscreteValue.Value = RuntimeHelpers.GetObjectValue(connection.arrRptTables[1]);
crParamDef.CurrentValues.Add(myDiscreteValue);
crParamDefs.Add(crParamDef);
}
else if (Operators.CompareString(crParamDef1.ParameterFieldName, "date", TextCompare: true) == 0)
{
if (Operators.CompareString(connection.strrptfile, "crCustomizeSaleCost.rpt", TextCompare: true) != 0)
{
if (Information.IsDate(RuntimeHelpers.GetObjectValue(connection.arrRptPara[2])))
{
myDiscreteValue1.Value = Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[2]), "dd/mm/yyyy") + " To " + Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[3]), "dd/mm/yyyy");
crParamDef1.CurrentValues.Add(myDiscreteValue1);
crParamDefs.Add(crParamDef1);
}
else
{
myDiscreteValue1.Value = Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[3]), "dd/mm/yyyy") + " To " + Strings.Format(RuntimeHelpers.GetObjectValue(connection.arrRptPara[4]), "dd/mm/yyyy");
crParamDef1.CurrentValues.Add(myDiscreteValue1);
crParamDefs.Add(crParamDef1);
}
}
}
else if (Operators.CompareString(crParamDef2.ParameterFieldName, "itemcode", TextCompare: true) == 0)
{
if (Operators.CompareString(connection.strrptfile, "crCustomizeSaleCost.rpt", TextCompare: true) != 0)
{
if (Operators.CompareString(Strings.Trim(Conversions.ToString(connection.arrRptPara[1])), "", TextCompare: true) != 0)
{
if (!rptSort)
{
myDiscreteValue2.Value = Operators.ConcatenateObject(Operators.ConcatenateObject(connection.arrRptPara[1], " To "), connection.arrRptPara[2]);
crParamDef2.CurrentValues.Add(myDiscreteValue2);
crParamDefs.Add(crParamDef2);
}
else
{
myDiscreteValue2.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[1]);
crParamDef2.CurrentValues.Add(myDiscreteValue2);
crParamDefs.Add(crParamDef2);
}
}
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "rvno", TextCompare: true) == 0)
{
if ((double)connection.mrvno != Conversions.ToDouble("0"))
{
myDiscreteValue3.Value = Conversions.ToString(connection.mrvno);
crParamDef3.CurrentValues.Add(myDiscreteValue3);
crParamDefs.Add(crParamDef3);
}
else
{
myDiscreteValue3.Value = Conversions.ToString(connection.mrvno);
crParamDef3.CurrentValues.Add(myDiscreteValue3);
crParamDefs.Add(crParamDef3);
}
}
else if (Operators.CompareString(crParamDef4.ParameterFieldName, "@FromCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[0], "", TextCompare: true))
{
myDiscreteValue4.Value = Conversions.ToString(connection.arrRptPara[0]);
crParamDef4.CurrentValues.Add(myDiscreteValue4);
crParamDefs.Add(crParamDef4);
}
else
{
myDiscreteValue4.Value = "";
crParamDef4.CurrentValues.Add(myDiscreteValue4);
crParamDefs.Add(crParamDef4);
}
}
else if (Operators.CompareString(crParamDef5.ParameterFieldName, "@ToCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[1], "", TextCompare: true))
{
myDiscreteValue5.Value = Conversions.ToString(connection.arrRptPara[1]);
crParamDef5.CurrentValues.Add(myDiscreteValue5);
crParamDefs.Add(crParamDef5);
}
else
{
myDiscreteValue5.Value = "";
crParamDef5.CurrentValues.Add(myDiscreteValue5);
crParamDefs.Add(crParamDef5);
}
}
else if (Operators.CompareString(crParamDef6.ParameterFieldName, "@SupID", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[2], "", TextCompare: true))
{
myDiscreteValue6.Value = Conversions.ToString(connection.arrRptPara[2]);
crParamDef6.CurrentValues.Add(myDiscreteValue6);
crParamDefs.Add(crParamDef6);
}
else
{
myDiscreteValue6.Value = "";
crParamDef6.CurrentValues.Add(myDiscreteValue6);
crParamDefs.Add(crParamDef6);
}
}
else if (Operators.CompareString(crParamDef7.ParameterFieldName, "date", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[3], "", TextCompare: true))
{
myDiscreteValue7.Value = Conversions.ToString(connection.arrRptPara[3]);
crParamDef7.CurrentValues.Add(myDiscreteValue7);
crParamDefs.Add(crParamDef7);
}
else
{
myDiscreteValue7.Value = "";
crParamDef7.CurrentValues.Add(myDiscreteValue7);
crParamDefs.Add(crParamDef7);
}
}
else if (Operators.CompareString(crParamDef8.ParameterFieldName, "@FromDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[4], "", TextCompare: true))
{
myDiscreteValue8.Value = Conversions.ToDate(connection.arrRptPara[4]);
crParamDef8.CurrentValues.Add(myDiscreteValue8);
crParamDefs.Add(crParamDef8);
}
else
{
myDiscreteValue8.Value = Conversions.ToDate(connection.arrRptPara[4]);
crParamDef8.CurrentValues.Add(myDiscreteValue8);
crParamDefs.Add(crParamDef8);
}
}
else if (Operators.CompareString(crParamDef9.ParameterFieldName, "@ToDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[5], "", TextCompare: true))
{
myDiscreteValue9.Value = Conversions.ToDate(connection.arrRptPara[5]);
crParamDef9.CurrentValues.Add(myDiscreteValue9);
crParamDefs.Add(crParamDef9);
}
else
{
myDiscreteValue9.Value = Conversions.ToDate(connection.arrRptPara[5]);
crParamDef9.CurrentValues.Add(myDiscreteValue9);
crParamDefs.Add(crParamDef9);
}
}
else if (Operators.CompareString(crParamDef10.ParameterFieldName, "@StoreCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[6], "", TextCompare: true))
{
myDiscreteValue10.Value = Conversions.ToString(connection.arrRptPara[6]);
crParamDef10.CurrentValues.Add(myDiscreteValue10);
crParamDefs.Add(crParamDef10);
}
else
{
myDiscreteValue10.Value = "";
crParamDef10.CurrentValues.Add(myDiscreteValue10);
crParamDefs.Add(crParamDef10);
}
}
else if (Operators.CompareString(crParamDef11.ParameterFieldName, "@StationNo", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[7], "", TextCompare: true))
{
myDiscreteValue11.Value = Conversions.ToString(connection.arrRptPara[7]);
crParamDef11.CurrentValues.Add(myDiscreteValue11);
crParamDefs.Add(crParamDef11);
}
else
{
myDiscreteValue11.Value = "";
crParamDef11.CurrentValues.Add(myDiscreteValue11);
crParamDefs.Add(crParamDef11);
}
}
/* else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@SupplierCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[8], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[8]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@CatCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[9], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[9]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@Debit", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[10], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[10]);
}
else
{
myDiscreteValue3.Value = "";
}
}
*/
else if (Operators.CompareString(crParamDef12.ParameterFieldName, "@StoreName", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[30], "", TextCompare: true))
{
myDiscreteValue12.Value = Conversions.ToString(connection.arrRptPara[30]);
crParamDef12.CurrentValues.Add(myDiscreteValue12);
crParamDefs.Add(crParamDef12);
}
else
{
myDiscreteValue12.Value = "";
crParamDef12.CurrentValues.Add(myDiscreteValue12);
crParamDefs.Add(crParamDef12);
}
}
else if (Operators.CompareString(crParamDef13.ParameterFieldName, "@StoreNameFin", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[31], "", TextCompare: true))
{
myDiscreteValue13.Value = Conversions.ToString(connection.arrRptPara[31]);
crParamDef13.CurrentValues.Add(myDiscreteValue13);
crParamDefs.Add(crParamDef13);
}
else
{
myDiscreteValue13.Value = "";
crParamDef13.CurrentValues.Add(myDiscreteValue13);
crParamDefs.Add(crParamDef13);
}
}
/* else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@ABWORD", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[12], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[12]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTSErial_No", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[13], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[13]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTVoucherType", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[14], "", TextCompare: true))
{
myDiscreteValue3.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[14]);
}
else
{
myDiscreteValue3.Value = "0";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "AmountInWords", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[15], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[15]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "StoreName", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[16], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[16]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[17], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[17]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[17]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "EDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[18], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[18]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[18]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "EndDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[23], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[23]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[23]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SPDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[19], "", TextCompare: true))
{
myDiscreteValue3.Value = RuntimeHelpers.GetObjectValue(connection.arrRptPara[19]);
}
else
{
myDiscreteValue3.Value = "0";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SCode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[20], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[20]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ECode", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[21], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[21]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "RPTPrintAll", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectEqual(connection.arrRptPara[22], "TRUE", TextCompare: true))
{
myDiscreteValue3.Value = true;
}
else
{
myDiscreteValue3.Value = false;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "BILLNO", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[29], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[29]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "BILLTYPE", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[28], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[28]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@Userid", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[33], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[33]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@AtNo", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[34], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversion.Val(RuntimeHelpers.GetObjectValue(connection.arrRptPara[34]));
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@strCond", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[35], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[35]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "FromDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[36], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[36]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[36]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ToDate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[37], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[37]);
}
else
{
myDiscreteValue3.Value = Conversions.ToDate(connection.arrRptPara[37]);
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "rpc", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[38], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[38]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "SSCODE", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[39], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[39]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@FromTime", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[40], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[40]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "@ToTime", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[41], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[41]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ntpur", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[42], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[42]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "taxas", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[43], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[43]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "optax", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[44], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[44]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "ntaxas", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[45], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[45]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "totpur", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[46], 0, TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToDouble(connection.arrRptPara[46]);
}
else
{
myDiscreteValue3.Value = 0;
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "mdate", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[47], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[47]);
}
else
{
myDiscreteValue3.Value = "";
}
}
else if (Operators.CompareString(crParamDef3.ParameterFieldName, "wh", TextCompare: true) == 0)
{
if (Operators.ConditionalCompareObjectNotEqual(connection.arrRptPara[48], "", TextCompare: true))
{
myDiscreteValue3.Value = Conversions.ToString(connection.arrRptPara[48]);
}
else
{
myDiscreteValue3.Value = "";
}
}
*/
if ((Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLBILL.RPT", TextCompare: true) == 0) | (Operators.CompareString(Strings.UCase(connection.strrptfile), "PAYMENTRECEIPTTOPUP.RPT", TextCompare: true) == 0) | (Operators.CompareString(Strings.UCase(connection.strrptfile), "RPTBILLCOUNTER.RPT", TextCompare: true) == 0))
{
CrystalReportViewer1.Visible = false;
if (!connection.DISPLAYPRINTPROGRESS)
{
// CrystalReportViewer1.EnableProgressControl = false;
}
else
{
// CrystalReportViewer1.EnableProgressControl = true;
}
//CrystalReportViewer1.EnablePopupMenu = false;
if (!connection.DISPLAYPRINTPROGRESS)
{
// report.DisplayProgressDialog = false;
}
else
{
// report.DisplayProgressDialog = true;
}
// report.PrintOut(false, 1, Missing.Value, Missing.Value, Missing.Value);
Close();
return;
}
rptSort = false;
SortFieldInd = 1;
sortAsc = 0;
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.ParameterFieldInfo = crParamDefs;
MessageBox.Show("your report pm " + crParamDefs);
if (connection.NOGROUP)
{
// CrystalReportViewer1.EnableGroupTree = false;
// CrystalReportViewer1.EnableProgressControl = false;
// CrystalReportViewer1.EnableRefreshButton = false;
}
CrystalReportViewer1.Zoom(checked((short)connection.reportzoom));
}
private void CrystalReportViewer1_Enter(object sender, EventArgs e)
{
}
private void CrystalReportViewer1_Load(object sender, EventArgs e)
{
}
}
when i view report ask me for enter parameters...
I use multi reports in single report viewer
i try if parameter exist then file value pick form connection,(class)
Continue reading...