CHANGES by client : GWM

This commit is contained in:
Gowtham M 2025-01-04 18:05:29 +05:30
parent 2a46955917
commit 5f5ebb22ec
15 changed files with 948 additions and 125 deletions

View File

@ -152,6 +152,8 @@ $routes->get('purchaseorder/Savencrlist', 'Purchaseorder::Savencrlist');
$routes->get('purchaseorder/Nonconfirmativelist', 'Purchaseorder::Nonconfirmativelist');
$routes->post('purchaseorder/addloadfile', 'Purchaseorder::addloadfile');
$routes->post('purchaseorder/uploadfile', 'Purchaseorder::uploadfile');
$routes->post('getMaterialUsedPO', 'Purchaseorder::getMaterialUsedPO');
$routes->post('getSupplierUsedPO', 'Purchaseorder::getSupplierUsedPO');
//Zohobooks sync
$routes->match(['GET', 'POST'], 'user/zohobooks_api_fetch_all', 'User::zohobooks_api_fetch_all');
@ -288,8 +290,9 @@ $routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
$routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile');
$routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile');
$routes->get('download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1');
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
$routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks');
$routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks');
// Non IGR / Expense

View File

@ -7,6 +7,7 @@ use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Inwardgateregister_model;
use App\Models\IGRRemarks_model;
use ZipArchive;
@ -21,6 +22,7 @@ use ZipArchive;
class Inwardgateregister extends BaseController
{
protected $inwardgateregister_model;
protected $IGRRemarks_model;
protected $session;
/**
@ -30,6 +32,7 @@ class Inwardgateregister extends BaseController
{
parent::__construct();
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->IGRRemarks_model = new IGRRemarks_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
@ -1791,6 +1794,37 @@ function updateIGRWeight(){
return redirect()->to('/ViewIGR');
}
}
public function getIGRRemarks()
{
$igrNo = $this->request->getPost('igr_no');
$data = $this->IGRRemarks_model->select('t_igr_remarkes.remark ,t_igr_remarkes.remark_on , t_employee_details.FirstName as remark_by')
->join('t_employee_details', 't_igr_remarkes.remark_by = t_employee_details.EmpID', 'left')
->where('t_igr_remarkes.igr_no', $igrNo)
->findAll();
echo json_encode($data);
}
public function saveIGRRemarks()
{
$data['igr_no'] = $this->request->getPost('igr_no');
$data['remark'] = $this->request->getPost('remark');
$data['remark_by'] = session()->get('EmpID');
$data['remark_on'] = date('Y-m-d H:i:s');
$insert = $this->IGRRemarks_model->save($data);
$data = $this->IGRRemarks_model->select('t_igr_remarkes.remark ,t_igr_remarkes.remark_on , t_employee_details.FirstName as remark_by')
->join('t_employee_details', 't_igr_remarkes.remark_by = t_employee_details.EmpID', 'left')
->where('t_igr_remarkes.igr_no', $data['igr_no'])
->findAll();
echo json_encode($data);
}

View File

@ -10,6 +10,7 @@ use App\Models\Costcenter_model;
use App\Models\Inwardgateregister_model;
use App\Models\Purchaseorder_model;
use App\Models\Requistion_model;
use App\Models\PurchaseOrderLineItemModel;
use Mpdf\Mpdf;
use DateTime;
@ -29,6 +30,7 @@ class Purchaseorder extends BaseController
protected $inwardgateregister_model;
protected $requistion_model;
protected $costcenter_model;
protected $PurchaseOrderLineItemModel;
protected $session;
@ -42,6 +44,7 @@ class Purchaseorder extends BaseController
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->requistion_model = new Requistion_model();
$this->costcenter_model = new Costcenter_model();
$this->PurchaseOrderLineItemModel = new PurchaseOrderLineItemModel();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
@ -345,8 +348,19 @@ class Purchaseorder extends BaseController
$data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetailsForPDF($PONO);
$CurrencyType = $data['POItem'][0]->CurrencyType;
} else if ($ReqType == CAPITAL) {
$data['POItem'] = $this->purchaseorder_model->GetCapitalPurchaseOrderDetailsForPDF($PONO);
$CurrencyType = $data['POItem'][0]->CurrencyType;
$CapitalRange = $this->purchaseorder_model->where('PONO',$PONO)->get()->getRow()->CapitalRange;
if($CapitalRange == 1){
$data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetailsForpdf($PONO);
$data['serviceTaxList'] = $this->purchaseorder_model->GetServiceTaxDetails($PONO);
$CurrencyType = $data['POItem'][0]->CurrencyType;
}else{
$data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetailsForPDF($PONO);
$CurrencyType = $data['POItem'][0]->CurrencyType;
}
// $data['POItem'] = $this->purchaseorder_model->GetCapitalPurchaseOrderDetailsForPDF($PONO);
}
@ -415,7 +429,7 @@ class Purchaseorder extends BaseController
// $html = view('pdf_view', $data);
// $mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
$html = view('po_pdf', $data);
// echo $html;die;
// echo $html;die;
$mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
// Set HTML footer
@ -2515,14 +2529,14 @@ class Purchaseorder extends BaseController
/* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/
function poapproval()
{
$q = "APPROVAL";
$this->global['pageTitle'] = 'Purchase Order Approval';
// $data['Status']= $this->purchaseorder_model->getStatus();
$userID = $this->session->get('userId');
//print_r($data['Status']);echo "CON";
$data['AppList'] = $this->purchaseorder_model->getPOList($q);
// $q = "APPROVAL";
// $this->global['pageTitle'] = 'Purchase Order Approval';
// // $data['Status']= $this->purchaseorder_model->getStatus();
// $userID = $this->session->get('userId');
// //print_r($data['Status']);echo "CON";
// $data['AppList'] = $this->purchaseorder_model->getPOList($q);
$this->loadViews("poapproval_view", $this->global, $data, NULL);
// $this->loadViews("poapproval_view", $this->global, $data, NULL);
}
@ -3316,9 +3330,9 @@ class Purchaseorder extends BaseController
/* capital po print/pdf*/
public function CapitalPoPrint($PONO)
public function CapitalPoPrint()
{
$PONO = $this->request->getVar('PONO');
$PoStatus = '';
$data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO);
// Load the pdf page with multiviews
@ -3406,53 +3420,32 @@ class Purchaseorder extends BaseController
$mpdf = new Mpdf([
$mpdf = new \Mpdf\Mpdf([
'mode' => 'utf-8',
'format' => 'A4-P', // Page format: A4 with portrait orientation
// 'format' => [148, 210], // Set custom width and height in millimeters
'default_font_size' => 6,
'format' => 'A4',
'default_font' => 'sans-serif',
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 10,
'margin_bottom' => 10,
'margin_header' => 82,
'margin_footer' => 38,
'orientation' => 'P',
'margin_header' => 0,
'margin_top' => -30,
'margin_right' => 14,
'margin_left' => 5,
'margin_footer' => -30,
'orientation' => 'P'
]);
// Set PDF properties
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data['CompanyDetails'][0]->CompanyName);
$mpdf->SetCreator('Venba');
// Set watermark
if ($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus == '' || $PoStatus == SPECIAL_PO) {
$mpdf->SetWatermarkText('');
} else {
$mpdf->SetWatermarkText('DRAFT');
}
$mpdf->SetWatermarkImage('.public/assets/images/mpdf.png', 8, 10);
$mpdf->showWatermarkImage = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->showWatermarkText = true;
// Set HTML header
$HtmlHeading = view('includes/pdfheader', $data);
$mpdf->SetHTMLHeader($HtmlHeading);
// Set HTML footer
$HTMLFooter = view('includes/pdffooter', $data);
$mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
// Set auto margins
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->use_kwt = true;
// Generate PDF content
$html = view('capitalpopdf', $data);
$html = view('po_pdf', $data);
// echo $html;die;
$mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
// Write HTML content to PDF
$mpdf->WriteHTML($html);
$mpdf->SetDisplayMode('fullpage');
// Output PDF
$mpdf->Output('CapitalPOReport' . $PONO . '.pdf', 'I');
$mpdf->Output('POReport' . $PONO . '.pdf', 'D');
}
@ -4507,5 +4500,40 @@ class Purchaseorder extends BaseController
// return $this->response->setJSON($result);
}
public function getMaterialUsedPO()
{
$materialCode = $this->request->getPost('materialCode');
$data = $this->PurchaseOrderLineItemModel->select('t_purchaseorder_lineitem.PONO,t_purchaseorder_master.TotalOrderValue,t_purchaseorder_master.CreatedDate,t_purchaseorder_master.POType,t_purchaseorder_master.CapitalRange')
->where('t_purchaseorder_lineitem.MaterialCode',$materialCode)
->join('t_purchaseorder_master', 't_purchaseorder_lineitem.PONO = t_purchaseorder_master.PONO', 'left')
->groupBy('t_purchaseorder_lineitem.MaterialCode,t_purchaseorder_lineitem.PONO')
->orderBy('t_purchaseorder_master.CreatedDate' , 'desc')
->findAll();
echo json_encode($data);
}
public function getSupplierUsedPO()
{
$supplier_id = $this->request->getPost('supplier_id');
$data = $this->purchaseorder_model->select('PONO,TotalOrderValue,CreatedDate,POType,CapitalRange')
->where('SupplierID',$supplier_id)
->orderBy('CreatedDate' , 'desc')
->findAll();
echo json_encode($data);
}
/*--------------------------------------------------------------------------------------*/
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class IGRRemarks_model extends Model
{
protected $table = 't_igr_remarkes';
protected $primaryKey = 'id';
protected $allowedFields = [
'igr_no',
'remark',
'remark_by',
];
protected $useTimestamps = false;
protected $createdField = 'remark_on';
protected $updatedField = null; // Disable updated_at column explicitly
}

