<?php
namespace app\index\controller;
use app\index\controller\Acl;
use app\index\model\Goodsclass;
use app\index\model\Often;
use app\index\model\Room;
class Main extends Acl{
public function index(){
$menu=db('menu')->order('sort asc')->select()->ToArray();
$menu=get_root_menu($menu);
$this->assign('menu',$menu);
$this->assign('sys_name',get_sys(['sys_name']));
$this->assign('user_info',user_info());
return $this->fetch();
}
public function home(){
$often=Often::select()->ToArray();
foreach ($often as $often_key=>$often_vo) {
if(isset($often_vo['root'])){
if(!get_root($often_vo['root'])){
unset($often[$often_key]);
}
}
}
$roomwarning_nums=0 $room=Room::with('goodsinfo')->where(auth('room',[]))->select();
foreach ($room as $room_vo) {
if(bccomp($room_vo['nums'],$room_vo['goodsinfo']['stocktip'],config('decimal'))==-1){
$roomwarning_nums++;
}
}
$sys=get_sys(['form_day','notice']);
$day_arr=sum_old_day($sys['form_day']);
$echarts_data=[
'purchase'=>get_echarts_info('purchaseclass','total',$day_arr),
'rpurchase'=>get_echarts_info('rpurchaseclass','total',$day_arr),
'sale'=>get_echarts_info('saleclass','total',$day_arr),
'cashier'=>get_echarts_info('cashierclass','total',$day_arr),
'itemorder'=>get_echarts_info('itemorderclass','total',$day_arr),
];
$this->assign('often',array_chunk($often,8));
$this->assign('sys',$sys);
$this->assign('account',db('account')->where(auth('account',[]))->sum('balance'));
$this->assign('customer',db('customer')->where(auth('customer',[]))->count());
$this->assign('supplier',db('supplier')->where(auth('supplier',[]))->count());
$this->assign('room',db('room')->where(auth('room',[]))->sum('nums'));
$this->assign('user',db('user')->where(auth('user',[]))->count());
$this->assign('roomwarning_nums',$roomwarning_nums);
$this->assign('day_arr',$day_arr);
$this->assign('echarts_data',$echarts_data);
return $this->fetch();
}
public function base_goods(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function room_goods(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function serve(){
return $this->fetch();
}
public function room(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function room_info(){
return $this->fetch();
}
public function room_warning(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function room_check(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function summary(){
return $this->fetch();
}
public function goods_profit(){
$goodsclass=Goodsclass::select();
if(!empty($goodsclass)){
$tree=new \org\tree();
$goodsclass=$tree::vTree($goodsclass) }
$this->assign('goodsclass',$goodsclass);
return $this->fetch();
}
public function bill_profit(){
return $this->fetch();
}
public function serial(){
return $this->fetch();
}
public function serial_info(){
return $this->fetch();
}
public function arrears(){
return $this->fetch();
}
public function about(){
$this->assign('now_ver',get_ver());
$this->assign('new_ver',new_ver());
echo $this->fetch();
}
}