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

View File

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

View File

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

View File

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

View File

@ -728,15 +728,13 @@
<div class="form-row" id="batchCardRowId">
<!-- 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>
<br>
<div>
<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>
@ -950,15 +948,12 @@
<div class="form-row" id="editBatchCardRowId">
<!-- 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>
<br>
<div>
<input type="file" class="editBatchFile " name="batchCard[]">
</div>
<button type="button" class="btn btn-success btn-sm mt-2" id="editBatchCardAddBtnId">Add More</button>
<button type="button" class="btn btn-success btn-sm mt-2" id="editBatchCardAddBtnId">Add File</button>
</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>
<input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" >
<p>( Previously Uploaded File ${element.client_given_name} )</p>
@ -1680,7 +1675,7 @@
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>
<input type="file" class="batchfile" name="batchCard[]" >
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>
@ -1705,7 +1700,7 @@
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>
<input type="file" class="editBatchFile" name="batchCard[]" >
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>

View File

@ -269,9 +269,10 @@
<div class="col-3">
<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>
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
</div>
@ -290,6 +291,8 @@
</div>
</form>
<div class="table-responsive">