%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/buggydubrovnik.com/prodaja/statistika/
Upload File :
Create Path :
Current File : //var/www/html/buggydubrovnik.com/prodaja/statistika/obracuni.php

<?php

	if (session_id() == ""){

		session_cache_expire(30);

		session_start();

	}

if(!isset($_SESSION['userx']))

 		{header( 'Location: ../auth.php' ) ; exit;}

		

$rm = 0;

$idiz = 82;

if($_COOKIE['regina']=='rm1')

{$rm=1;}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<script type="text/javascript" src="statsBL.js" ></script>

<script src="../jquery.js"></script>

<link href="../glyphicons.css" type="text/css" rel="stylesheet"/>

<script>

    $(document).ready(function(){

        var sidemenu=$("#izborniklijevo")

        $("#toggleMenuButton").on("click", function(){

            if(sidemenu.hasClass("active")) {

                sidemenu.removeClass("active")

                $(this).removeClass("active")

            }

            else {

                sidemenu.addClass("active")

                $(this).addClass("active")

            }

        })

    })

</script>

<script language="JavaScript" type="text/javascript" src="../calendar_eu.js"></script>

<link rel="stylesheet" href="../calendar.css" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../style.css" rel="stylesheet" type="text/css" />
<link href="stats.css" rel="stylesheet" type="text/css" />



<title>STATISTIKA-OBRAČUNI</title>



<script type="text/javascript">

	var regina = <?php echo $rm; ?>;

	var reginaID = <?php echo $idiz; ?>;

	var vari = "";

	var index=0;

	var ptablica = new Array(0,0,0,0,0,0,0,0,0);

	var pizleti = new Array();

	 var odkad=''; 

 var dokad='';

 var idpartnera='';

 var idprodmj='';

 

function formatCurrency(num) {

	num = num.toString().replace(/\$|\,/g,'');

	if(isNaN(num))

		num = "0";

	sign = (num == (num = Math.abs(num)));

	num = Math.floor(num*100+0.50000000001);

	cents = num%100;

	num = Math.floor(num/100).toString();

	if(cents<10)

		cents = "0" + cents;

	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)

		num = num.substring(0,num.length-(4*i+3))+','+

	num.substring(num.length-(4*i+3));

	return (((sign)?'':'-') + num + '.' + cents );

}

	

function popuniDropdown()

{

	//alert("ispravljam obracune...bit cu gotov oko 19:30 sati");

	//alert('mislim da bi sada sve trebalo raditi - mozemo se cuti ako budes radio obracune. Sada cu napraviti Excelsior ...ne znam sto je s alfa touristom...');

	MakeRequestLoadAllPartnerOB();

	//`IDPartner``naziv``puniNaziv``oib``adresa``odgovornaOs

	pPartneri = ParsirajSve(vari);

	//alert(vari);

	var opt = document.createElement("option");document.getElementById("sPartneri").options.add(opt);

		opt.text = "ODABERI PARTNERA";

        opt.value = "-1";

		

	var opt = document.createElement("option");document.getElementById("sPartneri").options.add(opt);

		opt.text = "----------------------------------------";

        opt.value = "-1";

		

	for(i=0;i<pPartneri['brojac'];i++)

	{

		var opt = document.createElement("option");

		document.getElementById("sPartneri").options.add(opt);

		if(pPartneri['crveno'+i]>0) {opt.text = ''+pPartneri['naziv'+i]+' ['+ pPartneri['crveno'+i]+']'; opt.style.color="red";} else {opt.text = pPartneri['naziv'+i];opt.style.color="black";}

        opt.value = i;

	} 

	

	var opt = document.createElement("option");document.getElementById("sObracun").options.add(opt);

		opt.text = "ODABERITE OBRAČUN";

        opt.value = "-1";

		

	var opt = document.createElement("option");document.getElementById("sObracun").options.add(opt);

		opt.text = "----------------------------------------";

        opt.value = "-1";

			

}	

	

