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 //---------------------------------------------------------------------------------
88 $hidden_fields = array(); // store for hiddn fields attached just before form end (for proper html validation)
90 function hidden($name, $value=null, $echo=true)
92 global $Ajax, $hidden_fields;
95 $value = get_post($name);
97 $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
98 $Ajax->addUpdate($name, $name, $value);
100 $hidden_fields[] = $ret;
105 Universal submit form button.
106 $atype - type of submit:
108 false - normal button; optional icon
109 null - button visible only in fallback mode; optional icon
111 true - standard button; optional icon
113 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
114 'selector' - ditto with closing current popup editor window
115 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
116 'process' - displays progress bar during call; optional icon
117 'nonajax' - ditto, non-ajax submit
119 $atype can contain also multiply type selectors separated by space,
120 however make sense only combination of 'process' and one of defualt/selector/cancel
122 function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
124 global $path_to_root;
127 if ($atype === null) {
128 $aspect = fallback_mode() ? " aspect='fallback'" : " style='display:none;'";
130 } elseif (!is_bool($atype)) { // necessary: switch uses '=='
132 $aspect = " aspect='$atype' ";
133 $types = explode(' ', $atype);
135 foreach ($types as $type) {
138 $aspect = " aspect='selector' rel = '$value'";
139 $value = _("Select");
140 if ($icon===false) $icon=ICON_SUBMIT; break;
143 if ($icon===false) $icon=ICON_SUBMIT; break;
146 if ($icon===false) $icon=ICON_ESCAPE; break;
153 $submit_str = "<button class=\""
154 .($atype ? 'ajaxsubmit' : 'inputsubmit')
155 ."\" type=\"submit\""
157 ." name=\"$name\" id=\"$name\" value=\"$value\""
158 .($title ? " title='$title'" : '')
160 .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon' height='12' alt=''>" : '')
161 ."<span>$value</span>"
169 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
171 if ($echo) echo "<center>";
172 submit($name, $value, $echo, $title, $async, $icon);
173 if ($echo) echo "</center>";
176 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
179 submit($name, $value, true, $title, $async, $icon);
183 function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
186 submit($name, $value, true, $title, $async, $icon);
190 For following controls:
191 'both' - use both Ctrl-Enter and Escape hotkeys
192 'cancel' - apply to 'RESET' button
194 function submit_add_or_update($add=true, $title=false, $async=false, $clone=false)
198 if ($async === 'both') {
199 $async = 'default'; $cancel = 'cancel';
201 else if ($async === 'default')
203 else if ($async === 'cancel')
207 submit('ADD_ITEM', _("Add new"), true, $title, $async);
209 submit('UPDATE_ITEM', _("Update"), true, _('Submit changes'), $async);
210 if ($clone) submit('CLONE', _("Clone"), true,
211 _('Edit new record with current data'), $async);
212 submit('RESET', _("Cancel"), true, _('Cancel edition'), $cancel);
216 function submit_add_or_update_center($add=true, $title=false, $async=false, $clone=false)
219 submit_add_or_update($add, $title, $async, $clone);
223 function submit_add_or_update_row($add=true, $right=true, $extra="", $title=false, $async=false, $clone = false)
227 echo "<td> </td>\n";
229 submit_add_or_update($add, $title, $async, $clone);
233 function submit_cells($name, $value, $extra="", $title=false, $async=false)
236 submit($name, $value, true, $title, $async);
240 function submit_row($name, $value, $right=true, $extra="", $title=false, $async=false)
244 echo "<td> </td>\n";
245 submit_cells($name, $value, $extra, $title, $async);
249 function submit_return($name, $value, $title=false)
251 if (@$_REQUEST['popup']) {
252 submit($name, $value, true, $title, 'selector');
256 function submit_js_confirm($name, $msg, $set = true) {
258 $js = "_validate.$name=".($set ? "function(){ return confirm('"
259 . strtr($msg, array("\n"=>'\\n')) . "');};"
262 $Ajax->addScript(true, $js);
266 //-----------------------------------------------------------------------------------
268 function set_icon($icon, $title=false)
270 global $path_to_root;
271 if (basename($icon) === $icon) // standard icons does not contain path separator
272 $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
273 return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";
276 function button($name, $value, $title=false, $icon=false, $aspect='')
278 // php silently changes dots,spaces,'[' and characters 128-159
279 // to underscore in POST names, to maintain compatibility with register_globals
281 if ($aspect == 'selector') {
282 $rel = " rel='$value'";
283 $value = _("Select");
285 if (user_graphic_links() && $icon)
287 if ($value == _("Delete")) // Helper during implementation
289 return "<button type='submit' class='editbutton' name='"
290 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
292 ."' value='1'" . ($title ? " title='$title'":" title='$value'")
293 . ($aspect ? " aspect='$aspect'" : '')
295 ." >".set_icon($icon)."</button>\n";
298 return "<input type='submit' class='editbutton' name='"
299 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
302 .($title ? " title='$title'":'')
303 . ($aspect ? " aspect='$aspect'" : '')
308 function button_cell($name, $value, $title=false, $icon=false, $aspect='')
310 echo "<td align='center'>";
311 echo button($name, $value, $title, $icon, $aspect);
315 function delete_button_cell($name, $value, $title=false)
317 button_cell($name, $value, $title, ICON_DELETE);
320 function edit_button_cell($name, $value, $title=false)
322 button_cell($name, $value, $title, ICON_EDIT);
325 function select_button_cell($name, $value, $title=false)
327 button_cell($name, $value, $title, ICON_ADD, 'selector');
329 //-----------------------------------------------------------------------------------
331 function check_value($name)
333 if (!isset($_POST[$name]))
338 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
345 $str .= $label . " ";
346 if ($submit_on_change !== false) {
347 if ($submit_on_change === true)
349 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
352 $value = get_post($name,0);
355 .($value == 1 ? ' checked':'')
356 ." type='checkbox' name='$name' value='1'"
357 .($submit_on_change ? " onclick='$submit_on_change'" : '')
358 .($title ? " title='$title'" : '')
361 $Ajax->addUpdate($name, $name, $value);
365 function check($label, $name, $value=null, $submit_on_change=false, $title=false)
367 echo checkbox($label, $name, $value, $submit_on_change, $title);
370 function check_cells($label, $name, $value=null, $submit_on_change=false, $title=false,
374 echo "<td>$label</td>\n";
376 echo check(null, $name, $value, $submit_on_change, $title);
380 function check_row($label, $name, $value=null, $submit_on_change=false, $title=false)
382 echo "<tr><td class='label'>$label</td>";
383 echo check_cells(NULL, $name, $value, $submit_on_change, $title);
387 //-----------------------------------------------------------------------------------
388 function radio($label, $name, $value, $selected=null, $submit_on_change=false)
390 if (!isset($selected))
391 $selected = get_post($name) === (string)$value;
393 if ($submit_on_change === true)
395 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
397 return "<input type='radio' name=$name value='$value' ".($selected ? "checked":'')
398 .($submit_on_change ? " onclick='$submit_on_change'" : '')
399 .">".($label ? $label : '');
402 //-----------------------------------------------------------------------------------
403 function labelheader_cell($label, $params="")
405 echo "<td class='tableheader' $params>$label</td>\n";
408 function label_cell($label, $params="", $id=null)
414 $params .= " id='$id'";
415 $Ajax->addUpdate($id, $id, $label);
417 echo "<td $params>$label</td>\n";
422 function email_cell($label, $params="", $id=null)
424 label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
427 function amount_decimal_cell($label, $params="", $id=null)
430 label_cell(price_decimal_format($label, $dec), "nowrap align=right ".$params, $id);
433 function amount_cell($label, $bold=false, $params="", $id=null)
436 label_cell("<b>".price_format($label)."</b>", "nowrap align=right ".$params, $id);
438 label_cell(price_format($label), "nowrap align=right ".$params, $id);
441 //JAM Allow entered unit prices to be fractional
442 function unit_amount_cell($label, $bold=false, $params="", $id=null)
445 label_cell("<b>".unit_price_format($label)."</b>", "nowrap align=right ".$params, $id);
447 label_cell(unit_price_format($label), "nowrap align=right ".$params, $id);
451 function percent_cell($label, $bold=false, $id=null)
454 label_cell("<b>".percent_format($label)."</b>", "nowrap align=right", $id);
456 label_cell(percent_format($label), "nowrap align=right", $id);
458 // 2008-06-15. Changed
459 function qty_cell($label, $bold=false, $dec=null, $id=null)
462 $dec = get_qty_dec();
464 label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
466 label_cell(number_format2($label, $dec), "nowrap align=right", $id);
469 function label_cells($label, $value, $params="", $params2="", $id=null)
472 echo "<td $params>$label</td>\n";
473 label_cell($value, $params2, $id);
476 function label_row($label, $value, $params="", $params2="", $leftfill=0, $id=null)
481 echo "<td class='label'>$label</td>";
484 label_cells($label, $value, $params, $params2, $id);
486 echo "<td colspan=$leftfill></td>";
490 //-----------------------------------------------------------------------------------
492 function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
493 $labparams="", $post_label="", $inparams="")
497 default_focus($name);
499 label_cell($label, $labparams);
503 $value = get_post($name);
504 echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
505 .($title ? " title='$title'" : '')
508 if ($post_label != "")
509 echo " " . $post_label;
512 $Ajax->addUpdate($name, $name, $value);
515 function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
516 $labparams=null, $post_label=null, $submit_on_change=false)
520 default_focus($name);
521 if (!isset($_POST[$name]) || $_POST[$name] == "")
524 $_POST[$name] = $init;
529 label_cell($label, $labparams);
535 $class = $submit_on_change ? 'class="searchbox"' : '';
536 echo "<input $class type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"" . $_POST[$name]. "\""
537 .($title ? " title='$title'": '')." >";
540 echo " " . $post_label;
543 $Ajax->addUpdate($name, $name, $_POST[$name]);
546 function text_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
548 echo "<tr><td class='label'>$label</td>";
549 text_cells(null, $name, $value, $size, $max, $title, $params, $post_label);
554 //-----------------------------------------------------------------------------------
556 function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
558 echo "<tr><td class='label'>$label</td>";
559 text_cells_ex(null, $name, $size, $max, $value, $title, $params, $post_label);
564 //-----------------------------------------------------------------------------------
565 function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
568 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
569 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
572 function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
575 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
576 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
579 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
581 $val = get_post($name);
583 if (strpos($val,'http://')===false)
584 $val = 'http://'.$val;
585 $label = "<a href='$val' target='_blank'>$label</a>";
587 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
590 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
592 $val = get_post($name);
594 if (strpos($val,'http://')===false)
595 $val = 'http://'.$val;
596 $label = "<a href='$val' target='_blank'>$label</a>";
598 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
601 //-----------------------------------------------------------------------------------
603 // Since FA 2.2 $init parameter is superseded by $check.
604 // When $check!=null current date is displayed in red when set to other
605 // than current date.
607 function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
608 $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
610 global $path_to_root, $Ajax;
612 if (!isset($_POST[$name]) || $_POST[$name] == "")
614 if ($inc_years == 1001)
615 $_POST[$name] = null;
620 $dd = add_days($dd, $inc_days);
621 if ($inc_months != 0)
622 $dd = add_months($dd, $inc_months);
624 $dd = add_years($dd, $inc_years);
628 if (user_use_date_picker())
630 $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ?
631 "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
632 $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
633 . " <img src='$calc_image' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
639 label_cell($label, $params);
643 $class = $submit_on_change ? 'date active' : 'date';
645 $aspect = $check ? 'aspect="cdate"' : '';
646 if ($check && (get_post($name) != Today()))
647 $aspect .= ' style="color:#FF0000"';
649 default_focus($name);
650 $size = (user_date_format()>3)?11:10;
651 echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"$size\" maxlength=\"12\" value=\""
652 . $_POST[$name]. "\""
653 .($title ? " title='$title'": '')." > $post_label";
655 $Ajax->addUpdate($name, $name, $_POST[$name]);
658 function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0,
659 $inc_years=0, $params=null, $submit_on_change=false)
661 echo "<tr><td class='label'>$label</td>";
662 date_cells(null, $name, $title, $check, $inc_days, $inc_months,
663 $inc_years, $params, $submit_on_change);
667 //-----------------------------------------------------------------------------------
668 function password_row($label, $name, $value)
670 echo "<tr><td class='label'>$label</td>";
671 label_cell("<input type='password' name='$name' size=20 maxlength=20 value='$value' >");
675 //-----------------------------------------------------------------------------------
676 function file_cells($label, $name, $id="")
680 label_cells($label, "<input type='file' name='$name' $id >");
682 function file_row($label, $name, $id = "")
684 echo "<tr><td class='label'>$label</td>";
685 file_cells(null, $name, $id);
689 //-----------------------------------------------------------------------------------
691 function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit_on_change=false)
693 text_cells_ex($label, $name, 16, 18, $init, $title, $params, null, $submit_on_change);
696 //-----------------------------------------------------------------------------------
698 function ref_row($label, $name, $title=null, $init=null, $submit_on_change=false)
700 echo "<tr><td class='label'>$label</td>";
701 ref_cells(null, $name, $title, $init, null, $submit_on_change);
705 //-----------------------------------------------------------------------------------
707 function percent_row($label, $name, $init=null)
710 if (!isset($_POST[$name]) || $_POST[$name]=="")
712 $_POST[$name] = $init == null ? '' : $init;
715 small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
718 function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
723 $dec = user_price_dec();
724 if (!isset($_POST[$name]) || $_POST[$name] == "")
727 $_POST[$name] = $init;
734 $params = "class='label'";
735 label_cell($label, $params);
743 echo "<td align='right'>";
745 echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
748 echo "<span id='_{$name}_label'> $post_label</span>";
749 $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
752 $Ajax->addUpdate($name, $name, $_POST[$name]);
753 $Ajax->addAssign($name, $name, 'dec', $dec);
757 //-----------------------------------------------------------------------------------
759 function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
761 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
764 //JAM Allow entered unit prices to be fractional
765 function unit_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
768 $dec = user_price_dec()+2;
770 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec+2);
773 function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
776 amount_cells($label, $name, $init, $params, $post_label, $dec);
780 function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
783 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
787 //-----------------------------------------------------------------------------------
789 function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
792 $dec = user_qty_dec();
794 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
797 function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
800 $dec = user_qty_dec();
803 amount_cells($label, $name, $init, $params, $post_label, $dec);
807 function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
810 $dec = user_qty_dec();
813 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
817 //-----------------------------------------------------------------------------------
819 function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
821 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
824 //-----------------------------------------------------------------------------------
826 function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
829 $dec = user_qty_dec();
830 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
833 //-----------------------------------------------------------------------------------
835 function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
839 default_focus($name);
841 echo "<td $params>$label</td>\n";
843 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
844 echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
845 .($title ? " title='$title'" : '')
846 .">$value</textarea></td>\n";
847 $Ajax->addUpdate($name, $name, $value);
850 function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
852 echo "<tr><td class='label'>$label</td>";
853 textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
857 //-----------------------------------------------------------------------------------
859 function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
863 default_focus($name);
864 echo "<tr><td>$label</td>\n";
868 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
869 echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\"> ";
871 submit($input_name, $input_value);
874 $Ajax->addUpdate($name, $name, $value);
877 //-----------------------------------------------------------------------------------
879 // When show_inactive page option is set
880 // displays value of inactive field as checkbox cell.
881 // Also updates database record after status change.
883 function inactive_control_cell($id, $value, $table, $key)
887 $name = "Inactive". $id;
888 $value = $value ? 1:0;
890 if (check_value('show_inactive')) {
891 if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') ||
892 get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
893 update_record_status($id, !$value, $table, $key);
895 echo '<td align="center">'. checkbox(null, $name, $value, true, '')
896 . hidden("LInact[$id]", $value, false) . '</td>';
900 // Displays controls for optional display of inactive records
902 function inactive_control_row($th) {
903 echo "<tr><td colspan=".(count($th)).">"
904 ."<div style='float:left;'>"
905 . checkbox(null, 'show_inactive', null, true). _("Show also Inactive")
906 ."</div><div style='float:right;'>"
907 . submit('Update', _('Update'), false, '', null)
911 // Inserts additional column header when display of inactive records is on.
913 function inactive_control_column(&$th) {
916 if (check_value('show_inactive'))
917 array_insert($th, count($th)-2 , _("Inactive"));
918 if (get_post('_show_inactive_update')) {
919 $Ajax->activate('_page_body');
923 function customer_credit_row($customer, $credit, $parms='')
925 global $path_to_root;
927 label_row( _("Current Credit:"),
928 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
929 ."href='$path_to_root/sales/inquiry/customer_inquiry.php?customer_id=".$customer."'"
930 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
931 . price_format($credit)
935 function supplier_credit_row($supplier, $credit, $parms='')
937 global $path_to_root;
939 label_row( _("Current Credit:"),
940 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
941 ."href='$path_to_root/purchasing/inquiry/supplier_inquiry.php?supplier_id=".$supplier."'"
942 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
943 . price_format($credit)
947 function bank_balance_row($bank_acc, $parms='')
949 global $path_to_root;
951 $to = add_days(Today(), 1);
952 $bal = get_balance_before_for_bank_account($bank_acc, $to);
953 label_row( _("Bank Balance:"),
954 "<a target='_blank' " . ($bal<0 ? 'class="redfg"' : '')
955 ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."'"
956 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" > "