function create_query() { $company_details = array(); $sql_query = "SELECT userId,companyname FROM cs_companydetails"; $result = sql_query_read($sql_query); if (!$result) { etelPrint("<p><b>" . mysql_error() . "</b><br>{$sql_query}</p>"); } else { while ($row = mysql_fetch_assoc($result)) { $this->company_details[$row['userId']] = $row; } } $sql_from = $this->trans_table; $sql_queries = array(); foreach ($this->company_details as $company_id => $details) { $sql_queries[$company_id] = array(); foreach ($this->report_date as $range_name => $range_values) { $sql_select = ""; foreach ($this->sql_options as $key => $info) { $sql_select .= ($sql_select == "" ? "" : ",\r\n") . $info . " AS " . $key . "_" . $range_name; } $date_range = " (td.transactionDate between '" . $range_values['from'] . "' and '" . $range_values['to'] . "')"; $sql_where = "cd.userId = \"{$company_id}\""; $sql_query = "SELECT {$sql_select} FROM {$sql_from} WHERE {$sql_where} AND {$date_range} GROUP BY td.userId"; $sql_query = str_replace("[company_userId]", $sql_where, $sql_query); $sql_query = str_replace("[time_frame]", $date_range, $sql_query); $sql_queries[$company_id][$range_name] = $sql_query; } } return $sql_queries; }
function update_transaction_profit($id) { $sql = "SELECT * FROM cs_transactiondetails as td \n\t\tleft join `cs_bank` as bk on td.bank_id = bk.bank_id\n\t\tWHERE transactionId = '{$id}'"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); $transInfo = mysql_fetch_assoc($result); $rates = $this->rates->get_MerchantRates($transInfo['userId'], $transInfo['bank_id']); $rates = $rates[$transInfo['bank_id']]; if (!is_array($rates)) { return array('status' => 'fail', 'msg' => 'Invalid Merchant Bank Rates'); } etelPrint($rates); // Create/Update Required Entities $proc_en_ID = $this->get_entity_id(array('en_ID' => 2)); if (!$proc_en_ID) { $proc_en_ID = $this->create_entity(array('en_ID' => 2, 'en_type' => 'processor', 'en_type_ID' => 1, 'en_company' => "Etelegate.com", 'en_gateway_ID' => 3)); } if (!$proc_en_ID) { return array('status' => 'fail', 'msg' => 'Could not get/create Processor ID'); } $bank_en_ID = $this->get_entity_id(array('en_type' => 'bank', 'en_type_ID' => $transInfo['bank_id'])); if (!$bank_en_ID) { $bank_en_ID = $this->create_entity(array('en_type' => 'bank', 'en_type_ID' => $transInfo['bank_id'], 'en_company' => $transInfo['bank_name'], 'en_gateway_ID' => $transInfo['gateway_id'])); } if (!$bank_en_ID) { return array('status' => 'fail', 'msg' => 'Could not get/create Bank Entity ID'); } $merc_en_ID = $this->get_entity_id(array('en_type' => 'merchant', 'en_type_ID' => $transInfo['userId'])); if (!$merc_en_ID) { return array('status' => 'fail', 'msg' => 'Could not get Merchant Entity ID'); } // Create/Update Required Entities // Commit Profit $data = array('description' => "Transaction Profit for " . $transInfo['reference_number']); // Merchant Profit // $newTransfer = array('amount' => $transInfo['amount']-$transInfo['td_customer_fee'],'from_entity'=>$bank_en_ID,'to_entity'=>$merc_en_ID,'date_effective'=> $data['transfers'][] = $newTransfer; // Merchant Profit echo $proc_en_ID; //$data['transfers'] }
function http_post($server, $port, $url, $urlencoded, $username = "", $password = "") { // example: // http_post( // "www.fat.com", // 80, // "/weightloss.pl", // array("name" => "obese bob", "age" => "20") // ); $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; $base_64_auth = base64_encode($username . ":" . $password); $content_length = strlen($urlencoded); $headers = "POST {$url} HTTP/1.1\nAccept: */*\nAccept-Language: en-au\nContent-Type: application/x-www-form-urlencoded\nUser-Agent: {$user_agent}\nHost: {$server}\nConnection: Keep-Alive\nCache-Control: no-cache\nAuthorization: Basic {$base_64_auth}\nContent-Length: {$content_length}\n\n"; etelPrint($headers); $time = microtime_float(); $fp = fsockopen($server, $port, &$errno, &$errstr, 45); if (!$fp) { return "{$errno}: {$errstr}"; } fputs($fp, $headers); fputs($fp, $urlencoded); $ret = ""; $body = false; while (!feof($fp)) { $s = @fgets($fp, 1024); if ($body) { $ret .= $s; } if ($s == "\r\n") { $body = true; } if (microtime_float() - $time > 45) { return "Timeout: {$ret}"; } } fclose($fp); return $ret; }
$cs_name = strtolower($cs_company_sites['cs_name']); echo $cs_name . " ___________ "; foreach ($rep0 as $key => $data) { $cs_name = str_replace($key, $data, $cs_name); } foreach ($rep3 as $key => $data) { $cs_name = str_replace($key, $data, $cs_name); } foreach ($rep1 as $key => $data) { $cs_name = str_replace($key, $data, $cs_name); } foreach ($rep2 as $key => $data) { $cs_name = str_replace($key, $data, $cs_name); } $cs_name = ucwords(trim(preg_replace('/[^a-zA-Z]/', ' ', $cs_name))); etelPrint($cs_name); $sql = "update etel_dbsmain.cs_company_sites set cs_title = '" . quote_smart($cs_name) . "' where cs_ID = '" . $cs_company_sites['cs_ID'] . "' limit 1"; mysql_query($sql); } die; $sql = "SELECT transactionId\r\nFROM cs_transactiondetails limit 1\r\n"; $result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$sql}"); while ($transInfo = mysql_fetch_assoc($result)) { $sql = "SELECT transactionId, `CCnumber`, `bankaccountnumber`, `bankroutingcode`, td_process_query,td_process_result from cs_transactiondetails where transactionId = '180093199' limit 1"; $res2 = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$sql}"); $transInfo = mysql_fetch_assoc($res2); $reparray = array('[credit_card]', '[account_number]', '[routing_number]'); if (!is_numeric($transInfo['CCnumber'])) { $transInfo['CCnumber'] = etelDec($transInfo['CCnumber']); } if (!is_numeric($transInfo['bankaccountnumber'])) {
$active_subscriptions = isset($HTTP_GET_VARS['active_subscriptions']) ? quote_smart($HTTP_GET_VARS['active_subscriptions']) : ""; $untracked_orders = isset($HTTP_GET_VARS['untracked_orders']) ? quote_smart($HTTP_GET_VARS['untracked_orders']) : ""; $trans_table_name = "cs_transactiondetails"; if ($display_test_transactions == 1) { $trans_table_name = "cs_test_transactiondetails"; } $trans_recur = isset($HTTP_GET_VARS['trans_recur']) ? quote_smart($HTTP_GET_VARS['trans_recur']) : ""; $trans_chargeback = isset($HTTP_GET_VARS['trans_chargeback']) ? quote_smart($HTTP_GET_VARS['trans_chargeback']) : ""; $compID = $sessionlogin; if (!$compID) { $compID = -1; } if ($_POST['Submit'] == "Issue Refund" && !$display_test_transactions) { $transID = intval($_POST['id']); $etel_debug_mode = 0; etelPrint($transID); $msg = exec_refund_request($transID, "Merchant Refund", ""); } if ($_POST['Submit'] == "Cancel Rebill" && !$display_test_transactions) { $trans = new transaction_class(false); $trans->pull_transaction($_POST['id']); $status = $trans->process_cancel_request(array("actor" => 'Administrator')); } $search_date_type = "transactionDate"; $email = isset($HTTP_GET_VARS["email"]) ? quote_smart($HTTP_GET_VARS["email"]) : ""; if ($companyBlocked != 1) { $check_number = isset($HTTP_GET_VARS['check_number']) ? quote_smart($HTTP_GET_VARS['check_number']) : ""; $credit_number = isset($HTTP_GET_VARS['credit_number']) ? quote_smart($HTTP_GET_VARS['credit_number']) : ""; $account_number = isset($HTTP_GET_VARS['account_number']) ? quote_smart($HTTP_GET_VARS['account_number']) : ""; $routing_code = isset($HTTP_GET_VARS['routing_code']) ? quote_smart($HTTP_GET_VARS['routing_code']) : ""; $decline_reason = isset($HTTP_GET_VARS['decline_reasons']) ? $HTTP_GET_VARS['decline_reasons'] : "";
function checkCheckSum($row) { if (!$row['cd_verify_rand_price']) { return TRUE; } $check = md5($row['cd_secret_key'] . $row['cs_reference_ID'] . $_SESSION['mt_amount'] . $_SESSION['mt_product_id']); etelPrint("Checksum:<br>" . $check . " " . $_SESSION['mt_checksum'] . " "); etelPrint($row['cd_secret_key'] . "-" . $row['cs_reference_ID'] . "-" . $_SESSION['mt_amount'] . "-" . $_SESSION['mt_product_id']); if ($_SESSION['mt_checksum'] != $check) { return FALSE; } return TRUE; }
function buildApproval() { if ($_SESSION['Success_Posted_Vars']) { return $_SESSION['Success_Posted_Vars']; } //if(!$this->row['transactionTable']['reference_number']) // return ''; $postedvars = ""; //echo $this->merchantdetails['mt_posted_variables']; $md = unserialize($this->merchantdetails['mt_posted_variables']); $return_message = 'SUC'; if ($this->merchantdetails['response']['status'] == 'D') { $return_message = 'DEC'; } foreach ($md as $key => $val) { $postedvars .= "<input type='hidden' name='{$key}' value='{$val}'>\n"; } $postedvars .= "<input type='hidden' name='mt_transaction_result' value='{$return_message}'>\n"; $postedvars .= "<input type='hidden' name='mt_total_amount' value='" . $this->amount . "'>\n"; $postedvars .= "<input type='hidden' name='mt_reference_number' value='" . $this->row['transactionTable']['reference_number'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_subscription_id' value='" . $this->merchantdetails['response']['td_subscription_id'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_product_id' value='" . $this->merchantdetails['mt_product_id'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_useremail' value='" . $this->merchantdetails['email'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_usercountry' value='" . $this->merchantdetails['country'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_usercity' value='" . $this->merchantdetails['city'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_userstate' value='" . $this->merchantdetails['state'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_userzip' value='" . $this->merchantdetails['zipcode'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_userip' value='{$_SERVER['REMOTE_ADDR']}'>\n"; // BUG: this should come from the transaction info, not server. $postedvars .= "<input type='hidden' name='mt_userfirst' value='" . $this->merchantdetails['firstname'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_userlast' value='" . $this->merchantdetails['lastname'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_charge_type' value='" . $this->merchantdetails['cardtype'] . "'>\n"; if ($this->row['websiteTable']['cs_enable_passmgmt'] == 1) { $postedvars .= "<input type='hidden' name='mt_username' value='" . $this->merchantdetails['td_username'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_password' value='" . $this->merchantdetails['td_password'] . "'>\n"; } if (isset($md['mt_amount']) && $md['mt_amount'] != "") { $check = md5($this->row['companydetailsTable']['cd_secret_key'] . $this->row['websiteTable']['cs_reference_ID'] . $md['mt_amount'] . $this->row['transactionTable']['reference_number']); $postedvars .= "<input type='hidden' name='verify_checksum' value='{$check}'>\n"; etelPrint("Verify Checksum:<br>" . $check . " " . $_SESSION['mt_checksum'] . " "); etelPrint($this->row['companydetailsTable']['cd_secret_key'] . "-" . $this->row['websiteTable']['cs_reference_ID'] . "-" . $md['mt_amount'] . "-" . $this->row['transactionTable']['reference_number']); } if ($this->row['rebillingTable']['rd_pin_coding_enabled']) { $sql = "SELECT * \n\t\t\t\t\t\tFROM \n\t\t\t\t\t\tcs_pincodes \n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\tpc_subAccount = '{$this->row['rebillingTable']['rd_subaccount']}' and pc_used = 0"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); if ($cs_pincodes = mysql_fetch_assoc($result)) { $postedvars .= "<input type='hidden' name='mt_pincode' value='" . $cs_pincodes['pc_code'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_pincode_username' value='" . $cs_pincodes['pc_code'] . "'>\n"; $postedvars .= "<input type='hidden' name='mt_pincode_password' value='" . $cs_pincodes['pc_pass'] . "'>\n"; $ibill_array['CODE'] = $cs_pincodes['pc_code']; $ibill_array['USER'] = $cs_pincodes['pc_code']; $ibill_array['NAME'] = $cs_pincodes['pc_code']; $ibill_array['USRENAME'] = $cs_pincodes['pc_code']; $ibill_array['PASS'] = $cs_pincodes['pc_pass']; $ibill_array['PASSWORD'] = $cs_pincodes['pc_pass']; $sql = "UPDATE\n\t\t\t\t\t\t\t cs_pincodes \n\t\t\t\t\t\t\t SET pc_used = 1,\n\t\t\t\t\t\t\t pc_trans_ID = '" . $this->merchantdetails['response']['transactionId'] . "' \n\t\t\t\t\t\t\t WHERE pc_ID = '" . $cs_pincodes['pc_ID'] . "' "; sql_query_write($sql) or dieLog(mysql_error()); } } $_SESSION['Success_Posted_Vars'] = $postedvars; return $postedvars; }
if ($_REQUEST['showheader']) { $headerInclude = $_REQUEST['showheader']; } require $rootdir . 'smarty/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $curtemplate = $_SESSION["gw_template"]; if (!$curtemplate) { $curtemplate = "default"; } if ($curtemplate_overwrite) { if (file_exists($etel_root_path . "/tmpl/" . $curtemplate_overwrite . "/cp_header.tpl")) { $curtemplate = $curtemplate_overwrite; } else { etelPrint($etel_root_path . "/tmpl/" . $curtemplate_overwrite . "/cp_header.tpl Not Found"); } } $smarty->template_dir = $etel_root_path . "/tmpl/" . $curtemplate . "/"; $smarty->compile_dir = $etel_root_path . "/tmpl/" . $curtemplate . "_c/"; $smarty->config_dir = $etel_root_path . "/tmpl/" . $curtemplate . "/config/"; $tmpl_dir = $etel_domain_path . "/tmpl/" . $curtemplate . "/"; $smarty->assign("rootdir", $etel_domain_path); $smarty->assign("tempdir", $tmpl_dir); $smarty->assign("display_stat_wait", $display_stat_wait); $smarty->assign("gw_phone_support", $_SESSION["gw_phone_support"]); $smarty->assign("gateway_title", ':: ' . $_SESSION["gw_title"] . ' Payment Gateway :: '); $smarty->assign("page_title", $pageConfig['Title']); if (!$pageConfig['HideHeader']) { require_once $rootdir . 'includes/links.php'; }
$companyInfo = mysql_fetch_assoc($result); $completion = ""; $bank_update_sql = ""; if ($strUnsubscribe != $companyInfo['send_mail']) { if ($strUnsubscribe) { removeListEmail($companyInfo['email']); removeListEmail($companyInfo['contact_email']); } else { addListEmail($companyInfo['email'], "Admin Unsubscribed Email", $companyInfo['userId'], 'merchant', 'unsubscribe'); addListEmail($companyInfo['contact_email'], "Admin Unsubscribed Email", $companyInfo['userId'], 'merchant', 'unsubscribe'); } } if ($cd_custom_contract && !$companyInfo['cd_custom_contract']) { $contract = genMerchantContract(&$companyInfo); $sql = "insert into cs_email_templates set et_name='merchant_contract', et_custom_id='" . $companyInfo['userId'] . "', et_title='" . quote_smart($companyInfo['companyname']) . " Contract', et_access='admin', et_to_title='" . quote_smart($companyInfo['companyname']) . "', et_subject='Custom Merchant Contract for " . quote_smart($companyInfo['companyname']) . "', et_htmlformat='" . quote_smart($contract['et_htmlformat']) . "', et_catagory='Merchant'"; $result = mysql_query($sql) or etelPrint(mysql_error()); $cd_custom_contract = mysql_insert_id(); } else { if (!$cd_custom_contract && $companyInfo['cd_custom_contract']) { $sql = "delete from cs_email_templates where et_name='merchant_contract' and et_custom_id='" . $companyInfo['userId'] . "'"; $result = mysql_query($sql) or dieLog(mysql_error()); $cd_custom_contract = 'null'; } else { $cd_custom_contract = intval($companyInfo['cd_custom_contract']); } } if ($cd_merchant_show_contract == 1 && $companyInfo['cd_completion'] <= 3) { $completion = ' cd_completion=4, '; } if ($trans_activity == 1 && !$companyInfo['activeuser']) { toLog('turnedlive', 'merchant', '', $companyInfo['userId']);
function smart_process_mysql_form(&$sql) { $search =& $sql['search']; $sql_pairs =& $sql['pairs']; $posts_not_required =& $sql['posts_not_required']; $posts_set = 0; $is_form_complete = 1; foreach ($search as $field => $elements) { $this_element = "frm_" . str_replace(".", "_", $field); //check if field is required $is_required = isset($search[$field]['required']) ? $search[$field]['required'] : 0; $compare = isset($search[$field]['compare']) ? $search[$field]['compare'] : 0; if (!strcasecmp($compare, "between")) { $this_element_to = $this_element . "_to"; $this_element .= "_from"; } //check to see if field is hidden and if so, make sure the value hasn't changed. if (!strcasecmp($search[$field]['input_type'], "hidden") && (!isset($search[$field]['locked']) || $search[$field]['locked'] == true)) { $_REQUEST[$this_element] = $search[$field]['value']; } //if a field has a source, make sure the returned value is on of the possible options $pairs = 0; if (isset($search[$field]['options']['source']['script'])) { $pairs = $search[$field]['options']['source']['script']($search[$field]['options']['source']['parameters']); } //if(isset($search[$field]['options']['source']['ajax'])) // $pairs = $search[$field]['options']['source']['ajax']($search[$field]['options']['source']['parameters'],false); if (isset($search[$field]['options']['source']['pairs'])) { $pairs = $sql_pairs[$search[$field]['options']['source']['pairs']]; } if ($pairs != 0) { if (is_array($_REQUEST[$this_element])) { foreach ($_REQUEST[$this_element] as $index => $post_element) { if ($post_element != "") { $found = false; foreach ($pairs as $index => $info) { if (!strcasecmp($info['value'], $post_element)) { $found = true; } } if (!$found) { echo $post_element . " is not an option"; // print_r($pairs); // echo "</pre>"; return false; } } } } else { if ($_REQUEST[$this_element] != "") { $found = false; foreach ($pairs as $index => $info) { if (!strcasecmp($info['value'], $_REQUEST[$this_element])) { $found = true; } } if (!$found) { echo $_REQUEST[$this_element] . " is not an option"; // echo "<pre>"; // print_r($pairs); //echo "</pre>"; return false; } } } } if (!$is_required || $is_required && isset($_REQUEST[$this_element]) && $_REQUEST[$this_element] != "") { if ($_REQUEST[$this_element] != NULL) { $posts_set++; $search[$field]['value'] = ""; $post_element = $_REQUEST[$this_element]; $post_element_to = isset($_REQUEST[$this_element_to]) ? $_REQUEST[$this_element_to] : NULL; if (isset($search[$field]['swap'])) { $post_element = $search[$field]['swap']($post_element); $post_element_to = $search[$field]['swap']($post_element_to); } if (is_array($post_element)) { if (strcasecmp($search[$field]['compare'], "BETWEEN") != 0) { foreach ($post_element as $element) { if ($element == NULL) { continue; } //echo $this_element . " => " . $element . "<br>"; if ($search[$field]['enclose']) { $element = $search[$field]['enclose'] . $element . $search[$field]['enclose']; } if (isset($search[$field]['date_format'])) { $element = date($search[$field]['date_format'], strtotime($element)); } $this_value = "\"" . quote_smart($element) . "\""; if (isset($search[$field]['convert'])) { $this_value = $search[$field]['convert'] . "({$this_value})"; } $search[$field]['value'] .= ($search[$field]['value'] == "" ? "" : ",") . $this_value; } } if ($search[$field]['value']) { $search[$field]['value'] = "(" . $search[$field]['value'] . ")"; } } else { $element = $post_element; if ($search[$field]['enclose']) { $element = $search[$field]['enclose'] . $element . $search[$field]['enclose']; } if ($search[$field]['compare'] == "like" && strpos($element, '%') === false) { $search[$field]['compare'] = '='; } if (isset($search[$field]['date_format'])) { if (!strcasecmp($search[$field]['compare'], "BETWEEN")) { $element = date($search[$field]['date_format'] . " 00:00:00", strtotime($element)); $post_element_to = date($search[$field]['date_format'] . " 23:59:59", strtotime($post_element_to)); } else { $element = date($search[$field]['date_format'], strtotime($element)); } } if ($search[$field]['compare'] == "LIKE") { $this_value = "\"" . quote_smart($element) . "\""; } elseif (!strcasecmp($search[$field]['compare'], "BETWEEN")) { $this_value = "\"" . quote_smart($element) . "\" AND \"" . quote_smart($post_element_to) . "\""; } else { $this_value = "\"" . quote_smart($element) . "\""; } if (isset($search[$field]['convert'])) { $this_value = $search[$field]['convert'] . "({$this_value})"; } if (!strcasecmp($search[$field]['compare'], "IN")) { $search[$field]['value'] = "('" . implode("','", preg_split('/[,\'" ]+/', $this_value)) . "')"; } else { $search[$field]['value'] = $this_value; } } } } else { etelPrint("{$this_element} must be set"); $is_form_complete = 0; } } if ($posts_set == 0 && !$posts_not_required) { return false; } return $is_form_complete; }
$bankItem['amt_limit'] = intval($dayinfo[$bankid]['totalamount'] / 30); } if (!isset($bankItem['bill_cnt'])) { $bankItem['bill_cnt'] = intval($bankItem['cnt_limit'] / 12); } if ($bankItem['bill_cnt'] < 1) { $bankItem['skip'] = true; $bankItem['skipped_because'] = "Bill Count < 1" . print_r($bankItem, true); } if ($bankItem['cnt_limit'] && $bankItem['cnt'] > $bankItem['cnt_limit']) { $bankItem['skip'] = true; $bankItem['skipped_because'] = "Count Limit " . $bankItem['cnt'] . ">" . $bankItem['cnt_limit']; } if ($bankItem['amt_limit'] && $bankItem['amt'] > $bankItem['amt_limit']) { $bankItem['skip'] = true; $bankItem['skipped_because'] = "Amount Limit " . $bankItem['amt'] . ">" . $bankItem['amt_limit']; } if (!$bankItem['skip']) { if (!$test) { process_rebills($trans_class, $bankItem['bill_cnt'], array('bank_limit' => array($bankid), 'bank_where' => $bankItem['bank_where'])); } } else { echo 'Skipping Bank ' . $bankid . '...<br>' . print_r($bankItem, true); } if ($test) { etelPrint($bankItem); } } if (!$test) { process_expired($trans_class, 0, 250); }
$bank_sort_code = isset($HTTP_POST_VARS['bank_sort_code']) ? quote_smart($HTTP_POST_VARS['bank_sort_code']) : ""; $cd_bank_routingnumber = isset($HTTP_POST_VARS['cd_bank_routingnumber']) ? quote_smart($HTTP_POST_VARS['cd_bank_routingnumber']) : ""; $registrationNo = isset($HTTP_POST_VARS['regnum']) ? quote_smart($HTTP_POST_VARS['regnum']) : ""; $bic_code = isset($HTTP_POST_VARS['bic_code']) ? quote_smart($HTTP_POST_VARS['bic_code']) : ""; $VATnumber = isset($HTTP_POST_VARS['VATnumber']) ? quote_smart($HTTP_POST_VARS['VATnumber']) : ""; $company_num_code = isset($HTTP_POST_VARS['company_num_code']) ? quote_smart($HTTP_POST_VARS['company_num_code']) : ""; $cd_bank_instructions = isset($HTTP_POST_VARS['cd_bank_instructions']) ? quote_smart($HTTP_POST_VARS['cd_bank_instructions']) : ""; $bank_IBState = isset($HTTP_POST_VARS['bank_IBState']) ? quote_smart($HTTP_POST_VARS['bank_IBState']) : ""; $bank_IBCity = isset($HTTP_POST_VARS['bank_IBCity']) ? quote_smart($HTTP_POST_VARS['bank_IBCity']) : ""; $bank_IBName = isset($HTTP_POST_VARS['bank_IBName']) ? quote_smart($HTTP_POST_VARS['bank_IBName']) : ""; $bank_IBRoutingCodeType = isset($HTTP_POST_VARS['bank_IBRoutingCodeType']) ? quote_smart($HTTP_POST_VARS['bank_IBRoutingCodeType']) : ""; $bank_IBRoutingCode = isset($HTTP_POST_VARS['bank_IBRoutingCode']) ? quote_smart($HTTP_POST_VARS['bank_IBRoutingCode']) : ""; $qry_update_user = "******"; $qry_update_user .= " where userId='{$userid}' {$bank_sql_limit}"; //if ($adminInfo['li_level'] == 'full') etelPrint($qry_update_user); mysql_query($qry_update_user) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$qry_update_user}"); } $company_id = isset($HTTP_GET_VARS['company_id']) ? $HTTP_GET_VARS['company_id'] : ""; if ($company_id == "") { $company_id = isset($HTTP_POST_VARS['userid']) ? quote_smart($HTTP_POST_VARS['userid']) : ""; } $companyname = isset($HTTP_GET_VARS['companyname']) ? $HTTP_GET_VARS['companyname'] : ""; $companytype = isset($HTTP_GET_VARS['companymode']) ? $HTTP_GET_VARS['companymode'] : ""; $companytrans_type = isset($HTTP_GET_VARS['companytrans_type']) ? quote_smart($HTTP_GET_VARS['companytrans_type']) : ""; $script_display = ""; $qry_select_companies = "select * from cs_companydetails where userid='{$company_id}' {$bank_sql_limit}"; if ($qry_select_companies != "") { if (!($show_sql = mysql_query($qry_select_companies))) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); }
} unset($access['Data']['cd_enable_tracking']); unset($access['Data']['td_enable_tracking']); $access['Data']['ss_cancel_id']['DisplayName'] = 'Cancelation ID'; if (!$access['Data']['ss_cancel_id']['Value']) { unset($access['Data']['ss_cancel_id']); } if (!$access['Data']['ss_billing_state']['Value']) { unset($access['Data']['ss_billing_state']); } if (!$access['Data']['Last_Rebill_Date']['Value']) { unset($access['Data']['Last_Rebill_Date']); } $RF = new rates_fees(); $r = $RF->update_transaction_profit($transactionId, true); etelPrint($r); $profit = $RF->get_profit(array('EffectiveOnly' => false, 'useTransTable' => true, 'where' => array('pa_trans_ID' => $transactionId)), 2); if (!is_array($profit['Revenue'])) { $r = $RF->update_transaction_profit($transactionId); $profit = $RF->get_profit(array('EffectiveOnly' => false, 'useTransTable' => true, 'where' => array('pa_trans_ID' => $transactionId)), 2); } $row = 2; $access['Data']['Breakdown']['RowDisplay'] = 'Wide'; $access['Data']['Breakdown']['Input'] = ''; $access['Data']['Breakdown']['disable'] = true; $access['Data']['Breakdown']['DisplayName'] = false; $access['Data']['Breakdown']['AddHtml'] .= $smarty->assign("Profit", $profit); $access['Data']['Breakdown']['AddHtml'] = $smarty->fetch('cp_profitreport.tpl'); if ($_POST['submit_access'] == 'Submit') { $result = processAccessForm(&$access); if ($result) {
function writeAccessForm($access) { global $etel_domain_path; $row = 2; $header = 0; $columns = 1; if ($access['Headers'] > 1) { $columns = 2; } if (!$access['SubmitName']) { $access['SubmitName'] = 'submit_access'; } if (!$access['SubmitValue']) { $access['SubmitValue'] = 'Submit'; } if ($access['Columns']) { $columns = $access['Columns']; } if ($access['EnablePlusMinus']) { $plusminus = true; } $table_start = "<table border=0 class='invoice' width='%100'>"; echo $table_start; if ($access['HeaderMessage']) { echo "<tr><td valign='top' align='center' colspan = '{$columns}'>" . $access['HeaderMessage'] . "</td></tr>"; } if ($access['EntityManager']) { echo "<tr><td valign='top' align='center' colspan = '{$columns}'><div id='en_status'></div><div id='en_results'></div></td></tr>"; } echo "<tr><td valign='top'>"; echo $table_start; $lastHeaderTagId = NULL; $lastHeaderInc = 0; $lastHeaderHide = 0; $scriptAdd = ""; foreach ($access['Data'] as $key => $data) { $tagId = preg_replace('/[^a-z0-9]+/', '_', strtolower($data['Value'])); if ($data['Name'] == 'access_header' || $data['Name'] == 'access_header_spanned') { $lastHeaderTagId = $tagId; $lastHeaderInc = 0; $plusMinusVal = $data['PlusMinus']; if (!$plusMinusVal) { $plusMinusVal = 'Open'; } $scriptAdd .= "toggleSectionView(\$('{$tagId}'),'{$plusMinusVal}');\n"; if ($data['Name'] == 'access_header_spanned') { if ($columns > 1) { if ($header > 1) { echo "</table></td></tr><tr><td colspan='2' valign='top'>{$table_start}"; } } } else { if ($header == intval($access['Headers'] / 2) && $columns > 1) { echo "</table></td><td valign='top'>{$table_start}"; } $header++; } echo "<tr class='infoHeader'><td colspan='2'>"; if ($plusminus) { echo "<img id='{$lastHeaderTagId}' onclick='toggleSectionView(this)' border='0' alt='-'> <a href='javascript:toggleSectionView(\$(\"{$lastHeaderTagId}\"))'>" . $data['Value'] . "</a>"; } else { echo $data['Value']; } echo "</td></tr>\n"; } else { $input = ""; $display_row = true; $size = $data['Length'] / 1.5; if ($size > 100 && !$data['Input']) { $data['Input'] = 'textarea'; } if ($size < 5) { $size = 5; } if ($size > 15) { $size = 15; } $size -= $size % 5; if ($data['Size']) { $size = $data['Size']; } $rows = 3; if ($data['Rows']) { $rows = $data['Rows']; } $additional = $data['InputAdditional']; if ($data['disable']) { $additional .= " disabled"; } if ($data['Valid']) { $additional .= " valid='" . $data['Valid'] . "'"; } if ($data['Name']) { $additional .= " name='" . $data['Name'] . "'"; } if ($data['Name']) { $additional .= " id='" . $data['Name'] . "'"; } if ($data['ReadOnly']) { $additional .= " readonly"; } if ($data['Style']) { $additional .= " style='" . $data['Style'] . "'"; } if ($data['DisplayName']) { $additional .= " title='" . preg_replace('/[^a-zA-Z0-9_ #$]/', ' ', $data['DisplayName']) . "'"; } if (!$data['DisplayName']) { etelPrint("Error: No DisplayName for '{$key}'"); continue; } switch ($data['Input']) { case 'custom': $input = $data['Input_Custom']; break; case 'hidden': $input = "<input type='hidden' value='" . $data['Value'] . "' name='" . $data['Name'] . "'>"; $display_row = false; break; case 'checkbox': $input = "<input type='checkbox' " . ($data['Value'] ? "checked" : "") . " value='1' {$additional}>"; break; case 'selectcustom': $input = "<select {$additional}>\n\t\t\t\t\t" . get_fill_combo_conditionally($data['Input_Custom'], $data['Value']) . "\n\t\t\t\t\t</select>"; break; case 'selectvolume': global $etel_process_volume; $data['Input_Custom'] = $etel_process_volume; case 'selectcustomarray': $input = "<select {$additional}>"; $found = false; $grouped = false; foreach ($data['Input_Custom'] as $key => $val) { $style = NULL; $group = NULL; if (is_array($val)) { $style = "style='" . $val['style'] . "'"; $group = $val['group']; $val = $val['txt']; } if ($group) { if ($grouped) { $input .= "</optgroup>\n"; } $input .= "<optgroup label='{$val}' {$style}>\n"; $grouped = true; } else { if ($data['Value'] == $key && !$found) { $style .= 'selected '; $found = true; } $input .= "<option value='{$key}' {$style}>{$val}</option>\n"; } } if ($grouped) { $input .= "</optgroup>\n"; } $input .= "</select>"; break; case 'selectenum': $input = "<select {$additional}>\n\t\t\t\t\t" . func_get_enum_values($data['Table'], $data['Name'], $data['Value']) . "\n\t\t\t\t\t</select>"; break; case 'textarea': $input = "<textarea cols='{$size}' rows='{$rows}' {$additional}>" . $data['Value'] . "</textarea>"; break; case 'password': $input = "<input type='password' value='" . $data['Value'] . "' maxlength='" . $data['Length'] . "' size='{$size}' {$additional}>"; break; default: $input = "<input type='textfield' value='" . $data['Value'] . "' maxlength='" . $data['Length'] . "' size='{$size}' {$additional}>"; if ($data['disable']) { $input = $data['Value']; } break; } if ($data['LinkTo']) { $input .= " <a target='_blank' href=" . $data['Value'] . ">Link</a>"; } if ($data['EmailTo']) { $input .= " <a href='mailto:" . $data['Value'] . "'>Email</a>"; } if ($data['AddHtml']) { $input .= $data['AddHtml']; } if ($data['HideIfEmpty'] && !$input) { continue; } if ($display_row) { $rowClass = "class='row" . ($row = 3 - $row) . "'"; if ($data['Highlight']) { $rowClass = "class='rowhighlight'"; } if ($data['RowDisplay'] == 'Wide') { if ($data['DisplayName']) { echo "<tr {$rowClass} id='" . $lastHeaderTagId . $lastHeaderInc++ . "' >\n<td colspan='2' align='center' valign='top'>\n<strong>"; echo ($data['Valid'] ? '* ' : '') . $data['DisplayName'] . ":"; echo "</strong>\n</td>\n</tr>\n"; } echo "<tr {$rowClass} id='" . $lastHeaderTagId . $lastHeaderInc++ . "'><td colspan='2' align='center' valign='top'>\n"; echo $input; //." " echo "</td>\n</tr>\n"; } else { echo "<tr {$rowClass} id='" . $lastHeaderTagId . $lastHeaderInc++ . "'>\n<td align='right' valign='top'>\n<strong>"; echo ($data['Valid'] ? '* ' : '') . $data['DisplayName'] . ":"; echo "</strong>\n</td>\n<td>\n"; echo $input; //." " echo "</td>\n</tr>\n"; } } else { echo $input; } } } echo "<tr class='row" . ($row = 3 - $row) . "'><td colspan='2' align='center'>"; echo "</td></tr>\n"; echo "</table>"; echo "</td></tr>\n"; if ($access['Submitable']) { echo "<tr><td colspan='{$columns}' align='center'>\n"; echo "<input type='submit' name='" . $access['SubmitName'] . "' value='" . $access['SubmitValue'] . "'>"; echo "</td></tr>\n"; } echo "</table>"; if ($scriptAdd) { echo "<script>\n{$scriptAdd}</script>"; } }
?> <select name="bi_ID" size="5" id="bi_ID"> <option value="">Select an Invoice</option> <?php func_fill_combo_conditionally("select bi_ID, bi_title from `cs_bank_invoice` where bi_bank_id = '{$bankId}' ORDER BY `bi_date` ASC ", $bi_ID, $cnn_cs); ?> </select> <BR> <input name="Submit" type="submit" value="View Invoice"> <?php endTable("Invoice History", "viewBankInvoice.php"); $bi_pay_info['BankCreditReserveFees'] += $bi_pay_info['BankCreditDiscountFees']; } if ($_GET['debug']) { etelPrint($bi_pay_info); } ?> <script language="javascript"> function reverseInvoice(bi_ID) { if(!confirm("Are you sure you want to delete this invoice and reverse all calculated data affiliated with it?")) return 0; document.location.href="viewBankInvoice.php?bi_ID="+bi_ID+"&action=reverse"; } </script> <style type="text/css"> <!-- .style1 {font-size: 10px}