"._t("_affiliate_system_was_disabled").")"; } if ( !($logged['aff'] = member_auth( 2, false)) ) $logged['admin'] = member_auth( 1 ); $AFF = $_COOKIE['affID'] > 0 ? $_COOKIE['affID'] : ( $_GET['affID'] > 0 ? $_GET['affID'] : $_POST['affID'] ); if ( !strstr($AFF, "@") ) { $affID = (int)$AFF; $aff_arr = db_arr("SELECT `Percent` FROM `aff` WHERE `ID` = $affID"); } else { $AFF = process_db_input($AFF); $aff_arr = db_arr("SELECT `ID`, `Percent` FROM `aff` WHERE `email` = '$AFF'"); $affID = (int)$aff_arr['ID']; } $percent = (float)$aff_arr['Percent'] / 100.0; $tr = array(); $tr_query = ""; $order_num_disabled = 'disabled="disabled"'; $last_disabled = 'disabled="disabled"'; $date_disabled = 'disabled="disabled"'; $between_disabled = 'disabled="disabled"'; switch ( $_POST['calculation_type'] ) { case 'total': $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`, '$date_format' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = $affID AND `Status` = 'approved' ORDER BY `Date` DESC"; break; case 'order_num': $order_id = process_db_input( $_POST['tr_order_num'] ); $tr['order_num'] = process_pass_data( $_POST['tr_order_num'] ); $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`, '$date_format' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = $affID AND `gtwTransactionID` = '$order_id' AND `Status` = 'approved' ORDER BY `Date` DESC"; $order_num_disabled = ""; break; case 'last': $last_days = (int)$_POST['tr_last_days']; $tr['last_days'] = process_pass_data( $_POST['tr_last_days'] ); $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`, '$date_format' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = $affID AND ( TO_DAYS( NOW() ) - TO_DAYS( `Date` ) <= $last_days ) AND `Status` = 'approved' ORDER BY `Date` DESC"; $last_disabled = ""; break; case 'date': $exact_date = strtotime( $_POST['tr_exact_date'] ); $tr['exact_date'] = process_pass_data( $_POST['tr_exact_date'] ); if ( $exact_date != -1 ) { $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`, '$date_format' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = $affID AND TO_DAYS( FROM_UNIXTIME($exact_date) ) = TO_DAYS( `Date` ) AND `Status` = 'approved' ORDER BY `Date` DESC"; } else { $tr_query = ""; $tr['error_text'] = "Please specify correct dates"; } $date_disabled = ""; break; case 'between': // First date parse if ( $_POST['tr_between_date1'] == 'start' ) $between_date1 = 0; elseif ( $_POST['tr_between_date1'] == 'now' ) $between_date1 = time(); else $between_date1 = strtotime( $_POST['tr_between_date1'] ); // Second date parse if ( $_POST['tr_between_date2'] == 'start' ) $between_date2 = 0; elseif ( $_POST['tr_between_date2'] == 'now' ) $between_date2 = time(); else $between_date2 = strtotime( $_POST['tr_between_date2'] ); $tr['between_date1'] = process_pass_data( $_POST['tr_between_date1'] ); $tr['between_date2'] = process_pass_data( $_POST['tr_between_date2'] ); if ( $between_date1 != -1 && $between_date2 != -1 ) { $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`, '$date_format' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = $affID AND ( TO_DAYS( FROM_UNIXTIME($between_date1) ) <= TO_DAYS( `Date` ) AND TO_DAYS( FROM_UNIXTIME($between_date2) ) >= TO_DAYS( `Date` ) ) AND `Status` = 'approved' ORDER BY `Date` DESC"; } else { $tr_query = ""; $tr['error_text'] = "Please specify correct dates"; } $between_disabled = ""; break; } // Calculations if ( strlen($tr_query) ) { $fin = getFinanceAffStat( $affID, $tr ); } // Transactions if ( strlen($tr_query) ) { $tr_res = db_res( $tr_query ); $tr_num = mysql_num_rows( $tr_res ); } else { $tr_num = 0; } $_page['header'] = "Finance"; $_page['header_text'] = "Calculations and transactions"; send_headers_page_changed(); ob_start(); ?>
{$tr['error_text']}

"; ?>
 Show transactions and calculate sums 
>
> >
> >  days (type 0 for today's transactions)
> >  />  />
> >  />  />
  and >  />  />
 
The earlier date must be set first, the later one - second. Also you can use words "start" and "now" to indicate the beginning of your work and the present date. Do not use queries like "between start and now" because it can display a huge amount of transactions.

Please Pay Attention
NOTE: Only transactions with site's current currency will be shown here.
Transactions and Calculations
 Calculations for the query
 Membership subscriptions    
 Contact sales    
 Events tickets    
 Total    

"; } else { $paymentProviders = getPaymentProviders( false ); ?> Type: ' . $tranDataArray['action']; $tranDataString = 'Description: ' . returnDescByAction( $tranDataArray['action'], $tranDataArray['data'], false ); $tranNoteString = strlen($tr_arr['Note']) ? 'Note: ' . $tr_arr['Note'] : ''; ?>
Transactions
No transactions available
Order number Date Member Provider Info Sum paid,
{$tr_arr['IDMember']}" ?> Info