| | |
| | | private static String quoteNo = 'textQutote01'; |
| | | public static String trade = '内貿'; |
| | | public static String CurrencyIso = 'CNY'; |
| | | |
| | | public static String USDIso = 'USD'; |
| | | private static Boolean isUnitPrice = true; |
| | | private static Boolean isOfferAmount = true; |
| | | private static Boolean isTotalPrice = true; |
| | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = Date.today().addDays(5); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(5); |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | |
| | | SI_NewQuoteEntryController.QELine actList12 = new SI_NewQuoteEntryController.QELine(10,true,'aaa',Date.today(),'bbb',pE2.Id,'ddd','eee','fff','ggg','hhh','iii','jjj','kkk',10,1.1,2.2,3.3,4.0,5.5,6.6,'lll',7.7,8.8); |
| | | system.debug('xxxxxxxxxxxxxxxxxxxxxxxx++++++++++++++++++++++++'); |
| | | } |
| | | |
| | | |
| | | static testMethod void dataEntryTest3() { |
| | | Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin]; |
| | | User MacOwner = new User(Test_staff__c = true, Batch_User__c = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | system.runAs(MacOwner) { |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeAccountTrigger = true; |
| | | ControllerUtil.EscapeNFM001Trigger = true; |
| | | Oly_TriggerHandler.bypass('PowerBIBaseHandler'); |
| | | StaticParameter.EscapeSyncOpportunityTrigger = true; |
| | | StaticParameter.EscapeNFM007Trigger = true; |
| | | StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true; |
| | | Oly_TriggerHandler.bypass('AgencyOppUpdHandler'); |
| | | StaticParameter.EscapeSyncOpportunityTrigger = true; |
| | | StaticParameter.EscapeSyncProduct2Trigger = true; |
| | | Oly_TriggerHandler.bypass('PowerBIBaseHandler'); |
| | | |
| | | 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; |
| | | 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 = USDIso; |
| | | 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.Agency2__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Stock_Confrim_Date__c = Date.today(); |
| | | insert opp; |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Manual_Entry__c = false; |
| | | product1.Foreign_Trade_List_US_1__c = 100; |
| | | product1.Foreign_Trade_Cost_US_End_Date1__c = Date.today().addDays(5); |
| | | product1.Foreign_Trade_List_US_End_Date1__c = Date.today().addDays(5); |
| | | product1.Foreign_Trade_List_US_Date1__c = date.today(); |
| | | product1.Foreign_Trade_Cost_US_1__c = 200; |
| | | product1.Foreign_Trade_Cost_US_Date1__c = date.today(); |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | // product2.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = USDIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = USDIso; |
| | | //pE. |
| | | insert pE2; |
| | | |
| | | OpportunityLineItem oli = new OpportunityLineItem(); |
| | | //target.QuoteId = input.Id; |
| | | oli.Quantity = 1; |
| | | // target.TotalPrice = 100; |
| | | oli.UnitPrice = 10; |
| | | oli.PricebookEntryId = pE.Id; |
| | | oli.OpportunityId = opp.id; |
| | | oli.Cost__c = 100; |
| | | //oli.op |
| | | insert oli; |
| | | |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = quoteNo; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | quote.QuoteName__c = 'テスト見積'; |
| | | quote.Dealer_Final_Price__c = 100; |
| | | quote.Quote_Adjust_Calculate__c = 10; |
| | | quote.Quote_Adjust_Amount__c = 10; |
| | | quote.OCM_Agent1_Price__c = 10; |
| | | quote.Agent1_Agent2_Price__c = 10; |
| | | |
| | | insert quote; |
| | | |
| | | // セット品 |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | |
| | | System.Test.startTest(); |
| | | // 20211013 lt add 注释掉 |
| | | //SI_NewQuoteEntryController.QELine sqline = new SI_NewQuoteEntryController.QELine(2, true ,'String VenderName','String ProductSetName', pE.id, 'String Asset_Model', 'String StorageStatus', ' String ProductCode', 'String Id_c', 'String SFDA_Status_c', 'String Sales_Possibility_c', 'String Name_c', 'String BSS_Category_c', 2, 123, 21, 312, 123, 1.1, 1.1, '', 1.1,0); |
| | | |
| | | //##ページデバッグセクション 開始 |
| | | PageReference page = new PageReference('/apex/NewQuoteEntry'); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | SI_NewQuoteEntryController controller = new SI_NewQuoteEntryController(); |
| | | //Apexpages.currentPage().getParameters().put('id', quote.id); |
| | | controller.oppId = null; |
| | | controller.quoId = null; |
| | | controller.enableSales = false; |
| | | controller.init(); |
| | | controller.dataCheck(); |
| | | controller.select_index = 0; |
| | | controller.Product_text = product1.id; |
| | | controller.setProduct_text = ps1.id; |
| | | controller.setProductEntry(); |
| | | // controller.settingProduct2(); |
| | | controller.OppReflection(); |
| | | controller.activities[0].Asset_Model = 'test'; |
| | | controller.PriceStatusUpdate(); |
| | | controller.SalesId1 = sellerA.id; |
| | | controller.SalesId2 = sellerA.id; |
| | | controller.getSalesId1(); |
| | | controller.getSalesId2(); |
| | | controller.cancel(); |
| | | |
| | | Quote quoteAfterInsert = [SELECT OpportunityId, Pricebook2Id, Name, Quote_No__c, Unit_Price__c, Offer_Amount__c, TOTAL__c, |
| | | Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c, Quote_Comment__c, |
| | | QuoteName__c, Dealer_Final_Price__c, Quote_Adjust_Calculate__c, Quote_Adjust_Amount__c, |
| | | OCM_Agent1_Price__c, Agent1_Agent2_Price__c |
| | | FROM Quote WHERE Id = :quote.id]; |
| | | system.assertEquals( quote.OCM_Agent1_Price__c, quoteAfterInsert.OCM_Agent1_Price__c); |
| | | |
| | | controller.enableSales = false; |
| | | controller.opp.Agency1__c = null; |
| | | controller.quo.OCM_Agent1_Price__c = null; |
| | | controller.opp.Agency2__c = null; |
| | | controller.quo.Agent1_Agent2_Price__c = null; |
| | | controller.quo.QuoteName__c = 'aaa'; |
| | | controller.quo.Dealer_Final_Price_Page__c = 100; |
| | | controller.quo.Dealer_Final_Price__c = 100; |
| | | controller.qb.Quote_Adjust_Calculate = 100; |
| | | controller.quo.Quote_Adjust_Calculate__c = 100; |
| | | controller.quo.Quote_Adjust_Amount_Page__c = 10; |
| | | controller.quo.Quote_Adjust_Amount__c = 10; |
| | | controller.quo.Quote_Expiration_Date__c = date.today(); |
| | | controller.oppId = opp.id; |
| | | // controller.PricebookId = pricebook.id; |
| | | SI_NewQuoteEntryController.QELine act = new SI_NewQuoteEntryController.QELine(oli, 0); |
| | | |
| | | act.Asset_Model = '11111'; |
| | | |
| | | act.pageObject.Quantity__c = 10; |
| | | act.pageObject.UnitPrice_Page__c = 100; |
| | | act.pageObject.UnitPrice = 100; |
| | | act.pageObject.Subtotal__c = 1000; |
| | | act.pageObject.PricebookEntryId = pE2.id; |
| | | act.pageObject.Id__c = product2.id; |
| | | List<SI_NewQuoteEntryController.QELine> actList = new List<SI_NewQuoteEntryController.QELine>(); |
| | | actList.add(act); |
| | | controller.activities = actList; |
| | | controller.save(); |
| | | controller.dataEntry(); |
| | | controller.dataCheck(); |
| | | controller.QuoteDecision(); |
| | | controller.Print(); |
| | | |
| | | actList = new List<SI_NewQuoteEntryController.QELine>(); |
| | | actList.add(act); |
| | | controller.activities = actList; |
| | | controller.excel_text = 'OTV-SP1H-NA-12E\t1'; |
| | | controller.excelImport(); |
| | | Add_Report.getProduct2(product2.id); |
| | | |
| | | // QELine(QELine tmp, Integer i) 関数をテスト |
| | | actList = new List<SI_NewQuoteEntryController.QELine>(); |
| | | act.Asset_Model = null; |
| | | actList.add(act); |
| | | controller.activities = actList; |
| | | controller.excel_text = 'OTV-SP1H-NA-12E\t1'; |
| | | controller.excelImport(); |
| | | Add_Report.getProduct2(product2.id); |
| | | |
| | | // dataCheckDecide関数をチェック |
| | | controller.enableSales = true; |
| | | |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | |
| | | controller.QuoteDecision = false; |
| | | controller.QuoteDecision(); |
| | | controller.Print(); |
| | | //##ページデバッグセクション 終了 |
| | | |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | } |