| 
						
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -1,5 +1,6 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				package info.bukova.isspst.reporting;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import com.mysql.jdbc.StringUtils;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.data.Address;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.data.AuthItem;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.data.Order;
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -8,16 +9,14 @@ import info.bukova.isspst.data.User;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.data.UserSettingsData;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.services.requirement.TripRequirementService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.services.settings.GlobalSettingsService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.services.tripbill.TripBillApprovalService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.services.users.UserService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.storage.FileStorage;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.util.HashMap;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.util.Map;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import com.mysql.jdbc.StringUtils;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				public class ParamFiller {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Autowired
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -30,6 +29,8 @@ public class ParamFiller {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private TripRequirementService tripReqService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Autowired
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private GlobalSettingsService settingService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Autowired
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private TripBillApprovalService tripBillApprovalService;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public void fill() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -57,7 +58,13 @@ public class ParamFiller {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							TripBill tb = (TripBill)definition.getDataSet().get(0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							tripReqService.loadAuthItems(tb.getRequirement());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							AuthItem lastButOneAuth = tb.getRequirement().getAuthorization().get(0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (tb.getApproval() != null) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								tripBillApprovalService.loadAuthItems(tb.getApproval());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (tb.getApproval() != null && tb.getApproval().getAuthorization() != null && !tb.getApproval().getAuthorization().isEmpty()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								AuthItem lastButOneAuth = tb.getApproval().getAuthorization().get(0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								User lastButOneUser = lastButOneAuth.getApprover();
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -67,8 +74,7 @@ public class ParamFiller {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							AuthItem lastAuth = tb.getRequirement().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								User u = lastAuth.getApprover();
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -78,6 +84,7 @@ public class ParamFiller {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if ((definition.getDataSet().get(0) instanceof Order)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								&& definition.getReport().isSingleRecord()) {
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |