Untitled

mail@pastecode.io avatar
unknown
text
a month ago
1.2 kB
8
Indexable
Never
Select 
dpr.repairby,
(Select name from tbl_user where badge = dpr.repairby) as pic,
(Select count(PCB) from tbl_datarepairanalyst where repairby=dpr.repairby) as bindqty,
(Select count(PCB) from tbl_datarepairanalyst where repairby=dpr.repairby and statusrepair =105) as output,
(Select count(PCB) from tbl_datarepairanalyst where repairby=dpr.repairby and statusrepair =108) as scrap,
(Select count(PCB) from tbl_datarepairanalyst where repairby=dpr.repairby and statusrepair =109) as rtv,
(bindqty - (output+scrap+rtv)) as balance,

(Select count(PCB) from tbl_datarepairanalyst where repairby=dpr.repairby and statusrepair in (105,108,109) as bindqty,

from tbl_datarepairanalyst dpr where 
dpr.createdate beetwen ('2023-12-01 07:00:00 and '2023-12-02 07:00:00)



Buat tbl_datapcbreturn
Id,PCB,repairby,repairpassdate,returndate,returnby,typereturn)
Returntype:
1: internal
2:external


Logic:
Triger by scanin repair PCB
Select count(*) from tbl_datarepairanalyst where PCB='Isn Pcb'
If count > 0
{
select createby,repairpassdate, repairtype_id from tbl_datarepairanalyst where PCB= 'isn' order by repairpassdate desc limit 1
Typereturn  : repairtype =30 then 1 else 2
Insert into tbl_datapcbreturn
}
Else
{}
Leave a Comment