欢迎您来到 数字平台。 您尚未登录。[登录] [注册新用户]
当前位置: 论坛首页 / 栏目 产品与服务 / 文章 258

点击:2399

[顶层访客留言] [回复顶层(需要先登录)] [表状] [详细]
[回复留言] [回复(需要先登录)] [引用(需要先登录)]普通文章跟帖
文章id: 258
财产总账中如何定义自己需要的字段?

作者: magic3694


江老师:您好!由于新书通报不能输出表格式的文件,我想通过财产总账的统计程序变通一下,但相关的字段不知如何自定义,请赐教,谢谢!

财产总账的主要输出字段:

"序号,登录号,书名,著者,出版者,ISBN,出版版期,装订、开本页数,册数,单价,总价"

我想把“登录号,ISBN”两个字段改为“分类号905$d、种次号905$e”,通过这样更改后,输出的信息就为:"序号,分类号,书名,著者,出版者,种次号,出版版期,装订、开本页数,册数,单价,总价",再通过excel处理得到自己需要的文件。

// 财产总帐

// 最后修改时间: 2008/1/4

using System;

using System.Windows.Forms;

using System.IO;

using System.Text;

using System.Drawing;

using DigitalPlatform.MarcDom;

using DigitalPlatform.Statis;

using DigitalPlatform.Xml;

using DigitalPlatform.Text;

using dp1Batch;

public class MyBatch : Batch

{

    public string strDengLuHao = "";  //分类号905$d 可重

    public string strISBN = ""; //种次号 905$e

    public string strShuMing = "";//  书名 200$a

       public string strZhuZhe = ""; //著者 200$f

    public string strChuBanZhe = "";//出版者 210$c

    public string strChuBanRiQi = ""; //出版日期 205$a

    public string strZaiTi = "";//载体形态 215$a(页码) ,215$d(尺寸)

    public string strDanJia = ""; //单价 010$d

    public string strCheShu = "";//册数 905$f

    Table table = new Table(10); 

    string strOutFileName = "";  //输出文件类型

    string strWordFileName = "f:\\test.doc"; // 缺省Word文件名

    

    bool IsSort = false; //默认为不排序

    public override void OnBegin(object sender, BatchEventArgs e)

    {

        // 询问页面

        string strError;

        

        HtmlForm window = new HtmlForm();

        window.Url = this.ProjectDir + "\\input.html";

        window.Size = new Size(700,500);

        window.ShowDialog();

        // 必须是OK

        if (window.DialogResult != DialogResult.OK) 

        {

            e.Continue = ContinueType.SkipAll;

            return;

        }

        if (window.SubmitUrl == "action://ok/") 

        {

            //取排序风格

            string strIsSort = window.SubmitResult["sort"];

            if(strIsSort == "on")

                IsSort = true; //表示排序

            // 输出文件类型

            strOutFileName = window.SubmitResult["outfiletype"];

            // 输出word文件名

            strWordFileName = window.SubmitResult["filename"];            

        }

    }

    //普通表格模块

    public void DoCommonTable()

