<?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.financing_due.financing_query_detail');
                    
                    var bpMaster_list_map = bpMaster_list_bm.queryAsMap({
                        calc_session_id: $ctx.parameter.calc_session_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,
                    quotation_list: []
                };
                var quotation_list = result.quotation_list;
               if (bpMaster_list_details) {
                    for (var i = 0;i < bpMaster_list_details.length;i++) {
                         var bp_class_list_detail2 = bpMaster_list_details[i];
                        quotation_list.push({
                         
                         "outstanding_rental_tax_incld": bp_class_list_detail2.outstanding_rental_tax_incld,
                         "due_date": bp_class_list_detail2.due_date,
                            "down_payment": bp_class_list_detail2.down_payment,
                            "irr": Number(bp_class_list_detail2.irr),
                            "lease_charge": bp_class_list_detail2.lease_charge,
                            "deposit": bp_class_list_detail2.deposit,
                            "lease_item_amount": bp_class_list_detail2.lease_item_amount,
                            "hd_user_col_n06": bp_class_list_detail2.hd_user_col_n06,
                            "financing_cost": bp_class_list_detail2.financing_cost,
                            
                            "times": bp_class_list_detail2.times,
                            "principal": bp_class_list_detail2.principal,
                            "interest": bp_class_list_detail2.interest,
                            "discount_limit_1": bp_class_list_detail2.discount_limit_1,
                            "rental": bp_class_list_detail2.rental
                           
                        });
                    }
               }
                
              
                $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>