<?php
declare(strict_types=1);ini_set('display_errors','0');require_once __DIR__.'/../includes/console_shell.php';require_login();$pageLink='salary-config/salary-components.php';require_acl('can_view',$pageLink);require_once __DIR__.'/salary-component-common.php';$types=scm_types($con);$filter=max(0,(int)($_GET['componenttype']??0));if($filter&&!scm_in($types,$filter))$filter=0;$where=$filter&&$filter!==6?' WHERE m.componenttype=?':'';$rows=scm_rows($con,'SELECT m.*,t.componenttype type_name FROM jos_app_salarycomponentmaster m LEFT JOIN jos_app_componenttype t ON t.id=m.componenttype'.$where.' ORDER BY m.id ASC',$where?'i':'',$where?[$filter]:[]);?><!doctype html><html><head><meta charset="utf-8"><title>Salary Component Master</title><style>body{font:12px Arial;color:#172033;padding:20px}h1{font-size:22px}table{width:100%;border-collapse:collapse}th,td{border:1px solid #cbd5e1;padding:7px;text-align:left}th{background:#f1f5f9}@media print{button{display:none}}</style></head><body><button onclick="window.print()">Print</button><h1>Salary Component Master</h1><table><thead><tr><th>Sr No</th><th>Component Type</th><th>Component Name</th><th>Marathi Name</th><th>Short Name</th><th>Function Name</th><th>Calculation Type</th><th>Status</th><th>Order By</th></tr></thead><tbody><?php foreach($rows as $i=>$r):?><tr><td><?=$i+1?></td><td><?=h($r['type_name']??'-')?></td><td><?=h($r['componentname'])?></td><td><?=h($r['marathiname'])?></td><td><?=h($r['shortname'])?></td><td><?=h($r['functionname'])?></td><td><?=h(scm_calc_label((int)$r['calculation_type']))?></td><td><?=$r['status']?'Active':'Inactive'?></td><td><?=h((string)$r['orderby'])?></td></tr><?php endforeach;?></tbody></table></body></html>
