This commit is contained in:
SUM2046
2026-07-03 12:37:30 +05:30
parent f2ad6093d2
commit 7fba009978
3 changed files with 272 additions and 244 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace Modules\DailySalePaymentReportModule\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class PaymentOption extends Model
{
use HasFactory;
protected $fillable = [
'name',
'account_id',
'is_active',
'percentage',
'type',
'status',
'approved_by',
'approved_at'
];
protected static function newFactory()
{
return \Modules\DailySalePaymentReportModule\Database\factories\PaymentOptionFactory::new();
}
}

View File

@@ -5,6 +5,7 @@ namespace Modules\DailySalePaymentReportModule\Http\Controllers;
use Illuminate\Contracts\Support\Renderable; use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use Modules\DailySalePaymentReportModule\Entities\PaymentOption;
class DailySalePaymentReportModuleController extends Controller class DailySalePaymentReportModuleController extends Controller
{ {
@@ -14,7 +15,13 @@ class DailySalePaymentReportModuleController extends Controller
*/ */
public function index() public function index()
{ {
return view('dailysalepaymentreportmodule::index'); $paymentOptions = PaymentOption::where('is_active', 1)
->orderBy('id')
->get(['id', 'name']);
return view('dailysalepaymentreportmodule::index', [
'paymentOptions' => $paymentOptions,
]);
} }
/** /**

View File

@@ -1,268 +1,262 @@
@extends('backend.layout.main') @extends('backend.layout.main')
@section('content') @section('content')
@if ($errors->has('title')) @if ($errors->has('title'))
<div class="alert alert-danger alert-dismissible text-center"> <div class="alert alert-danger alert-dismissible text-center">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
aria-hidden="true">&times;</span></button>{{ $errors->first('title') }} aria-hidden="true">&times;</span></button>{{ $errors->first('title') }}
</div> </div>
@endif @endif
@if (session()->has('message')) @if (session()->has('message'))
<div class="alert alert-success alert-dismissible text-center"> <div class="alert alert-success alert-dismissible text-center">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button>{{ session()->get('message') }} </button>{{ session()->get('message') }}
</div> </div>
@endif @endif
@if (session()->has('not_permitted')) @if (session()->has('not_permitted'))
<div class="alert alert-danger alert-dismissible text-center"> <div class="alert alert-danger alert-dismissible text-center">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button>{{ session()->get('not_permitted') }} </button>{{ session()->get('not_permitted') }}
</div> </div>
@endif @endif
<section> <section>
<div class="container-fluid"> <div class="container-fluid">
<div style="border-radius: 30px;" class="card pb-4 "> <div style="border-radius: 30px;" class="card pb-4 ">
<link rel="stylesheet" href="{{ asset('public/css/cloudma.css') }}"> <link rel="stylesheet" href="{{ asset('public/css/cloudma.css') }}">
<div style="background: linear-gradient(to right, #00c1e3, #00489f); border-radius: 30px 30px 0px 0px; font-weight: bold; color: white;" <div style="background: linear-gradient(to right, #00c1e3, #00489f); border-radius: 30px 30px 0px 0px; font-weight: bold; color: white;"
class="card-header mt-2"> class="card-header mt-2">
<h3 class="text-center">Daily Sale Payment Report</h3> <h3 class="text-center">Daily Sale Payment Report</h3>
</div> </div>
<form action="{{ url('dailysalepaymentreportmodule') }}" method="GET"> <form action="{{ url('dailysalepaymentreportmodule') }}" method="GET">
<div class="row mr-1 mt-4 pl-4 align-items-center"> <div class="row mr-1 mt-4 pl-4 align-items-center">
<div class="col-md-4"> <div class="col-md-4">
<label><strong>Select Date</strong> &nbsp;</label> <label><strong>Select Date</strong> &nbsp;</label>
<div class="input-group"> <div class="input-group">
<input type="date" name="report_date" id="report_date" <input type="date" name="report_date" id="report_date"
value="{{ request()->input('report_date', date('Y-m-d')) }}" class="form-control" value="{{ request()->input('report_date', date('Y-m-d')) }}" class="form-control"
required /> required />
</div>
</div>
<div class="col-md-3 pt-md-4">
<button type="submit" class="btn btn-primary" id="generate-report-btn">Generate Report</button>
</div> </div>
</div> </div>
</form> <div class="col-md-3 pt-md-4">
</div> <button type="submit" class="btn btn-primary" id="generate-report-btn">Generate Report</button>
</div> </div>
<div class="container-fluid mt-4">
<!-- අලුතෙන් දාපු Single Export Buttons ටික -->
<div class="row mb-3">
<div class="col-md-12 text-right">
<button class="btn btn-danger" onclick="exportFullReport('pdf')" style="border-radius: 10px;">
<i class="fa fa-file-pdf-o"></i> Export PDF
</button>
<button class="btn btn-success" onclick="exportFullReport('excel')" style="border-radius: 10px;">
<i class="dripicons-document-new"></i> Export Excel
</button>
<button class="btn btn-info" onclick="exportFullReport('csv')" style="border-radius: 10px;">
<i class="fa fa-file-text-o"></i> Export CSV
</button>
<button class="btn btn-secondary" onclick="window.print()" style="border-radius: 10px;">
<i class="fa fa-print"></i> Print Report
</button>
</div> </div>
</div> </form>
</div>
</div>
<!-- Sales Table --> <div class="container-fluid mt-4">
<h4 class="mb-3" style="color: #00489f; font-weight: bold;">Sales Table (Daily Sale)</h4> <!-- අලුතෙන් දාපු Single Export Buttons ටික -->
<div class="table-responsive"> <div class="row mb-3">
<table style="border-radius: 15px; background-color: #e0e5ea;" class="table table-hover table-bordered"> <div class="col-md-12 text-right">
<thead <button class="btn btn-danger" onclick="exportFullReport('pdf')" style="border-radius: 10px;">
style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;"> <i class="fa fa-file-pdf-o"></i> Export PDF
<tr> </button>
<th>Date</th> <button class="btn btn-success" onclick="exportFullReport('excel')" style="border-radius: 10px;">
<th>Reference Number</th> <i class="dripicons-document-new"></i> Export Excel
<th>Cashier</th> </button>
<th>Customer</th> <button class="btn btn-info" onclick="exportFullReport('csv')" style="border-radius: 10px;">
<th>Grand Total</th> <i class="fa fa-file-text-o"></i> Export CSV
<th>Cash</th> </button>
<th>Card 1</th> <button class="btn btn-secondary" onclick="window.print()" style="border-radius: 10px;">
<th>Card 2</th> <i class="fa fa-print"></i> Print Report
<th>Card 3</th> </button>
<th>Online Transfer</th>
<th>Link Pay</th>
<th>Due Amount</th>
</tr>
</thead>
<tbody>
{{-- @foreach ($sales_data as $sale) --}}
<!-- Data rows will come here -->
{{-- @endforeach --}}
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td colspan="4" class="text-right">Total</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tfoot>
</table>
</div> </div>
</div> </div>
<div class="container-fluid mt-5"> <!-- Sales Table -->
<!-- Credit Sale Collections Table --> <h4 class="mb-3" style="color: #00489f; font-weight: bold;">Sales Table (Daily Sale)</h4>
<h4 class="mb-3" style="color: #00489f; font-weight: bold;">Credit Sale Collections</h4> <div class="table-responsive">
<div class="table-responsive"> <table style="border-radius: 15px; background-color: #e0e5ea;" class="table table-hover table-bordered">
<table style="border-radius: 15px; background-color: #e0e5ea;" class="table table-hover table-bordered"> <thead
<thead style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;">
style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;"> <tr>
<tr> <th>Date</th>
<th>Original Bill Date</th> <th>Reference Number</th>
<th>Reference Number</th> <th>Cashier</th>
<th>Cashier</th> <th>Customer</th>
<th>Customer</th> <th>Grand Total</th>
<th>Grand Total</th> <th>Cash</th>
<th>Cash</th> <th>Card 1</th>
<th>Card 1</th> <th>Card 2</th>
<th>Card 2</th> <th>Card 3</th>
<th>Card 3</th> <th>Online Transfer</th>
<th>Online Transfer</th> <th>Link Pay</th>
<th>Link Pay</th> <th>Due Amount</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{-- @foreach ($credit_data as $credit) --}} {{-- @foreach ($sales_data as $sale) --}}
<!-- Data rows will come here --> <!-- Data rows will come here -->
{{-- @endforeach --}} {{-- @endforeach --}}
</tbody> </tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;"> <tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr> <tr>
<td colspan="4" class="text-right">Total</td> <td colspan="4" class="text-right">Total</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
</tr> <td>0.00</td>
</tfoot> </tr>
</table> </tfoot>
</div> </table>
</div> </div>
</div>
<div class="container-fluid mt-5 mb-5"> <div class="container-fluid mt-5">
<!-- Payment Method Summary Table --> <!-- Credit Sale Collections Table -->
<h4 class="mb-3" style="color: #00489f; font-weight: bold;">Payment Method Summary</h4> <h4 class="mb-3" style="color: #00489f; font-weight: bold;">Credit Sale Collections</h4>
<div class="table-responsive"> <div class="table-responsive">
<table style="border-radius: 15px; background-color: #e0e5ea; width: 60%;" <table style="border-radius: 15px; background-color: #e0e5ea;" class="table table-hover table-bordered">
class="table table-hover table-bordered"> <thead
<thead style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;">
style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;"> <tr>
<tr> <th>Original Bill Date</th>
<th>Payment Option</th> <th>Reference Number</th>
<th>Sale Amount</th> <th>Cashier</th>
<th>Received Amount</th> <th>Customer</th>
<th>Total Amount</th> <th>Grand Total</th>
</tr> @foreach ($paymentOptions as $option)
</thead> <th>{{ $option->name }}</th>
<tbody> @endforeach
<tr> <th>Due Amount</th>
<td>Cash</td>
<td>0.00</td> </tr>
<td>0.00</td> </thead>
<td>0.00</td> <tbody>
</tr> </tbody>
<tr> <tfoot style="background-color: #cdd4da; font-weight: bold;">
<td>Card 1</td> <tr>
<td>0.00</td> <td colspan="4" class="text-right">Total</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> @foreach ($paymentOptions as $option)
</tr> <td>0.00</td>
<tr> @endforeach
<td>Card 2</td> <td>0.00</td>
<td>0.00</td> </tr>
<td>0.00</td> </tfoot>
<td>0.00</td> </table>
</tr>
<tr>
<td>Card 3</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Online Transfer</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Link Pay</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td class="text-right">Grand Total</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tfoot>
</table>
</div>
</div> </div>
</section> </div>
<style> <div class="container-fluid mt-5 mb-5">
.bootstrap-select.form-control, <!-- Payment Method Summary Table -->
.form-control, <h4 class="mb-3" style="color: #00489f; font-weight: bold;">Payment Method Summary</h4>
.input-group-text { <div class="table-responsive">
background-color: #fdfdff; <table style="border-radius: 15px; background-color: #e0e5ea; width: 60%;"
border-color: #002250; class="table table-hover table-bordered">
border-radius: 15px; <thead
} style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;">
<tr>
<th>Payment Option</th>
<th>Sale Amount</th>
<th>Received Amount</th>
<th>Total Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cash</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 1</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 2</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 3</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Online Transfer</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Link Pay</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td class="text-right">Grand Total</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tfoot>
</table>
</div>
</div>
</section>
.btn-primary { <style>
background-color: #002250; .bootstrap-select.form-control,
border-color: #002250; .form-control,
border-radius: 15px; .input-group-text {
padding: 10px 25px; background-color: #fdfdff;
} border-color: #002250;
border-radius: 15px;
}
.btn-primary:hover { .btn-primary {
background-color: #0068e3; background-color: #002250;
} border-color: #002250;
border-radius: 15px;
padding: 10px 25px;
}
table { .btn-primary:hover {
border-collapse: collapse !important; background-color: #0068e3;
} }
</style>
table {
border-collapse: collapse !important;
}
</style>
@endsection @endsection
@push('scripts') @push('scripts')
<script type="text/javascript"> <script type="text/javascript">
$.ajaxSetup({ $.ajaxSetup({
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
// මුළු රිපෝට් එකම එක්ස්පෝර්ට් කරන්න හදපු Function එක
function exportFullReport(exportType) {
var selectedDate = $('#report_date').val();
// ඔයාගේ Controller එකේ export route එකට මේක හරවන්න ඕනේ.
// උදාහරණයක් විදිහට: url('/dailysalepaymentreportmodule/export')
var exportUrl = "{{ url('/dailysalepaymentreportmodule/export') }}" + "?date=" + selectedDate + "&type=" + exportType;
window.location.href = exportUrl;
} }
</script> });
// මුළු රිපෝට් එකම එක්ස්පෝර්ට් කරන්න හදපු Function එක
function exportFullReport(exportType) {
var selectedDate = $('#report_date').val();
// ඔයාගේ Controller එකේ export route එකට මේක හරවන්න ඕනේ.
// උදාහරණයක් විදිහට: url('/dailysalepaymentreportmodule/export')
var exportUrl = "{{ url('/dailysalepaymentreportmodule/export') }}" + "?date=" + selectedDate + "&type=" + exportType;
window.location.href = exportUrl;
}
</script>
@endpush @endpush