XtraReport1 CreateReport()
    {
        
        XtraReport1 report = new XtraReport1();
        report.dersid.Value = GetSelectedValue(1);

         
        report.CreateDocument();
        
        return report;
    }
Beispiel #2
0
        public override void ExecuteReport()
        {
            base.ExecuteReport();

            var sh = cbShop.Properties.Items.GetCheckedValues();
            var tbShop = new DataTable();
            tbShop.Columns.Add("Id", typeof(string));
            sh.ForEach(x => tbShop.Rows.Add(x));

            var sp = cbSupplier.Properties.Items.GetCheckedValues();
            var tbSuppl = new DataTable();
            tbSuppl.Columns.Add("Id", typeof(string));
            sp.ForEach(x => tbSuppl.Rows.Add(x));

            var sg = cbGroup.Properties.Items.GetCheckedValues();
            var tbGp = new DataTable();
            tbGp.Columns.Add("Id", typeof(string));
            sg.ForEach(x => tbGp.Rows.Add(x));

            string suppl = string.Join(", ", sp);
            string group = string.Join(", ", sg);

            try
            {
                Parameter.Connection.Open();
                using (
                    var command = new SqlCommand("rep_sel_OrederByShop", Parameter.Connection)
                                      {CommandType = CommandType.StoredProcedure, CommandTimeout = 60000})
                {
                    command.Parameters.AddWithValue("@dateBeg", dateBeg.DateTime.Date);
                    command.Parameters.AddWithValue("@dateEnd", dateEnd.DateTime.Date);
                    command.Parameters.AddWithValue("@ShopCodes", tbShop);

                    command.Parameters.AddWithValue("@Suppliers", tbSuppl);
                    command.Parameters.AddWithValue("@GoodGroups", tbGp);

                    var rep = new XtraReport1() {DataAdapter = new SqlDataAdapter(command)};
                    rep.Parameters["pDate"].Value = string.Format("Период: {0} по {1}", dateBeg.DateTime.Date.ToShortDateString(), dateEnd.DateTime.Date.ToShortDateString());

                    rep.Parameters["pGroup"].Value = string.Format("Товарная группа: {0}", string.IsNullOrEmpty(group) ? "Все" : group);
                    rep.Parameters["pSuppl"].Value = string.Format("Поставщик: {0}", string.IsNullOrEmpty(suppl) ? "Все" : suppl);

                    var reportPrintTool = new ReportPrintTool(rep) {AutoShowParametersPanel = false};
                    reportPrintTool.ShowPreviewDialog();
                }
            }
            finally
            {
                Parameter.Connection.Close();
            }

            //MessageBox.Show("ExecuteReport " + table.Rows.Count.ToString());
        }
 protected void ExportarExcel()
 {
     try
     {
         EnlazarDatos();
         Sesion      loSesion  = (Sesion)Session["Sesion"];
         XtraReport1 objReport = new XtraReport1();
         objReport.DataSource = (DataTable)ViewState["loResultado"];
         objReport.DataMember = "sqlDataSource1";
         #region Asignar permiso de imprimir y guardar
         if (Session["Permiso"] == null)
         {
             foreach (Permiso loPermiso in loSesion.Usuario.Permiso)
             {
                 if (loPermiso.Clave == 14)
                 {
                     foreach (Dapesa.Seguridad.Comun.Definiciones.TipoPermiso loTipoEmelento in loPermiso.TipoPermiso)
                     {
                         if (loTipoEmelento.ToString() == "Imprimir")
                         {
                             #region Eliminar Boton Imprimir
                             ReportToolbarItem saveItem = null;
                             foreach (ReportToolbarItem item in xrInforme.ToolbarItems)
                             {
                                 if (item.ItemKind == ReportToolbarItemKind.PrintReport || item.ItemKind == ReportToolbarItemKind.PrintPage)
                                 {
                                     saveItem = item;
                                 }
                             }
                             xrInforme.ToolbarItems.Remove(saveItem);
                             saveItem = null;
                             foreach (ReportToolbarItem item in xrInforme.ToolbarItems)
                             {
                                 if (item.ItemKind == ReportToolbarItemKind.PrintPage || item.ItemKind == ReportToolbarItemKind.PrintPage)
                                 {
                                     saveItem = item;
                                 }
                             }
                             xrInforme.ToolbarItems.Remove(saveItem);
                             #endregion
                             xrInforme.ToolbarItems.Add(new ReportToolbarButton(ReportToolbarItemKind.PrintPage, true));
                             xrInforme.ToolbarItems.Add(new ReportToolbarButton(ReportToolbarItemKind.PrintReport, true));
                         }
                     }
                 }
                 if (loPermiso.Clave == 14)
                 {
                     foreach (Dapesa.Seguridad.Comun.Definiciones.TipoPermiso loTipoEmelento in loPermiso.TipoPermiso)
                     {
                         if (loTipoEmelento.ToString() == "Guardar")
                         {
                             #region Eliminar Boton Guadar
                             ReportToolbarItem loItem = null;
                             foreach (ReportToolbarItem item in xrInforme.ToolbarItems)
                             {
                                 if (item.ItemKind == ReportToolbarItemKind.SaveToDisk || item.ItemKind == ReportToolbarItemKind.SaveToDisk)
                                 {
                                     loItem = item;
                                 }
                             }
                             xrInforme.ToolbarItems.Remove(loItem);
                             #endregion
                             xrInforme.ToolbarItems.Add(new ReportToolbarButton(ReportToolbarItemKind.SaveToDisk, true));
                         }
                     }
                 }
             }
         }
         #endregion
         objReport.CreateDocument();
         this.xrInforme.Report = objReport;
         Page.Session["loInformeBackOrderPedidos"] = objReport;
     }
     catch (Exception ex)
     {
         Session["Excepcion"] = ex;
         Response.Redirect("~/Error.aspx", false);
     }
 }
 protected void ASPxCallbackPanel1_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
 {
     XtraReport1.UpdateRecordsState(System.Convert.ToInt32(e.Parameter));
 }
