/
home
/
sjslayjy
/
public_html
/
mosaram
/
resources
/
views
/
dashboard
/
report
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title','Stock Report') @section('content') <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="#">{{__('messages.Home')}}</a> </li> <li class="active">Party Aging Report</li> </ul> </div> <div class="page-content"> <h3 class="header smaller lighter blue">Party Aging Report</h3> <div class="row"> <div class="col-xs-12"> <form action="" method="POST" role="form"> <div class="row"> {{csrf_field()}} <div class="col-md-3"> <div class="form-group"> <label for="master_rake_id">Dealers</label> <select class="form-control select2" name="dealer_id" id="dealer_id"> <option value="">Select Dealers</option> @foreach($dealers as $dealer) <option value="{{$dealer->id}}" {{isset($dealer_id) && $dealer_id==$dealer->id ? "selected":""}}>{{$dealer->name}}</option> @endforeach() </select> @if ($errors->has('dealer_id')) <span class="label label-danger">{{ $errors->first('dealer_id') }}</span> @endif </div> </div> <div class="col-md-3"> <div class="form-group"> <button type="submit" class="btn btn-primary">Submit</button> </div> </div> </div> </form> <div class="clearfix"> <div class="pull-right tableTools-container"> </div> </div> @if (session('success')) <div class="alert alert-success"> {{ session('success') }} </div> @endif @if (session('error')) <div class="alert alert-danger"> {{ session('error') }} </div> @endif @foreach($dealers as $dealer) @if(isset($dealer_id) && $dealer->id == $dealer_id) <div class="table-header"> {{$dealer->name}} ({{$dealer->address1}}) </div> <div class="table-responsive"> <div class="dataTables_borderWrap"> <table id="dynamic-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th colspan="2">Debitors Total</th> <th>15 Days</th> <th>30 Days</th> <th>45 Days</th> <th>60 Days</th> <th>75 Days</th> <th>90 Days</th> <th>Over 90 Days</th> <th></th> </tr> <tr> <th></th> <th>Total Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Pending Amount</th> <th>Total Pending Amount</th> </tr> </thead> <tbody> @foreach($product_categories as $product_category) <tr> <td> {{$product_category->category}}</td> <td> @php $total_amount = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereDate('created_at','<=',date('Y-m-d')) ->sum('total'); @endphp @if($total_amount) <a target="_blank" href='{{URL("/user/outstating-total-amount-details/$dealer->id/$product_category->id")}}'>{{$total_amount}}</a> @else {{$total_amount}} @endif </td> <td> @php $total_pending_amount = 0; $current_date = date('Y-m-d'); $last_15_date = date('Y-m-d',strtotime('-15 days')); $total_pending_amount_15 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_15_date,$current_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_15; @endphp @if($total_pending_amount_15) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$current_date/$last_15_date")}}'>{{$total_pending_amount_15}}</a> @else {{$total_pending_amount_15}} @endif </td> <td> @php $last_30_date = date('Y-m-d',strtotime(' -30 days')); $total_pending_amount_30 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_30_date,$last_15_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_30; @endphp @if($total_pending_amount_30) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_15_date/$last_30_date")}}'>{{$total_pending_amount_30}}</a> @else {{$total_pending_amount_30}} @endif </td> <td> @php $last_45_date = date('Y-m-d',strtotime(' -45 days')); $total_pending_amount_45 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_45_date,$last_30_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_45; @endphp @if($total_pending_amount_45) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_30_date/$last_45_date")}}'>{{$total_pending_amount_45}}</a> @else {{$total_pending_amount_45}} @endif </td> <td> @php $last_60_date =date('Y-m-d',strtotime(' -60 days')); $total_pending_amount_60 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_60_date,$last_45_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_60; @endphp @if($total_pending_amount_60) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_45_date/$last_60_date")}}'>{{$total_pending_amount_60}}</a> @else {{$total_pending_amount_60}} @endif </td> <td> @php $last_75_date =date('Y-m-d',strtotime(' -75 days')); $total_pending_amount_75 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_75_date,$last_60_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_75; @endphp @if($total_pending_amount_75) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_60_date/$last_75_date")}}'>{{$total_pending_amount_75}}</a> @else {{$total_pending_amount_75}} @endif </td> <td> @php $last_90_date =date('Y-m-d',strtotime(' -90 days')); $total_pending_amount_90 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_90_date,$last_75_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_90; @endphp @if($total_pending_amount_90) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_75_date/$last_90_date")}}'>{{$total_pending_amount_90}}</a> @else {{$total_pending_amount_90}} @endif </td> <td> @php $last_365_date =date('Y-m-d',strtotime(' -365 days')); $total_pending_amount_365 = \App\LoadingSlipInvoice::where('dealer_id',$dealer->id)->where('is_paid',0) ->whereIn('product_id',$product_category->products->pluck('id')) ->whereBetween('created_at',array($last_365_date,$last_90_date)) ->sum('remaining_amount'); $total_pending_amount = $total_pending_amount + $total_pending_amount_365; @endphp @if($total_pending_amount_365) <a target="_blank" href='{{URL("/user/outstating-remaining-amount-details/$dealer->id/$product_category->id/$last_90_date/$last_365_date")}}'>{{$total_pending_amount_365}}</a> @else {{$total_pending_amount_365}} @endif </td> <td> {{$total_pending_amount}} </td> </tr > @endforeach </tbody> </table> </div> </div> @endif @endforeach </div> </div> </div> </div> </div> @section('script') {{ Html::script("assets/js/jquery.dataTables.min.js")}} {{ Html::script("assets/js/jquery.dataTables.bootstrap.min.js")}} {{ Html::script("assets/js/dataTables.buttons.min.js")}} {{ Html::script("assets/js/buttons.flash.min.js")}} {{ Html::script("assets/js/buttons.html5.min.js")}} {{ Html::script("assets/js/buttons.print.min.js")}} {{ Html::script("assets/js/buttons.colVis.min.js")}} {{ Html::script("assets/js/dataTables.select.min.js")}} {{ Html::script("assets/js/ace-elements.min.js")}} {{ Html::script("assets/js/ace.min.js")}} @endsection @endsection