X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=0831e6103df0fd66369deac64cc2bbc30bfc66d1;hb=de3a75773afa86df1739d14f24399d6f7a46f809;hp=0220b7be55db4538642974f4c05c3b46a15be2ee;hpb=37f4a02e0f4bea58e5b2097d583bf9395ffc515f;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 0220b7be..0831e610 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -1,5 +1,12 @@  \n"; submit_cells($name, $value, $extra); echo "\n"; -} +} +//--------------------------------------------------------------------------------- + +function button($name, $value, $onclick) +{ + echo "\n"; +} + +function button_cell($name, $value, $onclick) +{ + echo ""; + button($name, $value, $onclick); + echo "\n"; +} + //----------------------------------------------------------------------------------- -function check_value($name) +function check_value($name) { if (!isset($_POST[$name])) return 0; - return 1; + return 1; } function check($label, $name, $value, $submit_on_change=false) @@ -130,12 +151,12 @@ function check_row($label, $name, $value, $submit_on_change=false) //----------------------------------------------------------------------------------- -function labelheader_cell($label, $params="") +function labelheader_cell($label, $params="") { echo "$label\n"; } -function label_cell($label, $params="") +function label_cell($label, $params="") { echo "$label\n"; } @@ -143,17 +164,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"); - else - label_cell(number_format2($label,user_price_dec()), "nowrap align=right"); + label_cell("".price_format($label)."", "nowrap align=right"); + else + label_cell(price_format($label), "nowrap align=right"); } -function qty_cell($label, $bold=false) +function percent_cell($label, $bold=false) { if ($bold) - label_cell("".number_format2($label,user_qty_dec())."", "nowrap align=right"); - else - label_cell(number_format2($label,user_qty_dec()), "nowrap align=right"); + label_cell("".percent_format($label)."", "nowrap align=right"); + else + label_cell(percent_format($label), "nowrap align=right"); +} + +function qty_cell($label, $bold=false, $dec=null) +{ + if ($bold) + label_cell("".qty_format($label, $dec)."", "nowrap align=right"); + else + label_cell(qty_format($label, $dec), "nowrap align=right"); } function label_cells($label, $value, $params="", $params2="") @@ -163,10 +192,12 @@ function label_cells($label, $value, $params="", $params2="") echo "$value\n"; } -function label_row($label, $value, $params="", $params2="") +function label_row($label, $value, $params="", $params2="", $leftfill=0) { echo ""; label_cells($label, $value, $params, $params2); + if($leftfill!=0) + echo ""; echo "\n"; } @@ -190,7 +221,7 @@ function text_cells($label, $name, $value, $size="", $max="", $params="", $post_ function text_cells_ex($label, $name, $size, $max=null, $init=null, $params=null, $post_label=null) { - if (!isset($_POST[$name]) || $_POST[$name] == "") + if (!isset($_POST[$name]) || $_POST[$name] == "") { if ($init) $_POST[$name] = $init; @@ -238,7 +269,7 @@ function text_row_ex($label, $name, $size, $max=null, $value=null, $params=null, function date_cells($label, $name, $init=null, $inc_days=0, $inc_months=0, $inc_years=0, $params=null) { global $use_date_picker, $path_to_root; - if (!isset($_POST[$name]) || $_POST[$name] == "") + if (!isset($_POST[$name]) || $_POST[$name] == "") { if (!$init) { @@ -254,8 +285,8 @@ function date_cells($label, $name, $init=null, $inc_days=0, $inc_months=0, $inc_ if ($inc_years != 0) $dd = add_years($dd, $inc_years); $_POST[$name] = $dd; - } - } + } + } else $_POST[$name] = $init; } @@ -295,34 +326,107 @@ function ref_row($label, $name, $init=null) function percent_row($label, $name, $init=null) { - if (!isset($_POST[$name]) || $_POST[$name]=="") + if (!isset($_POST[$name]) || $_POST[$name]=="") + { + $_POST[$name] = $init== null ? '' : $init; + } + + 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) +{ + if (!isset($dec)) + $dec = user_price_dec(); + if (!isset($_POST[$name]) || $_POST[$name] == "") { if ($init) $_POST[$name] = $init; + else + $_POST[$name] = ''; } + if ($label != null) + label_cell($label, $params); + + if (!isset($max)) + $max = $size; + + echo ""; - text_row($label, $name, $_POST[$name], 6, 6, "", "%"); + echo ""; + + if ($post_label) + echo " " . $post_label; + + echo "\n"; +} + + +//----------------------------------------------------------------------------------- + +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 amount_cells($label, $name, $init=null, $params=null, $post_label=null) +function qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null) { - text_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_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, $dec); + echo "\n"; +} + +//----------------------------------------------------------------------------------- + +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_amount_cells($label, $name, $init=null, $params=null, $post_label=null) +function small_qty_cells($label, $name, $init=null, $params=null, $post_label=null, $dec=null) { - text_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); } //-----------------------------------------------------------------------------------