global class RepairReceiptBatch implements Database.Batchable<sObject> {
	//HWAG-BCM5AK;---2019-06-12-XHL---
	

	global RepairReceiptBatch() {
		
	}
	
	global Database.QueryLocator start(Database.BatchableContext BC) {
		
		return Database.getQueryLocator([select Id,Name,
						Repair__c,Maintenance_Contract__c,DeadlineLastMonthPeriodPaymentAmount__c,
						DeadlineLastMonthPeriodPaymentAmountFigu__c
					from Repair_receipt__c where PaymentAmountContrast__c = 0
					
		]);
		
		
	}

   	global void execute(Database.BatchableContext BC, List<Repair_receipt__c> repairReceiptss) {

   		for (Repair_receipt__c rr :repairReceiptss) {
   			//公式与文本不相等时，以公式值为准
   			if ( rr.DeadlineLastMonthPeriodPaymentAmount__c != rr.DeadlineLastMonthPeriodPaymentAmountFigu__c) {
   				rr.DeadlineLastMonthPeriodPaymentAmountFigu__c = rr.DeadlineLastMonthPeriodPaymentAmount__c;
   			}
   			
   		}
   		if ( repairReceiptss.size() >0 ) {
   			update repairReceiptss;
   		}
	
	}
	
	global void finish(Database.BatchableContext BC) {
		
	}
	
}