mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-10-31 00:45:35 -04:00 
			
		
		
		
	Beginning of transaction calculator framework & enh.
This commit is contained in:
		
							parent
							
								
									7ddff6778c
								
							
						
					
					
						commit
						dc7dd4d01f
					
				| @ -40,7 +40,7 @@ define("TIMEZONE", "America/New_York"); | ||||
| define("NONSHOP",0); | ||||
| 
 | ||||
| // How many transactions to you want shown
 | ||||
| define("NUMBER_OF_TRANSACTIONS", 11); | ||||
| define("NUMBER_OF_TRANSACTIONS", 50); | ||||
| 
 | ||||
| //constants
 | ||||
| define("PAGE_START_SHOP", "/start_shop.php"); | ||||
|  | ||||
| @ -21,8 +21,14 @@ form[name=FormEdit] select:focus { | ||||
|     color: green; | ||||
| } | ||||
| 
 | ||||
| /* | ||||
| input[value=Save]:focus, input[value=Close]:focus { | ||||
| 	background: green; | ||||
| } | ||||
| */ | ||||
| 
 | ||||
| /* distinguish deposits */ | ||||
| .deposit { | ||||
| .deposit, .deposit_calculator { | ||||
| 	background-color: #FFDB58; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -7,16 +7,47 @@ $(function() { | ||||
| 	// paid or not?
 | ||||
| 	$(".paid").click(function() { | ||||
| 		if ($(this).prop("checked")) {  | ||||
| 			//console.log("turn color on");
 | ||||
| 			$(this).closest("tr").css("background-color","#99CC33");   | ||||
| 		 | ||||
| 			$(this).closest("tr").css("background-color","#E6E7E6");   | ||||
| 	    	$.post("json/transaction.php",{ paid: 1, transaction_id: this.name } ); | ||||
| 	 	}  | ||||
| 	 	else {  | ||||
| 	  		//console.log("turn color off");
 | ||||
| 	  		 | ||||
| 	    	$(this).closest("tr").css("background-color","transparent");   | ||||
| 	    	$.post("json/transaction.php",{ paid: 0, transaction_id: this.name } ); | ||||
| 	  	}  | ||||
| 	}); | ||||
| 
 | ||||
| 	// Deposit Calculator
 | ||||
| 	if ( $(".paid").length ) {	 // any transactions?
 | ||||
| 		var deposit_length = $(".deposit").length; | ||||
| 		 | ||||
| 		if ( deposit_length && deposit_length == 1 ) { // one transaction - maybe can do 1 or more with a sort
 | ||||
| 
 | ||||
| 			$(".paid").each( function() { | ||||
| 				 | ||||
| 				if (this.value == 1) {  /* Calculate using only the transactions that have been checked  | ||||
| 													as paid before the deposit | ||||
| 												*/ | ||||
| 					var deposit_number = $(".deposit input").attr("name"); | ||||
| 					if ( this.name < deposit_number ) {  // use database at this point
 | ||||
| 						 | ||||
| 						// find out the Payment Type
 | ||||
| 						console.log(this.name) | ||||
| 					} | ||||
| 					 | ||||
| 				}  | ||||
| 			 | ||||
| 			}); | ||||
| 				 | ||||
| 		}  | ||||
| 		else if ( deposit_length && deposit_length > 1) { /* more than one transaction | ||||
| 																		  	  use a range of deposits closest to visible transactions | ||||
| 																		  */ | ||||
| 			//console.log("greater than one deposit");
 | ||||
| 			 | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	// editing a transaction
 | ||||
| 	if ( $("input[name='shop_id']").length ) { | ||||
| @ -32,6 +63,8 @@ $(function() { | ||||
| 		$("input[name='payment_type']").attr("tabindex",8); | ||||
| 		$("select[name='sold_to']").attr("tabindex",9); | ||||
| 		$("select[name='sold_by']").attr("tabindex",10); | ||||
| 		$("input[value='Save']").attr("tabindex",11); | ||||
| 		$("input[value='Close']").attr("tabindex",12);		 | ||||
| 		 | ||||
| 		// require that values be filled in a particular fashion
 | ||||
| 		$("#date").mask("0000-00-00"); | ||||
|  | ||||
| @ -39,7 +39,8 @@ INSERT INTO shop_user_roles ( | ||||
|   ("Personal",0,0,0,0),  | ||||
|   ("Volunteer",0,1,0,0),  | ||||
|   ("Greeter",0,0,1,0), | ||||
|   ("Staff",0,0,1,1); | ||||
|   ("Staff",0,0,1,1) | ||||
|   ("Student Volunteer",0,0,0,0); | ||||
| 
 | ||||
| -- Add some projects to projects | ||||
| 
 | ||||
|  | ||||
| @ -430,7 +430,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) { | ||||
|         <form method="post" name="FormView_<?php echo $row_Recordset1['transaction_id']; ?>" action="<?php echo $editFormAction; ?>"> | ||||
|           <tr bordercolor='#CCCCCC' <?php | ||||
|           	echo ((intval($row_Recordset1['transaction_id']) == intval($trans_id)) ? "bgcolor='#CCCC33'" :  ""); | ||||
|           	if ($row_Recordset1['paid'] == 1) { echo "bgcolor='#99CC33'"; }  | ||||
|           	if ($row_Recordset1['paid'] == 1) { echo "bgcolor='#E6E7E6'"; }  | ||||
|           	if ($row_Recordset1['transaction_type'] == "Deposit") { echo "class='deposit'"; } | ||||
|           ?> >
 | ||||
|           <td><?php echo $row_Recordset1['shop_id']; ?></td>
 | ||||
| @ -449,13 +449,13 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) { | ||||
| 	    </tr> | ||||
| 	    <?php  			 | ||||
|   			if ($row_Recordset1['transaction_type'] == "Deposit") { | ||||
| 				echo "<tr class='deposit'><td colspan='8'><div style='text-align:right;'>";  				 | ||||
|   				echo '<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_change">Change:' . " $$change_fund" . '</span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_credit">Credit Card:</span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_check">Check:</span>+ | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_cash">Cash:</span>= | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_sum">Sum:</span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_difference">Difference:</span>'; | ||||
| 				echo "<tr class='deposit_calculator'><td colspan='8'><div style='text-align:right;'>";  				 | ||||
|   				echo '<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_change">Change Fund:' . " $$change_fund" . '  <span></span></span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_credit">Credit Card:  <span></span></span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_check">Check:  <span></span></span>+ | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_cash">Cash:  <span></span></span>= | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_sum">Sum:  <span></span></span>| | ||||
|   						<span style="padding-left:10px; padding-right:10px;" id="' . $ti . '_difference">Difference:  <span></span></span>'; | ||||
|   				echo "</div></td></tr>"; | ||||
|   			} | ||||
|   		?>
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user