    {

        /*

    public string strDengLuHao = "";  //登录号905$b 可重

    public string strISBN = ""; //ISBN号 010$a

    public string strShuMing = "";//  书名 200$a

       public string strZhuZhe = ""; //著者 200$f

    public string strChuBanZhe = "";//出版者 210$c

    public string strChuBanRiQi = ""; //出版日期 205$a

    public string strZaiTi = "";//载体形态 215$a(页码) ,215$d(尺寸)

    public string strDanJia = ""; //单价 010$d

    public string strCheShu = "";//册数 905$f

        */

        table.SetValue(Convert.ToString(this.RecIndex),

            0,

            strDengLuHao);

        table.SetValue(Convert.ToString(this.RecIndex),

            1,

            strISBN);

        table.SetValue(Convert.ToString(this.RecIndex),

            2,

            strShuMing);

        table.SetValue(Convert.ToString(this.RecIndex),

            3,

            strZhuZhe);

        table.SetValue(Convert.ToString(this.RecIndex),

            4,

            strChuBanZhe);

        table.SetValue(Convert.ToString(this.RecIndex),

            5,

            strChuBanRiQi);

        table.SetValue(Convert.ToString(this.RecIndex),

            6,

            strZaiTi);

        table.SetValue(Convert.ToString(this.RecIndex),

            7,

            strCheShu);

        table.SetValue(Convert.ToString(this.RecIndex),

            8,

            strDanJia);

        //如果905$f有册数则按此计数,否则通过折分登录号,得到册数

        int nCheShu = 0;

        if (strCheShu == "")

        {

            nCheShu = GetCeShuFromDengLuHao(strDengLuHao);

        }

        else

        {

            nCheShu = Convert.ToInt32(strCheShu);

        }

        table.SetValue(Convert.ToString(this.RecIndex),

            9,

            nCheShu);

/* ????

        int nCheShu = 0;

        try

        {

            nCheShu = Convert.ToInt32(strCheShu);

        }

        catch

        {

        }

*/

        //总价

        Int64 v = 0;

        try {

            v = Batch.PriceToInt64(strDanJia);

        }

        catch {

            v = 0;    // TODO: strDanJia字符串格式有问题,这里可以报错

        }

        table.SetValue(Convert.ToString(this.RecIndex),

            10,

            (Int64)v*nCheShu);

    }

    //从登录号字符串折分单个登录号的个数,即册数

    public int GetCeShuFromDengLuHao(string strDengLuHao)

    {

        string[] aDengLuHao = strDengLuHao.Split(new char[] {','});

        for(int i=0;i<aDengLuHao.Length;i++)

        {

            string strOneDengLuHao = aDengLuHao[i];

            string strLeft = "";

            string strRight = "";

            int nPosition = strOneDengLuHao.IndexOf('-');

            if (nPosition > 0)  // 001-3

            {

                strLeft = strOneDengLuHao.Substring(0,nPosition);  // 001

                strRight = strOneDengLuHao.Substring(nPosition+1); // 3

            }

            else if (nPosition == 0)  // -1

            {

                strLeft = strOneDengLuHao.Substring(nPosition+1); // 1

            }

            else  // 001

            {

                strLeft = strOneDengLuHao; // 001

            }

            if (strRight == "")

                return 1;

            string strRightPartOfLeft = strLeft.Substring(strLeft.Length - strRight.Length);

            int nCount = 0;

            try

            {

                nCount = Convert.ToInt32(strRight) - Convert.ToInt32(strRightPartOfLeft);

            }

            catch  //忽略掉错误的字符串格式了

            {}

            return nCount;

         }

        return 0;    // 2007/7/6 xietao new add

    }

    //排序表格模块

    public void DoSortTable()

    {

    }

    public override void OnMiddle(object sender, BatchEventArgs e)

    {

        if (IsSort == false)

        {

            DoCommonTable();

        }

        else

        {

            DoSortTable();

        }

    }

    public override void OnEnd(object sender, BatchEventArgs e)

