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
@isTest
public class LexQuoteSelectbottonControllerTest {
    static final String RC_BYOUIN = '病院';
    static final String RC_HANBAOITEN = '販売店';
    static final String RC_KEIYAKU = '契約';
    @isTest
    static void Test1(){
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
        hospital.RecordTypeId = recByoin.id;
        hospital.Site = 'テスト病院部門';
        hospital.Alias_Name2__c = 'テスト病院別名';
        insert hospital;
 
        RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
        Account sellerA = new Account(Name = '販売店');
        sellerA.RecordTypeId = recHanbaiten.id;
        sellerA.Hospital__c = hospital.id;
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '内貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        insert opp;
        Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
        Quote quote=new Quote();
        quote.QuoteName__c = 'テスト見積';
        quote.Dealer_Final_Price_Page__c = 100;
        quote.Quote_Adjust_Amount_Page__c = 10;
        quote.Quote_Expiration_Date__c = date.today();
        quote.Agency1__c = sellerA.id;
        quote.OCM_Agent1_Price_Page__c = 1243;
        quote.OpportunityId = opp.id;
        quote.Name ='テスト見積';
        quote.Pricebook2Id = pricebook.id;
        quote.Quote_No__c = 'textQutote01';
        insert quote;
        Quote quo = LexQuoteSelectbottonController.selectQuoteById(quote.Id);
    }
}