CHANGE_ISSUE_CLEAR

This commit is contained in:
aadhavan valli 2024-09-05 09:04:36 +05:30
parent a1be08cf7f
commit 660536d515
22 changed files with 1326 additions and 1031 deletions

View File

@ -74,6 +74,7 @@ $routes->get('exportcost', 'CostCenter::exportcost');
$routes->get('assetListing', 'Assetdetails::assetListing');
$routes->get('addasset', 'Assetdetails::addasset');
$routes->get('assetdetails/editOldasset', 'Assetdetails::editOldasset');
$routes->post('assetdetails/getpodetails', 'Assetdetails::getpodetails');
// $routes->post('addNewasset', 'Assetdetails::addNewasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset', 'Assetdetails::editasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset/(:num)', 'Assetdetails::editasset/$1');
@ -376,6 +377,7 @@ $routes->get('inprocess', 'Inprocess::index');
// Sales Controller
$routes->get('sales_dashboard', 'Sales::sales_dashboard');
$routes->get('invoicedetails/ViewInvoice', 'Sales::ViewInvoice');
$routes->get('getInvoiceAttachment', 'Sales::getInvoiceAttachments');
$routes->get('getInvoiceAttachments', 'Sales::getInvoiceAttachments');
$routes->get('deleteAttachment', 'Sales::deleteAttachment');
$routes->post('saveAttachment', 'Sales::saveAttachment');

View File

