<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="app/app_login_check.js"><![CDATA[
            function bp_master_query() {
                var bpMaster_list_details;
                var bp_account_list_details;
                try {
                    var bpMaster_list_bm = $bm('app.prj_quotation.prj_quotation_query');
                    
                    var bpMaster_list_map = bpMaster_list_bm.queryAsMap({
                        project_id: $ctx.parameter.project_id
                    });
                    bpMaster_list_details = bpMaster_list_map.getChildren();
                   
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                } catch (e) {
                    $ctx.success = "true";
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
                //返回结果
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    prj_quotation_query_list: []
                };
                var prj_quotation_query_list = result.prj_quotation_query_list;
              
                    for (var i = 0;i < bpMaster_list_details.length;i++) {
                         var bpmaster_list_detail = bpMaster_list_details[i];
                        prj_quotation_query_list.push({
                            "project_id": bpmaster_list_detail.project_id,
                            "price_list": bpmaster_list_detail.price_list,
								  "price_list_n": bpmaster_list_detail.price_list_n,
								  "lease_times": Number(bpmaster_list_detail.lease_times),
								  "lease_times_n": bpmaster_list_detail.lease_times_n,
								  "annual_pay_times": bpmaster_list_detail.annual_pay_times,
								  
								  "notarial_fee_payable": bpmaster_list_detail.notarial_fee_payable,
								  "btb_interest_margin": Number(bpmaster_list_detail.btb_interest_margin),
								  "lease_item_price_agent": Number(bpmaster_list_detail.lease_item_price_agent),
								  "hd_user_col_n06": bpmaster_list_detail.hd_user_col_n06,
								  "btb_fee_after_tax": bpmaster_list_detail.btb_fee_after_tax,
								  "base_rate_type": bpmaster_list_detail.base_rate_type,
								  "base_rate": bpmaster_list_detail.base_rate,
								  
								  "lease_item_amount": Number(bpmaster_list_detail.lease_item_amount),
								  "margin_ratio": Number(bpmaster_list_detail.deposit_ratio),
								  "deposit": Number(bpmaster_list_detail.deposit),
								  "deposit_deduction": bpmaster_list_detail.deposit_deduction,
								  "hd_user_col_n14": bpmaster_list_detail.hd_user_col_n14,
								  "insurance_fee": Number(bpmaster_list_detail.insurance_fee),
								  "hd_user_col_n05": bpmaster_list_detail.hd_user_col_n05,
								  
								  "times_1": bpmaster_list_detail.times_1,
								  "principal_1": bpmaster_list_detail.principal_1,
								  "interest_1": bpmaster_list_detail.interest_1,
								  "discount_limit_1": bpmaster_list_detail.discount_limit_1,
								  "rental_1": bpmaster_list_detail.rental_1,
								  "product_id": bpmaster_list_detail.product_id,
								  "product_id_n": bpmaster_list_detail.product_id_n,
								  
								  "hd_user_col_v01": bpmaster_list_detail.hd_user_col_v01,
								  "down_payment_ratio": Number(bpmaster_list_detail.down_payment_ratio),
								  "other_fee": bpmaster_list_detail.other_fee,
								  "other_fee3": Number(bpmaster_list_detail.other_fee3),
								  "lease_charge_ratio": Number(bpmaster_list_detail.lease_charge_ratio),
								  "lease_charge": bpmaster_list_detail.lease_charge,
								  "btb_int_rate_implicit": Number(bpmaster_list_detail.int_rate_display)
								                           
                        });
                    }
                
              
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
                bp_master_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>