function OdaberiPartnera(){

	formObj = document.forms['unos'];

	formObj.sObracun.options.length = 0;

	document.getElementById('zadnjiObracun').innerHTML="";

	selectElement1 = document.getElementById('sPartneri');

 	selectedValue1 = selectElement1[selectElement1.selectedIndex].value;

 	if(selectedValue1 != -1){

		

	MakeRequestLoadPKProdajnoMjOB(pPartneri['idpartner'+selectedValue1]);	

	pProdMj = ParsirajSve(vari);

	//alert(vari);

		var formObj = document.forms['unos'];

	formObj.sProdMj.options.length = 0;

	var opt = document.createElement("option");

		document.getElementById("sProdMj").options.add(opt);

		opt.text = 'SVA PRODAJNA MJESTA';

        opt.value = -1;

		

		

		

		for(i=0;i<pProdMj['brojac'];i++)

	{

		var opt = document.createElement("option");

		document.getElementById("sProdMj").options.add(opt);

		if(pProdMj['crveno'+i]>0) {opt.text = pProdMj['naziv'+i]+' [' + pProdMj['crveno'+i]+']';opt.style.color="red";} else {opt.text = pProdMj['naziv'+i];opt.style.color="black";}

        opt.value = i;

	} popuniObracune();

		

	/*

		//funkcija koja će vratiti obračune za odabranog partnera

		pObracun = ParsirajSve(vari);

		

		for(i=0;i<pObracun['brojac'];i++)

		{

			var opt = document.createElement("option");

			document.getElementById("sObracun").options.add(opt);

			opt.text = pObracun['naziv'+i];

   	    	opt.value = i;

		} */

 	}



}

	

function prikaziDiv(){

	index = document.getElementById('vrselect').selectedIndex;

	

	if(index==2) {document.getElementById('oddodiv').style.display="none";document.getElementById('vrazmakdiv').style.display="inline";}

	if(index==3) {document.getElementById('oddodiv').style.display="inline";document.getElementById('vrazmakdiv').style.display="none";}

	if((index!=2)&&(index!=3)) {document.getElementById('oddodiv').style.display="none";document.getElementById('vrazmakdiv').style.display="none";}

}

	

function ParsirajSve(value)

{

	value = value.split("##");

	for (var i = 0; i < value.length; i++)

	{

	var tmp = value[i].split("==");

	value[tmp[0]] = tmp[1];

	}

	return value;

}