    {

        Int64 nHeJiZongJia = 0;

        int nHeJiCheShu = 0;

        for(int i=0;i<table.Count;i++)

        {

            nHeJiZongJia += (int)table.SearchValue(Convert.ToString(i),

                    9);    

        

            string cheShu = (string)table.SearchValue(Convert.ToString(i),

                        7);

            try

            {

                nHeJiCheShu += Convert.ToInt32(cheShu);

            }

            catch

            {}

        }

        if (StringUtil.IsInList("html",strOutFileName) == true)

        {

            

    

            string strOutputFileName = this.ProjectDir + "\\output.html";

            StreamWriter sw = new StreamWriter(strOutputFileName,

                        false,

                        Encoding.UTF8);

            sw.WriteLine("<html><head>");

            sw.WriteLine("<meta http-equiv='Content-Type' content=\"text/html; charset=utf-8\">");

            sw.WriteLine("<title></title>");

            sw.WriteLine("<link rel=\"stylesheet\" href=\"./style.css\" type=\"text/css\">");

            sw.WriteLine("</head><body>");

            sw.WriteLine("<h3>分类统计表</h3>");

            sw.WriteLine("<p>共计&nbsp;&nbsp;");

            sw.WriteLine("&nbsp;&nbsp;" + Convert.ToString(table.Count) + "&nbsp;种");

            sw.WriteLine("&nbsp;&nbsp;" + Convert.ToString(nHeJiCheShu) + "&nbsp;册");

            sw.WriteLine("&nbsp;&nbsp;" + Convert.ToString(nHeJiZongJia) + "&nbsp;元</p>");

            table.Sort("-1:a");  //按行标题降序

            Report    report = Report.BuildReport(table,

                    "序号,登录号,书名,著者,出版者,ISBN,出版版期,装订、开本页数,册数,单价,总价",

                    "&nbsp;",

                    true);    

            if (report == null)

            {

                MessageBox.Show("表格为空");

                return;

            }

            report[10].DataType = DataType.Price;

            report[0].Sum = false;

            report[1].Sum = false;

            report[2].Sum = false;

            report[3].Sum = false;

            report[4].Sum = false;

            report[5].Sum = false;

            report[6].Sum = false;

            report[7].Sum = false;

            report[9].Sum = false;

            report.SumLine = false;

            //MessageBox.Show("1");

            string strReportHtml = report.HtmlTable(table);        

            sw.WriteLine(strReportHtml);

            sw.WriteLine("</body></html>");

            sw.Close();

            HtmlForm htmlWindow = new HtmlForm();

            htmlWindow.Url = strOutputFileName;

            htmlWindow.ShowDialog();

        }

        

        if (StringUtil.IsInList("word",strOutFileName) == true)

        {

            table.Sort("-1:a");  //按行标题降序

            WordReport report = WordReport.BuildWordReport(table,

                    "序号,登录号,书名,著者,出版者,ISBN,出版版期,装订、开本页数,册数,单价,合计",

                    "&nbsp;",

                    true);

            if (report == null)

            {

                MessageBox.Show("表格为空");

                return;

            }

            report[10].DataType = DataType.Price;

        

            report[0].Sum = false;

            report[1].Sum = false;

            report[2].Sum = false;

            report[3].Sum = false;

            report[4].Sum = false;

            report[5].Sum = false;

            report[6].Sum = false;

            report[7].Sum = false;

            report[9].Sum = false;

            report.SumLine = false;

            WordTableFormat format = new WordTableFormat();

            format.TableStyle = "彩色型 2";

            report.OutputTable(table,

                "财产帐",

                format,

                strWordFileName);

            MessageBox.Show("输出结束,到'" + strWordFileName + "'");

    

        }

    }

}



