if(isset($_REQUEST['time1']) && $_REQUEST['time1'] != ''){ $riqi=substr($_REQUEST['time1'],0,7); $nian=substr($_REQUEST['time1'],0,4); $chaxun=substr($_REQUEST['time1'],0,10); }else{ $riqi=date("Y-m",time()); $nian=date("Y",time()); $chaxun=date("Y-m-d",time()); } if(session('iszb')=='是'){ if(isset($_REQUEST['shopid']) && $_REQUEST['shopid'] != ''){ $map=" and shopid=".I('shopid')." "; $shopname=get_shop_name($_REQUEST['shopid']); }else{ $shopname='全部店铺'; } }else{ $map=" and shopid=".session('shopid')." "; $shopname=get_shop_name(session('shopid')); } $yueyingyee=M('zijin')->where("addtime like '%".$riqi."%' and (type<>'充值' and type<>'退款') ".$map)->sum('jine'); $nianyingyee=M('zijin')->where("addtime like '%".$nian."%' and (type<>'充值' and type<>'退款') ".$map)->sum('jine'); $yingyee=M('zijin')->where("id<>0 and (type<>'充值' and type<>'退款') ".$map)->sum('jine'); $yueqtsr=M('shou')->where("addtime like '%".$riqi."%' ".$map)->sum('jine'); $nianqtsr=M('shou')->where("addtime like '%".$nian."%' ".$map)->sum('jine'); $qtsr=M('shou')->where("id<>0 ".$map)->sum('jine'); $yueticheng=M('ticheng')->where("addtime like '%".$riqi."%' ".$map)->sum('jine'); $nianticheng=M('ticheng')->where("addtime like '%".$nian."%' ".$map)->sum('jine'); $ticheng=M('ticheng')->where("id<>0 ".$map)->sum('jine'); $yuezhichu=M('fukuan')->where("addtime like '%".$riqi."%' ".$map)->sum('jine'); $nianzhichu=M('fukuan')->where("addtime like '%".$nian."%' ".$map)->sum('jine'); $zhichu=M('fukuan')->where("id<>0 ".$map)->sum('jine'); $yuemaoli=$yueyingyee+$yueqtsr-$yueticheng-$yuezhichu; $nianmaoli=$nianyingyee+$nianqtsr-$nianticheng-$nianzhichu; $maoli=$yingyee+$qtsr-$ticheng-$zhichu; $yuehysl=M('huiyuan')->where("addtime like '%".$riqi."%' ".$map)->count('id'); $nianhysl=M('huiyuan')->where("addtime like '%".$nian."%' ".$map)->count('id'); $hysl=M('huiyuan')->where("id<>0 ".$map)->count('id'); $yuejine=M('zijin')->where("addtime like '%".$riqi."%' and type='充值' ".$map)->sum('jine'); $nianjine=M('zijin')->where("addtime like '%".$nian."%' and type='充值' ".$map)->sum('jine'); $jine=M('zijin')->where("id<>0 and type='充值' ".$map)->sum('jine'); $yuejifen=M('zijin')->where("addtime like '%".$riqi."%' and type='退款' ".$map)->sum('jine'); $nianjifen=M('zijin')->where("addtime like '%".$nian."%' and type='退款' ".$map)->sum('jine'); $jifen=M('zijin')->where("id<>0 and type='退款' ".$map)->sum('jine');

{$shopname}营业状况表

单位:{$shopname}
查询日期:{$chaxun}
项目
行次
本月数
本年数
历史数
一、业务收入(营业额)1{$yueyingyee}{$nianyingyee}{$yingyee}
      加:其他业务收入2{$yueqtsr}{$nianqtsr}{$qtsr}
      减:业务成本(应付员工提成)4{$yueticheng}{$nianticheng}{$ticheng}
      减:费用支出(管理费用,工资(不含员工提成),房租,电话费等)5{$yuezhichu}{$nianzhichu}{$zhichu}
二、毛利润6{$yuemaoli}{$nianmaoli}{$maoli}
三、会员数量7{$yuehysl}{$nianhysl}{$hysl}
      充值8{$yuejine}{$nianjine}{$jine}
      退款9{$yuejifen}{$nianjifen}{$jifen}