mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-11-04 01:15:35 -05:00 
			
		
		
		
	Closes #62.
* Provides contact search in transaction_log * future: may improve calendar search with PickMeUp?
This commit is contained in:
		
							parent
							
								
									46be9fa887
								
							
						
					
					
						commit
						305ebee833
					
				@ -725,6 +725,13 @@ function dateandtimein($date, $time){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Drop-Down lists
 | 
					// Drop-Down lists
 | 
				
			||||||
 | 
					function list_contacts_select_contact($form_name = "contact_id", $default_value = "")
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						echo "<select name={$form_name} class='yb_standard'>\n";
 | 
				
			||||||
 | 
						echo "<option value='everyone'>Everyone</option>\n";
 | 
				
			||||||
 | 
						list_contacts("none",$default_value);	
 | 
				
			||||||
 | 
						echo "</select>\n";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function list_contacts_edit_add($form_name = "contact_id", $default_value = "")
 | 
					function list_contacts_edit_add($form_name = "contact_id", $default_value = "")
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -10,9 +10,10 @@ $(function() {
 | 
				
			|||||||
										 // but all ajax needs to be synchronous in this program because of the use of an "ancient" mysql
 | 
															 // but all ajax needs to be synchronous in this program because of the use of an "ancient" mysql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$("[name='transaction_type']").attr("tabindex",1);
 | 
						$("[name='transaction_type']").attr("tabindex",1);
 | 
				
			||||||
	$("[name='transaction_type']").focus();
 | 
						$("[name='transaction_type']").focus().scrollTop();
 | 
				
			||||||
	$("input[value='Create Transaction']").attr("tabindex",2);
 | 
						$("input[value='Create Transaction']").attr("tabindex",2);
 | 
				
			||||||
	$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
 | 
						$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
 | 
				
			||||||
 | 
						$("[name='contact_id']").attr("tabindex",3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Add focus for easier tab browsing
 | 
						// Add focus for easier tab browsing
 | 
				
			||||||
	// use .paid parent and hover & classes
 | 
						// use .paid parent and hover & classes
 | 
				
			||||||
@ -183,7 +184,10 @@ $(function() {
 | 
				
			|||||||
			}		
 | 
								}		
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// contact search on main page
 | 
				
			||||||
 | 
						$("select[name='contact_id_search']").chosen();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// transaction slider - on reload
 | 
						// transaction slider - on reload
 | 
				
			||||||
	transaction_slider();	
 | 
						transaction_slider();	
 | 
				
			||||||
 | 
				
			|||||||
@ -78,6 +78,17 @@ if($_GET['trans_type']=='all_types'){
 | 
				
			|||||||
	$trans_type_state = 'all_types';
 | 
						$trans_type_state = 'all_types';
 | 
				
			||||||
}	
 | 
					}	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if($_GET['contact_id_search']=='everyone'){
 | 
				
			||||||
 | 
						$contact_id = '';
 | 
				
			||||||
 | 
						$contact_id_state = 'everyone';
 | 
				
			||||||
 | 
					} elseif(isset($_GET['contact_id_search'])) {
 | 
				
			||||||
 | 
						$contact_id = "AND contact_id = '" . $_GET['contact_id_search'] . "'";
 | 
				
			||||||
 | 
						$contact_id_state = $_GET['contact_id_search'];
 | 
				
			||||||
 | 
					} else {
 | 
				
			||||||
 | 
						$contact_id = '';
 | 
				
			||||||
 | 
						$contact_id_state = 'everyone';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//record_count (SQL or state)
 | 
					//record_count (SQL or state)
 | 
				
			||||||
if($_GET['record_count']>0){
 | 
					if($_GET['record_count']>0){
 | 
				
			||||||
	$record_count = $_GET['record_count'];
 | 
						$record_count = $_GET['record_count'];
 | 
				
			||||||
@ -88,6 +99,7 @@ if($_GET['record_count']>0){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// create a string to remember state
 | 
					// create a string to remember state
 | 
				
			||||||
$search_state_array = array(
 | 
					$search_state_array = array(
 | 
				
			||||||
 | 
													"contact_id_search" => $contact_id_state,
 | 
				
			||||||
								"trans_date" => $trans_date_state, 
 | 
													"trans_date" => $trans_date_state, 
 | 
				
			||||||
								"trans_type" => $trans_type_state, 
 | 
													"trans_type" => $trans_type_state, 
 | 
				
			||||||
								"shop_dayname" => $shop_dayname_state, 
 | 
													"shop_dayname" => $shop_dayname_state, 
 | 
				
			||||||
@ -120,7 +132,7 @@ LEFT(IF(show_startdate, CONCAT(' [',
 | 
				
			|||||||
FROM transaction_log
 | 
					FROM transaction_log
 | 
				
			||||||
LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
 | 
					LEFT JOIN contacts ON transaction_log.sold_to=contacts.contact_id
 | 
				
			||||||
LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
 | 
					LEFT JOIN transaction_types ON transaction_log.transaction_type=transaction_types.transaction_type_id
 | 
				
			||||||
WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} ORDER BY transaction_id DESC LIMIT  0, $record_count;";
 | 
					WHERE 1=1 {$trans_date} {$shop_dayname} {$trans_type} {$contact_id} ORDER BY transaction_id DESC LIMIT  0, $record_count;";
 | 
				
			||||||
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
 | 
					$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
 | 
				
			||||||
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 | 
					$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -318,9 +330,9 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ConfirmDelete") &&
 | 
				
			|||||||
	header(sprintf("Location: %s", PAGE_SALE_LOG . "?trans_id={$delete_trans_id}&" . $search_state ));   //$editFormAction
 | 
						header(sprintf("Location: %s", PAGE_SALE_LOG . "?trans_id={$delete_trans_id}&" . $search_state ));   //$editFormAction
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Change Date     isset($_POST["MM_update"]) =========================================================
 | 
					//Change Date  & Search   isset($_POST["MM_update"]) =========================================================
 | 
				
			||||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
					if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
				
			||||||
  $editFormAction = "?trans_date={$_POST['trans_date']}&trans_type={$_POST['trans_type']}&shop_dayname={$_POST['dayname']}&record_count={$_POST['record_count']}";
 | 
					  $editFormAction = "?trans_date={$_POST['trans_date']}&trans_type={$_POST['trans_type']}&shop_dayname={$_POST['dayname']}&record_count={$_POST['record_count']}&contact_id_search={$_POST['contact_id_search']}";
 | 
				
			||||||
  header(sprintf("Location: %s",$editFormAction ));   //$editFormAction
 | 
					  header(sprintf("Location: %s",$editFormAction ));   //$editFormAction
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -818,7 +830,10 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
 | 
				
			|||||||
          <option value="Sunday">Sunday</option>
 | 
					          <option value="Sunday">Sunday</option>
 | 
				
			||||||
          </select>
 | 
					          </select>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
         transaction type <?php list_transaction_types_withheader('trans_type', 'all_types'); ?> 
 | 
					         transaction type <?php list_transaction_types_withheader('trans_type', 'all_types'); ?> by
 | 
				
			||||||
 | 
					         
 | 
				
			||||||
 | 
					         <?php list_contacts_select_contact(contact_id_search, $_GET['contact_id_search']);?>
 | 
				
			||||||
 | 
					     
 | 
				
			||||||
		          
 | 
							          
 | 
				
			||||||
          <input type="submit" name="Submit" value="Submit" />
 | 
					          <input type="submit" name="Submit" value="Submit" />
 | 
				
			||||||
          <input type="hidden" name="MM_insert" value="ChangeDate" />
 | 
					          <input type="hidden" name="MM_insert" value="ChangeDate" />
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user