📄 table3.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.Forms;
namespace AnotherPDFLibTest
{
public class Table3 : AppendentTable
{
public Table3()
{
Name = "table3";
Title = "表3 设备费—试制设备预算明细表";
SubTitle = "(申请市科委科研计划项目课题资助经费在20万元人民币及以下时,毋须填写本表)";
Remarks =
@"1、单价≥30万元的试制设备需提交单独的“大型设备申请表”和设备试制方案和成本分析。
2、本表(5)列≤本表(4)列。
本表(4)列累计数=“上海市科研计划项目资助课题经费预算表”中“预算总额”列相关数字。
本表(5)列累计数=“上海市科研计划项目资助课题经费预算表”中“其中:申请本次资助额”列相关数字。
";
ColumnCaptions = new string[]
{
"设备名称",
"单台价值\r\n(元/台件)",
"拟试制数量\r\n(台件)",
"总价",
"其中:申请本次\r\n资助额",
"试制理由和用途"
};
ColumnNumbers = new string[]
{
"(1)",
"(2)",
"(3)",
"(4)=(2)×\r\n(3)/1000",
"(5)",
"(6)"
};
FieldNames = new string[]{
"N:orderNum",
"T:deviceName",
"N:unitPrice",
"N:quantity",
"N:totalPrice",
"N:applyNum",
"T:usage"
};
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 + -