@extends('layout')

@section('content')

<div class="page-header page-header-default">
	<div class="breadcrumb-line">
		<ul class="breadcrumb">
			<li><a href="index.html"><i class="icon-home2 position-left"></i> Penjualan</a></li>
			<li>Laporan</li>
			<li class="active">Laporan Penjualan</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="row">
		{{-- <div class="col-sm-6 col-md-6">
			
			<div class="panel panel-flat">
				<div class="panel-heading">
					<h5 class="panel-title">Laporan Penjualan Keseluruhan</h5>
					<div class="heading-elements">
						<ul class="icons-list">
				      		<li><a data-action="collapse"></a></li>
				      	</ul>
			       	</div>
			    </div>
			    	<form class="form-horizontal" method="POST" action="{{ $url_laporan.'_keseluruhan' }}" id="laporan-keseluruhan" target="_blank">
			    <div class="panel-body">
			    		{{ csrf_field() }}
			    		<div class="form-group">
			    			<label class="control-label col-sm-12 col-md-2">Lokasi</label>
			    			<div class="col-sm-12 col-md-10">
				    			<select name="lokasi" class="form-control set_selected" required="">
				    				@if($lokasi_semua == 'show')
				    					<option value="0">Semua</option>
				    				@endif
				    				@foreach($lokasi_produksi AS $key => $value)
				    					<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
				    				@endforeach
				    			</select>
				    		</div>
			    		</div>
			    		<div class="form-group">
			    			<label class="control-label col-sm-12 col-md-2">Label CV</label>
			    			<div class="col-sm-12 col-md-10">
				    			<select name="label" class="form-control set_selected" required="">
				    				@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
				    				@foreach($arr_opt AS $key => $value)
				    					<option value="{{ $key }}">{{ $value }}</option>
				    				@endforeach
				    			</select>
				    		</div>
			    		</div>
			    		<div class="form-group">
			    			<label class="control-label col-sm-12 col-md-2">Tanggal</label>
			    			<div class="col-sm-12 col-md-10">
			    				<div class="row">
				    				<!-- <div class="col-sm-6 col-md-6">
						    			<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off">
						    		</div>
				    				<div class="col-sm-6 col-md-6">
						    			<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off">
						    		</div> -->
						    		<div class="col-sm-12 col-md-12">
				  						<div class="input-group bootstrap-touchspin">
					  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  						<span class="input-group-addon bootstrap-touchspin-postfix">s/d</span>
					  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  					</div>
				  					</div>
						    	</div>
				    		</div>
			    		</div>
			    		<div class="form-group">
			    			<label class="control-label col-sm-12 col-md-2">&nbsp;</label>
			    			<div class="col-sm-12 col-md-10">
			    				<select name="jenis_laporan" class="form-control set_selected">
				    				@php($lap_opt=[0=>'Rekap', 1=>'Detail'])
				    				@foreach($lap_opt AS $key=>$value)
				    					<option value="{{ $key }}">{{ $value }}</option>
				    				@endforeach
				    			</select>
			    			</div>
			    		</div>
			    </div>
			    <div class="panel-footer">
			    	<div class="col-sm-12 col-md-12 text-right">
				    	<button type="submit" class="btn btn-sm btn-primary"><i class="icon-printer position-left"></i> Cetak</button>
				    </div>
			    </div>
			    	</form>
			</div>
		</div> --}}

		<div class="col-sm-6 col-md-6">
			
			<div class="panel panel-flat">
				<div class="panel-heading">
					<h5 class="panel-title">Laporan Penjualan Per-Pelanggan</h5>
					<div class="heading-elements">
						<!-- <ul class="icons-list">
				      		<li><a data-action="collapse"></a></li>
				      	</ul> -->
				      </div>
				  </div>

				  <form class="form-horizontal" method="POST" action="{{ $url_laporan.'_pelanggan' }}" id="laporan-perpelanggan" target="_blank">
				  	<div class="panel-body">
				  		{{ csrf_field() }}
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Lokasi</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="lokasi" class="form-control set_selected" required="">
				  					@if($lokasi_semua == 'show')
				    					<option value="0">Semua</option>
				    				@endif
				  					@foreach($lokasi_produksi AS $key => $value)
				  					<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Label CV</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="label" class="form-control set_selected" required="">
				  					@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
				  					@foreach($arr_opt AS $key => $value)
				  					<option value="{{ $key }}">{{ $value }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Pelanggan</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="id_pelanggan" class="form-control set_selected" required="">
				  					@foreach($pelanggan AS $key => $value)
				  					<option value="{{ $value->id_pelanggan }}">{{ $value->nama }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Tanggal</label>
				  			<div class="col-sm-12 col-md-10">
				  				<div class="row">
				  					<!-- <div class="col-sm-6 col-md-6">
				  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off">
				  					</div>
				  					<div class="col-sm-6 col-md-6">
				  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off">
				  					</div> -->
				  					<div class="col-sm-12 col-md-12">
				  						<div class="input-group bootstrap-touchspin">
					  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  						<span class="input-group-addon bootstrap-touchspin-postfix">s/d</span>
					  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  					</div>
				  					</div>
				  				</div>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">&nbsp;</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="jenis_laporan" class="form-control set_selected">
				  					@php($lap_opt=[0=>'Rekap', 1=>'Detail'])
				  					@foreach($lap_opt AS $key=>$value)
				  					<option value="{{ $key }}">{{ $value }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  	</div>
				  	<div class="panel-footer">
				  		<div class="col-sm-12 col-md-12 text-right">
				  			<button type="submit" class="btn btn-sm btn-primary"><i class="icon-printer position-left"></i> Cetak</button>
				  		</div>
				  	</div>
				  </form>
				</div>
			</div>

			<div class="col-sm-6 col-md-6">
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title">Laporan Penjualan Per Kelompok</h5>
					</div>

					<form class="form-horizontal" method="POST" action="{{ url('laporan_penjualan/cetak_laporan_kelompok') }}" id="form_laporan_kelompok" target="_blank">
						<input type="hidden" name="_token" value="{{ csrf_token() }}">

						<div class="panel-body">

							<div class="form-group">
								<label class="control-label col-sm-12 col-md-2">Lokasi</label>
								<div class="col-sm-12 col-md-10">
									<select name="lokasi" class="form-control set_selected" required="">
										@if($lokasi_semua == 'show')
					    					<option value="0">Semua</option>
					    				@endif
										@foreach($lokasi_produksi AS $key => $value)
										<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
										@endforeach
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="control-label col-sm-12 col-md-2">Label CV</label>
								<div class="col-sm-12 col-md-10">
									<select name="label" class="form-control set_selected" required="">
										@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
										@foreach($arr_opt AS $key => $value)
										<option value="{{ $key }}">{{ $value }}</option>
										@endforeach
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Kelompok", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10">
									<select name="kategori" class="form-control set_selected" id="kategori" required="true" oninvalid="this.setCustomValidity('Pilih Kelompok!')" onchange="setCustomValidity('')">
										<option value="">--- Pilih Kelompok ---</option>
										@foreach($kategori AS $key => $value)
										<option value="{{ $value->id_kb }}">{{ $value->nama }}</option>
										@endforeach
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Detail", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10">
									<select name="detail" class="form-control set_selected" id="detail">
										<option value="1">Faktur Penjualan</option>
										<option value="2">Kuantitas Barang</option>
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Tanggal", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10" >
									<div class="row">
										<!-- <div class="col-sm-12 col-md-6">
											{{ Form::text("tanggal_awal", date("d/m/Y"), ['class'=>'form-control set_datepicker']) }}
										</div>
										<div class="col-sm-12 col-md-6">
											{{ Form::text("tanggal_akhir", date("d/m/Y"), ['class'=>'form-control set_datepicker']) }}
										</div> -->
										<div class="col-sm-12 col-md-12">
					  						<div class="input-group bootstrap-touchspin">
						  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
						  						<span class="input-group-addon bootstrap-touchspin-postfix">s/d</span>
						  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
						  					</div>
					  					</div>
									</div>
								</div>
							</div>


						</div>
						<div class="panel-footer">
							<div class="col-sm-12 col-md-12 text-right">
								<button type="button" id="btn_print_kelompok" class="btn btn-primary"><i class="icon-printer position-left"></i> Cetak</button>
							</div>
						</div>
					</form>

				</div>
			</div>

		</div> <!--- end : .row -->

		<div class="row">
			<div class="col-sm-6 col-md-6">

				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title">Laporan Jatuh Tempo</h5>
						<div class="heading-elements">
						<!-- <ul class="icons-list">
				      		<li><a data-action="collapse"></a></li>
				      	</ul> -->
				      </div>
				  </div>
				  <form class="form-horizontal" autocomplete="off" method="POST" action="#" id="laporan-jatuhtempo" target="_blank">
				  	<div class="panel-body">
				  		<input type="hidden" name="_token" value="{{ csrf_token() }}">
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Lokasi</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="lokasi" class="form-control set_selected" required="">
				  					@if($lokasi_semua == 'show')
				    					<option value="0">Semua</option>
				    				@endif
				  					@foreach($lokasi_produksi AS $key => $value)
				  					<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Label CV</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="label" class="form-control set_selected" required="">
				  					@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
				  					@foreach($arr_opt AS $key => $value)
				  					<option value="{{ $key }}">{{ $value }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Pelanggan</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="id_pelanggan" class="form-control set_selected" required="">
				  					<option value="0">Semua</option>
				  					@foreach($pelanggan AS $key => $value)
				  					<option value="{{ $value->id_pelanggan }}">{{ $value->nama }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>

				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Periode</label>
				  			<div class="col-sm-12 col-md-5">
				  				<input class="form-control month_datepicker" type="text" name="tanggal_tempo" readonly="readonly" value="{{ date('m-Y') }}" data-date-format="mm-yyyy" data-date-viewmode="years" data-date-minviewmode="months" required>
				  			</div>
				  		</div>
				  	</div>
				  	<div class="panel-footer">
				  		<div class="col-sm-12 col-md-12 text-right">
				  			<button type="button" class="btn btn-sm btn-success" id="btn_excel_lap_tempo"><i class="fa fa-file-excel-o"></i> Excel</button>
				  			<button type="button" class="btn btn-sm btn-primary" id="btn_cetak_lap_tempo"><i class="icon-printer position-left"></i> Cetak</button>
				  		</div>
				  	</div>
				  </form>

				</div>

			</div>

			<div class="col-sm-6 col-md-6">

				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title">Laporan Penjualan per Barang</h5>
						<div class="heading-elements">
						<!-- <ul class="icons-list">
				      		<li><a data-action="collapse"></a></li>
				      	</ul> -->
				      </div>
				  </div>
				  <form class="form-horizontal" method="POST" autocomplete="off" id="form_laporan_barang" action="{{ url('laporan_penjualan/cetak_laporan_barang') }}" target="_blank">
				  	<input type="hidden" name="_token" value="{{ csrf_token() }}">

				  	<div class="panel-body">

				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Lokasi</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="lokasi" class="form-control set_selected" required="">
				  					@if($lokasi_semua == 'show')
				    					<option value="0">Semua</option>
				    				@endif
				  					@foreach($lokasi_produksi AS $key => $value)
				  					<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>
				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Label CV</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select name="label" class="form-control set_selected" required="">
				  					@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
				  					@foreach($arr_opt AS $key => $value)
				  					<option value="{{ $key }}">{{ $value }}</option>
				  					@endforeach
				  				</select>
				  			</div>
				  		</div>

				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Barang</label>
				  			<div class="col-sm-12 col-md-10">
				  				<select class="form-control select-search" id="select_barang" name="barang" required="">

				  				</select>
				  			</div>
				  		</div>

				  		<div class="form-group">
				  			<label class="control-label col-sm-12 col-md-2">Tanggal</label>
				  			<div class="col-sm-12 col-md-10">
				  				<div class="row">
				  					<!-- <div class="col-sm-12 col-md-6">
				  						<input class="form-control set_datepicker" type="text" name="tanggal_awal" value="{{ date('d/m/Y') }}" readonly="" required="">
				  					</div>
				  					<div class="col-sm-12 col-md-6">
				  						<input class="form-control set_datepicker" type="text" name="tanggal_akhir" value="{{ date('d/m/Y') }}" readonly="" required="">
				  					</div> -->
				  					<div class="col-sm-12 col-md-12">
				  						<div class="input-group bootstrap-touchspin">
					  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  						<span class="input-group-addon bootstrap-touchspin-postfix">s/d</span>
					  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
					  					</div>
				  					</div>
				  				</div>
				  			</div>
				  		</div>

				  	</div>
				  	<div class="panel-footer">
				  		<div class="col-sm-12 col-md-12 text-right">
				  			<button type="button" id="cetak_perbarang" class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Cetak Laporan Penjualan Per Barang"><i class="icon-printer position-left"></i> Cetak</button>
				  		</div>
				  	</div>
				  </form>
				</div>

			</div>

		</div> <!--- end : .row -->

		<div class="row">
			<div class="col-sm-6 col-md-6">
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title">Laporan Penjualan Per Kategori</h5>
					</div>

					<form class="form-horizontal" method="POST" action="{{ url('laporan_penjualan/cetak_laporan_kategori_excel') }}" id="form_laporan_kategori" target="_blank">
						<input type="hidden" name="_token" value="{{ csrf_token() }}">

						<div class="panel-body">

							<div class="form-group">
								<label class="control-label col-sm-12 col-md-2">Lokasi</label>
								<div class="col-sm-12 col-md-10">
									<select name="lokasi" class="form-control set_selected" required="">
										@if($lokasi_semua == 'show')
					    					<option value="0">Semua</option>
					    				@endif
										@foreach($lokasi_produksi AS $key => $value)
										<option value="{{ $value->id_lokasi }}">{{ $value->nama_lokasi }}</option>
										@endforeach
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="control-label col-sm-12 col-md-2">Label CV</label>
								<div class="col-sm-12 col-md-10">
									<select name="label" class="form-control set_selected" required="">
										@php($arr_opt = ["3"=>"Semua", "1"=>"CV", "0"=>"Non-CV"])
										@foreach($arr_opt AS $key => $value)
										<option value="{{ $key }}">{{ $value }}</option>
										@endforeach
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Kategori", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10">
									<select name="kategori" class="form-control set_selected" id="kategori2" onchange="get_sub_kategori(this.options[this.selectedIndex].value)">
										<option value="0">--- Pilih Kategori ---</option>
										@foreach($kategori AS $key => $value)
										<option value="{{ $value->id_kb }}">{{ $value->nama }}</option>
										@endforeach
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Sub Kategori", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10">
									<select name="sub_kategori" class="form-control set_selected" id="sub_kategori">
										<option value="0">&nbsp;</option>
									</select>
								</div>
							</div>

							<div class="form-group">
								{{ Form::label("Tanggal", "", ['class'=>'control-label col-sm-12 col-md-2']) }}
								<div class="col-sm-12 col-md-10" >
									<div class="row">
										<!-- <div class="col-sm-12 col-md-6">
											{{ Form::text("tanggal_awal", date("d/m/Y"), ['class'=>'form-control set_datepicker']) }}
										</div>
										<div class="col-sm-12 col-md-6">
											{{ Form::text("tanggal_akhir", date("d/m/Y"), ['class'=>'form-control set_datepicker']) }}
										</div> -->
										<div class="col-sm-12 col-md-12">
					  						<div class="input-group bootstrap-touchspin">
						  						<input type="text" name="tanggal_awal" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
						  						<span class="input-group-addon bootstrap-touchspin-postfix">s/d</span>
						  						<input type="text" name="tanggal_akhir" class="form-control set_datepicker" value="{{ date('d/m/Y') }}" required="" autocomplete="off" data-mask="99/99/9999">
						  					</div>
					  					</div>
									</div>
								</div>
							</div>


						</div>
						<div class="panel-footer">
							<div class="col-sm-12 col-md-12 text-right">
								<button type="button" id="cetak_perkategori" class="btn btn-success"><i class="fa fa-file-excel-o position-left"></i> Excel</button>
							</div>
						</div>
					</form>

				</div>
			</div>
		</div>
	</div>

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

			$(".set_selected").select2();
			// $("#laporan-keseluruhan select[name=lokasi], #laporan-perpelanggan select[name=lokasi], #laporan-jatuhtempo select[name=lokasi], #form_laporan_kelompok select[name=lokasi], #form_laporan_kategori select[name=lokasi], #form_laporan_barang select[name=lokasi]").val(1).trigger("change");

			get_barang();

			$(".set_datepicker").datepicker({
				format : "dd/mm/yyyy",
				autoclose : true,
				zOfIndex : 9999,
			});

			$(".month_datepicker").datepicker({
				format : "mm-yyyy",
				viewMode : 'months',
				minViewMode : 'months',
				autoclose : true,
				zOfIndex : 9999,
			})

			$("#btn_print_kelompok").click(function(evt){
				evt.preventDefault();
				if ($("#kategori").val() == "") {
					$("#kategori").select2('open');
				} else {
					$("#form_laporan_kelompok").submit();
				}
			})

			$("#cetak_perbarang").click(function(evt){
				evt.preventDefault();
				if ($("#select_barang").val() == "") {
					$("#select_barang").select2('open');
				} else {
					$("#form_laporan_barang").submit();
				}
			})

			$("#cetak_perkategori").click(function(evt){
				evt.preventDefault();
				if ($("#kategori2").val() == "" || $("#kategori2").val() == "0") {
					$("#kategori2").select2('open');
				} else {
					$("#form_laporan_kategori").submit();
				}
			})

			$("#btn_cetak_lap_tempo").click(function(){
				$("#laporan-jatuhtempo").attr("action", "{{ $url_laporan.'_jatuhtempo' }}");
				$("#laporan-jatuhtempo").submit();
			})

			$("#btn_excel_lap_tempo").click(function(){
				$("#laporan-jatuhtempo").attr("action", "{{ $url_laporan.'_jatuhtempo/excel' }}");
				$("#laporan-jatuhtempo").submit();
			})

		})

		function get_sub_kategori(id_selected){
			$.ajax({
				url: "{{ url('laporan_penjualan/get_sub_kategori') }}",
				type: 'get',
				data : { id_kelompok : id_selected },
				dataType: 'json',
				success: function(result){
			// alert('success');
			$("[name=sub_kategori]").html('');
			$("[name=sub_kategori]").append('<option value="0">Semua</option>');
			for(i in result){
				$("[name=sub_kategori]").append('<option value="'+result[i].id_kb+'" nama="'+result[i].nama+'">'+result[i].nama+'</option>');
			}

		}
	})
		}

		function get_barang(){
			$.ajax({
				url: "{{ url('laporan_penjualan/get_barang') }}",
				success: function(respon){
					$("select[name=barang]").html('');
					$("select[name=barang]").html('<option value="">--- Pilih Barang ---</option>');
					if(respon.length > 0){
						for(i in respon){
							$("select[name=barang]").append('<option value="'+respon[i].id+'">'+respon[i].kode_barang+' - '+respon[i].nama_barang+'</option>');
						}
					}
				}
			})
		}

	</script>


	@endsection