function PovuciPodatke(){

	

	index = document.getElementById('vrselect').selectedIndex;

 var selectElement1 = document.getElementById('sPartneri');

 var selectedValue1 = selectElement1[selectElement1.selectedIndex].value;

 idpartnera = 'SVI';

 if(selectedValue1 != -1){

 	idpartnera = pPartneri['idpartner'+selectedValue1];

 }

 

  var selectElement2 = document.getElementById('sProdMj');

 var selectedValue2 = selectElement2[selectElement2.selectedIndex].value;

 idprodmj = 'SVI';

 if(selectedValue2 != -1){

 	idprodmj = pProdMj['idprodajnomj'+selectedValue2];

 }

 

 



 



	 

	 if(index==3){	

		vrijednost = (document.unos.pocetak.value).split("-"); 

		odkad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

		

		vrijednost = (document.unos.kraj.value).split("-"); 

		dokad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

	 }

	 

	 if(index==2){ 

		var vpocetak;

		var vkraj;

		vrijednost = (document.unos.pocetak1.value).split("-"); 

		var mjc= vrijednost[1];

	   //za dan

		if(document.unos.vrazmak[0].checked){	

			odkad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

			dokad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

	   //za tjedan

		}else if(document.unos.vrazmak[1].checked){

			var dan = new Date(vrijednost[2],(parseInt(vrijednost[1],10)-1),vrijednost[0]);

			var DuT=dan.getDay();

			//alert(vrijednost[2]+'.'+(parseInt(mjc,10))+'.'+vrijednost[0]);

			if(DuT == 0){

				vpocetak=new Date(vrijednost[2],(parseInt(vrijednost[1],10)-1),vrijednost[0]);

				vpocetak.setDate(vpocetak.getDate() - 6);		

				odkad = vpocetak.getFullYear()+'-'+(vpocetak.getMonth()+1)+'-'+vpocetak.getDate();

				dokad = vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

			}else{

				vpocetak=new Date(vrijednost[2],(parseInt(vrijednost[1],10)-1),vrijednost[0]);

				vpocetak.setDate(vpocetak.getDate() - (DuT-1));

				vkraj = new Date(vpocetak);

				vkraj.setDate(vpocetak.getDate() + 6);

				odkad = vpocetak.getFullYear()+'-'+(vpocetak.getMonth()+1)+'-'+vpocetak.getDate();

				dokad = vkraj.getFullYear()+'-'+(vkraj.getMonth()+1)+'-'+vkraj.getDate();

			}

	   //za mjesec

		}else if(document.unos.vrazmak[2].checked){

			odkad=vrijednost[2]+'-'+vrijednost[1]+'-01';

			vkraj=new Date(vrijednost[2],vrijednost[1],1);

			vkraj.setDate(vkraj.getDate() - 1);

			dokad = vkraj.getFullYear()+'-'+(vkraj.getMonth()+1)+'-'+vkraj.getDate();

	   //za godinu

		}else if(document.unos.vrazmak[3].checked){

			odkad=vrijednost[2]+'-01-01';

			dokad=vrijednost[2]+'-12-31';

		}

	 }

	 

	 if(index!=2&&index!=3) {

		datum = new Date();

		odkad = datum.getFullYear() + '-01-01';

		dokad = datum.getFullYear() + '-12-31';

	 }



 //POPIS REZERVACIJA ZA OBRACUN  tip=obracun, subj=partner, idizlettip=idpartner,   idtrazeno= 0, idtrazeno1= 0

	DohvatiStatistiku6(odkad, dokad, 'obracun', 'partner', idpartnera, idprodmj, 0 );

	podaci = ParsirajSve(vari);

	//alert(vari);

	var nazivx = "";

	

	var tpomjesti ="";

	var ind=0;

	//datum, izlet, prodajno mjesto, broj putnika, cijena, rabat, neto promet

	var	tpartnertekst=' <tr height="30px" style="background-color:#002951;"><td width="100px" style="background-color:#FFF"></td><td width="100px" style="background-image:url(../slike/tablecell1.jpg);background-position:top;background-repeat:repeat-x;background-color:#005fbb;" align="center">Izlet</td><td width="100px" style="background-image:url(../slike/tablecell1.jpg);background-position:top;background-repeat:repeat-x;background-color:#005fbb;" align="center">Broj putnika</td><td width="100px" style="background-image:url(../slike/tablecell1.jpg);background-position:top;background-repeat:repeat-x;background-color:#005fbb;" align="center">Cijena (kn)</td><td style="background-image:url(../slike/tablecell1.jpg);background-position:top;background-repeat:repeat-x;background-color:#005fbb;" width="100px" align="center">Rabat (kn)</td><td style="background-image:url(../slike/tablecell1.jpg);background-position:top;background-repeat:repeat-x;background-color:#005fbb;" width="100px" align="center">Neto promet (kn)</td></tr>';

		ukupnoputnika1=0;

		ukupnacijena1=0;

		ukupnorabat1=0;

		netopromet1=0;

		

		n2=0;

		ukupnoputnika2=0;

		ukupnacijena2=0;

		ukupnorabat2=0;

		netopromet2=0;

//+++	

	if (pProdMj['brojac']>0)

	{

		var ispmj = new Array(pProdMj['brojac']);

		for(i=0;i<pProdMj['brojac'];i++)

		{

			ispmj[i]= new Array(6);

			ispmj[i][0]= pProdMj['naziv'+i];

			ispmj[i][1]= 0;

			ispmj[i][2]= 0;

			ispmj[i][3]= 0;

			ispmj[i][4]= 0;

			ispmj[i][5]= 0;

		}	

	}

	

	

	

		

		

	for(i=0;i<podaci['brojac'];i++)

	{

		//+++++	

		//alert (podaci['nazivprodajnogmjesta'+i]);

				for(j=0;j<pProdMj['brojac'];j++)

					{

						if (podaci['nazivprodajnogmjesta'+i]==ispmj[j][0])

						{

							 ispmj[j][1]+= parseInt(podaci['brodrasli'+i]) + parseInt(podaci['brdjeca'+i]);

							 ispmj[j][2]+=parseInt(podaci['cijenaodrasli'+i]) + parseInt(podaci['cijenadjeca'+i]);

							 ispmj[j][3]+=parseInt(podaci['rabatodrasli'+i]) + parseInt(podaci['rabatdjeca'+i]);

							 ispmj[j][4]+=parseInt(podaci['cijenaodrasli'+i]) + parseInt(podaci['cijenadjeca'+i])-(parseInt(podaci['rabatodrasli'+i]) + parseInt(podaci['rabatdjeca'+i]));

							 ispmj[j][5]++;

							

						}

					}

			// alert (ispmj);

			 

		if (podaci['nazivizlet'+i] != nazivx) 

		{

			

			nazivx = podaci['nazivizlet'+i] ;

			

			if (ind==1){

			tpartnertekst+='<tr height="30px" style="background-color:#002951;"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">Ukupno :</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+n2+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+ukupnoputnika2+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+formatCurrency(ukupnacijena2)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(ukupnorabat2)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(netopromet2)+'</td></tr>';}

			

			tpartnertekst+='<tr height="30"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td></tr>';					

			tpartnertekst+='<tr height="30"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">I Z L E T :</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+podaci['nazivizlet'+i]+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;"> </td></tr>';

		ind=1;

		n2=0;			

		ukupnoputnika2=0;

		ukupnacijena2=0;

		ukupnorabat2=0;

		netopromet2=0;

			

		}

		

		ukupnoputnika = parseInt(podaci['brodrasli'+i]) + parseInt(podaci['brdjeca'+i]);

		ukupnoputnika1+=ukupnoputnika; ukupnoputnika2+=ukupnoputnika;

		ukupnacijena = parseInt(podaci['cijenaodrasli'+i]) + parseInt(podaci['cijenadjeca'+i]);

		ukupnacijena1+=ukupnacijena; ukupnacijena2+=ukupnacijena;

		ukupnorabat = parseInt(podaci['rabatodrasli'+i]) + parseInt(podaci['rabatdjeca'+i]);

		ukupnorabat1+=ukupnorabat; ukupnorabat2+=ukupnorabat;

		netopromet = ukupnacijena - ukupnorabat;

		netopromet1+=netopromet; netopromet2+=netopromet;

		n2+=1;

		

		vrijednost = (podaci['datum'+i].split("-")); 

		datumt=vrijednost[2]+'.'+vrijednost[1]+'.'+vrijednost[0];

		

		

		tpartnertekst+='<tr height="30"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">'

					+datumt+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+podaci['nazivizlet'+i]+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+ukupnoputnika+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+formatCurrency(ukupnacijena)+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+formatCurrency(ukupnorabat)+'</td><td style="background-image:url(../slike/tablecell3.jpg);text-align:center;">'

					+formatCurrency(netopromet)+'</td></tr>';

	} 

	

//++++++	



tpomjesti ='<tr height="30px" style="background-color:#002951;"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;"> </td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center"> </td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center"> </td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center"> </td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center"> </td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center"> </td></tr>'



	for(j=0;j<pProdMj['brojac'];j++)

		{

			//alert(selectElement1[selectElement1.selectedIndex].value);

			if	((ispmj[j][2]>0)||(ispmj[j][0]== selectElement2[selectElement2.selectedIndex].text)||(selectElement2[selectElement2.selectedIndex].value==-1)){

	tpomjesti +='<tr height="30px" style="background-color:#002951;"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">'+ispmj[j][0]+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+ispmj[j][5]+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+ispmj[j][1]+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+formatCurrency(ispmj[j][2])+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(ispmj[j][3])+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(ispmj[j][4])+'</td></tr>';

	}

		}

		

		

	tpartnertekst+='<tr height="30px" style="background-color:#002951;"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">Ukupno :</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+n2+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+ukupnoputnika2+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+formatCurrency(ukupnacijena2)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(ukupnorabat2)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(netopromet2)+'</td></tr>';

				

	tsumarno='<table  class="podaci" align="center" cellspacing="1" cellpadding="5"  style=" border-width:1px; font-family:Arial;font-size:12px; margin-top:25px; color:#FFF;  border-color:#FFF;"><tr height="30px" style="background-color:#002951;"><td style="background-image:url(../slike/tablecell1.jpg); background-repeat:repeat-x; background-color:#005fbb; background-position:top;">Ukupno :</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+podaci['brojac']+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+ukupnoputnika1+'</td><td width="100px" style="background-image:url(../slike/tablecell3.jpg);" align="center">'+formatCurrency(ukupnacijena1)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(ukupnorabat1)+'</td><td style="background-image:url(../slike/tablecell3.jpg);" width="100px" align="center">'+formatCurrency(netopromet1)+'</td></tr>';

		

		document.getElementById('tijelo').innerHTML=tsumarno+tpomjesti+tpartnertekst + '</table></div>';

}



function spremiObracun(){

	

	MakeRequestInsertobracun( 0 , odkad, dokad, idpartnera, idprodmj, 0);

	//alert(vari);

	popuniObracune();

	//alert(vari);

	

	alert("Obračun je uspješno spremljen");

	}

	

	

	

	var pObracun=new Array();





function povuciObracun(){

	

	

		

 var selectElement2 = document.getElementById('sObracun');

 var selectedValue2 = selectElement2[selectElement2.selectedIndex].value;

 

 document.getElementById('oddodiv').style.display="inline";document.getElementById('vrazmakdiv').style.display="none";

 document.getElementById('vrselect').selectedIndex=3;

 

	vrijednost = (pObracun['odkad'+selectedValue2].split("-")); 

		odkad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];

		document.unos.pocetak.value=odkad;

		vrijednost = (pObracun['dokad'+selectedValue2].split("-")); 

		dokad=vrijednost[2]+'-'+vrijednost[1]+'-'+vrijednost[0];document.unos.pocetak.value=odkad;

 document.unos.kraj.value=dokad;

 	

 PovuciPodatke();

}