@ -201,11 +201,9 @@ class Employeedetails extends BaseController
function AddNewEmployee()
{
// print_r($this->request->getPost());die;
$photo = $this->request->getFile('photo');
$Picture = "";
if(isset($photoan)){
if (isset($photo)) {
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
@ -603,8 +601,7 @@ class Employeedetails extends BaseController
/* To Update the employee details*/
function UpdateEmployee()
{
// echo "<pre>";
// print_r($this->request->getPost());die;
$EmpId = $this->request->getPost('employeeid');
//$mail = $this->this->.post('emailid');
@ -637,33 +634,43 @@ class Employeedetails extends BaseController
$ModifyPictureName = $this->request->getPost('ModifyImage');
$Picture = "";
if ($PictureName != '') {
//echo 'Exists';
//$Picture = $PictureName;
if (strlen((string)$ModifyPictureName) == 0) {
//echo 'Exists But Not replace';
$Picture = $PictureName;
} else {
// echo "<pre>";
// // print_r($this->request->getPost());
// print_r($this->request->getFile('photo'));
// die;
//echo 'Exists But Replace';
//$Picture = $ModifyPictureName;
//$Picture = $this->editimage($ModifyPictureName);
$photo = $this->request->getFile('ModifyImage');
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($photo->getExtension(), $allowedTypes)) {
$newName = $photo->getRandomName();
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0777, true);
if (!$photo || !$photo->isValid()) {
$photo = $this->request->getFile('photo');
}
if (isset($photo)) {
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($photo->getExtension(), $allowedTypes)) {
$newName = $photo->getRandomName();
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
$photo->move($uploadDir, $newName);
$Picture = $newName;
}
$photo->move($uploadDir, $newName);
$Picture = $newName;
}
}
}
} else {
//echo 'Not Exists';
$photo = $this->request->getFile('photo');
if(isset($photo)){
if (isset($photo)) {
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];

View File

@ -37,7 +37,9 @@ class Login extends BaseController
return view('login');
} else {
// redirect('/dashboard');
return redirect()->to('/dashboard');
// return redirect()->to('/dashboard');
return redirect()->to('/sales_dashboard');
}
}
@ -53,7 +55,9 @@ class Login extends BaseController
return view('login');
} else {
// return view('login');
return redirect()->to('/dashboard');
// return redirect()->to('/dashboard');
return redirect()->to('/sales_dashboard');
}
}
@ -107,9 +111,11 @@ class Login extends BaseController
$DEPCode = $res->DEPCode;
if ($DEPCode == SECURITY) {
return redirect()->to(site_url('/dashboard'));
// return redirect()->to(site_url('/dashboard'));
return redirect()->to(site_url('/sales_dashboard'));
} else {
return redirect()->to(site_url('/dashboard'));
return redirect()->to(site_url('/sales_dashboard'));
// return redirect()->to(site_url('/dashboard'));
}
}
} else {

View File

@ -5,18 +5,21 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\Ipinvoice_model;
use App\Models\Ipattachment_model;
require_once 'vendor/autoload.php';
class Sales extends BaseController
{
protected $ipinvoice_model;
protected $ipattachment_model;
protected $session;
public function __construct()
{
parent::__construct();
$this->ipinvoice_model = new Ipinvoice_model();
$this->ipattachment_model = new Ipattachment_model();
$this->session = session();
$this->isLoggedIn();
}
@ -91,8 +94,7 @@ class Sales extends BaseController
// Invoice Attachments
function getInvoiceAttachments(){
$data['invoiceAttachment'] = $this->ipinvoice_model->getinvoiceAttachment($this->request->getGet('invoice_id'));
$data['invoiceAttachment'] = $this->ipinvoice_model->getinvoiceAttachment($this->request->getGet('invoice_number'));
return json_encode($data);
}

File diff suppressed because it is too large Load Diff

View File

@ -48,9 +48,9 @@ if (!function_exists('generateCopyrightNotice')) {
{
$current_year = date('Y');
if ($current_year > 2024) {
return " Copyright &copy; 2024 - $current_year ";
return " &copy; 2024 - $current_year ";
} else {
return " Copyright &copy; $current_year ";
return " &copy; $current_year ";
}
}
}

View File

@ -160,7 +160,6 @@ class User_model extends Model
$query = $builder->get();
$user = $query->getResult();
if (!empty($user)) {
if (password_verify($oldPassword, $user[0]->password)) {

View File

@ -493,7 +493,7 @@
class="badge">*</span>
<input id="DateofBirth" required name="DateofBirth"
onkeypress="return false;" maxlength="10"
onchange="getAge();" class="form-control " data-provide="datepicker" data-date-format="dd-mm-yyyy">
onchange="getAge();" class="form-control " data-provide="datepicker" data-date-format="dd-mm-yyyy">
</div>
</div>
<div class="row">
@ -638,7 +638,7 @@
class="badge">*</span>
<input id="dateofjoining" name="dateofjoining"
onkeypress="return false;" maxlength="10" required
class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
</div>
<div class="col-md-3"><span>Previous Years of Experience</span>
<input type="text" id="Previousexperience" name="Previousexperience"
@ -966,7 +966,7 @@
</div>
<div class="tab-pane fade" id="fivth">
<form id="fileForm" method="post" action="#" class="form-horizontal">
<form id="fileForm" method="post" action="#" class="form-horizontal" enctype="multipart/form-data">
<div class="row">
<div class="col-md-1">
</div>
@ -988,7 +988,7 @@
Add
</button>
</div>
<div id="filesContainer" class="col-12"></div>
<div id="filesContainer" class="col-12"></div>
<!-- </div> -->
</div>
</div>
@ -1347,7 +1347,7 @@
e.preventDefault(); // Prevent default form submission
var isValid = true;
var combinedFormData = '';
var combinedFormData = new FormData(); // Use FormData to handle files
// List of form IDs you want to combine
var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here
@ -1362,8 +1362,19 @@
return false; // Break the loop if any form is invalid
}
// Serialize and combine the form data
combinedFormData += $form.serialize() + '&'; // Append each form's serialized data
// Serialize and append the form data
$form.find(':input').each(function() {
var input = $(this);
if (input.attr('type') === 'file') {
// If the input is a file, append it to FormData
$.each(input[0].files, function(i, file) {
combinedFormData.append(input.attr('name'), file);
});
} else {
// Otherwise, append other form data
combinedFormData.append(input.attr('name'), input.val());
}
});
});
if (!isValid) {
@ -1371,22 +1382,21 @@
return; // Stop the submission if validation fails
}
// Remove the trailing '&' from the combined form data
combinedFormData = combinedFormData.slice(0, -1);
console.log('Combined Form Data:', combinedFormData); // Log the combined form data for debugging
console.log('Combined Form Data:', combinedFormData); // Log the combined form data
// Now you can send the combined data via AJAX or perform your desired action
// Now you can send the combined data via AJAX
$.ajax({
type: 'POST',
url: '<?php echo base_url() ?>addNewEmployee', // Replace with your form submission URL
data: combinedFormData,
processData: false, // Don't process the data
contentType: false, // Don't set content type
success: function(response) {
console.log('Form submitted successfully:', response);
// Handle the success scenario
if(response){
if (response) {
window.location.href = '<?php echo base_url("employeeListing"); ?>';
}else{
} else {
alert('Employee details Not Update...');
}
},
@ -1398,6 +1408,7 @@
});
// Function to navigate to the next tab
function goToNextTab() {
var $activeTab = $('#rootwizard').find('ul.nav li.nav-item a.active');

View File

@ -229,7 +229,8 @@
dataType: 'json',
success: function(data) {
//alert(data);
console.log(data);
var line = '';
$('#SelectMaterialCode').empty();
//alert('before');

View File

@ -1,96 +1,96 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Change Password
<small>Set new password for your account</small>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-4">
<!-- general form elements -->
<div class="box box-success">
<div class="box-header">
<h3 class="box-title">Enter Details</h3>
</div><!-- /.box-header -->
<!-- form start -->
<form role="form" action="<?php echo base_url() ?>changePassword" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword1">Old Password</label>
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="oldPassword" maxlength="15" required>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword1">New Password</label>
<input type="password" class="form-control" id="inputPassword1" placeholder="New password" name="newPassword" maxlength="15" required>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword2">Confirm New Password</label>
<input type="password" class="form-control" id="inputPassword2" placeholder="Confirm new password" name="cNewPassword" maxlength="15" required>
</div>
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<input type="submit" class="btn btn-success" value="Submit" />
<input type="reset" class="btn btn-default" value="Reset" />
</div>
</form>
</div>
</div>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<?php
$noMatch = session()->getFlashdata('nomatch');
if($noMatch)
{
?>
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('nomatch'); ?>
</div>
<?php } ?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-md-12">
<?php //echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Change Password
<small>Set new password for your account</small></h4>
</div>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<?php
$noMatch = session()->getFlashdata('nomatch');
if ($noMatch) {
?>
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('nomatch'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" action="<?php echo base_url() ?>changePassword" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword1">Old Password</label>
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="oldPassword" maxlength="15" required>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword1">New Password</label>
<input type="password" class="form-control" id="inputPassword1" placeholder="New password" name="newPassword" maxlength="15" required>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword2">Confirm New Password</label>
<input type="password" class="form-control" id="inputPassword2" placeholder="Confirm new password" name="cNewPassword" maxlength="15" required>
</div>
</div>
</div>
<div class="row">
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<div class="row">
<div class="col-12 text-right">
<input type="reset" class="btn btn-default" style="background-color:red;color:white;" value="Reset" />
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</div>
</div>
</form>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div>
</section>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>

View File

@ -481,7 +481,7 @@ function ValidateUA() {
<div class="row" style="margin-bottom: 10px;">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Company Profile</h4>
<h4 class="page-title">Business Settings</h4>
</div>
</div>
<div class="col-6 text-right">
@ -498,7 +498,7 @@ function ValidateUA() {
<form class="form-horizontal" role="form" id="addemployee" action="<?php echo base_url() ?>Updatecompany" method="post" role="form" enctype="multipart/form-data">
<div class="box-body">
<!-- Supplier Information -->
<legend style="margin-left:-10px;color: #4f7c97;;color: #4f7c97;">Company Information</legend>
<legend style="margin-left:-10px;color: #4f7c97;;color: #4f7c97;">Business Information</legend>
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row">
<div class=" col-md-3">

View File

@ -625,8 +625,10 @@ $('#datepick').change(function() {
<!-- <section class="content-header"> -->
<!-- <h3>Admin Dashboard</h3> -->
<div class="row">
<div class="col-xs-12 col-md-4 col-md-offset-4" style="height: 75px;">
<a href="javascript:void(0)" type="button" class="btn btn-success" onclick="synczohobooks()">Sync With Zoho Books</a>
<div class="col-12 text-right" style="height: 75px;">
<a href="javascript:void(0)" type="button" title="Sync With Zoho Books" class="btn btn-success" onclick="synczohobooks()">
<i class="fas fa-sync-alt"></i> <!-- <img src="<?php echo base_url();?>public/new_assets/images/zoho_sync.png" alt="Sync Icon" style="width: 20px; height: 20px;"> -->
</a>
</div>
</div>
<!-- </section> -->

View File

@ -207,7 +207,7 @@ if (!empty($EmpDetails)) {
src="<?php echo base_url() . $ProfilePic; ?>"
alt="your image" style="width: 139px;" /><br />
<input type='file' onchange="readURL(this);" id="photo"
value="<?php echo $ProfilePic; ?>" name="photo" />
value="<?php echo base_url() . $ProfilePic; ?>" name="photo" />
<label for="photo">Select profile picture<br /><small>(only .jpg or
.png)</small></label>
@ -250,7 +250,7 @@ if (!empty($EmpDetails)) {
<input id="DateofBirth" required name="DateofBirth"
value="<?php echo $DOB; ?>" maxlength="10"
placeholder="Date Of Birth" onchange="getAge();"
class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
</div>
<div class="col-md-2 pad">
@ -465,7 +465,7 @@ if (!empty($EmpDetails)) {
class="badge">*</span>
<input id="dateofjoining" name="dateofjoining"
value="<?php echo $DOJ; ?>" maxlength="10" required
placeholder="Date Of Joining" class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
placeholder="Date Of Joining" class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy">
</div>
<div class="col-md-3">
<span>Previous Years of Experience</span>
@ -874,13 +874,17 @@ if (!empty($EmpDetails)) {
<div class="col-md-1">
</div>
<div class="col-md-11">
<div class="row">
<!-- <div class="row"> -->
<!-- <div class="files"> -->
<div class="col-md-10 text-right">
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()" id="day" style="display: inline-block;">
Add New File
</button>
</div>
<?php if (count($emp_data) > 0) {
foreach ($emp_data as $key => $value) { ?>
<div class="col-md-12 pad ">
<div class="row">
<div class="col-md-4">
<span>File Name</span>
<input type="text" maxlength="255" class="form-control"
@ -921,7 +925,7 @@ if (!empty($EmpDetails)) {
<div id="filesContainer" class="col-12"></div>
<!-- </div> -->
</div>
<!-- </div> -->
</div>
</div>
@ -1617,55 +1621,55 @@ if (!empty($EmpDetails)) {
});
$('.submit').click(function(e) {
e.preventDefault(); // Prevent default form submission
e.preventDefault();
var isValid = true;
var combinedFormData = '';
// List of form IDs you want to combine
var combinedFormData = new FormData();
var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here
formIds.forEach(function(formId) {
var $form = $(formId);
// Validate the form
if (!$form[0].checkValidity()) {
isValid = false;
$form.find(':submit').click(); // Trigger the built-in HTML5 validation to show errors
return false; // Break the loop if any form is invalid
}
// Serialize and combine the form data
combinedFormData += $form.serialize() + '&'; // Append each form's serialized data
// Append the form data to FormData
$form.serializeArray().forEach(function(field) {
combinedFormData.append(field.name, field.value);
});
// Handle file inputs separately
$form.find('input[type="file"]').each(function() {
var input = $(this);
$.each(input[0].files, function(i, file) {
combinedFormData.append(input.attr('name'), file);
});
});
});
if (!isValid) {
console.log('Validation failed. Please fill all required fields.');
return; // Stop the submission if validation fails
}
console.log('Form Data Prepared:', combinedFormData); // Log for debugging
// Remove the trailing '&' from the combined form data
combinedFormData = combinedFormData.slice(0, -1);
console.log('Combined Form Data:', combinedFormData); // Log the combined form data
// Now you can send the combined data via AJAX or perform your desired action
// Send the combined data via AJAX
$.ajax({
type: 'POST',
url: '<?php echo base_url() ?>employeedetails/UpdateEmployee', // Replace with your form submission URL
data: combinedFormData,
processData: false, // Prevent jQuery from processing the data
contentType: false, // Prevent jQuery from setting the content type
success: function(response) {
console.log('Form submitted successfully:', response);
// Handle the success scenario
// if (response) {
// window.location.href = '<?php echo base_url("employeeListing"); ?>';
// } else {
// alert('Employee details Not Update...');
// }
console.log(response);
console.log('Form submitted successfully:', response == 'true');
if (response == 'true') {
window.location.href = '<?php echo base_url("employeeListing"); ?>';
} else {
alert('Employee details Not Update...');
}
},
error: function(error) {
console.log('Form submission failed:', error);
// Handle the error scenario
}
});
});

View File

@ -95,7 +95,7 @@
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download" aira-hidden="true"></i></a>
<!-- <a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download" aira-hidden="true"></i></a> -->
</div>
</div>
<div class="row">

View File

@ -8,6 +8,7 @@
.form-group {
padding-bottom: 0%;
}
.Date-filter-form {
display: flex;
align-items: center;
@ -43,7 +44,8 @@
.icon-button:hover {
color: #0056b3;
}
.delete_button{
.delete_button {
border: none;
background-color: white;
color: red;
@ -69,7 +71,7 @@
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
@ -87,11 +89,11 @@
<th align="right">Created Date</th>
<!-- <th align="right">Expense Id</th> -->
<th align="right">Supplier Name</th>
<th align="right">GST</th>
<th align="right">Cost</th>
<th align="right">GST</th>
<th align="right">Total</th>
<th align="right">Status</th>
<th align="right">Payment Method</th>
<th align="right">Status</th>
<th>Action</th>
</tr>
</thead>
@ -105,34 +107,34 @@
$fileExists = 1;
$fileUrl = base_url('uploads/') . $record['transporter_file'];
}
// Create download link and delete button
?>
// Create download link and delete button
?>
<tr>
<?php if (date('d-m-Y', strtotime($record['created_on'])) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record['created_on']));
}
}
?>
<td><?php echo $cdate; ?></td>
<!-- <td><?php echo $record['id']; ?></td> -->
<td><?php echo $record['SupplierName']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['cost']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['total']; ?></td>
<td><?php echo $record['status']; ?></td>
<td><?php echo $record['payment_method']; ?></td>
<td><?php echo $record['status']; ?></td>
<td>
<?php if($fileExists == 1){ ?>
<?php if ($fileExists == 1) { ?>
<button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;">
<i class="fas fa-file-download"></i>
</button>
<button title="Delete File" id="deleteFile" class="delete_button" data-value="<?php echo $record['id'] ?>" data-id="<?php echo $record['id'] ?>" data-file="<?php echo $record['transporter_file'] ?>"><i class="fas fa-trash"></i></button>
<?php } ?>
<button title="Edit" class="edit-button" data-toggle="modal" data-target="#expenseModal" data-id="<?php echo $record['id']; ?>" style="border: none;background-color: white;color: #02a8b5;" >
<i class="fas fa-pencil-alt"></i>
</button>
<button title="Edit" class="edit-button" data-toggle="modal" data-target="#expenseModal" data-id="<?php echo $record['id']; ?>" style="border: none;background-color: white;color: #02a8b5;">
<i class="fas fa-pencil-alt"></i>
</button>
</td>
</tr>
<?php
@ -165,7 +167,7 @@
<input type="hidden" name="id" id="id">
<div class="form-group row">
<div class="col-md-5">
<label for="transporterfile" class="col-form-label">Transporter File:</label>
<label for="transporterfile" class="col-form-label">Transporter File</label>
<input type="file" name="transporterfile" id="transporterfile" class="form-control">
<input type="hidden" name="transporterfile_name" id="transporterfile_name">
<small id="fileHelp" class="form-text text-muted">
@ -175,29 +177,27 @@
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="supplierid" class="col-form-label">Supplier :</label>
<label for="supplierid" class="col-form-label">Supplier </label>
<select name="supplierid" id="supplierid" class="form-control" required>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-5">
<label for="gst" class="col-form-label">Tax:</label>
<input type="number" name="gst" id="gst" class="form-control" >
<label for="cost" class="col-form-label">Cost</label>
<input type="number" name="cost" id="cost" class="form-control">
</div>
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="cost" class="col-form-label">Cost:</label>
<input type="number" name="cost" id="cost" class="form-control">
<label for="gst" class="col-form-label">Tax</label>
<input type="number" name="gst" id="gst" class="form-control">
</div>
</div>
<div class="form-group row">
<div class="col-md-5">
<label for="status" class="col-form-label">Status:</label>
<label for="status" class="col-form-label">Status</label>
<select name="status" id="status_id" class="form-control" required>
<option>Select Status</option>
<option value="Payment Pending">Payment Pending</option>
@ -207,21 +207,21 @@
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="payment_method" class="col-form-label">Payment Method:</label>
<label for="payment_method" class="col-form-label">Payment Method</label>
<select name="payment_method" id="payment_method" class="form-control" required>
<option>Select Payment Method</option>
<option value="Cash">Cash</option>
<option value="Online">Online</option>
<option>Select Payment Method</option>
<option value="Cash">Cash</option>
<option value="Online">Online</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-12">
<label for="remarks" class="col-form-label">Remarks:</label>
<label for="remarks" class="col-form-label">Remarks</label>
<!-- <input type="text" name="remarks" id="remarks" class="form-control"> -->
<textarea name="remarks" id="remarks" class="form-control"></textarea>
<textarea name="remarks" id="remarks" class="form-control"></textarea>
</div>
</div>
</form>
</div>
@ -239,256 +239,264 @@
window.location.href = 'downloadFile/' + fileName;
}
$(document).ready(function() {
// Function to toggle payment method based on status
function togglePaymentMethod() {
var status = $('#status_id').val();
console.log(status);
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
// Function to toggle payment method based on status
function togglePaymentMethod() {
var status = $('#status_id').val();
console.log(status);
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
}
}
}
// Trigger the toggle function on page load
togglePaymentMethod();
// Trigger the toggle function whenever the status changes
$('#status_id').on('change', function() {
// Trigger the toggle function on page load
togglePaymentMethod();
// Trigger the toggle function whenever the status changes
$('#status_id').on('change', function() {
togglePaymentMethod();
});
});
});
$(document).ready(function() {
$('#supplierid').select2();
var formActionUrl = '';
var formActionUrl = '';
// Event handler for file input change
$('#transporterfile').on('change', function() {
var fileName = $(this).val().split('\\').pop(); // Get the file name
$('#file-name-display').text(fileName); // Display the file name
});
function togglePaymentMethodEdit() {
var status = $('#status_id').val();
console.log(status);
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
}
}
$(document).on('click', '.edit-button', function() {
$('.modal-title').html('Edit Expense');
var expenseId = $(this).data('id');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
// Event handler for file input change
$('#transporterfile').on('change', function() {
var fileName = $(this).val().split('\\').pop(); // Get the file name
$('#file-name-display').text(fileName); // Display the file name
});
formActionUrl = '<?php echo base_url().'editExpense' ?>'; // Set action URL for adding
$.ajax({
url: '<?php echo base_url().'getExpenseDetails'; ?>',
type: 'POST',
data: { id: expenseId },
success: function(response) {
var expense = JSON.parse(response);
$('#id').val(expense.id);
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val(expense.supplier_id).trigger('change');
$('#remarks').val(expense.remarks);
$('#cost').val(expense.cost);
$('#gst').val(expense.gst);
$('#total').val(expense.total);
$('#status_id').val(expense.status);
$('#payment_method').val(expense.payment_method);
function togglePaymentMethodEdit() {
var status = $('#status_id').val();
console.log(status);
// Clear any existing file link and delete button
$('#transporterfile').next('.download_button').remove();
$('#transporterfile').next('.delete_button').remove();
if (expense.transporter_file) {
$('#transporterfile_name').val(expense.transporter_file); // Set the hidden input value
$('#currentFileName').text(expense.transporter_file); // Display the existing file name
// Construct the full URL to the file
var fileUrl = '<?php echo base_url('uploads/'); ?>' + expense.transporter_file;
// Create download link and delete button
var fileLink = '<a class="download_button" href="' + fileUrl + '" target="_blank" download="' + expense.transporter_file + '"><i class=" fas fa-file-download"></i></a>';
var deleteButton = '<button id="deleteFile" class="delete_button" data-value="' + expense.id +'" data-id="' + expense.id + '" data-file="' + expense.transporter_file + '"><i class="fas fa-trash"></i></button>';
// Add the file link and delete button
$('#transporterfile').after(fileLink + ' ' + deleteButton);
} else {
$('#transporterfile_name').val(''); // Clear hidden input if no file
}
togglePaymentMethodEdit();
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
}
}
$(document).on('click', '.edit-button', function() {
$('.modal-title').html('Edit Expense');
var expenseId = $(this).data('id');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url() . 'editExpense' ?>'; // Set action URL for adding
$.ajax({
url: '<?php echo base_url() . 'getExpenseDetails'; ?>',
type: 'POST',
data: {
id: expenseId
},
success: function(response) {
var expense = JSON.parse(response);
$('#id').val(expense.id);
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val(expense.supplier_id).trigger('change');
$('#remarks').val(expense.remarks);
$('#cost').val(expense.cost);
$('#gst').val(expense.gst);
$('#total').val(expense.total);
$('#status_id').val(expense.status);
$('#payment_method').val(expense.payment_method);
// Clear any existing file link and delete button
$('#transporterfile').next('.download_button').remove();
$('#transporterfile').next('.delete_button').remove();
if (expense.transporter_file) {
$('#transporterfile_name').val(expense.transporter_file); // Set the hidden input value
$('#currentFileName').text(expense.transporter_file); // Display the existing file name
// Construct the full URL to the file
var fileUrl = '<?php echo base_url('uploads/'); ?>' + expense.transporter_file;
// Create download link and delete button
var fileLink = '<a class="download_button" href="' + fileUrl + '" target="_blank" download="' + expense.transporter_file + '"><i class=" fas fa-file-download"></i></a>';
var deleteButton = '<button id="deleteFile" class="delete_button" data-value="' + expense.id + '" data-id="' + expense.id + '" data-file="' + expense.transporter_file + '"><i class="fas fa-trash"></i></button>';
// Add the file link and delete button
$('#transporterfile').after(fileLink + ' ' + deleteButton);
} else {
$('#transporterfile_name').val(''); // Clear hidden input if no file
}
togglePaymentMethodEdit();
}
});
});
$(document).on('click', '#addExpense', function() {
$('.download_button').remove();
$('.delete_button').remove();
$('.modal-title').html('Add Expense');
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val('').trigger('change');
$('#remarks').val('');
$('#cost').val('');
$('#gst').val('');
$('#total').val('');
$('#status_id').val('');
$('#payment_method').val('');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url() . 'addExpense' ?>'; // Set action URL for adding
togglePaymentMethodEdit();
});
// Handle form submission
$('#tempClick').on('click', function(e) {
e.preventDefault();
// Native HTML5 form validation
if ($('#expenseForm')[0].checkValidity()) {
var formData = new FormData($('#expenseForm')[0]); // Use FormData to handle file upload
console.log(formActionUrl);
$.ajax({
url: formActionUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
if (response) {
$('#expenseModal').modal('hide');
$('#expenseForm')[0].reset();
$('#file-name-display').text(''); // Clear the file name display
window.location.reload();
} else {
console.log(response);
}
},
error: function(xhr, status, error) {
alert('An error occurred: ' + error);
}
});
} else {
// If form is invalid, show native validation messages
$('#expenseForm')[0].reportValidity();
}
});
// DataTable initialization and date range filter logic (unchanged)
var table = $('#expense_list_table').DataTable({
dom: 'Blfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: true,
order: [
[0, 'desc']
],
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>',
previous: '<i class="fas fa-angle-left"></i>'
}
}
});
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0];
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
startDate.setDate(startDate.getDate() - 1);
endDate.setHours(23, 59, 59, 999);
return date >= startDate && date <= endDate;
}
);
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw();
});
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
toDateInput.min = fromDate;
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
$(document).on('click', '#addExpense', function () {
$('.download_button').remove();
$('.delete_button').remove();
$('.modal-title').html('Add Expense');
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val('').trigger('change');
$('#remarks').val('');
$('#cost').val('');
$('#gst').val('');
$('#total').val('');
$('#status_id').val('');
$('#payment_method').val('');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url().'addExpense' ?>'; // Set action URL for adding
togglePaymentMethodEdit();
});
// Handle form submission
$('#tempClick').on('click', function(e) {
e.preventDefault();
// Native HTML5 form validation
if ($('#expenseForm')[0].checkValidity()) {
var formData = new FormData($('#expenseForm')[0]); // Use FormData to handle file upload
console.log(formActionUrl);
$(document).on('click', '#deleteFile', function() {
var fileName = $(this).data('file');
var expenseId = $(this).data('value');
$.ajax({
url: formActionUrl,
url: '<?php echo base_url('deleteFile'); ?>',
type: 'POST',
data: formData,
processData: false,
contentType: false,
data: {
file_name: fileName,
expense_id: expenseId
},
success: function(response) {
console.log(response);
if (response) {
$('#expenseModal').modal('hide');
$('#expenseForm')[0].reset();
$('#file-name-display').text(''); // Clear the file name display
window.location.reload();
var result = JSON.parse(response);
if (result.success) {
alert('File deleted successfully.');
$('#currentFileName').text('');
$('#transporterfile_name').val('');
$('#deleteFile').remove(); // Remove the delete button
$('#transporterfile').next('a').remove(); // Remove the download link
} else {
console.log(response);
alert('Failed to delete the file: ' + result.message);
}
},
error: function(xhr, status, error) {
alert('An error occurred: ' + error);
error: function() {
alert('Error deleting the file.');
}
});
} else {
// If form is invalid, show native validation messages
$('#expenseForm')[0].reportValidity();
}
});
// DataTable initialization and date range filter logic (unchanged)
var table = $('#expense_list_table').DataTable({
dom: 'Blfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ],
responsive: true,
order: [[0, 'desc']],
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>',
previous: '<i class="fas fa-angle-left"></i>'
}
}
});
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0];
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
startDate.setDate(startDate.getDate() - 1);
endDate.setHours(23, 59, 59, 999);
return date >= startDate && date <= endDate;
}
);
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw();
});
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
toDateInput.min = fromDate;
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
$(document).on('click', '#deleteFile', function() {
var fileName = $(this).data('file');
var expenseId = $(this).data('value');
$.ajax({
url: '<?php echo base_url('deleteFile'); ?>',
type: 'POST',
data: { file_name: fileName, expense_id: expenseId },
success: function(response) {
console.log(response);
var result = JSON.parse(response);
if (result.success) {
alert('File deleted successfully.');
$('#currentFileName').text('');
$('#transporterfile_name').val('');
$('#deleteFile').remove(); // Remove the delete button
$('#transporterfile').next('a').remove(); // Remove the download link
} else {
alert('Failed to delete the file: ' + result.message);
}
},
error: function() {
alert('Error deleting the file.');
}
});
});
</script>
@ -497,4 +505,4 @@ $(document).on('click', '#deleteFile', function() {
var fileName = this.files[0].name;
document.getElementById('currentFileName').textContent = fileName;
});
</script>
</script>

View File

@ -82,6 +82,36 @@
$('#hdate').addClass('form-control');
$('#hname').addClass('form-control');
});
// Zoho Sync FUnction
function synczohobooks() {
var sync = true
$('#loader_wrapper').css("display", "block");
$.ajax({
// $('#loadingDiv').show();
url: "<?php echo base_url() ?>user/zohobooks_api_fetch_all",
type: "post",
data: {
sync
},
success: function(data) {
console.log(data);
alert("Sync Completed");
},
failure: function(data) {
alert("Failed");
},
complete: function() {
$('#loader_wrapper').css("display", "none");
}
});
}
</script>
</body>
</html>

View File

@ -318,7 +318,8 @@
<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
<!-- item-->
<div class="dropdown-header noti-title">
<h6 class="text-overflow m-0"><?php echo "Welcome ".$role_text." !"; ?><?php //echo $role; ?></h6>
<h6 class="text-overflow m-0"><?php echo "Welcome ".$name." !"; ?><?php //echo $role; ?></h6>
<!-- <h6 class="text-overflow m-0"><?php echo "Welcome ".$role_text." !"; ?><?php //echo $role; ?></h6> -->
</div>
<!-- item-->
@ -397,15 +398,19 @@
<div class="collapse navbar-collapse" id="topnav-menu-content">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-dashboard" role="button"
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button"
aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i> DASHBOARD
</a>
<!-- <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-dashboard" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i> DASHBOARDS <div class="arrow-down"></div>
<i class="ri-dashboard-line mr-1"></i> DASHBOARD <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-dashboard">
<a href="<?php echo base_url(); ?>dashboard" class="dropdown-item">Home</a>
<!-- <a href="https://vu.venbait.in/d/d9eb820b-60aa-4fe6-9de0-531924185b77/sales-at-a-glance?orgId=2&from=1715215911333&to=1715237511333" class="dropdown-item">Sales</a> -->
<a href="https://vu.venbait.in/d/d9eb820b-60aa-4fe6-9de0-531924185b77/sales-at-a-glance?orgId=2&from=1715215911333&to=1715237511333" class="dropdown-item">Sales</a>
<a href="<?php echo base_url(); ?>sales_dashboard" class="dropdown-item">Sales</a>
</div>
</div> -->
</li>
<li class="nav-item dropdown">
@ -414,7 +419,8 @@
<i class="ri-file-paper-2-line mr-1"></i> SALES <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>sales_invoice" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i> Sales Invoice</a>
<a href="<?php echo base_url(); ?>sales_invoice" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Invoice</a>
<a href="<?php echo base_url(); ?>dashboard" class="dropdown-item"><i class="ri-refresh-line align-middle mr-1"></i>Sync With Zoho Books</a>
</div>
</li>
@ -483,8 +489,17 @@
<a href="<?php echo base_url(); ?>ViewPay" class="dropdown-item">PaySlip Generator</a>
<!-- <a href="<?php echo base_url(); ?>PaysilpListing" class="dropdown-item">Edit Payslip</a> -->
<a href="<?php echo base_url(); ?>emppayListings" class="dropdown-item">Employee Loan Details</a>
</div>
</div>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-calendar-times align-middle mr-1"></i> Leave <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-leave">
<a href="<?php echo base_url(); ?>publicholidays" class="dropdown-item">Public Holidays</a>
<a href="<?php echo base_url(); ?>leavereports" class="dropdown-item">Leave Reports</a>
<a href="<?php echo base_url(); ?>leavereports" class="dropdown-item"> Reports</a>
</div>
</div>
@ -508,7 +523,7 @@
<a href="<?php echo base_url(); ?>transporterListing" class="dropdown-item">Transporter Details</a>
<a href="<?php echo base_url(); ?>costListing" class="dropdown-item">Cost Details</a>
<a href="<?php echo base_url(); ?>assetListing" class="dropdown-item">Asset Details</a>
<a href="<?php echo base_url(); ?>companyview" class="dropdown-item">Company Master</a>
<a href="<?php echo base_url(); ?>companyview" class="dropdown-item">Business Settings</a>
<a href="<?php echo base_url(); ?>configlisting" class="dropdown-item">Config Details</a>
<a href="<?php echo base_url(); ?>departmentListing" class="dropdown-item">Department Details</a>
<a href="<?php echo base_url(); ?>rawmaterialListing" class="dropdown-item">Material Details</a>

View File

@ -1868,7 +1868,7 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="form-group col-md-3" id="Deliverydtdiv">
<label>Delivery Date<span class="badge mandatory">*</span></label>
<input type="date" class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="Deliverydt" name="Deliverydt" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<input class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="Deliverydt" name="Deliverydt" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<!-- <div>
<?php
@ -1898,7 +1898,7 @@ if (!empty($INRSYMBOL)) {
<div class="form-row">
<div class="form-group col-md-3">
<label>Purchase Order Date</label>
<input type="date" class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="PODate" name="PODate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<input class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="PODate" name="PODate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<!-- <div>
<?php

View File

@ -86,7 +86,7 @@ span.highlight {
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Requisition Listing</h4>
<h4 class="page-title">Requisition List</h4>
<?php if($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?>

View File

@ -1,16 +1,16 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
/* 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 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;
}
/* 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{
.card_font_colorset_green {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -18,7 +18,8 @@
z-index: 1;
color: rgb(86, 166, 75);
}
.card_font_colorset_bule{
.card_font_colorset_bule {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -26,7 +27,8 @@
z-index: 1;
color: rgb(31, 96, 196);
}
.card_font_colorset_red{
.card_font_colorset_red {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -34,72 +36,78 @@
z-index: 1;
color: rgb(173, 3, 23);
}
</style>
<style>
#Requisition_filter {
float: inline-end;
}
#Requisition_filter {
float: inline-end;
}
#Requisition_wrapper .row .col-sm-4 {
flex-basis: 50%;
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_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_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) {
padding: 0 15px;
}
#Requisition_info {
margin-top: 5px;
}
#Requisition_info {
margin-top: 5px;
}
.dataTables_wrapper {
padding-bottom: 0;
}
.dataTables_wrapper {
padding-bottom: 0;
}
span.highlight {
background-color: yellow;
}
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>
.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-->
@ -109,80 +117,82 @@ span.highlight {
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Invoices Table</h4>
<h4 class="page-title">Invoices List</h4>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button" title="Search"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<button type="submit" class="range_search_button" title="Search"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<div class="card-body">
<table id="datatable-buttosns" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th >Invoice Date</th>
<th>Invoice Date</th>
<th>Invoice No</th>
<th>Client Name</th>
<th >Product</th>
<th>Product</th>
<th>Rate</th>
<th>Quantity</th>
<th>Sub Total</th>
<th>GST</th>
<th>Total</th>
<th>Status</th>
<th >E-Invoice Number</th>
<th >Action</th>
<th>E-Invoice Number</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<input type="text" id="invoice_id_set" name="invoice_id_set" hidden>
<?php if(!empty($sales_invoice)){ foreach($sales_invoice as $invoice){
$subtotal = $invoice->item_price * $invoice->item_quantity;
// Calculate CGST and SGST
$cgst_amount = ($subtotal * $invoice->cgst) / 100;
$sgst_amount = ($subtotal * $invoice->sgst) / 100;
$total = $subtotal + $cgst_amount + $sgst_amount;?>
<!-- Main invoice row -->
<tr >
<td ><?php echo date('d-m-Y', strtotime($invoice->invoice_date_created)); ?></td>
<td >
<?php if(!empty($invoice->invoice_url)){ ?>
<a href="<?php echo $invoice->invoice_url; ?>" target="_blank" class="invoice-link">
<?php } ?>
<?php echo $invoice->invoice_number; ?>
<?php if(!empty($invoice->invoice_url)){ ?>
</a>
<?php } ?>
</td>
<td ><?php echo $invoice->client_name ?></td>
<td ><?php echo $invoice->item_name ?></td>
<td ><?php echo $invoice->item_price ?></td>
<td ><?php echo number_format($invoice->item_quantity, 2 ,'.', ',' ) ?></td>
<td ><?php echo number_format($subtotal, 2, '.', ',') ?></td>
<td ><?php echo number_format($cgst_amount+$sgst_amount, 2, '.', ',') ?></td>
<td ><?php echo number_format($total, 2, '.', ',') ?></td>
<td ><?php echo $invoice->status ?></td>
<td ><?php echo $invoice->e_invoice_number; ?></td>
<td >
<a class="edit-button" style="cursor: pointer; display: inline-block;" title="Files Upload" onclick="openInvoiceModal('<?php echo $invoice->invoice_number; ?>', '<?php echo $invoice->client_name; ?>', '<?php echo $invoice->invoice_date_created; ?>', '<?php echo $invoice->invoice_id; ?>')">
<i class="fas fa-file-upload text-muted" style="font-size: 18px; vertical-align: middle;"></i>
</a>
</td>
</tr>
<?php } } ?>
<?php if (!empty($sales_invoice)) {
foreach ($sales_invoice as $invoice) {
$subtotal = $invoice->item_price * $invoice->item_quantity;
// Calculate CGST and SGST
$cgst_amount = ($subtotal * $invoice->cgst) / 100;
$sgst_amount = ($subtotal * $invoice->sgst) / 100;
$total = $subtotal + $cgst_amount + $sgst_amount; ?>
<!-- Main invoice row -->
<tr>
<td><?php echo date('d-m-Y', strtotime($invoice->invoice_date_created)); ?></td>
<td>
<?php if (!empty($invoice->invoice_url)) { ?>
<a href="<?php echo $invoice->invoice_url; ?>" target="_blank" class="invoice-link">
<?php } ?>
<?php echo $invoice->invoice_number; ?>
<?php if (!empty($invoice->invoice_url)) { ?>
</a>
<?php } ?>
</td>
<td><?php echo $invoice->client_name ?></td>
<td><?php echo $invoice->item_name ?></td>
<td><?php echo $invoice->item_price ?></td>
<td><?php echo number_format($invoice->item_quantity, 2, '.', ',') ?></td>
<td><?php echo number_format($subtotal, 2, '.', ',') ?></td>
<td><?php echo number_format($cgst_amount + $sgst_amount, 2, '.', ',') ?></td>
<td><?php echo number_format($total, 2, '.', ',') ?></td>
<td><?php echo $invoice->status ?></td>
<td><?php echo $invoice->e_invoice_number; ?></td>
<td>
<a class="edit-button" style="cursor: pointer; display: inline-block;" title="Files Upload" onclick="openInvoiceModal('<?php echo $invoice->invoice_number; ?>', '<?php echo $invoice->client_name; ?>', '<?php echo $invoice->invoice_date_created; ?>', '<?php echo $invoice->invoice_id; ?>')">
<i class="fas fa-file-upload text-muted" style="font-size: 18px; vertical-align: middle;"></i>
</a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div> <!-- end card body-->
@ -193,81 +203,305 @@ span.highlight {
</div> <!-- container -->
</div> <!-- content -->
</div>
<!-- Modal Structure -->
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog" aria-labelledby="invoiceModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="display:block">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="standard-modalLabel">
<span id="invoice_number_display_model"></span> -
<span id="date_display_model"></span>
</h4>
<span id="client_name_display_model"></span>
<div class="col-md-12">
</div>
</div>
<div class="modal-body" style="margin-top: 23px;">
<div class="col-md-4">
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()" id="day">
Add New File
</button>
</div>
<div id="filesContainer">
<!-- Rows will be dynamically appended here -->
</div>
<?php if (isset($invoice_data)) {
foreach ($invoice_data as $key => $value) { ?>
<div class="row pad ">
<div class="col-md-6">
<span>File Name</span>
<input type="text" maxlength="255" class="form-control"
value="<?php echo $value['file_name']; ?>" readonly>
</div>
<div class="col-md-1" style="margin-top: 25px;">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $value['emp_file']; ?>"
download>
<i class="fa fa-download" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<div class="col-md-5" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm"
id="<?= $value['id']; ?>"
onclick="removeContact(this)">Delete</button>
</div>
</div>
<?php }
} ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick="saveAttachment()" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable-buttosns').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: true, // Responsive table
order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable-buttosns').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [
[0, 'desc']
], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
}
});
});
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
function openInvoiceModal(invoiceNumber, clientName, invoiceDateCreated, invoiceId) {
$('#invoice_number_display_model').html(invoiceNumber);
$('#date_display_model').html(invoiceDateCreated);
$('#client_name_display_model').html(clientName);
$('#invoice_id_set').val(invoiceId);
// document.getElementById('modalInvoiceNumber').innerText = invoiceNumber;
$('#day').show();
// $('#invoiceModal').modal('show');
// url: "<?php echo base_url() ?>servicepurchaseorder/getPODetails",
$.ajax({
url: '<?php echo base_url() ?>getInvoiceAttachment',
type: 'GET',
data: {
invoice_number: invoiceId
},
success: function(response) {
console.log(response);
console.log(JSON.parse(response).invoiceAttachment);
var list = JSON.parse(response).invoiceAttachment;
var attachmentsHtml = '';
list.forEach(element => {
console.log(element);
var fileName = element.file_name;
var attachmentName = element.attachment_name;
attachmentsHtml += `
<div class="row pad">
<div class="col-md-4">
<span>File Name</span>
<input type="text" maxlength="255" class="form-control"
value="${attachmentName}" readonly>
</div>
<div class="col-md-1" style="margin-top: 25px;">
<a href="<?php echo base_url() . 'public/uploads/images/invoice_files/' ?>${fileName}" download>
<i class="fa fa-download" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<div class="col-md-5" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm"
id="${element.invoice_attachment_id}"
onclick="removeContact(this)">Delete</button>
</div>
</div>`;
});
$('#filesContainer').html(attachmentsHtml);
$('#invoiceModal').modal('show');
},
error: function() {
// Handle any errors during the AJAX request
$('#filesContainer').html('<p>There was an error loading the attachments.</p>');
$('#invoiceModal').modal('show');
}
});
}
function appendFilesFileds(data) {
var newRowHtml = `
<div class="row pad">
<div class="col-md-4">
<span for="file_name">File name</span>
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
</div>
<div class="col-md-4">
<span for="emp_file">File</span>
<input type="file" name="emp_file[]" class="form-control">
</div>
<div class="col-md-4" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)">Remove</button>
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()">Add</button>
</div>
</div>`;
// Append the new row to the container
$('#filesContainer').append(newRowHtml);
// Hide all "Add" buttons except the last one
$('.a1').hide();
$('#filesContainer .pad:last .a1').show();
}
function removeContact(button) {
$(button).closest('.pad').remove();
$('#filesContainer .a1').hide();
$('#filesContainer .pad:last .a1').show();
var len = $('#filesContainer .pad:last .a1')
var length = len.length;
if (length == 0) {
$('#day').show()
} else {
$('#day').hide()
}
);
console.log("-------------------");
console.log(button);
console.log($(button).val());
console.log($(button).attr('id'));
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
$.ajax({
url: '<?php echo base_url() ?>deleteAttachment',
type: 'GET',
data: {
invoice_attachment_id: $(button).attr('id')
},
success: function(response) {
console.log(response);
},
error: function() {
}
});
}
function saveAttachment() {
var formData = new FormData();
var invoiceId = $('#invoice_id_set').val();
formData.append('invoice_id', invoiceId);
// Append files
$('input[name="emp_file[]"]').each(function(index, input) {
var files = $(input)[0].files;
if (files.length > 0) {
formData.append('emp_file[]', files[0]);
}
});
// Append other fields
$('input[name="file_name[]"]').each(function(index, input) {
formData.append('file_name[]', $(input).val());
});
// AJAX request using FormData
$.ajax({
url: '<?php echo base_url() ?>saveAttachment',
type: 'POST',
data: formData,
processData: false, // Prevent jQuery from converting the data
contentType: false, // Prevent jQuery from overriding the content type
success: function(response) {
console.log(response);
if (response.success) {
$('#invoiceModal').modal('hide');
// Handle success
} else {
alert(response.message);
}
},
error: function() {
alert('An error occurred while saving the attachment.');
}
});
}
</script>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB