add barchart and add jobcard id in transactionleg table

add-reporting-dashboard
Usama Khan 2025-04-09 12:09:01 -07:00
parent 93f6b01ece
commit 6da953ad69
12 changed files with 516 additions and 100 deletions

View File

@ -46,7 +46,15 @@ public class ReportingController {
@GetMapping( "/job-card-report")
public String jobCardReport(@RequestParam( value = "job-card-id", required = false ) String jobCardId,
Model model ){
model.addAttribute("totalProduction", reportingService.getTotalProduction(jobCardId));
model.addAttribute("phasesTimes", reportingService.getEachPhaseTotalTime(jobCardId));
model.addAttribute("segregateItems", reportingService.getSegregateItems(jobCardId));
model.addAttribute("pendingStatus", reportingService.countPendingItemsOnDifferentPhases(jobCardId));
model.addAttribute("completeProduction", reportingService.getCompleteProduction(jobCardId));
model.addAttribute("jobCardProgress", reportingService.getJobCardProgress(jobCardId));
model.addAttribute("cuttingDetails", reportingService.getCuttingDetails(jobCardId));
model.addAttribute("stitchingDetails", reportingService.getStitchingDetails(jobCardId));
return "/reporting/job-card-report";
}

View File

@ -26,10 +26,11 @@ public class BundleDAO {
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME );
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE master_bundle_id = :master_bundle_id ORDER BY id DESC", TABLE_NAME );
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
private final String SELECT_BY_ITEM_ID_AND_JOB_CARD = String.format( "SELECT * FROM %s WHERE item_id = :item_id AND job_card_id = :job_card_id", TABLE_NAME );
private final String SELECT_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
private final String SELECT_BY_ITEM_IDS_AND_JOB_CARD = String.format( "SELECT * FROM %s WHERE item_id IN (:item_ids) AND job_card_id = :job_card_id", TABLE_NAME );
private final String SELECT_LIKE_BARCODE = String.format("SELECT * FROM %s WHERE barcode LIKE :barcode", TABLE_NAME);
private final String SELECT_FIRST_BUNDLE_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at ASC LIMIT 1", TABLE_NAME);
private final String SELECT_LAST_BUNDLE_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1", TABLE_NAME);
public BundleDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
@ -132,11 +133,10 @@ public class BundleDAO {
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new BundleRowMapper() );
}
public List<Bundle> findByItemIdAndCardId( long itemId, long cardId ){
public List<Bundle> findByCardId( long cardId ){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("item_id", itemId );
params.addValue("job_card_id", cardId );
return namedParameterJdbcTemplate.query( SELECT_BY_ITEM_ID_AND_JOB_CARD, params, new BundleRowMapper() );
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD, params, new BundleRowMapper() );
}
public List<Bundle> findByItemIdsAndCardId( List<Long> itemIds, long cardId ){
@ -146,4 +146,19 @@ public class BundleDAO {
params.addValue("job_card_id", cardId );
return namedParameterJdbcTemplate.query( SELECT_BY_ITEM_IDS_AND_JOB_CARD, params, new BundleRowMapper() );
}
public Bundle findFirstBundleByCardId(long cardId) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("job_card_id", cardId);
return namedParameterJdbcTemplate.queryForObject(SELECT_FIRST_BUNDLE_BY_JOB_CARD, params, new BundleRowMapper());
}
public Bundle findLastBundleByCardId(long cardId) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("job_card_id", cardId);
return namedParameterJdbcTemplate.query(SELECT_LAST_BUNDLE_BY_JOB_CARD, params, new BundleRowMapper())
.stream()
.findFirst().orElse(new Bundle());
}
}

View File

@ -32,6 +32,7 @@ public class FinishedItemDAO {
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated ORDER BY ID DESC", TABLE_NAME );
private final String SELECT_BY_STITCHED_ITEM_ID = String.format( "SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id", TABLE_NAME );
private final String SELECT_BY_STITCHED_ITEM_IDS = String.format( "SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME );
private final String COUNT_TOTAL_FINISH_ITEM= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_segregated IS TRUE ",TABLE_NAME);
public FinishedItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
@ -168,4 +169,11 @@ public class FinishedItemDAO {
}
return items;
}
public Long calculateTotalFinishItem( long jobCardId ){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("job_card_id", jobCardId );
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_FINISH_ITEM, params, Long.class);
return count != null ? count : 0;
}
}

View File

@ -27,6 +27,7 @@ public class InventoryAccountDAO {
private final String SELECT_BY_IDS_AND_PARENT_ENTITY_TYPE_AND_PARENT_ID_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id = :parent_entity_id AND parent_entity_type = :parent_entity_type LIMIT :limit", TABLE_NAME );
private final String SELECT_BY_IDS_PACKAGING_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND is_packaging = :is_packaging LIMIT :limit", TABLE_NAME );
private final String SELECT_BY_PARENT_TYPE_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND parent_entity_type = :parent_entity_type AND parent_entity_id = :parent_entity_id" , TABLE_NAME );
private final String SELECT_BY_IS_PACKAGING_TRUE = String.format( "SELECT * FROM %s WHERE is_packaging IS TRUE", TABLE_NAME );
public InventoryAccountDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
@ -144,4 +145,9 @@ public class InventoryAccountDAO {
params.addValue("parent_entity_id", parentEntityId );
return namedParameterJdbcTemplate.query( SELECT_BY_PARENT_TYPE_AND_PARENT_ID, params, new InventoryAccountRowMapper() );
}
public List<InventoryAccount> getPackagingAccounts(){
MapSqlParameterSource params = new MapSqlParameterSource();
return namedParameterJdbcTemplate.query( SELECT_BY_IS_PACKAGING_TRUE, params, new InventoryAccountRowMapper() );
}
}

View File

@ -1,5 +1,6 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.Bundle;
import com.utopiaindustries.model.ctp.InventorySummary;
import com.utopiaindustries.model.ctp.InventoryTransactionLeg;
import com.utopiaindustries.util.KeyHolderFunctions;
@ -21,7 +22,7 @@ public class InventoryTransactionLegDAO {
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, transaction_id, item_id, sku, type, quantity, account_id, balance, transaction_leg_datetime, parent_document_type, parent_document_id, parent_document_piece_type) VALUES (:id, :transaction_id, :item_id, :sku, :type, :quantity, :account_id, :balance, :transaction_leg_datetime, :parent_document_type, :parent_document_id, :parent_document_piece_type) ON DUPLICATE KEY UPDATE transaction_id = VALUES(transaction_id), item_id = VALUES(item_id), sku = VALUES(sku), type = VALUES(type), quantity = VALUES(quantity), account_id = VALUES(account_id), balance = VALUES(balance), transaction_leg_datetime = VALUES(transaction_leg_datetime), parent_document_type = VALUES(parent_document_type), parent_document_id = VALUES(parent_document_id), parent_document_piece_type = VALUES(parent_document_piece_type)", TABLE_NAME );
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, transaction_id, item_id, sku, type, quantity, account_id, balance, transaction_leg_datetime, parent_document_type, parent_document_id, parent_document_piece_type, job_card_id) VALUES (:id, :transaction_id, :item_id, :sku, :type, :quantity, :account_id, :balance, :transaction_leg_datetime, :parent_document_type, :parent_document_id, :parent_document_piece_type, :job_card_id) ON DUPLICATE KEY UPDATE transaction_id = VALUES(transaction_id), item_id = VALUES(item_id), sku = VALUES(sku), type = VALUES(type), quantity = VALUES(quantity), account_id = VALUES(account_id), balance = VALUES(balance), transaction_leg_datetime = VALUES(transaction_leg_datetime), parent_document_type = VALUES(parent_document_type), parent_document_id = VALUES(parent_document_id), parent_document_piece_type = VALUES(parent_document_piece_type), job_card_id = VALUES(job_card_id)", TABLE_NAME );
private final String SELECT_LAST_ACCOUNT_ID_AND_ITEM_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id AND item_id = :item_id AND parent_document_type= :parent_document_type AND parent_document_piece_type = :parent_document_piece_type ORDER BY id DESC LIMIT 1", TABLE_NAME );
private final String SELECT_BY_ACCOUNT_ID = String.format( "SELECT * FROM %s WHERE account_id = :account_id ORDER BY id DESC" , TABLE_NAME );
private final String SELECT_SUMMARY_BY_ACCOUNT_ID = String.format( "SELECT item_id, sku, parent_document_type,parent_document_piece_type," +
@ -44,6 +45,9 @@ public class InventoryTransactionLegDAO {
" WHERE itl.type = :type" +
" AND itl.parent_document_type = :parent_document_type"
, TABLE_NAME, TABLE_NAME );
private final String COUNT_TOTAL_SEGREGATE_ITEMS = String.format("SELECT COUNT(*) FROM %s WHERE parent_document_id IN (:parent_document_id) AND account_id = :account_id", TABLE_NAME);
private final String SELECT_FIRST_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type ORDER BY transaction_leg_datetime ASC LIMIT 1", TABLE_NAME);
private final String SELECT_GROUP_By_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type GROUP BY account_id", TABLE_NAME);
public InventoryTransactionLegDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
@ -63,7 +67,9 @@ public class InventoryTransactionLegDAO {
.addValue( "transaction_leg_datetime", inventoryTransactionLeg.getTransactionLegDateTime() )
.addValue( "parent_document_type", inventoryTransactionLeg.getParentDocumentType() )
.addValue( "parent_document_id", inventoryTransactionLeg.getParentDocumentId() )
.addValue("parent_document_piece_type", inventoryTransactionLeg.getParentDocumentPieceType() );
.addValue("parent_document_piece_type", inventoryTransactionLeg.getParentDocumentPieceType() )
.addValue("job_card_id", inventoryTransactionLeg.getJobCardId() );
return params;
}
@ -153,4 +159,34 @@ public class InventoryTransactionLegDAO {
params.addValue("parent_document_type", parentType );
return namedParameterJdbcTemplate.query( SELECT_LAST_LEG_BY_TYPE_AND_PARENT_ID , params, new InventoryTransactionLegRowMapper() );
}
public Long CalculateTotalGradingItems(List<Long> finishItemIds, Integer accountId) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("parent_document_id", finishItemIds);
params.addValue("account_id", accountId);
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_SEGREGATE_ITEMS, params, Long.class);
return count != null ? count : 0;
}
public InventoryTransactionLeg getFirstStitchBundleTime(List<Long> parentsIds, String parentType) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("parent_document_id", parentsIds);
params.addValue("parent_document_type", parentType);
return namedParameterJdbcTemplate.query(SELECT_FIRST_TRANSACTION_PARENT_TYPE_PARENT_ID, params,new InventoryTransactionLegRowMapper())
.stream()
.findFirst()
.orElse( new InventoryTransactionLeg() );
}
public List<InventoryTransactionLeg> getTransactionByParentIdAndType(List<Long> parentIds , String parentType){
if ( parentIds == null || parentIds.isEmpty() ){
return new ArrayList<>();
}
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("parent_document_id", parentIds );
params.addValue("parent_document_type", parentType );
return namedParameterJdbcTemplate.query( SELECT_GROUP_By_TRANSACTION_PARENT_TYPE_PARENT_ID , params, new InventoryTransactionLegRowMapper() );
}
}

