prj_project_lease_item.lview 16.4 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-2-26 下午2:37:49  
    $Revision: 1.0  
    $Purpose: projectMaintainScreen
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        	
            
            function onRemove_leaseItemDs(ds, record, index) {
                displayHandle('leaseItem');
            }
            
            function onAdd_leaseItemDs(ds, record, index) {
                displayHandle('leaseItem');
            }
            
            function onLoad_leaseItemDs(ds) {
                displayDom('leaseItem_button');
                displayHandle('leaseItem');
            }
            
            function leaseItem_recordDisplayContral(record)
            {
                var name_list=[
						'full_name',
						'pattern',
						'specification',
						'serial_number',
						'price',
						'uom_name',
						'currency_name',
						'original_asset_value',
						'net_asset_value',
						'accumulated_depreciation',
						'vender_name',
						'fixed_assets_site',
						'installation_site',
						'manufacturing_date',
						'manufacturer_name',
						'description'
					];
                if(Ext.isEmpty(record.get('lease_item_id')))
                {
                    if(record.get('readonly_flag')=='Y')
                    {
                    	for (var i=0,j=name_list.length;i<j;i++)
                    	{
                    	    record.getField(name_list[i]).setReadOnly(false);
                    	}
                    	record.set('readonly_flag','',true);
                    }
                }
                else
                {
                    if(record.get('readonly_flag')!='Y')
                    {
                    	for (var i=0,j=name_list.length;i<j;i++)
                    	{
                    	    record.getField(name_list[i]).setReadOnly(true);
                    	}
                    	record.set('readonly_flag','Y',true);
                    }
                }
            }
            
            var leaseItem_oldValueObject={
            	short_name:null
            }
            
            function leaseItem_recoverValue(record,name,value,oldValue)
            {
                if(leaseItem_oldValueObject[name]==null){
                  	leaseItem_oldValueObject[name] = value;
                  	(function(){
                    	record.set(name,oldValue); 
                    	leaseItem_oldValueObject[name] = null;
                  	}).defer(10);
                }
                Leaf.showMessage('${l:HLS.PROMPT}', '不能修改选择出来的值,请删除后自由填写或重新选择');
            }
            
            function onUpdate_leaseItemDs(ds, record, name, value, oldValue)
            {
                if(name=='short_name')
                {
                    if(!Ext.isEmpty(record.get('lease_item_id')))
                    {
                        if(Ext.isEmpty(value))
                        {
                            record.set('lease_item_id','');
                        }
                        else
                        {
                            if(value!=record.get('short_name_backup'))
                            {
                                leaseItem_recoverValue(record,name,value,oldValue);
                            }
                        }
                    }
                    else
	                {
	                    Leaf.request({
	                        url: $('bmLink_ifLeaseItemExist').getUrl(),
	                        para: {
	                            short_name: value
	                        },
	                        success: function(res) {
	                            if (res['result']['if_leaseItem_exist'] == 'Y') {
	                                Leaf.showMessage('${l:HLS.PROMPT}', '${l:PRJ501.LEASE_ITEM_EXIST}');
	                            }
	                        },
	                        scope: this
	                    });
	                }
                }
                else if(name=='lease_item_id')
                {
                	leaseItem_recordDisplayContral(record);
                }
                
            }
            
            function onIndexChange_leaseItemDs(ds,record)
            {
                if ('${/parameter/@maintain_type}' == 'READONLY') {
                	record_displayControl(ds,record);
                }
                else
                {
                    leaseItem_recordDisplayContral(record);
                }
            }
            
            function validate_leaseItemDs(record,name,value)
            {
                if(name=='short_name')
                {
                    if(!Ext.isEmpty(record.get('lease_item_id'))&&record.get('short_name_backup')!=value)
                    {
                        return '不能修改选出来的租赁物';
                    }
                    return true;
                }
                return true;
                
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="leaseItemDs" autoQuery="true" bindName="lease_item_info" bindTarget="basicInfoDs" fetchAll="true" model="prj.PRJ501.prj_project_lease_item" queryUrl="${/request/@context_path}/autocrud/prj.PRJ501.prj_project_lease_item/query?project_id=${/parameter/@project_id}" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="short_name" fetchRemote="false" lovGridHeight="350" lovHeight="500" lovService="basic.hls_lease_item_v_for_lov" lovWidth="500" required="true" title="HLS.LEASE_ITEM">
                        <a:mapping>
                            <a:map from="lease_item_id" to="lease_item_id"/>
                            <a:map from="full_name" to="full_name"/>
                            <a:map from="pattern" to="pattern"/>
                            <a:map from="specification" to="specification"/>
                            <a:map from="serial_number" to="serial_number"/>
                            <a:map from="uom" to="uom"/>
                            <a:map from="uom_name" to="uom_name"/>
                            <a:map from="currency" to="currency"/>
                            <a:map from="currency_name" to="currency_name"/>
                            <a:map from="price" to="price"/>
                            <a:map from="original_asset_value" to="original_asset_value"/>
                            <a:map from="net_asset_value" to="net_asset_value"/>
                            <a:map from="manufacturer_id" to="manufacturer_id"/>
                            <a:map from="manufacturer_name" to="manufacturer_name"/>
                            <a:map from="manufacturing_date" to="manufacturing_date"/>
                            <a:map from="vender_id" to="vender_id"/>
                            <a:map from="vender_name" to="vender_name"/>
                            <a:map from="detention" to="detention"/>
                            <a:map from="installation_site" to="installation_site"/>
                            <a:map from="fixed_assets_site" to="fixed_assets_site"/>
                            <a:map from="accumulated_depreciation" to="accumulated_depreciation"/>
                            <a:map from="short_name" to="short_name_backup"/>
                            <a:map from="short_name" to="short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="vender_name" fetchRemote="false" lovGridHeight="350" lovHeight="500" lovService="prj.PRJ501.hls_bp_master_prj_v_lov?bp_category=VENDER" lovWidth="500" required="true" title="供应商">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_class" to="bp_class"/>
                            <a:map from="bp_class_desc" to="bp_class_desc"/>
                            <a:map from="business_license_num" to="business_license_num"/>
                            <a:map from="founded_date" to="founded_date"/>
                            <a:map from="country" to="country"/>
                            <a:map from="country_name" to="country_name"/>
                            <a:map from="province" to="province"/>
                            <a:map from="province_name" to="province_name"/>
                            <a:map from="city" to="city"/>
                            <a:map from="city_name" to="city_name"/>
                            <a:map from="district" to="district"/>
                            <a:map from="district_name" to="district_name"/>
                            <a:map from="street" to="street"/>
                            <a:map from="address" to="address"/>
                            <a:map from="zipcode" to="zipcode"/>
                            <a:map from="registered_place" to="registered_place"/>
                            <a:map from="registered_capital" to="registered_capital"/>
                            <a:map from="currency" to="currency"/>
                            <a:map from="currency_name" to="currency_name"/>
                            <a:map from="legal_form_desc" to="legal_form_desc"/>
                            <a:map from="industry" to="industry"/>
                            <a:map from="corporate_code" to="corporate_code"/>
                            <a:map from="organization_code" to="organization_code"/>
                            <a:map from="tax_registry_num" to="tax_registry_num"/>
                            <a:map from="last_name" to="last_name"/>
                            <a:map from="middle_name" to="middle_name"/>
                            <a:map from="first_name" to="first_name"/>
                            <a:map from="name_at_birth" to="name_at_birth"/>
                            <a:map from="gender" to="gender"/>
                            <a:map from="gender_desc" to="gender_desc"/>
                            <a:map from="nationality" to="nationality"/>
                            <a:map from="date_of_birth" to="date_of_birth"/>
                            <a:map from="age" to="age"/>
                            <a:map from="place_of_birth" to="place_of_birth"/>
                            <a:map from="id_type" to="id_type"/>
                            <a:map from="id_type_desc" to="id_type_desc"/>
                            <a:map from="id_card_no" to="id_card_no"/>
                            <a:map from="academic_background" to="academic_background"/>
                            <a:map from="academic_background_desc" to="academic_background_desc"/>
                            <a:map from="marital_status" to="marital_status"/>
                            <a:map from="marital_status_desc" to="marital_status_desc"/>
                            <a:map from="number_of_children" to="number_of_children"/>
                            <a:map from="annual_income" to="annual_income"/>
                            <a:map from="contact_person" to="contact_person"/>
                            <a:map from="position" to="position"/>
                            <a:map from="phone" to="phone"/>
                            <a:map from="phone_extra" to="phone_extra"/>
                            <a:map from="fax" to="fax"/>
                            <a:map from="cell_phone" to="cell_phone"/>
                            <a:map from="email" to="email"/>
                            <a:map from="contact_person_2" to="contact_person_2"/>
                            <a:map from="position_2" to="position_2"/>
                            <a:map from="phone_2" to="phone_2"/>
                            <a:map from="phone_extra_2" to="phone_extra_2"/>
                            <a:map from="fax_2" to="fax_2"/>
                            <a:map from="cell_phone_2" to="cell_phone_2"/>
                            <a:map from="email_2" to="email_2"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_seq" defaultValue="1" required="true"/>
                    <a:field name="currency_name" displayField="currency_name" options="currencyDs" returnField="currency" valueField="currency_code"/>
                    <a:field name="uom_name" lovGridHeight="300" lovHeight="450" lovService="basic.fnd_uom_codes_vl_for_lov" lovWidth="600" title="HLS.UOM">
                        <a:mapping>
                            <a:map from="description_text" to="uom_name"/>
                            <a:map from="uom_code" to="uom"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="indexchange" handler="onIndexChange_leaseItemDs"/>
                    <a:event name="update" handler="onUpdate_leaseItemDs"/>
                    <a:event name="add" handler="onAdd_leaseItemDs"/>
                    <a:event name="remove" handler="onRemove_leaseItemDs"/>
                    <a:event name="load" handler="onLoad_leaseItemDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:grid id="grid_leaseItemDs" bindTarget="leaseItemDs" height="240" marginWidth="30">
            <a:columns>
                <a:column name="short_name"/>
                <a:column name="full_name" width="200"/>
                <a:column name="pattern"/>
                <a:column name="price"/>
                <a:column name="contract_seq"/>
                <a:column name="vender_name"/>
                <a:column name="manufacturer_name"/>
            </a:columns>
        </a:grid>
        <a:switch test="/parameter/@maintain_type">
            <a:case value="READONLY"><![CDATA[
			                ]]></a:case>
            <a:case value="*">
                <div id="leaseItem_button" class="hide_dom">
                    <script type="text/javascript"><![CDATA[
	                		function leaseItemDelete() {
				                $('grid_leaseItemDs').remove();
				            }
				            
				            function leaseItemAdd() {
				                $('grid_leaseItemDs').showEditorByRecord($('leaseItemDs').create());
				            }
	                	]]></script>
                    <a:hBox>
                        <a:button click="leaseItemAdd" text="HLS.NEW"/>
                        <a:button click="leaseItemDelete" text="HLS.REMOVE"/>
                    </a:hBox>
                </div>
            </a:case>
        </a:switch>
        <div id="leaseItemInfo" class="hide_dom">
            <a:form column="4" labelWidth="120" marginWidth="30" title=" ">
                <a:lov name="short_name" bindTarget="leaseItemDs"/>
                <a:textField name="full_name" bindTarget="leaseItemDs"/>
                <a:numberField name="contract_seq" allowDecimals="false" bindTarget="leaseItemDs"/>
                <a:textField name="pattern" bindTarget="leaseItemDs"/>
                <a:textField name="specification" bindTarget="leaseItemDs"/>
                <a:textField name="serial_number" bindTarget="leaseItemDs"/>
                <a:numberField name="price" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="leaseItemDs" decimalPrecision="2"/>
                <a:lov name="uom_name" bindTarget="leaseItemDs"/>
                <a:numberField name="quantity" bindTarget="leaseItemDs"/>
                <a:comboBox name="currency_name" bindTarget="leaseItemDs"/>
                <a:numberField name="original_asset_value" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="leaseItemDs" decimalPrecision="2"/>
                <a:numberField name="net_asset_value" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="leaseItemDs" decimalPrecision="2"/>
                <a:numberField name="accumulated_depreciation" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="leaseItemDs" decimalPrecision="2"/>
                <a:textField name="vender_name" bindTarget="leaseItemDs"/>
                <a:textField name="fixed_assets_site" bindTarget="leaseItemDs"/>
                <a:textField name="installation_site" bindTarget="leaseItemDs"/>
                <a:numberField name="manufacturing_date" allowDecimals="false" allowNegative="false" bindTarget="leaseItemDs"/>
                <a:textField name="manufacturer_name" bindTarget="leaseItemDs"/>
                <a:textField name="description" bindTarget="leaseItemDs"/>
            </a:form>
        </div>
    </a:view>
</a:screen>