📄 table6.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.Forms;
namespace AnotherPDFLibTest
{
public class Table6 : AppendentTable
{
public Table6()
{
Name = "table6";
Title = "表6 现有仪器设备使用费预算明细表(单价5万元以上)";
SubTitle = "(申请市科委科研计划项目课题资助经费在20万元人民币及以下时,毋须填写本表)";
Remarks =
@"1、由国家财政资金购置或支付运行费的不得列入本表。
2、本表(8)列≤本表(7)列。
";
ColumnCaptions = new string[]
{
"设备名称",
"设备型号",
"隶属单位",
"购买单价\r\n(元/台件)",
"使用数量\r\n(台件)",
"使用设备原值",
"设备使用费",
"其中:申请本次资助额"
};
ColumnNumbers = new string[]
{
"(1)",
"(2)",
"(3)",
"(4)",
"(5)",
"(6)=(4)×\r\n(5)/1000",
"(7)",
"(8)"
};
FieldNames = new string[]{
"N:orderNum",
"T:deviceName",
"T:deviceModel",
"T:deviceOwner",
"N:unitPrice",
"N:quantity",
"N:totalPrice",
"N:usageCost",
"N:applyNum"
};
footNames = new string[]{
"",
"",
"",
"quantitySum",
"",
"costSum",
"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;
SetCalculateScript((NumerictBox)inputRow["totalPrice"], new FormCalc(@"
unitPrice * quantity / 1000"
));
NumerictBox usageCost = (NumerictBox)inputRow["usageCost"];
usageCost.Event.Validate = new FormCalc(@"
usageCost >= applyNum");
usageCost.Event.ValidateMessage = "设备使用费必须≥其中:申请本次资助额的金额。";
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["costSum"], new FormCalc(@"
Sum(table2[*].inputRow[*].usageCost)".Replace("table2", Name)
));
SetCalculateScript((NumerictBox)footRow["applySum"], new FormCalc(@"
Sum(table2[*].inputRow[*].applyNum)".Replace("table2", Name)
));
NumerictBox costSum = (NumerictBox)footRow["costSum"];
costSum.DataType = typeof(decimal);
costSum.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 + -