View File

@ -23,6 +23,7 @@ public class InventoryTransactionLegRowMapper implements RowMapper<InventoryTran
inventoryTransactionLeg.setParentDocumentType( rs.getString( "parent_document_type" ) );
inventoryTransactionLeg.setParentDocumentId( rs.getLong( "parent_document_id" ) );
inventoryTransactionLeg.setParentDocumentPieceType( rs.getString("parent_document_piece_type"));
inventoryTransactionLeg.setJobCardId( rs.getLong("job_card_id"));
return inventoryTransactionLeg;
}
}

View File

@ -1,5 +1,6 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.InventoryTransactionLeg;
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
import com.utopiaindustries.util.KeyHolderFunctions;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@ -28,7 +29,8 @@ public class StitchingOfflineItemDAO {
private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME );
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND qa_remarks IS NOT NULL",TABLE_NAME);
private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa IS TRUE",TABLE_NAME);
private final String SELECT_BY_TIME_AND_CARD_ID= String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1;",TABLE_NAME);
public StitchingOfflineItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
@ -148,4 +150,14 @@ public class StitchingOfflineItemDAO {
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_QA_ITEMS, params, Long.class);
return count != null ? count : 0;
}
public StitchingOfflineItem getLastStitchItemByCardIdAndTime(long jobCardId) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("job_card_id", jobCardId);
return namedParameterJdbcTemplate.query(SELECT_BY_TIME_AND_CARD_ID, params,new StitchingOfflineItemRowMapper())
.stream()
.findFirst()
.orElse( new StitchingOfflineItem() );
}
}

View File

