<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: LR $Date: 2013-8-23 下午02:08:12 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true"> <a:init-procedure> <a:model-query defaultWhereClause="t1.document_category='CONTRACT'" fetchAll="true" model="basic.hls_document_type_for_lov" rootPath="prj505_con_document_type_path"/> <a:model-query defaultWhereClause="t1.project_id=${/parameter/@project_id}" fetchAll="true" model="cont.CON500.con_contract_lv_query" rootPath="prj505_con_contract_lov_path"/> <a:model-query defaultWhereClause="t1.enabled_flag = 'Y'" fetchAll="true" model="prj.PRJ505.con_billing_method" rootPath="billing_method_list"/> </a:init-procedure> <a:view> <a:link id="prj505_project_create_con_lease_item_lov_link" url="${/request/@context_path}/modules/prj/PRJ505/prj_project_create_con_lease_item_lov.lview"/> <a:link id="prj505_project_bp_lov_link" url="${/request/@context_path}/modules/prj/PRJ505/prj_project_bp_lov.lview"/> <a:link id="prj505_project_guarantor_lov_link" url="${/request/@context_path}/modules/prj/PRJ505/prj_project_guarantor_lov.lview"/> <a:link id="prj505_project_mortgage_lov_link" url="${/request/@context_path}/modules/prj/PRJ505/prj_project_create_con_mortgage_lov.lview"/> <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/> <a:link id="prj505_update_project_status_link" model="prj.PRJ501.prj_project_v" modelaction="execute"/> <script type="text/javascript"><![CDATA[ function prj505_project_create_con_close() { $('prj505_project_create_contract_window').close(); } function prj505_project_create_con_create() { var records = $('prj505_project_create_con_ds').getSelected(); $('prj505_project_create_con_ds').submitSelected(); } function prj505_project_update_project_status() { Leaf.showConfirm('${l:HLS.PROMPT}', '${l:PRJ505.CONTRACT_CREATED_CONFIRM}', function() { Leaf.request({ url: $('prj505_update_project_status_link').getUrl(), para: { project_id: '${/parameter/@project_id}' }, scope: this, success: function() { $('projectQueryScreen_mainDs_grid').clear(); prj505_project_create_con_close(); } }); }); } function prj505_project_create_con_ondLoad(ds) { $('prj505_project_bp_ds').query(); $('prj505_project_lease_item_ds').query(); $('prj505_project_guarantor_ds').query(); $('prj505_project_mortgage_ds').query(); var records = ds.getAll(); var record = $('projectQueryScreen_mainDs').getCurrentRecord(); for (var i = 0;i < records.length;i++) { records[i].set('contract_name', record.get('project_name'), true); records[i].set('contract_type','PRJCON'); records[i].set('contract_type_desc','项目类合同'); records[i].getField('contract_type_desc').setReadOnly(true); } set_create_con_create_btn(); } function prj505_project_guarantor_ondLoad(ds) { var records = $('prj505_project_create_con_ds').getAll(); var guarantorRecords = ds.getAll(); for (var i = 0;i < records.length;i++) { var guarantor = ''; for (var j = 0;j < guarantorRecords.length;j++) { if (guarantor == '') { guarantor = guarantorRecords[j].get('bp_name'); } else { guarantor = guarantor + ',' + guarantorRecords[j].get('bp_name'); } } records[i].set('guarantor', guarantor, true); } } function prj505_project_bp_ondLoad(ds) { var records = $('prj505_project_create_con_ds').getAll(); var leaseRecords = ds.getAll(); for (var i = 0;i < records.length;i++) { var bp_name = ''; for (var j = 0;j < leaseRecords.length;j++) { if (bp_name == '') { bp_name = leaseRecords[j].get('bp_name'); } else { bp_name = bp_name + ',' + leaseRecords[j].get('bp_name'); } } records[i].set('bp_name', bp_name, true); } } function prj505_project_lease_item_ondLoad(ds) { var records = $('prj505_project_create_con_ds').getAll(); var leaseRecords = ds.getAll(); for (var i = 0;i < records.length;i++) { var lease_item = ''; for (var j = 0;j < leaseRecords.length;j++) { if (leaseRecords[j].get('contract_seq') == records[i].get('contract_seq')) { if (lease_item == '') { lease_item = leaseRecords[j].get('full_name'); } else { lease_item = lease_item + ',' + leaseRecords[j].get('full_name'); } } } records[i].set('lease_item', lease_item, true); } } function prj505_project_mortgage_ondLoad(ds) { var records = $('prj505_project_create_con_ds').getAll(); var leaseRecords = ds.getAll(); for (var i = 0;i < records.length;i++) { var mortgage = ''; for (var j = 0;j < leaseRecords.length;j++) { if (leaseRecords[j].get('contract_seq') == records[i].get('contract_seq')) { if (mortgage == '') { mortgage = leaseRecords[j].get('mortgage_name'); } else { mortgage = mortgage + ',' + leaseRecords[j].get('mortgage_name'); } } } records[i].set('mortgage', mortgage, true); } } function prj505_project_create_con_grid_cellclick(grid, row, name, record) { if (!Leaf.isEmpty(record.get('contract_seq'))) { if (name == 'bp_name') { record.getField('bp_name').setLovUrl($('prj505_project_bp_lov_link').getUrl() + '?project_id=' + '${/parameter/@project_id}'); }else if (name == 'lease_item') { record.getField('lease_item').setLovUrl($('prj505_project_create_con_lease_item_lov_link').getUrl() + '?project_id=' + '${/parameter/@project_id}' + '&contract_seq=' + record.get('contract_seq')); } else if (name == 'guarantor') { record.getField('guarantor').setLovUrl($('prj505_project_guarantor_lov_link').getUrl() + '?project_id=' + '${/parameter/@project_id}'); }else if (name == 'mortgage') { record.getField('mortgage').setLovUrl($('prj505_project_mortgage_lov_link').getUrl() + '?project_id=' + '${/parameter/@project_id}' + '&contract_seq=' + record.get('contract_seq')); } } else { record.getField('lease_item').setLovUrl(''); } } function prj505_project_create_con_submitsuccess(ds, res) { $('prj505_project_create_con_grid').clear(); // $('prj505_con_contract_ds').query(); if (Leaf.isEmpty(res.result.record[0])) { var record = new Leaf.Record({ contract_id: res.result.record.contract_id, contract_number: res.result.record.contract_number, contract_name: res.result.record.contract_name, bp_name: res.result.record.bp_name }); $('prj505_con_contract_ds').create(record.data); Leaf.SideBar.show({ msg: res.result.record.contract_number, duration: 2000 }); } } function set_btn_style(id, dis_value) { Ext.get(id).setStyle({ display: dis_value }); } function set_created_con_ok_btn() { var records = $('prj505_con_contract_ds').getAll(); if (records.length == 0) { set_btn_style('prj505_created_con_ok_id', 'none'); } else { set_btn_style('prj505_created_con_ok_id', ''); } } function set_create_con_create_btn() { var pre_records = $('prj505_project_create_con_ds').getAll(); if (pre_records.length == 0) { set_btn_style('prj505_project_create_con_create_id', 'none'); } else { set_btn_style('prj505_project_create_con_create_id', ''); } } function on_prj505_tab_select(tab, index) { set_create_con_create_btn(); set_created_con_ok_btn(); } function prj505_project_create_con_grid_clear(){ $('prj505_project_create_con_grid').clear(); } function con_contract_ds_loadHanler(ds) { $('prj505_con_bp_ds').query(); } function prj505_con_bp_ondLoad(ds) { var records = $('prj505_con_contract_ds').getAll(); var leaseRecords = ds.getAll(); for (var i = 0;i < records.length;i++) { var bp_name = ''; for (var j = 0;j < leaseRecords.length;j++) { if (bp_name == '') { bp_name = leaseRecords[j].get('bp_name'); } else { bp_name = bp_name + ',' + leaseRecords[j].get('bp_name'); } } records[i].set('bp_name', bp_name, true); } } function con601_param_set_value(param) { param['document_category'] = 'CONTRACT'; param['function_code'] = 'CON301'; param['function_usage'] = 'QUERY'; param['maintain_type'] = 'READONLY'; param['url_title'] = '${l:CON301.CONTRACT_DETAIL}'; param['company_id'] = '${/session/@company_id}'; // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_update_link_id', 'prj505_con_contract_ds'); } function contract_link(id) { var current_record = $('prj505_con_contract_ds').findById(id); var record = current_record; var saveData = []; for (var k in record.data) { var item = record.data[k]; if (item && item.xtype == 'dataset') { delete record.data[k]; } } var param = record.data; param['document_id'] = current_record.get('contract_id'); con601_param_set_value(param); } function CON620_render_contract_dun_grid(value, record, name) { if (name == 'contract_number') { return '<a href="javascript:contract_link(' + record.id + ');">' + value + '</a>'; } } ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> <a:dataSets> <a:dataSet id="prj505_con_contract_ds" selectable="true" selectionModel="single"> <a:datas dataSource="/model/prj505_con_contract_lov_path"/> <a:fields> <a:field name="contract_number"/> <a:field name="contract_name"/> <a:field name="bp_name"/> </a:fields> <!-- <a:events> <a:event name="load" handler="con_contract_ds_loadHanler"/> </a:events> --> </a:dataSet> <a:dataSet id="prj505_con_document_type_ds"> <a:datas dataSource="/model/prj505_con_document_type_path"/> </a:dataSet> <a:dataSet id="prj505_billing_method_ds"> <a:datas dataSource="/model/billing_method_list"/> </a:dataSet> <a:dataSet id="prj505_query_ds"> <a:fields> <a:field name="project_id" defaultValue="${/parameter/@project_id}"/> </a:fields> </a:dataSet> <a:dataSet id="prj505_project_create_con_ds" autoPageSize="true" autoQuery="true" fetchAll="true" model="prj.PRJ505.prj_project_create_contract" queryDataSet="prj505_query_ds" selectable="true" selectionModel="single"> <a:fields> <a:field name="contract_seq" required="true"/> <a:field name="bp_name" autoComplete="true" lovGridHeight="350" lovHeight="500" lovService="prj.PRJ501.prj_project_bp_lov?project_id=${/parameter/@project_id}" lovWidth="500" required="true" title="HLS.TENANT_CODE"> <a:mapping> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_name" to="bp_name"/> <a:map from="contract_seq" to="bp_contract_seq"/> </a:mapping> </a:field> <a:field name="bp_name" lovHeight="500" lovWidth="500" prompt="承租人" title="HLS.TENANT_CODE"/> <a:field name="bp_contract_seq"/> <a:field name="lease_item" lovHeight="500" lovWidth="500" prompt="HLS.LEASE_ITEM" title="HLS.LEASE_ITEM"/> <a:field name="mortgage" lovHeight="500" lovWidth="500" prompt="HLS.MORTGAGE" title="HLS.MORTGAGE"/> <a:field name="guarantor" lovHeight="500" lovWidth="650" title="GUARANTOR"/> <a:field name="billing_method_desc" displayField="description" options="prj505_billing_method_ds" required="true" returnField="billing_method" valueField="billing_method"/> <a:field name="contract_type_desc" displayField="description" options="prj505_con_document_type_ds" required="true" returnField="contract_type" valueField="document_type"/> <a:field name="contract_type"/> <a:field name="contract_name" required="true"/> </a:fields> <!-- <a:events> <a:event name="load" handler="prj505_project_create_con_ondLoad"/> <a:event name="submitsuccess" handler="prj505_project_create_con_submitsuccess"/> </a:events> --> </a:dataSet> <a:dataSet id="prj505_project_bp_ds" autoQuery="true" fetchAll="true" model="prj.PRJ501.prj_project_bp_lov_2" queryDataSet="prj505_query_ds" selectable="true"> <a:fields> <a:field name="check_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/> </a:fields> <a:events> <a:event name="load" handler="prj505_project_bp_ondLoad"/> </a:events> </a:dataSet> <a:dataSet id="prj505_project_lease_item_ds" autoQuery="true" fetchAll="true" model="prj.PRJ505.prj_project_create_con_lease_item_lov" queryDataSet="prj505_query_ds" selectable="true"> <a:fields> <a:field name="check_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/> </a:fields> <a:events> <a:event name="load" handler="prj505_project_lease_item_ondLoad"/> </a:events> </a:dataSet> <a:dataSet id="prj505_project_mortgage_ds" autoQuery="true" fetchAll="true" model="prj.PRJ505.prj_project_create_con_mortgage_lov" queryDataSet="prj505_query_ds" selectable="true"> <a:fields> <a:field name="check_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/> </a:fields> <a:events> <a:event name="load" handler="prj505_project_mortgage_ondLoad"/> </a:events> </a:dataSet> <a:dataSet id="prj505_project_guarantor_ds" autoQuery="true" fetchAll="true" model="prj.PRJ505.prj_project_guarantor_lov" queryDataSet="prj505_query_ds" selectable="true"> <a:fields> <a:field name="check_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/> </a:fields> <!-- <a:events> <a:event name="load" handler="prj505_project_guarantor_ondLoad"/> </a:events> --> </a:dataSet> <!-- <a:dataSet id="prj505_con_bp_ds" autoQuery="true" fetchAll="true" model="prj.PRJ501.prj_project_bp_lov_2" queryDataSet="prj505_query_ds" selectable="true"> <a:events> <a:event name="load" handler="prj505_con_bp_ondLoad"/> </a:events> </a:dataSet> --> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:gridButton click="prj505_project_create_con_close" text="HLS.CLOSE"/> <!-- <a:gridButton click="prj505_project_create_con_grid_clear" text="HLS.CLEAR" type="clear"/> --> <!-- <a:gridButton id="prj505_project_create_con_create_id" click="prj505_project_create_con_create" text="HLS.CREATE"/> <a:gridButton id="prj505_created_con_ok_id" click="prj505_project_update_project_status" text="PRJ505.CONTRACT_CREATED"/> --> </a:screenTopToolbar> <a:form column="3" labelSeparator=" " labelWidth="100"> <a:textField name="project_number" bindTarget="projectQueryScreen_mainDs" prompt="HLS.PROJECT_NUMBER" readOnly="true"/> <a:textField name="project_name" bindTarget="projectQueryScreen_mainDs" prompt="HLS.PROJECT_NAME" readOnly="true" width="250"/> <!-- <a:textField name="approved_date" bindTarget="projectQueryScreen_mainDs" prompt="PRJ505.APPROVED_DATE" readOnly="true"/> --> </a:form> <a:tabPanel marginHeight="180" marginWidth="50"> <a:tabs> <!-- <a:tab prompt="PRJ505.CON_CREATE" width="100"> <a:grid id="prj505_project_create_con_grid" bindTarget="prj505_project_create_con_ds" marginHeight="230" marginWidth="55"> <a:columns> <a:column name="contract_seq" prompt="PRJ505.CONTRACT_SEQ" width="70"/> <a:column name="contract_name" editor="prj505_project_create_con_grid_tf" prompt="HLS.CONTRACT_NAME" width="180"/> <a:column name="contract_type_desc" prompt="HLS.CONTRACT_TYPE" width="120"/> <a:column name="billing_method_desc" editor="prj505_project_create_con_grid_cb" prompt="PRJ505.BILLING_METHOD" width="100"/> <a:column name="bp_name" editor="prj505_project_create_con_grid_lov" prompt="HLS.TENANT_CODE" width="100"/> <a:column name="lease_item" editor="prj505_project_create_con_grid_lov" prompt="HLS.LEASE_ITEM" width="160"/> <a:column name="mortgage" editor="prj505_project_create_con_grid_lov" prompt="HLS.MORTGAGE" width="160"/> <a:column name="guarantor" editor="prj505_project_create_con_grid_lov" prompt="PRJ305.GUARANTOR" width="160"/> <a:column name="version" prompt="PRJ505.VERSION" width="90"/> </a:columns> <a:editors> <a:textField id="prj505_project_create_con_grid_tf"/> <a:lov id="prj505_project_create_con_grid_lov"/> <a:comboBox id="prj505_project_create_con_grid_cb"/> </a:editors> <a:events> <a:event name="cellclick" handler="prj505_project_create_con_grid_cellclick"/> </a:events> </a:grid> </a:tab> --> <a:tab prompt="PRJ505.CREATED_CON" width="100"> <a:grid id="prj505_con_contract_grid" bindTarget="prj505_con_contract_ds" marginHeight="230" marginWidth="55"> <a:columns> <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" renderer="CON620_render_contract_dun_grid" width="150"/> <a:column name="contract_name" prompt="HLS.CONTRACT_NAME" width="300"/> <a:column name="bp_id_tenant_n" prompt="HLS.TENANT_CODE" width="250"/> </a:columns> </a:grid> </a:tab> </a:tabs> <!-- <a:events> <a:event name="select" handler="on_prj505_tab_select"/> </a:events> --> </a:tabPanel> </a:screenBody> </a:view> </a:screen>