# 工资数据报表

```` 
select e.lastname,sob.name as 账套名, record.salary_month as 薪资月, item.name as 薪资项 ,result.result_value as 值
from hrsa_salary_acct_record record 
left join hrsa_salary_sob sob  on record.salary_sob_id = sob.id and sob.delete_type = 0  and record.delete_type = 0 
left join hrsa_salary_acct_result result on record.id = result.salary_acct_record_id and result.delete_type = 0  and record.delete_type = 0 
left join hrsa_salary_item item on result.salary_item_id = item.id and item.delete_type = 0 
left join hrsa_tax_agent agent on agent.id=sob.tax_agent_id and agent.delete_type=0 
left join hrmresource e on e.id= result.employee_id


# 获取档案信息

 select i.item_value from hrsa_salary_archive_item i 
 left join hrsa_salary_archive a on a.id = i.salary_archive_id 
 left join hrsa_salary_item c on c.id=i.salary_item_id 
 left join hrsa_tax_agent t on a.tax_agent_id=t.id  
 where a.delete_type=0 and i.delete_type=0 and t.delete_type=0   and c.delete_type=0 
 and a.employee_id=$main.ygid$ and t.name='$main.dzqgskjywr$' 
 and effective_time <= now() and c.name='基本工资' order by effective_time desc