<?php


function ID_MAIN_COSTS_GROUP( $cmd, $value ) {
	global $result, $thiss;

	if ($cmd == 'POST_VERIFY') {
		return;
	}

	$field_name = 'ID_MAIN_COSTS_GROUP';
	$select_list = array();

	$sql = "select cg.`ID`, cg.`S_OTHER_INFO`, cg.`A_STATUS`
		from `USERS2_OFFERS_COSTS_GROUPS` as cg
		where
			cg.`A_STATUS`!='DELETED'
			and cg.`ID_MAIN_COSTS_GROUP`='0'
		order by `ID`
	";
	ZAP_SQL( $sql );
	while ($r = mysql_fetch_object( $result )) {
		$select_list [$r->ID] = $r->ID . ": " . $r->S_OTHER_INFO . " (" . $r->A_STATUS . ")";
	}

	echo '<select name="' . $field_name . '">';
		echo ' <option value="">' . " " . '</option>';
		foreach ($select_list as $key => $val) {
			$sel = ($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDITRECORD'][$field_name] == $key)? ' selected="selected"' : '';
			echo '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
		}//end foreach
	echo '</select>';
}