View File

@ -372,11 +372,12 @@ class Inwardgateregister_model extends Model
{
$builder = $this->db->table('t_igr_master igr')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount , count(remark.id) as remark_count')
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo')
->join('t_igr_remarkes remark', 'igr.IGRNo = remark.igr_no', 'left')
->where('igr.IGRStatus !=', MRIR_CREATED)
->where('Date(igr.CreatedDate) >=',"$fromDate")
->where('Date(igr.CreatedDate) <=', "$toDate")
@ -411,7 +412,7 @@ class Inwardgateregister_model extends Model
$builder = $this->db->table('t_igr_master igr')
->distinct()
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder')
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POL.Rate,POM.POType,POM.IsOpenOrder')
->join('t_igr_details igrd', 'igrd.IGRNO = igr.IGRNO')
->join('t_purchaseorder_master POM', 'igr.PONO = POM.PONO')
->join('t_purchaseorder_lineitem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ')

View File

@ -0,0 +1,100 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PurchaseOrderLineItemModel extends Model
{
protected $table = 't_purchaseorder_lineitem'; // Table name
protected $primaryKey = 'LineItemNo'; // Primary key
// Fields allowed for insert/update
protected $allowedFields = [
'LineItemNo',
'PONO',
'ReqNo',
'ItemNo',
'MaterialCode',
'Quantity',
'Rate',
'ReceivedQuantity',
'AmendmentQuantity',
'AmendmentRemarks',
'ServiceMaterialDescription',
'AmendedDetails',
'Status',
'OGR_Status',
'CreatedDate',
'CreatedBy',
'UpdateBY',
'UpdatedOn',
'CostCenterCode',
'ServiceFrequency',
'Per'
];
// Use automatic timestamps
protected $useTimestamps = true;
protected $createdField = 'CreatedDate';
protected $updatedField = 'UpdatedOn';
// Validation rules
protected $validationRules = [
'LineItemNo' => 'required|alpha_numeric|max_length[20]',
'PONO' => 'permit_empty|alpha_numeric|max_length[27]',
'ReqNo' => 'required|alpha_numeric|max_length[20]',
'ItemNo' => 'permit_empty|integer',
'MaterialCode' => 'required|alpha_numeric|max_length[20]',
'Quantity' => 'required|decimal',
'Rate' => 'required|decimal',
'ReceivedQuantity' => 'required|decimal',
'AmendmentQuantity' => 'permit_empty|decimal',
'AmendmentRemarks' => 'permit_empty|string|max_length[20]',
'ServiceMaterialDescription' => 'permit_empty|string',
'AmendedDetails' => 'permit_empty|string',
'Status' => 'required|string|max_length[20]',
'OGR_Status' => 'permit_empty|string|max_length[50]',
'CreatedBy' => 'required|string|max_length[50]',
'UpdateBY' => 'required|string|max_length[50]',
'CostCenterCode' => 'permit_empty|alpha_numeric|max_length[5]',
'ServiceFrequency' => 'permit_empty|string|max_length[100]',
'Per' => 'permit_empty|string|max_length[50]',
];
// Validation messages
protected $validationMessages = [
'LineItemNo' => [
'required' => 'Line Item Number is required.',
'alpha_numeric' => 'Line Item Number must be alphanumeric.',
],
'MaterialCode' => [
'required' => 'Material Code is required.',
],
// Add custom messages for other fields as needed
];
// Skip validation
protected $skipValidation = false;
/**
* Custom function to fetch line items by PONO
* @param string $pono
* @return array
*/
public function getByPONO(string $pono)
{
return $this->where('PONO', $pono)->findAll();
}
/**
* Custom function to update the status of a line item
* @param string $lineItemNo
* @param string $status
* @return bool
*/
public function updateStatus(string $lineItemNo, string $status): bool
{
return $this->update($lineItemNo, ['Status' => $status]);
}
}

View File

@ -6,6 +6,71 @@ use CodeIgniter\Model;
class Purchaseorder_model extends Model
{
protected $table = 't_purchaseorder_master'; // Table name
protected $primaryKey = 'POID'; // Primary key
protected $useAutoIncrement = true;
// Allowed fields for insert/update operations
protected $allowedFields = [
'PONO',
'ParentPO',
'POType',
'SupplierID',
'TotalOrderValue',
'PODate',
'Status',
'PORange',
'DeliverySchedule',
'DeliveryOption',
'ServiceDescription',
'ExchangeRateCalculatedon',
'ExchangeRate',
'PaymentTerms',
'PaymentID',
'PaymentOtherDescription',
'ServiceWorkStatus',
'ServiceWorkStatusRemarks',
'CapitalRange',
'CurrencyType',
'CreatedDate',
'CreatedBy',
'UpdateBY',
'UpdatedOn',
'DeliveryAddress',
'DeliveryDate',
'ApprovedBy',
'ApprovedOn',
'ReleasedBy',
'ReleasedOn',
'OnHoldBy',
'OnHoldOn',
'Remarks',
'Import_DispatchDetails',
'Import_PlaceofOrgin',
'AmendedDetails',
'Supplier_Reference',
'Mode_Of_Shipment',
'Supplier_Offer_No',
'Other_Reference',
'Fincap',
'Description_Of_Service',
'InsuranceStatus',
'InsuranceNumber',
'POSubType',
'IsQualityChkReqired',
'BudgetType',
'Paymentstatus',
'IsOpenOrder',
'POFile',
];
// Automatically handle timestamps
protected $useTimestamps = true;
protected $createdField = 'CreatedDate';
protected $updatedField = 'UpdatedOn';
function GetServicePOListforStatusUpdate()
{
$builder = $this->db->table('t_purchaseorder_master PO')->distinct()

View File

@ -214,11 +214,13 @@
title="<?php echo $record->PONO; ?> - Click here to view Purchase Order details"></i>
&nbsp;&nbsp;&nbsp;</a> &nbsp;&nbsp;&nbsp;
<a data-toggle="tooltip" href="<?php echo base_url() . 'purchaseorder/CreatePOPrint?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType; ?>"
target="new"><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->PONO; ?>
- Click here to Print the Purchase Order details"></i>
- Click here to Print the Purchase Order details"></i>
&nbsp;&nbsp;&nbsp;
</a>
</td>
<?php
} ?>

View File

@ -10,9 +10,7 @@
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
th {
/* width: auto !important; */
}
table{
width:auto;
}
@ -185,14 +183,14 @@
<!-- <table class="table table-bordered table-hover" id="asset_list_table" style="background-color:#fff;font-size:12px;"> -->
<thead>
<tr>
<th style="text-align:center, width:10%">PO Date</th>
<th style="text-align:center, width:14%">PO No</th>
<th style="text-align:center, width:15%">Supplier Name</th>
<th style="text-align:center, width:17%">Material Name</th>
<th style="text-align:center, width:10%">Category</th>
<th style="text-align:center, width:9%">Ordered Quantity</th>
<th style="text-align:center, width:9%">Received Quantity</th>
<th style="text-align:center, width:10%">Pending Quantity</th>
<th style="text-align:center; width:10%">PO Date</th>
<th style="text-align:center; width:14%">PO No</th>
<th style="text-align:center; width:15%">Supplier Name</th>
<th style="text-align:center; width:17%">Material Name</th>
<th style="text-align:center; width:10%">Category</th>
<th style="text-align:center; width:9%">Ordered Quantity</th>
<th style="text-align:center; width:9%">Received Quantity</th>
<th style="text-align:center; width:10%">Pending Quantity</th>
</tr>
</thead>
<tbody>
@ -209,13 +207,9 @@
$cat = $rel->category;
?>
<tr>
<!-- <td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php //echo $rel->sid;
?>&ab=<?php //echo $ab;
?>&mid=<?php //echo $rel->mid;
?>"><?php //echo $rel->supplier_name;
?></a>
</span></td>-->
<td><span>
<?php echo $rel->pdate; ?>
</span></td>

View File

@ -183,8 +183,9 @@ $currentday = date('d');
{
position: sticky;
left: 0;
top: 0;
background-color: #00a65a;
z-index: 2;
z-index: 7!important;
border-right: 2px solid #ddd;
color: #ffffff;
}
@ -201,6 +202,17 @@ $currentday = date('d');
border-right: 2px solid #ddd;
color: #0e0b0b;
}
.table-responsive {
overflow-y: auto;
max-height: 450px;
}
.fht-table thead th {
position: sticky;
top: 0;
z-index: 5!important;
}
</style>
<div class="content-page">
<div class="content">
@ -235,15 +247,21 @@ $currentday = date('d');
echo form_open('attendance', $attributes); ?>
<div class="row">
<div class="col-3">
<div class="col-2">
<?php $today = date('M-Y'); ?>
<input type="text" name="month" id="month" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
</div>
<div class="col-3">
<div class="col-1">
<input type="submit" value="Change Month" class="btn btn-success"
title='click here for load attendance for specified month' style="margin-top:0px;">
</div>
<div class="col-1 text-right">
<i id="exportButton" class="fas fa-download download-icon" style="font-size: x-large; margin-top:12px;" title="Export Excel"></i>
</div>
<div class="col-8 text-right">
<input type="button" class="btn btn-success" id="c" value="save" style="margin-top:0px;">
</div>
</div>
<?php echo form_close(); ?>
@ -496,12 +514,11 @@ $currentday = date('d');
</div><!-- End table-responsive -->
<div class="row">
<!-- <div class="row">
<div class="col-md-12 text-right">
<input type="button" class="btn btn-success" id="c" value="save"
>
<input type="button" class="btn btn-success" id="c" value="save">
</div>
</div>
</div> -->
</div>
</div> <!-- End card-body -->
@ -585,6 +602,44 @@ $currentday = date('d');
<script type="text/javascript">
$(document).ready(function () {
function exportTableToExcel(tableId, filename = 'attendance.csv') {
var table = document.getElementById(tableId);
var rows = table.rows;
var csv = [];
// Loop through table rows and cells
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
// Loop through each cell in the row
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
}
csv.push(rowData.join('\t'));
}
// Create a Blob from the CSV data
var blob = new Blob([csv.join('\n')], { type: 'application/vnd.ms-excel' });
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
// Trigger download
link.click();
}
// Add click event listener to the export button
document.getElementById('exportButton').addEventListener('click', function () {
exportTableToExcel('attendance');
});
});
$(document).ready(function() {

View File

@ -15,8 +15,9 @@
{
position: sticky;
left: 0;
top: 0;
background-color: #00a65a;
z-index: 2;
z-index: 7!important;
border-right: 2px solid #ddd;
color: #ffffff;
}
@ -33,6 +34,17 @@
border-right: 2px solid #ddd;
color: #0e0b0b;
}
.table-responsive {
overflow-y: auto;
max-height: 450px;
}
.fht-table thead th {
position: sticky;
top: 0;
z-index: 5!important;
}
</style>
<?php
@ -199,9 +211,17 @@
<?php echo form_dropdown('monthyear', $ot, set_value('monthyear', $currentselection), 'id="monthyear"', 'class="form-control select2'); ?>
</form>
</div>
<div class="col-3 ">
<i id="exportButton" class="fas fa-download download-icon" style="font-size: x-large; margin-top:12px;" title="Export Excel"></i>
</div>
<div class="col-6 text-right" id="savebutton">
<input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;">
</div>
</div>
<div style="overflow-x:scroll;">
<div class="table-responsive" style="overflow-x:scroll;">
<table id="monthlylistings" class="table table-bordered table-hover fht-table"
style="background-color:#fff;font-size:12px;white-space: nowrap;">
<thead style="background-color: #ddd;">
@ -260,7 +280,7 @@
<td style="text-align:right;" style="background-color:blue;">
<?php echo $index; ?></td>
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
<td <?php if($record->is_management_team == 1){ ?> style="max-width:150px;background-color: #d8d8ea;" <?php }else{ ?> style="max-width:150px;" <?php } ?> >
<td <?php if($record->is_management_team == 1){ ?> style="background-color: #d8d8ea;" <?php } ?> >
<?php echo $record->FirstName; ?>
</td>
<td style="max-width: 100px;">
@ -515,10 +535,10 @@
</div>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-12 text-right" id="savebutton">
<!-- <div class="col-md-12 text-right" id="savebutton">
<input type="button" id="submit" value="Save" class="btn btn-success"
onclick="getAllData();">
</div>
</div> -->
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
@ -539,6 +559,43 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function () {
function exportTableToExcel(tableId, filename = 'monthlyPay.csv') {
var table = document.getElementById(tableId);
var rows = table.rows;
var csv = [];
// Loop through table rows and cells
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
// Loop through each cell in the row
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
}
csv.push(rowData.join('\t'));
}
// Create a Blob from the CSV data
var blob = new Blob([csv.join('\n')], { type: 'application/vnd.ms-excel' });
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
// Trigger download
link.click();
}
// Add click event listener to the export button
document.getElementById('exportButton').addEventListener('click', function () {
exportTableToExcel('monthlylistings');
});
});
$('#monthyear').attr('class', 'form-control');
var estTotal = [];

View File

@ -22,59 +22,66 @@
<table>
<tbody>
<tr >
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Name </td>
<td width="200px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->FName; ?></td>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Employee ID </td>
<td width="152px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->EmpID ?></td>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Name </td>
<td width="200px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->FName; ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Employee ID </td>
<td width="152px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->EmpID ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Designation </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;" > <?php echo ':&nbsp;'.$PayDetails[0]->Designation ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Department </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->DeptName ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Designation </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" > <?php echo ':&nbsp;'.$PayDetails[0]->Designation ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Department </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->DeptName ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Date Of Joining </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"> <?php echo ':&nbsp;'.date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">No Of Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"> <?php echo ':&nbsp;'.$PayDetails[0]->TotalCalDays ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Date Of Joining </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">No Of Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->TotalCalDays ?></td>
</tr>
<!-- <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Date Of Birth </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.date('d-m-Y', strtotime($PayDetails[0]->Dob)) ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Loss Of Pay Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"> <?php echo ':&nbsp;'. number_format((double)$PayDetails[0]->LOP,2,'.',''); ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Date Of Birth </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.date('d-m-Y', strtotime($PayDetails[0]->Dob)) ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Loss Of Pay Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'. number_format((double)$PayDetails[0]->LOP,2,'.',''); ?></td>
</tr> -->
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">PF Acc No </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;" ><?php echo ':&nbsp;'.$PayDetails[0]->PFNumber ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Worked Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.number_format($PayDetails[0]->NoofDaysWorked,2,'.',''); ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">PF Acc No </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;'.$PayDetails[0]->PFNumber ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Worked Days </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.number_format($PayDetails[0]->NoofDaysWorked,2,'.',''); ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Bank Name </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->BankName ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Loan Balance </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->BalanceAdvance ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Name </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->BankName ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Loan Balance </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->BalanceAdvance ?></td>
</tr>
<tr>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Bank Acc No </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"> <?php echo ':&nbsp;'.$PayDetails[0]->BankAccountNumber ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">OT In Hours </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->OT_Hrs_Worked ?></td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Acc No </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->BankAccountNumber ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">OT In Hours </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->OT_Hrs_Worked ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Bank IFSC </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->IFSCCode ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">ESI Acc No </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"> <?php echo ':&nbsp;'.$PayDetails[0]->ESINumber ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank IFSC </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->IFSCCode ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">ESI Acc No </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->ESINumber ?></td>
</tr>
<tr>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">PAN Number </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.$PayDetails[0]->Pan;?> </td>
<td width="50px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;">Aadhar Number </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ;"><?php echo ':&nbsp;'.str_replace(' ', '', $PayDetails[0]->AadharNo);?></td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">PAN Number </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->Pan;?> </td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td width="50px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Aadhar Number </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.str_replace(' ', '', $PayDetails[0]->AadharNo);?></td>
</tr>
</tbody>
</table>

