mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-26 18:55:44 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
60
app/financebase/lib/finder/account/chart.php
Normal file
60
app/financebase/lib/finder/account/chart.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class financebase_finder_account_chart {
|
||||
|
||||
function __construct(){
|
||||
if(in_array($_REQUEST['action'], ['exportcnf', 'to_export', 'export'])){
|
||||
unset($this->column_edit);
|
||||
}
|
||||
}
|
||||
|
||||
var $column_edit = "操作";
|
||||
var $column_edit_order = "1";
|
||||
var $column_edit_width = "50";
|
||||
|
||||
function column_edit($row) {
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
// 检查编辑权限
|
||||
if (!kernel::single('desktop_user')->has_permission('shop_settlement_account_chart_edit')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$title = '编辑会计科目';
|
||||
if (!empty($row['account_code'])) {
|
||||
$title .= ' - ' . $row['account_code'];
|
||||
}
|
||||
$ret = '<a href="index.php?app=financebase&ctl=admin_shop_settlement_account_chart&act=setAccount&p[0]='.$row['id'].'&_finder[finder_id]=' . $finder_id . '&finder_id=' . $finder_id . '" target="dialog::{width:550,height:520,resizeable:false,title:\'' . $title . '\'}">编辑</a>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 添加操作日志功能
|
||||
public $detail_show_log = '操作记录';
|
||||
public function detail_show_log($account_id)
|
||||
{
|
||||
// 使用ome模块的read_log方法,与经销商品价格保持一致
|
||||
$omeLogMdl = app::get('ome')->model('operation_log');
|
||||
$logList = $omeLogMdl->read_log(array('obj_id' => $account_id, 'obj_type' => 'account_chart@financebase'), 0, -1);
|
||||
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
if ($logList) {
|
||||
foreach ($logList as $k => $v) {
|
||||
$logList[$k]['operate_time'] = date('Y-m-d H:i:s', $v['operate_time']);
|
||||
|
||||
// 检查操作类型,为编辑操作添加快照链接
|
||||
if (strpos($v['operation'], '编辑') !== false) {
|
||||
$logList[$k]['memo'] = "<a href='index.php?app=financebase&ctl=admin_shop_settlement_account_chart&act=show_history&p[0]={$v['log_id']}&finder_id={$finder_id}' onclick=\"window.open(this.href, '_blank', 'width=550,height=520'); return false;\">查看快照</a>";
|
||||
} else {
|
||||
// 其他操作(如新建)不显示快照链接,但保留原有的memo内容
|
||||
$logList[$k]['memo'] = $v['memo'] ?: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$render = app::get('financebase')->render();
|
||||
$render->pagedata['logs'] = $logList ?: array();
|
||||
return $render->fetch('finder/account/chart/operation_log.html');
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
class financebase_finder_bill_category_rules {
|
||||
|
||||
|
||||
var $addon_cols = 'account_id_plus,account_id_minus';
|
||||
var $col_prefix = ''; // 动态设置的前缀,用于addon_cols字段
|
||||
|
||||
var $column_edit = "操作";
|
||||
var $column_edit_width = "150";
|
||||
@@ -25,11 +26,74 @@ class financebase_finder_bill_category_rules {
|
||||
function column_edit($row) {
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
// 检查编辑权限
|
||||
if (!kernel::single('desktop_user')->has_permission('shop_settlement_rules_edit')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$ret = '<a href="index.php?app=financebase&ctl=admin_shop_settlement_rules&act=setCategory&p[0]='.$row['rule_id'].'&_finder[finder_id]=' . $finder_id . '&finder_id=' . $finder_id . '" target="dialog::{width:550,height:400,resizeable:false,title:\'编辑收支分类\'}">编辑</a>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 添加贷会计科目列
|
||||
public $column_account_id_plus = "贷会计科目";
|
||||
public $column_account_id_plus_width = 110;
|
||||
public $column_account_id_plus_order = 15;
|
||||
|
||||
// 添加借会计科目列
|
||||
public $column_account_id_minus = "借会计科目";
|
||||
public $column_account_id_minus_width = 110;
|
||||
public $column_account_id_minus_order = 16;
|
||||
|
||||
private function _getAccountCache()
|
||||
{
|
||||
static $accountCache;
|
||||
|
||||
if (!isset($accountCache)) {
|
||||
$accountObj = app::get('financebase')->model('account_chart');
|
||||
$accountList = $accountObj->getList('id,account,description,postingkey');
|
||||
$accountCache = array();
|
||||
foreach ($accountList as $account) {
|
||||
$accountCache[$account['id']] = '[' . $account['account'] . '-' . $account['postingkey'] . ']' . $account['description'];
|
||||
}
|
||||
}
|
||||
|
||||
return $accountCache;
|
||||
}
|
||||
|
||||
public function column_account_id_plus($row, $list)
|
||||
{
|
||||
if (empty($row[$this->col_prefix.'account_id_plus'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$accountCache = $this->_getAccountCache();
|
||||
|
||||
// 格式化显示
|
||||
if (isset($accountCache[$row[$this->col_prefix.'account_id_plus']])) {
|
||||
return $accountCache[$row[$this->col_prefix.'account_id_plus']];
|
||||
}
|
||||
|
||||
return $row[$this->col_prefix.'account_id_plus'];
|
||||
}
|
||||
|
||||
public function column_account_id_minus($row, $list)
|
||||
{
|
||||
if (empty($row[$this->col_prefix.'account_id_minus'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$accountCache = $this->_getAccountCache();
|
||||
|
||||
// 格式化显示
|
||||
if (isset($accountCache[$row[$this->col_prefix.'account_id_minus']])) {
|
||||
return $accountCache[$row[$this->col_prefix.'account_id_minus']];
|
||||
}
|
||||
|
||||
return $row[$this->col_prefix.'account_id_minus'];
|
||||
}
|
||||
|
||||
|
||||
var $column_platform = '平台规则设置(蓝色:已设置、红色:未设置)';
|
||||
var $column_platform_width = "500";
|
||||
@@ -39,7 +103,7 @@ class financebase_finder_bill_category_rules {
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
$oFunc = kernel::single('financebase_func');
|
||||
|
||||
$platform = $oFunc->getShopPlatform();
|
||||
$platform = $oFunc->getShopPlatform(true);
|
||||
|
||||
$ret = "";
|
||||
|
||||
@@ -57,7 +121,34 @@ class financebase_finder_bill_category_rules {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 添加操作日志功能
|
||||
public $detail_show_log = '操作记录';
|
||||
public function detail_show_log($rule_id)
|
||||
{
|
||||
// 使用ome模块的read_log方法,与经销商品价格保持一致
|
||||
$omeLogMdl = app::get('ome')->model('operation_log');
|
||||
$logList = $omeLogMdl->read_log(array('obj_id' => $rule_id, 'obj_type' => 'bill_category_rules@financebase'), 0, -1);
|
||||
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
if ($logList) {
|
||||
foreach ($logList as $k => $v) {
|
||||
$logList[$k]['operate_time'] = date('Y-m-d H:i:s', $v['operate_time']);
|
||||
|
||||
// 检查操作类型,为编辑操作添加快照链接
|
||||
if (strpos($v['operation'], '编辑') !== false) {
|
||||
$logList[$k]['memo'] = "<a href='index.php?app=financebase&ctl=admin_shop_settlement_rules&act=show_history&p[0]={$v['log_id']}&finder_id={$finder_id}' onclick=\"window.open(this.href, '_blank', 'width=801,height=570'); return false;\">查看快照</a>";
|
||||
} else {
|
||||
// 其他操作(如新建)不显示快照链接,但保留原有的memo内容
|
||||
$logList[$k]['memo'] = $v['memo'] ?: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$render = app::get('financebase')->render();
|
||||
$render->pagedata['logs'] = $logList ?: array();
|
||||
return $render->fetch('finder/bill/category/rules/operation_log.html');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
* ============================
|
||||
*/
|
||||
class financebase_finder_expenses_rule {
|
||||
public $addon_cols = 'rule_content';
|
||||
|
||||
public $column_edit = "操作";
|
||||
public $column_edit_width = "80";
|
||||
@@ -39,4 +40,27 @@ class financebase_finder_expenses_rule {
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
var $column_platform = '平台设置';
|
||||
var $column_platform_width = "500";
|
||||
var $column_platform_order = 20;
|
||||
function column_platform($row) {
|
||||
|
||||
$oFunc = kernel::single('financebase_func');
|
||||
|
||||
$platform = $oFunc->getShopPlatform();
|
||||
|
||||
$ret = [];
|
||||
|
||||
$row['rule_content'] = $row[$this->col_prefix.'rule_content'];
|
||||
|
||||
$rule_content = $row['rule_content'] ? json_decode($row['rule_content'],1) : array();
|
||||
foreach ($platform as $key => $value) {
|
||||
if(isset($rule_content[$key]) && $rule_content[$key]) {
|
||||
$ret[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return implode(',', $ret);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* ============================
|
||||
*/
|
||||
class financebase_finder_expenses_split {
|
||||
public $addon_cols = 'bm_id';
|
||||
public $addon_cols = 'bm_id,order_bn,shop_id';
|
||||
|
||||
public $column_skucode = "基础物料编码";
|
||||
public $column_skucode_width = "80";
|
||||
@@ -38,4 +38,135 @@ class financebase_finder_expenses_split {
|
||||
$bm = app::get('material')->model('basic_material')->db_dump(array('bm_id'=>$bmId), 'material_bn');
|
||||
return (string)$bm['material_bn'];
|
||||
}
|
||||
|
||||
public $column_verification_status = "核销状态";
|
||||
public $column_verification_status_width = "100";
|
||||
public function column_verification_status($row, $list) {
|
||||
$orderBn = $row[$this->col_prefix . 'order_bn'];
|
||||
if (empty($orderBn)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
// 批量查询优化:使用静态缓存确保整个列表只查询一次数据库
|
||||
static $verificationStatusCache;
|
||||
|
||||
if (!isset($verificationStatusCache)) {
|
||||
$verificationStatusCache = array();
|
||||
|
||||
// 从传入的list参数获取当前页面的所有订单号
|
||||
$orderBns = array();
|
||||
foreach ($list as $listRow) {
|
||||
$bn = $listRow[$this->col_prefix . 'order_bn'];
|
||||
if (!empty($bn)) {
|
||||
$orderBns[] = $bn;
|
||||
}
|
||||
}
|
||||
$orderBns = array_unique($orderBns);
|
||||
|
||||
if (!empty($orderBns)) {
|
||||
// 批量查询所有订单号的核销状态
|
||||
$monthlyReportItemsModel = app::get('finance')->model('monthly_report_items');
|
||||
$items = $monthlyReportItemsModel->getList(
|
||||
'order_bn,verification_status',
|
||||
array('order_bn' => $orderBns)
|
||||
);
|
||||
|
||||
// 构建缓存映射:order_bn => verification_status
|
||||
foreach ($items as $item) {
|
||||
$verificationStatusCache[$item['order_bn']] = $item['verification_status'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 从缓存中获取核销状态
|
||||
$verificationStatus = $verificationStatusCache[$orderBn] ?? null;
|
||||
|
||||
if (empty($verificationStatus)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$statusMap = array(
|
||||
'1' => '未核销',
|
||||
'2' => '已核销',
|
||||
);
|
||||
|
||||
return $statusMap[$verificationStatus] ?? '-';
|
||||
}
|
||||
|
||||
public $column_shop_name = "店铺名称";
|
||||
public $column_shop_name_width = "120";
|
||||
public $column_shop_name_order = 20;
|
||||
public function column_shop_name($row, $list) {
|
||||
$shopId = $row[$this->col_prefix . 'shop_id'];
|
||||
if (empty($shopId)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
// 批量查询优化:使用静态缓存确保整个列表只查询一次数据库
|
||||
static $shopCache;
|
||||
|
||||
if (!isset($shopCache)) {
|
||||
$shopCache = array();
|
||||
|
||||
// 从传入的list参数获取当前页面的所有店铺ID
|
||||
$shopIds = array();
|
||||
foreach ($list as $listRow) {
|
||||
$sid = $listRow[$this->col_prefix . 'shop_id'];
|
||||
if (!empty($sid)) {
|
||||
$shopIds[] = $sid;
|
||||
}
|
||||
}
|
||||
$shopIds = array_unique($shopIds);
|
||||
|
||||
if (!empty($shopIds)) {
|
||||
// 批量查询所有店铺信息
|
||||
$shopModel = app::get('ome')->model('shop');
|
||||
$shops = $shopModel->getList(
|
||||
'shop_id,name',
|
||||
array('shop_id' => $shopIds)
|
||||
);
|
||||
|
||||
// 构建缓存映射:shop_id => name
|
||||
foreach ($shops as $shop) {
|
||||
$shopCache[$shop['shop_id']] = $shop['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 从缓存中获取店铺名称
|
||||
return $shopCache[$shopId] ?? '-';
|
||||
}
|
||||
|
||||
public $column_platform = '平台规则设置(蓝色:已设置、红色:未设置)';
|
||||
public $column_platform_width = "500";
|
||||
public $column_platform_order = 21;
|
||||
public function column_platform($row) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
$oFunc = kernel::single('financebase_func');
|
||||
$platform = $oFunc->getShopPlatform();
|
||||
|
||||
$ret = "";
|
||||
|
||||
// 通过 bill_category 获取规则内容
|
||||
$ruleModel = app::get('financebase')->model('bill_category_rules');
|
||||
$ruleInfo = $ruleModel->getRow('rule_id,rule_content', array('bill_category' => $billCategory));
|
||||
|
||||
if (empty($ruleInfo)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$ruleId = $ruleInfo['rule_id'];
|
||||
$rule_content = $ruleInfo['rule_content'] ? json_decode($ruleInfo['rule_content'], 1) : array();
|
||||
foreach ($platform as $key => $value) {
|
||||
$color = (isset($rule_content[$key]) && $rule_content[$key]) ? 'blue' : 'red';
|
||||
$ret .= '<a style="color:'.$color.';" href="index.php?app=financebase&ctl=admin_shop_settlement_rules&act=setRule&p[0]='.$ruleId.'&p[1]='.$key.'&_finder[finder_id]=' . $finder_id . '&finder_id=' . $finder_id . '" target="_blank">'.$value.'</a> ';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* ============================
|
||||
*/
|
||||
class financebase_finder_expenses_unsplit {
|
||||
public $addon_cols = 'bill_category';
|
||||
public $addon_cols = 'bill_category,order_bn';
|
||||
|
||||
public $column_edit = "操作";
|
||||
public $column_edit_width = "80";
|
||||
@@ -40,4 +40,340 @@ class financebase_finder_expenses_unsplit {
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会计科目信息缓存
|
||||
* @param array $list 当前列表数据
|
||||
* @return array 返回 bill_category => account_info 的映射
|
||||
*/
|
||||
private function _getAccountInfoCache($list) {
|
||||
static $accountInfoCache;
|
||||
|
||||
if (!isset($accountInfoCache)) {
|
||||
$accountInfoCache = array();
|
||||
|
||||
// 收集所有 bill_category
|
||||
$billCategories = array();
|
||||
foreach ($list as $listRow) {
|
||||
$category = $listRow[$this->col_prefix . 'bill_category'];
|
||||
if (!empty($category)) {
|
||||
$billCategories[] = $category;
|
||||
}
|
||||
}
|
||||
$billCategories = array_unique($billCategories);
|
||||
|
||||
if (!empty($billCategories)) {
|
||||
// 批量查询 bill_category_rules 获取会计科目ID
|
||||
$ruleModel = app::get('financebase')->model('expenses_rule');
|
||||
$rules = $ruleModel->getList(
|
||||
'bill_category,account_id_plus,account_id_minus',
|
||||
array('bill_category' => $billCategories)
|
||||
);
|
||||
|
||||
// 收集所有会计科目ID
|
||||
$accountIds = array();
|
||||
foreach ($rules as $rule) {
|
||||
if (!empty($rule['account_id_plus'])) {
|
||||
$accountIds[] = $rule['account_id_plus'];
|
||||
}
|
||||
if (!empty($rule['account_id_minus'])) {
|
||||
$accountIds[] = $rule['account_id_minus'];
|
||||
}
|
||||
}
|
||||
$accountIds = array_unique($accountIds);
|
||||
|
||||
// 批量查询 account_chart 获取详细信息
|
||||
$accountChartModel = app::get('financebase')->model('account_chart');
|
||||
$accounts = array();
|
||||
if (!empty($accountIds)) {
|
||||
$accounts = $accountChartModel->getList(
|
||||
'id,account,postingkey,costcenter,tax_rate,customer',
|
||||
array('id' => $accountIds)
|
||||
);
|
||||
}
|
||||
|
||||
// 构建 account_id => account_info 映射
|
||||
$accountMap = array();
|
||||
foreach ($accounts as $account) {
|
||||
$accountMap[$account['id']] = $account;
|
||||
}
|
||||
|
||||
// 构建 bill_category => account_info 映射
|
||||
foreach ($rules as $rule) {
|
||||
$accountInfoCache[$rule['bill_category']] = array(
|
||||
'plus' => isset($accountMap[$rule['account_id_plus']]) ? $accountMap[$rule['account_id_plus']] : null,
|
||||
'minus' => isset($accountMap[$rule['account_id_minus']]) ? $accountMap[$rule['account_id_minus']] : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $accountInfoCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核销状态缓存
|
||||
* @param array $list 当前列表数据
|
||||
* @return array 返回 order_bn => verification_status 的映射
|
||||
*/
|
||||
private function _getVerificationStatusCache($list) {
|
||||
static $verificationStatusCache;
|
||||
|
||||
if (!isset($verificationStatusCache)) {
|
||||
$verificationStatusCache = array();
|
||||
|
||||
// 收集所有订单号
|
||||
$orderBns = array();
|
||||
foreach ($list as $listRow) {
|
||||
$bn = $listRow[$this->col_prefix . 'order_bn'];
|
||||
if (!empty($bn)) {
|
||||
$orderBns[] = $bn;
|
||||
}
|
||||
}
|
||||
$orderBns = array_unique($orderBns);
|
||||
|
||||
if (!empty($orderBns)) {
|
||||
// 批量查询所有订单号的核销状态
|
||||
$monthlyReportItemsModel = app::get('finance')->model('monthly_report_items');
|
||||
$items = $monthlyReportItemsModel->getList(
|
||||
'order_bn,verification_status',
|
||||
array('order_bn' => $orderBns)
|
||||
);
|
||||
|
||||
// 构建缓存映射:order_bn => verification_status
|
||||
foreach ($items as $item) {
|
||||
$verificationStatusCache[$item['order_bn']] = $item['verification_status'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $verificationStatusCache;
|
||||
}
|
||||
|
||||
// 贷方会计科目
|
||||
public $column_account_plus = "贷方会计科目";
|
||||
public $column_account_plus_width = "120";
|
||||
public $column_account_plus_order = 100;
|
||||
public function column_account_plus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['plus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['plus']['account'] ?: '-';
|
||||
}
|
||||
|
||||
// 借方会计科目
|
||||
public $column_account_minus = "借方会计科目";
|
||||
public $column_account_minus_width = "120";
|
||||
public $column_account_minus_order = 101;
|
||||
public function column_account_minus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['minus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['minus']['account'] ?: '-';
|
||||
}
|
||||
|
||||
// 贷方记账码
|
||||
public $column_postingkey_plus = "贷方记账码";
|
||||
public $column_postingkey_plus_width = "100";
|
||||
public $column_postingkey_plus_order = 102;
|
||||
public function column_postingkey_plus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['plus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['plus']['postingkey'] ?: '-';
|
||||
}
|
||||
|
||||
// 借方记账码
|
||||
public $column_postingkey_minus = "借方记账码";
|
||||
public $column_postingkey_minus_width = "100";
|
||||
public $column_postingkey_minus_order = 103;
|
||||
public function column_postingkey_minus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['minus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['minus']['postingkey'] ?: '-';
|
||||
}
|
||||
|
||||
// 贷方成本中心
|
||||
public $column_costcenter_plus = "贷方成本中心";
|
||||
public $column_costcenter_plus_width = "100";
|
||||
public $column_costcenter_plus_order = 104;
|
||||
public function column_costcenter_plus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['plus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['plus']['costcenter'] ?: '-';
|
||||
}
|
||||
|
||||
// 借方成本中心
|
||||
public $column_costcenter_minus = "借方成本中心";
|
||||
public $column_costcenter_minus_width = "100";
|
||||
public $column_costcenter_minus_order = 105;
|
||||
public function column_costcenter_minus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['minus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['minus']['costcenter'] ?: '-';
|
||||
}
|
||||
|
||||
// 贷方税率
|
||||
public $column_tax_rate_plus = "贷方税率";
|
||||
public $column_tax_rate_plus_width = "100";
|
||||
public $column_tax_rate_plus_order = 106;
|
||||
public function column_tax_rate_plus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['plus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$taxRate = $accountInfo['plus']['tax_rate'];
|
||||
return $taxRate !== null && $taxRate !== '' ? $taxRate : '-';
|
||||
}
|
||||
|
||||
// 借方税率
|
||||
public $column_tax_rate_minus = "借方税率";
|
||||
public $column_tax_rate_minus_width = "100";
|
||||
public $column_tax_rate_minus_order = 107;
|
||||
public function column_tax_rate_minus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['minus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$taxRate = $accountInfo['minus']['tax_rate'];
|
||||
return $taxRate !== null && $taxRate !== '' ? $taxRate : '-';
|
||||
}
|
||||
|
||||
// 贷方客户
|
||||
public $column_customer_plus = "贷方客户";
|
||||
public $column_customer_plus_width = "100";
|
||||
public $column_customer_plus_order = 108;
|
||||
public function column_customer_plus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['plus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['plus']['customer'] ?: '-';
|
||||
}
|
||||
|
||||
// 借方客户
|
||||
public $column_customer_minus = "借方客户";
|
||||
public $column_customer_minus_width = "100";
|
||||
public $column_customer_minus_order = 109;
|
||||
public function column_customer_minus($row, $list) {
|
||||
$billCategory = $row[$this->col_prefix . 'bill_category'];
|
||||
if (empty($billCategory)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$accountInfoCache = $this->_getAccountInfoCache($list);
|
||||
$accountInfo = isset($accountInfoCache[$billCategory]) ? $accountInfoCache[$billCategory] : null;
|
||||
|
||||
if (empty($accountInfo) || empty($accountInfo['minus'])) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return $accountInfo['minus']['customer'] ?: '-';
|
||||
}
|
||||
|
||||
// 核销状态
|
||||
public $column_verification_status = "核销状态";
|
||||
public $column_verification_status_width = "100";
|
||||
public $column_verification_status_order = 110;
|
||||
public function column_verification_status($row, $list) {
|
||||
$orderBn = $row[$this->col_prefix . 'order_bn'];
|
||||
if (empty($orderBn)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$verificationStatusCache = $this->_getVerificationStatusCache($list);
|
||||
$verificationStatus = isset($verificationStatusCache[$orderBn]) ? $verificationStatusCache[$orderBn] : null;
|
||||
|
||||
if (empty($verificationStatus)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$statusMap = array(
|
||||
'1' => '未核销',
|
||||
'2' => '已核销',
|
||||
);
|
||||
|
||||
return isset($statusMap[$verificationStatus]) ? $statusMap[$verificationStatus] : '-';
|
||||
}
|
||||
}
|
||||
117
app/financebase/lib/finder/gap.php
Normal file
117
app/financebase/lib/finder/gap.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
class financebase_finder_gap {
|
||||
|
||||
function __construct(){
|
||||
if(in_array($_REQUEST['action'], ['exportcnf', 'to_export', 'export'])){
|
||||
unset($this->column_edit);
|
||||
}
|
||||
}
|
||||
|
||||
var $addon_cols = 'account_id_plus,account_id_minus';
|
||||
var $col_prefix = ''; // 动态设置的前缀,用于addon_cols字段
|
||||
|
||||
// 添加贷会计科目列
|
||||
public $column_account_id_plus = "贷会计科目";
|
||||
public $column_account_id_plus_width = 110;
|
||||
public $column_account_id_plus_order = 20;
|
||||
|
||||
// 添加借会计科目列
|
||||
public $column_account_id_minus = "借会计科目";
|
||||
public $column_account_id_minus_width = 110;
|
||||
public $column_account_id_minus_order = 22;
|
||||
|
||||
var $column_edit = "操作";
|
||||
var $column_edit_order = "1";
|
||||
var $column_edit_width = "50";
|
||||
|
||||
function column_edit($row) {
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
// 检查编辑权限
|
||||
if (!kernel::single('desktop_user')->has_permission('shop_settlement_gap_edit')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$ret = '<a href="index.php?app=financebase&ctl=admin_shop_settlement_gap&act=setGap&p[0]='.$row['id'].'&_finder[finder_id]=' . $finder_id . '&finder_id=' . $finder_id . '" target="dialog::{width:600,height:400,resizeable:false,title:\'编辑差异类型\'}">编辑</a>';
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function _getAccountCache()
|
||||
{
|
||||
static $accountCache;
|
||||
|
||||
if (!isset($accountCache)) {
|
||||
$accountObj = app::get('financebase')->model('account_chart');
|
||||
$accountList = $accountObj->getList('id,account,description,postingkey');
|
||||
$accountCache = array();
|
||||
foreach ($accountList as $account) {
|
||||
$accountCache[$account['id']] = '[' . $account['account'] . '-' . $account['postingkey'] . ']' . $account['description'];
|
||||
}
|
||||
}
|
||||
|
||||
return $accountCache;
|
||||
}
|
||||
|
||||
public function column_account_id_plus($row, $list)
|
||||
{
|
||||
if (empty($row[$this->col_prefix.'account_id_plus'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$accountCache = $this->_getAccountCache();
|
||||
|
||||
// 格式化显示
|
||||
if (isset($accountCache[$row[$this->col_prefix.'account_id_plus']])) {
|
||||
return $accountCache[$row[$this->col_prefix.'account_id_plus']];
|
||||
}
|
||||
|
||||
return $row[$this->col_prefix.'account_id_plus'];
|
||||
}
|
||||
|
||||
public function column_account_id_minus($row, $list)
|
||||
{
|
||||
if (empty($row[$this->col_prefix.'account_id_minus'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$accountCache = $this->_getAccountCache();
|
||||
|
||||
// 格式化显示
|
||||
if (isset($accountCache[$row[$this->col_prefix.'account_id_minus']])) {
|
||||
return $accountCache[$row[$this->col_prefix.'account_id_minus']];
|
||||
}
|
||||
|
||||
return $row[$this->col_prefix.'account_id_minus'];
|
||||
}
|
||||
|
||||
// 添加操作日志功能
|
||||
public $detail_show_log = '操作记录';
|
||||
public function detail_show_log($gap_id)
|
||||
{
|
||||
// 使用ome模块的read_log方法,与会计科目保持一致
|
||||
$omeLogMdl = app::get('ome')->model('operation_log');
|
||||
$logList = $omeLogMdl->read_log(array('obj_id' => $gap_id, 'obj_type' => 'gap@financebase'), 0, -1);
|
||||
|
||||
$finder_id = $_GET['_finder']['finder_id'];
|
||||
|
||||
if ($logList) {
|
||||
foreach ($logList as $k => $v) {
|
||||
$logList[$k]['operate_time'] = date('Y-m-d H:i:s', $v['operate_time']);
|
||||
|
||||
// 检查操作类型,为编辑操作添加快照链接
|
||||
if (strpos($v['operation'], '编辑') !== false) {
|
||||
$logList[$k]['memo'] = "<a href='index.php?app=financebase&ctl=admin_shop_settlement_gap&act=show_history&p[0]={$v['log_id']}&finder_id={$finder_id}' onclick=\"window.open(this.href, '_blank', 'width=801,height=570'); return false;\">查看快照</a>";
|
||||
} else {
|
||||
// 其他操作(如新建)不显示快照链接,但保留原有的memo内容
|
||||
$logList[$k]['memo'] = $v['memo'] ?: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$render = app::get('financebase')->render();
|
||||
$render->pagedata['logs'] = $logList ?: array();
|
||||
return $render->fetch('finder/gap/operation_log.html');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user