varsql=" select t1.*,t2.warehouse_name from dc_report_cash_flow_forecast_task_log as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.is_delete=0 and `val`!=0 ";
varsql=$" select t1.*,t2.warehouse_name ,{search.type??2} as 'type' from dc_report_cash_flow_forecast_task_log as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.is_delete=0 and `val`!=0 ";
if(search.issum)
{
sql=$" select sum(`val`) as 'val' from dc_report_cash_flow_forecast_task_log as t1 where t1.is_delete=0 and `val`!=0 ";
}
else
{
if(search.view_type==2)
{
sql=$@" select t1.data_type,t1.pay_type,sum(`val`) as 'val'
from dc_report_cash_flow_forecast_task_log as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.is_delete=0 and `val`!=0 ";