add payment recording
This commit is contained in:
		
							parent
							
								
									8f0193f55f
								
							
						
					
					
						commit
						49e089f0e5
					
				
					 1 changed files with 51 additions and 24 deletions
				
			
		|  | @ -90,9 +90,9 @@ public class receipt { | |||
|         	String content_headers = ""; | ||||
|          | ||||
|         	if (content_headers_raw.get("Full Name") != null) { | ||||
|             content_headers = content_headers_raw.get("Full Name"); | ||||
|           	content_headers = content_headers_raw.get("Full Name").toUpperCase(); | ||||
|         	} else if (content_headers_raw.get("Name") != null) { | ||||
|             content_headers = content_headers_raw.get("Name"); | ||||
|           	content_headers = content_headers_raw.get("Name").toUpperCase(); | ||||
|         	}; | ||||
|          | ||||
|         	while (content_headers_raw_headers.hasMoreElements()) { | ||||
|  | @ -138,4 +138,31 @@ public class receipt { | |||
| 		return(data.get("cart").toString()); | ||||
| 	}; | ||||
| 
 | ||||
| 	public static String payment(Dictionary<String, Float> details) { | ||||
| 		/* Add the payment data.  | ||||
| 		 *  | ||||
| 		 * Parameters:  | ||||
| 		 * 	(Dict) details: the payment details, including total, subtotal, and change | ||||
| 		 *  | ||||
| 		 * Returns: (String) the portion of the receipt | ||||
| 		*/ | ||||
| 
 | ||||
| 		// re-initialize the payment details | ||||
| 		data.put("payment", ""); | ||||
| 		 | ||||
| 		// Check for the details | ||||
| 		Enumeration<String> details_contents = details.keys();	 | ||||
| 
 | ||||
| 		while (details_contents.hasMoreElements()) { | ||||
| 			String details_content = details_contents.nextElement(); | ||||
| 			 | ||||
| 			data.put("payment", data.get("payment").concat("\n")); | ||||
| 			data.put("payment", data.get("payment").concat(String.join(": ", (details_content.contains("total")) ? details_content.toUpperCase() : details_content.substring(0, 1).toUpperCase() + details_content.substring(1), String.valueOf(details.get(details_content))))); | ||||
| 		}; | ||||
| 
 | ||||
| 		refresh(); | ||||
| 
 | ||||
| 		return(data.get("payment")); | ||||
| 	}; | ||||
|      | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue