<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: zhangyu $Date: 2016-1-26 下午18:07:27 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:init-procedure> <a:model-query defaultWhereClause="t1.contract_id=${/parameter/@contract_id} and t1.cashflow_id=${/parameter/@cashflow_id} and t1.bp_id=${/parameter/@bp_id}" fetchAll="true" model="acp.ACP510.sdic_acp_invoice_query" rootPath="invoice_path"/> </a:init-procedure> <a:view> <script type="text/javascript"><![CDATA[ function sdic_acp_exit() { $('${/parameter/@winid}').close(); } function submitsuccess_handler(ds,res){ $('sdic_acp_invoice_ds').query(); } function foot_sum(data,name){ if(name=='product_name'){ return '<font color=red>' + '合计:' + '</font>'; } else if(name=='total_amount'){ return colum_caculateTotal(data, name); } else if(name=='tax_amount'){ return colum_caculateTotal(data, name); } } function colum_caculateTotal(data, name) { var total = 0; var length = data.length; var value = 0; for (var i = 0;i < length;i++) { if (Ext.isEmpty(data[i].get(name))) { value = 0; } else { value = data[i].get(name); } total = plus(total, value); } return '<font color=red>' + Leaf.formatMoney(total) + '</font>'; } function editor_func(record,name){ if(name=='total_amount'||name=='tax_amount'){ if(record.isNew){ return 'editor_nf'; } return ''; } } ]]></script> <a:dataSets> <a:dataSet id="invoice_kind_ds" lookupCode="ACR510_INVOICE_KIND"/> <a:dataSet id="sdic_acp_invoice_query_ds" autoCreate="true"> <a:fields> <a:field name="contract_id" defaultValue="${/parameter/@contract_id}"/> <a:field name="cashflow_id" defaultValue="${/parameter/@cashflow_id}"/> <a:field name="bp_id" defaultValue="${/parameter/@bp_id}"/> </a:fields> </a:dataSet> <a:dataSet id="sdic_acp_invoice_ds" autoQuery="true" fetchAll="true" model="acp.ACP510.sdic_acp_invoice_create" queryDataSet="sdic_acp_invoice_query_ds" selectable="true"> <a:fields> <a:field name="contract_id" defaultValue="${/model/invoice_path/record/@contract_id}"/> <a:field name="cashflow_id" defaultValue="${/model/invoice_path/record/@cashflow_id}"/> <a:field name="bp_id" defaultValue="${/model/invoice_path/record/@bp_id}"/> <a:field name="virtual_con_number" defaultValue="${/model/invoice_path/record/@virtual_con_number}"/> <a:field name="contract_number" defaultValue="${/model/invoice_path/record/@contract_number}"/> <a:field name="bp_name" defaultValue="${/model/invoice_path/record/@bp_name}"/> <a:field name="bp_tax_registry_num" defaultValue="${/model/invoice_path/record/@bp_tax_registry_num}"/> <a:field name="cf_item_n" defaultValue="${/model/invoice_path/record/@cf_item_n}"/> <a:field name="due_amount" defaultValue="${/model/invoice_path/record/@due_amount}"/> <a:field name="invoice_kind_n" displayField="code_value_name" options="invoice_kind_ds" required="true" returnField="invoice_kind" valueField="code_value"/> <a:field name="invoice_date" datatype="date" required="true"/> <a:field name="accounting_date" datatype="date" required="true"/> <a:field name="total_amount" required="true"/> <a:field name="tax_amount" required="true"/> <a:field name="invoice_number" required="true"/> <a:field name="product_name" required="true"/> </a:fields> <a:events> <a:event name="submitsuccess" handler="submitsuccess_handler"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:screenTitle/> <a:gridButton click="sdic_acp_exit" text="后退"/> <a:gridButton bind="sdic_acp_invoice_grid_id" type="add"/> <a:gridButton bind="sdic_acp_invoice_grid_id" type="save"/> <a:gridButton bind="sdic_acp_invoice_grid_id" type="delete"/> </a:screenTopToolbar> <a:form/> <a:grid id="sdic_acp_invoice_grid_id" bindTarget="sdic_acp_invoice_ds" marginHeight="180" marginWidth="30" navBar="true"> <a:columns> <a:column name="document_number" lock="true" prompt="单据编号" width="120"/> <a:column name="virtual_con_number" lock="true" prompt="合同号" width="120"/> <a:column name="contract_number" lock="true" prompt="合同编号" width="120"/> <a:column name="invoice_number" editor="editor_tf" lock="true" prompt="发票号" width="120"/> <a:column name="invoice_kind_n" editor="editor_cb" prompt="发票种类" width="100"/> <a:column name="invoice_date" editor="editor_dp" prompt="发票日期" renderer="Leaf.formatDate" width="100"/> <a:column name="accounting_date" editor="editor_dp" prompt="记账日期" renderer="Leaf.formatDate" width="100"/> <a:column name="bp_name" prompt="销方对象名称" width="150"/> <a:column name="bp_tax_registry_num" prompt="销方识别号" width="150"/> <a:column name="cf_item_n" prompt="应付项目" width="100"/> <a:column name="product_name" editor="editor_tf" footerRenderer="foot_sum" prompt="货物及应税劳务名称" width="100"/> <a:column name="due_amount" align="right" prompt="应付金额" renderer="Leaf.formatMoney" width="120"/> <a:column name="total_amount" align="right" editorFunction="editor_func" footerRenderer="foot_sum" prompt="本次进项发票金额" renderer="Leaf.formatMoney" width="140"/> <a:column name="tax_amount" align="right" editorFunction="editor_func" footerRenderer="foot_sum" prompt="税额" renderer="Leaf.formatMoney" width="100"/> </a:columns> <a:editors> <a:textField id="editor_tf"/> <a:comboBox id="editor_cb"/> <a:datePicker id="editor_dp"/> <a:numberField id="editor_nf"/> </a:editors> </a:grid> </a:screenBody> </a:view> </a:screen>