Example #1
0
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            if (dgList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet ds = new DataSet();

            //DataTable dt = (DataTable)dgList.DataSource;
            DataTable dt      = GetDgvToTable(dgList);
            DataTable dtPrint = dt.Copy();

            dtPrint.TableName = strStaticsName;
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\预存统计模板\" + strStaticsName + ".frx");

                if (strStaticsName == "预存统计(按收费员)")
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = "大厅收费统计(按收费员)";
                }
                else if (strStaticsName == "预存统计(按用户)")
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = "大厅收费统计(按用户)";
                }
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource(strStaticsName).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();
            }
        }/// <summary>
Example #2
0
        private void toolPrint_Click(object sender, EventArgs e)
        {
            if (dtWaterMeterList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet   ds      = new DataSet();
            DataTable dtPrint = GetDgvToTable(dgList);

            dtPrint.TableName = "收费明细表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\一户式查询打印.frx");
                (report1.FindObject("txtWaterUserNO") as FastReport.TextObject).Text      = "用户号:" + strWaterUserID;
                (report1.FindObject("txtWaterUserName") as FastReport.TextObject).Text    = "用户名:" + strWaterUserName;
                (report1.FindObject("txtWaterUserAddress") as FastReport.TextObject).Text = "地  址:" + strWaterUserAddress;
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("收费明细表").Enabled = true;
                report1.PrintSettings.ShowDialog       = false;
                report1.Prepare();
                report1.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
 private void btPrint_Click(object sender, EventArgs e)
 {
     if (txtReason.Text == "")
     {
         if (mes.ShowQ("原因为空,确定要打印吗?") != DialogResult.OK)
         {
             return;
         }
     }
     #region
     FastReport.Report report1 = new FastReport.Report();
     try
     {
         // load the existing report
         report1.Load(Application.StartupPath + @"\PRINTModel\变更审批表模板.frx");
         (report1.FindObject("txtName") as FastReport.TextObject).Text    = txtName.Text;
         (report1.FindObject("txtNO") as FastReport.TextObject).Text      = txtNO.Text;
         (report1.FindObject("txtAddress") as FastReport.TextObject).Text = txtAddress.Text;
         (report1.FindObject("txtReason") as FastReport.TextObject).Text  = "变更原因:" + txtReason.Text;
         //report1.Show();
         report1.PrintSettings.ShowDialog = false;
         report1.Prepare();
         report1.Print();
     }
     catch (Exception exx)
     {
         mes.Show(exx.Message);
         return;
     }
     finally
     {
         // free resources used by report
         report1.Dispose();
     }
     #endregion
 }
Example #4
0
        /// <summary>
        /// Creates the unique object's name.
        /// </summary>
        /// <remarks>
        /// <para><b>Note:</b> you have to set object's parent before calling this method. Method uses the <see cref="BaseName"/>
        /// property to create a name.</para>
        /// <para><b>Note:</b> this method may be very slow on a report that contains lots of objects. Consider
        /// using own naming logic in this case.</para>
        /// </remarks>
        /// <example>
        /// <code>
        /// TextObject textObj = new TextObject();
        /// dataBand1.Objects.Add(textObj);
        /// textObj.CreateUniqueName();
        /// </code>
        /// </example>
        public void CreateUniqueName()
        {
            Report report = Report;

            if (report == null)
            {
                return;
            }

            string s;
            int    i = 1;

            do
            {
                s = baseName + i.ToString();
                i++;
            }while (report.FindObject(s) != null);
            SetName(s);
        }
Example #5
0
        private void toolPrint_Click(object sender, EventArgs e)
        {
            if (dgJieZhangYS.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }
            decimal   decSum  = 0;
            DataSet   ds      = new DataSet();
            DataTable dtPrint = GetDgvToTable(dgJieZhangYS);

            dtPrint.TableName = "水费应收统计表(按用水性质)";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\应收水费统计模板\应收水费统计(结账报表).frx");
                (report1.FindObject("txtMonth") as FastReport.TextObject).Text = "应收月份:" + dtpStartSearch.Value.ToString("yyyy-MM");
                report1.RegisterData(ds);
                report1.GetDataSource("水费应收统计表(按用水性质)").Enabled = true;
                report1.PrintSettings.ShowDialog = false;
                report1.Prepare();
                report1.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Example #6
0
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\用水情况一览表.frx");
                (report1.FindObject("Cell3") as FastReport.TextObject).Text   = labYCHS.Text;
                (report1.FindObject("Cell8") as FastReport.TextObject).Text   = labXSHS.Text;
                (report1.FindObject("Cell13") as FastReport.TextObject).Text  = labXHHS.Text;
                (report1.FindObject("Cell148") as FastReport.TextObject).Text = labYMHS.Text;

                (report1.FindObject("Cell33") as FastReport.TextObject).Text = labYSZJ.Text;
                (report1.FindObject("Cell43") as FastReport.TextObject).Text = labFSYSHS.Text;
                (report1.FindObject("Cell48") as FastReport.TextObject).Text = labYSYSL.Text;
                (report1.FindObject("Cell38") as FastReport.TextObject).Text = labYSSF.Text;
                (report1.FindObject("Cell58") as FastReport.TextObject).Text = labYSWSSF.Text;
                (report1.FindObject("Cell63") as FastReport.TextObject).Text = labYSFJF.Text;

                (report1.FindObject("Cell68") as FastReport.TextObject).Text  = labSSZJ.Text;
                (report1.FindObject("Cell108") as FastReport.TextObject).Text = labSSSL.Text;
                (report1.FindObject("Cell103") as FastReport.TextObject).Text = labSSHS.Text;
                (report1.FindObject("Cell53") as FastReport.TextObject).Text  = labSSSF.Text;
                (report1.FindObject("Cell28") as FastReport.TextObject).Text  = labSSWSCLF.Text;
                (report1.FindObject("Cell18") as FastReport.TextObject).Text  = labSSFJF.Text;
                (report1.FindObject("Cell113") as FastReport.TextObject).Text = labOverDue.Text;

                (report1.FindObject("Cell73") as FastReport.TextObject).Text = labWQZJ.Text;
                (report1.FindObject("Cell98") as FastReport.TextObject).Text = labWQSL.Text;
                (report1.FindObject("Cell93") as FastReport.TextObject).Text = labWQHS.Text;
                (report1.FindObject("Cell88") as FastReport.TextObject).Text = labWQSF.Text;
                (report1.FindObject("Cell83") as FastReport.TextObject).Text = labWQWSCLF.Text;
                (report1.FindObject("Cell78") as FastReport.TextObject).Text = labWQFJF.Text;

                (report1.FindObject("Cell118") as FastReport.TextObject).Text = labLJQFZJ.Text;
                (report1.FindObject("Cell123") as FastReport.TextObject).Text = labLJQFHS.Text;
                (report1.FindObject("Cell128") as FastReport.TextObject).Text = labLJQFSL.Text;
                (report1.FindObject("Cell133") as FastReport.TextObject).Text = labLJQFSF.Text;
                (report1.FindObject("Cell138") as FastReport.TextObject).Text = labLJQFWSCLF.Text;
                (report1.FindObject("Cell143") as FastReport.TextObject).Text = labLJQFFJF.Text;

                //(report1.FindObject("Cell28") as FastReport.TextObject).Text = labSQZMJE.Text;
                //(report1.FindObject("Cell18") as FastReport.TextObject).Text = labBQZJ.Text;
                //(report1.FindObject("Cell23") as FastReport.TextObject).Text = labBQZMJE.Text;

                if (GetMonth(dtpStartSearch.Value, dtpEndSearch.Value) > 1)
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = dtpStartSearch.Value.ToString("yyyy-MM") + "至" + dtpEndSearch.Value.ToString("yyyy-MM") + "月份用水情况一览表";
                }
                else
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = strMonth[dtpEndSearch.Value.Month - 1] + "月份用水情况一览表";
                }

                // 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();
            }
        }
        /// <summary>
        /// 打印收条
        /// </summary>
        /// <param name="TaskID"></param>
        /// <param name="_LastPointSort"></param>
        private void PrintReceipt(string TaskID, string _LastPointSort)
        {
            //获取用户基本信息
            Hashtable ht = new SqlServerHelper().GetHashtableById("View_WorkBase", "TaskID", TaskID);

            if (ht.Contains("SD"))
            {
                string _waterUserId      = ht["WATERUSERID"].ToString();
                string _waterUserName    = ht["WATERUSERNAME"].ToString();
                string _SD               = ht["SD"].ToString();
                string _waterUserAddress = ht["WATERUSERADDRESS"].ToString();
                string _TotalFee_CH      = "";//合计大写

                //获取费用合计
                string sqlstr = @"SELECT * FROM 
(SELECT SUM(FEE) AS FEE,InvoiceType AS FEENAME,'0' AS SORT FROM 
(SELECT FEE,(SELECT InvoiceTitle FROM Meter_FeeItmes WHERE FeeID=MWF.FeeID) AS InvoiceType FROM Meter_WorkResolveFee MWF,Meter_WorkResolve MWR 
WHERE MWF.ResolveID=MWR.ResolveID AND MWF.[STATE]=1 
AND MWR.TaskID=@TaskID AND PointSort=@LastPoingSort
) T GROUP BY InvoiceType
UNION ALL
SELECT SUM(CONVERT(decimal,Fee)),'合计','1' FROM Meter_WorkResolveFee MWF,Meter_WorkResolve MWR 
WHERE MWF.ResolveID=MWR.ResolveID AND MWF.[STATE]=1
AND MWR.TaskID=@TaskID AND PointSort=@LastPoingSort) M WHERE FEE<>0";
                //FEE--收费金额
                //FEENAME--收费名称
                DataTable dt = new SqlServerHelper().GetDateTableBySql(sqlstr, new SqlParameter[] { new SqlParameter("@TaskID", TaskID), new SqlParameter("@LastPoingSort", _LastPointSort) });
                if (DataTableHelper.IsExistRows(dt))
                {
                    DataRow[] DR = dt.Select("SORT=1");
                    if (DR.Length.Equals(1))
                    {
                        _TotalFee_CH = RMBHelper.CmycurD(decimal.Parse(DR[0]["FEE"].ToString()));
                    }

                    //====================================打印
                    DataSet   ds     = new DataSet();
                    DataTable dtTemp = dt.Copy();
                    dtTemp.TableName = "收据模板";
                    ds.Tables.Add(dtTemp);
                    FastReport.Report report1 = new FastReport.Report();

                    try
                    {
                        // load the existing report
                        report1.Load(Application.StartupPath + @"\PRINTModel\业扩模板\业扩预算收据模板.frx");

                        (report1.FindObject("txtReceiptNO") as FastReport.TextObject).Text        = "NO." + RECEIPTNO.Text;
                        (report1.FindObject("txtWaterUserNO") as FastReport.TextObject).Text      = "用 户 号:" + _waterUserId;
                        (report1.FindObject("txtSD") as FastReport.TextObject).Text               = "受理编号:" + _SD;
                        (report1.FindObject("txtWaterUserName") as FastReport.TextObject).Text    = "用户名称:" + _waterUserName;
                        (report1.FindObject("txtWaterUserAddress") as FastReport.TextObject).Text = "地    址:" + _waterUserAddress;

                        (report1.FindObject("txtCapMoney") as FastReport.TextObject).Text = "金额大写:" + _TotalFee_CH;
                        (report1.FindObject("txtCasher") as FastReport.TextObject).Text   = "收 款 员:" + strRealName;

                        (report1.FindObject("txtReceiptNO1") as FastReport.TextObject).Text        = "NO." + RECEIPTNO.Text;
                        (report1.FindObject("txtWaterUserNO1") as FastReport.TextObject).Text      = "用 户 号:" + _waterUserId;
                        (report1.FindObject("txtSD1") as FastReport.TextObject).Text               = "受理编号:" + _SD;
                        (report1.FindObject("txtWaterUserName1") as FastReport.TextObject).Text    = "用户名称:" + _waterUserName;
                        (report1.FindObject("txtWaterUserAddress1") as FastReport.TextObject).Text = "地    址:" + _waterUserAddress;

                        (report1.FindObject("txtCapMoney1") as FastReport.TextObject).Text = "金额大写:" + _TotalFee_CH;
                        (report1.FindObject("txtCasher1") as FastReport.TextObject).Text   = "收 款 员:" + strRealName;

                        // register the dataset
                        report1.RegisterData(ds);
                        report1.GetDataSource("收据模板").Enabled = true;
                        //report1.Show();
                        report1.PrintSettings.ShowDialog = false;
                        report1.Prepare();
                        report1.Print();
                    }
                    catch (Exception ex)
                    {
                        mes.Show("收据打印失败:" + ex.Message);
                    }
                }
            }
        }