diff --git a/optmanagementprod/kol_databases.py b/optmanagementprod/kol_databases.py index b09ef46..6dcc786 100644 --- a/optmanagementprod/kol_databases.py +++ b/optmanagementprod/kol_databases.py @@ -38,7 +38,7 @@ def fetch_records(config): if connection.is_connected(): cursor = connection.cursor(dictionary=True) - cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, GROUP_CONCAT(DISTINCT projects.name) as project_name, clients.name as client_name,CONCAT(client_users.first_name,client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status FROM kols left join user_kols on user_kols.kol_id = kols.id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join project_kols on project_kols.kol_id = user_kols.kol_id left join projects on projects.id = project_kols.project_id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;") + cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.npi_num,kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, GROUP_CONCAT(DISTINCT projects.name) as project_name, clients.name as client_name,CONCAT(client_users.first_name,client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status FROM kols left join user_kols on user_kols.kol_id = kols.id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join project_kols on project_kols.kol_id = user_kols.kol_id left join projects on projects.id = project_kols.project_id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;") records = cursor.fetchall() return records diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json index b83e151..3eccf1a 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json @@ -17,7 +17,8 @@ "cs_assigned_poc", "optin_type", "data_processed_date", - "instance" + "instance", + "npi_id" ], "fields": [ { @@ -83,12 +84,17 @@ "fieldname": "instance", "fieldtype": "Data", "label": "Instance" + }, + { + "fieldname": "npi_id", + "fieldtype": "Data", + "label": "Npi ID" } ], "index_web_pages_for_search": 1, "is_virtual": 1, "links": [], - "modified": "2024-06-19 17:59:49.749353", + "modified": "2024-06-20 15:03:39.506553", "modified_by": "Administrator", "module": "Opt management production", "name": "optlistprod", diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py index a133341..3eed269 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py @@ -29,6 +29,7 @@ class optlistprod(Document): "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), "status" : str(client["status"]), "instance" : str(client["instance"]), + "npi_id": str(client["npi_num"]), } ) @@ -120,6 +121,7 @@ def getValues(): "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), "status" : str(client["status"]), "instance" : str(client["instance"]), + "npi_id": str(client["npi_num"]), } for client in records ] diff --git a/optmanagementprod/www/optanalystview.html b/optmanagementprod/www/optanalystview.html index db42be9..e885641 100644 --- a/optmanagementprod/www/optanalystview.html +++ b/optmanagementprod/www/optanalystview.html @@ -143,16 +143,16 @@ document.addEventListener('DOMContentLoaded', function() { paginationSizeSelector: [5, 10, 50, 100], paginationCounter: "rows", columns:[ // Define table columns - {title:"KOL ID", field:"kol_id",headerFilterPlaceholder: "Search",hozAlign:"center", headerFilter: true,width:150}, - {title:"KOL Name", field:"kol_name",headerFilterPlaceholder: "Search", headerFilter: true,}, - {title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true}, + {title:"Instance", field:"instance",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, {title:"Client Name", field:"client_name",headerFilterPlaceholder: "Search", headerFilter: true,tooltip:true}, - {title:"Client POC", field:"client_poc",headerFilterPlaceholder: "Search", headerFilter: true,}, - + {title:"NPI ID", field:"npi_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, + {title:"KOL ID", field:"kol_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, + {title:"KOL Name", field:"kol_name",headerFilterPlaceholder: "Search", headerFilter: true,}, + {title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,}, {title:"Requested Date", field:"optin_received_date",headerFilterPlaceholder: "Search", headerFilter: true,}, {title:"Approved Date", field:"optin_approved_date",headerFilterPlaceholder: "Search", headerFilter: true,}, - {title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,}, - {title:"Instance", field:"instance",headerFilterPlaceholder: "Search", headerFilter: true,}, + {title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true}, + {title:"Client POC", field:"client_poc",headerFilterPlaceholder: "Search", headerFilter: true,}, // {title:"CS Assigned POC", field:"cs_assigned_poc",headerFilterPlaceholder: "Search", headerFilter: true,}, // {title:"Opt-In Type", field:"optin_type",headerFilterPlaceholder: "Search", headerFilter: true,}, // {title:"Data Processed Date", field:"data_processed_date",headerFilterPlaceholder: "Search", headerFilter: true} diff --git a/optmanagementprod/www/optanalystview.py b/optmanagementprod/www/optanalystview.py index 0f0bcb5..f266a81 100644 --- a/optmanagementprod/www/optanalystview.py +++ b/optmanagementprod/www/optanalystview.py @@ -13,10 +13,10 @@ def fetch_data(): "client_name" : str(client["client_name"]), "client_poc" : str(client["client_poc"]), "optin_received_date" : str(client["optin_received_date"]), - "optin_approved_date" : "empty" if not str(client["optin_approved_date"]) else str(client["optin_approved_date"]), + "optin_approved_date" : str(client["optin_approved_date"]), "status" : str(client["status"]), "instance" : str(client["instance"]), - + "npi_id": str(client["npi_id"]), } for client in records]