|
@@ -775,6 +775,114 @@ function adminDeleteUser(){
|
|
|
return "/adminExecute";
|
|
|
}
|
|
|
|
|
|
+function adminInvoice(){
|
|
|
+ Doo::loadModel('staff');
|
|
|
+ $staff=new staff();
|
|
|
+ Doo::loadModel("invoiceManage");
|
|
|
+ $invoiceManage=new invoiceManage();
|
|
|
+
|
|
|
+ $data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
|
|
|
+ $list=$invoiceManage->find(array('asArray'=>true));
|
|
|
+
|
|
|
+ $execute=array('收款管理'=>'','发票审批'=>'','发票打印'=>'','发票邮寄'=>'','公司汇总查阅'=>'');
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $name=json_decode($value['staff']);
|
|
|
+ $staffString="";
|
|
|
+ if (!empty($name)){
|
|
|
+ foreach ($name as $k=>$v){
|
|
|
+
|
|
|
+ $staffString.="<span class='tagGroup'> ".$v[1].'<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delInvoiceManage/'.$v[0].'/'.$value['iid'].'\'" title="删除" class="icon-">k</a></span>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach ($execute as $k=>$v){
|
|
|
+ if ($k==$value['mold']){
|
|
|
+ $execute[$k]=$name=$staffString;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $data['invoice']=$execute;
|
|
|
+ $data['memu']="invoice";
|
|
|
+ $data['staff']=$this->staff;
|
|
|
+
|
|
|
+ $this->render ( "/admin/adminInvoice", $data );
|
|
|
+ }
|
|
|
+
|
|
|
+ function addInvoiceManage(){
|
|
|
+ $mold=$this->get_args('mold')?$this->get_args('mold'):"";
|
|
|
+ $staff=$this->get_args('staff')?$this->get_args('staff'):"";
|
|
|
+
|
|
|
+ if(!empty($mold)&&!empty($staff)){
|
|
|
+ Doo::loadModel("invoiceManage");
|
|
|
+ $execute=new invoiceManage();
|
|
|
+
|
|
|
+ $executeInfo=$execute->getOne(array('where'=>'mold ="'.$mold.'" ','asArray'=>true));
|
|
|
+ if (empty($executeInfo)){
|
|
|
+
|
|
|
+ $list=array();
|
|
|
+ foreach ($staff as $key=>$value){
|
|
|
+ $info=explode(":", $value);
|
|
|
+ array_push($list, $info);
|
|
|
+ }
|
|
|
+
|
|
|
+ $execute->mold=$mold;
|
|
|
+ $execute->staff=json_encode($list);
|
|
|
+
|
|
|
+ $execute->insert();
|
|
|
+ }else{
|
|
|
+ $list=json_decode($executeInfo['staff'],true);
|
|
|
+
|
|
|
+ foreach ($staff as $k=>$v){
|
|
|
+ $info=explode(":", $v);
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ if($value[1]==$info[1]){
|
|
|
+ unset($staff[$k]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach ($staff as $k=>$v){
|
|
|
+ $info=explode(":", $v);
|
|
|
+ array_push($list, $info);
|
|
|
+ }
|
|
|
+
|
|
|
+ $execute->staff=json_encode($list);
|
|
|
+ $execute->update(array('where'=>'iid = '.$executeInfo['iid']));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "/adminInvoice";
|
|
|
+ }
|
|
|
+
|
|
|
+ function delInvoiceManage(){
|
|
|
+ $uid=isset($this->params['uid'])&&is_numeric($this->params['uid'])?$this->params['uid']:0;
|
|
|
+ $iid=isset($this->params['iid'])&&is_numeric($this->params['iid'])?$this->params['iid']:0;
|
|
|
+
|
|
|
+ if(!empty($uid)&&!empty($iid)){
|
|
|
+ Doo::loadModel("invoiceManage");
|
|
|
+ $execute=new invoiceManage();
|
|
|
+
|
|
|
+ $executeInfo=$execute->getOne(array('where'=>'iid ="'.$iid.'" ','asArray'=>true));
|
|
|
+ if (empty($executeInfo))
|
|
|
+ return "/adminInvoice";
|
|
|
+
|
|
|
+ $ini=array();
|
|
|
+ $list=json_decode($executeInfo['staff'],true);
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+ if ($v[0]==$uid){
|
|
|
+ $ini=$list[$k];
|
|
|
+ unset($list[$k]);break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $execute->staff=json_encode($list);
|
|
|
+ $execute->update(array('where'=>'iid = '.$executeInfo['iid']));
|
|
|
+ }
|
|
|
+
|
|
|
+ return "/adminInvoice";
|
|
|
+ }
|
|
|
+
|
|
|
function ajaxRoleStaff(){
|
|
|
|
|
|
$name=$this->get_args('name')?$this->get_args('name'):"";
|