<?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 project_build_query() {
                var company_list_details;
                
                try {
                   
                     var bp_class_bm1= $bm('app.workflow.bill_status_query');
                    var bp_class_list_map1 = bp_class_bm1.queryAsMap({
                        pagesize: $ctx.parameter.pagesize,
                        searchInput: $ctx.parameter.searchInput,
                        user_id: $ctx.parameter.user_id,
                        offsize: $ctx.parameter.offsize
                    });
                    company_list_details = bp_class_list_map1.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,
                    bill_status_list:[]
                };
               
                
                
                var bill_status_list = result.bill_status_list;
                if (company_list_details) {
                    for (var i = 0;i < company_list_details.length;i++) {
                        var bp_class_list_detail1 = company_list_details[i];
                        bill_status_list.push({
                            "instance_id": bp_class_list_detail1.instance_id,
                            "submitted_by_name": bp_class_list_detail1.submitted_by_name,
                            "user_name": bp_class_list_detail1.user_name,
                            "workflow_desc": bp_class_list_detail1.workflow_desc,
                            "instance_status_desc": bp_class_list_detail1.instance_status_desc,
                            "document_info": bp_class_list_detail1.document_info,
                            "last_approve_date": bp_class_list_detail1.last_approve_date,
                            "approve_user_name": bp_class_list_detail1.approve_user_name
                        });
                    }
                }
                
               
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                project_build_query();
            }   
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>