";
+}
- if ($selected_id == null)
- $selected_id = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- foreach ($types as $type)
- {
- echo "" . $type['name'] . " \n";
- }
+function quick_entries_list_cells($label, $name, $selected_id=null, $expense=-1, $bank_only=-1, $submit_on_change=false)
+{
+ echo "$label \n";
+ quick_entries_list($name, $selected_id, $expense, $bank_only, $submit_on_change);
+ echo " ";
}
-function wo_types_list_row($label, $name, &$selected_id)
+function quick_entries_list_row($label, $name, $selected_id=null, $expense=-1, $bank_only=-1, $submit_on_change=false)
{
- echo "$label \n";
- wo_types_list($name, $selected_id);
- echo " \n";
+ echo "\n";
+ quick_entries_list_cells($label, $name, $selected_id, $expense, $bank_only, $submit_on_change);
+ echo " \n";
}
+
//------------------------------------------------------------------------------------------------
-function dateformats_list_row($label, $name, $value)
+function wo_types_list($name, $selected_id=null)
{
- global $dateformats;
-
- echo "$label \n";
- echo "";
-
- if ($value == null)
- $value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
- $counter = 0;
- foreach ($dateformats as $df)
- {
+ $types = wo_types::get_all();
- if ($value==$counter)
- {
- echo "$df \n";
- }
- else
- {
- echo "$df \n";
- }
- $counter++;
- }
- echo " \n";
+ $items = array();
+ foreach ($types as $type)
+ $items[$type['id']] = $type['name'];
+
+ return array_selector($name, $selected_id, $items,
+ array( 'select_submit'=> true, 'async' => true ) );
}
-function dateseps_list_row($label, $name, $value)
+function wo_types_list_row($label, $name, $selected_id=null)
{
- global $dateseps;
+ echo "$label \n";
+ $str = wo_types_list($name, $selected_id);
+ echo " \n";
+ return $str;
+}
- echo "$label \n";
- echo "";
+//------------------------------------------------------------------------------------------------
- if ($value == null)
- $value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
- $counter = 0;
- foreach ($dateseps as $ds)
- {
+function dateformats_list_row($label, $name, $value=null)
+{
+ global $dateformats;
- if ($value==$counter)
- {
- echo "$ds \n";
- }
- else
- {
- echo "$ds \n";
- }
- $counter++;
- }
- echo " \n";
+ echo "$label \n";
+ array_selector( $name, $value, $dateformats );
+ echo " \n";
}
-function thoseps_list_row($label, $name, $value)
+function dateseps_list_row($label, $name, $value=null)
{
- global $thoseps;
-
- echo "$label \n";
- echo "";
-
- if ($value == null)
- $value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
- $counter = 0;
- foreach ($thoseps as $ts)
- {
+ global $dateseps;
- if ($value==$counter)
- {
- echo "$ts \n";
- }
- else
- {
- echo "$ts \n";
- }
- $counter++;
- }
- echo " \n";
+ echo "$label \n";
+ array_selector( $name, $value, $dateseps );
+ echo " \n";
}
-function decseps_list_row($label, $name, $value)
+function thoseps_list_row($label, $name, $value=null)
{
- global $decseps;
+ global $thoseps;
- echo "$label \n";
- echo "";
+ echo "$label \n";
+ array_selector( $name, $value, $thoseps );
+ echo " \n";
+}
- if ($value == null)
- $value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
- $counter = 0;
- foreach ($decseps as $ds)
- {
+function decseps_list_row($label, $name, $value=null)
+{
+ global $decseps;
- if ($value==$counter)
- {
- echo "$ds \n";
- }
- else
- {
- echo "$ds \n";
- }
- $counter++;
- }
- echo " \n";
+ echo "$label \n";
+ array_selector( $name, $value, $decseps );
+ echo " \n";
}
-function themes_list_row($label, $name, $value)
+function themes_list_row($label, $name, $value=null)
{
- global $themes;
+ global $path_to_root;
- echo "$label \n";
- echo "";
-
- if ($value == null)
- $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- foreach ($themes as $th)
+ $path = $path_to_root.'/themes/';
+ $themes = array();
+ $themedir = opendir($path);
+ while(false !== ($fname = readdir($themedir)))
{
-
- if ($value==$th)
+ if($fname!='.' && $fname!='..' && $fname!='CVS' && is_dir($path.$fname))
{
- echo "$th \n";
- }
- else
- {
- echo "$th \n";
+ $themes[$fname] = $fname;
}
}
- echo " \n";
+ ksort($themes);
+
+ echo "$label \n";
+ array_selector( $name, $value, $themes );
+ echo " \n";
}
-function pagesizes_list_row($label, $name, $value)
+function pagesizes_list_row($label, $name, $value=null)
{
- global $pagesizes;
-
- echo "$label \n";
- echo "";
+ global $pagesizes;
- if ($value == null)
- $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- foreach ($pagesizes as $pz)
- {
+ $items = array();
+ foreach ($pagesizes as $pz)
+ $items[$pz] = $pz;
- if ($value==$pz)
- {
- echo "$pz \n";
- }
- else
- {
- echo "$pz \n";
- }
- }
- echo " \n";
+ echo "$label \n";
+ array_selector( $name, $value, $items );
+ echo " \n";
}
-function security_headings_list_row($label, $name, $value)
+function security_headings_list_row($label, $name, $value=null)
{
- global $security_headings;
-
- echo "$label \n";
- echo "";
-
- if ($value == null)
- $value = (!isset($_POST[$name]) ? 0 : (int)$_POST[$name]);
- $counter=0;
- foreach ($security_headings as $sh)
- {
+ global $security_headings;
- if ($value==$counter)
- {
- echo "$sh \n";
- }
- else
- {
- echo "$sh \n";
- }
- $counter++;
- }
- echo " \n";
+ echo "$label \n";
+ array_selector( $name, $value, $security_headings );
+ echo " \n";
}
-function systypes_list_cells($label, $name, $value, $submit_on_change=false)
+function systypes_list_cells($label, $name, $value=null, $submit_on_change=false)
{
- global $systypes_array;
+ global $systypes_array;
if ($label != null)
echo "$label \n";
- echo "";
- else
- echo ">";
- if ($value == null)
- $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- foreach ($systypes_array as $key=>$type)
- {
-
- if ($value==$key)
- {
- echo "".$type['name']." \n";
- }
- else
- {
- echo "".$type['name']." \n";
- }
- }
- echo " \n";
+ echo "";
+
+ $items = array();
+ foreach ($systypes_array as $key=>$type)
+ $items[$key] = $type['name'];
+
+ $str = array_selector($name, $value, $items,
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => false
+ )
+ );
+ echo " \n";
+ return $str;
}
-function systypes_list_row($label, $name, $value, $submit_on_change=false)
+function systypes_list_row($label, $name, $value=null, $submit_on_change=false)
{
echo "\n";
- systypes_list_cells($label, $name, $value, $submit_on_change);
+ $str = systypes_list_cells($label, $name, $value, $submit_on_change);
echo " \n";
+ return $str;
}
-function cust_allocations_list_cells($label, $name, $selected)
+function cust_allocations_list_cells($label, $name, $selected=null)
{
+ global $all_items;
+
if ($label != null)
label_cell($label);
- if ($selected == null)
- $selected = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- echo "";
- echo "" . _("All Types"). " \n";
- echo "" . _("Sales Invoices"). " \n";
- echo "" . _("Overdue Invoices"). " \n";
- echo "" . _("Payments"). " \n";
- echo "" . _("Credit Notes"). " \n";
- echo " \n";
-}
-
-function supp_allocations_list_cells($name, $selected)
-{
- if ($selected == null)
- $selected = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- echo "";
- echo "" . _("All Types"). " \n";
- echo "" . _("Invoices"). " \n";
- echo "" . _("Overdue Invoices"). " \n";
- echo "" . _("Payments"). " \n";
- echo "" . _("Credit Notes"). " \n";
- echo "" . _("Overdue Credit Notes"). " \n";
- echo " \n";
-}
-
-function policy_list_cells($label, $name, $selected)
-{
- if ($selected == null)
- {
- $selected = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- if ($selected == "")
- $_POST[$name] = $selected;
- }
+ echo "\n";
+ $allocs = array(
+ $all_items=>_("All Types"),
+ '1'=> _("Sales Invoices"),
+ '2'=> _("Overdue Invoices"),
+ '3' => _("Payments"),
+ '4' => _("Credit Notes"),
+ '5' => _("Delivery Notes")
+ );
+ $str = array_selector($name, $selected, $allocs);
+ echo " \n";
+ return $str;
+}
+
+function supp_allocations_list_cell($name, $selected=null)
+{
+ global $all_items;
+
+ echo "\n";
+ $allocs = array(
+ $all_items=>_("All Types"),
+ '1'=> _("Invoices"),
+ '2'=> _("Overdue Invoices"),
+ '3' => _("Payments"),
+ '4' => _("Credit Notes"),
+ '5' => _("Overdue Credit Notes")
+ );
+ $str = array_selector($name, $selected, $allocs);
+ echo " \n";
+ return $str;
+}
+
+function policy_list_cells($label, $name, $selected=null)
+{
if ($label != null)
label_cell($label);
- echo "";
- echo "" . _("Automatically put balance on back order"). " \n";
- echo "" . _("Cancel any quantites not delivered"). " \n";
- echo " \n";
+ echo "\n";
+ $str = array_selector($name, $selected,
+ array( '' => _("Automatically put balance on back order"),
+ 'CAN' => _("Cancel any quantites not delivered")) );
+ echo " \n";
+ return $str;
}
-function policy_list_row($label, $name, $selected)
+function policy_list_row($label, $name, $selected=null)
{
echo "\n";
policy_list_cells($label, $name, $selected);
echo " \n";
}
-function credit_type_list_cells($label, $name, $selected, $submit_on_change=false)
+function credit_type_list_cells($label, $name, $selected=null, $submit_on_change=false)
{
- if ($selected == null)
- {
- $selected = (!isset($_POST[$name]) ? "Return" : $_POST[$name]);
- if ($selected == "Return")
- $_POST[$name] = $selected;
- }
if ($label != null)
label_cell($label);
- echo "";
- else
- echo ">";
- echo "" . _("Items Returned to Inventory Location"). " \n";
- echo "" . _("Items Written Off"). " \n";
- echo " \n";
+ echo "\n";
+ $str = array_selector($name, $selected,
+ array( 'Return' => _("Items Returned to Inventory Location"),
+ 'WriteOff' => _("Items Written Off")),
+ array( 'select_submit'=> $submit_on_change ) );
+ echo " \n";
+ return $str;
}
-function credit_type_list_row($label, $name, $selected, $submit_on_change=false)
+function credit_type_list_row($label, $name, $selected=null, $submit_on_change=false)
{
echo "\n";
- credit_type_list_cells($label, $name, $selected, $submit_on_change);
+ $str = credit_type_list_cells($label, $name, $selected, $submit_on_change);
echo " \n";
+ return $str;
}
-function number_list($name, $selected, $from, $to, $firstlabel="")
+function number_list($name, $selected, $from, $to, $no_option=false)
{
- if ($selected == null)
- {
- $selected = (!isset($_POST[$name]) ? $from : $_POST[$name]);
- if ($selected == $from)
- $_POST[$name] = $selected;
- }
- echo "";
+ $items = array();
for ($i = $from; $i <= $to; $i++)
- {
- if ($i == 0 && $firstlabel != "")
- $label = $firstlabel;
- else
- $label = $i;
- if ($selected == $i)
- {
- echo "$label \n";
- }
- else
- {
- echo "$label \n";
- }
- }
- echo "\n";
+ $items[$i] = "$i";
+
+ return array_selector($name, $selected, $items,
+ array( 'spec_option' => $no_option,
+ 'spec_id' => reserved_words::get_all_numeric()) );
}
-function number_list_cells($label, $name, $selected, $from, $to)
+function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
{
if ($label != null)
label_cell($label);
echo "\n";
- number_list($name, $selected, $from, $to);
+ number_list($name, $selected, $from, $to, $no_option);
echo " \n";
-}
+}
-function number_list_row($label, $name, $selected, $from, $to)
+function number_list_row($label, $name, $selected, $from, $to, $no_option=false)
{
echo "\n";
- number_list_cells($label, $name, $selected, $from, $to);
+ number_list_cells($label, $name, $selected, $from, $to, $no_option);
echo " \n";
}
+
+function print_profiles_list_row($label, $name, $selected_id=null, $spec_opt=false,
+ $submit_on_change=true)
+{
+ $sql = "SELECT profile FROM ".TB_PREF."print_profiles"
+ ." GROUP BY profile";
+ $result = db_query($sql, 'cannot get all profile names');
+ $profiles = array();
+ while($myrow=db_fetch($result)) {
+ $profiles[$myrow['profile']] = $myrow['profile'];
+ }
+
+ echo "";
+ if ($label != null)
+ echo "$label \n";
+ echo "";
+
+ array_selector($name, $selected_id, $profiles,
+ array( 'select_submit'=> $submit_on_change,
+ 'spec_option'=>$spec_opt,
+ 'spec_id' => ''
+ ));
+
+ echo " \n";
+}
+
+function printers_list($name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
+{
+ static $printers; // query only once for page display
+
+ if (!$printers) {
+ $sql = "SELECT id, name, description FROM ".TB_PREF."printers";
+ $result = db_query($sql, 'cannot get all printers');
+ $printers = array();
+ while($myrow=db_fetch($result)) {
+ $printers[$myrow['id']] = $myrow['name'].' - '.$myrow['description'];
+ }
+ }
+ array_selector($name, $selected_id, $printers,
+ array( 'select_submit'=> $submit_on_change,
+ 'spec_option'=>$spec_opt,
+ 'spec_id' => ''
+ ));
+}
+
+
?>
\ No newline at end of file