Beispiel #5
0
        public void StampaPrimaNota(IList scritture, string filename)
        {
            XtraReport1 x = new XtraReport1();

            x.DataSource = scritture;

            string titleBanca1 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca1Nome : Properties.Settings.Default.Banca1NomeRegionale ;
            string titleBanca2 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca2Nome : Properties.Settings.Default.Banca2NomeRegionale;
            string titleBanca3 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca3Nome : Properties.Settings.Default.Banca3NomeRegionale;
            string titleBanca4 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca1Nome : Properties.Settings.Default.Banca1NomeRegionale ;
            string titleBanca5 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca2Nome : Properties.Settings.Default.Banca2NomeRegionale;
            string titleBanca6 = ""; // = TipoBilanco.IsProvinciale ? Properties.Settings.Default.Banca3Nome : Properties.Settings.Default.Banca3NomeRegionale;


            _presenter.FillNomiBanca(ref titleBanca1, ref titleBanca2, ref titleBanca3, ref titleBanca4, ref titleBanca5, ref titleBanca6);



            //riscrivo i nomi della banca
            foreach (ScritturaPrimaNotaDTO item in scritture)
            {
                if (item.Contropartita == "Banca1" && titleBanca1 != "Banca1")
                {
                    item.ContoContropartita = titleBanca1 + "(Banca1)";
                }
                else if (item.Contropartita == "Banca2" && titleBanca2 != "Banca2")
                {
                    item.ContoContropartita = titleBanca2 + "(Banca2)";
                }
                else if (item.Contropartita == "Banca3" && titleBanca3 != "Banca3")
                {
                    item.ContoContropartita = titleBanca3 + "(Banca3)";
                }


                else if (item.Contropartita == "Banca4" && titleBanca4 != "Banca4")
                {
                    item.ContoContropartita = titleBanca4 + "(Banca4)";
                }
                else if (item.Contropartita == "Banca5" && titleBanca5 != "Banca5")
                {
                    item.ContoContropartita = titleBanca5 + "(Banca5)";
                }
                else if (item.Contropartita == "Banca6" && titleBanca6 != "Banca6")
                {
                    item.ContoContropartita = titleBanca6 + "(Banca6)";
                }



                if (item.Conto.StartsWith("Banca1") && titleBanca1 != "Banca1")
                {
                    item.Conto = item.Conto.Replace("Banca1", titleBanca1 + "(Banca1)");
                }
                else if (item.Conto.StartsWith("Banca2") && titleBanca2 != "Banca2")
                {
                    item.Conto = item.Conto.Replace("Banca2", titleBanca2 + "(Banca2)");
                }
                else if (item.Conto.StartsWith("Banca3") && titleBanca3 != "Banca3")
                {
                    item.Conto = item.Conto.Replace("Banca3", titleBanca3 + "(Banca3)");
                }

                else if (item.Conto.StartsWith("Banca4") && titleBanca4 != "Banca4")
                {
                    item.Conto = item.Conto.Replace("Banca4", titleBanca4 + "(Banca4)");
                }
                else if (item.Conto.StartsWith("Banca5") && titleBanca5 != "Banca5")
                {
                    item.Conto = item.Conto.Replace("Banca5", titleBanca5 + "(Banca5)");
                }
                else if (item.Conto.StartsWith("Banca5") && titleBanca5 != "Banca5")
                {
                    item.Conto = item.Conto.Replace("Banca5", titleBanca5 + "(Banca5)");
                }
            }



            x.ExportToPdf(filename);


            Process.Start(filename);
        }
        private void Print()
        {
            XtraReport report = new XtraReport1();

            ReportData = new SignsJobCardReportData();

            ReportData.Lines.AddRange(new[]
            {
                new SignJobCardReportLine
                {
                    Shape = new ImageSource(Properties.Resources.SL),
                    Size  = "750 SL",
                    Qty   = 20,
                    Unit  = "Nos"
                },
                new SignJobCardReportLine {
                    Shape = new ImageSource(Properties.Resources.Circle),
                    Size  = "600 Dia",
                    Qty   = 32,
                    Unit  = "Nos"
                },
                new SignJobCardReportLine {
                    Shape = new ImageSource(Properties.Resources.HT),
                    Size  = "600 HT",
                    Qty   = 2,
                    Unit  = "Nos"
                },
                new SignJobCardReportLine {
                    Shape = new ImageSource(Properties.Resources.R1),
                    Size  = "1200 x 400",
                    Qty   = 16,
                    Unit  = "Nos"
                },
                new SignJobCardReportLine {
                    Shape = new ImageSource(Properties.Resources.R2)
                },
                new SignJobCardReportLine {
                    Shape = new ImageSource(Properties.Resources.R3)
                }
            });

            var aluminumSheets = SelectedAluminumSheets.Split(',');

            ReportData.AluminumSheet2_03MM  = aluminumSheets.Contains("2.03mm") ? "P" : "";
            ReportData.AluminumSheet3_175MM = aluminumSheets.Contains("3.175mm") ? "P" : "";
            ReportData.AluminumSheet3_0MM   = aluminumSheets.Contains("3.0mm") ? "P" : "";
            ReportData.AluminumSheet2_0MM   = aluminumSheets.Contains("2.0mm") ? "P" : "";
            ReportData.AluminumSheet1_5MM   = aluminumSheets.Contains("1.5mm") ? "P" : "";
            ReportData.AluminumSheet1MM     = aluminumSheets.Contains("1.0mm") ? "P" : "";


            report.DataSource = new List <SignsJobCardReportData> {
                ReportData
            };

            DocumentPreviewWindow window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = report;
            report.CreateDocument();
            window.Show();
        }
