binxie
2024-01-20 1d91be0be5220ce19ee64de5a5c9a8237b1c15b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>BeforeOPDPDFBtn</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>产品试用评价OPD</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/connection.js&quot;)};
{!REQUIRESCRIPT(&quot;/soap/ajax/51.0/apex.js&quot;)};
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)};
 
if (window.confirm(&apos;是否新建OPD报告书?\n[确定] =&gt; 新建OPD\n[取消] =&gt; 只生成 [产品试用评价]&apos;)) {
    try {
        sforce.connection.sessionId = &quot;{!GETSESSIONID()}&quot;;
        var accid = &apos;{!Opportunity.AccountId}&apos;;
        var recordType = &apos;OPD&apos;;
        var repOwnerId = &apos;{!$User.Id}&apos;;
        
        var pdfno = sforce.apex.execute(&quot;ControllerUtil&quot;, &quot;selectCommonSequence&quot;, {valueField: &apos;EvaluationPDF_NextValue__c&apos;, formatField: &apos;EvaluationPDF_Format__c&apos;});
        
        //新建OPD报告书
        // 20220913 ljh WLIG-CHMATN update start
        /*var rtn = sforce.apex.execute(&quot;Add_Report&quot;, &quot;addReportOPWithEvaluationPDF&quot;, 
            {repOwnerId: repOwnerId,
             reportId: null,
             dailyReportId: null,
             eventId: null,
             recordType: recordType,
             aId: accid,
             visitor1: null,
             visitor2: null,
             visitor3: null,
             visitor4: null,
             visitor5: null,
             opp1: &apos;{!Opportunity.Id}&apos;,
             opp2: null,
             opp3: null,
             opp4: null,
             opp5: null,
             reportDate: null,
             evaluationPDFNumber: pdfno
            }
        );*/
        var rtn = sforce.apex.execute(&quot;Add_Report&quot;, &quot;addReportOPWithEvaluationPDF&quot;, 
            {&quot;repOwnerId&quot;: &quot;{!$User.Id}&quot;,
             &quot;reportId&quot;: &quot;&quot;,
             &quot;dailyReportId&quot;: &quot;&quot;,
             &quot;eventId&quot;: &quot;&quot;,
             &quot;recordType&quot;: &quot;OPD&quot;,
             &quot;aId&quot;: accid,
             &quot;visitor1&quot;: &quot;&quot;,
             &quot;visitor2&quot;: &quot;&quot;,
             &quot;visitor3&quot;: &quot;&quot;,
             &quot;visitor4&quot;: &quot;&quot;,
             &quot;visitor5&quot;: &quot;&quot;,
             &quot;opp1&quot;: &quot;{!Opportunity.Id}&quot;,
             &quot;opp2&quot;: &quot;&quot;,
             &quot;opp3&quot;: &quot;&quot;,
             &quot;opp4&quot;: &quot;&quot;,
             &quot;opp5&quot;: &quot;&quot;,
             &quot;reportDate&quot;: &quot;&quot;,
             &quot;evaluationPDFNumber&quot;: pdfno
            }
        );
        // 20220913 ljh WLIG-CHMATN update end
        window.open(&apos;/apex/BeforeOPDPDF?oid=&apos; + &apos;{!Opportunity.Id}&apos; + &apos;&amp;pdfNo=&apos; + pdfno, &apos;BeforeOPDPDF&apos;);
    } catch(e) {
        alert(e); 
    }
} else {
    window.open(&apos;/apex/BeforeOPDPDF?oid=&apos; + &apos;{!Opportunity.Id}&apos;, &apos;BeforeOPDPDF&apos;);
}</url>
</WebLink>