Example #1
0
 private void modelTree_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
 {
     if (e.Node.Tag is Maticsoft.Model.SMT_VERMODEL_INFO)
     {
         Maticsoft.Model.SMT_VERMODEL_INFO model = e.Node.Tag as Maticsoft.Model.SMT_VERMODEL_INFO;
         if (model != null)
         {
             _lastSelectModel = model;
             ShowModelReportPreview(_lastSelectModel);
         }
     }
     else if (e.Node.Tag is FileInfo)//示例模板
     {
         try
         {
             var      dt = StaffDataHelper.GetTestReportDataTable();
             FileInfo fi = (FileInfo)e.Node.Tag;
             _report.Clear();
             _report.Load(fi.FullName);
             _report.RegisterData(dt, dt.TableName);
             _report.AutoFillDataSet = true;
             _report.Prepare();
             _report.ShowPrepared();
         }
         catch (Exception ex)
         {
             log.Error("预览示例模板异常:", ex);
             WinInfoHelper.ShowInfoWindow(this, "预览示例模板异常:" + ex.Message);
         }
     }
 }
        private void DisplayReporteTraspaso()
        {
            try
            {
                var movimiento = Datos.GetListOf <MovimientoInventarioView>(m => m.MovimientoInventarioID.Equals(oID));
                var detalle    = Datos.GetListOf <MovimientoInventarioDetalleView>(d => d.MovimientoInventarioID.Equals(oID));

                IEnumerable <MovimientoInventarioView>        movimientoE = movimiento;
                IEnumerable <MovimientoInventarioDetalleView> detalleE    = detalle;

                using (FastReport.Report report = new FastReport.Report())
                {
                    if (detalle.Count < 10)
                    {
                        report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteTraspaso.frx"));
                    }
                    else
                    {
                        report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteTraspasosMasDeDiez.frx"));
                    }

                    report.RegisterData(movimientoE, "movimiento", 3);
                    report.RegisterData(detalleE, "detalle", 3);
                    report.GetDataSource("movimiento").Enabled = true;
                    report.GetDataSource("detalle").Enabled    = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #3
0
        public static FastReport.Report GetReport(string filePath, DataSet ds)
        {
            rep.RegisterData(ds, "data");

            if (File.Exists(filePath))
            {
                rep.Load(filePath);
            }
            else
            {
                MsgBox.ShowInfoMsg("找不到文件: \r\n" + filePath);
            }

            return(rep);
        }
Example #4
0
        //导出
        void UCReport_ExportEvent(object sender, EventArgs e)
        {
            string fileName = GetDefaultStyleFile();
            // create report instance
            FastReport.Report report = new FastReport.Report();
            if (!string.IsNullOrEmpty(fileName))
            {
                report.Load(fileName);
                report.RegisterData(dt, styleObject);
            }
            else
            {

                Report.FastReportEx reportEx = new Report.FastReportEx();
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.dt = dt;
                reportEx.styleObject = styleObject;
                reportEx.styleTitle = styleTitle;
                report = reportEx.DefaultReport();
            }
            if (report == null)
            {
                return;
            }
            report.Prepare();
            PDFExport export = new PDFExport();
            export.Name = "name";
            export.Title = "title";
            export.Export(report);
            report.Dispose();
        }
Example #5
0
        public static int PrintContract(FishEntity.ContractEntity entity, List <FishEntity.ContractDetailEntity> details, string templatename)
        {
            try
            {
                if (entity == null)
                {
                    return(-1);
                }
                string reportPath = _reportFolder + "\\" + templatename;
                if (System.IO.File.Exists(reportPath) == false)
                {
                    return(-1);
                }

                FastReport.Report report = new FastReport.Report();
                report.Load(reportPath);
                SetParameters <FishEntity.ContractEntity, FishEntity.ContractDetailEntity>(entity, details, report, "contractdetail");

                SetReportDataSource <FishEntity.ContractDetailEntity>(report, details, "contractdetail");

                PrintReport(report, "");

                return(1);
            }
            catch (System.Drawing.Printing.InvalidPrinterException pex)
            {
                Utility.LogHelper.WriteException(pex);
                return(-4);
            }
            catch (Exception ex)
            {
                Utility.LogHelper.WriteException(ex);
                return(-3);
            }
        }
Example #6
0
        void 入库统计ToolStripMenuItemClick(object sender, EventArgs e)
        {
            //打印非零库存
            FastReport.Report report1 = new FastReport.Report();
            report1.Load("Reports\\IncomeSum.frx");

            DataSet   FDataSet = new DataSet();
            DataTable table    = new DataTable();

            table           = BLL.GoodsTypeBLL.GetAllGoodsType().Tables[0].Copy();
            table.TableName = "GoodsType";
            FDataSet.Tables.Add(table);

            table           = BLL.ReceiptBLL.GetAllReceiptItems().Tables[0].Copy();
            table.TableName = "ReceiptItems";
            FDataSet.Tables.Add(table);
            //report1.SetParameterValue("PeriodNo",sPeriodNo);
            DataRelation dsdr  =  new DataRelation("R1",  FDataSet.Tables["GoodsType"].Columns["GoodsTypeID"],  FDataSet.Tables["ReceiptItems"].Columns["GoodsTypeID"]);   
            FDataSet.Relations.Add(dsdr);   
            CalculateTotal(ref FDataSet);

            report1.RegisterData(FDataSet);
            report1.Show();
            report1.Dispose();
        }
Example #7
0
        void ButtonSCClick(object sender, EventArgs e)
        {
            FastReport.Report report1 = new FastReport.Report();
            report1.Load("Reports\\PriceLimit.frx");

            DataSet   FDataSet = new DataSet();
            DataTable table    = new DataTable();

            table           = BLL.GoodsTypeBLL.GetAllGoodsType().Tables[0].Copy();
            table.TableName = "GoodsType";
            FDataSet.Tables.Add(table);

            table           = BLL.RKBLL.GetInStockItems(Convert.ToInt32(comboBoxProject.SelectedValue)).Tables[0].Copy();
            table.TableName = "ReceiptItems";
            FDataSet.Tables.Add(table);

            sProjectName = comboBoxProject.Text;
            report1.SetParameterValue("ProjectName", sProjectName);

            DataRelation dsdr  =  new DataRelation("R1",  FDataSet.Tables["GoodsType"].Columns["GoodsTypeID"],  FDataSet.Tables["ReceiptItems"].Columns["GoodsTypeID"]);   
            FDataSet.Relations.Add(dsdr);   


            report1.RegisterData(FDataSet);

            report1.Show();
            report1.Dispose();
        }
Example #8
0
        private byte[] InternalGenerateReport(string reportFile, Dictionary <string, string> parameters)
        {
            FastReport.Report report = new FastReport.Report();
            report.Load(Path.Combine("Reports", reportFile));
            if (string.IsNullOrWhiteSpace(_appSettings.ConnectionString))
            {
                throw new NotSupportedException("Connectionstring não informada");
            }

            report.Dictionary.Connections[0].ConnectionString = _appSettings.ConnectionString;
            //report.SetParameterValue("initialDate", "2019-01-01");
            //report.SetParameterValue("finalDate", "2019-01-07");

            foreach (var parameter in parameters)
            {
                report.SetParameterValue(parameter.Key, parameter.Value);
            }

            report.Prepare();

            // report.Parameters[0].Value = 143;
            //report.Refresh();

            PDFSimpleExport export = new PDFSimpleExport();

            using (MemoryStream ms = new MemoryStream())
            {
                report.Export(export, ms);
                ms.Flush();
                return(ms.ToArray());
            }
        }
Example #9
0
        private void toolPrint_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(taskid))
            {
                DataSet ds = new DataSet();

                DataTable dtPrint = new SqlServerHelper().GetDataTable("View_GroupInfo", "taskid='" + taskid + "'", "");

                dtPrint.TableName = "用户报装申请表";
                ds.Tables.Add(dtPrint.Copy());
                FastReport.Report report1 = new FastReport.Report();
                try
                {
                    // load the existing report
                    report1.Load(Application.StartupPath + @"\PRINTModel\业扩模板\多用户报装申请表.frx");
                    // register the dataset
                    report1.RegisterData(ds);
                    report1.GetDataSource("用户报装申请表").Enabled = true;
                    // run the report
                    report1.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    // free resources used by report
                    report1.Dispose();
                }
            }
        }
Example #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime d_rq1 = dateTimePicker1.Value.Date;
            DateTime d_rq2 = dateTimePicker1.Value.AddDays(1).Date;

            var dataList = SqlUtil.Inst.Orders.Where(a => a.date >= d_rq1 && a.date < d_rq2).ToList().Select(a => new {
                no   = a.no,
                date = a.date.ToString("yyyy年MM月dd日"),
                zje  = a.zje.ToString("0.00"),
                yhje = a.yhje.ToString("0.00"),
                ssje = (a.zje - a.yhje).ToString("0.00"),
                zffs = a.zffs
            }).ToList();

            Assembly assembly = Assembly.GetExecutingAssembly();

            //获取指定的资源

            using (Stream stream = assembly.GetManifestResourceStream("DishSysManager.daily_mx.frx"))
            {
                if (stream != null)  //没有找到,GetManifestResourceStream会返回null
                {
                    report.Clear();
                    report.Load(stream);
                    report.RegisterData(dataList, "mx");
                    report.Preview = this.previewControl1;
                    report.Prepare();
                    report.ShowPrepared();
                }
            }
        }