Beispiel #7
0
        void OnNavBarItemsClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (sender != navBarItemExit)
            {
                RemoveControls();
            }

            if (sender == navBarItemCheck)
            {
                //Process prupdate = Process.Start("wyUpdate.exe");
                CheckUpdate();
            }
            //else if (sender == navBarItemHelp)
            //{
            //    //Help.ShowHelp(this, "C:\\Users\\Femmy\\Documents\\Visual Studio 2010\\Projects\\TSS_Oyo\\BankReconciliation\\reconciliation.chm");

            //}
            else if (sender == navBarItemMergeAgent)
            {
                tableLayoutPanel2.Controls.Add((new Form1().panelContainer), 1, 0);

                Form1.publicStreetGroup.Tag = ((sender) as NavBarItem).Tag;

                Form1.publicStreetGroup.RefreshForm();
            }
            else if (sender == navBarItemMergeApproval)
            {
                tableLayoutPanel2.Controls.Add((new FrmApproval().panelContainer), 1, 0);

                FrmApproval.publicStreetGroup.Tag = ((sender) as NavBarItem).Tag;

                FrmApproval.publicStreetGroup.RefreshForm();
            }
            else if (sender == navBItmTaxAgent)
            {
                string strquery = string.Format("SELECT UTINNew ,tblTaxAgent.OrganizationName ,Registration.tblTaxAgentMerge.UTIN ,Registration.tblTaxAgentMerge.OrganizationName FROM Registration.tblTaxAgentMerge JOIN Registration.tblTaxAgent ON UTINNew = tblTaxAgent.UTIN AND TaxAgentReferenceNumberNew = Registration.tblTaxAgent.TaxAgentReferenceNumber");

                using (var ds = new System.Data.DataSet())
                {
                    using (SqlDataAdapter ada = new SqlDataAdapter(strquery, Logic.ConnectionString))
                    {
                        ada.SelectCommand.CommandTimeout = 0;
                        ada.Fill(ds, "tables");
                    }

                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count >= 1)
                    {
                        var listret = (from DataRow row in ds.Tables[0].Rows
                                       select new ReportsMergi
                        {
                            OrganizationNameNew = row["OrganizationName"] as string,
                            UTINNew = row["UTINNew"] as string,
                            UTIN = row["UTIN"] as string,
                            OrganizationName = row["OrganizationName"] as string
                        }).ToList();

                        //XtraRepTaxAgentReturnAnnual Annual = new XtraRepTaxAgentReturnAnnual { DataSource = listret, logoPath = Logic.logopth };
                        //Annual.xrLabel11.Text = string.Format("{0} STATE GOVERNMENT", Program.StateName.ToUpper());
                        //Annual.xrLabel12.Text = string.Format("Tax Agent Annual returns report for {0} assessmenyt year", oDataRowViewsd.Row["TaxYear"]);
                        //Annual.ShowPreviewDialog();
                        XtraReport1 report = new XtraReport1 {
                            DataSource = listret
                        };
                        report.ShowPreviewDialog();
                    }
                    else
                    {
                        Common.setMessageBox("No Record Found for selected  Tax Agent Reconcilied", Program.ApplicationName, 1);
                        return;
                    }
                }
            }
            else if (sender == navBarItemExit)
            {
                Close();
            }
            //else if (sender == navBarItemDataUpload)
            //{
            //    tableLayoutPanel2.Controls.Add((new FrmTransaction().panelContainer), 1, 0);

            //    FrmTransaction.publicStreetGroup.Tag = ((sender) as NavBarItem).Tag;

            //    FrmTransaction.publicStreetGroup.RefreshForm();

            //}
        }