function CallPrint(strid)

{

	var selectElement2 = document.getElementById('sPartneri');

 	var tpartner = selectElement2[selectElement2.selectedIndex].text;

 	var selectElement2 = document.getElementById('sProdMj');

 	var tprodmj = selectElement2[selectElement2.selectedIndex].text;

 

	var datum = new Date ()

  	tdatum=datum.getFullYear()+'-'+(parseInt(datum.getMonth())+1)+'-'+datum.getDate();

  

  	vrijednost = (tdatum.split("-")); 

	datumt=vrijednost[2]+'.'+vrijednost[1]+'.'+vrijednost[0]+'.';

		

	var prtContent = document.getElementById(strid);

	var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');

	WinPrint.document.write('<div style="margin:0 auto; font-weight:bold; text-align:center"><span style="font-family:Arial"><table align="center" style="font-family:Verdana; font-size:12px;"><tr><td align="left" width="200px" >Datum:</td><td> <b>'+datumt+'</b></td></tr><tr><td align="left" width="200px">Partner:</td><td> <b>'+tpartner+'</b></td></tr><tr><td align="left" width="200px">Prodajno mjesto:</td> <td> <b>'+tprodmj+'</b></td></tr></table></span></div>'+prtContent.innerHTML);

	WinPrint.document.close();

	WinPrint.focus();

	WinPrint.print();

	WinPrint.close();

	prtContent.innerHTML=strOldOne;

}



function popuniObracune(){

	var odkadt='';

	var dokadt='';

	var selectElement2 = document.getElementById('sProdMj');

 	var selectedValue2 = selectElement2[selectElement2.selectedIndex].value;

 	idprodmj = 'SVI';

 	if(selectedValue2 != -1){

 		idprodmj = pProdMj['idprodajnomj'+selectedValue2];

 	}

 

  	var selectElement1 = document.getElementById('sPartneri');

 	var selectedValue1 = selectElement1[selectElement1.selectedIndex].value;

 	idpartnera = 'SVI';

 	if(selectedValue1 != -1){

 		idpartnera = pPartneri['idpartner'+selectedValue1];

 	}

	vari='';

	DohvatiStatistiku6(0, 0, 'obracun', 'obracun', idpartnera, idprodmj, 0 );

	pObracun = ParsirajSve(vari);

	formObj = document.forms['unos'];

	formObj.sObracun.options.length = 0;

	var opt = document.createElement("option");

		

	document.getElementById("sObracun").options.add(opt);

	opt.text = 'ODABERITE OBRAČUN';

    opt.value = -1;

	brobracuna=-1;

		

	for(i=0;i<pObracun['brojac'];i++)

	{ 	

		brobracuna+=1;

		vrijednost = (pObracun['odkad'+i].split("-")); 

		odkadt=vrijednost[2]+'.'+vrijednost[1]+'.'+vrijednost[0];

		

		vrijednost = (pObracun['dokad'+i].split("-")); 

		dokadt=vrijednost[2]+'.'+vrijednost[1]+'.'+vrijednost[0];

	//odkadt="odkad"+i;

	//dokadt="dokad"+i;

		var opt = document.createElement("option");

		opt.text = odkadt+' - '+dokadt;

        opt.value = i;

		document.getElementById("sObracun").options.add(opt);

		

	} 

	

	document.getElementById('zadnjiObracun').innerHTML='Zadnji obračun :<br /><span style="color:red"> '+odkadt+' - '+dokadt+'</span>';

	}

	

