ria/app/Views/credit_notes.php

357 lines
11 KiB
PHP

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
.edit-container {
display: inline-flex;
align-items: center;
gap: 10px;
}
.edit-input-field {
padding: 2px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
width: 150px;
}
.edit-input-field:focus {
outline: none;
border-color: #007bff;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}
.save-btn, .cancel-btn {
border: none;
background: none;
cursor: pointer;
font-size: 16px;
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
transition: background-color 0.3s ease;
}
.save-btn {
color: #28a745;
background-color: #e8f5e9;
}
.save-btn:hover {
background-color: #c3e6cb;
}
.cancel-btn {
color: #dc3545;
background-color: #f8d7da;
}
.cancel-btn:hover {
background-color: #f5c6cb;
}
/* Target the first child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(1) {
display: none;
}
/* Target the third child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(3) {
display: none;
}
.card_font_colorset_green {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
position: relative;
z-index: 1;
color: rgb(86, 166, 75);
}
.card_font_colorset_bule {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
position: relative;
z-index: 1;
color: rgb(31, 96, 196);
}
.card_font_colorset_red {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
position: relative;
z-index: 1;
color: rgb(173, 3, 23);
}
</style>
<style>
#Requisition_filter {
float: inline-end;
}
#Requisition_wrapper .row .col-sm-4 {
flex-basis: 50%;
float: inline-end;
}
#Requisition_paginate .pagination {
flex-basis: 50%;
float: inline-end;
margin: 0 0 15px;
}
#Requisition_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) {
padding: 0 15px;
}
#Requisition_info {
margin-top: 5px;
}
.dataTables_wrapper {
padding-bottom: 0;
}
span.highlight {
background-color: yellow;
}
</style>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Sales</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Credit Notes List</h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="row">
<div class="col-md-10">
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"
method="post" action="<?= base_url('credit_notes'); ?>">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search"
value="<?= $fromDate?>"
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search"
value="<?= $toDate ?>"
id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button" >
<i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i>
</button>
<i class="fe-rotate-cw range_reset_button"
style="cursor:pointer;"
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-md-2 text-right" style="padding-right: 36px !important;">
<!-- <button class="btn btn-secondary" id="excel-download" style="margin-top: 14px; margin-bottom: -11px; " type="button"><span>Excel</span></button> -->
</div>
</div>
<div class="card-body" style="overflow-x:scroll;">
<table id="datatable-buttosns" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Date</th>
<th>Credit Note</th>
<th>Invoice</th>
<th>Client </th>
<th>Item Name</th>
<th>Item Price</th>
<th>Item qty</th>
<th>Sub Total</th>
<th>GST</th>
<th>Total</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php if (!empty($credit_notes)) {
foreach ($credit_notes as $val) { ?>
<!-- Main invoice row -->
<tr>
<td><?php echo date('d-m-Y', strtotime($val['date'])); ?></td>
<td><?php echo $val['creditnote_number'] ?></td>
<td><?php echo $val['applied_invoices'] ?></td>
<td><?php echo $val['customer_name'] ?></td>
<td><?php echo $val['item_name'] ?></td>
<td><?php echo $val['item_price'] ?></td>
<td><?php echo $val['item_quantity'] ?></td>
<td><?php echo $val['item_total_without_tax'] ?></td>
<td><?php echo $val['item_total'] - $val['item_total_without_tax'] ?></td>
<td><?php echo $val['item_total'] ?></td>
<td><?php echo $val['status'] ?></td>
</tr>
<?php } } ?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.0/xlsx.full.min.js"></script>
<script>
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable-buttosns').DataTable({
dom: 'Blfrtip',
buttons: [
{
extend: 'excel',
text: 'Excel',
exportOptions: {
columns: ':not(:last-child)' // Exclude the last column
}
}
],
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
ordering: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
window.location="sales_invoice"
});
});
</script>
<script>
$(document).ready(function() {
$('#fromDate , #toDate').change(function() {
let fromDate = $('#fromDate').val();
let toDate = $('#toDate').val();
let fromDateObj = new Date(fromDate.split('-').reverse().join('-'));
let toDateObj = new Date(toDate.split('-').reverse().join('-'));
if (fromDateObj > toDateObj) {
alert('Incorrect Date Applied For Filter..!!');
$('#toDate').attr('min', fromDate);
$('#toDate').val('');
}
});
});
</script>