<?
					$la_tablica = array(
						array('', 'tablica_procesa', 'tablica_taskova', 'tablica_zadataka', 'tablica_godisnjih_ciljeva', 'tablica_godisnjih_planova_int_audit', 'tablica_godisnjih_planova_izobrazbe'),
						array('tablica_zaposlenika', '', '', '', '', '', '', '', 'tablica_loko', 'tablica_putnih_naloga'),
						array(),
						array('tablica_poslovnih_partnera', 'tablica_poruka', 'tablica_zabiljeski', 'tablica_zapisnika_sa_sastanaka', 'tablica_prigovora_kupca'),
						array('tablica_nesukladnosti', 'tablica_popravnih_radnji', 'tablica_zastitnih_radnji', 'tablica_upravinih_ocjena', '', 'tablica_godisnjih_ocjena_dobavljaca'),
						array('', '', '', '', '', '', 'tablica_receivingsa', 'tablica_receivingsa_inv'),
						array(),
						array(),
						array('', '', 'tablica_info_usluga', 'tablica_info_imovine', 'tablica_ranjivosti', 'tablica_postojecih_kontrola', 'tablica_plana_lijecenja', 'tablica_info_rizika'),
					);
					
?>
					<?/*?>
					<div class="title">
						<?=$lh_title_0?>
						<?=$lh_title?>
<?
						if($_GET['c'] == 2){
?>
							&nbsp; || &nbsp; <?=$g_term[$g_language_sign]['sifrarnik']?>: "<?=$lha_sifrarnik[$_GET['d'] - 1][1]?>"
<?
						}
						
						if(mysql_num_rows(mysql_query("SHOW TABLES LIKE 'aa_verzija' ")) == 1){
							$l_verzija = ' &nbsp; &nbsp; App: '.get_item('select verzija from aa_verzija where rbr = 1 limit 1 ');
						}else{
							$l_verzija = '';
						}
?>
					</div>
					<div class="appUser">
						<?=$g_term[$g_language_sign]['korisnik']?>: <?=get_item('select DisplayName from zaposlenik where rbr_users_outer_db = '.$_SESSION['__id'])?><?=$l_verzija?>
					</div>
					<?*/?>
					<div id="menuButtons">
						<div class="buttons">
<?
							if($_GET['c'] == 2 && 1 == 0){
								/*
?>
								<a href="<?=make_link($lh_link_pregled, $_GET['a'].':'.$_GET['b'])
									?>"><img src="<?=$g_path_sl_res?>images/b-back.gif" border="0" title="<?=$g_term[$g_language_sign]['povratak']?>"></a>
								<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								<img src="<?=$g_path_sl_res?>images/b-sifrarnik-little.gif" border="0" title="<?=$lha_sifrarnik[$_GET['d'] - 1][1]?>: <?=$lha_sifrarnik[$_GET['d'] - 1][3]?>">
								<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								<a href="<?=make_link('sifrarnik-'.$_GET['d'], $_GET['a'].':'.$_GET['b'].':'.$_GET['c'].':'.$_GET['d'])
									?>" title="Pregled podataka šifrarnika"><img src="<?=$g_path_sl_res?>images/b-list.gif" border="0"></a>
								<a href="<?=make_link('sifrarnik-dodaj-podatak-'.$_GET['d'], $_GET['a'].':'.$_GET['b'].':'.$_GET['c'].':'.$_GET['d'].':-1')
									?>" title="Dodaj novi podatak u šifrarnik"><img src="<?=$g_path_sl_res?>images/b-add.gif" border="0"></a>
<?
								if($_GET['e'] != ''){
									
									$l_img_spremi = 'b-spremi.gif';
									$l_js_spremi = 'submitThisForm(); ';
									
									if($_GET['c'] == '2'){
										$x = get_data('select meta_forma.rbr, klasa, show_label, label, default_tab '.
											' from meta_forma, meta_tablica_list '.
											' where meta_forma.rbr_meta_tablica_list = meta_tablica_list.rbr '.
											' and meta_tablica_list.ime_tablice = "'.$lha_sif_table[$_GET['d'] - 1].'" '.
											' and meta_forma.ime = "'.$lha_sif_table_desc[$_GET['d'] - 1].'" ', 0);
											
										// kontrola prikaza indexa modula
										//$z = get_item('select rbr from access '.
											//' where rbr_zaposlenik = '.$_SESSION['__id'].' and rbr_modul_type = 2 and rbr_modul = '.$x['rbr'].' and rbr_access_type = 2 ');
										$z = 0;
										if($z > 0){
											$l_img_spremi = 'b-spremi-disabled.gif';
											$l_js_spremi = 'alert(\'Nemate ovlasti za upis/editiranje podataka.\'); ';
										}
									}
									
									//if(!($z > 0 && strval($_GET['e']) == '-1')){
?>
										<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
										<a href="#" onclick="<?=$l_js_spremi?>return false;" title="<?=$g_term[$g_language_sign]['spremi']
											?>"><img src="<?=$g_path_sl_res?>images/<?=$l_img_spremi?>" border="0"></a>
<?
									//}
								}
?>
								<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
<?
								*/
							}else{
								if(isset($_GET['addition'])){
									$l_add = '&addition='.$_GET['addition'];
								}else{
									$l_add = '';
								}
								
								
								if($_GET['a'] == '6' && $_GET['b'] == '7' && empty($_GET['d']) && $_GET['addition'] == 'Primka'){
									$l_sql = 'UPDATE articles SET price_sell = price_buy*1.3 WHERE price_sell= 0';
									sql_exe($l_sql);
									$l_sql = 'UPDATE articles SET price_sell = 0.03 WHERE price_buy= 0 and price_sell=0 ';
									sql_exe($l_sql);
									$l_sql = 'UPDATE articles SET price_buy = 0.01 WHERE price_buy= 0';
									sql_exe($l_sql);
									$l_sql = 'UPDATE receiving_items SET price_sell = 0.03 WHERE price_buy= 0 and price_sell=0 ';
									sql_exe($l_sql);
									$l_sql = 'UPDATE receiving_items SET marza_percent = 1 WHERE marza_percent IS NULL';
									sql_exe($l_sql);
									$l_sql = 'UPDATE receiving_items SET price_buy = 0.01 WHERE price_buy= 0';
									sql_exe($l_sql);
								}
								
?>
								<a href="<?=make_link($lh_link_pregled, $_GET['a'].':'.$_GET['b'])?><?=$l_add?>" title="<?=$lh_link_pregled_title
									?>"><img src="<?=$g_path_sl_res?>images/b-list.gif" border="0"></a>
								<a href="<?=make_link($lh_link_dodaj, $_GET['a'].':'.$_GET['b'].':-1')?><?=$l_add?>" title="<?=$lh_link_dodaj_title
									?>"><img src="<?=$g_path_sl_res?>images/b-add.gif" border="0"></a>
<?
								if($_GET['a'] == '6' && $_GET['b'] == '11' && empty($_GET['c']) && empty($_GET['d'])){
?>
									<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
									<a href="../receivings/indexZapisnikPromjenaCijeneArtiklaList" target="_parent" title="<?=$lh_link_dodaj_title
										?>"><img src="<?=$g_path_sl_res?>images/b-print.gif" border="0"></a>
<?
								}
								
								
								
									
								if($_GET['c'] != ''){
									
									
									
									$l_img_spremi = 'b-spremi.gif';
									$l_js_spremi = 'submitThisForm(); ';
									
									
									$l_proknjizi_img = '';
									
									
									
									
									// da se ponovo otvori forma koja se prvi put snima, a ne da se ide na pregled primki
									if($_GET['a'] == '6' && ($_GET['b'] == '7' || $_GET['b'] == '8') && $_GET['c'] == -1 && empty($_GET['d'])){
										if($_GET['b'] == '7'){
											$l_js_spremi = 'submitThisFormAndBack(151, '.$_GET['c'].'); ';
										}
										if($_GET['b'] == '8'){
											$l_js_spremi = 'submitThisFormAndBack(153, '.$_GET['c'].'); ';
										}
									}
									
									
									
									
									if($_GET['a'] == '6' && ($_GET['b'] == '7' || $_GET['b'] == '8') && $_GET['c'] > 0 && empty($_GET['d'])){
										$l_posted = get_item('select posted from receivings where id = '.$_GET['c']);
										if($l_posted == 1){
											$l_img_spremi = 'b-spremi-disabled.gif';
											$l_js_spremi = 'alert(\'Stavka je proknjižena. Promjene su moguće tek nakon Otknjiženja stavke.\'); ';
											
											$l_proknjizi_img = '<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'.
												'<a href="#" onclick="stavka_promijeni_status('.$_GET['c'].', 1); return false;">'.
												'<img src="'.$g_path_sl_res.'images/b-otknjizi.gif" border="0" title="Otknjiži" alt="Otknjiži"></a>';
										}else{
											$l_img_spremi = 'b-spremi.gif';
											if($_GET['b'] == '7'){
												$l_js_spremi = 'submitThisFormAndBack(151, '.$_GET['c'].'); ';
											}
											if($_GET['b'] == '8'){
												$l_js_spremi = 'submitThisFormAndBack(153, '.$_GET['c'].'); ';
											}
											
											$l_proknjizi_img = '<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'.
												'<a href="#" onclick="stavka_promijeni_status('.$_GET['c'].', 2); return false;">'.
												'<img src="'.$g_path_sl_res.'images/b-proknjizi.gif" border="0" title="Proknjiži" alt="Proknjiži"></a>';
										}
									}
									
									
									if($_GET['a'] == '6' && $_GET['b'] == '9' && $_GET['c'] > 0 && empty($_GET['d'])){
										$l_posted = get_item('select posted from medjus where id = '.$_GET['c']);
										if($l_posted == 1){
											$l_img_spremi = 'b-spremi-disabled.gif';
											$l_js_spremi = 'alert(\'Stavka je proknjižena. Promjene su moguće tek nakon Otknjiženja stavke.\'); ';
											
											$l_proknjizi_img = '<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'.
												'<a href="#" onclick="stavka_promijeni_status_medjus('.$_GET['c'].', 1); return false;">'.
												'<img src="'.$g_path_sl_res.'images/b-otknjizi.gif" border="0" title="Otknjiži" alt="Otknjiži"></a>';
										}else{
											$l_img_spremi = 'b-spremi.gif';
											$l_js_spremi = 'submitThisFormAndBack(155, '.$_GET['c'].'); ';
											
											$l_proknjizi_img = '<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'.
												'<a href="#" onclick="stavka_promijeni_status_medjus('.$_GET['c'].', 2); return false;">'.
												'<img src="'.$g_path_sl_res.'images/b-proknjizi.gif" border="0" title="Proknjiži" alt="Proknjiži"></a>';
										}
									}
									
									
									if($_GET['c'] != '2'){
										$x = get_data('select meta_forma.rbr, klasa, show_label, label, default_tab '.
											' from meta_forma, meta_tablica_list '.
											' where meta_forma.rbr_meta_tablica_list = meta_tablica_list.rbr '.
											' and meta_tablica_list.ime_tablice = "'.$lh_table.'" '.
											' and meta_forma.ime = "'.$lh_table_opis.'" ', 0);
											
										// kontrola prikaza indexa modula
										//$z = get_item('select rbr from access '.
											//' where rbr_zaposlenik = '.$_SESSION['__id'].' and rbr_modul_type = 2 and rbr_modul = '.$x['rbr'].' and rbr_access_type = 2 ');
										$z = 0;
										if($z > 0){
											$l_img_spremi = 'b-spremi-disabled.gif';
											$l_js_spremi = 'alert(\'Nemate ovlasti za upis/editiranje podataka.\'); ';
										}
									}
?>
									<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
									<a href="#" onclick="<?=$l_js_spremi?>return false;" title="<?=$g_term[$g_language_sign]['spremi']
										?>"><img src="<?=$g_path_sl_res?>images/<?=$l_img_spremi?>" border="0"></a>
									
									<?=$l_proknjizi_img?>
<?
								}
?>
								<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								
								<?=$lh_menu_button_1?>
<?
							}
							
							
							
							
							$l_click_1 = '';
							$l_click_2 = '';
							$l_click_3 = '';
							$l_click_4 = '';
							
							if(
								(		($_GET['a'] == 5 && ($_GET['b'] == 1 || $_GET['b'] == 2 || $_GET['b'] == 3 || $_GET['b'] == 4 || $_GET['b'] == 6)) ||
										($_GET['a'] == 1 && ($_GET['b'] == 6)) ||
										($_GET['a'] == 4 && ($_GET['b'] == 4))
								)
								&& (!($_GET['c'] == 2 || $_GET['c'] == ''))){
									
								$l_connect_fields = get_item('select meta_prikaz_item.connect_fields '.
									' from meta_prikaz, meta_prikaz_item '.
									' where meta_prikaz.rbr = meta_prikaz_item.rbr_meta_prikaz '.
									' and meta_prikaz.ime = "'.$la_tablica[$_GET['a'] - 1][$_GET['b'] - 1].'" '.
									' and meta_prikaz_item.rbr_atribut = 0 ');
								$la_connect_fields = explode(';', $l_connect_fields);
							}
							
							//print $l_connect_fields."<br>";
							
							if($_GET['a'] == 1 && $_GET['b'] == 6 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
									$l_click_4 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_nesuk'].'\'); return false;"';
								}else{
									$x = get_data('select id, Predmet from god_plan_un_oc where id = "'.$_GET['c'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=IA: '.$x['Predmet'].'&cf_data1=fea1e938-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=IA: '.$x['Predmet'].'&cf_data1=fea1e938-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
										
									//print $la_connect_fields[2];
										
									$l_click_4 = 'onclick="otvori_prozor2(\'default.php?a=5&b=1&c=-1&cf='.$la_connect_fields[2].
										'&cf_data0='.$x['id'].'\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							if($_GET['a'] == 4 && $_GET['b'] == 4 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
								}else{
									$x = get_data('select Tema from zapisnik_sa_sastanka where id = "'.$_GET['c'].'" ', 0);
									
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=ZS: '.$x['Tema'].'&cf_data1=fea1e939-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=ZS: '.$x['Tema'].'&cf_data1=fea1e939-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							
							if($_GET['a'] == 5 && $_GET['b'] == 1 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
									$l_click_3 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pop_radnje'].'\'); return false;"';
								}else{
									$x = get_data('select OpisNesukladnosti, Tema from nesukladnosti where id = "'.$_GET['c'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=NS: '.$x['OpisNesukladnosti'].'&cf_data1=e453262e-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=NS: '.$x['OpisNesukladnosti'].'&cf_data1=e453262e-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_3 = 'onclick="otvori_prozor2(\'default.php?a=5&b=2&c=-1&cf='.$la_connect_fields[2].
										'&cf_data0='.$_GET['c'].'&cf_data1='.$x['Tema'].'\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							
							if($_GET['a'] == 5 && $_GET['b'] == 2 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
								}else{
									$x = get_data('select OpisPostupka from popravne_radnje where id = "'.$_GET['c'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=PR: '.$x['OpisPostupka'].'&cf_data1=e89fba88-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=PR: '.$x['OpisPostupka'].'&cf_data1=e89fba88-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							
							if($_GET['a'] == 5 && $_GET['b'] == 3 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
								}else{
									$x = get_data('select OpisNesukladnosti from zastitne_radnje where id = "'.$_GET['c'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=ZR: '.$x['OpisNesukladnosti'].'&cf_data1=ec66b3f8-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=ZR: '.$x['OpisNesukladnosti'].'&cf_data1=ec66b3f8-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							
							if($_GET['a'] == 5 && $_GET['b'] == 4 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
								}else{
									$x = get_data('select Sazetak from upravina_ocjena where id = "'.$_GET['c'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=UPO: '.$x['Sazetak'].'&cf_data1=09b1ede0-f76f-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=UPO: '.$x['Sazetak'].'&cf_data1=09b1ede0-f76f-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							if($_GET['a'] == 5 && $_GET['b'] == 5 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								$l_click_1 = '';
								$l_click_2 = '';
								
								if($_GET['c'] == -1){
									$l_click_3 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_nesuk'].'\'); return false;"';
								}else{
									$l_click_3 = 'onclick="otvori_prozor2(\'default.php?a=5&b=1&c=-1\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							if($_GET['a'] == 5 && $_GET['b'] == 6 && (!($_GET['c'] == 2 || $_GET['c'] == ''))){
								if($_GET['c'] == -1){
									$l_click_1 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_zadatka'].'\'); return false;"';
									$l_click_2 = 'onclick="alert(\''.$g_term[$g_language_sign]['msg_prije_dodavanja_pr_zadatka'].'\'); return false;"';
								}else{
									$x = get_data('select dobavljac_id from godisnja_ocjena_dobavljaca where id = "'.$_GET['c'].'" ', 0);
									$x = get_data('select PunoIme from poslovni_partner where id = "'.$x['dobavljac_id'].'" ', 0);
								
									$l_click_1 = 'onclick="otvori_prozor2(\'default.php?a=1&b=3&c=-1&cf='.$la_connect_fields[0].
										'&cf_data0=GOD: '.$x['PunoIme'].'&cf_data1=fea1e940-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
									$l_click_2 = 'onclick="otvori_prozor2(\'default.php?a=1&b=4&c=-1&cf='.$la_connect_fields[1].
										'&cf_data0=GOD: '.$x['PunoIme'].'&cf_data1=fea1e940-f76e-11e1-bc0c-42972f232346\', \'win'.rand(10000, 99999).
										'\', 1400, 800, \'yes\', \'yes\'); return false;"';
								}
							}
							
							
							if($l_click_1 && $l_click_2){
								if($l_click_3){
									$l_click_3 = '<a href="#" '.$l_click_3.'><img src="'.$g_path_sl_res.
										'images/b-popravna-radnja.gif" border="0" title="'.$g_term[$g_language_sign]['dodaj_pop_radnju'].'" class="imgSmall"></a>'."\n";
								}
								if($l_click_4){
									$l_click_4 = '<a href="#" '.$l_click_4.'><img src="'.$g_path_sl_res.
										'images/b-nesukladnost.gif" border="0" title="'.$g_term[$g_language_sign]['dodaj_nesuk'].'" class="imgSmall"></a>'."\n";
								}
								
								$result = '<a href="#" '.$l_click_1.'><img src="'.$g_path_sl_res.
									'images/b-zadatak.gif" border="0" title="'.$g_term[$g_language_sign]['dodaj_zadatak'].'" class="imgSmall"></a>'."\n";
								$result .= '<a href="#" '.$l_click_2.'><img src="'.$g_path_sl_res.
									'images/b-projektni-zadatak.gif" border="0" title="'.$g_term[$g_language_sign]['dodaj_pr_zadatak'].'" class="imgSmall"></a>'."\n";
								$result .= $l_click_3;
								$result .= $l_click_4;
								$result .= '<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">';
								
								print $result;
							}else{
								if($l_click_3){
									print '<a href="#" '.$l_click_3.'><img src="'.$g_path_sl_res.
										'images/b-nesukladnost.gif" border="0" title="'.$g_term[$g_language_sign]['dodaj_nesuk'].'" class="imgSmall"></a>'."\n".
										'<img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'."\n";
								}
								
							}
							
							
							
							if(!$_GET['c']){
								
								//print $la_tablica[$_GET['a'] - 1][$_GET['b'] - 1]." -- <br>";
								
								$x = get_data('select meta_prikaz_item.* '.
									' from meta_prikaz, meta_prikaz_item '.
									' where meta_prikaz.rbr = meta_prikaz_item.rbr_meta_prikaz '.
									' and meta_prikaz.ime = "'.$la_tablica[$_GET['a'] - 1][$_GET['b'] - 1].'" '.
									' and meta_prikaz_item.search_field = 1 order by redoslijed ', 1);
								
								if(sizeof($x['label']) > 0){
									
									global $g_language;
									
									if($g_language > 1){
										$x_lang = get_data('select * '.
											' from meta_prikaz_item_lang '.
											' where rbr = '.$x['rbr_meta_prikaz'][0].
											' and rbr_jezik = '.$g_language.
											' order by rbr, rbr_atribut ', 1);
									}
		
									$l_pretraga = '<div class="pretragaWrap"><a href="#" onclick="open_layer(\'pretragaDiv\'); return false;">'.
										'<img src="'.$g_path_sl_res.'images/b-search.gif" border="0" title="'.$g_term[$g_language_sign]['pretraga'].'">'.
										'</a><img src="'.$g_path_sl_res.'images/b-separator.gif" border="0">'."\n".
										'<div class="clPretragaDiv" id="pretragaDiv"><form name="sftopmenu" method="post" action="default.php?search=1" autocomplete="off">'."\n";
										
									//p($x['label']);
									
									for($i = 0; $i < sizeof($x['label']); $i++){
										
										//p('select rbr_meta_tablica_list from meta_prikaz where rbr = '.$x['rbr_meta_prikaz'][$i]);
										
										$l_mtl = get_item('select rbr_meta_tablica_list from meta_prikaz where rbr = '.$x['rbr_meta_prikaz'][$i]);
										
										$a_meta_item_data = get_data('select meta_item.* '.
											' from meta_forma, meta_tab, meta_grupa, meta_item '.
											' where meta_tab.rbr_meta_forma = meta_forma.rbr '.
											' and meta_grupa.rbr_meta_tab = meta_tab.rbr '.
											' and meta_item.rbr_meta_grupa = meta_grupa.rbr '.
											' and meta_forma.rbr_meta_tablica_list = '.$l_mtl.
											' and meta_forma.ime = "'.$la_tablica[$_GET['a'] - 1][$_GET['b'] - 1].'" '.
											//' and meta_item.rbr = '.$x['rbr'][$i].
											' and meta_item.rbr_atribut = '.$x['rbr_atribut'][$i], 0);
											
										//print $x['rbr_atribut'][$i]." ---- <br>";
										if($g_language > 1 && $x_lang['label'][$x['rbr_atribut'][$i] - 1]){
											$l_label_lang = $x_lang['label'][$x['rbr_atribut'][$i] - 1];
										}else{
											$l_label_lang = $x['label'][$i];
										}
											
										if($x['kljuc'][$i]){
											//p('11');
											//p($a_meta_item_data);
											$y = get_data('select '.str_replace('f_', '', $a_meta_item_data['polje_select']).' from '.$a_meta_item_data['kljuc'].
												' where 1 = 1 '.$l_filter.' order by '.$a_meta_item_data['polje_order'], 1);
											//p('22');
											
											$l_pretraga .= '<p class="label">'.$l_label_lang.'</p>';
											
											$l_pretraga .= '<select class="select1" id="searchField'.$x['rbr_atribut'][$i].'" name="searchField'.$x['rbr_atribut'][$i].'">';
											$l_pretraga .= '<option value="NULL">--</option>'."\n";
											for($j = 0; $j < sizeof($y['rbr']); $j++){
												$y['rbr'][$j] == $_GET['sf'.$x['rbr_atribut'][$i]] ?
													$l_selected = ' selected'
													:
													$l_selected = '';
												$l_pretraga .= '<option value="'.$y['rbr'][$j].'"'.$l_selected.'>'.$y['ime'][$j].'</option>'."\n";
											}
											$l_pretraga .= '</select>'.
												"\n";
										}else{
											if($x['tip_polja_maska'][$i] == 'selectyesno'){
												$y['rbr'] = array('DA', 'NE');
												$y['ime'] = array('DA', 'NE');
												$l_pretraga .= '<p class="label">'.$l_label_lang.'</p>'.
													'<select class="select1" id="searchField'.$x['rbr_atribut'][$i].'" name="searchField'.$x['rbr_atribut'][$i].'">';
												$l_pretraga .= '<option value="NULL">--</option>'."\n";
												for($j = 0; $j < sizeof($y['rbr']); $j++){
													$y['rbr'][$j] == $_GET['sf'.$x['rbr_atribut'][$i]] ?
														$l_selected = ' selected'
														:
														$l_selected = '';
													$l_pretraga .= '<option value="'.$y['rbr'][$j].'"'.$l_selected.'>'.$y['ime'][$j].'</option>'."\n";
												}
												$l_pretraga .= '</select>'.
													"\n";
											}else{
												$l_pretraga .= '<p class="label">'.$l_label_lang.'</p>'.
													'<input type="text" id="searchField'.$x['rbr_atribut'][$i].'" name="searchField'.$x['rbr_atribut'][$i].'" '.
													'class="input1" value="'.$_GET['sf'.$x['rbr_atribut'][$i]].'" autocomplete="off" '.
													'onkeyup="checkSearch(this.value, '.$a_meta_item_data['rbr'].', '.$x['rbr_atribut'][$i].', '.zbroji($i).')" >'."\n";
											}
										}
									}
									
									$l_pretraga .= '<input type="submit" value="'.$g_term[$g_language_sign]['pretrazi'].'" class="sbm"></form>'.
										'<a href="#" onclick="close_layer(\'pretragaDiv\'); return false;" class="clWin">'.$g_term[$g_language_sign]['zatvori_pretragu'].'</a>'.
										'<div id="searchResults"></div></div></div>';
									
									print $l_pretraga;
								}
							}
							
							if(sizeof($lha_sifrarnik) > 0){
?>
								<img src="<?=$g_path_sl_res?>images/b-sifrarnik.gif" border="0" title="<?=$g_term[$g_language_sign]['sifrarnici']
									?>" onmouseover="document.getElementById('<?=$lh_sifrarnik_layer?>').style.display = 'block'">
								<div id="<?=$lh_sifrarnik_layer?>">
<?
									for($i = 0; $i < sizeof($lha_sifrarnik); $i++){
?>
											<a href="<?=make_link($lha_sifrarnik[$i][2], $_GET['a'].':'.$_GET['b'].':2:'.$lha_sifrarnik[$i][0])
												?>" title="<?=$lha_sifrarnik[$i][1]?>: <?=$lha_sifrarnik[$i][3]?>" class="sifButton"><?=$lha_sifrarnik[$i][4]?></a>
<?
									}
?>
								</div>
<?
							}
							
							for($i = 0; $i < sizeof($la_submenu[$_GET['a']]); $i++){
								if($la_submenu[$_GET['a']][$i]['srbr'] == $_GET['b']){
									//print_r($la_submenu[$_GET['a']][$i]);
									//print $la_submenu[$_GET['a']][$i]['link']."<br>";
									$l_srbr = $i;
									break;
								}
							}
							
							if(is_file($g_path_res.'help/'.$la_submenu[$_GET['a']][$l_srbr]['link'].'.pdf')){
?>
								<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								<a href="res/help/<?=$la_submenu[$_GET['a']][$l_srbr]['link']
									?>.pdf" target="_blank" title="<?=$g_term[$g_language_sign]['pomoc']
									?> - <?=$la_submenu[$_GET['a']][$l_srbr]['title']?>"><img src="<?=$g_path_sl_res?>images/b-help.gif" border="0"></a>
<?
							}
							
							
							/*
							// vise ne treba, jer je izrada ovog izvjesca, prebacena je u file "_all_reports.php" => function all_rekapitreceivings($date_start, $date_end)
							
							if($_GET['a'] == '6' && $_GET['b'] == '7' && $_GET['c'] == '' && empty($_GET['d']) && $_GET['addition'] == 'Primka'){
?>
								<div class="reportWrap">
									<a href="#" onclick="open_layer('primka-report-period'); return false;" title="Izvjesce: rekapitulacija primki" target="_blank"><img src="<?=$g_path_sl_res?>images/b-print.gif" border="0"></a>
									<div id="primka-report-period">
<?
										$l_datum = strtotime(u_godina().'-'.u_mjesec(0, 1).'-'.u_datum(0, 1)) - 30 * 24 * 60 * 60;
										$l_datum_str = date('d', $l_datum).'-'.date('m', $l_datum).'-'.date('Y', $l_datum);
?>
										<form name="formaasdf" method="post" action="print.php?a=<?=$_GET['a']?>&b=<?=$_GET['b']?>&addition=<?=$_GET['addition']?>" target="_blank">
										<p>Izvjesce: rekapitulacija primki</p>
										<p><span>Od: </span><input type="text" name="primka_od" id="primka_od" value="<?=$l_datum_str?>"><img src="<?=$g_path_sl_res
											?>js/datetimepicker_css/cal.gif" class="datetimepicker" onclick="NewCssCal('primka_od', 'ddMMyyyy', 'arrow'); return false;"></p>
										<p><span>Do: </span><input type="text" name="primka_do" id="primka_do" value="<?=u_datum(0, 1).'-'.u_mjesec(0, 1).'-'.u_godina()
											?>"><img src="<?=$g_path_sl_res
											?>js/datetimepicker_css/cal.gif" class="datetimepicker" onclick="NewCssCal('primka_do', 'ddMMyyyy', 'arrow'); return false;"></p>
										<p><input type="submit" value="Izradi izvjesce" class="sbm" onclick="close_layer('primka-report-period');"></p>
										<p><a href="#" onclick="close_layer('primka-report-period'); return false;" class="clWin">Odustani</a></p>
										</form>
									</div>
									<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								</div>
<?
							}
							*/
							
							
							if($_GET['a'] == '6' && $_GET['b'] == '7' && $_GET['c'] == '' && empty($_GET['d']) && $_GET['addition'] == 'Annulments'){
?>
								<div class="reportWrap">
									<a href="#" onclick="open_layer('primka-report-period'); return false;" title="Izvjesce: rekapitulacija otpisa" target="_blank"><img src="<?=$g_path_sl_res?>images/b-print.gif" border="0"></a>
									<div id="primka-report-period">
<?
										//$l_datum = strtotime(u_godina().'-'.u_mjesec(0, 1).'-'.u_datum(0, 1)) - 30 * 24 * 60 * 60;
										//$l_datum_str = date('d', $l_datum).'-'.date('m', $l_datum).'-'.date('Y', $l_datum);
										$l_datum_str = '01-01-'.u_godina();
?>
										<form name="formaasdf" method="post" action="print.php?a=<?=$_GET['a']?>&b=<?=$_GET['b']?>&addition=<?=$_GET['addition']?>" target="_blank">
										<p>Izvjesce: rekapitulacija otpisa</p>
										<p><span>Od: </span><input type="text" name="otpis_od" id="otpis_od" value="<?=$l_datum_str?>"><img src="<?=$g_path_sl_res
											?>js/datetimepicker_css/cal.gif" class="datetimepicker" onclick="NewCssCal('otpis_od', 'ddMMyyyy', 'arrow'); return false;"></p>
										<p><span>Do: </span><input type="text" name="otpis_do" id="otpis_do" value="<?=u_datum(0, 1).'-'.u_mjesec(0, 1).'-'.u_godina()
											?>"><img src="<?=$g_path_sl_res
											?>js/datetimepicker_css/cal.gif" class="datetimepicker" onclick="NewCssCal('otpis_do', 'ddMMyyyy', 'arrow'); return false;"></p>
										<p><input type="submit" value="Izradi izvjesce" class="sbm" onclick="close_layer('primka-report-period');"></p>
										<p><a href="#" onclick="close_layer('primka-report-period'); return false;" class="clWin">Odustani</a></p>
										</form>
									</div>
									<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
								</div>
<?
							}
							
							if($_GET['a'] == '6' && $_GET['b'] == '7' && $_GET['c'] == '' && empty($_GET['d']) && $_GET['addition'] == 'Primka'){
?>
								<a href="../reports/rekapitreceivings" title="Izvjesce: Rekapitulacija primki" target="_top"><img src="<?=$g_path_sl_res?>images/b-print.gif" border="0"></a>
<?
							}
							
							if($_GET['a'] == '6' && $_GET['b'] == '9' && $_GET['c'] == '' && empty($_GET['d']) && $_GET['addition'] == 'MedjuskladisnicaProizvodnja'){
?>
								<a href="../reports/rekapitproizvmedjus" title="Izvjesce: Rekapitulacija proizvodnih međuskladišnica" target="_top"><img src="<?=$g_path_sl_res?>images/b-print.gif" border="0"></a>
<?
							}
?>
						</div>
					</div>
					<div id="menuAction">
<?
						switch(strval($_GET['c'])){
							case '-1':
								print $lh_novi_label;
								break;
								
							case '2':
								switch(strval($_GET['e'])){
									case '-1':
										print $g_term[$g_language_sign]['dodaj_novi_podatak'];
										break;
										
									case '':
										print $g_term[$g_language_sign]['pregled_podataka'];
										break;
										
									default:
										print $g_term[$g_language_sign]['promjena_podataka'];
										break;
								}
								break;
								
							case '':
								print $lh_pregled_label;
								break;
								
							default:
								print $g_term[$g_language_sign]['promjena_podataka'];
								break;
						}
						
						
						
						
						switch($_GET['addition']){
							case 'Annulments':
								$l_word_1 = 'Otpis';
								$l_word_2 = 'snimljen';
								$l_word_3 = 'proknjizen';
								$l_word_4 = 'otknjizen';
								break;
								
							case 'Transfers':
								$l_word_1 = 'Medjuskladisnica';
								$l_word_2 = 'snimljena';
								$l_word_3 = 'proknjizena';
								$l_word_4 = 'otknjizena';
								break;
								
							case 'Returns':
								$l_word_1 = 'Povratnica';
								$l_word_2 = 'snimljena';
								$l_word_3 = 'proknjizena';
								$l_word_4 = 'otknjizena';
								break;
								
							case 'Inventura':
								$l_word_1 = 'Inventura';
								$l_word_2 = 'snimljena';
								$l_word_3 = 'proknjizena';
								$l_word_4 = 'otknjizena';
								break;
								
							case 'Primka':
								$l_word_1 = 'Primka';
								$l_word_2 = 'snimljena';
								$l_word_3 = 'proknjizena';
								$l_word_4 = 'otknjizena';
								break;
								
							default:
								$l_word_1 = '';
								$l_word_2 = '';
								$l_word_3 = '';
								$l_word_4 = '';
						}
						
						
						if(isset($_GET['primkamsg']) && $_GET['primkamsg'] != ''){
							print '<p id="primkaSaveMsg">'.$l_word_1.' je upravo '.$l_word_2.'.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaSaveMsg").style.display = "none"\', 10000);</script>';
						}
						
						if(isset($_GET['primkamsgproknjizi']) && $_GET['primkamsgproknjizi'] != ''){
							print '<p id="primkaProMsg">'.$l_word_1.' je upravo '.$l_word_3.'.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaProMsg").style.display = "none"\', 10000);</script>';
						}
						
						if(isset($_GET['primkamsgotknjizi']) && $_GET['primkamsgotknjizi'] != ''){
							print '<p id="primkaOtkMsg">'.$l_word_1.' je upravo '.$l_word_4.'.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaOtkMsg").style.display = "none"\', 10000);</script>';
						}
						
						
						
						if(isset($_GET['inventuramsg']) && $_GET['inventuramsg'] != ''){
							print '<p id="primkaSaveMsg">'.$l_word_1.' je upravo '.$l_word_2.'.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaSaveMsg").style.display = "none"\', 10000);</script>';
						}
						
						
						
						if(isset($_GET['medjusmsg']) && $_GET['medjusmsg'] != ''){
							print '<p id="primkaSaveMsg">Medjuskladisnica je upravo snimljena.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaSaveMsg").style.display = "none"\', 10000);</script>';
						}
						
						if(isset($_GET['medjusmsgproknjizi']) && $_GET['medjusmsgproknjizi'] != ''){
							print '<p id="primkaProMsg">Medjuskladisnica je upravo proknjizena.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaProMsg").style.display = "none"\', 10000);</script>';
						}
						
						if(isset($_GET['medjusmsgotknjizi']) && $_GET['medjusmsgotknjizi'] != ''){
							print '<p id="primkaOtkMsg">Medjuskladisnica je upravo otknjizena.</p>'."\n";
							print '<script type="text/javascript">setTimeout(\'document.getElementById("primkaOtkMsg").style.display = "none"\', 10000);</script>';
						}
?>
					</div>
<?
					$l_cnt = 0;
					$l_is_search = 0;
					$g_pretraga_string = '';
					$l_pretraga_opis = '';
					foreach($_GET as $key => $value){
						if(substr($key, 0, 2) == 'sf'){
							if($l_cnt == 0){
								// samo prvi put se poziva
								$l_is_search = 1;
								
								$y2 = get_data('select meta_prikaz_item.* '.
									' from meta_prikaz, meta_prikaz_item '.
									' where meta_prikaz.rbr = meta_prikaz_item.rbr_meta_prikaz '.
									' and meta_prikaz.ime = "'.$la_tablica[$_GET['a'] - 1][$_GET['b'] - 1].'" '.
									' order by meta_prikaz_item.rbr_atribut ', 1);
							}
							
							if(!$value && $value != "0"){
								continue;
							}
							
							$l_key = str_replace('sf', '', $key);
							
							//print "<br><br>+++++++++++++ ".$l_key." ---<br>";
							
							if($y2['tip_polja_maska'][$l_key]){
								$y2['tip_polja'][$l_key] = $y2['tip_polja_maska'][$l_key];
							}
							$la_tip[$l_key] = explode('-', $y2['tip_polja'][$l_key]);
							$la_tip[$l_key][0] = strtolower(trim($la_tip[$l_key][0]));
							
							if($la_tip[$l_key][0] == 'smallint' || ($y2['kljuc'][$l_key] && $y2['kljuc'][$l_key] != 'PRI')){
								
								$g_pretraga_string .= 'and '.$y2['ime_polja'][$l_key].' = "'.$value.'" ';
								$l_pretraga_opis .= $y2['label'][$l_key].' = "'.get_item('select '.str_replace('f_', '', $y2['polje_select'][$l_key]).' from '.$y2['kljuc'][$l_key].' where id = "'.$value.'" ').'" ';
							}else{
								if($la_tip[$l_key][0] == 'selectyesno'){
									$g_pretraga_string .= 'and '.$y2['ime_polja'][$l_key].' = "'.$value.'" ';
									$l_pretraga_opis .= $y2['label'][$l_key].' = "'.$value.'" ';
								}else{
									$g_pretraga_string .= 'and '.$y2['ime_polja'][$l_key].' like "%'.$value.'%" ';
									$l_pretraga_opis .= $y2['label'][$l_key].' = "%'.$value.'%" ';
								}
							}
							$l_pretraga_opis .= ' &nbsp; && &nbsp; ';
							
							$l_cnt++;
						}
					}
					
					if($l_is_search == 1){
?>
						<div id="searchLine">
							<b><?=$g_term[$g_language_sign]['pretraga']?>:</b> &nbsp;&nbsp; <?=substr($l_pretraga_opis, 0, sizeof($l_pretraga_opis) - 20)?>
						</div>
<?
					}
?>
