Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
d58d3da627
@ -438,11 +438,11 @@ $routes->get('getInvoiceAttachment', 'Sales::getInvoiceAttachments');
|
||||
$routes->get('getInvoiceAttachments', 'Sales::getInvoiceAttachments');
|
||||
$routes->get('deleteAttachment', 'Sales::deleteAttachment');
|
||||
$routes->post('saveAttachment', 'Sales::saveAttachment');
|
||||
$routes->get('sales_invoice', 'Sales::sales_invoice');
|
||||
$routes->post('sales_invoice', 'Sales::sales_invoice');
|
||||
$routes->post('download_sales_invoice', 'Sales::download_sales_invoice');
|
||||
$routes->post('updateInvRecQty', 'Sales::updateInvRecQty');
|
||||
$routes->match(['GET', 'POST'],'sales_invoice', 'Sales::sales_invoice');
|
||||
$routes->match(['GET', 'POST'], 'sales_report', 'Sales::sales_report');
|
||||
$routes->match(['GET', 'POST'],'credit_notes', 'Sales::credit_notes');
|
||||
|
||||
// transporter Routes
|
||||
$routes->match(['GET', 'POST'],'transporterListing', 'Supplier::transporterListing');
|
||||
|
||||
@ -6,6 +6,7 @@ use App\Controllers\BaseController;
|
||||
|
||||
use App\Models\Ipinvoice_model;
|
||||
use App\Models\Ipattachment_model;
|
||||
use App\Models\CreditNoteModel;
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
@ -15,6 +16,7 @@ class Sales extends BaseController
|
||||
{
|
||||
protected $ipinvoice_model;
|
||||
protected $ipattachment_model;
|
||||
protected $CreditNoteModel;
|
||||
protected $session;
|
||||
|
||||
public function __construct()
|
||||
@ -22,6 +24,7 @@ class Sales extends BaseController
|
||||
parent::__construct();
|
||||
$this->ipinvoice_model = new Ipinvoice_model();
|
||||
$this->ipattachment_model = new Ipattachment_model();
|
||||
$this->CreditNoteModel = new CreditNoteModel();
|
||||
$this->session = session();
|
||||
$this->isLoggedIn();
|
||||
}
|
||||
@ -119,6 +122,33 @@ class Sales extends BaseController
|
||||
}
|
||||
|
||||
|
||||
// credit_notes List
|
||||
function credit_notes(){
|
||||
$fromDate='';
|
||||
$toDate='';
|
||||
|
||||
if ($this->request->getMethod() === 'GET')
|
||||
{
|
||||
$toDate = date('Y-m-d');
|
||||
$fromDate = date('Y-m-d', strtotime('-90 days', strtotime($toDate)));
|
||||
} elseif ($this->request->getMethod() === 'POST') {
|
||||
$fromDate = $this->request->getPost('fromDate');
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$fromDate = date('Y-m-d', strtotime($fromDate));
|
||||
$toDate = date('Y-m-d', strtotime($toDate));
|
||||
}
|
||||
|
||||
$this->global['pageTitle'] = 'Credit Notes';
|
||||
$data['credit_notes'] = $this->CreditNoteModel->getAllCreditNotes($fromDate , $toDate);
|
||||
// dd($data);
|
||||
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
|
||||
$data['toDate'] = date('d-m-Y', strtotime($toDate));
|
||||
|
||||
|
||||
$this->loadViews("credit_notes", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
|
||||
public function sales_report()
|
||||
{
|
||||
$headline = '';
|
||||
|
||||
@ -14,6 +14,7 @@ use App\Models\User_model;
|
||||
use App\Models\Ipinvoice_model;
|
||||
use App\Models\Ipattachment_model;
|
||||
use App\Models\Zohobooks_api_model;
|
||||
use App\Models\CreditNoteModel;
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
@ -34,6 +35,7 @@ class User extends BaseController
|
||||
protected $user_model;
|
||||
protected $ipinvoice_model;
|
||||
protected $ipattachment_model;
|
||||
protected $CreditNoteModel;
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
@ -50,6 +52,7 @@ class User extends BaseController
|
||||
$this->user_model = new User_model();
|
||||
$this->ipinvoice_model = new Ipinvoice_model();
|
||||
$this->ipattachment_model = new Ipattachment_model();
|
||||
$this->CreditNoteModel = new CreditNoteModel();
|
||||
$this->session = session();
|
||||
helper('form'); //$this->load->library('form_validation');
|
||||
$this->isLoggedIn();
|
||||
@ -1337,17 +1340,13 @@ class User extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function zohobooks_api_fetch_all()
|
||||
{
|
||||
// print_r($_GET);
|
||||
// echo isset($_GET['from']) ? $_GET['from'] : 'n';
|
||||
// echo isset($_GET['to']) ? $_GET['to'] : 'n';
|
||||
// die();
|
||||
|
||||
try {
|
||||
// if (isset($_POST['sync']) || $_GET['from'] != null && $_GET['to'] != null)
|
||||
// {
|
||||
// $ch=curl_init();
|
||||
//$this->load->helper('zohobooks_fetch_api_helper');
|
||||
|
||||
helper('zohobook');
|
||||
$Zohobook_model = model('Zohobook_api_model');
|
||||
if (isset($_GET['from']) && $_GET['from'] != null && isset($_GET['to']) && $_GET['to'] != null) {
|
||||
@ -1357,15 +1356,13 @@ class User extends BaseController
|
||||
$date_today = date('Y-m-d');
|
||||
$date_yesterday = date('Y-m-d', strtotime('-3 day', strtotime($date_today)));
|
||||
}
|
||||
// echo $date_today.'--'.$date_yesterday;die;
|
||||
|
||||
$chk_acc_token_val = $Zohobook_model->get_data('zohobook_accesstoken', 'id', 1);
|
||||
// print_r($chk_acc_token_val);//die();
|
||||
|
||||
$date = new \DateTime($chk_acc_token_val[0]['created_at']);
|
||||
//print_r($date);
|
||||
|
||||
$date->add(new \DateInterval('PT1H'));
|
||||
//print_r($date);
|
||||
//echo '****************';
|
||||
//print_r(date('Y-m-d h:i:s'));
|
||||
|
||||
$token = 0;
|
||||
if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) {
|
||||
$token = $chk_acc_token_val[0]['token'];
|
||||
@ -1377,17 +1374,23 @@ class User extends BaseController
|
||||
// $token = generateNewToken(); $tokendata['token'] = $token;
|
||||
//$Zohobook_model->update($tokendata , 1,'zohobook_accesstoken');
|
||||
$result = getheringInvoiceDetails($date_today, $date_yesterday, $token);
|
||||
|
||||
$headers_new = $result['headers_new'];
|
||||
$res = json_decode($result['data'], true);
|
||||
$inv_array = $res['invoices'];
|
||||
|
||||
// $cteditNotes = getAllCreditNotes($date_today, $date_yesterday, $token);
|
||||
// dd($cteditNotes);
|
||||
|
||||
// dd($inv_array);
|
||||
// print_r($inv_array);
|
||||
// echo "rrrr";
|
||||
// die();
|
||||
$tokenWithCreditNoteScope = generateNewTokenForCreditNoteScope();
|
||||
$cteditNotesRes = getAllCreditNotes($date_today, $date_yesterday, $tokenWithCreditNoteScope);
|
||||
$cteditNotesData = json_decode($cteditNotesRes['data'],true);
|
||||
|
||||
if(count($cteditNotesData['creditnotes']))
|
||||
{
|
||||
$this->saveOrUpdateCreditNote($cteditNotesData['creditnotes']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($inv_array as $inv) {
|
||||
$invoice_id = $inv['invoice_id'];
|
||||
//filter only einvoice status pushed invoices only
|
||||
@ -1711,6 +1714,27 @@ class User extends BaseController
|
||||
}
|
||||
// END zoho API
|
||||
|
||||
public function saveOrUpdateCreditNote($data)
|
||||
{
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
$existingCreditNote = $this->CreditNoteModel->where('creditnote_id', $value['creditnote_id'])->first();
|
||||
|
||||
if ($existingCreditNote) {
|
||||
// Update existing record
|
||||
$this->CreditNoteModel->update($value['creditnote_id'], $value);
|
||||
|
||||
} else {
|
||||
// Insert new record
|
||||
$this->CreditNoteModel->insert($value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function fetchEmployeeDetails()
|
||||
{
|
||||
$EmpID = $this->request->getPost('EmpID');
|
||||
|
||||
@ -110,69 +110,58 @@ if (! function_exists('test_helper')) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('generateNewTokenForCreditNoteScope')) {
|
||||
function generateNewTokenForCreditNoteScope()
|
||||
{
|
||||
// Initialize cURL
|
||||
$ch = curl_init();
|
||||
|
||||
// Zoho API credentials
|
||||
$organization_id = '776847408';
|
||||
$client_id = '1000.0WMDLCXAZV5DR60IKE9P49YTYGVL6C';
|
||||
$refresh_token = '1000.461f55fee6248d21aafe4c10b05c37dc.9fc8b11993aba1ca95e539740f3d411f';
|
||||
$client_secret = '99da3a05cfa13cf91eb6476a3c44cfa3e21b6106a8';
|
||||
$redirect_uri = 'https://resicoindustries.com/RIA';
|
||||
|
||||
|
||||
// Construct URL to get the authentication token
|
||||
$url_getauthtoken = 'https://accounts.zoho.com/oauth/v2/token?refresh_token='.$refresh_token.'&client_id='.$client_id.'&client_secret='.$client_secret.'&redirect_uri='.$redirect_uri.'&grant_type=refresh_token';
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_URL, $url_getauthtoken);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Execute cURL request
|
||||
$res_token = curl_exec($ch);
|
||||
|
||||
// Decode the response
|
||||
$ress = json_decode($res_token);
|
||||
|
||||
// Return access token
|
||||
return $ress->access_token;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('getAllCreditNotes')) {
|
||||
// function getAllCreditNotes($date_today, $date_yesterday, $accesstoken)
|
||||
// {
|
||||
// // Initialize cURL
|
||||
// $ch = curl_init();
|
||||
|
||||
// // Zoho API credentials
|
||||
// $organization_id = '776847408';
|
||||
// // $url_org = "https://books.zoho.com/api/v3/creditnotes?";
|
||||
// $url_org = "https://www.zohoapis.com/books/v3/creditnotes?";
|
||||
|
||||
// // Construct query parameters
|
||||
// $fields = array(
|
||||
// "usestate" => "true",
|
||||
// "organization_id" => $organization_id,
|
||||
// "date_start" => $date_yesterday,
|
||||
// "date_end" => $date_today
|
||||
// );
|
||||
// $data_all = http_build_query($fields);
|
||||
|
||||
// // Set headers
|
||||
// $headers = array(
|
||||
// 'Authorization: Zoho-oauthtoken '.$accesstoken,
|
||||
// 'Content-Type: application/json'
|
||||
// );
|
||||
|
||||
// // Construct URL
|
||||
// $data_access = $url_org.$data_all;
|
||||
|
||||
// // Set cURL options
|
||||
// curl_setopt($ch, CURLOPT_URL, $data_access);
|
||||
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
// curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// // Execute cURL request
|
||||
// $result = curl_exec($ch);
|
||||
|
||||
// // Store headers and data
|
||||
// $data['headers_new'] = $headers;
|
||||
// $data['data'] = curl_exec($ch);
|
||||
// // Return data
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
function getAllCreditNotes($date_today, $date_yesterday, $accesstoken)
|
||||
{
|
||||
// Initialize cURL
|
||||
$ch = curl_init();
|
||||
var_dump($accesstoken);
|
||||
|
||||
// Zoho API credentials
|
||||
$organization_id = '776847408';
|
||||
$url_org = "https://books.zoho.com/api/v3/creditnotes?";
|
||||
$url_org = "https://www.zohoapis.com/books/v3/creditnotes?";
|
||||
|
||||
// Construct query parameters manually (Zoho might need raw values)
|
||||
$query_string = "usestate=true&organization_id=$organization_id&date_start=$date_yesterday&date_end=$date_today";
|
||||
$query_string = "organization_id=$organization_id&date_start=$date_yesterday&date_end=$date_today";
|
||||
|
||||
// Set headers
|
||||
$headers = array(
|
||||
'Authorization: Zoho-oauthtoken ' . $accesstoken,
|
||||
'Content-Type: application/json'
|
||||
// 'Content-Type: application/json'
|
||||
);
|
||||
|
||||
// Set cURL options
|
||||
|
||||
89
app/Models/CreditNoteModel.php
Normal file
89
app/Models/CreditNoteModel.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CreditNoteModel extends Model
|
||||
{
|
||||
protected $table = 'ip_credit_notes';
|
||||
protected $primaryKey = 'creditnote_id';
|
||||
protected $useAutoIncrement = false; // Since creditnote_id is BIGINT and not auto-incremented
|
||||
|
||||
protected $allowedFields = [
|
||||
'creditnote_id',
|
||||
'creditnote_number',
|
||||
'status',
|
||||
'reference_number',
|
||||
'date',
|
||||
'total',
|
||||
'balance',
|
||||
'customer_id',
|
||||
'customer_name',
|
||||
'applied_invoices',
|
||||
'is_digitally_signed',
|
||||
'is_edited_after_sign',
|
||||
'is_emailed',
|
||||
'is_signature_enabled_in_template',
|
||||
'has_attachment',
|
||||
'salesperson_name',
|
||||
'salesperson_id',
|
||||
'is_viewed_by_client',
|
||||
'client_viewed_time',
|
||||
'color_code',
|
||||
'current_sub_status_id',
|
||||
'current_sub_status',
|
||||
'item_quantity',
|
||||
'item_price',
|
||||
'item_total_price',
|
||||
'item_total',
|
||||
'item_total_without_tax',
|
||||
'currency_id',
|
||||
'currency_code'
|
||||
];
|
||||
|
||||
protected $useTimestamps = false; // Enable if you have created_at/updated_at fields
|
||||
|
||||
/**
|
||||
* Fetch all credit notes
|
||||
*/
|
||||
public function getAllCreditNotes($fromDate,$toDate)
|
||||
{
|
||||
return $this->where('date >=', $fromDate )
|
||||
->where('date <=', $toDate )
|
||||
->orderBy('date', 'DESC')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a single credit note by ID
|
||||
*/
|
||||
public function getCreditNoteById($id)
|
||||
{
|
||||
return $this->where('creditnote_id', $id)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new credit note
|
||||
*/
|
||||
public function createCreditNote($data)
|
||||
{
|
||||
return $this->insert($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing credit note
|
||||
*/
|
||||
public function updateCreditNote($id, $data)
|
||||
{
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a credit note by ID
|
||||
*/
|
||||
public function deleteCreditNote($id)
|
||||
{
|
||||
return $this->delete($id);
|
||||
}
|
||||
}
|
||||
355
app/Views/credit_notes.php
Normal file
355
app/Views/credit_notes.php
Normal file
@ -0,0 +1,355 @@
|
||||
<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 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_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>
|
||||
@ -654,6 +654,7 @@
|
||||
</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>Invoice</a>
|
||||
<a href="<?php echo base_url(); ?>credit_notes" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Credit Notes </a>
|
||||
<a href="<?php echo base_url(); ?>sales_report" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Invoice Report</a>
|
||||
|
||||
<?php if(session()->get('roleText') == 'System Administrator'){?>
|
||||
|
||||
@ -226,9 +226,9 @@
|
||||
<!-- Rec qty changed to invoice qty -->
|
||||
<th>Invoice Qty</th>
|
||||
<th>Net weight</th>
|
||||
<th>Taxable Amt</th>
|
||||
<!-- <th>Taxable Amt</th>
|
||||
<th>Tax Amt</th>
|
||||
<th>Total Amt</th>
|
||||
<th>Total Amt</th> -->
|
||||
<th>Vechicle No</th>
|
||||
<th>Driver</th>
|
||||
<th>Transporter</th>
|
||||
@ -281,9 +281,9 @@
|
||||
<td align="right"><?php echo (int)$record->ReceivedQuantity ?></td>
|
||||
|
||||
<td align="right"><?php echo (int)$record->NetWeight ?></td>
|
||||
<td align="right"><?php echo (int)$record->taxable_value ?></td>
|
||||
<!-- <td align="right"><?php echo (int)$record->taxable_value ?></td>
|
||||
<td align="right"><?php echo (int)$record->gst_amount ?></td>
|
||||
<td align="right"><?php echo ((int)$record->taxable_value + (int)$record->gst_amount) ?></td>
|
||||
<td align="right"><?php echo ((int)$record->taxable_value + (int)$record->gst_amount) ?></td> -->
|
||||
|
||||
<td><?php echo $record->VehicleNo ?></td>
|
||||
<td><?php echo $record->DriverName ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user