function ProcessData($strData, $Process) { global $currencies, $posted_currencies, $rw_xtra_jrnl_defs; //echo 'process = ' . $Process . ' and posted cur = '; print_r($posted_currencies); echo '<br />'; switch ($Process) { case "uc": return strtoupper_utf8($strData); case "lc": return strtolower_utf8($strData); case "neg": return -$strData; case "rnd2d": if (!is_numeric($strData)) { return $strData; } else { return number_format(round($strData, 2), 2, '.', ''); } case "rnd_dec": if (!is_numeric($strData)) { return $strData; } else { return $currencies->format($strData); } case "rnd_pre": if (!is_numeric($strData)) { return $strData; } else { return $currencies->precise($strData); } case "def_cur": if (!is_numeric($strData)) { return $strData; } else { return $currencies->format_full($strData, true, DEFAULT_CURRENCY, 1, 'fpdf'); } case "null_dcur": if (!is_numeric($strData)) { return $strData; } else { return !$strData ? '' : $currencies->format_full($strData, true, DEFAULT_CURRENCY, 1, 'fpdf'); } case "posted_cur": if (!is_numeric($strData)) { return $strData; } else { return $currencies->format_full($strData, true, $posted_currencies['currencies_code'], $posted_currencies['currencies_value'], 'fpdf'); } case "null_pcur": if (!is_numeric($strData)) { return $strData; } else { return !$strData ? '' : $currencies->format_full($strData, true, $posted_currencies['currencies_code'], $posted_currencies['currencies_value'], 'fpdf'); } case "dlr": if (!is_numeric($strData)) { return $strData; } else { return '$ ' . number_format(round($strData, 2), 2); } case "euro": if (!is_numeric($strData)) { return $strData; } else { return chr(128) . ' ' . number_format(round($strData, 2), 2); } // assumes standard FPDF fonts // assumes standard FPDF fonts case "n2wrd": return value_to_words_en_us($strData); // for checks primarily // for checks primarily case "terms": return gen_terms_to_language($strData, $short = true, $type = 'ar'); case "date": return gen_spiffycal_db_date_short($strData); case "null-dlr": return !$strData ? '' : '$ ' . number_format($strData, 2); case "ordr_qty": return pull_order_qty($strData); case "branch": return rw_get_branch_name($strData); case "rep_id": return rw_get_user_name($strData); case "ship_name": return rw_get_ship_name($strData); case 'j_desc': return isset($rw_xtra_jrnl_defs[$strData]) ? $rw_xtra_jrnl_defs[$strData] : $strData; case 'yesBno': return $strData ? TEXT_YES : ''; case 'printed': return $strData ? '' : TEXT_DUPLICATE; } $processed_value = false; if (function_exists('rw_extra_processing')) { $processed_value = rw_extra_processing($strData, $Process); } return $processed_value === false ? $strData : $processed_value; // do nothing if Process not recognized }
function ProcessData($strData, $Process) { global $loaded_modules; //echo 'process = ' . $Process . ' and posted cur = '; print_r($posted_currencies); echo '<br />'; switch ($Process) { case "uc": return strtoupper_utf8($strData); case "lc": return strtolower_utf8($strData); case "neg": return -$strData; case "n2wrd": return value_to_words_en_us($strData); case "rnd2d": if (!is_numeric($strData)) { return $strData; } return number_format(round($strData, 2), 2, '.', ''); case "date": return gen_locale_date($strData); case "null-dlr": return (double) $strData == 0 ? '' : '$ ' . number_format($strData, 2); case "dlr": if (!is_numeric($strData)) { return $strData; } return '$ ' . number_format(round($strData, 2), 2); case "euro": if (!is_numeric($strData)) { return $strData; } return chr(128) . ' ' . number_format(round($strData, 2), 2); // assumes standard FPDF fonts // assumes standard FPDF fonts case 'yesBno': return $strData ? TEXT_YES : ''; case 'blank': return ''; case 'printed': return $strData ? '' : TEXT_DUPLICATE; } // now try loaded modules for processing foreach ($loaded_modules as $mod) { $mod_function = "pf_process_" . $mod; if (function_exists($mod_function)) { $strData = $mod_function($strData, $Process); } } if (function_exists('pf_extra_process')) { $strData = pf_extra_process($strData, $Process); } return $strData; }