| Quintiq file version 2.0 | 
| #parent: PanelOperation/ButtonSalesImport | 
| Response OnClick () id:Response_PanelOperation_ButtonSalesImport_OnClick | 
| { | 
|   #keys: '[415136.0.1193322030]' | 
|   CanBindMultiple: false | 
|   DefinitionID: 'Responsedef_WebButton_OnClick' | 
|   Precondition: | 
|   [* | 
|     return not isnull( MacroPlan ); | 
|   *] | 
|   QuillAction | 
|   { | 
|     Body: | 
|     [* | 
|       try { | 
|         uploadJsonString := Application.GetFile(); | 
|         if ( uploadJsonString <> "" ) { | 
|           uploadJson := JSON::Parse( uploadJsonString ); | 
|           Archive::VerifyTheFileName( uploadJson ); | 
|                  | 
|           fileName := uploadJson.Get( "name" ).GetString(); | 
|           base64String := uploadJson.Get( "data" ).GetString(); | 
|                | 
|           webFileBinaryData := BinaryData::FromBase64EncodedString( base64String ).AsBinaryValue(); | 
|            | 
|           source := FinancialSalesSource::Upload( MacroPlan, webFileBinaryData, fileName ); | 
|           source.ReadStructure(); | 
|           //如果存在计划开始后的日期数据需要点击确认 | 
|           if( not source.IsExistFutureMonthData() or  | 
|               ( source.IsExistFutureMonthData() and WebMessageBox::Question( this, Translations::MP_FinancialProductionReport_Question(), 'Yes|No' ) = 0 ) ){ | 
|              source.AfterImport(); | 
|              FinancialSalesSource::InitiateSearch( MacroPlan ); | 
|           } | 
|            | 
|           WebMessageBox::Success( Translations::A_VWED_Success() ); | 
|           traverse( MacroPlan, FinancialSalesSource, psource, psource.IsImport() and psource <> source ){ | 
|             psource.Delete(); | 
|           } | 
|         } | 
|       } onerror { | 
|         WebMessageBox::Error( e.GeneralInformation() ); | 
|       } | 
|     *] | 
|     GroupServerCalls: false | 
|   } | 
| } |