X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=2a51d80ffaa35e9d60cade6e3c8530105a806d4b;hb=3c4482206218de2faceeb2f6563c92f28e57db50;hp=aab5fd18c5d3873ea564282878d5de6060f26b41;hpb=9ad27981afdaa91591f4e71d19ac59653c524cea;p=fa-stable.git
diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc
index aab5fd18..2a51d80f 100644
--- a/includes/ui/ui_input.inc
+++ b/includes/ui/ui_input.inc
@@ -1,5 +1,25 @@
$postval ) {
+ if (strpos($postkey, $prefix) === 0) {
+ $id = substr($postkey, strlen($prefix));
+ return $numeric ? (int)$id : $id;
+ }
+ }
+ return $numeric ? -1 : null;
+}
+
+//------------------------------------------------------------------------------
+//
+// Read numeric value from user formatted input
+//
function input_num($postname=null) {
if (!isset($_POST[$postname]))
return null;
@@ -164,25 +184,25 @@ function label_cell($label, $params="")
function amount_cell($label, $bold=false)
{
if ($bold)
- label_cell("".number_format2($label,user_price_dec())."", "nowrap align=right");
+ label_cell("".price_format($label)."", "nowrap align=right");
else
- label_cell(number_format2($label,user_price_dec()), "nowrap align=right");
+ label_cell(price_format($label), "nowrap align=right");
}
function percent_cell($label, $bold=false)
{
if ($bold)
- label_cell("".number_format2($label,user_percent_dec())."", "nowrap align=right");
+ label_cell("".percent_format($label)."", "nowrap align=right");
else
- label_cell(number_format2($label,user_percent_dec()), "nowrap align=right");
+ label_cell(percent_format($label), "nowrap align=right");
}
-function qty_cell($label, $bold=false)
+function qty_cell($label, $bold=false, $dec=null)
{
if ($bold)
- label_cell("".number_format2($label,user_qty_dec())."", "nowrap align=right");
+ label_cell("".qty_format($label, $dec)."", "nowrap align=right");
else
- label_cell(number_format2($label,user_qty_dec()), "nowrap align=right");
+ label_cell(qty_format($label, $dec), "nowrap align=right");
}
function label_cells($label, $value, $params="", $params2="")
@@ -331,11 +351,13 @@ function percent_row($label, $name, $init=null)
$_POST[$name] = $init== null ? '' : $init;
}
- small_amount_row($label, $name, $_POST[$name], null, "%");
+ 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)
+function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null, $dec=null)
{
+ if (!isset($dec))
+ $dec = user_price_dec();
if (!isset($_POST[$name]) || $_POST[$name] == "")
{
if ($init)
@@ -351,7 +373,7 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu
echo "
";
- echo "";
+ echo "";
if ($post_label)
echo " " . $post_label;
@@ -362,30 +384,69 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu
//-----------------------------------------------------------------------------------
-function amount_cells($label, $name, $init=null, $params=null, $post_label=null)
+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);
+}
+
+function amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ echo " | ";
+ amount_cells($label, $name, $init, $params, $post_label, $dec);
+ echo "
\n";
+}
+
+function small_amount_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ echo "";
+ small_amount_cells($label, $name, $init, $params, $post_label, $dec);
+ echo "
\n";
+}
+
+//-----------------------------------------------------------------------------------
+
+function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label);
+ if(!isset($dec))
+ $dec = user_qty_dec();
+
+ amount_cells_ex($label, $name, 15, 15, $init, $params, $post_label, $dec);
}
-function amount_row($label, $name, $init=null, $params=null, $post_label=null)
+function qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
+ if(!isset($dec))
+ $dec = user_qty_dec();
+
echo "";
- amount_cells($label, $name, $init, $params, $post_label);
+ amount_cells($label, $name, $init, $params, $post_label, $dec);
echo "
\n";
}
-function small_amount_row($label, $name, $init=null, $params=null, $post_label=null)
+function small_qty_row($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
+ if(!isset($dec))
+ $dec = user_qty_dec();
+
echo "";
- small_amount_cells($label, $name, $init, $params, $post_label);
+ small_amount_cells($label, $name, $init, $params, $post_label, $dec);
echo "
\n";
}
//-----------------------------------------------------------------------------------
-function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null)
+function small_amount_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
+{
+ amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
+}
+
+//-----------------------------------------------------------------------------------
+
+function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null)
{
- amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label);
+ if (!isset($dec))
+ $dec = user_qty_dec();
+ amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
}
//-----------------------------------------------------------------------------------