mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-18 03:15:33 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
@@ -116,11 +116,72 @@ abstract class financebase_expenses_sku_abstract {
|
||||
$className = explode('_', $className);
|
||||
$this->type = $className[2];
|
||||
$this->rule = $className[3];
|
||||
$expensesSplitModel = app::get('financebase')->model('expenses_split');
|
||||
$this->_dealCombinationItems($skuList);
|
||||
$porth = $this->_getPorthValue($skuList);
|
||||
if(empty($porth)) {
|
||||
return array(false, $this->failMsg);
|
||||
}
|
||||
|
||||
// 获取会计科目和税率信息
|
||||
$accountInfo = array(
|
||||
'account_id_plus' => null,
|
||||
'account_id_minus' => null,
|
||||
'tax_rate_plus' => 0,
|
||||
'tax_rate_minus' => 0,
|
||||
'postingkey_plus' => '',
|
||||
'postingkey_minus' => '',
|
||||
'costcenter_plus' => '',
|
||||
'costcenter_minus' => '',
|
||||
'customer_plus' => '',
|
||||
'customer_minus' => '',
|
||||
);
|
||||
if (!empty($skuList['bill']['bill_category'])) {
|
||||
$ruleModel = app::get('financebase')->model('expenses_rule');
|
||||
$ruleData = $ruleModel->db_dump(
|
||||
array('bill_category' => $skuList['bill']['bill_category']),
|
||||
'account_id_plus,account_id_minus'
|
||||
);
|
||||
if ($ruleData) {
|
||||
$accountInfo['account_id_plus'] = $ruleData['account_id_plus'];
|
||||
$accountInfo['account_id_minus'] = $ruleData['account_id_minus'];
|
||||
|
||||
$accountChartModel = app::get('financebase')->model('account_chart');
|
||||
|
||||
// 如果有贷会计科目,获取税率、记账码、成本中心、客户信息
|
||||
if ($ruleData['account_id_plus']) {
|
||||
$accountData = $accountChartModel->db_dump(
|
||||
array('id' => $ruleData['account_id_plus']),
|
||||
'tax_rate,postingkey,costcenter,customer'
|
||||
);
|
||||
if ($accountData) {
|
||||
if ($accountData['tax_rate']) {
|
||||
$accountInfo['tax_rate_plus'] = $accountData['tax_rate'];
|
||||
}
|
||||
$accountInfo['postingkey_plus'] = $accountData['postingkey'] ?? '';
|
||||
$accountInfo['costcenter_plus'] = $accountData['costcenter'] ?? '';
|
||||
$accountInfo['customer_plus'] = $accountData['customer'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有借会计科目,获取税率、记账码、成本中心、客户信息
|
||||
if ($ruleData['account_id_minus']) {
|
||||
$accountData = $accountChartModel->db_dump(
|
||||
array('id' => $ruleData['account_id_minus']),
|
||||
'tax_rate,postingkey,costcenter,customer'
|
||||
);
|
||||
if ($accountData) {
|
||||
if ($accountData['tax_rate']) {
|
||||
$accountInfo['tax_rate_minus'] = $accountData['tax_rate'];
|
||||
}
|
||||
$accountInfo['postingkey_minus'] = $accountData['postingkey'] ?? '';
|
||||
$accountInfo['costcenter_minus'] = $accountData['costcenter'] ?? '';
|
||||
$accountInfo['customer_minus'] = $accountData['customer'] ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$time = $time ? : time();
|
||||
$expensesSplit = array();
|
||||
$hasPorth = false;
|
||||
@@ -129,6 +190,7 @@ abstract class financebase_expenses_sku_abstract {
|
||||
$hasPorth = true;
|
||||
}
|
||||
$expensesSplit[] = array(
|
||||
'split_bn' => $expensesSplitModel->gen_id(),
|
||||
'bm_id' => $v['bm_id'],
|
||||
'bill_id' => $skuList['bill']['id'],
|
||||
'parent_id' => $skuList['parent_id'],
|
||||
@@ -141,13 +203,26 @@ abstract class financebase_expenses_sku_abstract {
|
||||
'split_rule' => $this->rule,
|
||||
'porth' => $porth[$v['bm_id']],
|
||||
'shop_id' => $skuList['bill']['shop_id'],
|
||||
'account_id_plus' => $accountInfo['account_id_plus'],
|
||||
'account_id_minus' => $accountInfo['account_id_minus'],
|
||||
'tax_rate_plus' => $accountInfo['tax_rate_plus'],
|
||||
'tax_rate_minus' => $accountInfo['tax_rate_minus'],
|
||||
'tax_amount_plus' => 0, // 将在计算money后更新
|
||||
'tax_amount_minus' => 0, // 将在计算money后更新
|
||||
'order_bn' => $skuList['bill']['order_bn'] ?? '',
|
||||
'financial_no' => $skuList['bill']['financial_no'] ?? '',
|
||||
'postingkey_plus' => $accountInfo['postingkey_plus'],
|
||||
'postingkey_minus' => $accountInfo['postingkey_minus'],
|
||||
'costcenter_plus' => $accountInfo['costcenter_plus'],
|
||||
'costcenter_minus' => $accountInfo['costcenter_minus'],
|
||||
'customer_plus' => $accountInfo['customer_plus'],
|
||||
'customer_minus' => $accountInfo['customer_minus'],
|
||||
);
|
||||
}
|
||||
if(!$hasPorth) {
|
||||
return array(false, $this->failMsg);
|
||||
}
|
||||
if($skuList['ids']) {
|
||||
$expensesSplitModel = app::get('financebase')->model('expenses_split');
|
||||
$olds = $expensesSplitModel->db_dump(['bill_id'=>$skuList['bill']['id']]);
|
||||
try{
|
||||
$splitStatus = $olds ? '2' : '1';
|
||||
@@ -160,7 +235,20 @@ abstract class financebase_expenses_sku_abstract {
|
||||
'porth_field' => 'porth',
|
||||
);
|
||||
$expensesSplit = kernel::single('ome_order')->calculate_part_porth($expensesSplit, $options, 5);
|
||||
$expensesSplitModel = app::get('financebase')->model('expenses_split');
|
||||
|
||||
// 计算税金
|
||||
foreach ($expensesSplit as &$item) {
|
||||
// 计算贷方税金
|
||||
if ($accountInfo['tax_rate_plus'] > 0) {
|
||||
$item['tax_amount_plus'] = round($item['money'] * $accountInfo['tax_rate_plus'], 5);
|
||||
}
|
||||
// 计算借方税金
|
||||
if ($accountInfo['tax_rate_minus'] > 0) {
|
||||
$item['tax_amount_minus'] = round($item['money'] * $accountInfo['tax_rate_minus'], 5);
|
||||
}
|
||||
}
|
||||
unset($item);
|
||||
|
||||
$sql = ome_func::get_insert_sql($expensesSplitModel, $expensesSplit);
|
||||
$expensesSplitModel->db->exec($sql);
|
||||
return array(true, '拆分完成');
|
||||
|
||||
Reference in New Issue
Block a user