'/index.php/Retail/SAdvancePayment/AdvanceOperation', 'AdvanceInfo'=>'/index.php/Retail/SAdvancePayment/record', 'exportOperation'=>'/index.php/Retail/SAdvancePayment/export', ); $authArr = checkFunction($arr); $this->assign('authArr',$authArr); $this->assign('showPrice',self::$showPrice); $this->assign('identity',self::$identity); $this->assign("global_store_jurisdiction",self::$global_store_jurisdiction); $this->display(); } public function AdvanceList() { $merchant_id = session("ls_userinfo")['merchantid']; $store_id = session("storeid"); $data = I("post."); $supplier_name = $data['supplier_name']; $page = $data['page']; $limit = $data['limit']; if(!empty($supplier_name)){ $where['supplier_name | linkman'] = array('like',"%".$supplier_name."%"); } $where['merchantid'] = $merchant_id; $where['store_id'] = $store_id; $where['status'] = 1; $res = A("Api/Inventory")->StoreAdvanceList($where,$page,$limit,"id,supplier_name,linkman,phone,address,advance_money"); $this->ajaxReturn($res); } /*预付款操作 * @param type 1增加 减少 */ public function AdvanceOperation() { $merchant_id = session("ls_userinfo")['merchantid']; $store_id = session("storeid"); $operator_id = session("jurisdiction_user")['id']; $data = I("post."); $res = A("Api/Inventory")->StoreAdvanceOperation($data,$merchant_id,$store_id,$operator_id); if($res['status']==1){ //操作日志记录 if($data['type']==1){ $msg='增加预付款'; }else{ $msg='减少预付款'; } $source = 0;//请求来源: 0pc系统 1小助手 $type = 4;//平台:1合伙人端 2代理商端 3商户端 4门店端 $request_data = json_encode($_POST);//请求参数 json数据 $desc = '预付款操作:'.$msg;//操作行为描述 action_log($source,$type,$request_data,$desc); //end } $this->ajaxReturn($res); } //记录 public function record() { $SAdvanceModel = D("SAdvancePayment"); $merchant_id = session("ls_userinfo")['merchantid']; $store_id = session("storeid"); $data = I("post."); $supplier_id = $data['supplier_id']; $page = $data['page']; $limit = $data['limit']; $where[$SAdvanceModel::SUPPLIER_ID] = $supplier_id; $where[$SAdvanceModel::MERCHANT_ID] = $merchant_id; $where[$SAdvanceModel::STORE_ID] = $store_id; $res = A("Api/Inventory")->StoreRecord($where,$page,$limit,"*"); $this->ajaxReturn($res); } public function export() { $merchant_id = session("ls_userinfo")['merchantid']; $store_id = session("storeid"); $data = I("post."); $supplier_name = $data['supplier_name']; if(!empty($supplier_name)){ $where['supplier_name | linkman'] = array('like',"%".$supplier_name."%"); } $where['store_id'] = $store_id; $where['merchantid'] = $merchant_id; $where['status'] = 1; $advanceList = D("SSupplier")->getSelect($where,$page='',$limit='',"id,supplier_name,linkman,phone,address,advance_money"); if($advanceList){ foreach ($advanceList as $key=>&$val){ $val['index'] = $key + 1; $val['advance_money'] = round($val['advance_money'],2); } } $advanceList = $advanceList?$advanceList:array(); $fileds_name = "预付款导出"; $arr = array( array('index',"序号"), array('supplier_name',"供货商"), array("linkman","联系人"), array("phone","手机号"), array("address","地址"), array("advance_money","预付款金额") ); $str = $fileds_name.",导出日期为".date("Y-m-d H:i:s",time()); getExcel($fileds_name, $arr, $advanceList, $str); } }