+ small_amount_row($label, $name, $_POST[$name], null, "%", user_percent_dec());
+}
+
+function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ global $Ajax;
+
+ if (!isset($dec))
+ $dec = user_price_dec();
+ if (!isset($_POST[$name]) || $_POST[$name] == "")
+ {
+ if ($init !== null)
+ $_POST[$name] = $init;
+ else
+ $_POST[$name] = '';
+ }
+ if ($label != null)
+ label_cell($label, $params);
+
+ if (!isset($max))
+ $max = $size;
+
+ if ($label != null)
+ echo "<td>";
+ else
+ echo "<td align='right'>";
+
+ echo "<input class='amount' type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" dec=\"$dec\" value=\"" . $_POST[$name]. "\">";
+
+ if ($post_label) {
+ echo "<span id='_{$name}_label'> $post_label</span>";
+ $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
+ }
+ echo "</td>\n";
+ $Ajax->addUpdate($name, $name, $_POST[$name]);
+ $Ajax->addAssign($name, $name, 'dec', $dec);
+}
+
+
+//-----------------------------------------------------------------------------------
+
+function amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
+}
+
+//JAM Allow entered unit prices to be fractional
+function unit_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ if (!isset($dec))
+ $dec = user_price_dec()+2;
+
+ amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec+2);
+}
+
+function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ echo "<tr>";
+ amount_cells($label, $name, $init, $params, $post_label, $dec);
+ echo "</tr>\n";
+}
+
+function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ echo "<tr>";
+ small_amount_cells($label, $name, $init, $params, $post_label, $dec);
+ echo "</tr>\n";