162 行
5.1 KiB
PHP
可执行文件
162 行
5.1 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Retail\Controller;
|
||
|
||
use Common\Business\PurchasePayable;
|
||
use Common\Model\RetailGoodsModel;
|
||
use Common\Model\RetailSellModel;
|
||
use Common\Model\SPurchaseGoodsModel;
|
||
use Common\Model\SSaleMGoodsModel;
|
||
use Think\Controller;
|
||
|
||
//[1.5.46]
|
||
|
||
/**
|
||
* 门店采购资金管理
|
||
* Class SPurchasePayableController
|
||
* @package Retail\Controller
|
||
*/
|
||
class SPurchasePayableController extends BaseController
|
||
{
|
||
public function index()
|
||
{
|
||
$arr = array(
|
||
'exportOperation' => '/index.php/Retail/SPurchasePayable/export',
|
||
'payment' => '/index.php/Retail/SPurchasePayable/supplierInfo',
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$merchant_id = session("ls_userinfo")['merchantid'];
|
||
$store_id = session("storeid");
|
||
$supplier_type = session('ls_userinfo')['supplier_type'];
|
||
$supplier = D("SSupplier")->getSelect(array('merchant_id' => $merchant_id, 'store_id' => $store_id, 'status' => 1), $page = '', $limit = '', "id,supplier_name");
|
||
$this->assign('supplier', json_encode($supplier));
|
||
$this->assign('supplier_type', $supplier_type);
|
||
$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 PayableList()
|
||
{
|
||
$data = I('post.');
|
||
$data['user_type'] = 2;
|
||
$data['store_id'] = session('storeid');
|
||
$data['merchant_id'] = session('ls_userinfo')['merchantid'];
|
||
$PurchasePayableClass = new PurchasePayable();
|
||
$result = $PurchasePayableClass->payableList($data);
|
||
$this->ajaxReturn($result);
|
||
}
|
||
|
||
|
||
/**
|
||
* 采购应付款统计
|
||
*/
|
||
public function PayableTotal()
|
||
{
|
||
$data = I('post.');
|
||
$data['user_type'] = 2;
|
||
$data['store_id'] = session('storeid');
|
||
$data['merchant_id'] = session('ls_userinfo')['merchantid'];
|
||
$PurchasePayableClass = new PurchasePayable();
|
||
$result = $PurchasePayableClass->payableTotal($data);
|
||
$this->ajaxReturn($result);
|
||
}
|
||
|
||
|
||
//供货商
|
||
public function supplierInfo()
|
||
{
|
||
$supplier_id = I("post.supplier_id");
|
||
$res = A("Api/Inventory")->StoreSupplierInfo($supplier_id);
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
//付款操作
|
||
public function payment()
|
||
{
|
||
$merchant_id = session("ls_userinfo")['merchantid'];
|
||
$store_id = session("storeid");
|
||
$operator_id = session("jurisdiction_user")['id'];
|
||
$data = I("post.");
|
||
$res = A("Api/Inventory")->StorePayment($data, $merchant_id, $store_id, $operator_id);
|
||
if ($res['status'] == 1) {
|
||
//操作日志记录
|
||
$source = 0;//请求来源: 0pc系统 1小助手
|
||
$type = 4;//平台:1合伙人端 2代理商端 3商户端 4门店端
|
||
$request_data = json_encode($_POST);//请求参数 json数据
|
||
$desc = '采购付款操做';//操作行为描述
|
||
action_log($source, $type, $request_data, $desc);
|
||
}
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
/**
|
||
* 寄售供货商销售明细
|
||
*/
|
||
public function sellList()
|
||
{
|
||
$store_id = session("storeid");
|
||
$purchase_model = new SPurchaseGoodsModel();
|
||
$id = I("post.id");
|
||
$page = I('post.page');
|
||
$limit = I('post.limit');
|
||
$content = I('post.content');
|
||
$where = array(
|
||
'purchase_order_id' => $id,
|
||
'store_id' => $store_id,
|
||
);
|
||
if (!empty($content)) {
|
||
$where['goods_name|goods_number|sku_goods_number'] = array('like','%'.$content.'%');
|
||
}
|
||
$parameter = array(
|
||
'where' => $where,
|
||
'page' => $page,
|
||
'limit' => $limit
|
||
);
|
||
$list = $purchase_model->getList($parameter);
|
||
if (!empty($list)) {
|
||
$count = $purchase_model->getListCount($parameter);
|
||
$parameter = array(
|
||
'list'=>$list,
|
||
'store_id'=>$store_id,
|
||
'id'=>$id
|
||
);
|
||
$list = $purchase_model->handleList($parameter);
|
||
}
|
||
$res = array(
|
||
'status' => 1,
|
||
'msg' => '查询成功',
|
||
'data' => array(
|
||
'list' => $list,
|
||
'count' => $count ? $count : 0
|
||
)
|
||
);
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
/**
|
||
* 采购应付款导出
|
||
* @throws \PHPExcel_Exception
|
||
* @throws \PHPExcel_Reader_Exception
|
||
* @throws \PHPExcel_Writer_Exception
|
||
*/
|
||
public function export()
|
||
{
|
||
$data = I('get.');
|
||
$data['user_type'] = 2;
|
||
$data['store_id'] = session('storeid');
|
||
$data['merchant_id'] = session('merchant_userinfo')['id'];
|
||
$PurchasePayableClass = new PurchasePayable();
|
||
$PurchasePayableClass->payableListExport($data);
|
||
}
|
||
|
||
} |