<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Larry Report</h1>
    	</div>
    </div>
            <div class="row">
                <div class="col-lg-12">
                	<?php if(session('status')): ?>
					<div class="alert alert-success">
						<?php echo e(session('status')); ?>

					</div>
					<?php endif; ?>
					<?php if(count($errors) > 0): ?>
						<div class="alert alert-danger">
							<strong>Whoops!</strong> There were some problems with your input.<br><br>
							<ul>
								<?php foreach($errors->all() as $error): ?>
									<li><?php echo e($error); ?></li>
								<?php endforeach; ?>
							</ul>
						</div>
					<?php endif; ?>
                    <div class="panel panel-default">
						<div class="panel-heading">
                            Upload CSV
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
									<form class="form-horizontal" method="POST" action="<?php echo e(url('admin/accounting/upload_csv')); ?>" enctype="multipart/form-data">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<div class="form-group">
											<div class="col-md-6 morePadding">
												<input type="file" name="file" style="color: #317aba;">
											</div>
											<div class="col-md-6 morePadding">
												<input type="submit" name="submit" value="Upload" class="btn btn-primary" style="float: right;">
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<div class="panel panel-default">
						<div class="panel-heading">
                            Generate Report
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
									<form class="form-horizontal" method="POST" action="<?php echo e(url('admin/accounting/generate_report2')); ?>">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<div class="form-group">
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('start_period')">
												<input type="number" min="1" max="13" step="1" class="form-control" id="start_period" name="start_period" value="<?php echo e(old('start_period')); ?>" title="Start Period">
												<span id="start_period-label" class="label-text">Start Period</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('start_year')">
												<input type="number" min="2015" max="2024" step="1" class="form-control" id="start_year" name="start_year" value="<?php echo e(old('start_year')); ?>" title="Start Year">
												<span id="start_year-label" class="label-text">Start Year</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('end_period')">
												<input type="number" min="1" max="13" step="1" class="form-control" id="end_period" name="end_period" value="<?php echo e(old('end_period')); ?>" title="End Period">
												<span id="end_period-label" class="label-text">End Period</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('end_year')">
												<input type="number" min="2015" max="2024" step="1" class="form-control" id="end_year" name="end_year" value="<?php echo e(old('end_year')); ?>" title="End Year">
												<span id="end_year-label" class="label-text">End Year</span>	
											</div>
										</div>
										<div class="form-group">
											
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded1')">
												<input type="number" class="form-control" id="excluded1" name="excluded[1]" value="<?php echo e(old('excluded.1')); ?>" title="Excluded Suffix Code 1">
												<span id="excluded1-label" class="label-text">Excluded Suffix Code 1</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded2')">
												<input type="number" class="form-control" id="excluded2" name="excluded[2]" value="<?php echo e(old('excluded.2')); ?>" title="Excluded Suffix Code 2">
												<span id="excluded2-label" class="label-text">Excluded Suffix Code 2</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded3')">
												<input type="number" class="form-control" id="excluded3" name="excluded[3]" value="<?php echo e(old('excluded.3')); ?>" title="Excluded Suffix Code 3">
												<span id="excluded3-label" class="label-text">Excluded Suffix Code 3</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded4')">
												<input type="number" class="form-control" id="excluded4" name="excluded[4]" value="<?php echo e(old('excluded.4')); ?>" title="Excluded Suffix Code 4">
												<span id="excluded4-label" class="label-text">Excluded Suffix Code 4</span>	
											</div>
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded5')">
												<input type="number" class="form-control" id="excluded5" name="excluded[5]" value="<?php echo e(old('excluded.5')); ?>" title="Excluded Suffix Code 5">
												<span id="excluded5-label" class="label-text">Excluded Suffix Code 5</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded6')">
												<input type="number" class="form-control" id="excluded6" name="excluded[6]" value="<?php echo e(old('excluded.6')); ?>" title="Excluded Suffix Code 6">
												<span id="excluded6-label" class="label-text">Excluded Suffix Code 6</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded7')">
												<input type="number" class="form-control" id="excluded7" name="excluded[7]" value="<?php echo e(old('excluded.7')); ?>" title="Excluded Suffix Code 7">
												<span id="excluded7-label" class="label-text">Excluded Suffix Code 7</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('excluded8')">
												<input type="number" class="form-control" id="excluded8" name="excluded[8]" value="<?php echo e(old('excluded.8')); ?>" title="Excluded Suffix Code 8">
												<span id="excluded8-label" class="label-text">Excluded Suffix Code 8</span>	
											</div>
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('start_gl')">
												<input type="text" class="form-control" id="start_gl" name="start_gl" value="<?php echo e(old('start_gl')); ?>" title="Start GL">
												<span id="start_gl-label" class="label-text">Start GL</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('end_gl')">
												<input type="type" class="form-control" id="end_gl" name="end_gl" value="<?php echo e(old('end_gl')); ?>" title="End GL">
												<span id="end_gl-label" class="label-text">End GL</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('company')">
												<input type="number" class="form-control" id="company" name="company" value="<?php echo e(old('company')); ?>" title="Company Number">
												<span id="company-label" class="label-text">Company Number</span>	
											</div>
											<div class="col-md-3 morePadding">
												<button type="submit" class="btn btn-primary" style="float: right;">
													Generate
												</button>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<div class="panel panel-default"
					<?php if(!isset($suffixes)): ?>
					style="display: none;"
					<?php endif; ?>
					>
						<div class="panel-heading">
                            View Report
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
                                <?php if(isset($suffixes)): ?>
	                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
	                                    <thead>
	                                        <tr>
	                                            <th>Company</th>
	                                            <th>GL</th>
	                                            <th>Suffix</th>
	                                            <th>Period</th>
	                                            <th>Date</th>
	                                            <th>Debit</th>
	                                            <th>Credit</th>
	                                        </tr>
	                                    </thead>
	                                    <tfoot>
	                                    	<tr>
	                                    		<th>&nbsp;</th>
	                                    		<th>&nbsp;</th>
	                                    		<th>&nbsp;</th>
	                                    		<th>&nbsp;</th>
	                                    		<th>&nbsp;</th>
	                                    		<th></th>
	                                    		<th></th>
	                                    	</tr>
	                                    </tfoot>
	                                    <tbody>
	                                    <?php $count = 0;  ?>
	                                    <?php foreach($suffixes as $suffix): ?>
	                                    <?php $count++; ?>
	                                    <?php if($count % 2 == 1): ?>
	                                        <tr class="odd">
	                                    <?php else: ?>
	                                    	<tr class="even">
	                                    <?php endif; ?>
												<td><?php echo e($suffix->company); ?></td>
												<td><?php echo e($suffix->gl_account_number); ?></td>
												<td><?php echo e($suffix->journal_entry_suffix); ?></td>
												<td><?php echo e($suffix->journal_entry_period); ?> - <?php echo e($suffix->journal_entry_year); ?> </td>
												<td><?php echo e($suffix->date); ?></td>
												<td><?php echo e($suffix->debit); ?></td>
												<td><?php echo e($suffix->credit); ?></td>
	                                        </tr>
	                                  	<?php endforeach; ?>
	                                       </tbody>
	                                	</table>
                                	<?php endif; ?>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/jquery.timepicker.css')); ?>" />
	<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/bootstrap-datepicker3.min.css')); ?>" />
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.css"/>
	<style>
			input:focus+.label-text, input:not([value=""])+.label-text, select+.label-text
		    		{
		    font-weight: normal;
		    padding: 0;
		    padding-left: 20px;
		    -webkit-transform: translateY(-2rem) scale(.7);
		    transform: translateY(-2rem) scale(.7);
		}
		input+.label-text, select+.label-text, .hasValue{
		    font-size: 1.5rem;
		    font-weight: 400;
		    position: absolute;
		    top: 0;
		    left: 0;
		    display: block;

		    padding-left: 20px;
		    padding-top: 5px;
		    padding-bottom: 5px;
		    opacity: .8;
		    transition: all .3s ease-out,opacity 150ms ease .3s;
		    -webkit-transform: translateY(0) scale(1);
		    transform: translateY(0) scale(1);
		    -webkit-transform-origin: left top;
		    transform-origin: left top;
		}
		span {
		    font-size: 1rem;
		    font-weight: 600;
		    display: block;
		    padding-top: .25rem;
		    padding-bottom: .25rem;
		    margin-left: 1rem;
		    color: #317aba;
		}
		.hasValue
		{
		    font-weight: normal;
		    padding: 0;
		    padding-left: 20px;
		    -webkit-transform: translateY(-2rem) scale(.7);
		    transform: translateY(-2rem) scale(.7);
		}
		

		@media (max-width: 959px)
		{
			.morePadding {
			    margin-top: 1.5em;
			}
		}

		@media (min-width: 960px)
		{
			.morePadding {
			    margin-top: 1em;
			}
		}
		
	</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom'); ?>
	<script src="<?php echo e(asset('js/jquery.datepair.min.js')); ?>"></script>
	<script src="<?php echo e(asset('js/bootstrap-datepicker.min.js')); ?>"></script>
	<script src="<?php echo e(asset('js/jquery.timepicker.min.js')); ?>"></script>
	<script type="text/javascript" src="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.js"></script>
	
	<script>
	    $('#start_date_container .date').datepicker({
	        'format': 'yyyy-m-d',
	        'autoclose': true
	    });
	    $('#end_date_container .date').datepicker({
	        'format': 'yyyy-m-d',
	        'autoclose': true
	    });

	    $(document).ready(function() {
	        var table1 =    $('#dataTables-example').dataTable( {
	    					"paging": false,
	    					"order": [ 4, 'asc'],
	    					"stateSave" : false,
	    					"scrollX" : window.innerWidth < 800 ? true : false,
    					        "footerCallback": function ( row, data, start, end, display ) {
    					            var api = this.api(), data;
    					 
    					            // Remove the formatting to get integer data for summation
    					            var intVal = function ( i ) {
    					                return typeof i === 'string' ?
    					                    i.replace(/[\$,]/g, '')*1 :
    					                    typeof i === 'number' ?
    					                        i : 0;
    					            };
    					 
    					 
    					            // Total over this page
    					            pageTotalDebit = api
    					                .column( 5, { page: 'current'} )
    					                .data()
    					                .reduce( function (a, b) {
    					                    return intVal(a) + intVal(b);
    					                }, 0 );

    					         // Total over this page
    					            pageTotalCredit = api
    					                .column( 6, { page: 'current'} )
    					                .data()
    					                .reduce( function (a, b) {
    					                    return intVal(a) + intVal(b);
    					                }, 0 );
    					 
    					            // Update footer
    					            $( api.column( 5 ).footer() ).html(
    					                '$'+pageTotalDebit.toFixed(3)
    					            );
    					            $( api.column( 6 ).footer() ).html(
        					                '$'+pageTotalCredit.toFixed(3)
        					            );
    					        }
	    					
	            } );  


	        });

        
	</script>

	<script>
	
		$('.form-control').each(function() {
		   var elem = $(this);
	
		   // Save current value of element
		   elem.data('oldVal', elem.val());
	
		   // Look for changes in the value
		   elem.bind("propertychange change click keyup input paste", function(event){
		      // If value has changed...
		      if (elem.data('oldVal') != elem.val()) {
		       // Updated stored value
		       elem.data('oldVal', elem.val());
		       var elem2 = $('#'+elem.attr('id')+"-label");
		       elem2.addClass('hasValue');
		       elem2.removeClass('label-text');
		       if(elem.val() == "")
		       {
			       
		    	   elem2.addClass('label-text');
			       elem2.removeClass('hasValue');
		       }
		     }
		   });
		 });
	
		function inputFocus(id)
		{
			document.getElementById(id).focus();
		}
	
	</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('residential.templates.uadmin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>