Example #11
0
        //打印
        void UCReport_PrintEvent(object sender, EventArgs e)
        {
            string fileName = GetDefaultStyleFile();

            // create report instance
            FastReport.Report report = new FastReport.Report();
            if (!string.IsNullOrEmpty(fileName))
            {
                report.Load(fileName);
                report.RegisterData(dt, styleObject);
            }
            else
            {
                Report.FastReportEx reportEx = new Report.FastReportEx();
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.dt          = dt;
                reportEx.styleObject = styleObject;
                reportEx.styleTitle  = styleTitle;
                report = reportEx.DefaultReport();
            }
            if (paperSize != null && report.Pages.Count > 0)
            {
                FastReport.ReportPage page = (FastReport.ReportPage)report.Pages[0];
                page.PaperHeight = paperSize.Height;
                page.PaperWidth  = paperSize.Width;
            }
            report.Prepare();
            report.Print();
            report.Dispose();
        }
Example #12
0
        //导出
        void UCReport_ExportEvent(object sender, EventArgs e)
        {
            string fileName = GetDefaultStyleFile();

            // create report instance
            FastReport.Report report = new FastReport.Report();
            if (!string.IsNullOrEmpty(fileName))
            {
                report.Load(fileName);
                report.RegisterData(dt, styleObject);
            }
            else
            {
                Report.FastReportEx reportEx = new Report.FastReportEx();
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.dt          = dt;
                reportEx.styleObject = styleObject;
                reportEx.styleTitle  = styleTitle;
                report = reportEx.DefaultReport();
            }
            if (report == null)
            {
                return;
            }
            report.Prepare();
            PDFExport export = new PDFExport();

            export.Export(report);
            report.Dispose();
        }
Example #13
0
        void PrintSFD(int i_CFID)
        {
            DataSet tmpDs = BLL.ChargeBLL.GetSFDs(i_CFID);

            //
            FastReport.Report report1 = new FastReport.Report();
            report1.Load("Reports\\SFPrint.frx");

            DataSet   FDataSet = new DataSet();
            DataTable table    = new DataTable();

            table           = tmpDs.Tables[0].Copy();
            table.TableName = "ChargeF";
            FDataSet.Tables.Add(table);

            tmpDs           = BLL.ChargeBLL.GetSFChargeDetail(i_CFID);
            table           = tmpDs.Tables[0].Copy();
            table.TableName = "ChargeDetail";
            FDataSet.Tables.Add(table);
            DataRelation dr = new DataRelation("FK_1", FDataSet.Tables["ChargeF"].Columns["CFID"], FDataSet.Tables["ChargeDetail"].Columns["CFID"]);

            FDataSet.Relations.Add(dr);

            report1.RegisterData(FDataSet);
            report1.Show();
            report1.Dispose();
        }
Example #14
0
        private void DisplayReporteDevolucion()
        {
            try
            {
                var movimiento = Datos.GetListOf <MovimientoInventarioView>(m => m.MovimientoInventarioID.Equals(oID));
                var detalle    = Datos.GetListOf <MovimientoInventarioDetalleView>(d => d.MovimientoInventarioID.Equals(oID));

                IEnumerable <MovimientoInventarioView>        movimientoE = movimiento;
                IEnumerable <MovimientoInventarioDetalleView> detalleE    = detalle;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteSalidaDevolucion.frx"));
                    report.RegisterData(movimientoE, "movimiento", 3);
                    report.RegisterData(detalleE, "detalle", 3);
                    report.GetDataSource("movimiento").Enabled = true;
                    report.GetDataSource("detalle").Enabled    = true;
                    //report.Show(true);
                    UtilLocal.EnviarReporteASalida("Reportes.DevolucionAProveedor.Salida", report);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #15
0
        void Button1Click(object sender, EventArgs e)
        {
            //打印当前显示的库存内容
            FastReport.Report report1 = new FastReport.Report();
            report1.Load("Reports\\Stock.frx");

            DataSet   FDataSet = new DataSet();
            DataTable table    = new DataTable();

            table = ds1.Tables[0].Clone();

            table.TableName = "Stock";
            //dataGridView1.SelectAll();
            foreach (DataGridViewRow dr in dataGridView1.SelectedRows)
            {
                 
                string    tsGoodsID = dr.Cells["GoodsID"].Value.ToString();
                DataRow[] dr1       = ds1.Tables[0].Select("GoodsID = " + tsGoodsID);          //查询
                table.ImportRow(dr1[0]);
            }
            FDataSet.Tables.Add(table);
            report1.SetParameterValue("PeriodNo", sPeriodNo);
            report1.RegisterData(FDataSet);
            report1.Show();
            report1.Dispose();
        }
Example #16
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvDatos.DataSource == null)
                {
                    return;
                }

                BindingSource bs = (BindingSource)this.dgvDatos.DataSource;
                DataTable     dt = (DataTable)bs.DataSource;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReportePartesClasificacionAbc.frx"));
                    report.RegisterData(dt, "PartesClasificacionAbc");
                    report.GetDataSource("PartesClasificacionAbc").Enabled = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #17
0
        private void ExceReportAnzeigenDruck(object sender, ExecutedRoutedEventArgs e)
        {
            _Report.Clear();
            var dsRep = _Auswertungen.Current;

            if (dsRep.Report != null)
            {
                MemoryStream mem;
                mem = new MemoryStream(dsRep.Report);
                _Report.Load(mem);
            }

            _Report.SetParameterValue("SqlVerbindung", Properties.Settings.Default.DatenbankVerbindungsString);

            if (e.Command == MyCommands.ReportAnzeigen)
            {
                _Report.Show();
            }
            else if (e.Command == Commands.MyCommands.ReportDrucken)
            {
                _Report.Print();
            }
            else if (e.Command == Commands.MyCommands.ReportBearbeiten)
            {
                _Report.Design();
            }
        }
Example #18
0
        void ButtonPrint1Click(object sender, EventArgs e)
        {
            //打印非零库存
            FastReport.Report report1 = new FastReport.Report();
            report1.Load("Reports\\Stock.frx");

            DataSet   FDataSet = new DataSet();
            DataTable table    = new DataTable();

            table = ds1.Tables[0].Clone();
            DataRow[] drArr = ds1.Tables[0].Select("EndQty <> 0");            //查询
            table.TableName = "Stock";
            for (int i = 0; i < drArr.Length; i++)
            {
                 
                {
                     
                        table.ImportRow(drArr[i]);
                }
            }
            FDataSet.Tables.Add(table);
            report1.SetParameterValue("PeriodNo", sPeriodNo);
            report1.RegisterData(FDataSet);
            report1.Show();
            report1.Dispose();
        }
Example #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            report1 = new FastReport.Report();
            report1.Load(Path.Combine(@"AltAltaVeriYazma.frx"));


            var kisi     = new Kisi();
            var kisiList = kisi.getKisiList();

            foreach (var data in kisiList)
            {
                var rowadaparsel = dataSet1.Tables["Kisi"].NewRow();

                rowadaparsel["No"]    = data.No;
                rowadaparsel["Ad"]    = data.Ad;
                rowadaparsel["Soyad"] = data.Soyad;
                rowadaparsel["TC"]    = data.TC;
                dataSet1.Tables["Kisi"].Rows.Add(rowadaparsel);
            }

            report1.RegisterData(dataSet1.Tables["Kisi"], "Kisi");
            report1.GetDataSource("Kisi").Enabled = true;
            (report1.Report.FindObject("Data1") as FastReport.DataBand).DataSource = report1.GetDataSource("Kisi");

            report1.Show();
        }
Example #20
0
        //----以下是YX01数据采集----
        private void GetParaDataPrint_YX02(int tt_itemtype)
        {
            //单板打印
            if (PrintText != "")
            {
                FastReport.Report report = new FastReport.Report();

                report.Prepare();
                report.Load(Application.StartupPath + "\\LABLE\\YX_2.frx");
                report.SetParameterValue("S01", PrintText);

                report.PrintSettings.ShowDialog = false;

                //--打印
                if (tt_itemtype == 1)
                {
                    report.Print();
                }

                //--预览
                if (tt_itemtype == 2)
                {
                    report.Design();
                }
            }
        }
Example #21
0
 //打印
 void UCReport_PrintEvent(object sender, EventArgs e)
 {
     if (dt == null || dt.Rows.Count == 0)
     {
         MessageBoxEx.Show("请查询出要打印的数据!");
         return;
     }
     string fileName = GetDefaultStyleFile();
     // create report instance
     FastReport.Report report = new FastReport.Report();
     if (!string.IsNullOrEmpty(fileName))
     {
         report.Load(fileName);
         report.RegisterData(dt, styleObject);
     }
     else
     {
         Report.FastReportEx reportEx = new Report.FastReportEx();
         reportEx.dicSpanRows = dicSpanRows;
         reportEx.dt = dt;
         reportEx.styleObject = styleObject;
         reportEx.styleTitle = styleTitle;
         report = reportEx.DefaultReport();
     }
     if (paperSize != null && report.Pages.Count > 0)
     {
         FastReport.ReportPage page = (FastReport.ReportPage)report.Pages[0];
         page.PaperHeight = paperSize.Height;
         page.PaperWidth = paperSize.Width;
     }
     report.Prepare();
     report.Print();
     report.Dispose();
 }
        private void btn_Print_Click(object sender, EventArgs e)
        {
            string strProcedureName = string.Format("{0}.{1}", className, MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                List <OrderInfo> data = this.grdCtrProductionInfo.DataSource as List <OrderInfo>;
                if (data == null || data.Count == 0)
                {
                    return;
                }
                MemoryStream ms;
                ms = new MemoryStream(Properties.Resources.双环_铸造产品标识卡);
                _report.Load(ms);
                foreach (OrderInfo item in data)
                {
                    if (item.IsPrint)
                    {
                        PrintOrderInfo(item);
                    }
                }
            }
            catch (Exception error)
            {
                WriteLog.Instance.Write(error.Message, strProcedureName);
                ShowMessageBox.Show(error.Message, "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Example #23
0
        //选择打印样式
        private void cboPrintStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboPrintStyle.SelectedItem == null)
            {
                return;
            }
            DataRowView drv = (DataRowView)cboPrintStyle.SelectedItem;
            //样式ID
            string styleID = CommonCtrl.IsNullToString(drv["style_id"]);

            //如果是默认样式,则不用设为默认样式
            btnDefault.Enabled = styleID.Length > 0 && CommonCtrl.IsNullToString(drv["is_default"]) != "1";
            //如果有样式ID,才可以删除
            btnDelete.Enabled = styleID.Length > 0;

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            string printStyle = CommonCtrl.IsNullToString(cboPrintStyle.SelectedValue);

            FastReport.Report rep;
            //FileTransferOperation fileOperation = new FileTransferOperation();
            ////如果下载出问题,用默认样式
            //if (!fileOperation.DownLoadFile(printStyle, "Report"))
            //{
            //    //LoadDefaultStyle();
            //    reportEx.LoadDefaultStyle(designerReport);
            //}
            //fileOperation.DownFile += new HXCFileTransferCache_Client.DownLoadFileHandler<HXCFileTransferCache_Client.DownLoadFileEventArgs>(fileOperation_DownFile);
            //下载打印样式
            string fileName = FileOperation.DownLoadFileByFile(cboPrintStyle.SelectedValue.ToString(), "Report");

            //如果没找到,则用默认样式
            if (string.IsNullOrEmpty(fileName))
            {
                FastReportEx reportEx = new FastReportEx();
                reportEx.styleObject = styleObject;
                reportEx.dt          = dt;
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.styleTitle  = styleTitle;
                rep = reportEx.DefaultReport();
                if (rep == null)
                {
                    return;
                }
            }
            else
            {
                rep = new FastReport.Report();
                rep.Load(fileName);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rep.RegisterData(dt, styleObject);
                }
            }
            designerReport.Report = rep;
            designerReport.RefreshLayout();
        }
