<?php
require_once "header.php";
require_once "connect.php";

//pega a data de hoje como padr??o de busca
$dt_hoje = date("dmY"); 
//echo $dt_hoje;

?>

    <div class="tab-content">
      <div class="block">
        <div class="header">
          	<h1>Fluxo de Caixa</h1>
  		  </div><!--breadcrumbs-->

			<div class="content controls">
                <div class="form-row">
                  <div class="col-md-3">
                  <!--h4 >Informe o Período</h4></div-->
                </div>

		<form id=validate_custom action="erpc_financeiro_fluxo_caixa.php" method="POST" class="stdform stdform2">

			<div class=form-row>
                <div class="col-md-2"/><label>Informe os Parâmetros</label></div>
                <div class="col-md-2"/></div>
			</div>
			<div class=form-row>
				<div class="col-md-2"/><label>Saldo Inicial</label></div>
				<div class="col-md-2"/><input type=text name="vl_saldo_inicial" class="form-control mask_money" id="vl_saldo_inicial" /></div>
			</div>

			<div class="form-row">
				<div class="col-md-2"><label>Ano</label></div>	
				<div class="col-md-2">
            		<select required name="nr_ano" class="form-control">
                		<?php 
                		$anoInicial = 2008;
                		foreach (range(date('Y')+2, $anoInicial) as $nr_ano) {
                		    if($nr_ano == date('Y')){
                		        echo "<option selected value='$nr_ano'>$nr_ano</option>";
                		    }else{
                		        echo "<option value='$nr_ano'>$nr_ano</option>";
                		    } 
                		}
                		?>
            		</select>
        		</div>
        	</div> 
			
          <div class="row clear"/><br>&nbsp;</div>


            <div class=footer>
              <div class="side pull-right">
                <div class=btn-group>
        		        <button class="btn btn-success" type="submit" onClick="$('#validate_custom').validationEngine('hide');" value="Buscar" name="buscar">Buscar</button>
                    <button class="btn btn-default" type="button" onClick="window.history.go(-1)" value="Voltar">Voltar</button>
                    <!-- <input type="submit" class="btn"  value="Buscar" name="buscar"></td> -->
        		    </div>
              </div>
            </div>


		</form>
				</div>
      </div>
      </div><!--mainright-->
    <!-- END OF RIGHT PANEL -->

<div class="clearfix"></div>

<?php include "footer.php"; ?>

<script type="text/javascript">
jQuery(document).ready(function(){

    $("#dt_inicio").mask("99/99/9999");
    $("#dt_final").mask("99/99/9999");

		// basic chart
		var flash = [[0, 2], [1, 6], [2,3], [3, 8], [4, 5], [5, 13], [6, 8]];
		var html5 = [[0, 5], [1, 4], [2,4], [3, 1], [4, 9], [5, 10], [6, 13]];

		function showTooltip(x, y, contents) {
			jQuery('<div id="tooltip" class="tooltipflot">' + contents + '</div>').css( {
				position: 'absolute',
				display: 'none',
				top: y + 5,
				left: x + 5
			}).appendTo("body").fadeIn(200);
		}


		var plot = jQuery.plot(jQuery("#chartplace2"),
			   [ { data: flash, label: "Flash(x)", color: "#fb6409"}, { data: html5, label: "HTML5(x)", color: "#8cb840"} ], {
				   series: {
					   lines: { show: true, fill: true, fillColor: { colors: [ { opacity: 0.05 }, { opacity: 0.15 } ] } },
					   points: { show: true }
				   },
				   legend: { position: 'nw'},
				   grid: { hoverable: true, clickable: true, borderColor: '#ccc', borderWidth: 1, labelMargin: 10 },
				   yaxis: { min: 0, max: 15 }
				 });

		var previousPoint = null;
		jQuery("#chartplace2").bind("plothover", function (event, pos, item) {
			jQuery("#x").text(pos.x.toFixed(2));
			jQuery("#y").text(pos.y.toFixed(2));

			if(item) {
				if (previousPoint != item.dataIndex) {
					previousPoint = item.dataIndex;

					jQuery("#tooltip").remove();
					var x = item.datapoint[0].toFixed(2),
					y = item.datapoint[1].toFixed(2);

					showTooltip(item.pageX, item.pageY,
									item.series.label + " of " + x + " = " + y);
				}

			} else {
			   jQuery("#tooltip").remove();
			   previousPoint = null;
			}

		});

		jQuery("#chartplace2").bind("plotclick", function (event, pos, item) {
			if (item) {
				jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + ".");
				plot.highlight(item.series, item.datapoint);
			}
		});


		// bar graph
		var d2 = [];
		for (var i = 0; i <= 10; i += 1)
			d2.push([i, parseInt(Math.random() * 30)]);

		var stack = 0, bars = true, lines = false, steps = false;
		jQuery.plot(jQuery("#bargraph2"), [ d2 ], {
			series: {
				stack: stack,
				lines: { show: lines, fill: true, steps: steps },
				bars: { show: bars, barWidth: 0.6 }
			},
			grid: { hoverable: true, clickable: true, borderColor: '#bbb', borderWidth: 1, labelMargin: 10 },
			colors: ["#8cb840"]
		});

		// calendar
		jQuery('#calendar').datepicker();



});
</script>
