X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_view.inc;h=1cd30802b0be9e0b44ce1fdd1d8bcf87d64070cb;hb=4c16d92ae1e1032f23e029d7d2f901a65a4223bc;hp=639aea0b9acdc661867b09e92dd9029d0e1432fc;hpb=d746d3fde3490592d30b75d31dd8622d09c997d0;p=fa-stable.git diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 639aea0b..1cd30802 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -1,12 +1,13 @@ $label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -42,17 +41,15 @@ function get_supplier_trans_view_str($type, $trans_no, $label="") function get_gl_view_str($type, $trans_no, $label="", $force=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; if (!$force && !user_show_gl_info()) return ""; if ($label == "") $label = _("GL"); - if ($use_popup_windows) - $gl_view = "$label"; - else - $gl_view = "$label"; + $pars = access_string($label); + $gl_view = "$pars[0]"; return $gl_view; } @@ -70,7 +67,7 @@ function get_gl_view_str_cell($type, $trans_no, $label="") function get_customer_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; if ($type == 10) @@ -98,10 +95,8 @@ function get_customer_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str .= "$lbl"; - else - $preview_str .= "$lbl"; + $pars = access_string($lbl); + $preview_str = "$pars[0]"; } else $preview_str .= $lbl; @@ -114,7 +109,7 @@ function get_customer_trans_view_str($type, $trans_no, $label="") function get_banking_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -134,10 +129,8 @@ function get_banking_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -149,7 +142,7 @@ function get_banking_trans_view_str($type, $trans_no, $label="") function get_inventory_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -165,10 +158,8 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -180,7 +171,7 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") function get_manufacturing_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -198,10 +189,8 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -213,7 +202,7 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") function get_dimensions_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -227,10 +216,8 @@ function get_dimensions_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -270,31 +257,40 @@ function get_trans_view_str($type, $trans_no, $label="") } //-------------------------------------------------------------------------------------- - -function exchange_rate_display($from_currency, $to_currency, $date_, $buttons=true) +// Displays currency exchange rate for given date. +// When there is no exrate for today, +// gets it form ECB and stores in local database. +// +function exchange_rate_display($from_currency, $to_currency, $date_) { + global $Ajax; + if ($from_currency != $to_currency) { - if ($buttons && isset($_POST['get_rate'])) - { - $comp_currency = get_company_currency(); - if ($from_currency == $comp_currency) - $currency = $to_currency; - else - $currency = $from_currency; - $rate = get_ecb_rate($currency); - if (get_date_exchange_rate($currency, $date_)) - update_exchange_rate($currency, $date_, $rate, $rate); - else - add_exchange_rate($currency, $date_, $rate, $rate); - if ($from_currency == $comp_currency) - $rate = 1 / $rate; - } + $comp_currency = get_company_currency(); + if ($from_currency == $comp_currency) + $currency = $to_currency; else + $currency = $from_currency; + $rate = 0; + if ($date_ == Today()) { + $rate = get_date_exchange_rate($currency, $date_); + if (!$rate) { + $rate = get_ecb_rate($currency); + if ($rate) + add_exchange_rate($currency, $date_, $rate, $rate); + } + } + if (!$rate) $rate = get_exchange_rate_from_to($to_currency, $from_currency, $date_); + + if ($from_currency == $comp_currency) + $rate = 1 / $rate; + $rate = number_format2($rate, user_exrate_dec()); - label_row(_("Exchange Rate:"),"1 " . $from_currency . " = " . $rate . " " . $to_currency . - ($buttons?" " . submit('get_rate',_("Get"), false):"")); + label_row(_("Exchange Rate:"),"1 " . $from_currency + . " = " . $rate . " " . $to_currency ); + $Ajax->addUpdate('_ex_rate','_ex_rate', $rate); } } @@ -312,7 +308,7 @@ function is_voided_display($type, $id, $label) echo "$label
"; echo "" . _("Date Voided:") . " " . sql2date($void_entry["date_"]) . "
"; if (strlen($void_entry["memo_"]) > 0) - echo "
" . _("Memo:") . " " . $void_entry["memo_"] . "
"; + echo "
" . _("Memo:") . " " . $void_entry["memo_"] . "

"; echo ""; end_table(1); @@ -453,7 +449,6 @@ function display_edit_tax_items($taxes, $columns, $tax_included, $leftspan=0) function display_footer_exit() { - global $path_to_root; br(2); end_page(); exit; @@ -522,22 +517,6 @@ function display_allocations_from($person_type, $person_id, $type, $type_no, $to } } -function get_js_go_back() -{ - $js = "\n\n"; - return $js; -} - function get_js_open_window($width, $height) { $js = "\n\n"; return $js; } -function get_js_form_entry($edit_name, $sel_name, $next_name) -{ - $js = "\n\n"; - return $js; +/* + Setting focus on element $name in $form. + If $form<0 $name is element id. +*/ +function set_focus($name, $form_no=0) { + global $Ajax; + $Ajax->addFocus(true, $name); + $_POST['_focus'] = $name; } - -function get_js_set_focus($name) -{ - $js = "\n\n"; - return $js; +// +// Set default focus on first field $name if not set yet +// +function default_focus($name, $form_no=0) { + if (!isset($_POST['_focus'])) { + set_focus($name); + } } function get_js_png_fix() @@ -633,29 +579,20 @@ function get_js_png_fix() function get_js_date_picker() { - global $dateseps, $date_system; - - $how = user_date_format(); // 0 = us/ca, 1 = eu, au, nz, 2 = jp, sw - $sep = $dateseps[user_date_sep()]; // date separator - $wstart = (($date_system == 1 || $date_system == 2) ? 6 : ($how == 0 ? 0 : 1)); // weekstart (sun = 0, mon = 1) - $months = array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")); - $wdays = array(_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")); - $back = _("Back"); - if ($date_system == 1) - list($cyear, $cmon, $cday) = gregorian_to_jalali(date("Y"), date("n"), date("j")); - else if ($date_system == 2) - list($cyear, $cmon, $cday) = gregorian_to_islamic(date("Y"), date("n"), date("j")); + global $comp_path, $go_debug; + $fpath = $comp_path.'/'.user_company().'/js_cache/'.'date_picker.js'; $js = " "; - $js .= " -"; - return $js; -} +document.write(\"
\");"; -function get_js_allocate() { - return ""; + cache_js_file($fpath, $js); + } + add_js_ufile($fpath); + + return ''; } function alert($msg)