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

            rpt.Site = this.Site;
            return(rpt);
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     crptPricelistDynamic rpt = new crptPricelistDynamic();
     rpt.Site = this.Site;
     return rpt;
 }
Esempio n. 3
0
        /// <summary>
        /// Function to print PriceListReport in curresponding Crystal report
        /// </summary>
        /// <param name="dsPriceListReport"></param>
        internal void PriceListReportPrinting(DataSet dsPriceListReport)
        {
            try
            {


                crptPricelistDynamic crptDynamic = new crptPricelistDynamic();
                DataTable dtblnew = new DataTable();
                foreach (DataTable dtbl in dsPriceListReport.Tables)
                {
                    if (dtbl.TableName == "Table1")
                    {
                        crptDynamic.Database.Tables["dtblCompanyReport"].SetDataSource(dtbl);
                    }
                    else if (dtbl.TableName == "Table2")
                    {
                        crptDynamic.Database.Tables["dtblPriceListGridFill"].SetDataSource(dtbl);
                    }
                    else if (dtbl.TableName == "Table3")
                    {
                        dtblnew = dtbl;
                        crptDynamic.Database.Tables["dtblOptions"].SetDataSource(dtbl);
                    }
                }
                LineObject line11 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line11"]);
                LineObject line12 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line12"]);
                LineObject line14 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line14"]);
                foreach (DataRow dR in dtblnew.Rows)
                {
                    LineObject line01;
                    int i = 1, j = 6;
                    if (dR["PurchaseRate"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "Purchase Rate");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                    if (dR["SalesRate"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "Sales Rate");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                    if (dR["LastSalesRate"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "Last Sales Rate");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                    if (dR["StandardRate"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "Standard Rate");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                    if (dR["MRP"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "MRP");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                    if (dR["Price"].ToString() == "True")
                    {
                        crptDynamic.SetParameterValue("field" + i, "Price");
                        i++;
                    }
                    else
                    {
                        crptDynamic.SetParameterValue("field" + j, "None");
                        line01 = ((LineObject)crptDynamic.ReportDefinition.ReportObjects["Line0" + j]);
                        line01.ObjectFormat.EnableSuppress = true;
                        line11.Right = int.Parse(line11.Right.ToString()) - 1790;
                        line12.Right = int.Parse(line12.Right.ToString()) - 1790;
                        line14.Right = int.Parse(line14.Right.ToString()) - 1790;
                        j--;
                    }
                }
                this.crptViewer.ReportSource = crptDynamic;
                SettingsSP spSettings = new SettingsSP();

                if (spSettings.SettingsStatusCheck("DirectPrint") == "No")
                {
                    base.Show();
                    this.BringToFront();
                }
                else
                {
                    crptDynamic.PrintToPrinter(1, false, 0, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(" " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }