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;
42 Returns true if input $name with $submit_on_change option set is subject to update.
44 function input_changed($name)
46 return isset($_POST['_'.$name.'_changed']);
49 //------------------------------------------------------------------------------
51 // Helper function for simple db table editor pages
53 function simple_page_mode($numeric_id = true)
55 global $Ajax, $Mode, $selected_id;
57 $default = $numeric_id ? -1 : '';
58 $selected_id = get_post('selected_id', $default);
59 foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET', 'CLONE') as $m) {
60 if (isset($_POST[$m])) {
61 $Ajax->activate('_page_body');
62 if ($m == 'RESET' || $m == 'CLONE')
63 $selected_id = $default;
64 unset($_POST['_focus']);
68 foreach (array('Edit', 'Delete') as $m) {
69 foreach ($_POST as $p => $pvar) {
70 if (strpos($p, $m) === 0) {
71 // $selected_id = strtr(substr($p, strlen($m)), array('%2E'=>'.'));
72 unset($_POST['_focus']); // focus on first form entry
73 $selected_id = quoted_printable_decode(substr($p, strlen($m)));
74 $Ajax->activate('_page_body');
83 //------------------------------------------------------------------------------
85 // Read numeric value from user formatted input
87 function input_num($postname=null, $dflt=0)
89 if (!isset($_POST[$postname]) || $_POST[$postname] == "")
92 return user_numeric($_POST[$postname]);
95 //---------------------------------------------------------------------------------
96 $hidden_fields = array(); // store for hiddn fields attached just before form end (for proper html validation)
98 function hidden($name, $value=null, $echo=true)
100 global $Ajax, $hidden_fields;
103 $value = get_post($name);
105 $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
106 $Ajax->addUpdate($name, $name, $value);
108 $hidden_fields[] = $ret;
113 Universal submit form button.
114 $atype - type of submit:
116 false - normal button; optional icon
117 null - button visible only in fallback mode; optional icon
119 true - standard button; optional icon
121 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
122 'selector' - ditto with closing current popup editor window
123 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
124 'process' - displays progress bar during call; optional icon
125 'nonajax' - ditto, non-ajax submit
127 $atype can contain also multiply type selectors separated by space,
128 however make sense only combination of 'process' and one of defualt/selector/cancel
130 function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
132 global $path_to_root;
135 if ($atype === null) {
136 $aspect = fallback_mode() ? " aspect='fallback'" : " style='display:none;'";
138 } elseif (!is_bool($atype)) { // necessary: switch uses '=='
140 $aspect = " aspect='$atype' ";
141 $types = explode(' ', $atype);
143 foreach ($types as $type) {
146 $aspect = " aspect='selector' rel = '$value'";
147 $value = _("Select");
148 if ($icon===false) $icon=ICON_SUBMIT; break;
151 if ($icon===false) $icon=ICON_SUBMIT; break;
154 if ($icon===false) $icon=ICON_ESCAPE; break;
161 $submit_str = "<button class=\""
162 .($atype ? 'ajaxsubmit' : 'inputsubmit')
163 ."\" type=\"submit\""
165 ." name=\"$name\" id=\"$name\" value=\"$value\""
166 .($title ? " title='$title'" : '')
168 .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon' height='12' alt=''>" : '')
169 ."<span>$value</span>"
177 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
179 if ($echo) echo "<center>";
180 submit($name, $value, $echo, $title, $async, $icon);
181 if ($echo) echo "</center>";
184 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
187 submit($name, $value, true, $title, $async, $icon);
191 function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
194 submit($name, $value, true, $title, $async, $icon);
198 For following controls:
199 'both' - use both Ctrl-Enter and Escape hotkeys
200 'cancel' - apply to 'RESET' button
202 function submit_add_or_update($add=true, $title=false, $async=false, $clone=false)
206 if ($async === 'both') {
207 $async = 'default'; $cancel = 'cancel';
209 else if ($async === 'default')
211 else if ($async === 'cancel')
215 submit('ADD_ITEM', _("Add new"), true, $title, $async);
217 submit('UPDATE_ITEM', _("Update"), true, _('Submit changes'), $async);
218 if ($clone) submit('CLONE', _("Clone"), true,
219 _('Edit new record with current data'), $async);
220 submit('RESET', _("Cancel"), true, _('Cancel edition'), $cancel);
224 function submit_add_or_update_center($add=true, $title=false, $async=false, $clone=false)
227 submit_add_or_update($add, $title, $async, $clone);
231 function submit_add_or_update_row($add=true, $right=true, $extra="", $title=false, $async=false, $clone = false)
235 echo "<td> </td>\n";
237 submit_add_or_update($add, $title, $async, $clone);
241 function submit_cells($name, $value, $extra="", $title=false, $async=false)
244 submit($name, $value, true, $title, $async);
248 function submit_row($name, $value, $right=true, $extra="", $title=false, $async=false)
252 echo "<td> </td>\n";
253 submit_cells($name, $value, $extra, $title, $async);
257 function submit_return($name, $value, $title=false)
259 if (@$_REQUEST['popup']) {
260 submit($name, $value, true, $title, 'selector');
264 function submit_js_confirm($name, $msg, $set = true) {
266 $js = "_validate.$name=".($set ? "function(){ return confirm('"
267 . strtr($msg, array("\n"=>'\\n')) . "');};"
270 $Ajax->addScript(true, $js);
274 //-----------------------------------------------------------------------------------
276 function set_icon($icon, $title=false)
278 global $path_to_root;
279 if (basename($icon) === $icon) // standard icons does not contain path separator
280 $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
281 return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";
284 function button($name, $value, $title=false, $icon=false, $aspect='')
286 // php silently changes dots,spaces,'[' and characters 128-159
287 // to underscore in POST names, to maintain compatibility with register_globals
289 if ($aspect == 'selector') {
290 $rel = " rel='$value'";
291 $value = _("Select");
293 if (user_graphic_links() && $icon)
295 if ($value == _("Delete")) // Helper during implementation
297 return "<button type='submit' class='editbutton' name='"
298 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
300 ."' value='1'" . ($title ? " title='$title'":" title='$value'")
301 . ($aspect ? " aspect='$aspect'" : '')
303 ." >".set_icon($icon)."</button>\n";
306 return "<input type='submit' class='editbutton' name='"
307 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
310 .($title ? " title='$title'":'')
311 . ($aspect ? " aspect='$aspect'" : '')
316 function button_cell($name, $value, $title=false, $icon=false, $aspect='')
318 echo "<td align='center'>";
319 echo button($name, $value, $title, $icon, $aspect);
323 function delete_button_cell($name, $value, $title=false)
325 button_cell($name, $value, $title, ICON_DELETE);
328 function edit_button_cell($name, $value, $title=false)
330 button_cell($name, $value, $title, ICON_EDIT);
333 function select_button_cell($name, $value, $title=false)
335 button_cell($name, $value, $title, ICON_ADD, 'selector');
337 //-----------------------------------------------------------------------------------
339 function check_value($name)
341 if (!isset($_POST[$name]))
346 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
353 $str .= $label . " ";
354 if ($submit_on_change !== false) {
355 if ($submit_on_change === true)
357 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
360 $value = get_post($name,0);
363 .($value == 1 ? ' checked':'')
364 ." type='checkbox' name='$name' value='1'"
365 .($submit_on_change ? " onclick='$submit_on_change'" : '')
366 .($title ? " title='$title'" : '')
369 $Ajax->addUpdate($name, $name, $value);
373 function check($label, $name, $value=null, $submit_on_change=false, $title=false)
375 echo checkbox($label, $name, $value, $submit_on_change, $title);
378 function check_cells($label, $name, $value=null, $submit_on_change=false, $title=false,
382 echo "<td>$label</td>\n";
384 echo check(null, $name, $value, $submit_on_change, $title);
388 function check_row($label, $name, $value=null, $submit_on_change=false, $title=false)
390 echo "<tr><td class='label'>$label</td>";
391 echo check_cells(NULL, $name, $value, $submit_on_change, $title);
395 //-----------------------------------------------------------------------------------
396 function radio($label, $name, $value, $selected=null, $submit_on_change=false)
398 if (!isset($selected))
399 $selected = get_post($name) === (string)$value;
401 if ($submit_on_change === true)
403 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
405 return "<input type='radio' name=$name value='$value' ".($selected ? "checked":'')
406 .($submit_on_change ? " onclick='$submit_on_change'" : '')
407 .">".($label ? $label : '');
410 //-----------------------------------------------------------------------------------
411 function labelheader_cell($label, $params="")
413 echo "<td class='tableheader' $params>$label</td>\n";
416 function label_cell($label, $params="", $id=null)
422 $params .= " id='$id'";
423 $Ajax->addUpdate($id, $id, $label);
425 echo "<td $params>$label</td>\n";
430 function email_cell($label, $params="", $id=null)
432 label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
435 function amount_decimal_cell($label, $params="", $id=null)
438 label_cell(price_decimal_format($label, $dec), "nowrap align=right ".$params, $id);
441 function amount_cell($label, $bold=false, $params="", $id=null)
444 label_cell("<b>".price_format($label)."</b>", "nowrap align=right ".$params, $id);
446 label_cell(price_format($label), "nowrap align=right ".$params, $id);
449 //JAM Allow entered unit prices to be fractional
450 function unit_amount_cell($label, $bold=false, $params="", $id=null)
453 label_cell("<b>".unit_price_format($label)."</b>", "nowrap align=right ".$params, $id);
455 label_cell(unit_price_format($label), "nowrap align=right ".$params, $id);
459 function percent_cell($label, $bold=false, $id=null)
462 label_cell("<b>".percent_format($label)."</b>", "nowrap align=right", $id);
464 label_cell(percent_format($label), "nowrap align=right", $id);
466 // 2008-06-15. Changed
467 function qty_cell($label, $bold=false, $dec=null, $id=null)
470 $dec = get_qty_dec();
472 label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
474 label_cell(number_format2($label, $dec), "nowrap align=right", $id);
477 function label_cells($label, $value, $params="", $params2="", $id=null)
480 echo "<td $params>$label</td>\n";
481 label_cell($value, $params2, $id);
484 function label_row($label, $value, $params="", $params2="", $leftfill=0, $id=null)
489 echo "<td class='label'>$label</td>";
492 label_cells($label, $value, $params, $params2, $id);
494 echo "<td colspan=$leftfill></td>";
498 //-----------------------------------------------------------------------------------
500 function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
501 $labparams="", $post_label="", $inparams="")
505 default_focus($name);
507 label_cell($label, $labparams);
511 $value = get_post($name);
512 echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
513 .($title ? " title='$title'" : '')
516 if ($post_label != "")
517 echo " " . $post_label;
520 $Ajax->addUpdate($name, $name, $value);
523 function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
524 $labparams=null, $post_label=null, $submit_on_change=false)
528 default_focus($name);
529 if (!isset($_POST[$name]) || $_POST[$name] == "")
532 $_POST[$name] = $init;
537 label_cell($label, $labparams);
543 $class = $submit_on_change ? 'class="searchbox"' : '';
544 echo "<input $class type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"" . $_POST[$name]. "\""
545 .($title ? " title='$title'": '')." >";
548 echo " " . $post_label;
551 $Ajax->addUpdate($name, $name, $_POST[$name]);
554 function text_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
556 echo "<tr><td class='label'>$label</td>";
557 text_cells(null, $name, $value, $size, $max, $title, $params, $post_label);
562 //-----------------------------------------------------------------------------------
564 function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
566 echo "<tr><td class='label'>$label</td>";
567 text_cells_ex(null, $name, $size, $max, $value, $title, $params, $post_label);
572 //-----------------------------------------------------------------------------------
573 function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
576 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
577 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
580 function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
583 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
584 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
587 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
589 $val = get_post($name);
591 if (strpos($val,'http://')===false)
592 $val = 'http://'.$val;
593 $label = "<a href='$val' target='_blank'>$label</a>";
595 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
598 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
600 $val = get_post($name);
602 if (strpos($val,'http://')===false)
603 $val = 'http://'.$val;
604 $label = "<a href='$val' target='_blank'>$label</a>";
606 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
609 //-----------------------------------------------------------------------------------
611 // Since FA 2.2 $init parameter is superseded by $check.
612 // When $check!=null current date is displayed in red when set to other
613 // than current date.
615 function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
616 $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
618 global $path_to_root, $Ajax;
620 if (!isset($_POST[$name]) || $_POST[$name] == "")
622 if ($inc_years == 1001)
623 $_POST[$name] = null;
628 $dd = add_days($dd, $inc_days);
629 if ($inc_months != 0)
630 $dd = add_months($dd, $inc_months);
632 $dd = add_years($dd, $inc_years);
636 if (user_use_date_picker())
638 $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ?
639 "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
640 $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
641 . " <img src='$calc_image' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
647 label_cell($label, $params);
651 $class = $submit_on_change ? 'date active' : 'date';
653 $aspect = $check ? 'aspect="cdate"' : '';
654 if ($check && (get_post($name) != Today()))
655 $aspect .= ' style="color:#FF0000"';
657 default_focus($name);
658 $size = (user_date_format()>3)?11:10;
659 echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"$size\" maxlength=\"12\" value=\""
660 . $_POST[$name]. "\""
661 .($title ? " title='$title'": '')." > $post_label";
663 $Ajax->addUpdate($name, $name, $_POST[$name]);
666 function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0,
667 $inc_years=0, $params=null, $submit_on_change=false)
669 echo "<tr><td class='label'>$label</td>";
670 date_cells(null, $name, $title, $check, $inc_days, $inc_months,
671 $inc_years, $params, $submit_on_change);
675 //-----------------------------------------------------------------------------------
676 function password_row($label, $name, $value)
678 echo "<tr><td class='label'>$label</td>";
679 label_cell("<input type='password' name='$name' size=20 maxlength=20 value='$value' >");
683 //-----------------------------------------------------------------------------------
684 function file_cells($label, $name, $id="")
688 label_cells($label, "<input type='file' name='$name' $id >");
690 function file_row($label, $name, $id = "")
692 echo "<tr><td class='label'>$label</td>";
693 file_cells(null, $name, $id);
697 //-----------------------------------------------------------------------------------
699 function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit_on_change=false)
701 text_cells_ex($label, $name, 16, 18, $init, $title, $params, null, $submit_on_change);
704 //-----------------------------------------------------------------------------------
706 function ref_row($label, $name, $title=null, $init=null, $submit_on_change=false)
708 echo "<tr><td class='label'>$label</td>";
709 ref_cells(null, $name, $title, $init, null, $submit_on_change);
713 //-----------------------------------------------------------------------------------
715 function percent_row($label, $name, $init=null)
718 if (!isset($_POST[$name]) || $_POST[$name]=="")
720 $_POST[$name] = $init == null ? '' : $init;
723 small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
726 function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
731 $dec = user_price_dec();
732 if (!isset($_POST[$name]) || $_POST[$name] == "")
735 $_POST[$name] = $init;
742 $params = "class='label'";
743 label_cell($label, $params);
751 echo "<td align='right'>";
753 echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
756 echo "<span id='_{$name}_label'> $post_label</span>";
757 $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
760 $Ajax->addUpdate($name, $name, $_POST[$name]);
761 $Ajax->addAssign($name, $name, 'dec', $dec);
765 //-----------------------------------------------------------------------------------
767 function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
769 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
772 //JAM Allow entered unit prices to be fractional
773 function unit_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
776 $dec = user_price_dec()+2;
778 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec+2);
781 function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
784 amount_cells($label, $name, $init, $params, $post_label, $dec);
788 function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
791 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
795 //-----------------------------------------------------------------------------------
797 function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
800 $dec = user_qty_dec();
802 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
805 function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
808 $dec = user_qty_dec();
811 amount_cells($label, $name, $init, $params, $post_label, $dec);
815 function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
818 $dec = user_qty_dec();
821 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
825 //-----------------------------------------------------------------------------------
827 function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
829 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
832 //-----------------------------------------------------------------------------------
834 function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
837 $dec = user_qty_dec();
838 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
841 //-----------------------------------------------------------------------------------
843 function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
847 default_focus($name);
849 echo "<td $params>$label</td>\n";
851 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
852 echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
853 .($title ? " title='$title'" : '')
854 .">$value</textarea></td>\n";
855 $Ajax->addUpdate($name, $name, $value);
858 function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
860 echo "<tr><td class='label'>$label</td>";
861 textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
865 //-----------------------------------------------------------------------------------
867 function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
871 default_focus($name);
872 echo "<tr><td>$label</td>\n";
876 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
877 echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\"> ";
879 submit($input_name, $input_value);
882 $Ajax->addUpdate($name, $name, $value);
885 //-----------------------------------------------------------------------------------
887 // When show_inactive page option is set
888 // displays value of inactive field as checkbox cell.
889 // Also updates database record after status change.
891 function inactive_control_cell($id, $value, $table, $key)
895 $name = "Inactive". $id;
896 $value = $value ? 1:0;
898 if (check_value('show_inactive')) {
899 if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') ||
900 get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
901 update_record_status($id, !$value, $table, $key);
903 echo '<td align="center">'. checkbox(null, $name, $value, true, '')
904 . hidden("LInact[$id]", $value, false) . '</td>';
908 // Displays controls for optional display of inactive records
910 function inactive_control_row($th) {
911 echo "<tr><td colspan=".(count($th)).">"
912 ."<div style='float:left;'>"
913 . checkbox(null, 'show_inactive', null, true). _("Show also Inactive")
914 ."</div><div style='float:right;'>"
915 . submit('Update', _('Update'), false, '', null)
919 // Inserts additional column header when display of inactive records is on.
921 function inactive_control_column(&$th) {
924 if (check_value('show_inactive'))
925 array_insert($th, count($th)-2 , _("Inactive"));
926 if (get_post('_show_inactive_update')) {
927 $Ajax->activate('_page_body');
931 function customer_credit_row($customer, $credit, $parms='')
933 global $path_to_root;
935 label_row( _("Current Credit:"),
936 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
937 ."href='$path_to_root/sales/inquiry/customer_inquiry.php?customer_id=".$customer."'"
938 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
939 . price_format($credit)
943 function supplier_credit_row($supplier, $credit, $parms='')
945 global $path_to_root;
947 label_row( _("Current Credit:"),
948 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
949 ."href='$path_to_root/purchasing/inquiry/supplier_inquiry.php?supplier_id=".$supplier."'"
950 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
951 . price_format($credit)
955 function bank_balance_row($bank_acc, $parms='')
957 global $path_to_root;
959 $to = add_days(Today(), 1);
960 $bal = get_balance_before_for_bank_account($bank_acc, $to);
961 label_row( _("Bank Balance:"),
962 "<a target='_blank' " . ($bal<0 ? 'class="redfg"' : '')
963 ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."'"
964 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" > "