landv / landv.github.io

landv-blogs
https://landv.cn
2 stars 0 forks source link

[西软]单菜销售明细报表-按营业点开发,并有报表穿透 #68

Open landv opened 1 year ago

landv commented 1 year ago
### 先执行以下这个让其能显示变量并能中报表中拖拽出来表格。
select 
    t.menu,
  d.descript as pcdes,
    t.code,
    t.descript,
    t.number as number,
    t.unit, 
                        h.date0,
 (t.amount0-t.dsc0-t.dsc1) amount ,
(t.serve0-t.srv_dsc0-t.srv_dsc1)   amount1    
from pos_detail_jie t
join pos_hdish as h on h.hotelid=t.hotelid and h.menu=t.menu and h.code=t.code and t.inumber=h.inumber 
left join pos_plucode p on t.hotelid=p.hotelid and t.plucode=p.code 
left join pos_sort  s on t.hotelid=s.hotelid and t.plucode=s.plucode and t.sort=s.sort 
left join pos_pccode d on t.hotelid=d.hotelid and t.pccode = d.pccode  
where t.hotelid='${hotelid}'  and Find_in_set( t.code,'${plu}')  and  t.bdate >='${start}' and t.bdate <=' ${end}' 
HAVING amount<>0 or amount1<>0
union all 
select 
    t.menu,
  d.descript as pcdes,
    t.code,
    t.descript,
    t.number as number,
    t.unit, 
                        h.date0,
 (t.amount0-t.dsc0-t.dsc1) amount ,
(t.serve0-t.srv_dsc0-t.srv_dsc1)   amount1    
from pos_detail_jie t
join pos_dish as h on h.hotelid=t.hotelid and h.menu=t.menu and h.code=t.code and t.inumber=h.inumber 
left join pos_plucode p on t.hotelid=p.hotelid and t.plucode=p.code 
left join pos_sort  s on t.hotelid=s.hotelid and t.plucode=s.plucode and t.sort=s.sort 
left join pos_pccode d on t.hotelid=d.hotelid and t.pccode = d.pccode  
where t.hotelid='${hotelid}'  and Find_in_set( t.code,'${plu}')  and  t.bdate >='${start}' and t.bdate <=' ${end}' 
HAVING amount<>0 or amount1<>0
order by pcdes,date0

### 重点记忆,里面要执行的公式一定要从变量那里拖拽出去,不能直接输入,直接输入的是文本就无法进行计算了。
### 例如:number.sum()就是这样

## 单菜销售明细报表-按营业点,不知道为毛用了 and  t.pccode in(${pccodestr}) 报表上面的变量就不显示了
select 
    t.menu,
  d.descript as pcdes,
    t.code,
    t.descript,
    t.number as number,
    t.unit, 
                        h.date0,
 (t.amount0-t.dsc0-t.dsc1) amount ,
(t.serve0-t.srv_dsc0-t.srv_dsc1)   amount1    
from pos_detail_jie t
join pos_hdish as h on h.hotelid=t.hotelid and h.menu=t.menu and h.code=t.code and t.inumber=h.inumber 
left join pos_plucode p on t.hotelid=p.hotelid and t.plucode=p.code 
left join pos_sort  s on t.hotelid=s.hotelid and t.plucode=s.plucode and t.sort=s.sort 
left join pos_pccode d on t.hotelid=d.hotelid and t.pccode = d.pccode  
where t.hotelid='${hotelid}'  and  t.pccode in(${pccodestr}) and  t.bdate >='${begin}' and t.bdate <=' ${end}' 
HAVING amount<>0 or amount1<>0
union all 
select 
    t.menu,
  d.descript as pcdes,
    t.code,
    t.descript,
    t.number as number,
    t.unit, 
                        h.date0,
 (t.amount0-t.dsc0-t.dsc1) amount ,
(t.serve0-t.srv_dsc0-t.srv_dsc1)   amount1    
from pos_detail_jie t
join pos_dish as h on h.hotelid=t.hotelid and h.menu=t.menu and h.code=t.code and t.inumber=h.inumber 
left join pos_plucode p on t.hotelid=p.hotelid and t.plucode=p.code 
left join pos_sort  s on t.hotelid=s.hotelid and t.plucode=s.plucode and t.sort=s.sort 
left join pos_pccode d on t.hotelid=d.hotelid and t.pccode = d.pccode  
where t.hotelid='${hotelid}'  and  t.pccode in(${pccodestr}) and  t.bdate >='${begin}' and t.bdate <=' ${end}' 
HAVING amount<>0 or amount1<>0
order by pcdes,date0

## 西软报表穿透
return "openreport?rptid=1059&m_model="+mode+"&m_date="+formDate+"&m_enddate="+formDate+
                "&m_cash=all&m_emp=all&m_pccode="+$.code+"&m_impindex=empty"+"&m_hotelid="+hotelid;

return "openreport?rptid=1060&menu="+$.menu+"ishis=T"