⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table4.cs

📁 PDF文件格式解析库源代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.Forms;

namespace AnotherPDFLibTest
{
    public class Table4 : AppendentTable
    {
        public Table4()
        {
            Name = "table4";
            Title = "表4 业务费—材料费预算明细表";
            SubTitle = "(申请市科委科研计划项目课题资助经费在20万元人民币及以下时,毋须填写本表)";
            Remarks =
@"本表(5)列≤(4)列。
本表(4)列累计数=“上海市科研计划项目资助课题经费预算表”中“预算总额”列相关数字。
本表(5)列累计数=“上海市科研计划项目资助课题经费预算表”中“其中:申请本次资助额”列相关数字。
";

            ColumnCaptions = new string[]
            {
                "材料名称",
                "购置数量",
                "单价(元/单位数量)",
                "材料费用",
                "其中:申请本次资助额"
            };

            ColumnNumbers = new string[]
            {
                "(1)",
                "(2)",
                "(3)",
                "(4)=(2)×\r\n(3)/1000",
                "(5)"
            };

            FieldNames = new string[]{
                "N:orderNum",
                "T:materialName",
                "N:quantity",
                "N:unitPrice",
                "N:totalPrice",
                "N:applyNum"
            };

            footNames = new string[]{
                "quantitySum",
                "",
                "priceSum",
                "applySum"
            };
        }

        public override Table[] BuildTable()
        {
            string[][] columnHeaders = new string[][] { ColumnCaptions, ColumnNumbers };
            Table tablehead = CreateTableHeader(columnHeaders);
            tablehead.CalculateSize();
            if (tablehead.Width < TableWidth)
            {
                tablehead.SetWidth(TableWidth);
            }

            Table headRow = new Table(1, 2);
            headRow.Cells[0][0] = CreateLabel("序号");
            headRow.Cells[0][1] = tablehead;
            headRow.Name = "headRow";

            List<float> widths = new List<float>();
            widths.Add(headRow.ColumnWidths[0]);
            widths.AddRange(tablehead.ColumnWidths);

            float paddingLeft, paddingRight;
            Table inputRow = CreateInputRow(FieldNames, widths, out paddingLeft, out paddingRight);
            inputRow.Name = "inputRow";
            inputRow.Occurance.Inintial = InitialRows;
            SetCalculateScript((NumerictBox)inputRow["orderNum"], new JavaScript(@"
if(inputRow.index == 0){
    var tableIndex = 0;
    if(inputRow.parent != null){
	    tableIndex = inputRow.parent.parent.index;
    }
	this.rawValue=tableIndex * 10 + 1;
}else{
	this.rawValue=inputRow.all.item(inputRow.index-1).orderNum.rawValue+1;
}
".Replace("table2", Name)
                ));
            NumerictBox totalPrice = (NumerictBox)inputRow["totalPrice"];
            totalPrice.DataType = typeof(decimal);
            totalPrice.RadixAlign = 30;
            totalPrice.Event.Validate = new FormCalc(@"
totalPrice >= applyNum");
            totalPrice.Event.ValidateMessage = "总价必须≥其中:申请本次资助额的金额。";
            SetCalculateScript((NumerictBox)inputRow["totalPrice"], new FormCalc(@"
unitPrice * quantity / 1000"
                ));
            NumerictBox applyNum = (NumerictBox)inputRow["applyNum"];
            applyNum.DataType = typeof(decimal);
            applyNum.RadixAlign = 30;
            applyNum.InitialValue = "0";

            Table footRow = CreateFootRow(2, footNames, widths);
            footRow.Name = "footRow";
            SetCalculateScript((NumerictBox)footRow["quantitySum"], new FormCalc(@"
Sum(table2[*].inputRow[*].quantity)".Replace("table2", Name)
                ));
            SetCalculateScript((NumerictBox)footRow["priceSum"], new FormCalc(@"
Sum(table2[*].inputRow[*].totalPrice)".Replace("table2", Name)
                ));
            SetCalculateScript((NumerictBox)footRow["applySum"], new FormCalc(@"
Sum(table2[*].inputRow[*].applyNum)".Replace("table2", Name)
                ));
            NumerictBox priceSum = (NumerictBox)footRow["priceSum"];
            priceSum.DataType = typeof(decimal);
            priceSum.RadixAlign = 30;
            NumerictBox applySum = (NumerictBox)footRow["applySum"];
            applySum.DataType = typeof(decimal);
            applySum.RadixAlign = 30;
            headRow.Padding.Left = paddingLeft;
            footRow.Padding.Left = paddingLeft;
            headRow.Padding.Right = paddingRight;
            footRow.Padding.Right = paddingRight;
            return new Table[] { headRow, inputRow, footRow };
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -