Главная » Файлы » Зарплата

Удаление расчета если нет прямых начислений
11.11.2015, 15:46

Пользователи забывают запустить соответствующий отчет, чтобы увидеть людей у которых нет прямых, но есть расчет. И из месяца в месяц такие люди получают деньги, потом приходится исправлять.

Для того, чтобы такая ситуация никогда не возникла, можно вставить в доп. сегмент процедуры zrp_расчетЗП_all такой код, который будет вычищать лицевой счет по текущему списку.

 

if dbo.cm_closed(@@4 * 12 + @@5, 1, 'E',0, 0, 0) = 0 then
{
SCAN @qqq --определяю работников, у которых есть расчет, но нет прямых
select e.pid from emps e join lic l on (l.pid=e.pid)
where st=curstation
and l.cmonth = @@4 * 12 + @@5
and not exists (select * from tabel where cmonth = l.cmonth and pid=l.pid)
group by e.pid
Execute
{
con Удаляю лиц счет тем у кого нет прямых;
delete lic
from
emps e 
where not exists (select * from tabel where cmonth = lic.cmonth and pid=lic.pid)
and lic.cmonth = @@4 * 12 + @@5
and e.pid=lic.pid and st = curstation
and e.pid = @qqq:pid;


delete z_retain
from
emps e 
where not exists (select * from tabel where cmonth = z_retain.cmonth and pid=z_retain.pid)
and z_retain.cmonth = @@4 * 12 + @@5
and e.pid=z_retain.pid and st = curstation
and e.pid = @qqq:pid;


delete z_sabsence
from
emps e 
where not exists (select * from tabel where cmonth = z_sabsence.cmonth and pid=z_sabsence.pid)
and z_sabsence.cmonth = @@4 * 12 + @@5
and e.pid=z_sabsence.pid and st = curstation
and e.pid = @qqq:pid;

delete sl_uni_tax
from
emps e 
where not exists (select * from tabel where cmonth = sl_uni_tax.cmonth and pid=sl_uni_tax.pid)
and sl_uni_tax.cmonth = @@4 * 12 + @@5
and e.pid=sl_uni_tax.pid and st = curstation
and e.pid = @qqq:pid;
};
};

Категория: Зарплата | Добавил: rebel25
Просмотров: 516 | Загрузок: 0 | Рейтинг: 0.0/0
Всего комментариев: 0
avatar