Example #24
0
        //Print
        private void button1_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear( );
            int  number = 0;
            bool isOk   = true;

            if (int.TryParse(textBox1.Text, out number) == false)
            {
                errorProvider1.SetError(textBox1, "请输入正确的打印数量");
                isOk = false;
            }
            if (texProduct.Tag == null)
            {
                errorProvider1.SetError(texProduct, "品号不可为空");
                isOk = false;
            }
            if (string.IsNullOrEmpty(texProduct.Text))
            {
                errorProvider1.SetError(texProduct, "品名不可为空");
                isOk = false;
            }
            if (string.IsNullOrEmpty(texSpec.Text))
            {
                errorProvider1.SetError(texSpec, "规格不可为空");
                isOk = false;
            }
            if (string.IsNullOrEmpty(textBox3.Text))
            {
                errorProvider1.SetError(textBox3, "型号不可为空");
                isOk = false;
            }
            if (string.IsNullOrEmpty(comboBox1.Text))
            {
                errorProvider1.SetError(comboBox1, "轴号不可为空");
                isOk = false;
            }
            if (isOk == false)
            {
                return;
            }
            numOf( );
            if (Save( ) == false)
            {
                return;
            }
            RDataSet = new DataSet( );

            getDataTable( );
            FastReport.Report report = new FastReport.Report( );
            string            path   = "";

            path = Application.StartupPath;
            //if ( string . IsNullOrEmpty ( texPack . Text ) )
            report.Load(path + "\\PrintBarCode.frx");
            //else
            //report . Load ( path + "\\PrintBarCodeA.frx" );
            report.RegisterData(RDataSet);
            report.Show( );
        }
 private void btn_storage_Click(object sender, EventArgs e)
 {
     try
     {
         FastReport.Report report1 = new FastReport.Report();
         report1.Load("2.frx");
         DataTable dt = new DataTable();
         DataSet   ds = new DataSet();
         dt.Columns.Add("物品名");
         dt.Columns.Add("物品数量");
         dt.Columns.Add("物品代码");
         dt.Columns.Add("物品备注");
         dt.Columns.Add("物品价格");
         dt.Columns.Add("物品类型");
         dt.Columns.Add("物品体积");
         dt.Columns.Add("物品重量");
         dt.Columns.Add("仓库名称");
         dt.Columns.Add("客户名称");
         dt.Columns.Add("物品规格");
         dt.Columns.Add("入库方式");
         dt.Columns.Add("生产日期");
         dt.Columns.Add("到期日期");
         dt.Columns.Add("批号");
         dt.Columns.Add("清单备注");
         dt.Columns.Add("操作人员");
         dt.Rows.Add();
         dt.Rows[0][0]  = gm.Goods_name;
         dt.Rows[0][1]  = bm.Goods_amount;
         dt.Rows[0][2]  = gm.Goods_code;
         dt.Rows[0][3]  = gm.Goods_note;
         dt.Rows[0][4]  = bm.Goods_price;
         dt.Rows[0][5]  = gtm.Goods_type;
         dt.Rows[0][6]  = gm.Goods_volume;
         dt.Rows[0][7]  = gm.Goods_wight;
         dt.Rows[0][8]  = wnm.Warehouse_name;
         dt.Rows[0][9]  = cm.Client_name;
         dt.Rows[0][10] = gm.Specifications;
         dt.Rows[0][11] = otm.Operation_type;
         dt.Rows[0][12] = bm.Expiration_date;
         dt.Rows[0][13] = bm.Manufacture_date;
         dt.Rows[0][14] = bm.Lot_number;
         dt.Rows[0][15] = bm.Bill_note;
         dt.Rows[0][16] = mm.Manager_name;
         ds.Tables.Add(dt);
         dt.TableName = "putreport";
         report1.RegisterData(ds);
         report1.GetDataSource("putreport").Enabled = true;
         report1.Show();
         //report1.Design();
         //report1.Prepare();
         //report1.ShowPrepared();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #26
0
 public FrmMain()
 {
     InitializeComponent();
     FastReport.Report report = new FastReport.Report();
     string fileName = Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "steelorder.frx");
     report.Load(fileName);
     report.Page.Height = 1000;
     report.ShowPrepared();
 }
Example #27
0
        /// <summary>
        /// FastReports
        /// </summary>
        /// <param name="isDesign"></param>
        private void FastReports(bool isDesign)
        {
            System.Data.DataSet printDataDs = new System.Data.DataSet();
            try
            {
                int[]   rownumber = this.gridViewMainData.GetSelectedRows();
                DataRow row       = this.gridViewMainData.GetDataRow(rownumber[0]);
                System.Data.DataTable mainData    = ToDataTable(row);
                System.Data.DataTable detailsData = ((DataView)this.gridViewDetailsData.DataSource).ToTable();
                if (mainData != null && mainData.Rows.Count > 0)
                {
                    mainData.TableName = "mainData";
                    printDataDs.Tables.Add(mainData.Copy());
                }
                if (detailsData != null && detailsData.Rows.Count > 0)
                {
                    detailsData.TableName = "detailsData";
                    printDataDs.Tables.Add(detailsData.Copy());
                }
                FastReport.Report report = new FastReport.Report();
                Res.LocaleFolder = AppDomain.CurrentDomain.BaseDirectory + "FastReports\\Localization";
                Res.LoadLocale(Res.LocaleFolder + @"\Chinese (Simplified).frl");
                string FDataTables = "FDataTables";
                string filename    = @"FastReports\Reports\fx_001.frx";
                report.Load(filename);

                using (Designer designer = new Designer())
                {
                    designer.SetModified(this, "EditData");
                    int i = 0;
                    foreach (DataTable dt in printDataDs.Tables)
                    {
                        FDataTables = "FDataTables" + i.ToString();
                        printDataDs.Tables[i].TableName = FDataTables;
                        report.RegisterData(printDataDs.Tables[i], FDataTables);
                        report.GetDataSource(FDataTables).Enabled = true;
                        i = i + 1;
                    }
                    Res.LocaleFolder = AppDomain.CurrentDomain.BaseDirectory + "FastReports\\Localization";
                    Res.LoadLocale(Res.LocaleFolder + @"\Chinese (Simplified).frl");
                    if (isDesign)
                    {
                        report.Design();
                    }
                    else
                    {
                        report.SetParameterValue("time", DateTime.Now.Date.ToString("yyyy-MM-dd"));
                        report.Prepare();
                        report.ShowPrepared();
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Example #28
0
 private void Form2_Load(object sender, EventArgs e)
 {
     #region 快速报表
     FastReport.Report fr = new FastReport.Report();
     fr.Load(@"Reports\fastReport1.frx");
     fr.Preview = previewControl1;
     fr.SetParameterValue("Title", "快速报表~~~");
     fr.Show();
     #endregion
 }
Example #29
0
        public static void GenereteReport(ReportParams reportParams)
        {
            if (reportParams == null)
            {
                throw new ArgumentNullException($"{nameof(reportParams)} cannot be null.");
            }

            // create report instance
            using (FastReport.Report report = new FastReport.Report())
            {
                // load the existing report
                report.Load(reportParams.FrxPath);

                // register datasource's
                if (reportParams.DataSource != null)
                {
                    foreach (var pair in reportParams.DataSource)
                    {
                        report.RegisterData(pair.Value, pair.Key);
                    }
                }

                if (reportParams.Parameters != null)
                {
                    foreach (var pair in reportParams.Parameters)
                    {
                        report.SetParameterValue(pair.Key, pair.Value);
                    }
                }

                // prepare the report
                report.Prepare();

                ExportBase export = null;
                switch (reportParams.OutputType)
                {
                case 0:     // export to html
                    export = new HTMLExport();
                    (export as HTMLExport).Format = HTMLExportFormat.HTML;
                    break;

                case 1:
                    export = new ImageExport();
                    (export as ImageExport).ImageFormat = ImageExportFormat.Png;
                    break;

                default:
                    throw new ArgumentException($"O parametro {reportParams.OutputType} é inválido");
                }

                report.Export(export, reportParams.OutStream);
            }

            reportParams.OutStream.Position = 0;
        }
Example #30
0
        public FormReportCP(string ord_no)
        {
            InitializeComponent();
            var order = SqlUtil.Inst.Orders.FirstOrDefault(a => a.no == ord_no);

            if (order == null)
            {
                return;
            }
            var          dataList  = SqlUtil.Inst.Details.Where(a => a.ord_no == order.no).ToList();
            Assembly     assembly  = Assembly.GetExecutingAssembly();
            List <Order> dataList2 = new List <Order>();

            dataList2.Add(order);
            var hz = dataList2.Select(a => new
            {
                date = a.date.ToString("yyyy-MM-dd HH:mm"),
                zje  = a.zje.ToString("0.00"),
                yhje = a.yhje.ToString("0.00"),
                sfje = (a.zje - a.yhje).ToString("0.00"),
                a.desk,
                ord_no = a.no
            }).ToList();

            //获取指定的资源

            using (Stream stream = assembly.GetManifestResourceStream("DishSysManager.daily_cp.frx"))
            {
                if (stream != null)  //没有找到,GetManifestResourceStream会返回null
                {
                    report.Clear();
                    report.Load(stream);
                    report.RegisterData(dataList, "mx");
                    report.RegisterData(hz, "hz");
                    report.Prepare();
                    report.PrintSettings.ShowDialog = false;
                    report.Print();
                }
            }
            autoClose = true;
        }
Example #31
0
        protected void WebReport1_StartReport(object sender, EventArgs e)
        {
            FastReport.Report report = new FastReport.Report();
            var path = FastReport.Utils.Config.ApplicationFolder + "report1.frx";//report.Load()

            report.Load(path);
            WebReport1.Report = report;
            var js = string.Format("<script>window.open('/FastReport.Export.axd?object={0}&print_browser=1&s=2944');</script>", WebReport1.ReportGuid);

            ClientScript.RegisterStartupScript(typeof(string), "autorun", js);
            //report.Show();
        }
Example #32
0
 private void hotSpot1_Click(object sender, EventArgs e)
 {
     if (File.Exists(txtREPORTFILE.Text) && (txtREPORTFILE.Text.Length > 0))
     {
         FastReport.Report rpt = new FastReport.Report();
         rpt.Load(txtREPORTFILE.Text);
         rpt.AutoFillDataSet = false;
         rpt.Dictionary.Connections[0].ConnectionString = string.Format(@"XSDFile={1};XmlFile={0}", txtXMLDataFile.Text, txtXSDSchemaFile.Text);
         rpt.AutoFillDataSet = true;
         rpt.Show();
     }
 }
Example #33
0
        private string GenderPDF(string model, DataSet ds)
        {
            FastReport.Report report = new FastReport.Report();
            report.Load(model);
            report.RegisterData(ds);

            report.Prepare();
            //report.PreparePhase1();
            //report.PreparePhase2();

            //初始化输出类
            PDFExport export = new PDFExport();
            //输出
            string path = "E:\\lis\\temp.pdf";
            export.Export(report, path);

            return path;
        }
 /// <summary>
 /// 生成明细报表
 /// </summary>
 /// <param name="dt">打印数据</param>
 /// <returns></returns>
 public FastReport.Report GetDetailReport(Dictionary<string, DataTable> dic)
 {
     if (!Directory.Exists("BusinessPrint"))
     {
         Directory.CreateDirectory("BusinessPrint");
     }
     
     FastReport.Report report = new FastReport.Report();
     foreach (string key in dic.Keys)
     {
         report.RegisterData(dic[key], key);
     }
     if (File.Exists(reportFileName))
     {
         report.Load(reportFileName);
     }
     report.DoublePass = true;//双通道,只有这样才能显示总页数
     return report;
 }
Example #35
0
        //导出
        void UCReport_ExportEvent(object sender, EventArgs e)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                MessageBoxEx.Show("请查询出要导出的数据!");
                return;
            }
            string fileName = GetDefaultStyleFile();
            // create report instance
            FastReport.Report report = new FastReport.Report();
            if (!string.IsNullOrEmpty(fileName))
            {
                report.Load(fileName);
                report.RegisterData(dt, styleObject);
            }
            else
            {

                Report.FastReportEx reportEx = new Report.FastReportEx();
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.dt = dt;
                reportEx.styleObject = styleObject;
                reportEx.styleTitle = styleTitle;
                report = reportEx.DefaultReport();
            }
            if (report == null)
            {
                return;
            }
            report.Prepare();
            report.FileName = styleTitle;
            //PDFExport export = new PDFExport();
            //export.Name = "name";
            //export.Title = styleTitle;
            //export.Export(report,styleTitle+".pdf");
            FastReport.Export.Csv.CSVExport csvExport = new FastReport.Export.Csv.CSVExport();
            csvExport.Export(report);
            //report.Export(export, styleTitle + ".pdf");
            report.Dispose();
        }
Example #36
0
        private void btnImprimirSugerido_Click(object sender, EventArgs e)
        {
            try
            {
                // if (this.dgvSugeridos.DataSource == null) return;
                if (this.tabPedidos.SelectedIndex != 0) return;

                /*
                DataTable t = new DataTable();
                DataTable dt = new DataTable();

                BindingSource bs = (BindingSource)this.dgvSugeridos.DataSource;
                if (string.IsNullOrEmpty(bs.Filter))
                {
                    dt = (DataTable)bs.DataSource;
                    t = dt.AsEnumerable().Where(x => x.Field<Boolean>("Sel") && x.Field<decimal>("Pedido") > 0).CopyToDataTable();
                }
                else
                {
                    DataView dv = (DataView)bs.List;
                    dt = dv.ToTable();
                    t = dt.AsEnumerable().Where(x => x.Field<Boolean>("Sel") && x.Field<decimal>("Pedido") > 0).CopyToDataTable();
                }
                */

                // Se quitan los que no estén seleccionados y los que no tengan pedido
                var oPartes = new List<pauPedidosSugeridos_Res>();
                foreach (DataGridViewRow oFila in this.dgvSugeridos.Rows)
                {
                    if (!oFila.Visible || !Util.Logico(oFila.Cells["sug_Sel"].Value) || Util.Decimal(oFila.Cells["sug_Pedido"].Value) <= 0)
                        continue;
                    oPartes.Add(new pauPedidosSugeridos_Res()
                    {
                        ParteID = Util.Entero(oFila.Cells["sug_ParteID"].Value),
                        NumeroParte = Util.Cadena(oFila.Cells["sug_NumeroDeParte"].Value),
                        NombreParte = Util.Cadena(oFila.Cells["sug_Descripcion"].Value),
                        UnidadEmpaque = Util.Decimal(oFila.Cells["sug_UnidadDeEmpaque"].Value),
                        CriterioABC = Util.Cadena(oFila.Cells["sug_AbcDeVentas"].Value),
                        NecesidadMatriz = Util.Decimal(oFila.Cells["sug_NecesidadMatriz"].Value),
                        NecesidadSuc02 = Util.Decimal(oFila.Cells["sug_NecesidadSuc02"].Value),
                        NecesidadSuc03 = Util.Decimal(oFila.Cells["sug_NecesidadSuc03"].Value),
                        Total = Util.Decimal(oFila.Cells["sug_Total"].Value),
                        Pedido = Util.Decimal(oFila.Cells["sug_Pedido"].Value),
                        CostoConDescuento = Util.Decimal(oFila.Cells["sug_CostoConDescuento"].Value),
                        Costo = Util.Decimal(oFila.Cells["sug_CostoTotal"].Value),
                        Observacion = Util.Cadena(oFila.Cells["sug_Observacion"].Value),
                    });
                }

                var oRep = new FastReport.Report();
                oRep.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReportePedidosSugeridos.frx"));
                oRep.RegisterData(oPartes, "PartesSugeridas");
                oRep.SetParameterValue("Proveedor", this.dgvProveedores.CurrentRow.Cells["pro_Proveedor"].Value);
                oRep.SetParameterValue("Usuario", GlobalClass.UsuarioGlobal.NombreUsuario);
                // oRep.GetDataSource("PartesSugeridas").Enabled = true;
                UtilLocal.EnviarReporteASalida("Reportes.Pedidos.Pedido", oRep);
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #37
0
        private void btnImprimirTicket_Click(object sender, EventArgs e)
        {
            if (!EsNuevo && oParte != null)
            {
                int copias = 0;
                var frmCantidad = new MensajeObtenerValor("Número de etiquetas", "1", MensajeObtenerValor.Tipo.Entero);
                if (frmCantidad.ShowDialog(Principal.Instance) == DialogResult.OK)
                {
                    copias = Util.Entero(frmCantidad.Valor);
                }
                frmCantidad.Dispose();

                if (copias > 0)
                {
                    var etiquetas = new List<Etiquetas>();
                    for (int x = 0; x < copias; x++)
                    {
                        var etiqueta = new Etiquetas()
                        {
                            ParteID = oParte.ParteID,
                            NumeroParte = oParte.NumeroParte,
                            NombreParte = oParte.NombreParte,
                            CodigoBarra = oParte.CodigoBarra,
                            NumeroEtiquetas = copias
                        };
                        etiquetas.Add(etiqueta);
                    }

                    IEnumerable<Etiquetas> listaEtiquetas = etiquetas;
                    using (FastReport.Report report = new FastReport.Report())
                    {
                        report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteEtiquetas.frx"));
                        report.RegisterData(etiquetas, "etiquetas", 3);
                        report.GetDataSource("etiquetas").Enabled = true;
                        // report.FindObject("Text1").Delete();
                        // report.Show(true);
                        UtilLocal.EnviarReporteASalida("Reportes.Partes.Etiqueta", report);
                    }
                }
            }
        }
Example #38
0
        private void btnProcesar_Click(object sender, EventArgs e)
        {
            try
            {
                this.tabPedidos.SelectedIndex = 0; ;
                if (this.dgvProveedores.CurrentRow == null)
                {
                    Util.MensajeError("Debe seleccionar a un Proveedor.", GlobalClass.NombreApp);
                    return;
                }

                // Se valida que haya al menos una parte seleccionada
                bool bError = true;
                foreach (DataGridViewRow oFila in this.dgvSugeridos.Rows)
                {
                    if (Util.Logico(oFila.Cells["sug_Sel"].Value))
                    {
                        bError = false;
                        break;
                    }
                }
                // if (this.dgvSugeridos.DataSource == null)
                if (bError)
                {
                    Util.MensajeError("Debe seleccionar al menos un número de parte.", GlobalClass.NombreApp);
                    return;
                }

                var proveedorId = Util.Entero(this.dgvProveedores.CurrentRow.Cells["pro_ProveedorID"].Value);
                var proveedor = Datos.GetEntity<Proveedor>(p => p.ProveedorID == proveedorId);
                if (proveedor != null)
                {
                    var msj = string.Format("{0} {1} {2}", "¿Está seguro de que la información del Pedido es correcta?", "Para el Proveedor:", proveedor.NombreProveedor);
                    var res = Util.MensajePregunta(msj, GlobalClass.NombreApp);
                    if (res == DialogResult.No)
                        return;
                }
                else
                {
                    Util.MensajeError("Proveedor Inválido.", GlobalClass.NombreApp);
                    return;
                }

                this.Cursor = Cursors.WaitCursor;
                SplashScreen.Show(new Splash());
                this.btnProcesar.Enabled = false;

                var pedido = new Pedido()
                {
                    ProveedorID = proveedorId,
                    ImporteTotal = Util.Decimal(this.txtImporteTotal.Text.SoloNumeric()),
                    PedidoEstatusID = 2
                };

                Datos.Guardar<Pedido>(pedido);

                if (pedido.PedidoID <= 0)
                {
                    this.Cursor = Cursors.Default;
                    SplashScreen.Close();
                    Util.MensajeError("Ocurrio un error al guardar el Pedido.", GlobalClass.NombreApp);
                    this.btnProcesar.Enabled = true;
                    return;
                }

                // DataTable dt = new DataTable();
                // BindingSource bs = (BindingSource)this.dgvSugeridos.DataSource;

                //Validación, debe estar seleccionado y el pedido debe ser mayor a 0
                /* if (!string.IsNullOrEmpty(bs.Filter))
                {
                    DataView dv = (DataView)bs.List;
                    dt = dv.ToTable().AsEnumerable().Where(x => x.Field<Boolean>("Sel") && x.Field<decimal>("Pedido") > 0).CopyToDataTable();
                } */

                foreach (DataGridViewRow oFila in this.dgvSugeridos.Rows)
                {
                    if (!oFila.Visible) continue;

                    int iParteID = Util.Entero(oFila.Cells["sug_ParteID"].Value);

                    // Se verifica si no se debe pedir por existencia en equivalentes
                    var oNoPedir = Datos.GetEntity<ParteCaracteristicaTemporal>(c => c.ParteID == iParteID
                        && c.Caracteristica == Cat.CaracTempPartes.NoPedidosPorEquivalentes);
                    if (Util.Cadena(oFila.Cells["sug_Caracteristica"].Value) == "NP")
                    {
                        if (oNoPedir == null)
                        {
                            oNoPedir = new ParteCaracteristicaTemporal()
                            {
                                ParteID = iParteID,
                                Caracteristica = Cat.CaracTempPartes.NoPedidosPorEquivalentes
                            };
                            Datos.Guardar<ParteCaracteristicaTemporal>(oNoPedir);
                        }
                    }
                    else
                    {
                        if (oNoPedir != null)
                            Datos.Eliminar<ParteCaracteristicaTemporal>(oNoPedir);
                    }

                    // Se verifica si está marcado o tiene pedidos para procesar, si no, se salta
                    if (!Util.Logico(oFila.Cells["sug_Sel"].Value) || Util.Decimal(oFila.Cells["sug_Pedido"].Value) <= 0)
                        continue;

                    if (Util.Entero(oFila.Cells["sug_ProveedorID"].Value) != proveedorId)
                    {
                        this.Cursor = Cursors.Default;
                        SplashScreen.Close();
                        var msj = string.Format("{0} {1} {2} {3}", "El número de Parte:", Util.Cadena(oFila.Cells["sug_NumeroDeParte"].Value)
                            , "No está asignado al Proveedor:", proveedor.NombreProveedor);
                        Util.MensajeError(msj, GlobalClass.NombreApp);
                        this.btnProcesar.Enabled = true;
                        return;
                    }

                    //
                    var detallePedido = new PedidoDetalle()
                    {
                        PedidoID = pedido.PedidoID,
                        ParteID = iParteID,
                        CantidadPedido = Util.Decimal(oFila.Cells["sug_Pedido"].Value),
                        CostosUnitario = Util.Decimal(oFila.Cells["sug_CostoConDescuento"].Value),
                        PedidoEstatusID = 2
                    };
                    Datos.Guardar<PedidoDetalle>(detallePedido);

                    // Se marca como pedido si es 9500
                    if (Util.Cadena(oFila.Cells["sug_Caracteristica"].Value) == "9500")
                    {
                        var o9500 = Datos.GetListOf<Cotizacion9500Detalle>(c => c.ParteID == iParteID && !c.Pedido && c.Estatus);
                        foreach (var oReg in o9500)
                        {
                            oReg.Pedido = true;
                            Datos.Guardar<Cotizacion9500Detalle>(oReg);
                        }
                    }

                    // Se marca como pedido en reporte de faltante, si aplica
                    if (Util.Cadena(oFila.Cells["sug_Caracteristica"].Value) == "RF")
                    {
                        var oFaltantes = Datos.GetListOf<ReporteDeFaltante>(c => c.ParteID == iParteID && !c.Pedido && c.Estatus);
                        foreach (var oReg in oFaltantes)
                        {
                            oReg.Pedido = true;
                            Datos.Guardar<ReporteDeFaltante>(oReg);
                        }
                    }
                }

                var ped = Datos.GetListOf<PedidosView>(p => p.PedidoID.Equals(pedido.PedidoID));
                var detalle = Datos.GetListOf<PedidosDetalleView>(p => p.PedidoID.Equals(pedido.PedidoID));

                IEnumerable<PedidosView> pedidoE = ped;
                IEnumerable<PedidosDetalleView> detalleE = detalle;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReportePedidos.frx"));
                    report.RegisterData(pedidoE, "Pedido");
                    report.GetDataSource("Pedido").Enabled = true;
                    report.RegisterData(detalleE, "DetallePedido");
                    report.GetDataSource("DetallePedido").Enabled = true;
                    report.Show(true);
                }

                this.Cursor = Cursors.Default;
                this.LimpiarFormularioDos();
                SplashScreen.Close();
                this.btnProcesar.Enabled = true;
                new Notificacion("Pedido Guardado exitosamente", 2 * 1000).Mostrar(Principal.Instance);
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                SplashScreen.Close();
                this.btnProcesar.Enabled = true;
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #39
0
 /// <summary>
 /// 设计报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmDesginReport_Click(object sender, EventArgs e)
 {
     report = new FastReport.Report();
     if (!report.IsDesigning)
     {
         GetData(tsmChooseDetail[iDefaultChecked].Name);
         report.Load(new MemoryStream(bt));
         RegReportData();
     }
     frmReportDesign rp = new frmReportDesign(report);
     rp.ReportGUID = rpGUID;
     rp.ShowDialog();
     report.Dispose();
     //刷新菜单
     CreateMenu();
 }
Example #40
0
        public static void getReport(string SQL, string AliasName, string FolderName, string FileName)
        {
            FastReport.Report report = new FastReport.Report();
            try
            {
                if (Function.FTPDownload(@"C:\Report/" + FolderName, FolderName, FileName))
                {
                    DataTable dt = Services.Database.ExecuteQuery(SQL).Tables[0];

                    report.RegisterData(dt, AliasName);
                    report.GetDataSource(AliasName).Enabled = true;
                    report.Load(@"C:\Report/" + FolderName + "/" + FileName);
                    report.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Дараахи алдаа гарлаа. " + ex.Message.ToString(), "Алдаа", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                report.Dispose();
            }
        }
Example #41
0
 /// <summary>
 /// 打印预览
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPreviewReport_Click(object sender, EventArgs e)
 {
     report = new FastReport.Report();
     if (!report.IsRunning)
     {
         GetData(tsmChooseDetail[iDefaultChecked].Name);
         report.Load(new MemoryStream(bt));
         RegReportData();
     }
     frmReportPreview rp = new frmReportPreview(report);
     rp.ShowDialog();
     report.Dispose();
 }
Example #42
0
 private string GenderPDF(string model, DataSet ds)
 {
     //
     using (FastReport.Report report = new FastReport.Report())
     {
         report.Load(model);
         report.RegisterData(ds);
         report.Prepare(); //报告准备
         //report.PreparePhase1();
         //report.PreparePhase2();
         //初始化PDF输出类
         using (PDFExport export = new PDFExport())
         {
             this.InitPDFExport(export);
             //输出PDF
             string fileFullName = GetFileFullName();
             export.Export(report, fileFullName);
             return fileFullName;
         }
     }
 }
Example #43
0
 /// <summary>
 /// 打印
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPrintReport_Click(object sender, EventArgs e)
 {
     report = new FastReport.Report();
     if (!report.IsPrinting)
     {
         GetData(tsmChooseDetail[iDefaultChecked].Name);
         report.Load(new MemoryStream(bt));
         RegReportData();
     }
     report.Print();
     report.Dispose();
 }
Example #44
0
        private void ImprimirEtiquetas(string sReporte)
        {
            // Se muestra progreso de avance
            this.IniciarTerminarProgreso(true);

            // Se inicia el proceso de impresión
            Datos.StartPersistentContext();
            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                this.pgrGuardar.EjecutarPaso(true);
                if (!Util.Logico(oFila.Cells["Procesar"].Value)) continue;

                int iParteID = Util.Entero(oFila.Cells["ParteID"].Value);
                var oParte = Datos.GetEntity<Parte>(c => c.ParteID == iParteID && c.Estatus);
                var oEtiqueta = new Etiquetas()
                {
                    ParteID = iParteID,
                    NumeroParte = oParte.NumeroParte,
                    NombreParte = oParte.NombreParte,
                    CodigoBarra = oParte.CodigoBarra
                };

                // Se manda imprimir el reporte
                var oRep = new FastReport.Report();
                oRep.Load(sReporte);
                oRep.RegisterData(new List<Etiquetas>() { oEtiqueta }, "etiquetas");
                oRep.Print();
            }
            Datos.EndPersistentContext();

            this.IniciarTerminarProgreso(false);
            UtilLocal.MostrarNotificacion("Proceso completado correctamente.");
        }
Example #45
0
        private void DisplayReporteDevolucion()
        {
            try
            {
                var movimiento = Datos.GetListOf<MovimientoInventarioView>(m => m.MovimientoInventarioID.Equals(oID));
                var detalle = Datos.GetListOf<MovimientoInventarioDetalleView>(d => d.MovimientoInventarioID.Equals(oID));

                IEnumerable<MovimientoInventarioView> movimientoE = movimiento;
                IEnumerable<MovimientoInventarioDetalleView> detalleE = detalle;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteSalidaDevolucion.frx"));
                    report.RegisterData(movimientoE, "movimiento", 3);
                    report.RegisterData(detalleE, "detalle", 3);
                    report.GetDataSource("movimiento").Enabled = true;
                    report.GetDataSource("detalle").Enabled = true;
                    //report.Show(true);
                    UtilLocal.EnviarReporteASalida("Reportes.DevolucionAProveedor.Salida", report);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #46
0
        private void DisplayReporteEntradaCompra()
        {
            try
            {
                var movimiento = Datos.GetListOf<MovimientoInventarioView>(m => m.MovimientoInventarioID.Equals(oID));
                var detalle = Datos.GetListOf<MovimientoInventarioDetalleView>(d => d.MovimientoInventarioID.Equals(oID));

                var detalleDescuentosGen = new List<MovimientoInventarioDescuentoView>();
                var detalleDescuentosGenerales = Datos.GetListOf<MovimientoInventarioDescuentoView>(m => m.MovimientoInventarioID.Equals(oID)
                    && (m.TipoDescuentoID.Equals(1) || m.TipoDescuentoID.Equals(4) || m.TipoDescuentoID.Equals(2) || m.TipoDescuentoID.Equals(5)));

                bool uno = false;
                bool cuatro = false;
                bool dos = false;
                bool cinco = false;
                foreach (var descuentoGen in detalleDescuentosGenerales)
                {
                    if (descuentoGen.TipoDescuentoID.Equals(1) && uno.Equals(false))
                    {
                        uno = true;
                        detalleDescuentosGen.Add(descuentoGen);
                    }
                    if (descuentoGen.TipoDescuentoID.Equals(4) && cuatro.Equals(false))
                    {
                        cuatro = true;
                        detalleDescuentosGen.Add(descuentoGen);
                    }
                    if (descuentoGen.TipoDescuentoID.Equals(2) && dos.Equals(false))
                    {
                        dos = true;
                        detalleDescuentosGen.Add(descuentoGen);
                    }
                    if (descuentoGen.TipoDescuentoID.Equals(5) && cinco.Equals(false))
                    {
                        cinco = true;
                        detalleDescuentosGen.Add(descuentoGen);
                    }
                }

                var detalleDescuentosInd = Datos.GetListOf<MovimientoInventarioDescuentoView>(m => m.MovimientoInventarioID.Equals(oID)
                    && m.TipoDescuentoID.Equals(3));

                foreach (var descuentoGen in detalleDescuentosInd)
                {
                    detalleDescuentosGen.Add(descuentoGen);
                }

                IEnumerable<MovimientoInventarioView> movimientoE = movimiento;
                IEnumerable<MovimientoInventarioDetalleView> detalleE = detalle;
                IEnumerable<MovimientoInventarioDescuentoView> descuentosGen = detalleDescuentosGen;
                //IEnumerable<MovimientoInventarioDescuentoView> descuentosInd = detalleDescuentosInd;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteEntradaCompra.frx"));
                    report.RegisterData(movimientoE, "movimiento", 3);
                    report.RegisterData(detalleE, "detalle", 3);
                    report.RegisterData(descuentosGen, "descuentosGenerales", 3);
                    //report.RegisterData(descuentosInd, "descuentosIndividuales", 3);
                    report.GetDataSource("movimiento").Enabled = true;
                    report.GetDataSource("detalle").Enabled = true;
                    report.GetDataSource("descuentosGenerales").Enabled = true;
                    //report.GetDataSource("descuentosIndividuales").Enabled = true;
                    report.Show(true);
                }

            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #47
0
        private void DisplayReporteEtiquetas()
        {
            try
            {
                var movimientoEtiquetas = Datos.GetListOf<MovimientoInventarioEtiquetasView>(l => l.MovimientoInventarioID.Equals(oID));
                var listaEtiquetas = new List<Etiquetas>();

                var cont = 0;
                foreach (var etiqueta in movimientoEtiquetas)
                {
                    for (var x = 0; x < etiqueta.NumeroEtiquetas; x++)
                    {
                        cont += 1;
                        var e = new Etiquetas()
                        {
                            MovimientoInventarioEtiquetaID = cont,
                            MovimientoInventarioID = oID,
                            ParteID = etiqueta.ParteID,
                            NumeroParte = etiqueta.NumeroParte,
                            CodigoBarra = etiqueta.CodigoBarra,
                            NumeroEtiquetas = 1,
                            NombreParte = etiqueta.NombreParte
                        };
                        listaEtiquetas.Add(e);
                    }
                }

                // Se obtiene el folio de la factura, para mandarlo al reporte
                var oMov = Datos.GetEntity<MovimientoInventario>(c => c.MovimientoInventarioID == oID);

                IEnumerable<Etiquetas> detalleE = listaEtiquetas;
                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteEtiquetas.frx"));
                    report.RegisterData(detalleE, "etiquetas", 3);
                    report.SetParameterValue("FolioFactura", oMov.FolioFactura);
                    report.GetDataSource("etiquetas").Enabled = true;
                    report.Show(true);
                    //report.Design(true);
                }

            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Example #48
0
        private void DisplayReporteTraspaso()
        {
            try
            {
                var movimiento = Datos.GetListOf<MovimientoInventarioView>(m => m.MovimientoInventarioID.Equals(oID));
                var detalle = Datos.GetListOf<MovimientoInventarioDetalleView>(d => d.MovimientoInventarioID.Equals(oID));

                IEnumerable<MovimientoInventarioView> movimientoE = movimiento;
                IEnumerable<MovimientoInventarioDetalleView> detalleE = detalle;

                using (FastReport.Report report = new FastReport.Report())
                {
                    if (detalle.Count < 10)
                        report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteTraspaso.frx"));
                    else
                        report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteTraspasosMasDeDiez.frx"));

                    report.RegisterData(movimientoE, "movimiento", 3);
                    report.RegisterData(detalleE, "detalle", 3);
                    report.GetDataSource("movimiento").Enabled = true;
                    report.GetDataSource("detalle").Enabled = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
        //选择打印样式
        private void cboPrintStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboPrintStyle.SelectedItem == null)
            {
                return;
            }
            DataRowView drv = (DataRowView)cboPrintStyle.SelectedItem;
            //样式ID
            string styleID = CommonCtrl.IsNullToString(drv["style_id"]);
            //如果是默认样式,则不用设为默认样式
            btnDefault.Enabled = styleID.Length > 0 && CommonCtrl.IsNullToString(drv["is_default"]) != "1";
            //如果有样式ID,才可以删除
            btnDelete.Enabled = styleID.Length > 0;

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            string printStyle = CommonCtrl.IsNullToString(cboPrintStyle.SelectedValue);
            FastReport.Report rep;
            //FileTransferOperation fileOperation = new FileTransferOperation();
            ////如果下载出问题,用默认样式
            //if (!fileOperation.DownLoadFile(printStyle, "Report"))
            //{
            //    //LoadDefaultStyle();
            //    reportEx.LoadDefaultStyle(designerReport);
            //}
            //fileOperation.DownFile += new HXCFileTransferCache_Client.DownLoadFileHandler<HXCFileTransferCache_Client.DownLoadFileEventArgs>(fileOperation_DownFile);
            //下载打印样式
            string fileName = FileOperation.DownLoadFileByFile(cboPrintStyle.SelectedValue.ToString(), "Report");
            //如果没找到,则用默认样式
            if (string.IsNullOrEmpty(fileName))
            {
                FastReportEx reportEx = new FastReportEx();
                reportEx.styleObject = styleObject;
                reportEx.dt = dt;
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.styleTitle = styleTitle;
                rep = reportEx.DefaultReport();
                if (rep == null)
                {
                    return;
                }
            }
            else
            {
                rep = new FastReport.Report();
                rep.Load(fileName);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rep.RegisterData(dt, styleObject);
                }
            }
            designerReport.Report = rep;
            designerReport.RefreshLayout();
        }
Example #50
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvDatos.DataSource == null)
                    return;

                BindingSource bs = (BindingSource)this.dgvDatos.DataSource;
                DataTable dt = (DataTable)bs.DataSource;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReportePartesClasificacionAbc.frx"));
                    report.RegisterData(dt, "PartesClasificacionAbc");
                    report.GetDataSource("PartesClasificacionAbc").Enabled = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }