Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
2fbd31f4de
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// $routes->match(['GET', 'POST'], 'trpProductionDetails', 'StockController::trpProductionDetails');
|
// $routes->match(['GET', 'POST'], 'trpProductionDetails', 'StockController::trpProductionDetails');
|
||||||
|
|
||||||
# GET http://localhost/ci4/ria/trpProductionDetails
|
GET http://localhost/ci4/ria/trpProductionDetails
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -496,7 +496,7 @@ class StockController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$updated = $this->incomingSilicaSandDetails_model
|
$updated = $this->incomingSilicaSandDetails_model
|
||||||
->insert($dbData);
|
->insert($dbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
@ -1383,7 +1383,7 @@ class StockController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// $month = new DateTime('2024-10-01');
|
// $month = new DateTime('2024-10-01');
|
||||||
// $month = $month->format('Y-m');
|
// $month = $month->format('Y-m');
|
||||||
|
|
||||||
$month = date('Y-m');
|
$month = date('Y-m');
|
||||||
|
|
||||||
@ -1409,7 +1409,9 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$inserts = $this->generateDummyData($startDate, $endDate);
|
$inserts = $this->generateDummyData($startDate, $endDate);
|
||||||
|
|
||||||
$data['trpProductionMaintenanceData'] = $this->updateTrpProductionDetails($inserts);
|
$freshEntry = true ;
|
||||||
|
|
||||||
|
$data['trpProductionMaintenanceData'] = $this->updateTrpProductionDetails($inserts ,$freshEntry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1443,147 +1445,155 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function updateTrpProductionDetails($inserts) {
|
public function updateTrpProductionDetails($inserts, $freshEntry = false)
|
||||||
|
{
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
if(empty($postData['updateTrpProductionDetails'])){
|
if (empty($postData['updateTrpProductionDetails'])) {
|
||||||
if(empty($inserts)){
|
if (empty($inserts)) {
|
||||||
return $this->response->setJSON(['error' => 'No data found to update']);
|
return $this->response->setJSON(['error' => 'No data found to update']);
|
||||||
}else{
|
} else {
|
||||||
$postData['updateTrpProductionDetails'] = $inserts;
|
$postData['updateTrpProductionDetails'] = $inserts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$updateTrpProductionDetails = $postData['updateTrpProductionDetails'];
|
||||||
$updateTrpProductionDetails = $postData['updateTrpProductionDetails'];
|
|
||||||
|
// Extract all dates from input data
|
||||||
$updateProduction = [];
|
$dates = array_column($updateTrpProductionDetails, 'Date');
|
||||||
$updateMaintanence = [];
|
$formattedDates = array_map(fn($date) => $this->convertToDateWithFlexibleFormats($date, ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"), $dates);
|
||||||
$updateWaste = [];
|
|
||||||
|
// Fetch all existing records in a single query per table
|
||||||
$insertProduction = [];
|
$existingMaintenance = $this->TrpProductionMaintenance_model->whereIn('date', $formattedDates)->findAll();
|
||||||
$insertMaintanence = [];
|
$existingProduction = $this->TrpProduction_model->whereIn('date', $formattedDates)->findAll();
|
||||||
$insertWaste = [];
|
$existingWaste = $this->TrpProductionWaste_model->whereIn('date', $formattedDates)->findAll();
|
||||||
|
|
||||||
foreach ($updateTrpProductionDetails as $data) {
|
// Map existing records by date for quick lookup
|
||||||
|
$existingMaintenanceMap = array_column($existingMaintenance, null, 'date');
|
||||||
$data['date'] = $this->convertToDateWithFlexibleFormats($data['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d");
|
$existingProductionMap = array_column($existingProduction, null, 'date');
|
||||||
|
$existingWasteMap = array_column($existingWaste, null, 'date');
|
||||||
$date = $data['date'];
|
|
||||||
|
$insertMaintenance = [];
|
||||||
$dbDataTrpMaintenance = [
|
$updateMaintenance = [];
|
||||||
'date' => $data['date'],
|
$insertProduction = [];
|
||||||
'openingTime' => $data['openingTime'],
|
$updateProduction = [];
|
||||||
'closingTime' => $data['closingTime'],
|
$insertWaste = [];
|
||||||
'totalHours' => $data['totalHours'],
|
$updateWaste = [];
|
||||||
'coldStart' => $data['coldStart'],
|
|
||||||
'breakdownHours' => $data['breakdownHours'],
|
foreach ($updateTrpProductionDetails as $data) {
|
||||||
'burnerFiringHours' => $data['burnerFiringHours'],
|
$date = $this->convertToDateWithFlexibleFormats($data['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d");
|
||||||
'sandFeedingHours' => $data['sandFeedingHours'],
|
|
||||||
'workingPersonEngineers' => $data['workingPersonEngineers'],
|
// Data arrays
|
||||||
'workingPersonSupervisiors' => $data['workingPersonSupervisiors'],
|
$dbDataTrpMaintenance = [
|
||||||
'workingPersonOperators' => $data['workingPersonOperators'],
|
'date' => $date,
|
||||||
'rollerDrivers' => $data['rollerDrivers'],
|
'openingTime' => $data['openingTime'],
|
||||||
'natureOfMaintenance' => $data['natureOfMaintenance'],
|
'closingTime' => $data['closingTime'],
|
||||||
'location' => $data['location'],
|
'totalHours' => $data['totalHours'],
|
||||||
'description' => $data['description']
|
'coldStart' => $data['coldStart'],
|
||||||
];
|
'breakdownHours' => $data['breakdownHours'],
|
||||||
|
'burnerFiringHours' => $data['burnerFiringHours'],
|
||||||
$dbDataTrpProduction = [
|
'sandFeedingHours' => $data['sandFeedingHours'],
|
||||||
'date' => $data['date'],
|
'workingPersonEngineers' => $data['workingPersonEngineers'],
|
||||||
'gasReceiptBg' => $data['gasReceiptBg'],
|
'workingPersonSupervisiors' => $data['workingPersonSupervisiors'],
|
||||||
'gasReceiptPg' => $data['gasReceiptPg'],
|
'workingPersonOperators' => $data['workingPersonOperators'],
|
||||||
'physicalGasConsumption'=> $data['physicalGasConsumption'],
|
'rollerDrivers' => $data['rollerDrivers'],
|
||||||
'trpPlusDrierGasConsumption'=> $data['trpPlusDrierGasConsumption'],
|
'natureOfMaintenance' => $data['natureOfMaintenance'],
|
||||||
'trpPhysicalGasPerTon' => $data['trpPhysicalGasPerTon'],
|
'location' => $data['location'],
|
||||||
'panelGasConsumption' => $data['panelGasConsumption'],
|
'description' => $data['description']
|
||||||
'panelGasPerTon' => $data['panelGasPerTon'],
|
];
|
||||||
'edRunningHours' => $data['edRunningHours'],
|
|
||||||
'edProduction' => $data['edProduction'],
|
$dbDataTrpProduction = [
|
||||||
'edUsage' => $data['edUsage'],
|
'date' => $date,
|
||||||
'trpProduction' => $data['trpProduction'],
|
'gasReceiptBg' => $data['gasReceiptBg'],
|
||||||
'trpProductionPerHour' => $data['trpProductionPerHour'],
|
'gasReceiptPg' => $data['gasReceiptPg'],
|
||||||
'waterReceipt' => $data['waterReceipt'],
|
'physicalGasConsumption' => $data['physicalGasConsumption'],
|
||||||
'waterConsumption' => $data['waterConsumption'],
|
'trpPlusDrierGasConsumption' => $data['trpPlusDrierGasConsumption'],
|
||||||
'ebReading' => $data['ebReading'],
|
'trpPhysicalGasPerTon' => $data['trpPhysicalGasPerTon'],
|
||||||
'ebReadingPerUnitTon' => $data['ebReadingPerUnitTon'],
|
'panelGasConsumption' => $data['panelGasConsumption'],
|
||||||
];
|
'panelGasPerTon' => $data['panelGasPerTon'],
|
||||||
|
'edRunningHours' => $data['edRunningHours'],
|
||||||
$dbDataTrpWaste = [
|
'edProduction' => $data['edProduction'],
|
||||||
'date' => $data['date'],
|
'edUsage' => $data['edUsage'],
|
||||||
'msSeperation' => $data['msSeperation'],
|
'trpProduction' => $data['trpProduction'],
|
||||||
'edWaste' => $data['edWaste'],
|
'trpProductionPerHour' => $data['trpProductionPerHour'],
|
||||||
'coolerBags' => $data['coolerBags'],
|
'waterReceipt' => $data['waterReceipt'],
|
||||||
'edPlus20Waste' => $data['edPlus20Waste'],
|
'waterConsumption' => $data['waterConsumption'],
|
||||||
'cycloneWaste' => $data['cycloneWaste'],
|
'ebReading' => $data['ebReading'],
|
||||||
];
|
'ebReadingPerUnitTon' => $data['ebReadingPerUnitTon'],
|
||||||
|
];
|
||||||
$trpMaintenanceResultExists = $this->TrpProductionMaintenance_model
|
|
||||||
->where('date', $date)
|
$dbDataTrpWaste = [
|
||||||
->first();
|
'date' => $date,
|
||||||
|
'msSeperation' => $data['msSeperation'],
|
||||||
$trpProductionResultExists = $this->TrpProduction_model
|
'edWaste' => $data['edWaste'],
|
||||||
->where('date', $date)
|
'coolerBags' => $data['coolerBags'],
|
||||||
->first();
|
'edPlus20Waste' => $data['edPlus20Waste'],
|
||||||
|
'cycloneWaste' => $data['cycloneWaste'],
|
||||||
$trpWasteResultExists = $this->TrpProductionWaste_model
|
];
|
||||||
->where('date', $date)
|
|
||||||
->first();
|
// Check if data already exists
|
||||||
|
if (isset($existingMaintenanceMap[$date])) {
|
||||||
if (empty($trpMaintenanceResultExists)) {
|
$dbDataTrpMaintenance['id'] = $existingMaintenanceMap[$date]['id'];
|
||||||
$insertMaintanence[] = $dbDataTrpMaintenance;
|
$updateMaintenance[] = $dbDataTrpMaintenance;
|
||||||
$insertProduction[] = $dbDataTrpProduction;
|
} else {
|
||||||
$insertWaste[] = $dbDataTrpWaste;
|
$insertMaintenance[] = $dbDataTrpMaintenance;
|
||||||
} else {
|
}
|
||||||
$dbDataTrpMaintenance['id'] = $trpMaintenanceResultExists['id'];
|
|
||||||
$dbDataTrpProduction['id'] = $trpProductionResultExists['id'];
|
if (isset($existingProductionMap[$date])) {
|
||||||
$dbDataTrpWaste['id'] = $trpWasteResultExists['id'];
|
$dbDataTrpProduction['id'] = $existingProductionMap[$date]['id'];
|
||||||
|
$updateProduction[] = $dbDataTrpProduction;
|
||||||
$updateMaintanence[] = $dbDataTrpMaintenance;
|
} else {
|
||||||
$updateProduction[] = $dbDataTrpProduction;
|
$insertProduction[] = $dbDataTrpProduction;
|
||||||
$updateWaste[] = $dbDataTrpWaste;
|
}
|
||||||
}
|
|
||||||
}
|
if (isset($existingWasteMap[$date])) {
|
||||||
|
$dbDataTrpWaste['id'] = $existingWasteMap[$date]['id'];
|
||||||
// Start the transaction
|
$updateWaste[] = $dbDataTrpWaste;
|
||||||
$this->db->transBegin();
|
} else {
|
||||||
|
$insertWaste[] = $dbDataTrpWaste;
|
||||||
try {
|
}
|
||||||
if (!empty($insertMaintanence)) {
|
}
|
||||||
$this->TrpProductionMaintenance_model->insertBatch($insertMaintanence);
|
|
||||||
}
|
// Start transaction
|
||||||
|
$this->db->transBegin();
|
||||||
if (!empty($insertProduction)) {
|
|
||||||
$this->TrpProduction_model->insertBatch($insertProduction);
|
try {
|
||||||
}
|
// Insert new records in batch
|
||||||
|
if (!empty($insertMaintenance)) {
|
||||||
if (!empty($insertWaste)) {
|
$this->TrpProductionMaintenance_model->insertBatch($insertMaintenance);
|
||||||
$this->TrpProductionWaste_model->insertBatch($insertWaste);
|
}
|
||||||
}
|
if (!empty($insertProduction)) {
|
||||||
|
$this->TrpProduction_model->insertBatch($insertProduction);
|
||||||
if (!empty($updateMaintanence)) {
|
}
|
||||||
$this->TrpProductionMaintenance_model->updateBatch($updateMaintanence, 'id');
|
if (!empty($insertWaste)) {
|
||||||
}
|
$this->TrpProductionWaste_model->insertBatch($insertWaste);
|
||||||
|
}
|
||||||
if (!empty($updateProduction)) {
|
|
||||||
$this->TrpProduction_model->updateBatch($updateProduction, 'id');
|
// Update existing records in batch
|
||||||
}
|
if (!empty($updateMaintenance)) {
|
||||||
|
$this->TrpProductionMaintenance_model->updateBatch($updateMaintenance, 'id');
|
||||||
if (!empty($updateWaste)) {
|
}
|
||||||
$this->TrpProductionWaste_model->updateBatch($updateWaste, 'id');
|
if (!empty($updateProduction)) {
|
||||||
}
|
$this->TrpProduction_model->updateBatch($updateProduction, 'id');
|
||||||
|
}
|
||||||
// Commit the transaction if all operations are successful
|
if (!empty($updateWaste)) {
|
||||||
$this->db->transCommit();
|
$this->TrpProductionWaste_model->updateBatch($updateWaste, 'id');
|
||||||
echo "Data Saved Successfully";
|
}
|
||||||
|
|
||||||
} catch (\Exception $error) {
|
// Commit transaction if successful
|
||||||
// Rollback the transaction in case of any errors
|
$this->db->transCommit();
|
||||||
$this->db->transRollback();
|
|
||||||
echo "An error occurred: " . $error->getMessage();
|
if (!$freshEntry) {
|
||||||
}
|
echo "Data Saved Successfully";
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $error) {
|
||||||
|
// Rollback transaction on error
|
||||||
|
$this->db->transRollback();
|
||||||
|
echo "An error occurred: " . $error->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1592,10 +1602,10 @@ class StockController extends BaseController
|
|||||||
$datesInMonth = [];
|
$datesInMonth = [];
|
||||||
$inserts = [];
|
$inserts = [];
|
||||||
|
|
||||||
$period = new DatePeriod(
|
$period = new DatePeriod(
|
||||||
new DateTime($startDate),
|
new DateTime($startDate),
|
||||||
new DateInterval('P1D'),
|
new DateInterval('P1D'),
|
||||||
(new DateTime($endDate))->modify('+1 day')
|
(new DateTime($endDate))->modify('+1 day')
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($period as $day) {
|
foreach ($period as $day) {
|
||||||
@ -1606,41 +1616,41 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$inserts[] = [
|
$inserts[] = [
|
||||||
'Date' => $dateInMonth,
|
'Date' => $dateInMonth,
|
||||||
'openingTime' => '00:00',
|
'openingTime' => " ",
|
||||||
'closingTime' => '00:00',
|
'closingTime' => " ",
|
||||||
'totalHours' => '00:00',
|
'totalHours' => " ",
|
||||||
'coldStart' => '00:00',
|
'coldStart' => " ",
|
||||||
'breakdownHours' => '00:00',
|
'breakdownHours' => " ",
|
||||||
'burnerFiringHours' => '00:00',
|
'burnerFiringHours' => " ",
|
||||||
'sandFeedingHours' => '00:00',
|
'sandFeedingHours' => " ",
|
||||||
'workingPersonEngineers' => 0,
|
'workingPersonEngineers' => " ",
|
||||||
'workingPersonSupervisiors' => 0,
|
'workingPersonSupervisiors' => " ",
|
||||||
'workingPersonOperators' => 0,
|
'workingPersonOperators' => " ",
|
||||||
'rollerDrivers' => 0,
|
'rollerDrivers' => " ",
|
||||||
'natureOfMaintenance' => '',
|
'natureOfMaintenance' => '',
|
||||||
'location' => '',
|
'location' => '',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'gasReceiptBg' => 0,
|
'gasReceiptBg' => " ",
|
||||||
'gasReceiptPg' => 0,
|
'gasReceiptPg' => " ",
|
||||||
'physicalGasConsumption' => 0,
|
'physicalGasConsumption' => " ",
|
||||||
'trpPlusDrierGasConsumption' => 0,
|
'trpPlusDrierGasConsumption' => " ",
|
||||||
'trpPhysicalGasPerTon' => 0,
|
'trpPhysicalGasPerTon' => " ",
|
||||||
'panelGasConsumption' => 0,
|
'panelGasConsumption' => " ",
|
||||||
'panelGasPerTon' => 0,
|
'panelGasPerTon' => " ",
|
||||||
'edRunningHours' => 0,
|
'edRunningHours' => " ",
|
||||||
'edProduction' => 0,
|
'edProduction' => " ",
|
||||||
'edUsage' => 0,
|
'edUsage' => " ",
|
||||||
'trpProduction' => 0,
|
'trpProduction' => " ",
|
||||||
'trpProductionPerHour' => 0,
|
'trpProductionPerHour' => " ",
|
||||||
'waterReceipt' => 0,
|
'waterReceipt' => " ",
|
||||||
'waterConsumption' => 0,
|
'waterConsumption' => " ",
|
||||||
'ebReading' => 0,
|
'ebReading' =>" ",
|
||||||
'ebReadingPerUnitTon' => 0,
|
'ebReadingPerUnitTon' =>" ",
|
||||||
'msSeperation' => 0,
|
'msSeperation' => " ",
|
||||||
'edWaste' => 0,
|
'edWaste' => " ",
|
||||||
'coolerBags' => 0,
|
'coolerBags' =>" ",
|
||||||
'edPlus20Waste' => 0,
|
'edPlus20Waste' => " ",
|
||||||
'cycloneWaste' => 0
|
'cycloneWaste' => " "
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -372,18 +372,42 @@ class Inwardgateregister_model extends Model
|
|||||||
|
|
||||||
function ViewigrListing($fromDate,$toDate)
|
function ViewigrListing($fromDate,$toDate)
|
||||||
{
|
{
|
||||||
$subQuery = $this->db->table('t_igr_remarkes')
|
$subQuery1 = $this->db->table('t_igr_remarkes')
|
||||||
->select('COUNT(id)')
|
->select('COUNT(id)')
|
||||||
->where('igr_no = igr.IGRNo')
|
->where('igr_no = igr.IGRNo')
|
||||||
->getCompiledSelect();
|
->getCompiledSelect();
|
||||||
|
|
||||||
|
// Build subQuery2 dynamically for rate and tax based on POType
|
||||||
|
$subQuery2 = "(CASE
|
||||||
|
WHEN PO.POType = 'revenue' THEN (
|
||||||
|
SELECT JSON_OBJECT('total_rate', SUM(POL.Rate), 'total_tax', AVG(tax.CGST + tax.SGST + tax.IGST))
|
||||||
|
FROM t_igr_details IGRD
|
||||||
|
LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode
|
||||||
|
LEFT JOIN t_revenue_tax tax ON tax.LineItemNo = POL.LineItemNo
|
||||||
|
WHERE IGRD.IGRNO = igr.IGRNO
|
||||||
|
)
|
||||||
|
WHEN PO.POType = 'service' THEN (
|
||||||
|
SELECT JSON_OBJECT('total_rate', SUM(POL.Rate), 'total_tax', AVG(tax.CGST + tax.SGST + tax.IGST))
|
||||||
|
FROM t_igr_details IGRD
|
||||||
|
LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode
|
||||||
|
LEFT JOIN t_service_tax tax ON tax.LineItemNo = POL.LineItemNo
|
||||||
|
WHERE IGRD.IGRNO = igr.IGRNO
|
||||||
|
)
|
||||||
|
|
||||||
|
ELSE NULL
|
||||||
|
END)";
|
||||||
|
|
||||||
|
|
||||||
|
// Main query
|
||||||
$builder = $this->db->table('t_igr_master igr')
|
$builder = $this->db->table('t_igr_master igr')
|
||||||
->select("igr.*, PO.IsOpenOrder, PO.DeliveryDate, sup.SupplierName, PO.POType,
|
->select("igr.*, PO.IsOpenOrder, PO.DeliveryDate, sup.SupplierName, PO.POType,
|
||||||
trans.name as TransporterName,
|
trans.name as TransporterName,
|
||||||
SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity,
|
SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity,
|
||||||
SUM(IGRD.NetWeight) as NetWeight,
|
SUM(IGRD.NetWeight) as NetWeight,
|
||||||
COUNT(IGRD.IGRNo) as itemCount,
|
COUNT(IGRD.IGRNo) as itemCount,
|
||||||
COALESCE(($subQuery), 0) as remark_count") // COALESCE to handle no matches
|
COALESCE(($subQuery1), 0) as remark_count,
|
||||||
|
JSON_EXTRACT(($subQuery2), '$.total_rate') as total_rate,
|
||||||
|
JSON_EXTRACT(($subQuery2), '$.total_tax') as total_tax")
|
||||||
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
|
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
|
||||||
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
|
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
|
||||||
->join('t_transporter trans', 'igr.TransporterId = trans.id', 'left')
|
->join('t_transporter trans', 'igr.TransporterId = trans.id', 'left')
|
||||||
@ -391,13 +415,15 @@ class Inwardgateregister_model extends Model
|
|||||||
->where('igr.IGRStatus !=', MRIR_CREATED)
|
->where('igr.IGRStatus !=', MRIR_CREATED)
|
||||||
->where('Date(igr.CreatedDate) >=', "$fromDate")
|
->where('Date(igr.CreatedDate) >=', "$fromDate")
|
||||||
->where('Date(igr.CreatedDate) <=', "$toDate")
|
->where('Date(igr.CreatedDate) <=', "$toDate")
|
||||||
// ->where('igr.IGRNo', "IGRNO-1627")
|
|
||||||
->groupBy('IGRD.IGRNo')
|
->groupBy('IGRD.IGRNo')
|
||||||
->orderBy('igr.CreatedDate', 'desc');
|
->orderBy('igr.CreatedDate', 'desc');
|
||||||
|
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
$result = $query->getResult();
|
$result = $query->getResult();
|
||||||
|
|
||||||
|
|
||||||
|
// echo $this->db->getLastQuery()->getQuery();die;
|
||||||
|
// dd($result);
|
||||||
|
|
||||||
|
|
||||||
// old - issue in t_igr_remarkes join
|
// old - issue in t_igr_remarkes join
|
||||||
|
|||||||
@ -68,6 +68,8 @@ class TrpProductionModel extends Model
|
|||||||
|
|
||||||
// Convert the array of material codes to a comma-separated string
|
// Convert the array of material codes to a comma-separated string
|
||||||
$materialCodesString = "'" . implode("','", $materialCodes) . "'";
|
$materialCodesString = "'" . implode("','", $materialCodes) . "'";
|
||||||
|
|
||||||
|
// dd($materialCodes);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@ -190,9 +192,9 @@ class TrpProductionModel extends Model
|
|||||||
|
|
||||||
tigrd.CreatedDate ,
|
tigrd.CreatedDate ,
|
||||||
|
|
||||||
SUM(CASE WHEN ts.SupplierName = 'ASHOK LEYLAND LIMITED FOUNDRY DIVN - SPU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
SUM(CASE WHEN ts.SupplierName = 'Ashok leyland limited foundry divn-SPU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||||
`ALs_wcs`,
|
`ALs_wcs`,
|
||||||
SUM(CASE WHEN ts.SupplierName = 'ASHOK LEYLAND LIMITED FOUNDRY DIVN - ENU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
SUM(CASE WHEN ts.SupplierName = 'Ashok leyland limited foundry divn-ENU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||||
`ALe_wcs`,
|
`ALe_wcs`,
|
||||||
SUM(CASE WHEN ts.SupplierName = 'MADRAS ENGINEERING INDUSTRIES PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
SUM(CASE WHEN ts.SupplierName = 'MADRAS ENGINEERING INDUSTRIES PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||||
`ME_wcs`,
|
`ME_wcs`,
|
||||||
@ -202,7 +204,7 @@ class TrpProductionModel extends Model
|
|||||||
`caparo_wcs`,
|
`caparo_wcs`,
|
||||||
SUM(CASE WHEN ts.SupplierName = 'NEMAK ALUMINIUM CASTING INDIA PVT LTD' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
SUM(CASE WHEN ts.SupplierName = 'NEMAK ALUMINIUM CASTING INDIA PVT LTD' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||||
`Nemak_wcs`,
|
`Nemak_wcs`,
|
||||||
SUM(CASE WHEN ts.SupplierName = 'DR AXION INDIA PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
SUM(CASE WHEN ts.SupplierName = 'DR Axion India Private Limited' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||||
`DR_wcs`
|
`DR_wcs`
|
||||||
|
|
||||||
from t_igr_details tigrd
|
from t_igr_details tigrd
|
||||||
|
|||||||
@ -444,9 +444,9 @@ foreach ($period as $day) {
|
|||||||
$summary['balanceStock'] = 0 ;
|
$summary['balanceStock'] = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$summary['totalPurchaseDiesel'] += $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] ;
|
$summary['totalPurchaseDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] ) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] : 0 ;
|
||||||
$summary['totalFillingDiesel'] += $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] ;
|
$summary['totalFillingDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] : 0 ;
|
||||||
$summary['balanceStock'] = $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] == '-' ? 0 : $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] ;
|
$summary['balanceStock'] = is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] : 0 ;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -570,7 +570,7 @@
|
|||||||
<!-- td:eq(11) -->
|
<!-- td:eq(11) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['drierGasConsumption'] ?>
|
<?= $trpProductionDetail['drierGasConsumption'] == 0 ? " " : $trpProductionDetail['drierGasConsumption'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- coatingGasConsumption -->
|
<!-- coatingGasConsumption -->
|
||||||
@ -612,18 +612,19 @@
|
|||||||
<?= $trpProductionDetail['panelGasPerTon'] ?>
|
<?= $trpProductionDetail['panelGasPerTon'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<!-- AL(S) -->
|
<!-- AL(S) -->
|
||||||
<!-- td:eq(17) -->
|
<!-- td:eq(17) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['ALs_wcs'] ?>
|
<?= $trpProductionDetail['ALs_wcs'] == 0 ? " " : $trpProductionDetail['ALs_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- AL(E) -->
|
<!-- AL(E) -->
|
||||||
<!-- td:eq(18) -->
|
<!-- td:eq(18) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['ALe_wcs'] ?>
|
<?= $trpProductionDetail['ALe_wcs'] == 0 ? " " : $trpProductionDetail['ALe_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- ME -->
|
<!-- ME -->
|
||||||
@ -631,21 +632,21 @@
|
|||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['ME_wcs'] ?>
|
<?= $trpProductionDetail['ME_wcs'] == 0 ? " " : $trpProductionDetail['ME_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- SI -->
|
<!-- SI -->
|
||||||
<!-- td:eq(20) -->
|
<!-- td:eq(20) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['SI_wcs'] ?>
|
<?= $trpProductionDetail['SI_wcs'] == 0 ? " " : $trpProductionDetail['SI_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Caparo -->
|
<!-- Caparo -->
|
||||||
<!-- td:eq(21) -->
|
<!-- td:eq(21) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<? $trpProductionDetail['caparo_wcs'] ?>
|
<?= $trpProductionDetail['caparo_wcs'] == 0 ? " " : $trpProductionDetail['caparo_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
@ -653,14 +654,14 @@
|
|||||||
<!-- td:eq(22) -->
|
<!-- td:eq(22) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['Nemak_wcs'] ?>
|
<?= $trpProductionDetail['Nemak_wcs'] == 0 ? " " : $trpProductionDetail['Nemak_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- DR -->
|
<!-- DR -->
|
||||||
<!-- td:eq(23) -->
|
<!-- td:eq(23) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['DR_wcs'] ?>
|
<?= $trpProductionDetail['DR_wcs'] == 0 ? " " : $trpProductionDetail['DR_wcs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- edRunningHours -->
|
<!-- edRunningHours -->
|
||||||
@ -668,7 +669,7 @@
|
|||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['edRunningHours'] ?>
|
<?= $trpProductionDetail['edRunningHours'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
@ -709,42 +710,42 @@
|
|||||||
<!-- td:eq(29) -->
|
<!-- td:eq(29) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['coating'] ?>
|
<?= $trpProductionDetail['coating'] == 0 ? " " : $trpProductionDetail['coating'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Hindhuja -->
|
<!-- Hindhuja -->
|
||||||
<!-- td:eq(30) -->
|
<!-- td:eq(30) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['ALs_crs'] ?>
|
<?= $trpProductionDetail['ALs_crs'] == 0 ? " " : $trpProductionDetail['ALs_crs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Nemak -->
|
<!-- Nemak -->
|
||||||
<!-- td:eq(31) -->
|
<!-- td:eq(31) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id="">
|
data-id="">
|
||||||
<?= $trpProductionDetail['Nemak_crs'] ?>
|
<?= $trpProductionDetail['Nemak_crs'] == 0 ? " " : $trpProductionDetail['Nemak_crs'] ?>
|
||||||
</td>
|
</td>
|
||||||
<!-- ME -->
|
<!-- ME -->
|
||||||
<!-- td:eq(32) -->
|
<!-- td:eq(32) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['ME_crs'] ?>
|
<?= $trpProductionDetail['ME_crs'] == 0 ? " " : $trpProductionDetail['ME_crs'] ?>
|
||||||
</td>
|
</td>
|
||||||
<!-- BI -->
|
<!-- BI -->
|
||||||
<!-- td:eq(33) -->
|
<!-- td:eq(33) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['BI_crs'] ?>
|
<?= $trpProductionDetail['BI_crs'] == 0 ? " " : $trpProductionDetail['BI_crs'] ?>
|
||||||
</td>
|
</td>
|
||||||
<!-- Karmen -->
|
<!-- Karmen -->
|
||||||
<!-- td:eq(34) -->
|
<!-- td:eq(34) -->
|
||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['Karmen_crs'] ?>
|
<?= $trpProductionDetail['Karmen_crs'] == 0 ? " " : $trpProductionDetail['Karmen_crs'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- waterReceipt -->
|
<!-- waterReceipt -->
|
||||||
@ -752,7 +753,7 @@
|
|||||||
<td class="celda_normal trpProductionStock"
|
<td class="celda_normal trpProductionStock"
|
||||||
data-id=""
|
data-id=""
|
||||||
contenteditable="true">
|
contenteditable="true">
|
||||||
<?= $trpProductionDetail['waterReceipt'] ?>
|
<?= $trpProductionDetail['waterReceipt'] ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- waterConsumption -->
|
<!-- waterConsumption -->
|
||||||
@ -1051,7 +1052,7 @@
|
|||||||
|
|
||||||
//table to json function
|
//table to json function
|
||||||
|
|
||||||
var updateResinStockDetails = tableToJson();
|
var updateTrpProductionDetails = tableToJson();
|
||||||
|
|
||||||
|
|
||||||
alert('Updation may take a while, And we appreciate your patience..!!');
|
alert('Updation may take a while, And we appreciate your patience..!!');
|
||||||
@ -1062,7 +1063,7 @@
|
|||||||
updateResinStockDetails
|
updateResinStockDetails
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>updateResinStockDetails",
|
url: "<?php echo base_url() ?>updateTrpProductionDetails",
|
||||||
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user