X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fui%2Fui_input.inc;h=ab33f649a81ce3cb4418b2ad9f4f4a5e191e03d7;hb=d746d3fde3490592d30b75d31dd8622d09c997d0;hp=8b6a6e2c31f150c3f9d636d9e67d19d723e69d46;hpb=da8311619dd73feae101d246a1957b972e00cbd2;p=fa-stable.git diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 8b6a6e2c..ab33f649 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -4,14 +4,14 @@ function hidden($name, $value) { - echo "\n"; + echo "\n"; } //--------------------------------------------------------------------------------- function submit($name, $value, $echo=true) { - $submit_str = "\n"; + $submit_str = "\n"; if ($echo) echo $submit_str; else @@ -86,14 +86,28 @@ function submit_row($name, $value, $right=true, $extra="") echo " \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 +144,12 @@ function check_row($label, $name, $value, $submit_on_change=false) //----------------------------------------------------------------------------------- -function labelheader_cell($label, $params="") // ändra till label_td +function labelheader_cell($label, $params="") { echo "$label\n"; } -function label_cell($label, $params="") // ändra till label_td +function label_cell($label, $params="") { echo "$label\n"; } @@ -144,15 +158,23 @@ function amount_cell($label, $bold=false) { if ($bold) label_cell("".number_format2($label,user_price_dec())."", "nowrap align=right"); - else + else label_cell(number_format2($label,user_price_dec()), "nowrap align=right"); } +function percent_cell($label, $bold=false) +{ + if ($bold) + label_cell("".number_format2($label,user_percent_dec())." %", "nowrap align=right"); + else + label_cell(number_format2($label,user_percent_dec())." %", "nowrap align=right"); +} + function qty_cell($label, $bold=false) { if ($bold) label_cell("".number_format2($label,user_qty_dec())."", "nowrap align=right"); - else + else label_cell(number_format2($label,user_qty_dec()), "nowrap align=right"); } @@ -163,10 +185,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"; } @@ -180,7 +204,7 @@ function text_cells($label, $name, $value, $size="", $max="", $params="", $post_ if ($value == null) $value = (!isset($_POST[$name]) ? "" : $_POST[$name]); - echo ""; + echo ""; if ($post_label != "") echo " " . $post_label; @@ -190,14 +214,13 @@ 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; else $_POST[$name] = ""; } - if ($label != null) label_cell($label, $params); @@ -206,7 +229,7 @@ function text_cells_ex($label, $name, $size, $max=null, $init=null, $params=null echo ""; - echo ""; + echo ""; if ($post_label) echo " " . $post_label; @@ -238,16 +261,34 @@ 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) { - if (!isset($_POST[$name]) || $_POST[$name] == "") + global $use_date_picker, $path_to_root; + if (!isset($_POST[$name]) || $_POST[$name] == "") { if (!$init) { - $_POST[$name] = date(user_date_display(), Mktime(0,0,0,date("m") + $inc_months,date("d") + $inc_days,date("Y") + $inc_years)); - } + 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; + } + } else $_POST[$name] = $init; } - text_cells_ex($label, $name, 9, 12, $_POST[$name], $params); + if ($use_date_picker) + $post_label = "" + . " "._(\n"; + else + $post_label = ""; + text_cells_ex($label, $name, 9, 12, $_POST[$name], $params, $post_label); } function date_row($label, $name, $init=null, $inc_days=0, $inc_months=0, $inc_years=0, $params=null) @@ -278,10 +319,9 @@ 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]=="") { - if ($init) - $_POST[$name] = $init; + $_POST[$name] = $init== null ? '' : $init; } text_row($label, $name, $_POST[$name], 6, 6, "", "%"); @@ -335,7 +375,7 @@ function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $ if ($value == null) $value = (!isset($_POST[$name]) ? "" : $_POST[$name]); - echo " "; + echo " "; submit($input_name, $input_value);