View File

@ -132,7 +132,7 @@
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td><?php echo $cdate; ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><a class="material-code" data-code="<?php echo $record->MaterialCode; ?>"><?php echo $record->MaterialCode ?></a></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->MaterialType ?></td>
<td><?php echo $record->UOM ?></td>
@ -186,9 +186,145 @@
</div> <!-- content -->
</div>
<!-- Long Content Scroll Modal -->
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="scrollableModalTitle">Material Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Table will be dynamically inserted here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script>
$(document).ready(function () {
function formatDate(inputDate) {
const date = new Date(inputDate); // Convert string to Date object
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
function formatNumberToIndianCurrency(number) {
const parts = number.toString().split("."); // Split integer and decimal parts
let integerPart = parts[0];
const decimalPart = parts[1] ? "." + parts[1] : "";
// Format the integer part in Indian numbering format
const lastThreeDigits = integerPart.slice(-3);
const otherDigits = integerPart.slice(0, -3);
if (otherDigits !== "") {
integerPart = otherDigits.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + "," + lastThreeDigits;
}
return integerPart + decimalPart;
}
$(".material-code").click(function () {
// Retrieve the material code from the data attribute
const materialCode = $(this).data("code");
$('#loader').show();
$('#scrollableModalTitle').text(`List of PO created using ${materialCode} Material code `);
// AJAX API call
$.ajax({
url: "<?php echo base_url() ?>getMaterialUsedPO",
method: 'POST',
data: { materialCode: materialCode },
success: function (response) {
let result = JSON.parse(response);
if (result.length > 0) {
let tableHtml = `
<table class="table table-bordered">
<thead style="background-color: #539754; color: white; font-size: 13px;">
<tr>
<th style="text-align: center;" >PONO</th>
<th style="text-align: center;" >Total Value</th>
<th style="text-align: center;" >PO Type</th>
<th style="text-align: center;" > Date</th>
</tr>
</thead>
<tbody>
`;
result.forEach(item => {
CreatedDate = formatDate(item.CreatedDate);
TotalOrderValue = formatNumberToIndianCurrency(item.TotalOrderValue);
tableHtml += `
<tr>
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #4d3a6d;">
${item.PONO}
</td>
<td style="text-align: right;">${TotalOrderValue}</td>
<td style="text-align: right;">${item.POType}</td>
<td>${CreatedDate}</td>
</tr>
`;
});
tableHtml += `
</tbody>
</table>
`;
// Insert the table into the modal body
$('#scrollable-modal .modal-body').html(tableHtml);
// Show the modal
$('#scrollable-modal').modal('show');
// Attach click event to PONO cells after the table is rendered
$('.pono-cell').click(function () {
const pono = $(this).data('pono');
const ReqType = $(this).data('potype');
const CapitalRange = $(this).data('capitalrange');
const url = '<?php echo base_url(); ?>EditPO?PONO=' + pono +'&ReqType='+ReqType+'&CapitalRange='+CapitalRange;
window.open(url, '_blank');
// window.location.href = url;
});
} else {
$('#scrollable-modal .modal-body').html('<p>No data found.</p>');
$('#scrollable-modal').modal('show');
}
$('#loader').hide();
},
error: function (xhr, status, error) {
// Handle any errors
console.error("API Error:", error);
alert("Failed to load material data.");
}
});
});
});
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;

View File

@ -137,7 +137,7 @@
} ?>
<td style="width:75px" align="left"><?php echo $cdate; ?></td>
<td><?php echo $record->SupplierID ?></td>
<td><a class="supplier-id" data-code="<?php echo $record->SupplierID; ?>"><?php echo $record->SupplierID ?></a></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->Address ?></td>
<td><?php echo $record->ContactNumber ?></td>
@ -187,9 +187,143 @@
</div> <!-- content -->
</div>
<!-- Long Content Scroll Modal -->
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="scrollableModalTitle">Material Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Table will be dynamically inserted here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function () {
function formatDate(inputDate) {
const date = new Date(inputDate); // Convert string to Date object
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
function formatNumberToIndianCurrency(number) {
const parts = number.toString().split("."); // Split integer and decimal parts
let integerPart = parts[0];
const decimalPart = parts[1] ? "." + parts[1] : "";
// Format the integer part in Indian numbering format
const lastThreeDigits = integerPart.slice(-3);
const otherDigits = integerPart.slice(0, -3);
if (otherDigits !== "") {
integerPart = otherDigits.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + "," + lastThreeDigits;
}
return integerPart + decimalPart;
}
$(".supplier-id").click(function () {
// Retrieve the material code from the data attribute
const supplier_id = $(this).data("code");
$('#loader').show();
$('#scrollableModalTitle').text(`List of PO created using ${supplier_id} Supplier id`);
// AJAX API call
$.ajax({
url: "<?php echo base_url() ?>getSupplierUsedPO",
method: 'POST',
data: { supplier_id: supplier_id },
success: function (response) {
let result = JSON.parse(response);
if (result.length > 0) {
let tableHtml = `
<table class="table table-bordered">
<thead style="background-color: #539754; color: white; font-size: 13px;">
<tr>
<th style="text-align: center;" >PONO</th>
<th style="text-align: center;" >Total Value</th>
<th style="text-align: center;" >PO Type</th>
<th style="text-align: center;" > Date</th>
</tr>
</thead>
<tbody>
`;
result.forEach(item => {
CreatedDate = formatDate(item.CreatedDate);
TotalOrderValue = formatNumberToIndianCurrency(item.TotalOrderValue);
tableHtml += `
<tr>
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #4d3a6d;">
${item.PONO}
</td>
<td style="text-align: right;">${TotalOrderValue}</td>
<td style="text-align: right;">${item.POType}</td>
<td>${CreatedDate}</td>
</tr>
`;
});
tableHtml += `
</tbody>
</table>
`;
// Insert the table into the modal body
$('#scrollable-modal .modal-body').html(tableHtml);
// Show the modal
$('#scrollable-modal').modal('show');
// Attach click event to PONO cells after the table is rendered
$('.pono-cell').click(function () {
const pono = $(this).data('pono');
const ReqType = $(this).data('potype');
const CapitalRange = $(this).data('capitalrange');
const url = '<?php echo base_url(); ?>EditPO?PONO=' + pono +'&ReqType='+ReqType+'&CapitalRange='+CapitalRange;
window.open(url, '_blank');
// window.location.href = url;
});
} else {
$('#scrollable-modal .modal-body').html('<p>No data found.</p>');
$('#scrollable-modal').modal('show');
}
$('#loader').hide();
},
error: function (xhr, status, error) {
// Handle any errors
console.error("API Error:", error);
alert("Failed to load material data.");
}
});
});
});
function deletesupplier(sid) {
var answer = confirm(" Do you want to delete the Supplier from the List?")

View File

@ -62,6 +62,28 @@
float: left;
}
.footer-textarea {
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
.send-btn {
padding: 10px 20px;
background-color: #2ecc71; /* Green color */
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.send-btn:hover {
background-color: #27ae60; /* Darker green on hover */
}
</style>
<script>
@ -121,6 +143,23 @@
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
.igr-remarks{
position: relative;
}
.igr-remarks i{
font-size: 14px;
}
.igr-remarks span{
position: absolute;
top: -5px;
right: -6px;
background-color: transparent;
border-radius: 50px!important;
font-weight: 600;
width: 14px;
box-shadow: 0 0 20px 0 rgba(0,0,0,0.2);
color:#35462c;
}
</style>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script>
@ -250,6 +289,8 @@
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
<td>
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fa fa-history" style="text-align: center;"></i>
</a>
@ -261,8 +302,17 @@
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
<i class="fa fa-download" style="text-align: center;"></i>
</a>
&nbsp;
<?php } ?>
&nbsp;
<?php } ?>
<a title="IGR Remarks" class="igr-remarks" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fe-bell noti-icon"></i>
<span class="badge badge-danger rounded-circle noti-icon-badge"><?php echo $record->remark_count ?></span>
</a>
</td>
</tr>
<?php
@ -282,6 +332,31 @@
</div> <!-- content -->
</div>
<!-- box closed here -->
<!-- Right modal content -->
<div id="right-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm modal-right">
<div class="modal-content">
<div class="modal-header border-0">
<h5 class="modal-title" style="font-size: large;"></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" style="border-top: 1px solid #2ecc71;border-bottom: 1px solid #2ecc71;">
</div>
<div class="modal-footer">
<input type="hidden" id="selected_igr">
<textarea class="footer-textarea" id="igr_remark" placeholder="Enter your message here..."></textarea>
<button class="send-btn" id="save_remark">
Send Message..
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Igr modal fade -->
<div id="Igrshow" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
@ -483,6 +558,8 @@
</div>
</div>
<!-- /.modal Igr modal fade closed-->
<!-- WeightCalculator modal fade -->
<div id="WeightCalculator" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -560,6 +637,8 @@
</div>
</div>
</div><!-- /.modal -->
<!-- WeightCalculator modal fade closed-->
<div id="Historyshow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -584,6 +663,8 @@
</div>
</div>
</div><!-- /.modal -->
<!-- History modal fade closed-->
<div id="CostCentershow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -614,6 +695,109 @@
<script>
$(document).ready(function() {
$(document).on('click', '#save_remark', function(e) {
$('#loader').show();
e.preventDefault();
// Get the data attributes
let igrNo = $('#selected_igr').val();
let remark = $('#igr_remark').val();
// Prepare the data to send
let requestData = {
igr_no: igrNo,
remark: remark
};
// AJAX call
$.ajax({
url: "<?php echo base_url() ?>saveIGRRemarks",
type: 'POST',
data: requestData,
success: function(response) {
$('#loader').hide();
appendRemark(response);
},
error: function(xhr, status, error) {
$('#loader').hide();
alert('Failed to fetch remarks. Please try again.');
}
});
});
$(document).on('click', '.igr-remarks', function(e) {
$('#loader').show();
e.preventDefault();
// Get the data attributes
let igrNo = $(this).data('igrno');
let poNo = $(this).data('pono');
// Set the modal heading dynamically
$('#right-modal .modal-header .modal-title').text(`${igrNo} - Remarks`);
$('#selected_igr').val(igrNo);
// Prepare the data to send
let requestData = {
igr_no: igrNo,
po_no: poNo
};
// AJAX call
$.ajax({
url: "<?php echo base_url() ?>getIGRRemarks",
type: 'POST',
data: requestData,
success: function(response) {
$('#loader').hide();
appendRemark(response);
},
error: function(xhr, status, error) {
$('#loader').hide();
alert('Failed to fetch remarks. Please try again.');
}
});
});
function appendRemark(response)
{
$('#igr_remark').val('');
let remarks = JSON.parse(response);
let remarksHtml = remarks.map(remark => {
// Convert remark_on to the desired format
let remarkDate = new Date(remark.remark_on).toLocaleString('en-US', {
month: 'short', // Short month name (e.g., Dec)
day: '2-digit', // Two-digit day (e.g., 31)
year: 'numeric', // Full year (e.g., 2024)
hour: '2-digit', // Two-digit hour (e.g., 11)
minute: '2-digit', // Two-digit minute (e.g., 42)
hour12: true // 12-hour format with AM/PM
});
return `
<div class="remark-item mb-3" style="padding-bottom: 10px; border-bottom: 1px solid #ddd;">
<p style="margin-bottom: 5px;font-size: 16px;">${remark.remark}</p>
<div style="display: flex; justify-content: space-between; align-items: center; font-size: 14px;">
<span style="color: #555;font-size: 10px;">${remark.remark_by}</span>
<span style="color: #888;font-size: 10px;">${remarkDate}</span>
</div>
</div>
`;
}).join('');
// Inject remarks into the modal body
$('#right-modal .modal-body').html(`
<div class="remarks-container" style="max-height: 350px; overflow-y: auto;">
${remarksHtml}
</div>
`);
$('#right-modal').modal('show');
}
$("#Igrshow").on("shown.bs.modal", function(e) {
$('#loader').show();