需求是我需要新建一个页面,添加一个invoice summary按钮和时间筛选器,对应的六个字段,点击update的时候获取时间筛选的数据打印出来,
第一步需要判断好类型(这块吃了好大的亏,一定要需求分析的时候分析好类型)
然后就是创建form(这个就不写了,找个类似的copy一个就可以注意类型!!)
效果如下
代码逻辑我就直接写在了按钮下,为了方便(没有层次感我会试着写的有层次感)
void clicked()
{
DSA_TPwrAppExpTable _DSA_TPwrAppExpTable;
DSA_TPwrAppExpInvoice _DSA_TPwrAppExpInvoice;
DSA_TPwrAppInvoiceSummaryTmp _DSA_TPwrAppInvoiceSummaryTmp;
/*
发票数量(Invoice quantity)
发票类型(Invoice type)
总发票金额(Total invoice amount):取Invoice选项卡中的Total的汇总金额。
总税额(Total tax amount):取Overview中的Tax amount。
不含税总金额(Total amount without tax):总发票金额(Total invoice amount)减去总税额(Total tax amount)。
可抵扣税额(Deductible input VAT):取Invoice选项卡中的Deductible input VAT的汇总金额
*/
super();
delete_from DSA_TPwrAppInvoiceSummaryTmp ;
While select count(RecId),sum (Total),
sum(TaxAmount),sum(DeductibleInputVAT),InvoiceType
from _DSA_TPwrAppExpInvoice
group by InvoiceType
exists join _DSA_TPwrAppExpTable
where _DSA_TPwrAppExpTable.relationType == _DSA_TPwrAppExpInvoice.relationType &&
_DSA_TPwrAppExpTable.TransDate >= FromDate.dateValue() &&
_DSA_TPwrAppExpTable.TransDate <= ToDate.dateValue()
{
ttsBegin;
DSA_TPwrAppInvoiceSummaryTmp.clear();
DSA_TPwrAppInvoiceSummaryTmp.DSA_Invoicequantity = _DSA_TPwrAppExpInvoice.RecId;
DSA_TPwrAppInvoiceSummaryTmp.DSA_Invoicetype = _DSA_TPwrAppExpInvoice.InvoiceType;
DSA_TPwrAppInvoiceSummaryTmp.DSA_Totalinvoiceamount = _DSA_TPwrAppExpInvoice.Total;
DSA_TPwrAppInvoiceSummaryTmp.DSA_Totaltaxamount = _DSA_TPwrAppExpInvoice.TaxAmount;
DSA_TPwrAppInvoiceSummaryTmp.DSA_Totalamountwirhouttax = DSA_TPwrAppInvoiceSummaryTmp.DSA_Totalinvoiceamount-DSA_TPwrAppInvoiceSummaryTmp.DSA_Totaltaxamount;
DSA_TPwrAppInvoiceSummaryTmp.DSA_DeductibleinputVAT = _DSA_TPwrAppExpInvoice.DeductibleInputVAT;
DSA_TPwrAppInvoiceSummaryTmp.insert();
ttsCommit;
}
DSA_TPwrAppInvoiceSummaryTmp_ds.research();
}
注意1:赋值逻辑写完前后一定要加上 ttsbegin, ttscommit,
注意2: 插入之后一定要在循环外面research(刷新),刷新完上方是要删除记录delect_form
clear 清除 insert 插入 update 更新 research 刷新