2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
13 // Sets local POST value and adds Value to ajax posting if needed
15 /*function set_post($name, $value, $ajax_trigger=true) {
18 $_POST[$name] = $value;
19 if ($ajax_trigger) $Ajax->activate($name);
22 //------------------------------------------------------------------------------
23 // Seek for _POST variable with $prefix.
24 // If var is found returns variable name with prefix stripped,
25 // and null or -1 otherwise.
27 function find_submit($prefix, $numeric=true)
30 foreach($_POST as $postkey=>$postval )
32 if (strpos($postkey, $prefix) === 0)
34 $id = substr($postkey, strlen($prefix));
35 return $numeric ? (int)$id : $id;
38 return $numeric ? -1 : null;
41 //------------------------------------------------------------------------------
43 // Helper function for simple db table editor pages
45 function simple_page_mode($numeric_id = true)
47 global $Ajax, $Mode, $selected_id;
49 $default = $numeric_id ? -1 : '';
50 $selected_id = get_post('selected_id', $default);
51 foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET', 'CLONE') as $m) {
52 if (isset($_POST[$m])) {
53 $Ajax->activate('_page_body');
54 if ($m == 'RESET' || $m == 'CLONE')
55 $selected_id = $default;
56 unset($_POST['_focus']);
60 foreach (array('Edit', 'Delete') as $m) {
61 foreach ($_POST as $p => $pvar) {
62 if (strpos($p, $m) === 0) {
63 // $selected_id = strtr(substr($p, strlen($m)), array('%2E'=>'.'));
64 unset($_POST['_focus']); // focus on first form entry
65 $selected_id = quoted_printable_decode(substr($p, strlen($m)));
66 $Ajax->activate('_page_body');
75 //------------------------------------------------------------------------------
77 // Read numeric value from user formatted input
79 function input_num($postname=null, $dflt=0)
81 if (!isset($_POST[$postname]) || $_POST[$postname] == "")
84 return user_numeric($_POST[$postname]);
87 //---------------------------------------------------------------------------------
89 function hidden($name, $value=null, $echo=true)
94 $value = get_post($name);
96 $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
97 $Ajax->addUpdate($name, $name, $value);
104 Universal submit form button.
105 $atype - type of submit:
107 false - normal button; optional icon
108 null - button visible only in fallback mode; optional icon
110 true - standard button; optional icon
112 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
113 'selector' - ditto with closing current popup editor window
114 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
115 'process' - displays progress bar during call; optional icon
116 'nonajax' - ditto, non-ajax submit
117 $atype can contain also multiply type selectors separated by space,
118 however make sense only combination of 'process' and one of defualt/selector/cancel
120 function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
122 global $path_to_root;
125 if ($atype === null) {
126 $aspect = fallback_mode() ? " aspect='fallback'" : " style='display:none;'";
128 } elseif (!is_bool($atype)) { // necessary: switch uses '=='
130 $aspect = "aspect='$atype' ";
131 $types = explode(' ', $atype);
133 foreach ($types as $type) {
136 $aspect = " aspect='selector' rel = '$value'";
137 $value = _("Select");
138 if ($icon===false) $icon=ICON_SUBMIT; break;
141 if ($icon===false) $icon=ICON_SUBMIT; break;
144 if ($icon===false) $icon=ICON_ESCAPE; break;
151 $submit_str = "<button class=\""
152 .($atype ? 'ajaxsubmit' : 'inputsubmit')
153 ."\" type=\"submit\""
155 ." name=\"$name\" id=\"$name\" value=\"$value\""
156 .($title ? " title='$title'" : '')
158 .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon' height='12'>" : '')
159 ."<span>$value</span>"
167 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
169 if ($echo) echo "<center>";
170 submit($name, $value, $echo, $title, $async, $icon);
171 if ($echo) echo "</center>";
174 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
177 submit($name, $value, true, $title, $async, $icon);
181 function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
184 submit($name, $value, true, $title, $async, $icon);
188 For following controls:
189 'both' - use both Ctrl-Enter and Escape hotkeys
190 'cancel' - apply to 'RESET' button
192 function submit_add_or_update($add=true, $title=false, $async=false, $clone=false)
196 if ($async === 'both') {
197 $async = 'default'; $cancel = 'cancel';
199 else if ($async === 'default')
201 else if ($async === 'cancel')
205 submit('ADD_ITEM', _("Add new"), true, $title, $async);
207 submit('UPDATE_ITEM', _("Update"), true, _('Submit changes'), $async);
208 if ($clone) submit('CLONE', _("Clone"), true,
209 _('Edit new record with current data'), $async);
210 submit('RESET', _("Cancel"), true, _('Cancel edition'), $cancel);
214 function submit_add_or_update_center($add=true, $title=false, $async=false, $clone=false)
217 submit_add_or_update($add, $title, $async, $clone);
221 function submit_add_or_update_row($add=true, $right=true, $extra="", $title=false, $async=false, $clone = false)
225 echo "<td> </td>\n";
227 submit_add_or_update($add, $title, $async, $clone);
231 function submit_cells($name, $value, $extra="", $title=false, $async=false)
234 submit($name, $value, true, $title, $async);
238 function submit_row($name, $value, $right=true, $extra="", $title=false, $async=false)
242 echo "<td> </td>\n";
243 submit_cells($name, $value, $extra, $title, $async);
247 function submit_return($name, $value, $title=false)
249 if (@$_REQUEST['popup']) {
250 submit($name, $value, true, $title, 'selector');
254 function submit_js_confirm($name, $msg, $set = true) {
256 $js = "_validate.$name=".($set ? "function(){ return confirm('"
257 . strtr($msg, array("\n"=>'\\n')) . "');};"
260 $Ajax->addScript(true, $js);
264 //-----------------------------------------------------------------------------------
266 function set_icon($icon, $title=false)
268 global $path_to_root;
269 if (basename($icon) === $icon) // standard icons does not contain path separator
270 $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
271 return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." />\n";
274 function button($name, $value, $title=false, $icon=false, $aspect='')
276 // php silently changes dots,spaces,'[' and characters 128-159
277 // to underscore in POST names, to maintain compatibility with register_globals
279 if ($aspect == 'selector') {
280 $rel = " rel='$value'";
281 $value = _("Select");
283 if (user_graphic_links() && $icon)
285 if ($value == _("Delete")) // Helper during implementation
287 return "<button type='submit' class='editbutton' name='"
288 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
290 ."' value='1'" . ($title ? " title='$title'":" title='$value'")
291 . ($aspect ? " aspect='$aspect'" : '')
293 ." />".set_icon($icon)."</button>\n";
296 return "<input type='submit' class='editbutton' name='"
297 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
300 .($title ? " title='$title'":'')
301 . ($aspect ? " aspect='$aspect'" : '')
306 function button_cell($name, $value, $title=false, $icon=false, $aspect='')
308 echo "<td align='center'>";
309 echo button($name, $value, $title, $icon, $aspect);
313 function delete_button_cell($name, $value, $title=false)
315 button_cell($name, $value, $title, ICON_DELETE);
318 function edit_button_cell($name, $value, $title=false)
320 button_cell($name, $value, $title, ICON_EDIT);
323 function select_button_cell($name, $value, $title=false)
325 button_cell($name, $value, $title, ICON_ADD, 'selector');
327 //-----------------------------------------------------------------------------------
329 function check_value($name)
331 if (!isset($_POST[$name]))
336 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
343 $str .= $label . " ";
344 if ($submit_on_change !== false) {
345 if ($submit_on_change === true)
347 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
350 $value = get_post($name,0);
353 .($value == 1 ? ' checked':'')
354 ." type='checkbox' name='$name' value='1'"
355 .($submit_on_change ? " onclick='$submit_on_change'" : '')
356 .($title ? " title='$title'" : '')
359 $Ajax->addUpdate($name, $name, $value);
363 function check($label, $name, $value=null, $submit_on_change=false, $title=false)
365 echo checkbox($label, $name, $value, $submit_on_change, $title);
368 function check_cells($label, $name, $value=null, $submit_on_change=false, $title=false,
372 echo "<td>$label</td>\n";
374 echo check(null, $name, $value, $submit_on_change, $title);
378 function check_row($label, $name, $value=null, $submit_on_change=false, $title=false)
380 echo "<tr><td class='label'>$label</td>";
381 echo check_cells(NULL, $name, $value, $submit_on_change, $title);
385 //-----------------------------------------------------------------------------------
386 function radio($label, $name, $value, $selected=null, $submit_on_change=false)
388 if (!isset($selected))
389 $selected = get_post($name) == $value;
391 if ($submit_on_change === true)
393 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
395 return "<input type='radio' name=$name value='$value' ".($selected ? "checked":'')
396 .($submit_on_change ? " onclick='$submit_on_change'" : '')
397 .">".($label ? $label : '');
400 //-----------------------------------------------------------------------------------
401 function labelheader_cell($label, $params="")
403 echo "<td class='tableheader' $params>$label</td>\n";
406 function label_cell($label, $params="", $id=null)
412 $params .= " id='$id'";
413 $Ajax->addUpdate($id, $id, $label);
415 echo "<td $params>$label</td>\n";
420 function email_cell($label, $params="", $id=null)
422 label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
425 function amount_decimal_cell($label, $params="", $id=null)
428 label_cell(price_decimal_format($label, $dec), "nowrap align=right ".$params, $id);
431 function amount_cell($label, $bold=false, $params="", $id=null)
434 label_cell("<b>".price_format($label)."</b>", "nowrap align=right ".$params, $id);
436 label_cell(price_format($label), "nowrap align=right ".$params, $id);
439 //JAM Allow entered unit prices to be fractional
440 function unit_amount_cell($label, $bold=false, $params="", $id=null)
443 label_cell("<b>".unit_price_format($label)."</b>", "nowrap align=right ".$params, $id);
445 label_cell(unit_price_format($label), "nowrap align=right ".$params, $id);
449 function percent_cell($label, $bold=false, $id=null)
452 label_cell("<b>".percent_format($label)."</b>", "nowrap align=right", $id);
454 label_cell(percent_format($label), "nowrap align=right", $id);
456 // 2008-06-15. Changed
457 function qty_cell($label, $bold=false, $dec=null, $id=null)
460 $dec = get_qty_dec();
462 label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
464 label_cell(number_format2($label, $dec), "nowrap align=right", $id);
467 function label_cells($label, $value, $params="", $params2="", $id='')
470 echo "<td $params>$label</td>\n";
471 label_cell($value, $params2, $id);
474 function label_row($label, $value, $params="", $params2="", $leftfill=0, $id='')
479 echo "<td class='label'>$label</td>";
482 label_cells($label, $value, $params, $params2, $id);
484 echo "<td colspan=$leftfill></td>";
488 //-----------------------------------------------------------------------------------
490 function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
491 $labparams="", $post_label="", $inparams="")
495 default_focus($name);
497 label_cell($label, $labparams);
501 $value = get_post($name);
502 echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
503 .($title ? " title='$title'" : '')
506 if ($post_label != "")
507 echo " " . $post_label;
510 $Ajax->addUpdate($name, $name, $value);
513 function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
514 $labparams=null, $post_label=null, $submit_on_change=false)
518 default_focus($name);
519 if (!isset($_POST[$name]) || $_POST[$name] == "")
522 $_POST[$name] = $init;
527 label_cell($label, $labparams);
533 $class = $submit_on_change ? 'class="searchbox"' : '';
534 echo "<input $class type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"" . $_POST[$name]. "\""
535 .($title ? " title='$title'": '')." >";
538 echo " " . $post_label;
541 $Ajax->addUpdate($name, $name, $_POST[$name]);
544 function text_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
546 echo "<tr><td class='label'>$label</td>";
547 text_cells(null, $name, $value, $size, $max, $title, $params, $post_label);
552 //-----------------------------------------------------------------------------------
554 function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
556 echo "<tr><td class='label'>$label</td>";
557 text_cells_ex(null, $name, $size, $max, $value, $title, $params, $post_label);
562 //-----------------------------------------------------------------------------------
563 function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
566 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
567 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
570 function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
573 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
574 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
577 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
579 $val = get_post($name);
581 if (strpos($val,'http://')===false)
582 $val = 'http://'.$val;
583 $label = "<a href='$val' target='_blank'>$label</a>";
585 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
588 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
590 $val = get_post($name);
592 if (strpos($val,'http://')===false)
593 $val = 'http://'.$val;
594 $label = "<a href='$val' target='_blank'>$label</a>";
596 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
599 //-----------------------------------------------------------------------------------
601 // Since FA 2.2 $init parameter is superseded by $check.
602 // When $check!=null current date is displayed in red when set to other
603 // than current date.
605 function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
606 $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
608 global $use_date_picker, $path_to_root, $Ajax;
610 if (!isset($_POST[$name]) || $_POST[$name] == "")
612 if ($inc_years == 1001)
613 $_POST[$name] = null;
618 $dd = add_days($dd, $inc_days);
619 if ($inc_months != 0)
620 $dd = add_months($dd, $inc_months);
622 $dd = add_years($dd, $inc_years);
626 if ($use_date_picker)
628 $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ?
629 "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
630 $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
631 . " <img src='$calc_image' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
637 label_cell($label, $params);
641 $class = $submit_on_change ? 'date active' : 'date';
643 $aspect = $check ? 'aspect="cdate"' : '';
644 if ($check && (get_post($name) != Today()))
645 $aspect .= ' style="color:#FF0000"';
647 default_focus($name);
648 $size = (user_date_format()>3)?11:10;
649 echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"$size\" maxlength=\"12\" value=\""
650 . $_POST[$name]. "\""
651 .($title ? " title='$title'": '')." > $post_label";
653 $Ajax->addUpdate($name, $name, $_POST[$name]);
656 function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0,
657 $inc_years=0, $params=null, $submit_on_change=false)
659 echo "<tr><td class='label'>$label</td>";
660 date_cells(null, $name, $title, $check, $inc_days, $inc_months,
661 $inc_years, $params, $submit_on_change);
665 //-----------------------------------------------------------------------------------
666 function password_row($label, $name, $value)
668 echo "<tr><td class='label'>$label</td>";
669 label_cell("<input type='password' name='$name' size=20 maxlength=20 value='$value' />");
673 //-----------------------------------------------------------------------------------
674 function file_cells($label, $name, $id="")
678 label_cells($label, "<input type='file' name='$name' $id />");
680 function file_row($label, $name, $id = "")
682 echo "<tr><td class='label'>$label</td>";
683 file_cells(null, $name, $id);
687 //-----------------------------------------------------------------------------------
689 function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit_on_change=false)
691 text_cells_ex($label, $name, 16, 18, $init, $title, $params, null, $submit_on_change);
694 //-----------------------------------------------------------------------------------
696 function ref_row($label, $name, $title=null, $init=null, $submit_on_change=false)
698 echo "<tr><td class='label'>$label</td>";
699 ref_cells(null, $name, $title, $init, null, $submit_on_change);
703 //-----------------------------------------------------------------------------------
705 function percent_row($label, $name, $init=null)
708 if (!isset($_POST[$name]) || $_POST[$name]=="")
710 $_POST[$name] = $init == null ? '' : $init;
713 small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
716 function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
721 $dec = user_price_dec();
722 if (!isset($_POST[$name]) || $_POST[$name] == "")
725 $_POST[$name] = $init;
732 $params = "class='label'";
733 label_cell($label, $params);
741 echo "<td align='right'>";
743 echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
746 echo "<span id='_{$name}_label'> $post_label</span>";
747 $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
750 $Ajax->addUpdate($name, $name, $_POST[$name]);
751 $Ajax->addAssign($name, $name, 'dec', $dec);
755 //-----------------------------------------------------------------------------------
757 function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
759 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
762 //JAM Allow entered unit prices to be fractional
763 function unit_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
766 $dec = user_price_dec()+2;
768 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec+2);
771 function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
774 amount_cells($label, $name, $init, $params, $post_label, $dec);
778 function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
781 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
785 //-----------------------------------------------------------------------------------
787 function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
790 $dec = user_qty_dec();
792 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
795 function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
798 $dec = user_qty_dec();
801 amount_cells($label, $name, $init, $params, $post_label, $dec);
805 function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
808 $dec = user_qty_dec();
811 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
815 //-----------------------------------------------------------------------------------
817 function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
819 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
822 //-----------------------------------------------------------------------------------
824 function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
827 $dec = user_qty_dec();
828 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
831 //-----------------------------------------------------------------------------------
833 function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
837 default_focus($name);
839 echo "<td $params>$label</td>\n";
841 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
842 echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
843 .($title ? " title='$title'" : '')
844 .">$value</textarea></td>\n";
845 $Ajax->addUpdate($name, $name, $value);
848 function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
850 echo "<tr><td class='label'>$label</td>";
851 textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
855 //-----------------------------------------------------------------------------------
857 function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
861 default_focus($name);
862 echo "<tr><td>$label</td>\n";
866 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
867 echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\"> ";
869 submit($input_name, $input_value);
872 $Ajax->addUpdate($name, $name, $value);
875 //-----------------------------------------------------------------------------------
877 // When show_inactive page option is set
878 // displays value of inactive field as checkbox cell.
879 // Also updates database record after status change.
881 function inactive_control_cell($id, $value, $table, $key)
885 $name = "Inactive". $id;
886 $value = $value ? 1:0;
888 if (check_value('show_inactive')) {
889 if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') ||
890 get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
891 update_record_status($id, !$value, $table, $key);
893 echo '<td align="center">'. checkbox(null, $name, $value, true, '')
894 . hidden("LInact[$id]", $value, false) . '</td>';
898 // Displays controls for optional display of inactive records
900 function inactive_control_row($th) {
901 echo "<tr><td colspan=".(count($th)).">"
902 ."<div style='float:left;'>"
903 . checkbox(null, 'show_inactive', null, true). _("Show also Inactive")
904 ."</div><div style='float:right;'>"
905 . submit('Update', _('Update'), false, '', null)
909 // Inserts additional column header when display of inactive records is on.
911 function inactive_control_column(&$th) {
914 if (check_value('show_inactive'))
915 array_insert($th, count($th)-2 , _("Inactive"));
916 if (get_post('_show_inactive_update')) {
917 $Ajax->activate('_page_body');
921 function customer_credit_row($customer, $credit, $parms='')
923 global $path_to_root;
925 label_row( _("Current Credit:"),
926 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
927 ."href='$path_to_root/sales/inquiry/customer_inquiry.php?customer_id=".$customer."'"
928 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
929 . price_format($credit)
933 function supplier_credit_row($supplier, $credit, $parms='')
935 global $path_to_root;
937 label_row( _("Current Credit:"),
938 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
939 ."href='$path_to_root/purchasing/inquiry/supplier_inquiry.php?supplier_id=".$supplier."'"
940 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
941 . price_format($credit)
945 function bank_balance_row($bank_acc, $parms='')
947 global $path_to_root;
949 $to = add_days(Today(), 1);
950 $bal = get_balance_before_for_bank_account($bank_acc, $to);
951 label_row( _("Bank Balance:"),
952 "<a target='_blank' " . ($bal<0 ? 'class="redfg"' : '')
953 ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."'"
954 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" > "