Beispiel #8
0
        public override void UpdateChargeGrid(Object _chargeObjects)
        {
            CalculateChargeClass calculateChargeClass =
                (_chargeObjects as Dictionary <string, object>)["第一阶段"] as CalculateChargeClass;

            base.UpdateChargeGrid(calculateChargeClass);
            if (calculateChargeClass != null)
            {
                DataRow row = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(总)";
                row[2] = calculateChargeClass.endEnergy.ToString("#0.00");
                row[3] = calculateChargeClass.startEnergy.ToString("#0.00");
                row[4] = "30";
                row[5] = calculateChargeClass.totalPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(尖峰)";
                row[2] = calculateChargeClass.spikeEnergy.ToString("#0.00");
                row[4] = "30";
                row[5] = calculateChargeClass.spikePower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(峰)";
                row[2] = calculateChargeClass.peakEnergy.ToString("#0.00");;
                row[4] = "30";
                row[5] = calculateChargeClass.peakPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(谷)";
                row[2] = calculateChargeClass.valleyEnergy.ToString("#0.00");;
                row[4] = "30";
                row[5] = calculateChargeClass.valleyPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "无功(QI象限)";
                row[2] = "";
                row[4] = "30";
                row[5] = calculateChargeClass.ReactiveQI.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                DataRow row1 = _chargeTable_2.NewRow();
                row1[0] = calculateChargeClass.activeCopperLoss.ToString("#0.00");
                row1[1] = calculateChargeClass.activeCoreLoss.ToString("#0.00");
                row1[2] = calculateChargeClass.activeAll.ToString("#0.00");
                row1[3] = calculateChargeClass.reactiveCopperLoss.ToString("#0.00");
                row1[4] = calculateChargeClass.reactiveCoreLoss.ToString("#0.00");
                row1[5] = calculateChargeClass.reactiveAll.ToString("#0.00");
                row1[6] = calculateChargeClass.peakPower.ToString("#0.00");
                row1[7] = calculateChargeClass.valleyPower.ToString("#0.00");
                row1[8] = calculateChargeClass.spikePower.ToString("#0.00");
                _chargeTable_2.Rows.Add(row1);

                DataRow row2 = _chargeTable_3.NewRow();
                row2[0] = 0;
                row2[1] = 0;
                row2[2] = 0;
                row2[3] = 0;
                row2[4] = 0;
                row2[5] = 0;
                row2[6] = 0;
                row2[7] = 0;
                row2[8] = 0;
                _chargeTable_3.Rows.Add(row2);

                DataRow row3  = _chargeTable_4.NewRow();
                Double  total = 0;
                row3[0] = "尖 一般工商";
                row3[1] = calculateChargeClass.spikePower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0].PriceSpike;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "峰 一般工商";
                row3[1] = calculateChargeClass.peakPower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0].PricePeak;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "谷 一般工商";
                row3[1] = calculateChargeClass.valleyPower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0]
                    .PriceValley;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "合计";
                row3[1] = "";
                row3[2] = "";
                row3[3] = "";
                row3[4] = "";
                row3[5] = total.ToString("#0.00");
                _chargeTable_4.Rows.Add(row3);


                gridCharge_1.DataSource = _chargeTable_1;
                gridCharge_2.DataSource = _chargeTable_2;
                gridCharge_3.DataSource = _chargeTable_3;
                gridCharge_4.DataSource = _chargeTable_4;


                XtraReport1 report = new XtraReport1();
                report.ExportOptions.PrintPreview.DefaultFileName = "国网浙江慈溪市供电公司非居民用户电费复核单据 (一次抄表)" +
                                                                    DateTime.Now.ToString("D");


                documentViewer.DocumentSource = report;
                report.SetReportDataSource(_chargeTable_1, _chargeTable_2, _chargeTable_3, _chargeTable_4);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        XtraReport1 report = new XtraReport1();

        Session["report"] = report;
    }
Beispiel #10
0
 private void button4_Click(object sender, EventArgs e)
 {
     var R = new XtraReport1();
     R.Filling(LR);
     var RPT = new DevExpress.XtraReports.UI.ReportPrintTool(R);
     RPT.ShowPreview();
 }