@ -22,7 +22,7 @@ public class InventoryTransactionLeg {
private String parentDocumentType;
private long parentDocumentId;
private String parentDocumentPieceType;
private long jobCardId;
//wrapper
private InventoryTransaction transaction;
@ -122,6 +122,14 @@ public class InventoryTransactionLeg {
this.parentDocumentPieceType = parentDocumentPieceType;
}
public long getJobCardId() {
return jobCardId;
}
public void setJobCardId(long jobCardId) {
this.jobCardId = jobCardId;
}
public InventoryTransaction getTransaction() {
return transaction;
}

View File

@ -174,6 +174,7 @@ public class InventoryService {
inventoryTransactionLeg.setParentDocumentId( artifact.getId( ));
inventoryTransactionLeg.setParentDocumentPieceType( artifact.getType( ));
inventoryTransactionLeg.setTransactionLegDateTime( LocalDateTime.now( ));
inventoryTransactionLeg.setJobCardId(artifact.getJobCardId());
// set balance
BigDecimal initialBalance = calculateBalance( accountId, artifact.getItemId( ), parentDocumentType, artifact.getType( ));

View File

@ -2,15 +2,17 @@ package com.utopiaindustries.service;
import com.utopiaindustries.dao.ctp.*;
import com.utopiaindustries.model.ctp.JobCardItem;
import com.utopiaindustries.model.ctp.*;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class ReportingService {
@ -25,8 +27,9 @@ public class ReportingService {
private final MasterBundleDAO masterBundleDAO;
private final FinishedItemDAO finishedItemDAO;
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
private final InventoryAccountDAO inventoryAccountDAO;
public ReportingService( JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO) {
public ReportingService( JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO) {
this.jobCardItemDAO = jobCardItemDAO;
this.cutPieceDAO = cutPieceDAO;
this.bundleDAO = bundleDAO;
@ -37,6 +40,7 @@ public class ReportingService {
this.masterBundleDAO = masterBundleDAO;
this.finishedItemDAO = finishedItemDAO;
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
this.inventoryAccountDAO = inventoryAccountDAO;
}
public Map<String,Integer> getJobCardProgress(String jobCardID){
@ -57,22 +61,6 @@ public class ReportingService {
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (totalProduction.compareTo(BigDecimal.ZERO) == 0 && actualProduction.compareTo(BigDecimal.ZERO) == 0 ) {
totalProgress.put("Job Card Progress", BigDecimal.ZERO.intValue());
} else {
if (actualProduction.compareTo(expectedProduction)>0){
BigDecimal progressPercentage = actualProduction.add(totalProduction)
.divide(actualProduction.multiply(BigDecimal.valueOf(2)), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Job Card Progress", progressPercentage.intValue());
}else {
BigDecimal progressPercentage = actualProduction.add(totalProduction)
.divide(expectedProduction.multiply(BigDecimal.valueOf(2)), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Job Card Progress", progressPercentage.intValue());
}
}
if (actualProduction.compareTo(BigDecimal.ZERO) == 0 ) {
totalProgress.put("Cutting Progress", BigDecimal.ZERO.intValue());
@ -88,8 +76,8 @@ public class ReportingService {
if (totalProduction.compareTo(BigDecimal.ZERO) == 0){
totalProgress.put("Stitching Progress", BigDecimal.ZERO.intValue());
}else {
BigDecimal stitchingProgress = expectedProduction
.divide(totalProduction, 4, BigDecimal.ROUND_HALF_UP)
BigDecimal stitchingProgress = totalProduction
.divide(actualProduction, 4, BigDecimal.ROUND_HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Stitching Progress", stitchingProgress.intValue());
}
@ -102,8 +90,253 @@ public class ReportingService {
.multiply(BigDecimal.valueOf(100));
totalProgress.put("QA Progress", qaProgress.intValue());
}
Long totalFinishItem = finishedItemDAO.calculateTotalFinishItem(Long.parseLong(jobCardID));
if (totalFinishItem == 0){
totalProgress.put("Finishing Progress", BigDecimal.ZERO.intValue());
}else {
BigDecimal finishItemProgress = BigDecimal.valueOf(totalFinishItem)
.divide(actualProduction, 4, BigDecimal.ROUND_HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Finishing Progress", finishItemProgress.intValue());
}
if (totalProduction.compareTo(BigDecimal.ZERO) == 0 && actualProduction.compareTo(BigDecimal.ZERO) == 0 ) {
totalProgress.put("Job Card Progress", BigDecimal.ZERO.intValue());
} else {
if (actualProduction.compareTo(expectedProduction)>0){
BigDecimal progressPercentage = actualProduction.add(totalProduction).add(BigDecimal.valueOf(qaProgressItems)).add(BigDecimal.valueOf(totalFinishItem))
.divide(actualProduction.multiply(BigDecimal.valueOf(4)), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Job Card Progress", progressPercentage.intValue());
}else {
BigDecimal progressPercentage = actualProduction.add(totalProduction).add(BigDecimal.valueOf(qaProgressItems)).add(BigDecimal.valueOf(totalFinishItem))
.divide(expectedProduction.multiply(BigDecimal.valueOf(4)), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
totalProgress.put("Job Card Progress", progressPercentage.intValue());
}
}
return totalProgress;
}
}
public Integer getTotalProduction(String jobCardID){
if (jobCardID == null){
return 0;
}else {
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
BigDecimal actualProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
return actualProduction.intValue();
}
}
public Map<String,Integer> getCompleteProduction(String jobCardID){
if (jobCardID == null){
return new HashMap<>();
}else {
HashMap<String,Integer> totalProgress = new HashMap<>();
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
BigDecimal totalProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal actualProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal expectedProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
Long qaProgressItems = stitchingOfflineItemDAO.CalculateTotalQA(Long.parseLong(jobCardID));
Long totalFinishItem = finishedItemDAO.calculateTotalFinishItem(Long.parseLong(jobCardID));
totalProgress.put("Cutting Progress", actualProduction.intValue());
totalProgress.put("Stitching Progress", totalProduction.intValue());
totalProgress.put("QA Progress", qaProgressItems.intValue());
totalProgress.put("Finishing Progress", totalFinishItem.intValue());
return totalProgress;
}
}
public Map<String,Integer> getSegregateItems(String jobCardID){
if (jobCardID == null){
return new HashMap<>();
}else {
HashMap<String,Integer> gradingItems = new HashMap<>();
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.getPackagingAccounts();
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(Long.parseLong(jobCardID));
List<Long> finishItemsIds = finishedItems.stream()
.map(FinishedItem::getId).collect(Collectors.toList());
if (finishItemsIds.isEmpty()){
return gradingItems;
}else {
for (InventoryAccount inventoryAccount : inventoryAccounts){
long totalGradingItems = inventoryTransactionLegDAO.CalculateTotalGradingItems(finishItemsIds,(int) inventoryAccount.getId());
gradingItems.put(inventoryAccount.getTitle(), (int) totalGradingItems);
}
return gradingItems;
}
}
}
public HashMap<String,String> getEachPhaseTotalTime(String jobCardID){
if (jobCardID == null){
return new HashMap<>();
}else {
HashMap<String,String> phasesTimes = new HashMap<>();
JobCard jobCard = jobCardDAO.find(Long.parseLong(jobCardID));
Bundle lastBundle = bundleDAO.findLastBundleByCardId(Long.parseLong(jobCardID));
//Cutting time
StringBuilder cuttingTime = generateTime(jobCard.getCreatedAt(),lastBundle.getCreatedAt());
phasesTimes.put("Cutting Total Time",cuttingTime.toString());
//Stitching time
List<Long> bundlesIds = bundleDAO.findByCardId(Long.parseLong(jobCardID)).stream().map(Bundle::getId).collect(Collectors.toList());
if (!bundlesIds.isEmpty()){
InventoryTransactionLeg inventoryTransactionLeg = inventoryTransactionLegDAO.getFirstStitchBundleTime(bundlesIds,"STITCH_BUNDLE");
StitchingOfflineItem lastStitchItem = stitchingOfflineItemDAO.getLastStitchItemByCardIdAndTime(Long.parseLong(jobCardID));
StringBuilder stitchingTime = generateTime(inventoryTransactionLeg.getTransactionLegDateTime(),lastStitchItem.getCreatedAt());
phasesTimes.put("Stitching Total Time",stitchingTime.toString());
}else {
phasesTimes.put("Stitching Total Time",null);
}
return phasesTimes;
}
}
public HashMap<String,String> countPendingItemsOnDifferentPhases(String jobCardID){
if (jobCardID == null){
return new HashMap<>();
}else {
HashMap<String,String> phasePending = new HashMap<String,String>();
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
BigDecimal totalProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal actualProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal expectedProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
if(actualProduction.compareTo(totalProduction) == 0) {
phasePending.put("Stitching Total Time", null);
}else {
phasePending.put("Stitching Total Time", "Pending");
}
return phasePending;
}
}
public Map<String, Map<String, Object>> getCuttingDetails(String jobCardID) {
if (jobCardID == null) {
return Collections.emptyMap();
}
Map<String, Map<String, Object>> cuttingDetails = new HashMap<>();
Map<String, InventoryAccount> cuttingAccount = new HashMap<>();
Map<String, String> cuttingPersonName = new HashMap<>();
Map<String, LocalDate> cuttingDate = new HashMap<>();
List<Bundle> bundles = bundleDAO.findByCardId(Long.parseLong(jobCardID));
if (bundles.isEmpty()) {
return cuttingDetails;
}
Map<Long, Bundle> bundleMap = bundles.stream()
.collect(Collectors.toMap(Bundle::getId, Function.identity()));
List<Long> bundleIds = new ArrayList<>(bundleMap.keySet());
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO
.getTransactionByParentIdAndType(bundleIds, "BUNDLE");
for (InventoryTransactionLeg inventoryTransactionLeg : inventoryTransactionLegs) {
Integer accountId = inventoryTransactionLeg.getAccountId();
InventoryAccount inventoryAccount = inventoryAccountDAO.find(accountId.longValue());
if (inventoryAccount != null) {
String accountTitle = inventoryAccount.getTitle();
cuttingAccount.put(accountTitle, inventoryAccount);
Bundle bundle = bundleMap.get(inventoryTransactionLeg.getParentDocumentId());
cuttingPersonName.put(accountTitle, (bundle != null) ? bundle.getCreatedBy() : null);
cuttingDate.put(accountTitle,(bundle != null) ? bundle.getCreatedAt().toLocalDate() : null);
}
}
cuttingDetails.put("accounts", new HashMap<>(cuttingAccount));
cuttingDetails.put("personName", new HashMap<>(cuttingPersonName));
cuttingDetails.put("date", new HashMap<>(cuttingDate));
return cuttingDetails;
}
public Map<String, Map<String, Object>> getStitchingDetails(String jobCardID) {
if (jobCardID == null) {
return Collections.emptyMap();
}
Map<String, Map<String, Object>> stitchingDetails = new HashMap<>();
Map<String, InventoryAccount> stitchingAccount = new HashMap<>();
Map<String, String> stitchingPersonName = new HashMap<>();
Map<String, LocalDate> stitchingDate = new HashMap<>();
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardId(Long.parseLong(jobCardID));
if (stitchingOfflineItems.isEmpty()) {
return stitchingDetails;
}
Map<Long, StitchingOfflineItem> stitchingOfflineItemMap = stitchingOfflineItems.stream()
.collect(Collectors.toMap(StitchingOfflineItem::getId, Function.identity()));
List<Long> stitchingItemsArray = new ArrayList<>(stitchingOfflineItemMap.keySet());
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO
.getTransactionByParentIdAndType(stitchingItemsArray, "STITCHING_OFFLINE");
for (InventoryTransactionLeg inventoryTransactionLeg : inventoryTransactionLegs) {
Integer accountId = inventoryTransactionLeg.getAccountId();
InventoryAccount inventoryAccount = inventoryAccountDAO.find(accountId.longValue());
if (inventoryAccount != null) {
String accountTitle = inventoryAccount.getTitle();
stitchingAccount.put(accountTitle, inventoryAccount);
StitchingOfflineItem stitchingOfflineItem = stitchingOfflineItemMap.get(inventoryTransactionLeg.getParentDocumentId());
stitchingPersonName.put(accountTitle, (stitchingOfflineItem != null) ? stitchingOfflineItem.getCreatedBy() : null);
stitchingDate.put(accountTitle,(stitchingOfflineItem != null) ? stitchingOfflineItem.getCreatedAt().toLocalDate() : null);
}
}
stitchingDetails.put("accounts", new HashMap<>(stitchingAccount));
stitchingDetails.put("personName", new HashMap<>(stitchingPersonName));
stitchingDetails.put("date", new HashMap<>(stitchingDate));
return stitchingDetails;
}
private StringBuilder generateTime(LocalDateTime startDate, LocalDateTime endDate){
StringBuilder totalTime = new StringBuilder();
if(startDate != null && endDate != null){
Duration duration = Duration.between(startDate, endDate);
if (duration.toDays() > 0) {
totalTime.append(String.format("%d days, ", duration.toDays()));
}
if (duration.toHours() % 24 > 0) {
totalTime.append(String.format("%d hours, ", duration.toHours() % 24));
}
if (duration.toMinutes() % 60 > 0) {
totalTime.append(String.format("%d minutes ", duration.toMinutes() % 60));
}
return totalTime;
}else return totalTime.append("");
}
}

View File

@ -4,8 +4,7 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
function createGaugeChart(speed, color, divId, title, height, width , fontSize, fontYAxis, fontXAxis, fontColor, total, actual) {
console.log(fontSize)
function createGaugeChart(progress, color, divId, title, height, width , fontSize, fontYAxis, fontXAxis, fontColor, total, actual, aGrade, bGrade, cGrade) {
Highcharts.chart(divId, {
chart: {
type: 'solidgauge',
@ -45,10 +44,9 @@ document.addEventListener("DOMContentLoaded", function () {
},
series: [{
name: 'Percentage',
data: [speed],
data: [progress],
dataLabels: {
format: '{y}% ',
// format: '{y}% <br>' + "Total: "+ total+ "<br> Complete: " + actual,
y: fontYAxis,
x: fontXAxis,
borderWidth: 0,
@ -60,6 +58,9 @@ document.addEventListener("DOMContentLoaded", function () {
},
zIndex: 10
},
tooltip: {
pointFormat: title == 'Finishing Progress' ? 'Percentage: ' + progress + '%<br>Total: ' + total + '<br>Completed: ' + actual + '<br>A Grade: ' + aGrade + '<br>B Grade: ' + bGrade + '<br>C Grade: ' + cGrade : 'Percentage: ' + progress + '%<br>Total: ' + total + '<br>Completed:'+actual
},
color: color,
showInLegend: false
}],
@ -68,11 +69,66 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
}
function createBarChart(config, height, width, title) {
if (!document.getElementById(config.containerId)) {
return;
}
Highcharts.chart(config.containerId, {
chart: {
type: 'column',
height: height,
width: width,
},
title: {
text: title,
align: 'center', // Optionally align title in center
verticalAlign: 'top',
y: 30 // Offset from top
},
xAxis: {
categories: [
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
"Next Monday", "Next Tuesday", "Next Wednesday", "Next Friday", "Next Saturday", "Next Sunday"
],
labels: {
rotation: -45 // Optional: Rotate labels if needed
}
},
yAxis: {
min: 0,
max: 100,
title: {
text: 'Total Progress'
},
labels: {
format: '{value}%'
}
},
scrollbar: {
enabled: true // Ensure Highcharts scrollbar is enabled
},
series: [{
name: 'Model A',
data: [100, 75, 78, 79, 77, 81, 80, 76, 79, 80, 76, 79, 80, 76, 79, 80, 80]
}, {
name: 'Model B',
data: [85, 78, 82, 80, 79, 84, 83, 78, 82, 83, 76, 79, 80, 76, 79, 80, 85]
}, {
name: 'Model C',
data: [88, 80, 85, 82, 81, 87, 85, 80, 85, 86, 76, 79, 80, 76, 79, 80, 88]
}, {
name: 'Model D',
data: [90, 83, 87, 84, 83, 89, 88, 83, 87, 88, 76, 79, 80, 76, 79, 80, 90]
}]
});
}
initializeGauges();
function initializeGauges() {
const gaugeDivs2 = document.querySelectorAll('.gauge-chart2');
gaugeDivs2.forEach(function (div) {
const speed = div.getAttribute('data-speed');
const progress = div.getAttribute('data-progress');
const color = div.getAttribute('data-color');
const title = div.getAttribute('data-title');
const height = div.getAttribute('data-height');
@ -82,11 +138,11 @@ document.addEventListener("DOMContentLoaded", function () {
const total = div.getAttribute('data-totalProduction');
const actual = div.getAttribute('data-actualProduction');
const divId = div.id;
createGaugeChart(parseInt(speed), color, divId, title, height, width, fontSize, -20, 4, fontColor, total, actual);
createGaugeChart(parseInt(progress), color, divId, title, height, width, fontSize, -20, 4, fontColor, total, actual);
});
const gaugeDivs = document.querySelectorAll('.gauge-chart');
gaugeDivs.forEach(function (div) {
const speed = div.getAttribute('data-speed');
const progress = div.getAttribute('data-progress');
const color = div.getAttribute('data-color');
const title = div.getAttribute('data-title');
const height = div.getAttribute('data-height');
@ -95,9 +151,32 @@ document.addEventListener("DOMContentLoaded", function () {
const fontColor = div.getAttribute('data-fontColor');
const total = div.getAttribute('data-totalProduction');
const actual = div.getAttribute('data-actualProduction');
const aGrade = div.getAttribute('data-aGrade');
const bGrade = div.getAttribute('data-bGrade');
const cGrade = div.getAttribute('data-cGrade');
const divId = div.id;
console.log(title)
createGaugeChart(parseInt(speed), color, divId, title, height, width, fontSize, -15, 2, fontColor, total, actual);
createGaugeChart(parseInt(progress), color, divId, title, height, width, fontSize, -15, 2, fontColor, total, actual, aGrade, bGrade, cGrade);
});
const barChart = document.querySelectorAll('.barChart');
barChart.forEach(function (div) {
const progress = div.getAttribute('data-progress');
const color = div.getAttribute('data-color');
const title = div.getAttribute('data-title');
const height = div.getAttribute('data-height');
const width = div.getAttribute('data-width');
const fontSize = div.getAttribute('data-fontSize');
const fontColor = div.getAttribute('data-fontColor');
const total = div.getAttribute('data-totalProduction');
const actual = div.getAttribute('data-actualProduction');
const aGrade = div.getAttribute('data-aGrade');
const bGrade = div.getAttribute('data-bGrade');
const cGrade = div.getAttribute('data-cGrade');
const divId = div.id;
createBarChart(barChartConfigs, height, width, title,);
});
}
});

View File

@ -21,11 +21,11 @@
<div style="width: 300px; height: 330px;"
th:id="'gauge-chart2'"
class="gauge-chart2"
th:data-speed="${jobCardProgress.get('Job Card Progress')}"
th:data-progress="${jobCardProgress.get('Job Card Progress')}"
th:data-title="${'Job Card Progress'}"
th:data-width="350"
th:data-height="350"
th:data-totalProduction="${jobCardProgress.get('totalProduction')}"
th:data-totalProduction="${totalProduction}"
th:data-actualProduction="${jobCardProgress.get('actualProduction')}"
th:data-fontSize="30"
th:data-fontColor="'#17202a'"
@ -34,16 +34,17 @@
<div style="display: flex; ">
<div th:each="title, index : ${jobCardProgress.keySet()}" style="text-align: center; margin-top: 40px;">
<div th:if ="${ title != 'Job Card Progress' }"
th:id="'gauge-chart-' + ${index}"
class="gauge-chart"
style="width: 200px; height: 230px;"
th:data-speed="${jobCardProgress.get(title)}"
th:data-totalProduction="${jobCardProgress.get('totalProduction')}"
th:data-actualProduction="${jobCardProgress.get('actualProduction')}"
th:id="'gauge-chart-' + ${index}" class="gauge-chart" style="width: 200px; height: 230px;"
th:data-progress="${jobCardProgress.get(title)}"
th:data-totalProduction="${totalProduction}"
th:data-actualProduction="${completeProduction.get(title)}"
th:data-title="${title}"
th:data-width="230"
th:data-height="230"
th:data-fontSize="20"
th:data-aGrade="${segregateItems.get('A GRADE') == null ? 0 : segregateItems.get('A GRADE')}"
th:data-bGrade="${segregateItems.get('B GRADE') == null ? 0 : segregateItems.get('B GRADE')}"
th:data-cGrade="${segregateItems.get('C GRADE') == null ? 0 : segregateItems.get('C GRADE')}"
th:data-fontColor="'#17202a'"
th:data-color="'#95a5a6'">
</div>
@ -56,18 +57,15 @@
<tr>
<td style="display: flex; flex-direction: column; align-items: center; border: none !important; outline: none;">
<div style="display: flex; gap: 10px;">
<div style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;">
<H6>Cutting Total Time</H6>
<H6>10</H6>
<div th:each="phase, index : ${phasesTimes.keySet()}" style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;">
<H6 th:text="${phase}"></H6>
<H6 th:text="${phasesTimes.get(phase)}"></H6>
<H6 th:if="${pendingStatus.get(phase) != null}" th:text="${pendingStatus.get(phase)}"></H6>
</div>
<div style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;"><H6>Stitching Total Time</H6></div>
<div style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;"><H6>Quality Checking Total Time</H6></div>
<div style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;"><H6>Finishing Total Time</H6></div>
<div style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;"><H6>Packaging Total Time</H6></div>
</div>
</td>
</tr>
<tr>
<tr th:if="${cuttingDetails != null and cuttingDetails.get('accounts') != null}">
<td style="padding: 0px; text-align: center;">
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
Cutting Detail
@ -78,24 +76,27 @@
<th>ID</th>
<th>Title</th>
<th>Cutting</th>
<th>Cutting Day</th>
<th>Cutting Date</th>
<th>Cutting Table Descriptions</th>
</tr>
</thead>
<tbody>
<tr>
<td th:text="1"></td>
<td th:text="'Cutting Account 1'"></td>
<td th:text="Usama"></td>
<td th:text="Friday"></td>
<td th:text="'Cutting Table'"></td>
<tr th:if="${cuttingDetails != null}" th:each="detail, index : ${cuttingDetails.get('accounts').keySet()}">
<td th:text="${cuttingDetails.get('accounts').get(detail).id}"></td>
<td th:text="${cuttingDetails.get('accounts').get(detail).title}"></td>
<td th:text="${cuttingDetails.get('personName').get(detail)}"></td>
<td>
<span th:text="${#temporals.format(cuttingDetails.get('date').get(detail), 'E')}"></span>
<span ctp:formatdate="${cuttingDetails.get('date').get(detail)}" ></span>
</td>
<td th:text="${cuttingDetails.get('accounts').get(detail).notes}"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<tr th:if="${stitchingDetails != null and stitchingDetails.get('accounts') != null}">
<td style="padding: 0px; text-align: center; ">
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
Stitching Detail
@ -110,27 +111,35 @@
<th>Stitching Table Descriptions</th>
</tr>
</thead>
<tbody>
<tr>
<td th:text="1"></td>
<td th:text="'Stitching Account 1'"></td>
<td th:text="Usama"></td>
<td th:text="Friday"></td>
<td th:text="'Stitching Table'"></td>
<tbody th:if="${stitchingDetails != null and stitchingDetails.get('accounts') != null}">
<tr th:each="detail : ${stitchingDetails.get('accounts').keySet()}">
<td th:text="${stitchingDetails.get('accounts').get(detail).id}"></td>
<td th:text="${stitchingDetails.get('accounts').get(detail).title}"></td>
<td th:text="${stitchingDetails.get('personName') != null ? stitchingDetails.get('personName').get(detail) : ''}"></td>
<td>
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}" th:text="${#temporals.format(stitchingDetails.get('date').get(detail), 'E')}"></span>
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}" ctp:formatdate="${stitchingDetails.get('date').get(detail)}"></span>
</td>
<td th:text="${stitchingDetails.get('accounts').get(detail).notes}"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- <tr>-->
<!-- <td style="padding-left: 150px;">-->
<!-- <div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 460px; width: 80%; overflow-x: auto;">-->
<!-- <div id="barChart" style="height: 400px; width: 1600px;"></div> &lt;!&ndash; 100% width for responsiveness &ndash;&gt;-->
<!-- </div>-->
<tr>
<td style="padding-left: 150px;">
<div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 460px; width: 80%; overflow-x: auto;">
<div id="barChart" class="barChart" style="height: 400px; width: 1600px;"
th:data-width="1600"
th:data-height="400"
th:data-title="'Days Wise Progress'"
></div> <!-- 100% width for responsiveness -->
</div>
<!-- </td>-->
<!-- </tr>-->
</td>
</tr>
</tbody>
</table>
</div>
@ -236,18 +245,18 @@
completedPiece:100
}
];
<!-- const barChartConfigs = {-->
<!-- containerId: "barChart",-->
<!-- title: "Day-wise Performance Metrics",-->
<!-- max:16,-->
<!-- categories: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Next Monday", "Next Tuesday", "Next Wednesday", "Friday", "Saturday", "Sunday", "Next Monday", "Next Tuesday", "Next Wednesday"],-->
<!-- series: [-->
<!-- { name: "Model A", data: [0.8, 0.75, 0.78, 0.76, 0.74, 0.80, 0.77, 0.79, 0.81, 0.76, 0.80, 0.77, 0.79, 0.81, 0.76], color: "#007bff" },-->
<!-- { name: "Model B", data: [0.85, 0.7, 0.77, 0.79, 0.72, 0.83, 0.78, 0.80, 0.82, 0.75,0.83, 0.78, 0.80, 0.82, 0.75], color: "#28a745" },-->
<!-- { name: "Model C", data: [0.82, 0.72, 0.79, 0.80, 0.78, 0.85, 0.81, 0.84, 0.86, 0.79, 0.85, 0.81, 0.84, 0.86, 0.79], color: "#dc3545" },-->
<!-- { name: "Model D", data: [0.88, 0.78, 0.83, 0.85, 0.82, 0.89, 0.85, 0.87, 0.90, 0.83, 0.89, 0.85, 0.87, 0.90, 0.83], color: "#fd7e14" }-->
<!-- ]-->
<!--};-->
const barChartConfigs = {
containerId: "barChart",
title: "Day-wise Performance Metrics",
max:16,
categories: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Next Monday", "Next Tuesday", "Next Wednesday", "Friday", "Saturday", "Sunday", "Next Monday", "Next Tuesday", "Next Wednesday"],
series: [
{ name: "Model A", data: [0.8, 0.75, 0.78, 0.76, 0.74, 0.80, 0.77, 0.79, 0.81, 0.76, 0.80, 0.77, 0.79, 0.81, 0.76], color: "#007bff" },
{ name: "Model B", data: [0.85, 0.7, 0.77, 0.79, 0.72, 0.83, 0.78, 0.80, 0.82, 0.75,0.83, 0.78, 0.80, 0.82, 0.75], color: "#28a745" },
{ name: "Model C", data: [0.82, 0.72, 0.79, 0.80, 0.78, 0.85, 0.81, 0.84, 0.86, 0.79, 0.85, 0.81, 0.84, 0.86, 0.79], color: "#dc3545" },
{ name: "Model D", data: [0.88, 0.78, 0.83, 0.85, 0.82, 0.89, 0.85, 0.87, 0.90, 0.83, 0.89, 0.85, 0.87, 0.90, 0.83], color: "#fd7e14" }
]
};
</script>