发表时间: 2008-06-11 08:32:56
  • 精品 dp1batch技术支持 任延华 2005-11-07 10:17:06[点击:377060]
  • 普通文章 赔书统计加库位(入藏处)906$b 风中的断弦 2005-11-07 11:17:01 (ID:28) [点击:3216]
  • 普通文章 _ 风中的断弦 2005-11-07 11:39:47 (ID:29) [点击:2931]
  • 普通文章 “赔书统计”方案修改好了! 任延华 2005-11-07 13:16:25 (ID:30) [点击:2480]
  • 普通文章 统计方案 任延华 2005-11-15 16:19:41 (ID:34) [点击:2409]
  • 普通文章 图书种数、册数、资金分类统计 任延华 2005-11-15 16:20:59 (ID:35) [点击:2573]
  • 普通文章 批处理问题 风中的断弦 2005-11-15 17:07:03 (ID:36) [点击:2931]
  • 普通文章 回复:批处理问题 任延华 2005-11-15 17:28:40 (ID:37) [点击:2608]
  • 普通文章 怎么没有统计方案呀???? 张云佳 2005-11-15 22:09:00 (ID:38) [点击:2762]
  • 普通文章 回复: 怎么没有统计方案呀???? xietao 2005-11-16 17:54:43 (ID:41) [点击:1965]
  • 普通文章 我馆现在用的是DT1500,很多统计程序都没有用,搞了很久也找不到原因,希望站长能指点一下。 magic3694 2007-08-09 08:30:30 (ID:170) [点击:1905]
  • 普通文章 请与我电子邮件联系,以便细谈 孤舟蓑笠翁 2007-08-09 12:11:09 (ID:172) [点击:1856]
  • 普通文章 我馆现在用的是DT1500,很多统计程序都没有用,搞了很久也找不到原因,希望站长能指点一下。 magic3694 2007-08-09 09:34:41 (ID:171) [点击:2307]
  • 普通文章 非常感谢站长回复! magic3694 2007-08-13 10:21:02 (ID:174) [点击:2339]
  • 普通文章 请安装一下dp1batch程序,在它的基础上我们再来找解决方案 孤舟蓑笠翁 2007-08-13 12:48:00 (ID:175) [点击:2077]
  • 普通文章 非常感谢!程序我已安装好。 magic3694 2007-08-14 19:42:02 (ID:176) [点击:2298]
  • 普通文章 请导入新统计方案 孤舟蓑笠翁 2007-08-15 10:48:06 (ID:177) [点击:1785]
  • 普通文章 非常感谢! magic3694 2007-08-16 09:14:02 (ID:178) [点击:2188]
  • 普通文章 请调整防火墙设置或系统安全设置 孤舟蓑笠翁 2007-08-16 12:25:16 (ID:180) [点击:1824]
  • 普通文章 回复: 非常感谢! xietao 2007-08-16 16:33:45 (ID:182) [点击:1952]
  • 普通文章 问题已经解决 xietao 2007-08-16 18:05:04 (ID:183) [点击:1726]
  • 普通文章 _ magic3694 2007-08-17 10:01:51 (ID:184) [点击:2436]
  • 普通文章 请发来读者库、书目库和流通日志库的全部数据 孤舟蓑笠翁 2007-08-17 10:48:56 (ID:185) [点击:2005]
  • 普通文章 “读者入馆登记”方案报错已经解决;另增加了“流通综合统计”方案 xietao 2007-08-17 15:50:45 (ID:186) [点击:1840]
  • 普通文章 经调试,方案都可以用。谢谢! magic3694 2007-08-18 19:24:17 (ID:189) [点击:2285]
  • 普通文章 回复: 经调试,方案都可以用。谢谢! magic3694 2007-08-18 19:34:34 (ID:190) [点击:2414]
  • 普通文章 先回复一些内容 孤舟蓑笠翁 2007-08-19 16:02:44 (ID:191) [点击:1710]
  • 普通文章 回复: 先回复一些内容 magic3694 2007-08-21 09:25:18 (ID:192) [点击:2207]
  • 普通文章 dp1batch手册等 xietao 2007-08-21 11:21:24 (ID:193) [点击:2319]
  • 普通文章 dp1batch参考手册下载地址 xietao 2007-08-16 11:39:29 (ID:179) [点击:1866]
  • 普通文章 安装问题 缺乏 stdole.dll xietao 2007-08-16 16:06:15 (ID:181) [点击:1991]
  • 普通文章 欢迎大家使用dp2Catalog,体验新的环境 xietao 2007-08-17 16:02:06 (ID:187) [点击:1977]
  • 普通文章 新增“输出ISO2709”方案 xietao 2007-08-18 11:11:22 (ID:188) [点击:2006]
  • 普通文章 安装dp1batch没反应,请问是什么原因?谢谢! magic3694 2007-12-06 17:56:28 (ID:212) [点击:1706]
  • 普通文章 回复: 安装dp1batch没反应,请问是什么原因?谢谢! xietao 2007-12-07 09:46:22 (ID:213) [点击:1632]
  • 普通文章 咨询 magic3694 2007-12-09 13:35:10 (ID:214) [点击:1782]
  • 普通文章 回复: 咨询 xietao 2007-12-09 17:09:46 (ID:215) [点击:1682]
  • 普通文章 回复: 回复: 咨询 magic3694 2007-12-12 18:34:55 (ID:216) [点击:1530]
  • 普通文章 回复: 咨询 xietao 2007-12-13 11:26:25 (ID:217) [点击:1449]
  • 普通文章 回复: 回复: 咨询 magic3694 2007-12-13 22:53:28 (ID:218) [点击:1621]
  • 普通文章 回复: 咨询 xietao 2007-12-14 11:06:38 (ID:220) [点击:1500]
  • 普通文章 统计财产总账时出现如下图所示信息,统计终止. magic3694 2008-01-03 19:15:10 (ID:222) [点击:2840]
  • 普通文章 回复: 统计财产总账时出现如下图所示信息,统计终止. xietao 2008-01-04 15:31:14 (ID:223) [点击:1772]
  • 普通文章 财产总账统计问题 magic3694 2008-03-05 09:43:55 (ID:224) [点击:2201]
  • 普通文章 回复: 财产总账统计问题 xietao 2008-03-05 15:56:06 (ID:225) [点击:1691]
  • 普通文章 回复: 回复: 财产总账统计问题 magic3694 2008-03-10 14:45:45 (ID:226) [点击:2359]
  • 普通文章 回复: 回复: 回复: 财产总账统计问题 xietao 2008-03-11 11:15:10 (ID:230) [点击:1608]
  • 普通文章 所需要的财产总帐统计方案编制好了 xietao 2008-03-11 18:41:58 (ID:231) [点击:1501]
  • 普通文章 财产总帐 统计方案 进行了大幅度修改 xietao 2008-03-11 22:04:25 (ID:232) [点击:1871]
  • 普通文章 回复: 财产总帐 统计方案 进行了大幅度修改 magic3694 2008-03-13 19:52:46 (ID:233) [点击:2387]
  • 普通文章 如何贴图片? magic3694 2008-03-13 20:28:28 (ID:234) [点击:2298]
  • 普通文章 回复: 如何贴图片? xietao 2008-03-13 20:49:16 (ID:236) [点击:1378]
  • 普通文章 回复: 回复: 如何贴图片? magic3694 2008-03-15 19:30:02 (ID:237) [点击:2660]
  • 普通文章 回复: 如何贴图片? xietao 2008-03-16 13:52:11 (ID:238) [点击:1642]
  • 普通文章 统计产品“读者借阅排名次”问题 magic3694 2008-03-21 19:43:46 (ID:239) [点击:2504]
  • 普通文章 回复: 统计产品“读者借阅排名次”问题 xietao 2008-03-26 08:43:42 (ID:240) [点击:1655]
  • 普通文章 “流通综合统计”中的“按图书分类号”统计能不能自己定义分类号? (访客)hoho 2008-05-26 10:32:16 (ID:253) [点击:1452]
  • 普通文章 不能 孤舟蓑笠翁 2008-05-30 16:05:02 (ID:254) [点击:1684]
  • 普通文章 财产总账中如何定义自己需要的字段? magic3694 2008-06-11 08:32:56 (ID:258) [点击:2399]
  • 普通文章 回复: 财产总账中如何定义自己需要的字段? 孤舟蓑笠翁 2008-06-11 10:24:57 (ID:259) [点击:1534]
  • 普通文章 回复: 回复: 财产总账中如何定义自己需要的字段? magic3694 2008-06-12 08:54:46 (ID:260) [点击:2487]
  • 普通文章 能不能做个借书未还状况的统计表啊 会飞的猪 2008-12-18 16:22:14 (ID:364) [点击:2547]
  • 普通文章 回复: 能不能做个借书未还状况的统计表啊 xietao 2008-12-18 16:32:09 (ID:366) [点击:1646]
  • 普通文章 回复: 回复: 财产总帐 统计方案 进行了大幅度修改 xietao 2008-03-13 20:46:30 (ID:235) [点击:1625]
  •  

    在线用户
    访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客   访客访客
    当前栏目在线用户数 110, 总在线用户数 114