";
echo check_cells($label, $name, $value, $submit_on_change, $title);
@@ -365,6 +387,12 @@ function email_cell($label, $params="", $id=null)
label_cell("$label", $params, $id);
}
+function amount_decimal_cell($label, $params="", $id=null)
+{
+ $dec = 0;
+ label_cell(price_decimal_format($label, $dec), "nowrap align=right ".$params, $id);
+}
+
function amount_cell($label, $bold=false, $params="", $id=null)
{
if ($bold)
@@ -373,6 +401,16 @@ function amount_cell($label, $bold=false, $params="", $id=null)
label_cell(price_format($label), "nowrap align=right ".$params, $id);
}
+//JAM Allow entered unit prices to be fractional
+function unit_amount_cell($label, $bold=false, $params="", $id=null)
+{
+ if ($bold)
+ label_cell("".unit_price_format($label)."", "nowrap align=right ".$params, $id);
+ else
+ label_cell(unit_price_format($label), "nowrap align=right ".$params, $id);
+}
+
+
function percent_cell($label, $bold=false, $id=null)
{
if ($bold)
@@ -409,18 +447,19 @@ function label_row($label, $value, $params="", $params2="", $leftfill=0, $id='')
//-----------------------------------------------------------------------------------
-function text_cells($label, $name, $value=null, $size="", $max="", $title=false, $params="", $post_label="", $disabled="")
+function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
+ $labparams="", $post_label="", $inparams="")
{
global $Ajax;
default_focus($name);
if ($label != null)
- label_cell($label, $params);
+ label_cell($label, $labparams);
echo "";
if ($value === null)
$value = get_post($name);
- echo "";
@@ -431,7 +470,8 @@ function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
$Ajax->addUpdate($name, $name, $value);
}
-function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null, $params=null, $post_label=null, $submit_on_change=false)
+function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
+ $labparams=null, $post_label=null, $submit_on_change=false)
{
global $Ajax;
@@ -444,7 +484,7 @@ function text_cells_ex($label, $name, $size, $max=null, $init=null, $title=null,
$_POST[$name] = "";
}
if ($label != null)
- label_cell($label, $params);
+ label_cell($label, $labparams);
if (!isset($max))
$max = $size;
@@ -484,64 +524,98 @@ function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
//-----------------------------------------------------------------------------------
function email_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
{
- text_row("$label", $name, $value, $size, $max, $title, $params, $post_label);
+ if (get_post($name))
+ $label = "$label";
+ text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
}
function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
{
- text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label);
+ if (get_post($name))
+ $label = "$label";
+ text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
}
function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
{
- text_row("$label", $name, $value, $size, $max, $title, $params, $post_label);
+ $val = get_post($name);
+ if ($val) {
+ if (strpos($val,'http://')===false)
+ $val = 'http://'.$val;
+ $label = "$label";
+ }
+ text_row($label, $name, $value, $size, $max, $title, $params, $post_label);
}
function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
{
- text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label);
+ $val = get_post($name);
+ if ($val) {
+ if (strpos($val,'http://')===false)
+ $val = 'http://'.$val;
+ $label = "$label";
+ }
+ text_row_ex($label, $name, $size, $max, $title, $value, $params, $post_label);
}
//-----------------------------------------------------------------------------------
-
-function date_cells($label, $name, $title = null, $init=null, $inc_days=0,
+//
+// Since FA 2.2 $init parameter is superseded by $check.
+// When $check!=null current date is displayed in red when set to other
+// than current date.
+//
+function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
$inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
{
- global $use_date_picker, $path_to_root;
+ global $use_date_picker, $path_to_root, $Ajax;
+
if (!isset($_POST[$name]) || $_POST[$name] == "")
{
- if (!$init)
+ if ($inc_years == 1001)
+ $_POST[$name] = null;
+ else
{
- if ($inc_years == 1001)
- $_POST[$name] = null;
- else
- {
- $dd = Today();
- if ($inc_days != 0)
- $dd = add_days($dd, $inc_days);
- if ($inc_months != 0)
- $dd = add_months($dd, $inc_months);
- if ($inc_years != 0)
- $dd = add_years($dd, $inc_years);
- $_POST[$name] = $dd;
- }
+ $dd = Today();
+ if ($inc_days != 0)
+ $dd = add_days($dd, $inc_days);
+ if ($inc_months != 0)
+ $dd = add_months($dd, $inc_months);
+ if ($inc_years != 0)
+ $dd = add_years($dd, $inc_years);
+ $_POST[$name] = $dd;
}
- else
- $_POST[$name] = $init;
}
if ($use_date_picker)
$post_label = ""
. " \n";
else
$post_label = "";
- text_cells_ex($label, $name, 9, 12, $_POST[$name], $title, $params, $post_label, $submit_on_change);
+
+ if ($label != null)
+ label_cell($label, $params);
+
+ echo " | ";
+
+ $class = $submit_on_change ? 'class="searchbox"' : '';
+
+ $aspect = $check ? 'aspect="cdate"' : '';
+ if ($check && (get_post($name) != Today()))
+ $aspect .= ' style="color:#FF0000"';
+
+ default_focus($name);
+
+ echo " $post_label";
+ echo " | \n";
+ $Ajax->addUpdate($name, $name, $_POST[$name]);
}
-function date_row($label, $name, $title=null, $init=null, $inc_days=0, $inc_months=0,
+function date_row($label, $name, $title=null, $check=null, $inc_days=0, $inc_months=0,
$inc_years=0, $params=null, $submit_on_change=false)
{
echo "