changes in supplier module 05-03-2025

This commit is contained in:
vadivelJ96 2025-03-05 18:55:58 +05:30
parent c3c7cd95a0
commit d7a1e8561c
6 changed files with 37 additions and 35 deletions

View File

@ -526,7 +526,7 @@ class StockController extends BaseController
$startDate = "$month-01"; $startDate = "$month-01";
$endDate = date("Y-m-t", strtotime($startDate)); $endDate = date("Y-m-t", strtotime($startDate));
$data['coatingMachineDetails'] = $this->coatingMachineDetails_model $data['coatingMachineDetails'] = $this->coatingMachineDetails_model
->select('t_coatingMachineDetails.*, ->select('t_coatingmachinedetails.*,
JSON_ARRAYAGG( JSON_ARRAYAGG(
JSON_OBJECT( JSON_OBJECT(
"client_given_name", t_batchcard_files.client_file_name, "client_given_name", t_batchcard_files.client_file_name,
@ -535,11 +535,11 @@ class StockController extends BaseController
"coating_id", t_batchcard_files.coating_id "coating_id", t_batchcard_files.coating_id
) )
) as batchcard_files') ) as batchcard_files')
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingMachineDetails.id', 'left') ->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingmachinedetails.id', 'left')
->where('t_coatingMachineDetails.date >=', $startDate) ->where('t_coatingmachinedetails.date >=', $startDate)
->where('t_coatingMachineDetails.date <=', $endDate) ->where('t_coatingmachinedetails.date <=', $endDate)
->groupBy('t_coatingMachineDetails.id') ->groupBy('t_coatingmachinedetails.id')
->orderBy('t_coatingMachineDetails.date', 'asc') ->orderBy('t_coatingmachinedetails.date', 'asc')
->findAll(); ->findAll();
@ -606,6 +606,7 @@ class StockController extends BaseController
if (!empty($batchCardFiles) && !($batchCardFiles[0]->getError() === UPLOAD_ERR_NO_FILE)) { if (!empty($batchCardFiles) && !($batchCardFiles[0]->getError() === UPLOAD_ERR_NO_FILE)) {
foreach ($batchCardFiles as $file) { foreach ($batchCardFiles as $file) {
if ($file->isValid() && !$file->hasMoved()) { if ($file->isValid() && !$file->hasMoved()) {
@ -623,12 +624,14 @@ class StockController extends BaseController
'coating_id' => $insertedId 'coating_id' => $insertedId
]; ];
$builder->insert($data); $result = $builder->insert($data);
} }
} }
} }
} }
} }
@ -636,6 +639,7 @@ class StockController extends BaseController
if ($this->db->transStatus() === false) { if ($this->db->transStatus() === false) {
throw new \Exception('Transaction failed due to database errors.'); throw new \Exception('Transaction failed due to database errors.');
} }
$this->db->transCommit(); $this->db->transCommit();
@ -905,7 +909,7 @@ class StockController extends BaseController
$data['gasStockDetails'] = $this->gasStockDetails_model $data['gasStockDetails'] = $this->gasStockDetails_model
->select( ->select(
't_gasStockDetails.*, 't_gasstockdetails.*,
drier_summary.drierMachineGasconsumption AS drierMachineGasConsumption, drier_summary.drierMachineGasconsumption AS drierMachineGasConsumption,
drier_summary.driedSand AS sandDried, drier_summary.driedSand AS sandDried,
coating_summary.coatingMachineGasconsumption, coating_summary.coatingMachineGasconsumption,
@ -916,31 +920,31 @@ class StockController extends BaseController
'(SELECT date, '(SELECT date,
SUM(totalGasconsumption) AS coatingMachineGasconsumption, SUM(totalGasconsumption) AS coatingMachineGasconsumption,
SUM(totalCoatingSandInKg) / 1000 AS coatedSand SUM(totalCoatingSandInKg) / 1000 AS coatedSand
FROM t_coatingMachineDetails FROM t_coatingmachinedetails
WHERE is_active = 1 WHERE is_active = 1
AND date >= ' . $this->db->escape($startDate) . ' AND date >= ' . $this->db->escape($startDate) . '
AND date <= ' . $this->db->escape($endDate) . ' AND date <= ' . $this->db->escape($endDate) . '
GROUP BY date GROUP BY date
) AS coating_summary', ) AS coating_summary',
'coating_summary.date = t_gasStockDetails.date', 'coating_summary.date = t_gasstockdetails.date',
'left' 'left'
) )
->join( ->join(
'(SELECT date, '(SELECT date,
SUM(total_gas_consumption) AS drierMachineGasconsumption, SUM(total_gas_consumption) AS drierMachineGasconsumption,
SUM(sand_dried_qty) AS driedSand SUM(sand_dried_qty) AS driedSand
FROM t_drierMachineDetails FROM t_driermachinedetails
WHERE date >= ' . $this->db->escape($startDate) . ' WHERE date >= ' . $this->db->escape($startDate) . '
AND date <= ' . $this->db->escape($endDate) . ' AND date <= ' . $this->db->escape($endDate) . '
GROUP BY date GROUP BY date
) AS drier_summary', ) AS drier_summary',
'drier_summary.date = t_gasStockDetails.date', 'drier_summary.date = t_gasstockdetails.date',
'left' 'left'
) )
->where('t_gasStockDetails.date >=', $startDate) ->where('t_gasstockdetails.date >=', $startDate)
->where('t_gasStockDetails.date <=', $endDate) ->where('t_gasstockdetails.date <=', $endDate)
->groupBy('t_gasStockDetails.date') ->groupBy('t_gasstockdetails.date')
->findAll(); ->findAll();

View File

@ -6,7 +6,7 @@ use CodeIgniter\Model;
class CoatingMachineDetailsModel extends Model class CoatingMachineDetailsModel extends Model
{ {
protected $table = 't_coatingMachineDetails'; protected $table = 't_coatingmachinedetails';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $useAutoIncrement = true; protected $useAutoIncrement = true;
protected $returnType = 'array'; protected $returnType = 'array';

View File

@ -92,7 +92,7 @@ class FactoryMachineModel extends Model
$result = $this->db->table('t_factorymachinemaster') $result = $this->db->table('t_factorymachinemaster')
->where('is_active', 1) ->where('is_active', 1)
->where('energy_type', 'diesel') ->where('energy_type', 'diesel')
->orderBy('id', 'asc') ->orderBy('id', 'desc')
->get() ->get()
->getResultArray(); ->getResultArray();

View File

@ -6,7 +6,7 @@ use CodeIgniter\Model;
class GasStockModel extends Model class GasStockModel extends Model
{ {
protected $table = 't_gasStockDetails'; protected $table = 't_gasstockdetails';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $useAutoIncrement = true; protected $useAutoIncrement = true;
protected $returnType = 'array'; protected $returnType = 'array';

View File

@ -728,15 +728,13 @@
<div class="form-row" id="batchCardRowId"> <div class="form-row" id="batchCardRowId">
<!-- batch card file upload --> <!-- batch card file upload -->
<div class="form-group col-md-3"> <div class="form-group col-md-4">
<label for="">Upload Batch Card</label> <label for="">Upload Batch Card</label>
<div> <br>
<input type="file" class="batchfile" name="batchCard[]">
</div>
<button type="button" class="btn btn-success btn-sm mt-2" id="batchCardAddBtnId">Add More</button> <button type="button" class="btn btn-success btn-sm mt-2" id="batchCardAddBtnId">Add File</button>
</div> </div>
@ -950,15 +948,12 @@
<div class="form-row" id="editBatchCardRowId"> <div class="form-row" id="editBatchCardRowId">
<!-- batch card file upload --> <!-- batch card file upload -->
<div class="form-group col-md-3"> <div class="form-group col-md-4">
<label for="editBatchCardId">Upload Batch Card</label> <label for="editBatchCardId">Upload Batch Card</label>
<br>
<div> <button type="button" class="btn btn-success btn-sm mt-2" id="editBatchCardAddBtnId">Add File</button>
<input type="file" class="editBatchFile " name="batchCard[]">
</div>
<button type="button" class="btn btn-success btn-sm mt-2" id="editBatchCardAddBtnId">Add More</button>
</div> </div>
@ -1284,7 +1279,7 @@
} }
let string = `<div class="form-group col-md-3 batch-container"> let string = `<div class="form-group col-md-4 batch-container">
<label for="">Change Batch Card</label> <label for="">Change Batch Card</label>
<input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" > <input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" >
<p>( Previously Uploaded File ${element.client_given_name} )</p> <p>( Previously Uploaded File ${element.client_given_name} )</p>
@ -1680,7 +1675,7 @@
return; return;
} }
let string = `<div class="form-group col-md-3 batch-container"> let string = `<div class="form-group col-md-4 batch-container">
<label for="">Upload Batch Card</label> <label for="">Upload Batch Card</label>
<input type="file" class="batchfile" name="batchCard[]" > <input type="file" class="batchfile" name="batchCard[]" >
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button> <button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>
@ -1705,7 +1700,7 @@
return; return;
} }
let string = `<div class="form-group col-md-3 batch-container"> let string = `<div class="form-group col-md-4 batch-container">
<label for="">Upload Batch Card</label> <label for="">Upload Batch Card</label>
<input type="file" class="editBatchFile" name="batchCard[]" > <input type="file" class="editBatchFile" name="batchCard[]" >
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button> <button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>

View File

@ -269,9 +269,10 @@
<div class="col-3"> <div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker" class="form-control datepicker mt-2 " data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1" readonly> data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
</div> </div>
<div class="form-group col-md-2"> <div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button> <button type="submit" class="btn btn-success"> Change Month </button>
</div> </div>
@ -292,6 +293,8 @@
<div class="table-responsive"> <div class="table-responsive">
<table style="width: 700px;" id="dustAndRoughStockDetailsTableId" class="fht-table table-striped"> <table style="width: 700px;" id="dustAndRoughStockDetailsTableId" class="fht-table table-striped">