Skip to content

Commit

Permalink
Merge branch 'release/1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
XEQTIONR committed May 28, 2019
2 parents df20833 + 931fe54 commit 27b3724
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 48 deletions.
20 changes: 19 additions & 1 deletion app/Http/Controllers/ConsignmentContainerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Consignment_container;
use App\Lc;
use App\Tyre;
use Illuminate\Support\Facades\DB;

class ConsignmentContainerController extends Controller
{
Expand All @@ -34,7 +35,24 @@ public function detailsRow(Request $request)
public function index()
{
//
$containers = Consignment_container::all();
$containers = DB::select('
SELECT Y.*, X.total_bought, X.total_sold, ((X.total_bought - X.total_sold)/X.total_bought * 100) AS percentage
FROM consignment_containers Y,
(SELECT A.BOL, A.Container_num, total_bought, IFNULL(total_sold, 0) AS total_sold
FROM (SELECT Container_num, BOL, SUM(qty) AS total_bought
FROM container_contents
GROUP BY Container_num) AS A
LEFT JOIN
(SELECT container_num, bol, SUM(qty) AS total_sold
FROM order_contents
GROUP BY container_num) AS B
ON A.Container_num = B.container_num AND A.BOL = B.bol) AS X
WHERE X.BOL = Y.BOL AND X.Container_num = Y.Container_num
');

return view('consignment_containers', compact('containers'));
}
Expand Down
16 changes: 12 additions & 4 deletions app/Http/Controllers/ConsignmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Http\Request;
use Validator;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class ConsignmentController extends Controller
{
Expand All @@ -20,10 +21,17 @@ class ConsignmentController extends Controller
*/
public function index()
{
//
$containers = array();
$contents = array();
$consignments = Consignment::all();
$consignments = DB::select('
SELECT D.*, C.total_bought, C.total_sold, ((C.total_bought - C.total_sold)/C.total_bought * 100) AS percentage
FROM consignments D, (SELECT A.BOL, total_bought, IFNULL(total_sold, 0) AS total_sold
FROM (SELECT BOL, SUM(qty) AS total_bought FROM container_contents GROUP BY BOL) AS A
LEFT JOIN
(SELECT bol, SUM(qty) AS total_sold FROM order_contents GROUP BY bol) AS B
ON A.BOL = B.bol
) AS C
WHERE C.BOL = D.BOL
');

return view('consignments', compact('consignments'));
}
Expand Down
9 changes: 8 additions & 1 deletion app/Http/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ public static function setContents(&$contents, $index, $order_num, $tyre_id, $pr
public function index()
{
//
$orders = Order::all();
$orders = DB::select('
SELECT O.*, D.total
FROM (SELECT B.*, SUM(B.multiply) as total
FROM (SELECT C.*, C.unit_price*C.qty AS multiply
FROM order_contents C) AS B
GROUP BY B.Order_num) D, orders O
WHERE D.Order_num = O.Order_num
');

//return $in_stock;
//dd(DB::getQueryLog());
Expand Down
15 changes: 11 additions & 4 deletions resources/views/consignment_containers.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@
</thead>
<tbody>
@foreach ($containers as $container)
<tr>
<tr style="cursor: pointer">
<td>{{$container->Container_num}}</td>
<td>{{$container->BOL}}</td>
<td>{{$container->created_at}}</td>
<td>{{$container->updated_at}}</td>
<td>
<div class="progress progress-xs">
<div class="progress-bar progress-bar-danger" style="width: 80%"></div>
</div>
@if($container->percentage == 0)
<small class="label bg-gray" data-toggle="tooltip" title="All {{$container->total_sold}} sold">empty</small>
@elseif($container->percentage == 100)
<small class="label bg-primary" data-toggle="tooltip" title="{{$container->total_bought}} total">full</small>
@else
<div class="progress progress-xs" data-toggle="tooltip" title="{{$container->total_bought - $container->total_sold}}/{{$container->total_bought}} remaining">
<div class="progress-bar progress-bar-<?php if($container->percentage<33) echo "danger"; else { echo $container->percentage<66 ? "warning" : "success"; } ?>"
style="width: {{$container->percentage}}%"></div>
</div>
@endif
</td>
</tr>
@endforeach
Expand Down
22 changes: 15 additions & 7 deletions resources/views/consignments.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tr>
<th>BOL#</th>
<th>LC#</th>
<th>$ Rate</th>
<th>Rate</th>
<th>Value($)</th>
<th>Value(&#2547)</th>
<th>Tax(&#2547)</th>
Expand All @@ -41,17 +41,25 @@
<tr style="cursor: pointer;" onclick="location.href='/consignments/{{$consignment->BOL}}'">
<td class="text-center">{{$consignment->BOL}}</td>
<td class="text-center">{{$consignment->lc}}</td>
<td class="text-right">{{$consignment->exchange_rate}}</td>
<td class="text-right">{{$consignment->value}}</td>
<td class="text-right">{{$consignment->value * $consignment->exchange_rate}}</td>
<td class="text-right">{{number_format($consignment->exchange_rate,2)}}</td>
<td class="text-right">{{number_format($consignment->value, 2)}}</td>
<td class="text-right">{{number_format($consignment->value * $consignment->exchange_rate,2)}}</td>
<td class="text-right">{{$consignment->tax}}</td>
<td class="text-center">{{$consignment->land_date}}</td>
<td class="text-center">{{$consignment->created_at}}</td>
{{--<td class="text-center">{{$consignment->updated_at}}</td>--}}
<td>
<div class="progress progress-xs">
{{--<div class="progress-bar progress-bar-danger" style="width: 80%"></div>--}}
</div>

@if($consignment->percentage == 0)
<small class="label bg-gray" data-toggle="tooltip" title="All {{$consignment->total_sold}} sold">empty</small>
@elseif($consignment->percentage == 100)
<small class="label bg-primary" data-toggle="tooltip" title="{{$consignment->total_bought}} total">full</small>
@else
<div class="progress progress-xs" data-toggle="tooltip" title="{{$consignment->total_bought - $consignment->total_sold}}/{{$consignment->total_bought}} remaining">
<div class="progress-bar progress-bar-<?php if($consignment->percentage<33) echo "danger"; else { echo $consignment->percentage<66 ? "warning" : "success"; } ?>"
style="width: {{$consignment->percentage}}%"></div>
</div>
@endif
</td>

</tr>
Expand Down
7 changes: 3 additions & 4 deletions resources/views/customers.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
<table id ="table_id" class="table table-hover table-bordered">
<thead>
<tr>
<th>Customer #</th>
<th>Customer ID</th>
<th>Customer Name</th>
<th>Address</th>
<th>Phone</th>
<th>Notes</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
Expand All @@ -36,10 +35,10 @@
<td class="text-center">{{$customer->id}}</td>
<td>{{$customer->name}}</td>
<td>{{$customer->address}}</td>
<td class="text-center">{{$customer->phone}}</td>
<td class="">{{$customer->phone}}</td>
<td>{{$customer->notes}}</td>
<td class="text-center">{{$customer->created_at}}</td>
<td class="text-center">{{$customer->updated_at}}</td>
{{--<td class="text-center">{{$customer->updated_at}}</td>--}}
{{--<td><a href="/customers/{{$customer->id}}" class="btn btn-primary">More Info</a></td>--}}
</tr>
@endforeach
Expand Down
4 changes: 1 addition & 3 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<style>
</style>
@yield('header-scripts')
<!-- Google Font -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

Expand Down
8 changes: 5 additions & 3 deletions resources/views/lcs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<th>Expenses Total(&#2547)</th>
<th>LC Value($)</th>
<th>LC Value(&#2547)</th>
<th>Created</th>
</tr>
</thead>
Expand All @@ -51,9 +52,10 @@
<td class="text-center">{{$LC->date_expiry}}</td>
{{--<td class="text-center">{{$LC->invoice_no}}</td>--}}
<td class="text-right">{{$LC->exchange_rate}}</td>
<td class="text-right">{{($LC->foreign_expense * $LC->exchange_rate)+$LC->domestic_expense}}</td>
<td class="text-right">{{$LC->foreign_amount}}</td>
<td class="text-right">{{$LC->foreign_amount * $LC->exchange_rate}}</td>
<td class="text-right">{{number_format(($LC->foreign_expense * $LC->exchange_rate)+$LC->domestic_expense,2)}}</td>
<td class="text-right">{{number_format($LC->foreign_amount,2)}}</td>
<td class="text-right">{{number_format($LC->foreign_amount * $LC->exchange_rate,2)}}</td>
<td class="text-center">{{$LC->created_at}}</td>
</tr>
@endforeach
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/new_consignment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<label>Land Date</label>
<div class="input-group">
<span class="input-group-addon">F31C</span>
<input v-model="date1" @click="datetify()" @blur="copyDate(1)" id="dateIssued" type="text" class="form-control date">
<input v-model="date1" @click="datetify()" @blur="copyDate(1)" id="dateIssued" type="text" class="form-control date" placeholder="dd/mm/yyyy">
<div class="input-group-addon">
<i class="icon-calendar-alt-s fa-calendar-alt"></i>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/new_lc.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<label>Date Issued</label>
<div class="input-group">
<span class="input-group-addon">F31C</span>
<input v-model="date1" @click="datetify()" @blur="copyDate(1)" id="dateIssued" type="text" class="form-control date">
<input v-model="date1" @click="datetify()" @blur="copyDate(1)" id="dateIssued" type="text" class="form-control date" placeholder="dd/mm/yyyy">
<div class="input-group-addon">
<i class="icon-calendar-alt-s fa-calendar-alt"></i>
</div>
Expand All @@ -94,7 +94,7 @@
<label>Date Expiry</label>
<div class="input-group">
<span class="input-group-addon">F31D</span>
<input v-model="date2" @click="datetify()" @blur="copyDate(2)" id="dateExpiry" type="text" class="form-control date">
<input v-model="date2" @click="datetify()" @blur="copyDate(2)" id="dateExpiry" type="text" class="form-control date" placeholder="dd/mm/yyyy">
<div class="input-group-addon">
<i class="icon-calendar-alt-s fa-calendar-alt"></i>
</div>
Expand Down
40 changes: 39 additions & 1 deletion resources/views/new_payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
</div>
@endsection

@section('header-scripts')

<style>
.progress-bar-colorful
{
-webkit-transition: background-color .6s ease, width .6s ease;
-o-transition: background-color .6s ease, width .6s ease;
transition: background-color .6s ease, width .6s ease;
}
</style>
@endsection

@section('body')


Expand Down Expand Up @@ -163,6 +175,11 @@
</table>
</div>
</div>
<div v-if="order" class="row justify-content-center">
<div class="progress col-xs-12 px-0 mx-4">
<div class="progress-bar progress-bar-colorful" :style="{width: fractionTotalP+'%', backgroundColor: fractionColor}">@{{ (fractionTotalP < 100) ? (parseFloat(fractionTotalP).toFixed(2)) +' % Paid' : 'Paid Off' }}</div>
</div>
</div>
<div v-if="order" class="row justify-content-center">
<div class="col-xs-12 col-md-4">
<div class="input-group input-group-lg">
Expand Down Expand Up @@ -332,7 +349,7 @@
this.amount = this.grandTotal- this.paymentsTotal();
else
this.helperPositiveFloat(new_val, "amount");
}
},
},
computed : {
Expand Down Expand Up @@ -448,6 +465,27 @@
amountToWords : function(){
return this.numberToWords.toWords(parseFloat(this.amount));
},
fractionTotalP : function(){
//return this.paymentsTotal();
return ((this.paymentsTotal()+parseFloat(this.amount))/this.grandTotal)*100;// * 100;
},
fractionColor : function(){
// var green = 255 * (this.fractionTotalP/100);
// var red = 255 * ((100-this.fractionTotalP)/100);
// return "rgba(" + red + "," + green + ", 0 ,1)";
//0-120
var val = Math.floor(120*(this.fractionTotalP/100));
return "hsl(" + val + ",60%,50%)";
//hsl(90,50%,50%)
}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/partials/currentstock.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table id ="table_id" class="table table-hover table-bordered">
<thead>
<tr>
{{--<th> Tyre ID </th>--}}
<th> Tyre ID </th>
<th> Brand </th>
<th> Size </th>
<th> Pattern </th>
Expand All @@ -15,14 +15,14 @@
<tbody>
<tr v-for="(item, index) in stock" v-if="item.in_stock>0" :id="index">

{{--<td class="text-center">@{{item.tyre_id}}</td>--}}
<td class="text-center">@{{item.tyre_id}}</td>
<td class="text-center">@{{item.brand}}</td>
<td class="text-center">@{{item.size}}</td>
<td class="text-center">@{{item.pattern}}</td>
<td class="text-center">@{{item.lisi}}</td>

<td class="text-center" :class="{'text-red' : helperStockLive(index)<0}">@{{helperStockLive(index)}}</td>
<td v-if="!do_not_show">
<td>
<a class="text-success" @click="add(index)">
<i class="icon-plus-circle-s fa-plus-circle"></i>
</a>
Expand Down
8 changes: 4 additions & 4 deletions resources/views/partials/rows/consignment_container.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</tr>
<?php
$total+= (floatval($listing->unit_price) * floatval($listing->qty));
$total_qty += intval($listing->unit_price);
$total_qty += intval($listing->qty);
$total_tax += floatval($listing->total_tax);
$total_weight += floatval($listing->total_weight);
?>
Expand All @@ -42,9 +42,9 @@
<td class="col-xs-3 text-uppercase"> TOTAL </td>
<td class="col-xs-1"> {{$total_qty}} </td>
<td class="col-xs-2"> </td>
<td class="col-xs-2"> {{$total}} </td>
<td class="col-xs-2"> {{$total_tax}} </td>
<td class="col-xs-2"> {{$total_weight}} </td>
<td class="col-xs-2"> {{number_format($total, 2)}} </td>
<td class="col-xs-2"> {{number_format($total_tax, 2)}} </td>
<td class="col-xs-2"> {{number_format($total_weight, 2)}} </td>
</tr>
</tbody>
</table>
18 changes: 9 additions & 9 deletions resources/views/partials/tables/orders.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<table id="table_id" class="table table-hover table-bordered">
<thead>
<tr>
<th>Order#</th>
<th>Customer ID</th>
<th>Discount %</th>
<th>Discount Amount(&#2547)</th>
<th>Tax %</th>
<th>Tax Amount(&#2547)</th>
<th>Created At</th>
<th>Updated At</th>
<th class="col-xs-1">Order#</th>
<th class="col-xs-2">Customer ID</th>
<th class="col-xs-1">Discount%</th>
<th class="col-xs-2">Discount Amount(&#2547)</th>
<th class="col-xs-1">Tax%</th>
<th class="col-xs-2">Tax Amount(&#2547)</th>
<th class="col-xs-1">Total(&#2547)</th>
<th class="col-xs-2">Created</th>
</tr>
</thead>
<tbody>
Expand All @@ -20,8 +20,8 @@
<td class="text-right">{{$order->discount_amount}}</td>
<td class="text-right">{{$order->tax_percentage}}</td>
<td class="text-right">{{$order->tax_amount}}</td>
<td class="text-right">{{number_format($order->total - ($order->total* $order->discount_percent/100.0) - $order->discount_amount + ($order->total* $order->tax_percentage/100.0) + $order->tax_amount, 2) }}</td>
<td class="text-center">{{$order->created_at}}</td>
<td class="text-center">{{$order->updated_at}}</td>
</tr>
@endforeach
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/profiles/consignment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</tr>
<?php
$total+= (floatval($listing->unit_price) * floatval($listing->qty));
$total_qty += intval($listing->unit_price);
$total_qty += intval($listing->qty);
$total_tax += floatval($listing->total_tax);
$total_weight += floatval($listing->total_weight);
?>
Expand Down

0 comments on commit 27b3724

Please sign in to comment.