// Calculate membership value based on branch + qualification
if(!empty($update['qualification_id'])){
try{
$workflowInstance=$db->selectOne(
"SELECT wi.*, wd.name_ar as workflow_name FROM workflow_instances wi JOIN workflow_definitions wd ON wd.id = wi.workflow_definition_id WHERE wi.id = ?",
[(int)$member->workflow_instance_id]
$pricing=$db->selectOne(
"SELECT price FROM pricing_configs
WHERE branch_id = ? AND qualification_id = ? AND membership_type = 'working'
AND is_active = 1 AND effective_from <= CURDATE()
AND (effective_to IS NULL OR effective_to >= CURDATE())