function brisiobracun() {

	var selectElement2 = document.getElementById('sObracun');

 var selectedValue2 = selectElement2[selectElement2.selectedIndex].value;

	MakeRequestDeleteobracun(pObracun['idobracun'+selectedValue2]);

	popuniObracune();

	alert("Obračun je uspješno izbrisan");

}

</script>

</head>



<body onload="javascript:popuniDropdown();" style=" margin:0 auto;">

<div id="gornjatraka">

    <span id="toggleMenuButton"></span>

<div style="float:right; margin-right:5px;padding-top:55px;">Prijavljeni ste kao <b><?php if (isset($_SESSION['user'])){ echo $_SESSION['user'];} else{  echo $_SESSION['userx'];}?></b></div>

</div>



<div id="main">

	<div id="izborniklijevo">

        <div class="izbornik"><span class="glyphicon glyphicon-home"></span><a href="../start.php">&nbsp;Glavni izbornik</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-stats"></span> <a href="index.php">&nbsp;Grafovi</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-map-marker"></span> <a href="stexcursions.php">&nbsp;Statistika Izlet</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-briefcase"></span> <a href="stpart.php">&nbsp;Statistika Partner</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-user"></span> <a href="stvodici.php">&nbsp;Statistika Vodič</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-road"></span> <a href="stvozaci.php">&nbsp;Statistika Vozač</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-plane"></span> <a href="stvozila.php">&nbsp;Statistika Vozila</a></div>

        <div class="izbornik"><span class="glyphicon glyphicon-euro"></span> <a href="obracuni.php">&nbsp;Obračuni</a></div>

		

	</div>

	

    <div id="tijelo" >

    </div>
    <h1 class="title">OBRAČUNI</h1>



	<div id="desno1"><br />

    <div style="text-align: center"><a href="javascript:CallPrint('tijelo');"><b><span class="glyphicon glyphicon-print"></span> PRINT</b></a></div><br /><br />

    <form onsubmit="return false" name="unos">

   <span style="width:150px;">

   

   </span>

   <table class="podaci" style="margin-left:15px;">

   <tr><td style="width:150px;"  ><select id="sPartneri" onchange="javascript:OdaberiPartnera();"></select> <br />

   <br /><select name="sProdaMj" id="sProdMj"  onchange="popuniObracune();		

">

   </select><br /><br />

   <select onchange="prikaziDiv();" id="vrselect" ><option>Odaberite format</option><option>------------------------</option><option value="1" ><b>Zadani periodi</b> </option><option value="2"><b>Odabir datuma</b></option></select> <br /><br />

   <div id="vrazmakdiv">Početni datum:<br /><input style="max-width:90px;" name="pocetak1" type="text" /> <script type="text/javascript" >



						new tcal ({

							// form name

							'formname': 'unos',

							// input name

							'controlname': 'pocetak1'

						});

						</script><br />

                        

                      

                        <input type="radio" name="vrazmak" /> Dan<br />

                           <input type="radio" name="vrazmak"/> Tjedan<br />

                              <input type="radio" name="vrazmak"/> Mjesec<br />

                                 <input type="radio" name="vrazmak"/> Godina<br /></div>

                                 

                      <div id="oddodiv">Početni datum:<br /><input style="max-width:90px;" name="pocetak" type="text" /> <script type="text/javascript" >



						new tcal ({

							// form name

							'formname': 'unos',

							// input name

							'controlname': 'pocetak'

						});

						</script><br />

Krajnji datum:<br /><input style="max-width:90px;"  name="kraj" type="text" /> <script type="text/javascript" >



						new tcal ({

							// form name

							'formname': 'unos',

							// input name

							'controlname': 'kraj'

						});

						</script></div>

   <br /><br /><br />

                      <button class="button" onclick="PovuciPodatke();" >PRIKAŽI</button> <br /><br />

                      <button class="button" onclick="javascript:spremiObracun();popuniObracune();" >SPREMI OBRAČUN</button> <br /><br />

   &nbsp;<a href="javascript:brisiobracun();"><img src="../slike/x.png" style="vertical-align:middle;" border="0"/></a>

    	<br /><select id="sObracun"  onchange="javascript:povuciObracun();"></select><br /><br />

        <div id="zadnjiObracun"></div></td></tr></table></form>

                     

  </div>

    </div>

</div>

</body>

</html>

Zerion Mini Shell 1.0