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 //---------------------------------------------------------------------------------
97 // Thanks to hidden fields buffering hidden() helper can be used in arbitrary places and
98 // proper html structure is still preserved. Buffered hidden fields are output on the nearest
99 // table or form closing tag (see output_hidden()).
101 $hidden_fields = array();
103 function hidden($name, $value=null, $echo=true)
105 global $Ajax, $hidden_fields;
108 $value = get_post($name);
110 $ret = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
111 $Ajax->addUpdate($name, $name, $value);
113 $hidden_fields[] = $ret;
118 Universal submit form button.
119 $atype - type of submit:
121 false - normal button; optional icon
122 null - button visible only in fallback mode; optional icon
124 true - standard button; optional icon
126 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
127 'selector' - ditto with closing current popup editor window
128 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
129 'process' - displays progress bar during call; optional icon
130 'nonajax' - ditto, non-ajax submit
132 $atype can contain also multiply type selectors separated by space,
133 however make sense only combination of 'process' and one of defualt/selector/cancel
135 function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
137 global $path_to_root;
140 if ($atype === null) {
141 $aspect = fallback_mode() ? " aspect='fallback'" : " style='display:none;'";
143 } elseif (!is_bool($atype)) { // necessary: switch uses '=='
145 $aspect = " aspect='$atype' ";
146 $types = explode(' ', $atype);
148 foreach ($types as $type) {
151 $aspect = " aspect='selector' rel = '$value'";
152 $value = _("Select");
153 if ($icon===false) $icon=ICON_SUBMIT; break;
156 if ($icon===false) $icon=ICON_SUBMIT; break;
159 if ($icon===false) $icon=ICON_ESCAPE; break;
166 $submit_str = "<button class=\""
167 .($atype ? 'ajaxsubmit' : 'inputsubmit')
168 ."\" type=\"submit\""
170 ." name=\"$name\" id=\"$name\" value=\"$value\""
171 .($title ? " title='$title'" : '')
173 .($icon ? "<img src='$path_to_root/themes/".user_theme()."/images/$icon' height='12' alt=''>" : '')
174 ."<span>$value</span>"
182 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
184 if ($echo) echo "<center>";
185 submit($name, $value, $echo, $title, $async, $icon);
186 if ($echo) echo "</center>";
189 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
192 submit($name, $value, true, $title, $async, $icon);
196 function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
199 submit($name, $value, true, $title, $async, $icon);
203 For following controls:
204 'both' - use both Ctrl-Enter and Escape hotkeys
205 'upgrade' - use Ctrl-Enter with progress ajax indicator and Escape hotkeys. Nonajax request for OK option is performed.
206 'cancel' - apply to 'RESET' button
208 function submit_add_or_update($add=true, $title=false, $async=false, $clone=false)
212 if ($async === 'both') {
213 $async = 'default'; $cancel = 'cancel';
215 elseif ($async === 'upgrade') {
216 $async = 'default nonajax process'; $cancel = 'cancel';
218 else if ($async === 'default')
220 else if ($async === 'cancel')
224 submit('ADD_ITEM', _("Add new"), true, $title, $async);
226 submit('UPDATE_ITEM', _("Update"), true, _('Submit changes'), $async);
227 if ($clone) submit('CLONE', _("Clone"), true,
228 _('Edit new record with current data'), $async);
229 submit('RESET', _("Cancel"), true, _('Cancel edition'), $cancel);
233 function submit_add_or_update_center($add=true, $title=false, $async=false, $clone=false)
236 submit_add_or_update($add, $title, $async, $clone);
240 function submit_add_or_update_row($add=true, $right=true, $extra="", $title=false, $async=false, $clone = false)
244 echo "<td> </td>\n";
246 submit_add_or_update($add, $title, $async, $clone);
250 function submit_cells($name, $value, $extra="", $title=false, $async=false)
253 submit($name, $value, true, $title, $async);
257 function submit_row($name, $value, $right=true, $extra="", $title=false, $async=false)
261 echo "<td> </td>\n";
262 submit_cells($name, $value, $extra, $title, $async);
266 function submit_return($name, $value, $title=false)
268 if (@$_REQUEST['popup']) {
269 submit($name, $value, true, $title, 'selector');
273 function submit_js_confirm($name, $msg, $set = true) {
275 $js = "_validate.$name=".($set ? "function(){ return confirm('"
276 . strtr($msg, array("\n"=>'\\n')) . "');};"
279 $Ajax->addScript(true, $js);
283 //-----------------------------------------------------------------------------------
285 function set_icon($icon, $title=false)
287 global $path_to_root;
288 if (basename($icon) === $icon) // standard icons does not contain path separator
289 $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
290 return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";
293 function button($name, $value, $title=false, $icon=false, $aspect='')
295 // php silently changes dots,spaces,'[' and characters 128-159
296 // to underscore in POST names, to maintain compatibility with register_globals
298 if ($aspect == 'selector') {
299 $rel = " rel='$value'";
300 $value = _("Select");
302 if (user_graphic_links() && $icon)
304 if ($value == _("Delete")) // Helper during implementation
306 return "<button type='submit' class='editbutton' name='"
307 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
309 ."' value='1'" . ($title ? " title='$title'":" title='$value'")
310 . ($aspect ? " aspect='$aspect'" : '')
312 ." >".set_icon($icon)."</button>\n";
315 return "<input type='submit' class='editbutton' name='"
316 .htmlentities(strtr($name, array('.'=>'=2E', '='=>'=3D',// ' '=>'=20','['=>'=5B'
319 .($title ? " title='$title'":'')
320 . ($aspect ? " aspect='$aspect'" : '')
325 function button_cell($name, $value, $title=false, $icon=false, $aspect='')
327 echo "<td align='center'>";
328 echo button($name, $value, $title, $icon, $aspect);
332 function delete_button_cell($name, $value, $title=false)
334 button_cell($name, $value, $title, ICON_DELETE);
337 function edit_button_cell($name, $value, $title=false)
339 button_cell($name, $value, $title, ICON_EDIT);
342 function select_button_cell($name, $value, $title=false)
344 button_cell($name, $value, $title, ICON_ADD, 'selector');
346 //-----------------------------------------------------------------------------------
348 function check_value($name)
350 if (!isset($_POST[$name]))
355 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
362 $str .= $label . " ";
363 if ($submit_on_change !== false) {
364 if ($submit_on_change === true)
366 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
369 $value = get_post($name,0);
372 .($value == 1 ? ' checked':'')
373 ." type='checkbox' name='$name' value='1'"
374 .($submit_on_change ? " onclick='$submit_on_change'" : '')
375 .($title ? " title='$title'" : '')
378 $Ajax->addUpdate($name, $name, $value);
382 function check($label, $name, $value=null, $submit_on_change=false, $title=false)
384 echo checkbox($label, $name, $value, $submit_on_change, $title);
387 function check_cells($label, $name, $value=null, $submit_on_change=false, $title=false,
391 echo "<td>$label</td>\n";
393 echo check(null, $name, $value, $submit_on_change, $title);
397 function check_row($label, $name, $value=null, $submit_on_change=false, $title=false)
399 echo "<tr><td class='label'>$label</td>";
400 echo check_cells(NULL, $name, $value, $submit_on_change, $title);
404 //-----------------------------------------------------------------------------------
405 function radio($label, $name, $value, $selected=null, $submit_on_change=false)
407 if (!isset($selected))
408 $selected = get_post($name) === (string)$value;
410 if ($submit_on_change === true)
412 "JsHttpRequest.request(\"_{$name}_update\", this.form);";
414 return "<input type='radio' name=$name value='$value' ".($selected ? "checked":'')
415 .($submit_on_change ? " onclick='$submit_on_change'" : '')
416 .">".($label ? $label : '');
419 //-----------------------------------------------------------------------------------
420 function labelheader_cell($label, $params="")
422 echo "<td class='tableheader' $params>$label</td>\n";
425 function label_cell($label, $params="", $id=null)
431 $params .= " id='$id'";
432 $Ajax->addUpdate($id, $id, $label);
434 echo "<td $params>$label</td>\n";
439 function email_cell($label, $params="", $id=null)
441 label_cell("<a href='mailto:$label'>$label</a>", $params, $id);
444 function amount_decimal_cell($label, $params="", $id=null)
447 label_cell(price_decimal_format($label, $dec), "nowrap align=right ".$params, $id);
450 function amount_cell($label, $bold=false, $params="", $id=null)
453 label_cell("<b>".price_format($label)."</b>", "nowrap align=right ".$params, $id);
455 label_cell(price_format($label), "nowrap align=right ".$params, $id);
458 //JAM Allow entered unit prices to be fractional
459 function unit_amount_cell($label, $bold=false, $params="", $id=null)
462 label_cell("<b>".unit_price_format($label)."</b>", "nowrap align=right ".$params, $id);
464 label_cell(unit_price_format($label), "nowrap align=right ".$params, $id);
468 function percent_cell($label, $bold=false, $id=null)
471 label_cell("<b>".percent_format($label)."</b>", "nowrap align=right", $id);
473 label_cell(percent_format($label), "nowrap align=right", $id);
475 // 2008-06-15. Changed
476 function qty_cell($label, $bold=false, $dec=null, $id=null)
479 $dec = get_qty_dec();
481 label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
483 label_cell(number_format2($label, $dec), "nowrap align=right", $id);
486 function label_cells($label, $value, $params="", $params2="", $id=null)
489 echo "<td $params>$label</td>\n";
490 label_cell($value, $params2, $id);
493 function label_row($label, $value, $params="", $params2="", $leftfill=0, $id=null)
498 echo "<td class='label'>$label</td>";
501 label_cells($label, $value, $params, $params2, $id);
503 echo "<td colspan=$leftfill></td>";
507 function text_input($name, $value=null, $size='', $max='', $title='', $params='')
510 $value = get_post($name);
512 return "<input $params type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
513 .($title ? " title='$title'" : '')
517 //-----------------------------------------------------------------------------------
519 function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
520 $labparams="", $post_label="", $inparams="")
524 default_focus($name);
526 label_cell($label, $labparams);
529 echo text_input($name, $value, $size, $max, $title, $inparams);
531 if ($post_label != "")
532 echo " " . $post_label;
535 $Ajax->addUpdate($name, $name, $value);
538 function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
539 $labparams=null, $post_label=null, $submit_on_change=false)
543 default_focus($name);
544 if (!isset($_POST[$name]) || $_POST[$name] == "")
547 $_POST[$name] = $init;
552 label_cell($label, $labparams);
558 $class = $submit_on_change ? 'class="searchbox"' : '';
559 echo "<input $class type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"" . $_POST[$name]. "\""
560 .($title ? " title='$title'": '')." >";
563 echo " " . $post_label;
566 $Ajax->addUpdate($name, $name, $_POST[$name]);
569 function text_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
571 echo "<tr><td class='label'>$label</td>";
572 text_cells(null, $name, $value, $size, $max, $title, $params, $post_label);
577 //-----------------------------------------------------------------------------------
579 function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
581 echo "<tr><td class='label'>$label</td>";
582 text_cells_ex(null, $name, $size, $max, $value, $title, $params, $post_label);
587 //-----------------------------------------------------------------------------------
588 function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
591 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
592 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
595 function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
598 $label = "<a href='Mailto:".$_POST[$name]."'>$label</a>";
599 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
602 function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
604 $val = get_post($name);
606 if (strpos($val,'http://')===false)
607 $val = 'http://'.$val;
608 $label = "<a href='$val' target='_blank'>$label</a>";
610 text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
613 function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
615 $val = get_post($name);
617 if (strpos($val,'http://')===false)
618 $val = 'http://'.$val;
619 $label = "<a href='$val' target='_blank'>$label</a>";
621 text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
624 //-----------------------------------------------------------------------------------
626 // Since FA 2.2 $init parameter is superseded by $check.
627 // When $check!=null current date is displayed in red when set to other
628 // than current date.
630 function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
631 $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
633 global $path_to_root, $Ajax;
635 if (!isset($_POST[$name]) || $_POST[$name] == "")
637 if ($inc_years == 1001)
638 $_POST[$name] = null;
643 $dd = add_days($dd, $inc_days);
644 if ($inc_months != 0)
645 $dd = add_months($dd, $inc_months);
647 $dd = add_years($dd, $inc_years);
651 if (user_use_date_picker())
653 $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ?
654 "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
655 $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
656 . " <img src='$calc_image' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
662 label_cell($label, $params);
666 $class = $submit_on_change ? 'date active' : 'date';
668 $aspect = $check ? 'aspect="cdate"' : '';
669 if ($check && (get_post($name) != Today()))
670 $aspect .= ' style="color:#FF0000"';
672 default_focus($name);
673 $size = (user_date_format()>3)?11:10;
674 echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"$size\" maxlength=\"12\" value=\""
675 . $_POST[$name]. "\""
676 .($title ? " title='$title'": '')." > $post_label";
678 $Ajax->addUpdate($name, $name, $_POST[$name]);
681 function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0,
682 $inc_years=0, $params=null, $submit_on_change=false)
684 echo "<tr><td class='label'>$label</td>";
685 date_cells(null, $name, $title, $check, $inc_days, $inc_months,
686 $inc_years, $params, $submit_on_change);
690 //-----------------------------------------------------------------------------------
691 function password_row($label, $name, $value)
693 echo "<tr><td class='label'>$label</td>";
694 label_cell("<input type='password' name='$name' size=20 maxlength=20 value='$value' >");
698 //-----------------------------------------------------------------------------------
699 function file_cells($label, $name, $id="")
703 label_cells($label, "<input type='file' name='$name' $id >");
705 function file_row($label, $name, $id = "")
707 echo "<tr><td class='label'>$label</td>";
708 file_cells(null, $name, $id);
712 //-----------------------------------------------------------------------------------
714 function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit_on_change=false)
716 text_cells_ex($label, $name, 16, 18, $init, $title, $params, null, $submit_on_change);
719 //-----------------------------------------------------------------------------------
721 function ref_row($label, $name, $title=null, $init=null, $submit_on_change=false)
723 echo "<tr><td class='label'>$label</td>";
724 ref_cells(null, $name, $title, $init, null, $submit_on_change);
728 //-----------------------------------------------------------------------------------
730 function percent_row($label, $name, $init=null)
733 if (!isset($_POST[$name]) || $_POST[$name]=="")
735 $_POST[$name] = $init == null ? '' : $init;
738 small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
741 function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
746 $dec = user_price_dec();
747 if (!isset($_POST[$name]) || $_POST[$name] == "")
750 $_POST[$name] = $init;
757 $params = "class='label'";
758 label_cell($label, $params);
766 echo "<td align='right'>";
768 echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
771 echo "<span id='_{$name}_label'> $post_label</span>";
772 $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
775 $Ajax->addUpdate($name, $name, $_POST[$name]);
776 $Ajax->addAssign($name, $name, 'dec', $dec);
780 //-----------------------------------------------------------------------------------
782 function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
784 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
787 //JAM Allow entered unit prices to be fractional
788 function unit_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
791 $dec = user_price_dec()+2;
793 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec+2);
796 function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
799 amount_cells($label, $name, $init, $params, $post_label, $dec);
803 function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
806 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
810 //-----------------------------------------------------------------------------------
812 function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
815 $dec = user_qty_dec();
817 amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
820 function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
823 $dec = user_qty_dec();
826 amount_cells($label, $name, $init, $params, $post_label, $dec);
830 function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
833 $dec = user_qty_dec();
836 small_amount_cells($label, $name, $init, $params, $post_label, $dec);
840 //-----------------------------------------------------------------------------------
842 function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
844 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
847 //-----------------------------------------------------------------------------------
849 function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
852 $dec = user_qty_dec();
853 amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
856 //-----------------------------------------------------------------------------------
858 function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
862 default_focus($name);
864 echo "<td $params>$label</td>\n";
866 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
867 echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
868 .($title ? " title='$title'" : '')
869 .">$value</textarea></td>\n";
870 $Ajax->addUpdate($name, $name, $value);
873 function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
875 echo "<tr><td class='label'>$label</td>";
876 textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
880 //-----------------------------------------------------------------------------------
882 function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
886 default_focus($name);
887 echo "<tr><td>$label</td>\n";
891 $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
892 echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\"> ";
894 submit($input_name, $input_value);
897 $Ajax->addUpdate($name, $name, $value);
900 //-----------------------------------------------------------------------------------
902 // When show_inactive page option is set
903 // displays value of inactive field as checkbox cell.
904 // Also updates database record after status change.
906 function inactive_control_cell($id, $value, $table, $key)
910 $name = "Inactive". $id;
911 $value = $value ? 1:0;
913 if (check_value('show_inactive')) {
914 if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') ||
915 get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
916 update_record_status($id, !$value, $table, $key);
918 echo '<td align="center">'. checkbox(null, $name, $value, true, '')
919 . hidden("LInact[$id]", $value, false) . '</td>';
923 // Displays controls for optional display of inactive records
925 function inactive_control_row($th) {
926 echo "<tr><td colspan=".(count($th)).">"
927 ."<div style='float:left;'>"
928 . checkbox(null, 'show_inactive', null, true). _("Show also Inactive")
929 ."</div><div style='float:right;'>"
930 . submit('Update', _('Update'), false, '', null)
934 // Inserts additional column header when display of inactive records is on.
936 function inactive_control_column(&$th) {
939 if (check_value('show_inactive'))
940 array_insert($th, count($th)-2 , _("Inactive"));
941 if (get_post('_show_inactive_update')) {
942 $Ajax->activate('_page_body');
946 function customer_credit_row($customer, $credit, $parms='')
948 global $path_to_root;
950 label_row( _("Current Credit:"),
951 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
952 ."href='$path_to_root/sales/inquiry/customer_inquiry.php?customer_id=".$customer."'"
953 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
954 . price_format($credit)
958 function supplier_credit_row($supplier, $credit, $parms='')
960 global $path_to_root;
962 label_row( _("Current Credit:"),
963 "<a target='_blank' " . ($credit<0 ? 'class="redfg"' : '')
964 ."href='$path_to_root/purchasing/inquiry/supplier_inquiry.php?supplier_id=".$supplier."'"
965 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >"
966 . price_format($credit)
970 function bank_balance_row($bank_acc, $parms='')
972 global $path_to_root;
974 $to = add_days(Today(), 1);
975 $bal = get_balance_before_for_bank_account($bank_acc, $to);
976 label_row( _("Bank Balance:"),
977 "<a target='_blank' " . ($bal<0 ? 'class="redfg"' : '')
978 ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."'"
979 ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" > "