parent
2418516c49
commit
eebbdf279e
|
@ -42,7 +42,9 @@
|
|||
- 完成了基本报表,由于时间久远暂无自定义功能
|
||||
- [x] 仪表盘自定义
|
||||
- 仪表盘支持简单的自定义、如快捷菜单、信息提示块、部件等
|
||||
|
||||
- [ ] 新角色权限(支持多角色,设定数据权限)
|
||||
- [ ] 新销售组
|
||||
- [ ] 新工作流程
|
||||
- [ ] 新表单设计器
|
||||
- [ ] 微信端h5(采用uniapp)
|
||||
|
|
|
@ -203,7 +203,7 @@ class ApproachController extends WorkflowController
|
|||
approach.customer_id,
|
||||
customer_id_customer.region_id,
|
||||
approach_market.name as market_name,
|
||||
customer_id_region_id_customer_region.name as region_name,
|
||||
region_id_customer_region.name as region_name,
|
||||
customer_id_customer.code as customer_code,
|
||||
customer_id_customer.name as customer_name,
|
||||
customer_id_customer.warehouse_contact,
|
||||
|
|
|
@ -44,7 +44,7 @@ var params = JSON.parse('{{json_encode($query)}}');
|
|||
{cellClass:'text-center', field: 'status', cellRenderer: 'htmlCellRenderer', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 120},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售团队', width: 120},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售组', width: 120},
|
||||
{cellClass:'text-right',field:'barcode_cast', headerName: '申请费用', width: 100},
|
||||
{cellClass:'text-right',field:'apply2_money', headerName: '批复费用', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
|
|
|
@ -38,7 +38,7 @@ var params = JSON.parse('{{json_encode($query)}}');
|
|||
{cellClass:'text-center', field: 'status', cellRenderer: 'htmlCellRenderer', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 120},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售团队', width: 120},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售组', width: 120},
|
||||
{cellClass:'text-right',field:'barcode_cast', headerName: '申请费用', width: 100},
|
||||
{cellClass:'text-right',field:'apply2_money', headerName: '批复费用', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
|
|
|
@ -148,8 +148,6 @@ class BusinessController extends DefaultController
|
|||
|
||||
$user = User::find($gets['user_id']);
|
||||
|
||||
NotificationService::sms([$gets['contacts_phone']], '感谢您对川南公司的关注', '负责您的业务人员是'.$user['name'].',电话'.$user['phone'].'。您可与其沟通或登陆www.cnnzfood.com');
|
||||
|
||||
return $this->json('恭喜你,操作成功。', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ class RegionTaskController extends AuditController
|
|||
],[
|
||||
'form_type' =>'dialog',
|
||||
'field' => 'region_id',
|
||||
'name' => '销售团队',
|
||||
'name' => '销售组',
|
||||
'options' => ['url' => 'customer/region/dialog', 'query' => ['layer' => 3]]
|
||||
],
|
||||
], 'model');
|
||||
|
|
|
@ -13,12 +13,12 @@ use Gdoo\Customer\Services\CustomerService;
|
|||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class AccountReportController extends DefaultController
|
||||
class ReportController extends DefaultController
|
||||
{
|
||||
public $permission = [];
|
||||
|
||||
// 客户对账单
|
||||
public function indexAction()
|
||||
public function accountStatementAction()
|
||||
{
|
||||
$sdate = date('Y-01-01');
|
||||
$edate = date('Y-m-d');
|
||||
|
@ -67,7 +67,7 @@ class AccountReportController extends DefaultController
|
|||
$json = collect();
|
||||
$one = [];
|
||||
|
||||
// 获取用友数据
|
||||
// 获取外部接口数据
|
||||
$res = plugin_sync_api('acclist/code/'.$taxs->implode('code', ',').'/start_dt/'.$start_dt.'/end_dt/'.$end_dt);
|
||||
if (count($res['data'])) {
|
||||
// 获取初期余额
|
|
@ -132,7 +132,7 @@ class TaskController extends AuditController
|
|||
],[
|
||||
'form_type' =>'dialog',
|
||||
'field' => 'region_id',
|
||||
'name' => '销售团队',
|
||||
'name' => '销售组',
|
||||
'options' => ['url' => 'customer/region/dialog', 'query' => ['layer' => 3]]
|
||||
],
|
||||
], 'model');
|
||||
|
|
|
@ -60,16 +60,6 @@ class CustomerApplyHook
|
|||
bank_address
|
||||
')->first();
|
||||
|
||||
// 自动处理区域
|
||||
if ($apply['region_id']) {
|
||||
$regions = DB::table('customer_region')->get()->keyBy('id');
|
||||
$region1 = $regions[$apply['region_id']];
|
||||
$region2 = $regions[$region1['parent_id']];
|
||||
$region3 = $regions[$region2['parent_id']];
|
||||
$apply['region2_id'] = $region2['id'];
|
||||
$apply['region3_id'] = $region3['id'];
|
||||
}
|
||||
|
||||
// 新建客户
|
||||
$customer = new Customer;
|
||||
$customer->fill($apply);
|
||||
|
@ -113,7 +103,7 @@ class CustomerApplyHook
|
|||
$_apply->code = $customer['code'];
|
||||
$_apply->save();
|
||||
|
||||
// 客户档案写入用友
|
||||
// 客户档案写入外部接口
|
||||
$department = DB::table('department')->where('id', $customer['department_id'])->first();
|
||||
$class = DB::table('customer_class')->where('id', $customer['class_id'])->first();
|
||||
$customer['class_code'] = $class['code'];
|
||||
|
|
|
@ -40,16 +40,6 @@ class CustomerHook
|
|||
}
|
||||
$user->fill($_user)->save();
|
||||
$master['user_id'] = $user->id;
|
||||
|
||||
// 自动处理区域
|
||||
if ($master['region_id']) {
|
||||
$regions = DB::table('customer_region')->get()->keyBy('id');
|
||||
$region1 = $regions[$master['region_id']];
|
||||
$region2 = $regions[$region1['parent_id']];
|
||||
$region3 = $regions[$region2['parent_id']];
|
||||
$master['region2_id'] = $region2['id'];
|
||||
$master['region3_id'] = $region3['id'];
|
||||
}
|
||||
$params['master'] = $master;
|
||||
|
||||
return $params;
|
||||
|
@ -78,7 +68,7 @@ class CustomerHook
|
|||
'status' => 1,
|
||||
]);
|
||||
|
||||
// 客户档案写入用友
|
||||
// 客户档案写入外部接口
|
||||
$department = DB::table('department')->where('id', $master['department_id'])->first();
|
||||
$class = DB::table('customer_class')->where('id', $customer['class_id'])->first();
|
||||
$customer['class_code'] = $class['code'];
|
||||
|
@ -105,13 +95,5 @@ class CustomerHook
|
|||
$row = $params['row'];
|
||||
$ret = $params['ret'];
|
||||
abort_error('客户档案暂时无法导入');
|
||||
// $row['password']
|
||||
if ($ret['id']) {
|
||||
//DB::table($table)->where('id', $ret['id'])->update($row);
|
||||
} else {
|
||||
//$row['id'] = DB::table($table)->insertGetId($row);
|
||||
}
|
||||
//print_r($row);
|
||||
// exit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class TaxHook
|
|||
$customer->tax_max_id = $max_id;
|
||||
$customer->save();
|
||||
|
||||
// 客户档案写入用友
|
||||
// 客户档案写入外部接口
|
||||
$department = DB::table('department')->where('id', $tax['department_id'])->first();
|
||||
$class = DB::table('customer_class')->where('id', $tax['class_id'])->first();
|
||||
$tax['class_code'] = $class['code'];
|
||||
|
|
|
@ -9,7 +9,7 @@ class CustomerRegion extends BaseModel
|
|||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'region.index', 'url' => 'customer/region/index', 'name' => '销售团队'],
|
||||
['value' => 'region.index', 'url' => 'customer/region/index', 'name' => '销售组'],
|
||||
]
|
||||
];
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
return [
|
||||
"name" => "客户管理",
|
||||
"version" => "1.0",
|
||||
"description" => "潜在客户资料上传,通过手机客户端收集客户资料。",
|
||||
"description" => "客户管理。",
|
||||
'dialogs' => [
|
||||
'customer_price' => [
|
||||
'name' => '客户销售价格',
|
||||
|
@ -10,7 +10,7 @@ return [
|
|||
'url' => 'customer/price/dialog',
|
||||
],
|
||||
'customer_region' => [
|
||||
'name' => '销售团队',
|
||||
'name' => '销售组',
|
||||
'model' => 'Gdoo\Customer\Models\Region::Dialog',
|
||||
'url' => 'customer/region/dialog',
|
||||
],
|
||||
|
@ -128,7 +128,7 @@ return [
|
|||
]
|
||||
],
|
||||
"region" => [
|
||||
"name" => "销售团队",
|
||||
"name" => "销售组",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
|
@ -226,7 +226,7 @@ return [
|
|||
]
|
||||
],
|
||||
"regionTask" => [
|
||||
"name" => "区域任务",
|
||||
"name" => "销售任务",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
|
@ -254,6 +254,7 @@ return [
|
|||
],
|
||||
]
|
||||
],
|
||||
/*
|
||||
"business" => [
|
||||
"name" => "客户商机",
|
||||
"actions" => [
|
||||
|
@ -274,6 +275,7 @@ return [
|
|||
]
|
||||
]
|
||||
],
|
||||
*/
|
||||
"price" => [
|
||||
"name" => "客户销售价格",
|
||||
"actions" => [
|
||||
|
@ -378,10 +380,10 @@ return [
|
|||
]
|
||||
]
|
||||
],
|
||||
"accountReport" => [
|
||||
"name" => "客户对账单",
|
||||
"report" => [
|
||||
"name" => "客户报表",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"accountStatement" => [
|
||||
"name" => "客户对账单"
|
||||
],
|
||||
]
|
||||
|
|
|
@ -183,8 +183,6 @@ class CostController extends AuditController
|
|||
$rows = $model->get();
|
||||
|
||||
$rows->transform(function($row) {
|
||||
$unit = option('product.unit', $row['unit_id']);
|
||||
$row['unit_name'] = $unit;
|
||||
return $row;
|
||||
});
|
||||
return response()->json(['data' => $rows]);
|
||||
|
|
|
@ -28,7 +28,7 @@ class ReportController extends DefaultController
|
|||
]/*,[
|
||||
'form_type' =>'dialog',
|
||||
'field' => 'region_id',
|
||||
'name' => '销售团队',
|
||||
'name' => '销售组',
|
||||
'options' => ['url' => 'customer/region/dialog', 'query' => ['layer' => 3]]
|
||||
],*/
|
||||
], 'model');
|
||||
|
|
|
@ -264,15 +264,7 @@ class DashboardController extends DefaultController
|
|||
public function settingInfoAction()
|
||||
{
|
||||
// 定义权限
|
||||
$permissions = [
|
||||
'me' => "本人",
|
||||
'me2' => "本人和下属",
|
||||
'department' => "本部门",
|
||||
'department2' => "本部门和下属部门",
|
||||
'team' => "本销售组",
|
||||
'team2' => "本销售组和下属销售组",
|
||||
'all' => "所有人",
|
||||
];
|
||||
$permissions = option('role.access')->pluck('name', 'id');
|
||||
$dates = [
|
||||
'day' => '今天',
|
||||
'day2' => '昨天',
|
||||
|
@ -294,7 +286,7 @@ class DashboardController extends DefaultController
|
|||
$row['date'] = 'month';
|
||||
}
|
||||
if (empty($row['permission'])) {
|
||||
$row['permission'] = 'department';
|
||||
$row['permission'] = 'dept';
|
||||
}
|
||||
$row['widget_name'] = $widget['name'];
|
||||
|
||||
|
@ -315,7 +307,7 @@ class DashboardController extends DefaultController
|
|||
$row['date'] = 'month';
|
||||
}
|
||||
if (empty($row['permission'])) {
|
||||
$row['permission'] = 'department';
|
||||
$row['permission'] = 'dept';
|
||||
}
|
||||
$row['widget_name'] = $widget['name'];
|
||||
|
||||
|
|
|
@ -404,11 +404,13 @@ class FieldController extends DefaultController
|
|||
$fields = DB::table('model_field')->where('model_id', $flow['id'])->get();
|
||||
$rows = [];
|
||||
foreach($fields as $field) {
|
||||
if ($field['data_type'] && $field['data_field']) {
|
||||
$f = $field['data_type'].'.'.$field['data_field'];
|
||||
$rows[] = ['field' => $f, 'key' => $field['field'].'.'.$field['data_link'].':'.$f, 'name' => $field['name']];
|
||||
} else {
|
||||
$rows[] = ['field' => $field['field'], 'key' => $field['field'], 'name' => $field['name']];
|
||||
if ($field['type']) {
|
||||
if ($field['data_type'] && $field['data_field']) {
|
||||
$f = $field['data_type'].'.'.$field['data_field'];
|
||||
$rows[] = ['field' => $f, 'key' => $field['field'].'.'.$field['data_link'].':'.$f, 'name' => $field['name']];
|
||||
} else {
|
||||
$rows[] = ['field' => $field['field'], 'key' => $field['field'], 'name' => $field['name']];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
|
|
|
@ -51,7 +51,10 @@ class Form
|
|||
$data_field = $field['data_field'];
|
||||
$data_link = $field['data_link'];
|
||||
$_table = $data_link.'_'.$data_type;
|
||||
$join[$_table] = [$data_type.' as '.$_table, $_table.'.id', '=', $table.'.'.$data_link];
|
||||
|
||||
if ($field['type']) {
|
||||
$join[$_table] = [$data_type.' as '.$_table, $_table.'.id', '=', $table.'.'.$data_link];
|
||||
}
|
||||
|
||||
$links[$data_link][$data_link] = 'id';
|
||||
|
||||
|
@ -65,56 +68,32 @@ class Form
|
|||
if ($field_count > 0) {
|
||||
$var1 = explode(':', $data_field);
|
||||
list($_v1, $_v2) = explode('.', $var1[0]);
|
||||
if ($field_count == 2) {
|
||||
// 分割对应的多表联合查询
|
||||
list($_t1, $_t2, $_t3) = explode('.', $var1[1]);
|
||||
list($_c1, $_c2) = explode('.', $var1[2]);
|
||||
list($_t1, $_t2) = explode('.', $var1[1]);
|
||||
|
||||
// 获取左表名
|
||||
$_left_table = $data_link.'_'.$_v2.'_'.$_t1;
|
||||
|
||||
$join[$_left_table] = [$_t1.' as '.$_left_table, $_left_table.'.id', '=', $_table.'.'.$_v2];
|
||||
|
||||
$_table = $data_link.'_'.$_v2.'_'.$_t1.'_'.$_t3;
|
||||
$join[$_table] = [$_c1.' as '.$_table, $_table.'.id', '=', $_left_table.'.'.$_t3];
|
||||
|
||||
$index = $_table.'.'.$_c2;
|
||||
|
||||
// 远程字段和本地字段名称一样重命名
|
||||
if ($data_link == $field['field']) {
|
||||
$column = $column.'_'.$_v1;
|
||||
$links[$data_link][$column] = $_v1;
|
||||
} else {
|
||||
if ($field['type']) {
|
||||
// 右表 id_name
|
||||
// 二层关联后无法获取远程字段是否有本地字段(这里暂时没有想到好的解决办法)
|
||||
// $links[$data_link][$column.'_'.$_t2] = $_v2.'_'.$_t2;
|
||||
$column = $column.'_'.$_c2;
|
||||
}
|
||||
$links[$data_link][$column] = $_v1;
|
||||
}
|
||||
|
||||
} else {
|
||||
list($_t1, $_t2) = explode('.', $var1[1]);
|
||||
if ($field['type']) {
|
||||
$_table = $data_link.'_'.$_t1;
|
||||
$join[$_table] = [$_t1.' as '.$_table, $_table.'.id', '=', $data_link.'_'.$data_type.'.'.$_v2];
|
||||
$index = $_table.'.'.$_t2;
|
||||
if ($field['field'] == $data_link) {
|
||||
$column = $field['field'].'_'.$_v1;
|
||||
// 这里本地字段和右表字段一样时,直接取右表名称
|
||||
$links[$data_link][$column] = $_v1;
|
||||
} else {
|
||||
// $_v2 右表关联字段,$_t2 右表映射字段
|
||||
if ($field['type']) {
|
||||
$links[$data_link][$column] = $_v2;
|
||||
// 右表 id_name
|
||||
$links[$data_link][$column.'_'.$_t2] = $_v2.'_'.$_t2;
|
||||
} else {
|
||||
$_table = $field['field'].'_'.$_t1;
|
||||
}
|
||||
|
||||
$field['dest_column'] = $column.'_'.$_t2;
|
||||
$column = $column.'_'.$_t2;
|
||||
} else {
|
||||
$links[$data_link][$column] = $_v2.'_'.$_t2;
|
||||
}
|
||||
$join[$_table] = [$_t1.' as '.$_table, $_table.'.id', '=', $data_link.'_'.$data_type.'.'.$_v2];
|
||||
|
||||
$index = $_table.'.'.$_t2;
|
||||
if ($field['field'] == $data_link) {
|
||||
$column = $field['field'].'_'.$_v1;
|
||||
// 这里本地字段和右表字段一样时,直接取右表名称
|
||||
$links[$data_link][$column] = $_v1;
|
||||
} else {
|
||||
// $_v2 右表关联字段,$_t2 右表映射字段
|
||||
if ($field['type']) {
|
||||
$links[$data_link][$column] = $_v2;
|
||||
// 右表 id_name
|
||||
$links[$data_link][$column.'_'.$_t2] = $_v2.'_'.$_t2;
|
||||
|
||||
$field['dest_column'] = $column.'_'.$_t2;
|
||||
$column = $column.'_'.$_t2;
|
||||
} else {
|
||||
$links[$data_link][$column] = $_v2.'_'.$_t2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -373,6 +352,7 @@ class Form
|
|||
}
|
||||
|
||||
foreach ($group['fields'] as $view) {
|
||||
|
||||
if ($view['role_id']) {
|
||||
$role_ids = explode(',', $view['role_id']);
|
||||
if (in_array($auth->role_id, $role_ids)) {
|
||||
|
@ -598,6 +578,15 @@ class Form
|
|||
|
||||
$tabs = static::sublist(['select' => $options['select'], 'sublist' => $sublist, 'permission' => $permission, 'action' => $action, 'table' => $table, 'row' => $row, 'bill' => $bill]);
|
||||
|
||||
if ($flowlog) {
|
||||
$tabs[] = [
|
||||
'tpl' => '<div class="b-a">'.$flowlog.'</div>',
|
||||
'id' => 'flowlog',
|
||||
'tool' => '',
|
||||
'name' => '审核记录',
|
||||
];
|
||||
}
|
||||
|
||||
if ($action == 'print') {
|
||||
|
||||
$prints = [[
|
||||
|
@ -662,6 +651,11 @@ class Form
|
|||
|
||||
$tool = $tool == '' ? $tool : '<div class="system_btn m-b-sm">'.$tool.'</div>';
|
||||
|
||||
// 审核记录不显示工具栏
|
||||
if ($tab['id'] == 'flowlog') {
|
||||
$tool = '';
|
||||
}
|
||||
|
||||
$_tabs .= '<div class="tab-pane fade '.$active.'" id="'.$tab['id'].'">
|
||||
<div class="wrapper-sm">
|
||||
<div class="grid-tool" id="'.$table.'-tool">
|
||||
|
@ -1756,7 +1750,7 @@ class Form
|
|||
// 获取表单上的审核意见
|
||||
if ($master['run_id'] && $gets['step_remark']) {
|
||||
|
||||
$run_steps = DB::table('flow_run_step')
|
||||
$run_steps = DB::table('model_run_step')
|
||||
->where('run_id', $master['run_id'])
|
||||
->get()->keyBy('step_id');
|
||||
|
||||
|
|
|
@ -296,59 +296,40 @@ class Grid
|
|||
$data_field = $row['data_field'];
|
||||
$data_link = $row['data_link'];
|
||||
$_table = $data_link.'_'.$data_type;
|
||||
// 连接右表
|
||||
$join[$_table] = [$data_type.' as '.$_table, $_table.'.id', '=', $table.'.'.$data_link];
|
||||
|
||||
if ($row['type']) {
|
||||
$join[$_table] = [$data_type.' as '.$_table, $_table.'.id', '=', $table.'.'.$data_link];
|
||||
}
|
||||
|
||||
$field_count = mb_substr_count($data_field, ':');
|
||||
if ($field_count > 0) {
|
||||
$var1 = explode(':', $data_field);
|
||||
list($_v1, $_v2) = explode('.', $var1[0]);
|
||||
if ($field_count == 2) {
|
||||
// 分割对应的多表联合查询
|
||||
list($_t1, $_t2, $_t3) = explode('.', $var1[1]);
|
||||
list($_c1, $_c2) = explode('.', $var1[2]);
|
||||
list($_t1, $_t2) = explode('.', $var1[1]);
|
||||
|
||||
// 获取左表名
|
||||
$_left_table = $data_link.'_'.$_v2.'_'.$_t1;
|
||||
$_table = $data_link.'_'.$_v2.'_'.$_t1.'_'.$_t3;
|
||||
|
||||
$join[$_table] = [$_c1.' as '.$_table, $_table.'.id', '=', $_left_table.'.'.$_t3];
|
||||
$index = $_table.'.'.$_c2;
|
||||
|
||||
$search['table'] = $_c1;
|
||||
$search['field'] = $_left_table.'.'.$_t3;
|
||||
$search['name'] = $_c2;
|
||||
|
||||
// 远程字段和本地字段名称一样重命名
|
||||
if ($data_link == $row['field']) {
|
||||
$column = $column.'_'.$_v1;
|
||||
} else {
|
||||
if ($row['type']) {
|
||||
$column = $column.'_'.$_c2;
|
||||
} else {
|
||||
$column = $column;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
list($_t1, $_t2) = explode('.', $var1[1]);
|
||||
// 判断是否存在左表字段
|
||||
if ($row['type']) {
|
||||
$_table = $data_link.'_'.$_v2.'_'.$_t1;
|
||||
$join[$_table] = [$_t1.' as '.$_table, $_table.'.id', '=', $data_link.'_'.$data_type.'.'.$_v2];
|
||||
$index = $_table.'.'.$_t2;
|
||||
} else {
|
||||
$_table = $row['field'].'_'.$_t1;
|
||||
}
|
||||
|
||||
$search['table'] = $_t1;
|
||||
$search['field'] = $data_link.'_'.$data_type.'.'.$_v2;
|
||||
$search['name'] = $_t2;
|
||||
$join[$_table] = [$_t1.' as '.$_table, $_table.'.id', '=', $data_link.'_'.$data_type.'.'.$_v2];
|
||||
|
||||
// 远程字段和本地字段名称一样重命名
|
||||
if ($data_link == $row['field']) {
|
||||
$column = $column.'_'.$_v1;
|
||||
} else {
|
||||
if ($row['type']) {
|
||||
$column = $column.'_'.$_t2;
|
||||
}
|
||||
$column = $column;
|
||||
$index = $_table.'.'.$_t2;
|
||||
|
||||
$search['table'] = $_t1;
|
||||
$search['field'] = $data_link.'_'.$data_type.'.'.$_v2;
|
||||
$search['name'] = $_t2;
|
||||
|
||||
// 远程字段和本地字段名称一样重命名
|
||||
if ($data_link == $row['field']) {
|
||||
$column = $column.'_'.$_v1;
|
||||
} else {
|
||||
if ($row['type']) {
|
||||
$column = $column.'_'.$_t2;
|
||||
}
|
||||
$column = $column;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -424,15 +405,29 @@ class Grid
|
|||
// 获取全部模型
|
||||
$models = ModelService::getModelAllFields($bill['model_id']);
|
||||
$_models = [];
|
||||
$left_fields = [];
|
||||
$fields = [];
|
||||
|
||||
if ($template) {
|
||||
$views = (array)json_decode($template['tpl'], true);
|
||||
$fields = [];
|
||||
foreach($views as $view) {
|
||||
$_model = $models[$view['table']];
|
||||
$_field = $_model['fields'][$view['field']];
|
||||
$_field['table'] = $_model['table'];
|
||||
$_field['is_index'] = 1;
|
||||
|
||||
// 关联字段是左表字段
|
||||
$data_link = $_field['data_link'];
|
||||
if ($data_link) {
|
||||
$_field['is_link'] = true;
|
||||
$left_field = $_model['fields'][$data_link];
|
||||
if ($left_field['type']) {
|
||||
$left_field['is_link'] = true;
|
||||
$left_field['table'] = $_model['table'];
|
||||
$left_fields[$data_link] = $left_field;
|
||||
}
|
||||
}
|
||||
|
||||
// 按角色隐藏字段
|
||||
if ($view['role_id']) {
|
||||
$role_ids = explode(',', $view['role_id']);
|
||||
|
@ -471,15 +466,26 @@ class Grid
|
|||
} else {
|
||||
$_fields = Field::where('model_id', $master['id'])
|
||||
->orderBy('sort', 'asc')
|
||||
->get()
|
||||
->toArray();
|
||||
->get()->keyBy('field')->toArray();
|
||||
|
||||
$fields = [];
|
||||
foreach($_fields as $field) {
|
||||
$field['table'] = $table;
|
||||
$field['column'] = $field['field'];
|
||||
$field['is_master'] = 1;
|
||||
$fields[] = $field;
|
||||
foreach($_fields as $_field) {
|
||||
$_field['table'] = $table;
|
||||
$_field['column'] = $_field['field'];
|
||||
$_field['is_master'] = 1;
|
||||
|
||||
// 关联字段是左表字段
|
||||
$data_link = $_field['data_link'];
|
||||
if ($data_link) {
|
||||
$_field['is_link'] = true;
|
||||
$left_field = $_fields[$data_link];
|
||||
if ($left_field['type']) {
|
||||
$left_field['is_link'] = true;
|
||||
$left_field['table'] = $table;
|
||||
$left_fields[$data_link] = $left_field;
|
||||
}
|
||||
}
|
||||
|
||||
$fields[] = $_field;
|
||||
}
|
||||
$select = [$table.'.created_by' => [], $table.'.created_at' => []];
|
||||
if ($master_prefix) {
|
||||
|
@ -487,6 +493,14 @@ class Grid
|
|||
}
|
||||
}
|
||||
|
||||
foreach($fields as $index => $field) {
|
||||
if (isset($left_fields[$field['field']])) {
|
||||
unset($left_fields[$field['field']]);
|
||||
}
|
||||
}
|
||||
|
||||
$fields = array_merge(array_values($left_fields), $fields);
|
||||
|
||||
$res['cols']['checkbox'] = [
|
||||
'width' => 40,
|
||||
'suppressSizeToFit' => true,
|
||||
|
@ -515,7 +529,7 @@ class Grid
|
|||
|
||||
foreach ($fields as $row) {
|
||||
|
||||
if ($row['is_index'] == 1 || $row['is_search'] == 1) {
|
||||
if ($row['is_index'] == 1 || $row['is_search'] == 1 || $row['is_link']) {
|
||||
$setting = json_decode($row['setting'], true);
|
||||
|
||||
$is_master = $row['is_master'];
|
||||
|
@ -534,6 +548,10 @@ class Grid
|
|||
}
|
||||
|
||||
static::fieldRelated($_table, $row, $join, $select, $index, $column, $_search, $setting);
|
||||
if ($row['is_link']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$_search['field2'] = $index;
|
||||
|
||||
if ($row['form_type'] == 'urd') {
|
||||
|
@ -824,6 +842,9 @@ class Grid
|
|||
$res['select'] = $src_select;
|
||||
$res['raw_select'] = $raw_select;
|
||||
|
||||
//print_r($join);
|
||||
//print_r($select);
|
||||
|
||||
$res['join'] = $join;
|
||||
$res['search'] = $search;
|
||||
$res['search_form'] = $search_form;
|
||||
|
|
|
@ -423,7 +423,7 @@ class StepService
|
|||
*/
|
||||
public static function getFlowLog($run_id, $data, $model)
|
||||
{
|
||||
$steps = DB::table('flow_run_step')
|
||||
$steps = DB::table('model_run_step')
|
||||
->whereNotIn('type', ['end'])
|
||||
->where('run_id', $run_id)
|
||||
->orderBy('sort', 'asc')
|
||||
|
@ -450,13 +450,16 @@ class StepService
|
|||
foreach($steps as $log) {
|
||||
if ($log['option'] == 1) {
|
||||
$remark = $log['remark'];
|
||||
if ($remark == '') {
|
||||
if ($log['run_status'] == 'next' || $log['run_status'] == 'end') {
|
||||
$remark = '同意';
|
||||
if ($log['run_updated_at'] > 0) {
|
||||
if ($remark == '') {
|
||||
if ($log['run_status'] == 'next' || $log['run_status'] == 'end') {
|
||||
$remark = '同意';
|
||||
}
|
||||
}
|
||||
$updated_by = get_user($log['updated_id'], 'name', false);
|
||||
$remark.' '.$updated_by.' '.format_datetime($log['updated_at']);
|
||||
}
|
||||
$updated_by = get_user($log['updated_id'], 'name', false);
|
||||
$html .= '<div class="row"><div class="col-sm-12 control-text">'.$log['name'].': '.$remark.' '.$updated_by.' '.format_datetime($log['updated_at']).'</div></div>';
|
||||
$html .= '<div class="row"><div class="col-sm-12 control-text">'.$log['name'].': '.$remark.'</div></div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
|
@ -566,7 +569,7 @@ class StepService
|
|||
$user_ids = [$data[$step['type_value']]];
|
||||
}
|
||||
break;
|
||||
// 销售团队(1级)
|
||||
// 销售组(1级)
|
||||
case 'region1':
|
||||
$customer_id = $data['customer_id'];
|
||||
if ($customer_id > 0) {
|
||||
|
@ -577,7 +580,7 @@ class StepService
|
|||
$user_ids = [$region1['owner_user_id']];
|
||||
}
|
||||
break;
|
||||
// 销售团队(2级)
|
||||
// 销售组(2级)
|
||||
case 'region2':
|
||||
$customer_id = $data['customer_id'];
|
||||
if ($customer_id > 0) {
|
||||
|
@ -593,7 +596,7 @@ class StepService
|
|||
$user_ids = [$region2['owner_user_id']];
|
||||
}
|
||||
break;
|
||||
// 销售团队(3级)
|
||||
// 销售组(3级)
|
||||
case 'region3':
|
||||
$customer_id = $data['customer_id'];
|
||||
if ($customer_id > 0) {
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" for="data_relation">关联关系</label>
|
||||
<div class="col-sm-9 control-text">
|
||||
|
@ -105,6 +106,7 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
@endverbatim
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ $(function() {
|
|||
|
||||
var type = form_group.type;
|
||||
var size = form_group.column;
|
||||
var title = form_group.title;
|
||||
var title = form_group.title || '';
|
||||
var border = form_group.border;
|
||||
var _fields = Array();
|
||||
|
||||
|
|
|
@ -1156,7 +1156,7 @@ class OrderController extends WorkflowController
|
|||
$avaMoney = 0;
|
||||
|
||||
if ($tax) {
|
||||
// 获取接口数据
|
||||
// 获取外部接口数据
|
||||
$a = plugin_sync_api('getAccInfo/code/'.$tax['code']);
|
||||
$b = CustomerService::getLockMoney($tax['id']);
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ class PlanController extends DefaultController
|
|||
],[
|
||||
'form_type' =>'select',
|
||||
'field' => 'type',
|
||||
'name' => '内销/外贸',
|
||||
'options' => [['id'=>1, 'name'=> '内销'], ['id'=>2, 'name'=> '外贸']]
|
||||
'name' => '内销/外销',
|
||||
'options' => [['id'=>1, 'name'=> '内销'], ['id'=>2, 'name'=> '外销']]
|
||||
],[
|
||||
'form_type' =>'dialog',
|
||||
'field' => 'warehouse_id',
|
||||
|
@ -92,7 +92,7 @@ class PlanController extends DefaultController
|
|||
}
|
||||
|
||||
/**
|
||||
* 外销进度表
|
||||
* 外销销售进度表
|
||||
*/
|
||||
public function export_saleAction()
|
||||
{
|
||||
|
@ -232,8 +232,8 @@ class PlanController extends DefaultController
|
|||
],[
|
||||
'form_type' =>'select',
|
||||
'field' => 'type',
|
||||
'name' => '内销/外贸',
|
||||
'options' => [['id'=>1, 'name'=> '内销'], ['id'=>2, 'name'=> '外贸']]
|
||||
'name' => '内销/外销',
|
||||
'options' => [['id'=>1, 'name'=> '内销'], ['id'=>2, 'name'=> '外销']]
|
||||
],[
|
||||
'form_type' =>'dialog',
|
||||
'field' => 'category_id',
|
||||
|
|
|
@ -7,12 +7,16 @@ use Request;
|
|||
use Gdoo\Index\Services\NotificationService;
|
||||
|
||||
use Gdoo\Product\Models\ProductCategory;
|
||||
use Gdoo\Customer\Models\CustomerType;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class ReportController extends DefaultController
|
||||
{
|
||||
public $permission = [
|
||||
'citydata',
|
||||
'clientdata'
|
||||
];
|
||||
|
||||
public $promotion = [
|
||||
'promotions_category' => [
|
||||
1 => '消费促销',
|
||||
|
@ -1396,46 +1400,6 @@ class ReportController extends DefaultController
|
|||
));
|
||||
}
|
||||
|
||||
// 促销分类查询
|
||||
public function promotionAction()
|
||||
{
|
||||
// 获得销售员登录名
|
||||
$id = (int)Request::get('id');
|
||||
$tag = Request::get('tag');
|
||||
$category = Request::get('category');
|
||||
|
||||
if ($id <= 0 and empty($tag) and empty($category)) {
|
||||
return $this->alert('很抱歉,参数不正确。');
|
||||
}
|
||||
|
||||
$category_name = $this->promotion['promotions_category'][$category];
|
||||
$category_name = str_replace('促销', '', $category_name);
|
||||
|
||||
//查询类型
|
||||
if ($tag == 'salesman_id') {
|
||||
$where = 'c.salesman_id='.$id;
|
||||
} elseif ($tag == 'city_id') {
|
||||
$where = 'c.city_id='.$id;
|
||||
} elseif ($tag == 'user_id') {
|
||||
$where = 'p.user_id='.$id;
|
||||
}
|
||||
|
||||
// 促销计算
|
||||
$_promotions = DB::table('promotion as p')
|
||||
->leftJoin('user as c', 'c.id', '=', 'p.customer_id')
|
||||
->where('p.deleted_by', 0)
|
||||
->whereRaw($where)
|
||||
->where('p.type_id', $category)
|
||||
->groupBy('p.id')
|
||||
->orderBy('p.id', 'DESC')
|
||||
->selectRaw('p.step_number,p.start_at,p.end_at,p.data_4,p.data_3,p.type_id,p.product_remark,p.data_5,p.data_18,p.data_19,p.data_amount,p.data_amount1')
|
||||
->get();
|
||||
|
||||
return $this->display(array(
|
||||
'promotions'=> $_promotions,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新客户分析
|
||||
* 计算本年度有订单去年无订单为新客户
|
||||
|
|
|
@ -89,7 +89,7 @@ class OrderService
|
|||
cot.name AS type_id_name,
|
||||
sd.customer_stock,
|
||||
sd.other_money,
|
||||
p.is_special,
|
||||
p.is_produce_plan,
|
||||
pc.code AS category_code,
|
||||
p.barcode,
|
||||
isnull(sd.money, 0) + isnull(sd.other_money, 0) AS hj_money,
|
||||
|
|
|
@ -226,52 +226,28 @@ return [
|
|||
]
|
||||
],
|
||||
"report" => [
|
||||
"name" => "客户订单报表",
|
||||
"name" => "客户销售报表",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "总订单报表"
|
||||
"name" => "销售曲线表"
|
||||
],
|
||||
"category" => [
|
||||
"name" => "品类报表"
|
||||
"name" => "销售品类汇总表"
|
||||
],
|
||||
"single" => [
|
||||
"name" => "单品报表"
|
||||
],
|
||||
"increase" => [
|
||||
"name" => "单品涨跌报表"
|
||||
],
|
||||
"clientsort" => [
|
||||
"name" => "客户涨跌报表"
|
||||
"name" => "销售单品汇总表"
|
||||
],
|
||||
"city" => [
|
||||
"name" => "城市报表"
|
||||
],
|
||||
"citydata" => [
|
||||
"name" => "城市数据报表"
|
||||
"name" => "区域销售品类表"
|
||||
],
|
||||
"client" => [
|
||||
"name" => "单品客户报表"
|
||||
],
|
||||
"clientdata" => [
|
||||
"name" => "单品数据客户报表"
|
||||
"name" => "销售单品客户表"
|
||||
],
|
||||
"ranking" => [
|
||||
"name" => "客户销售排行报表"
|
||||
],
|
||||
"promotion" => [
|
||||
"name" => "促销分类报表"
|
||||
],
|
||||
"clienttype" => [
|
||||
"name" => "客户销售类型报表"
|
||||
"name" => "销售排名表"
|
||||
],
|
||||
"newclient" => [
|
||||
"name" => "新客户报表"
|
||||
],
|
||||
"receivable" => [
|
||||
"name" => "客户回款报表"
|
||||
],
|
||||
"billingtype" => [
|
||||
"name" => "开票类型订单分析"
|
||||
"name" => "年度新客户表"
|
||||
],
|
||||
"stockmonth" => [
|
||||
"name" => "三个月未进货客户报表"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{cellClass:'text-center', field: 'sn', headerName: '订单号', width: 140},
|
||||
{cellClass:'text-right', type: 'number', field: 'fhjh_num', headerName: '数量', width: 80},
|
||||
{cellClass:'text-center', field: 'pay_dt', headerName: '打款日期', width: 100},
|
||||
{cellClass:'text-left', field: 'export_country', headerName: '出口国家', width: 100},
|
||||
{cellClass:'text-left', field: 'export_country', headerName: '外销国家', width: 100},
|
||||
];
|
||||
|
||||
grid.defaultColDef.cellStyle1 = function(params) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<table class="table table-bordered" id="report_export">
|
||||
<tr>
|
||||
<th style="white-space:nowrap">
|
||||
销售团队
|
||||
销售组
|
||||
</th>
|
||||
|
||||
@foreach($categorys as $k => $v)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<tr>
|
||||
<th width="80">排行</th>
|
||||
@if($select['query']['tag'] == 'customer_id')
|
||||
<th style="white-space:nowrap;">销售团队</th>
|
||||
<th style="white-space:nowrap;">销售组</th>
|
||||
<th style="white-space:nowrap;">负责人</th>
|
||||
@endif
|
||||
@if($select['query']['tag']=='city_id')
|
||||
|
|
|
@ -232,10 +232,7 @@ class ProduceService
|
|||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where ISNULL(d.use_close, 0) = 0
|
||||
and m.status > 0
|
||||
AND LEFT(pc.name, 2) <> '外销'
|
||||
|
||||
and m.created_at > 1585065600
|
||||
|
||||
AND isnull(p.is_export, 0) = 0
|
||||
GROUP BY d.product_id, ISNULL(m.pay_dt, null), m.status
|
||||
HAVING SUM(d.delivery_quantity) - ISNULL(SUM(sd.quantity), 0) - ISNULL(SUM(sa.quantity),0) <> 0
|
||||
) as a
|
||||
|
@ -261,7 +258,7 @@ class ProduceService
|
|||
null as batch_sn
|
||||
from (".StockService::getStockSelectSql().") kc
|
||||
LEFT JOIN product_category pc on pc.id = category_id
|
||||
WHERE product_type = 1 and warehouse_name LIKE '%成品%' and left(pc.name, 2) <> '外销' and warehouse_code <> '25'
|
||||
WHERE product_type = 1 and warehouse_name LIKE '%成品%' and is_export <> 1 and warehouse_code <> '25'
|
||||
GROUP by product_id
|
||||
HAVING sum(ky_num) <> 0";
|
||||
|
||||
|
@ -283,7 +280,7 @@ class ProduceService
|
|||
batch_sn
|
||||
from (".StockService::getStockSelectSql().") ss
|
||||
LEFT JOIN product_category pc on pc.id = category_id
|
||||
WHERE product_type = 1 and warehouse_name LIKE '%成品%' and left(pc.name, 2) = '外销' and warehouse_code <> '25'
|
||||
WHERE product_type = 1 and warehouse_name LIKE '%成品%' and is_export = 1 and warehouse_code <> '25'
|
||||
GROUP by product_id, batch_sn
|
||||
HAVING sum(ky_num) <> 0";
|
||||
|
||||
|
@ -339,9 +336,7 @@ class ProduceService
|
|||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where ISNULL(d.use_close,0) = 0
|
||||
AND m.status > 0
|
||||
and LEFT(pc.name, 2) = '外销'
|
||||
|
||||
and m.created_at > 1585065600
|
||||
and p.is_export = 1
|
||||
|
||||
GROUP BY d.product_id, d.batch_sn, ISNULL(m.pay_dt, null), m.status
|
||||
HAVING SUM(d.delivery_quantity) - ISNULL(SUM(sd.quantity), 0) - ISNULL(SUM(sa.quantity), 0) <> 0
|
||||
|
@ -371,7 +366,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where m.plan_delivery_dt BETWEEN '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close, 0) = 0 AND left(pc.name, 2) <> '外销'
|
||||
AND ISNULL(d.use_close, 0) = 0 AND isnull(p.is_export, 0) = 0
|
||||
GROUP BY d.product_id
|
||||
";
|
||||
|
||||
|
@ -396,7 +391,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where m.plan_delivery_dt BETWEEN '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close, 0) = 0 AND left(pc.name, 2) = '外销'
|
||||
AND ISNULL(d.use_close, 0) = 0 AND p.is_export = 1
|
||||
GROUP BY d.product_id, d.batch_sn";
|
||||
|
||||
// 营销计划数量
|
||||
|
@ -485,7 +480,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where ".sql_year_month('m.invoice_dt')." = '$now_month'
|
||||
and left(pc.name, 2) <> '外销'
|
||||
and isnull(p.is_export, 0) = 0
|
||||
GROUP BY d.product_id";
|
||||
|
||||
// 上月发货数量
|
||||
|
@ -509,7 +504,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where ".sql_year_month('m.invoice_dt')." = '$last_month'
|
||||
and left(pc.name, 2) <> '外销'
|
||||
and isnull(p.is_export, 0) = 0
|
||||
group by d.product_id";
|
||||
|
||||
$sql = "select p.department_id, dep.name department_name, dep.name department_id_name,p.category_id,
|
||||
|
@ -598,8 +593,7 @@ class ProduceService
|
|||
|
||||
where ISNULL(d.use_close, 0) = 0
|
||||
and m.status > 0
|
||||
and m.created_at > 1585065600
|
||||
AND LEFT(pc.name, 2) <> '外销'
|
||||
AND isnull(p.is_export, 0) = 0
|
||||
GROUP BY d.product_id, ISNULL(m.pay_dt, null), m.status
|
||||
HAVING SUM(d.delivery_quantity) - ISNULL(SUM(i.quantity),0) - ISNULL(SUM(r.quantity),0) <> 0
|
||||
) as a
|
||||
|
@ -654,10 +648,9 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
|
||||
where ISNULL(d.use_close,0) = 0
|
||||
and m.created_at > 1585065600
|
||||
where ISNULL(d.use_close, 0) = 0
|
||||
AND m.status > 0
|
||||
and LEFT(pc.name, 2) = '外销'
|
||||
and p.is_export = 1
|
||||
GROUP BY d.product_id, d.batch_sn, ISNULL(m.pay_dt, null), m.status
|
||||
HAVING SUM(d.delivery_quantity)-ISNULL(SUM(i.quantity),0)-ISNULL(SUM(r.quantity),0) <> 0
|
||||
) as b
|
||||
|
@ -687,7 +680,7 @@ class ProduceService
|
|||
WHERE (p.product_type=1 or p.material_type > 0) and
|
||||
(kc.warehouse_name LIKE '%成品%' or kc.warehouse_code = '07') and kc.warehouse_code <> '25'
|
||||
and ($warehouse_id = 0 OR kc.warehouse_id = $warehouse_id)
|
||||
AND LEFT(pc.name, 2) <> '外销'
|
||||
AND isnull(p.is_export, 0) = 0
|
||||
GROUP by kc.product_id
|
||||
HAVING sum(kc.ky_num) <> 0
|
||||
|
||||
|
@ -715,13 +708,13 @@ class ProduceService
|
|||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
WHERE p.product_type=1 and kc.warehouse_name LIKE '%成品%' and kc.warehouse_code <> '25'
|
||||
AND ($warehouse_id = 0 OR kc.warehouse_id = $warehouse_id)
|
||||
AND LEFT(pc.name, 2) = '外销'
|
||||
AND p.is_export = 1
|
||||
GROUP by kc.product_id, kc.batch_sn
|
||||
HAVING sum(kc.ky_num) <> 0
|
||||
|
||||
UNION ALL
|
||||
|
||||
--川南库存
|
||||
--待入库存
|
||||
SELECT
|
||||
kc.product_id,
|
||||
'' batch_sn,
|
||||
|
@ -740,7 +733,7 @@ class ProduceService
|
|||
0 syfh_num
|
||||
from (".StockService::getStockSelectSql().") kc
|
||||
LEFT JOIN product p on kc.product_id = p.id
|
||||
WHERE p.product_type = 1 and kc.warehouse_name LIKE '%川南%'
|
||||
WHERE p.product_type = 1 and kc.warehouse_code = '22'
|
||||
and ($warehouse_id = 0 OR kc.warehouse_id = $warehouse_id)
|
||||
GROUP by kc.product_id
|
||||
HAVING sum(kc.ky_num) <> 0
|
||||
|
@ -796,7 +789,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where m.plan_delivery_dt between '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 AND left(pc.name, 2) <> '外销'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 AND isnull(p.is_export, 0) = 0
|
||||
GROUP BY m.plan_delivery_dt, d.product_id
|
||||
|
||||
UNION ALL
|
||||
|
@ -822,7 +815,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where m.plan_delivery_dt between '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 and left(pc.name, 2) = '外销'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 and p.is_export = 1
|
||||
GROUP BY m.plan_delivery_dt, d.product_id, d.batch_sn
|
||||
|
||||
UNION ALL
|
||||
|
@ -866,7 +859,7 @@ class ProduceService
|
|||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
|
||||
where m.plan_delivery_dt between '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 and left(pc.name, 2) <> '外销'
|
||||
AND ISNULL(d.use_close, 0) = 0 and m.status > 0 and isnull(p.is_export, 0) = 0
|
||||
GROUP BY m.plan_delivery_dt, d.id, d.product_id, i.quantity, r.quantity
|
||||
having ISNULL(SUM(d.delivery_quantity), 0) - ISNULL(SUM(i.quantity), 0) - ISNULL(SUM(r.quantity), 0) <> 0
|
||||
) as c
|
||||
|
@ -913,7 +906,7 @@ class ProduceService
|
|||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
|
||||
where m.plan_delivery_dt between '$start_dt' and '$end_dt'
|
||||
AND ISNULL(d.use_close,0) = 0 and m.status > 0 and left(pc.name, 2) = '外销'
|
||||
AND ISNULL(d.use_close,0) = 0 and m.status > 0 and p.is_export = 1
|
||||
GROUP BY m.plan_delivery_dt, d.id, d.product_id, i.quantity, r.quantity
|
||||
having isnull(SUM(d.delivery_quantity), 0) - isnull(SUM(i.quantity), 0) - isnull(SUM(r.quantity), 0) <> 0
|
||||
) as d
|
||||
|
@ -1014,7 +1007,7 @@ class ProduceService
|
|||
LEFT JOIN product p on d.product_id = p.id
|
||||
LEFT JOIN product_category pc on pc.id = p.category_id
|
||||
where m.invoice_dt between '$start_dt' and '$end_dt'
|
||||
and left(pc.name,2) <> '外销'
|
||||
and isnull(p.is_export, 0) = 0
|
||||
GROUP BY m.invoice_dt, d.product_id";
|
||||
|
||||
$dates = date_range($start_dt, $end_dt);
|
||||
|
@ -1061,9 +1054,9 @@ class ProduceService
|
|||
}
|
||||
|
||||
if ($ny == 1) {
|
||||
$sql2[] = "and pc.name not like '外销%'";
|
||||
$sql2[] = "and isnull(p.is_export, 0) = 0";
|
||||
} else if($ny == 2) {
|
||||
$sql2[] = "and pc.name like '外销%'";
|
||||
$sql2[] = "and p.is_export = 1";
|
||||
}
|
||||
|
||||
$sql2[] = "group by pc.id,pc.name,pc.code,p.id,p.code,p.name,isnull(batch_sn,''),p.spec,pu.name
|
||||
|
|
|
@ -441,7 +441,7 @@ class PromotionController extends WorkflowController
|
|||
promotion.id,
|
||||
promotion.customer_id,
|
||||
customer_id_customer.region_id,
|
||||
customer_id_region_id_customer_region.name as region_name,
|
||||
region_id_customer_region.name as region_name,
|
||||
customer_id_customer.code as customer_code,
|
||||
customer_id_customer.name as customer_name,
|
||||
customer_id_customer.warehouse_contact,
|
||||
|
|
|
@ -27,10 +27,10 @@ class PromotionCash extends BaseModel
|
|||
|
||||
$total_num = DB::table('order')->count('id');
|
||||
|
||||
$master['customer_id'] = $cash->promotion->customer_id;
|
||||
$master['customer_id'] = $cash->promotion->customer_id;
|
||||
$master['flow_step_id'] = 1;
|
||||
$master['number'] = 'CXDX-'.date('Y-m').'-'.($total_num + 1);
|
||||
$master['add_time'] = time();
|
||||
$master['number'] = 'CXDX-'.date('Y-m').'-'.($total_num + 1);
|
||||
$master['add_time'] = time();
|
||||
$orderId = DB::table('order')->insertGetId($master);
|
||||
|
||||
foreach ($cash->datas as $data) {
|
||||
|
|
|
@ -43,7 +43,7 @@ var params = JSON.parse('{{json_encode($query)}}');
|
|||
{cellClass:'text-center', field: 'master_status', cellRenderer: 'htmlCellRenderer', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 120},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售团队', width: 120},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售组', width: 120},
|
||||
{cellClass:'text-right',field:'apply_money', headerName: '申请费用', width: 100},
|
||||
{cellClass:'text-right',field:'verification_cost', headerName: '批复费用', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
|
|
|
@ -379,7 +379,7 @@ class DeliveryController extends WorkflowController
|
|||
return $form;
|
||||
}
|
||||
|
||||
// 获取库存(不含不满件)
|
||||
// 获取库存
|
||||
public function getBatchSelectAction()
|
||||
{
|
||||
$search = search_form(['advanced' => ''], [
|
||||
|
|
|
@ -137,8 +137,8 @@ class DirectController extends WorkflowController
|
|||
pu.name as product_unit,
|
||||
p.material_type,
|
||||
p.product_type,
|
||||
SUBSTRING(batch_sn, 3, 4) as batch_sn,
|
||||
case when right(w.name, 4) = '不满件库' then 'B' else '' end warehouse_type
|
||||
batch_sn,
|
||||
w.name as warehouse_name
|
||||
")
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
|
|
@ -43,12 +43,14 @@ class Record10Controller extends WorkflowController
|
|||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
// 川南库管登录
|
||||
/*
|
||||
// 外部库管登录
|
||||
if (auth()->id() == 2177) {
|
||||
$model->whereIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
} else {
|
||||
$model->whereNotIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
}
|
||||
*/
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
|
|
|
@ -31,9 +31,8 @@ class ReportController extends DefaultController
|
|||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'dialog', 'name' => '产品', 'field' => 'product_id', 'options' => ['url' => 'product/product/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '批号', 'field' => 'batch_sn', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外贸','name'=>'外贸']]],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外销','name'=>'外销']]],
|
||||
//['form_type' => 'select', 'name' => '是否统计批号', 'field' => 'batch', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'date2', 'name' => '单据日期', 'field' => 'date', 'value' => [$sdate, $edate], 'options' => []],
|
||||
], 'model');
|
||||
|
||||
|
@ -85,10 +84,9 @@ class ReportController extends DefaultController
|
|||
], [
|
||||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '存货编码', 'field' => 'product_code', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'1','name'=>'内销'],['id'=>'2','name'=>'外贸']]],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'1','name'=>'内销'],['id'=>'2','name'=>'外销']]],
|
||||
['form_type' => 'date2', 'name' => '生产日期', 'field' => 'date', 'value' => [], 'options' => []],
|
||||
['form_type' => 'select', 'name' => '统计批号', 'field' => 'batch', 'value' => 1, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
|
||||
], 'model');
|
||||
|
||||
|
@ -144,9 +142,8 @@ class ReportController extends DefaultController
|
|||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'dialog', 'name' => '产品', 'field' => 'product_id', 'options' => ['url' => 'product/product/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '批号', 'field' => 'batch_sn', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外贸','name'=>'外贸']]],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外销','name'=>'外销']]],
|
||||
['form_type' => 'select', 'name' => '统计批号', 'field' => 'batch', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'date2', 'name' => '单据日期', 'field' => 'date', 'value' => [$sdate, $edate], 'options' => []],
|
||||
], 'model');
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class AllocationHook
|
|||
->leftJoin('product', 'product.id', '=', 'stock_allocation_data.product_id')
|
||||
->where('stock_allocation_data.allocation_id', $id)
|
||||
->get(['stock_allocation_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postTransVouch', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -53,7 +53,7 @@ class AllocationHook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_allocation')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'TransVouch', 'field' => 'cTVCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在其他入库单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -113,7 +113,7 @@ class CancelHook
|
|||
) t where t.row_index = 1";
|
||||
$rows = DB::select($sql);
|
||||
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postCancelOrder', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -124,7 +124,7 @@ class CancelHook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_cancel')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在退货申请['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -131,7 +131,7 @@ class DeliveryHook
|
|||
}
|
||||
}
|
||||
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postDelivery', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -142,7 +142,7 @@ class DeliveryHook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_delivery')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在发货单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -120,7 +120,7 @@ class DirectHook
|
|||
}
|
||||
}
|
||||
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postDeliveryZY', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -131,7 +131,7 @@ class DirectHook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_direct')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在发货单(直营)['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -37,7 +37,7 @@ class Record01Hook
|
|||
->leftJoin('product', 'product.id', '=', 'stock_record01_data.product_id')
|
||||
->where('stock_record01_data.record01_id', $id)
|
||||
->get(['stock_record01_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postRecord01', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -48,7 +48,7 @@ class Record01Hook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record01')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord01', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在采购单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -46,7 +46,7 @@ class Record08Hook
|
|||
->leftJoin('product', 'product.id', '=', 'stock_record08_data.product_id')
|
||||
->where('stock_record08_data.record08_id', $id)
|
||||
->get(['stock_record08_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postRecord08', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -57,7 +57,7 @@ class Record08Hook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record08')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord08', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在其他入库单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -76,7 +76,7 @@ class Record09Hook
|
|||
} else {
|
||||
$post_type = 'postRecord09';
|
||||
}
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api($post_type, ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -88,7 +88,7 @@ class Record09Hook
|
|||
$id = $params['id'];
|
||||
|
||||
$master = DB::table('stock_record09')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
if ($master['type_id'] == 2) {
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
|
|
|
@ -10,17 +10,19 @@ class Record10Hook
|
|||
}
|
||||
|
||||
public function onBillSeqNo($params) {
|
||||
// 川南库管独立编号
|
||||
|
||||
// 外部库管独立编号
|
||||
if (auth()->id() == 2177) {
|
||||
$params['rule'] = $params['rule'].'11';
|
||||
} else {
|
||||
$params['rule'] = $params['rule'].'10';
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforePage($params) {
|
||||
// 川南库管登录
|
||||
// 外部库管登录
|
||||
if (auth()->id() == 2177) {
|
||||
$params['q']->whereIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
} else {
|
||||
|
@ -63,7 +65,7 @@ class Record10Hook
|
|||
->leftJoin('product', 'product.id', '=', 'stock_record10_data.product_id')
|
||||
->where('stock_record10_data.record10_id', $id)
|
||||
->get(['stock_record10_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postRecord10', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
|
@ -75,7 +77,7 @@ class Record10Hook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record10')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord10', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在产成品入库单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -46,7 +46,7 @@ class Record11Hook
|
|||
->leftJoin('product', 'product.id', '=', 'stock_record11_data.product_id')
|
||||
->where('stock_record11_data.record11_id', $id)
|
||||
->get(['stock_record11_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
// 同步数据到外部接口
|
||||
$ret = plugin_sync_api('postRecord11', ['master' => $master, 'rows' => $rows]);
|
||||
|
||||
if ($ret['success'] == true) {
|
||||
|
@ -58,7 +58,7 @@ class Record11Hook
|
|||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record11')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
// 检查外部接口单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord11', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在原材料出库单['.$master['sn'].']无法弃审。');
|
||||
|
|
|
@ -41,7 +41,7 @@ class DeliveryService
|
|||
p.material_type,
|
||||
p.product_type,
|
||||
batch_sn,
|
||||
case when right(w.name, 4) = '不满件库' then 'B' else '' end warehouse_type
|
||||
w.name as warehouse_name
|
||||
")
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
|
|
@ -5,7 +5,7 @@ use DB;
|
|||
class StockService
|
||||
{
|
||||
/**
|
||||
* 商品批次选择(可筛选是否取不满件)
|
||||
* 商品批次选择
|
||||
*
|
||||
* @warehouse_id 仓库ID
|
||||
* @product_ids 存货档案ID
|
||||
|
@ -14,14 +14,6 @@ class StockService
|
|||
*/
|
||||
public static function getBatchSelect($warehouse_id = 0, $product_ids = '', $value = '', $customer_id = 0)
|
||||
{
|
||||
$count = 0;
|
||||
if ($customer_id > 0) {
|
||||
$count = DB::table('customer')
|
||||
->where('id', $customer_id)
|
||||
->whereRaw("RIGHT(name, 1) = 'A'")
|
||||
->count();
|
||||
}
|
||||
|
||||
$model = DB::query()->selectRaw('* FROM('.static::getStockSelectSql().') ss')
|
||||
->whereRaw("ISNULL(ky_num, 0) > 0");
|
||||
|
||||
|
@ -50,14 +42,6 @@ class StockService
|
|||
$model->where("warehouse_id", $warehouse_id);
|
||||
}
|
||||
|
||||
// 是否取不满件
|
||||
if ($count > 0) {
|
||||
$model->whereRaw("
|
||||
warehouse_code <> '28' -- 味聚特辣酱不满件库
|
||||
and warehouse_code <> '23' -- 成品泡菜不满件库
|
||||
");
|
||||
}
|
||||
|
||||
$model->orderByRaw('warehouse_code asc, product_code ASC, batch_sn ASC');
|
||||
return $model->get();
|
||||
}
|
||||
|
@ -138,39 +122,26 @@ class StockService
|
|||
*
|
||||
* @warehouse_id 仓库ID
|
||||
* @product_code 存货编码
|
||||
* @NY 内销1 外贸2
|
||||
* @NY 内销1 外销2
|
||||
* @made_start_dt 生产日期起始日期
|
||||
* @made_end_dt 生产日期截至日期
|
||||
* @user_id 用户id
|
||||
* @SFPH 是否显示批号
|
||||
* @HBBMJ 是否合并不满件
|
||||
*/
|
||||
public static function reportOrderStockTotal($warehouse_id = 0, $product_code = '', $ny = '', $made_start_dt = '', $made_end_dt = '', $user_id = 0, $SFPH = 0, $HBBMJ = 0)
|
||||
public static function reportOrderStockTotal($warehouse_id = 0, $product_code = '', $ny = '', $made_start_dt = '', $made_end_dt = '', $user_id = 0, $SFPH = 0)
|
||||
{
|
||||
$warehouse_id = (int)$warehouse_id;
|
||||
$SFPH = (int)$SFPH;
|
||||
$HBBMJ = (int)$HBBMJ;
|
||||
$HBBMJ = 1;
|
||||
|
||||
$sql = [];
|
||||
$sql[] = "select warehouse_code,product_code,batch_sn,batch_date,poscode,posname,warehouse_name,
|
||||
product_name,product_spec,unit_name,product_id,warehouse_id,SUM(Num) num,SUM(ky_Num) kynum,SUM(fh_Num) fhnum,SUM(Ck_Num) cknum,SUM(Rk_Num) rknum,SUM(Max_Num) maxnum
|
||||
from (
|
||||
SELECT case when {$HBBMJ}=1 AND warehouse_code='23' THEN '10'
|
||||
when {$HBBMJ}=1 AND warehouse_code='27' THEN '21'
|
||||
when {$HBBMJ}=1 AND warehouse_code='28' THEN '11' ELSE warehouse_code end AS warehouse_code,
|
||||
rd.product_code,batch_sn,batch_date,
|
||||
case when {$HBBMJ}=1 and poscode='91' THEN '99'
|
||||
when {$HBBMJ}=1 and poscode='92' THEN '98'
|
||||
when {$HBBMJ}=1 and poscode='93' THEN '98' ELSE poscode end AS poscode,
|
||||
case when {$HBBMJ}=1 and posname='不满件' THEN '小菜'
|
||||
when {$HBBMJ}=1 and posname='川南辣酱不满件' THEN '辣酱'
|
||||
when {$HBBMJ}=1 and posname='味聚特辣酱不满件' THEN '辣酱' ELSE posname end as posname,
|
||||
case when {$HBBMJ}=1 and warehouse_name='成品不满件库' THEN '成品库小菜'
|
||||
when {$HBBMJ}=1 and warehouse_name='川南辣酱不满件库' THEN '川南酱库'
|
||||
when {$HBBMJ}=1 and warehouse_name='味聚特辣酱不满件库' THEN '成品库酱' ELSE warehouse_name end AS warehouse_name, rd.product_name,rd.product_spec,rd.unit_name,rd.product_id,
|
||||
CASE WHEN {$HBBMJ}=1 AND warehouse_id=20005 THEN 139
|
||||
WHEN {$HBBMJ}=1 AND warehouse_id=20047 THEN 20001
|
||||
WHEN {$HBBMJ}=1 AND warehouse_id=20048 THEN 140 ELSE warehouse_id end AS warehouse_id,Num,ky_Num,fh_Num,Ck_Num,Rk_Num,Max_Num
|
||||
SELECT warehouse_code,
|
||||
rd.product_code,batch_sn,batch_date,poscode,posname,warehouse_name,
|
||||
rd.product_name,rd.product_spec,rd.unit_name,rd.product_id,warehouse_id,Num,ky_Num,fh_Num,Ck_Num,Rk_Num,Max_Num
|
||||
FROM (".StockService::getStockSelectSql().") rd
|
||||
left join (
|
||||
select i.product_id, i.product_name,i.product_spec,i.unit_name,invc.NY, i.product_code from (
|
||||
|
@ -190,8 +161,7 @@ class StockService
|
|||
$sql[] = "and (batch_date >= '$made_start_dt') and (batch_date <= '$made_end_dt')";
|
||||
}
|
||||
|
||||
$sql[] = "AND (({$warehouse_id} = 0 OR warehouse_id = {$warehouse_id} OR (
|
||||
({$HBBMJ}=1 and warehouse_id = 20005 AND {$warehouse_id} = 139) OR ({$HBBMJ} = 1 and warehouse_id = 20047 AND {$warehouse_id} = 20001) OR ({$HBBMJ} = 1 and warehouse_id = 20048 AND {$warehouse_id} = 140))
|
||||
$sql[] = "AND (({$warehouse_id} = 0 OR warehouse_id = {$warehouse_id}
|
||||
) and warehouse_id in (
|
||||
SELECT uwh.warehouse_id FROM user_warehouse uwh LEFT JOIN warehouse wh ON uwh.warehouse_id = wh.id where uwh.user_id = {$user_id})
|
||||
)";
|
||||
|
@ -204,7 +174,6 @@ class StockService
|
|||
GROUP BY warehouse_code,product_code,batch_sn,batch_date,poscode,posname,warehouse_name,
|
||||
product_name,product_spec,unit_name,product_id,warehouse_id
|
||||
order by warehouse_code desc,product_code,batch_sn";
|
||||
|
||||
return DB::select(join(" ", $sql));
|
||||
}
|
||||
|
||||
|
@ -219,14 +188,12 @@ class StockService
|
|||
* @end_dt 截至日期
|
||||
* @user_id 用户ID
|
||||
* @SFPH 是否显示批号
|
||||
* @HBBMJ 是否合并不满件
|
||||
*/
|
||||
public static function reportOrderStockInOut($warehouse_id = 0, $product_id = 0, $batch_sn = '', $ny = '', $start_dt = '', $end_dt = '', $user_id = 0, $SFPH = 0, $HBBMJ = 0)
|
||||
public static function reportOrderStockInOut($warehouse_id = 0, $product_id = 0, $batch_sn = '', $ny = '', $start_dt = '', $end_dt = '', $user_id = 0, $SFPH = 0)
|
||||
{
|
||||
$warehouse_id = (int)$warehouse_id;
|
||||
$product_id = (int)$product_id;
|
||||
$SFPH = (int)$SFPH;
|
||||
$HBBMJ = (int)$HBBMJ;
|
||||
|
||||
$invoice_dt = sql_year_month_day('m.invoice_dt');
|
||||
|
||||
|
@ -260,13 +227,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -281,13 +244,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -304,14 +263,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -327,14 +282,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' ='' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -349,14 +300,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.out_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id = $warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.out_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.out_warehouse_id,d.product_id,d.batch_sn,d.out_poscode,d.out_posname,batch_date
|
||||
|
@ -371,14 +317,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.in_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id = $warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.in_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.in_warehouse_id,d.product_id,d.batch_sn,d.in_poscode,d.in_posname,batch_date
|
||||
|
@ -396,14 +337,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -419,14 +355,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -442,13 +374,9 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL and m.status = 1
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id)
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' ='' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -499,14 +427,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -535,14 +459,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn'='' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny'='' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销') )
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export,0)=0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -573,14 +493,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -608,14 +524,10 @@ class StockService
|
|||
WHERE ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." >= '$start_dt'
|
||||
AND ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.out_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.out_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.out_warehouse_id,d.product_id,d.batch_sn,d.out_poscode,d.out_posname,batch_date
|
||||
|
@ -644,14 +556,10 @@ class StockService
|
|||
--WHERE CONVERT(varchar(10), case when isnull(m.delivery_dt, '') <> '' then m.delivery_dt else m.invoice_dt end, 121)>=@SdDate
|
||||
--AND CONVERT(varchar(10), case when isnull(m.delivery_dt, '') <> '' then m.delivery_dt else m.invoice_dt end, 121)<=@EdDate
|
||||
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.in_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.in_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.in_warehouse_id,d.product_id,d.batch_sn,d.in_poscode,d.in_posname,batch_date
|
||||
|
@ -680,14 +588,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销') )
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -715,14 +619,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -751,14 +651,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,batch_date
|
||||
|
@ -827,13 +723,11 @@ class StockService
|
|||
* @start_dt 起始日期
|
||||
* @end_dt 截至日期
|
||||
* @user_id 用户ID
|
||||
* @HBBMJ 是否合并不满件库
|
||||
*/
|
||||
public static function reportOrderStockDetail($warehouse_id = 0, $product_id = 0, $batch_sn = '', $ny = '', $start_dt = '', $end_dt = '', $user_id = 0, $HBBMJ = 0)
|
||||
public static function reportOrderStockDetail($warehouse_id = 0, $product_id = 0, $batch_sn = '', $ny = '', $start_dt = '', $end_dt = '', $user_id = 0)
|
||||
{
|
||||
$warehouse_id = (int)$warehouse_id;
|
||||
$product_id = (int)$product_id;
|
||||
$HBBMJ = (int)$HBBMJ;
|
||||
$user_id = (int)$user_id;
|
||||
|
||||
// 期初
|
||||
|
@ -847,14 +741,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -870,14 +760,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -893,14 +779,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -916,14 +798,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -940,14 +818,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id= $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
GROUP BY m.warehouse_id,d.product_id,d.batch_sn,d.poscode,d.posname,d.batch_date
|
||||
|
@ -963,14 +837,10 @@ class StockService
|
|||
LEFT JOIN product_category pc on p.category_id = pc.id
|
||||
WHERE ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.out_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.out_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.product_id,m.out_warehouse_id,d.batch_sn,d.out_poscode,d.out_posname,d.batch_date
|
||||
|
@ -985,14 +855,10 @@ class StockService
|
|||
LEFT JOIN product_category pc on p.category_id = pc.id
|
||||
WHERE ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.in_warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销')OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.in_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.product_id,m.in_warehouse_id,d.batch_sn,d.in_poscode,d.in_posname,d.batch_date
|
||||
|
@ -1010,14 +876,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.product_id,d.batch_sn,d.warehouse_id,d.poscode,d.posname,d.batch_date
|
||||
|
@ -1034,14 +896,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
GROUP BY d.product_id,d.batch_sn,m.warehouse_id,d.poscode,d.posname,d.batch_date
|
||||
|
@ -1057,14 +915,10 @@ class StockService
|
|||
WHERE d.product_id IS NOT NULL and m.status = 1
|
||||
AND ".sql_year_month_day('m.invoice_dt')." < '$start_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
GROUP BY d.product_id,d.batch_sn,d.warehouse_id,d.poscode,d.posname,d.batch_date
|
||||
|
@ -1108,14 +962,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
|
||||
|
@ -1133,14 +983,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny'='外销') OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id=$product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id=$user_id)
|
||||
|
||||
|
@ -1158,14 +1004,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1182,14 +1024,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id = 139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id = 20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id = 140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销')OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1206,14 +1044,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id = 139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id = 20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id = 140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1231,14 +1065,10 @@ class StockService
|
|||
where ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." >= '$start_dt'
|
||||
AND ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.out_warehouse_id=20005 AND $warehouse_id = 139)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20047 AND $warehouse_id = 20001)
|
||||
OR ($HBBMJ=1 AND m.out_warehouse_id=20048 AND $warehouse_id = 140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.out_warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.out_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1257,16 +1087,9 @@ class StockService
|
|||
where ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." >= '$start_dt'
|
||||
AND ".sql_year_month_day("case when m.delivery_dt <> null then m.delivery_dt else m.invoice_dt end")." <= '$end_dt'
|
||||
|
||||
--and (ISNULL(@cWhID,'')='' OR m.in_warehouse_id = @cWhID OR ($HBBMJ=1 AND m.in_warehouse_id=20005))
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id = $warehouse_id)
|
||||
|
||||
and ($warehouse_id = 0 OR m.in_warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.in_warehouse_id = 20005 AND $warehouse_id = 139)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id = 20047 AND $warehouse_id = 20001)
|
||||
OR ($HBBMJ=1 AND m.in_warehouse_id = 20048 AND $warehouse_id = 140)
|
||||
))
|
||||
|
||||
--and ('$batch_sn' = '' OR d.cBatch = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.in_warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1287,14 +1110,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销')OR (pc.name not like '%内销%' AND '$ny'='内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1313,14 +1132,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id OR (
|
||||
($HBBMJ=1 AND m.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND m.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR m.warehouse_id = $warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and m.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
|
||||
|
@ -1340,14 +1155,10 @@ class StockService
|
|||
AND ".$invoice_dt." >= '$start_dt'
|
||||
AND ".$invoice_dt." <= '$end_dt'
|
||||
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id OR (
|
||||
($HBBMJ=1 AND d.warehouse_id=20005 AND $warehouse_id=139)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20047 AND $warehouse_id=20001)
|
||||
OR ($HBBMJ=1 AND d.warehouse_id=20048 AND $warehouse_id=140)
|
||||
))
|
||||
and ($warehouse_id = 0 OR d.warehouse_id=$warehouse_id)
|
||||
|
||||
and ('$batch_sn' = '' OR d.batch_sn = '$batch_sn')
|
||||
and ('$ny' = '' OR (pc.name like '%外销%' AND '$ny' = '外销') OR (pc.name not like '%内销%' AND '$ny' = '内销'))
|
||||
and ('$ny' = '' OR (p.is_export = 1 AND '$ny' = '外销') OR (isnull(p.is_export, 0) = 0 AND '$ny' = '内销'))
|
||||
and ($product_id = 0 OR d.product_id = $product_id)
|
||||
and d.warehouse_id in (SELECT uwh.warehouse_id FROM user_warehouse uwh where user_id = $user_id)
|
||||
) as c, product p, product_unit g, warehouse w
|
||||
|
@ -1484,7 +1295,7 @@ class StockService
|
|||
SELECT w.code AS warehouse_code, p.code AS product_code, a.batch_sn AS batch_sn, a.batch_date,
|
||||
a.poscode AS poscode, a.posname AS posname, w.type as warehouse_type, w.name AS warehouse_name, p.name AS product_name, p.product_type,
|
||||
p.spec AS product_spec, u.id AS unit_id, u.name AS product_unit, u.name AS unit_name, p.category_id, p.id AS product_id, w.id AS warehouse_id,
|
||||
round(a.Num, 4) AS num,
|
||||
round(a.Num, 4) AS num, p.is_export,
|
||||
round(isnull(a.Num, 0) - isnull(a.FhNum, 0) - isnull(a.Cknum, 0) + isnull(a.Rknum, 0), 4) AS ky_num,
|
||||
round(isnull(a.FhNum, 0), 4) AS fh_num,
|
||||
round(isnull(a.Cknum, 0), 4) AS ck_num,
|
||||
|
|
|
@ -402,7 +402,7 @@ return [
|
|||
]
|
||||
],
|
||||
"report" => [
|
||||
"name" => "报表",
|
||||
"name" => "库存报表",
|
||||
"actions" => [
|
||||
"stockDetail" => [
|
||||
"name" => "库存明细表"
|
||||
|
|
|
@ -24,6 +24,18 @@
|
|||
<input class="form-control input-sm" type="text" id="value" name="value" value="{{$row['value']}}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">状态</td>
|
||||
<td align="left">
|
||||
<select class="form-control input-sm" name="status" id="status">
|
||||
@foreach(option('common.status') as $status)
|
||||
<option value="{{$status['id']}}" @if($row['status'] == $status['id']) selected @endif>{{$status['name']}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">排序</td>
|
||||
<td align="left">
|
||||
|
|
|
@ -59,7 +59,7 @@ class DepartmentController extends DefaultController
|
|||
}
|
||||
|
||||
$model->select($header['select'])
|
||||
->addSelect(DB::raw('parent_id,(select count(id) from [user] where department_id = department.id) as user_count'));
|
||||
->addSelect(DB::raw('(select count(id) from [user] where department_id = department.id) as user_count'));
|
||||
|
||||
$items = $model->get()->toNested('name');
|
||||
$items = Grid::dataFilters($items, $header, function($item) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class UserController extends DefaultController
|
|||
}
|
||||
}
|
||||
|
||||
$header['select'][] = 'password_text';
|
||||
$header['select'][] = 'user.password_text';
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
|
|
|
@ -77,7 +77,7 @@ class UserService
|
|||
return User::whereIn('department_id', $departments)->pluck('id')->toArray();
|
||||
}
|
||||
|
||||
// 销售团队
|
||||
// 销售组
|
||||
if ($level == 5) {
|
||||
$regions = DB::table('customer_region')->get()->toNested();
|
||||
// 审批权限
|
||||
|
@ -114,6 +114,187 @@ class UserService
|
|||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
*/
|
||||
public static function getRolesAccess()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$query = [
|
||||
'team_id' => 0,
|
||||
'customer_id' => 0,
|
||||
];
|
||||
|
||||
foreach ($query as $k => $v) {
|
||||
$query[$k] = Request::get($k, $v);
|
||||
}
|
||||
|
||||
$teams = DB::table('customer_region')->get()->toNested()->toArray();
|
||||
|
||||
$roles = DB::table('role')
|
||||
->leftJoin('user_role', 'user_role.role_id', '=', 'role.id')
|
||||
->where('user_role.user_id', $user['id'])
|
||||
->get();
|
||||
|
||||
// 支持销售组
|
||||
$isTeam = false;
|
||||
|
||||
$res = [];
|
||||
|
||||
// 自己
|
||||
$res['userId'] = $user->id;
|
||||
|
||||
foreach($roles as $role) {
|
||||
|
||||
// 全部数据权限
|
||||
if ($role['access'] == 'all') {
|
||||
$isTeam = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($role['access'] == 'team' || $role['access'] == 'team2') {
|
||||
$isTeam = true;
|
||||
}
|
||||
|
||||
// 获取单个角色权限
|
||||
$access = static::getRoleAccess($user, $role, $teams);
|
||||
|
||||
// 筛选了销售组重置过滤条件
|
||||
if ($isTeam && $query['team_id'] > 0) {
|
||||
$access['whereIn']['team'] = [$query['team_id']];
|
||||
}
|
||||
$res['roles'][] = $access;
|
||||
}
|
||||
|
||||
if ($isTeam) {
|
||||
$res['team'] = $teams;
|
||||
}
|
||||
|
||||
// 没有筛选销售组
|
||||
if ($query['team_id'] == 0) {
|
||||
$query['customer_id'] = 0;
|
||||
}
|
||||
|
||||
$res['query'] = $query;
|
||||
|
||||
print_r($res);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
*/
|
||||
public static function getRoleAccess($user, $role, $teams)
|
||||
{
|
||||
$res = [];
|
||||
|
||||
$res['whereIn'] = [];
|
||||
$res['authorise'] = false;
|
||||
|
||||
// 用户组
|
||||
$group_id = $user['group_id'];
|
||||
switch ($group_id) {
|
||||
// 用户
|
||||
case 1:
|
||||
// 角色数据权限
|
||||
switch ($role['access']) {
|
||||
// 本人
|
||||
case 'me':
|
||||
$res['userIds'] = [$user->id];
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = [];
|
||||
$res['whereIn']['user'] = $res['userIds'];
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 本人和下属
|
||||
case 'me2':
|
||||
$users = DB::table('user')->whereRaw('(id = '.$user->id.' or leader_id = '.$user->id.')')->pluck('id')->toArray();
|
||||
$res['userIds'] = $users;
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = [];
|
||||
$res['whereIn']['user'] = $users;
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 本部门
|
||||
case 'dept':
|
||||
$users = DB::table('user')->where('department_id', $user->department_id)->pluck('id')->toArray();
|
||||
$res['userIds'] = $users;
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = [];
|
||||
$res['whereIn']['user'] = $users;
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 本部门和下级部门
|
||||
case 'dept2':
|
||||
$departmentIds = DB::table('user')->treeById($user->department_id)->toArray();
|
||||
$users = DB::table('user')->whereIn('department_id', $departmentIds)->pluck('id')->toArray();
|
||||
$res['userIds'] = $users;
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = [];
|
||||
$res['whereIn']['user'] = $users;
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 本销售组
|
||||
case 'team':
|
||||
// 审批权限,查询权限
|
||||
$teamIds = DB::table('customer_region')
|
||||
->whereRaw('(owner_user_id = '.$user->id.' or '.db_instr('owner_assist', $user->id).')')->pluck('id')->toArray();
|
||||
$res['userIds'] = [];
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = $teamIds;
|
||||
$res['whereIn']['team'] = $teamIds;
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 本销售组和下级销售组
|
||||
case 'team2':
|
||||
// 审批权限,查询权限
|
||||
$_teamIds = DB::table('customer_region')
|
||||
->whereRaw('(owner_user_id = '.$user->id.' or '.db_instr('owner_assist', $user->id).')')->pluck('id')->toArray();
|
||||
$teamIds = [];
|
||||
foreach($_teamIds as $_teamId) {
|
||||
foreach($teams[$_teamId]['child'] as $id) {
|
||||
$teamIds[] = $id;
|
||||
}
|
||||
}
|
||||
$res['userIds'] = [];
|
||||
$res['customerIds'] = [];
|
||||
$res['teamIds'] = $teamIds;
|
||||
$res['whereIn']['team'] = $teamIds;
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
case 'all':
|
||||
break;
|
||||
}
|
||||
// 客户
|
||||
case 2:
|
||||
$customerIds = DB::table('customer')->where('user_id', $user->id)->pluck('id')->toArray();
|
||||
$res['userIds'] = [];
|
||||
$res['customerIds'] = $customerIds;
|
||||
$res['whereIn']['customer'] = $customerIds;
|
||||
$res['teamIds'] = [];
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 客户联系人
|
||||
case 3:
|
||||
$customerIds = DB::table('customer_contact')->where('user_id', $user->id)->pluck('customer_id')->toArray();
|
||||
$res['userIds'] = [];
|
||||
$res['customerIds'] = $customerIds;
|
||||
$res['whereIn']['customer'] = $customerIds;
|
||||
$res['teamIds'] = [];
|
||||
$res['authorise'] = true;
|
||||
break;
|
||||
// 供应商
|
||||
case 4:
|
||||
break;
|
||||
// 供应商联系人
|
||||
case 5:
|
||||
break;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查动态密码
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,7 @@ return [
|
|||
"name" => "编辑"
|
||||
],
|
||||
"config" => [
|
||||
"name" => "控制器权限"
|
||||
"name" => "权限"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<div class="panel-body">
|
||||
@if(count($groupValue['actions']))
|
||||
@foreach($groupValue['actions'] as $childKey => $childValue)
|
||||
<div class="col-md-3 col-sm-6 wrapper-xs">
|
||||
<div class="col-md-2 col-sm-4 wrapper-xs">
|
||||
{{'';$selected = $assets[$menuKey][$groupKey.'.'.$childKey]}}
|
||||
<label title="{{$childKey}}" class="checkbox-inline">
|
||||
<input type="checkbox" class="action-check" name="assets[{{$menuKey}}][{{$groupKey}}.{{$childKey}}][action]" value="1" @if(isset($selected)) checked @endif>
|
||||
|
|
|
@ -63,7 +63,7 @@ class Dialog
|
|||
'url' => 'promotion/promotion/dialog',
|
||||
],
|
||||
'region' => [
|
||||
'title' => '销售团队',
|
||||
'title' => '销售组',
|
||||
'table' => 'customer_region',
|
||||
'field' => 'name',
|
||||
'url' => 'customer/region/dialog',
|
||||
|
|
|
@ -39,29 +39,29 @@ function make_sn($config, $update = false)
|
|||
}
|
||||
|
||||
$no = DB::table('model_seq_no')
|
||||
->where('bill_id', $bill_id)
|
||||
->where('rule_code', $new_rule)
|
||||
->first();
|
||||
->where('bill_id', $bill_id)
|
||||
->where('rule_code', $new_rule)
|
||||
->first();
|
||||
|
||||
if (empty($no)) {
|
||||
$new_sn = 1;
|
||||
if ($update == true) {
|
||||
DB::table('model_seq_no')
|
||||
->insert([
|
||||
'bill_id' => $bill_id,
|
||||
'rule_code' => $new_rule,
|
||||
'seq_no' => $new_sn,
|
||||
]);
|
||||
->insert([
|
||||
'bill_id' => $bill_id,
|
||||
'rule_code' => $new_rule,
|
||||
'seq_no' => $new_sn,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$new_sn = (int) $no['seq_no'] + 1;
|
||||
if ($update == true) {
|
||||
DB::table('model_seq_no')
|
||||
->where('bill_id', $bill_id)
|
||||
->where('rule_code', $new_rule)
|
||||
->update([
|
||||
'seq_no' => $new_sn,
|
||||
]);
|
||||
->where('bill_id', $bill_id)
|
||||
->where('rule_code', $new_rule)
|
||||
->update([
|
||||
'seq_no' => $new_sn,
|
||||
]);
|
||||
}
|
||||
}
|
||||
$new_value = $config['prefix'] . $new_rule . str_pad($new_sn, $length, '0', STR_PAD_LEFT);
|
||||
|
@ -102,7 +102,6 @@ function search_condition($query)
|
|||
case 'not_empty':
|
||||
$condition = array('!=', '');
|
||||
break;
|
||||
|
||||
case 'gt':
|
||||
$condition = array('>', $search);
|
||||
break;
|
||||
|
@ -121,34 +120,27 @@ function search_condition($query)
|
|||
case 'neq':
|
||||
$condition = array('!=', $search);
|
||||
break;
|
||||
|
||||
case 'birthday':
|
||||
$condition = array('birthday', $search);
|
||||
break;
|
||||
|
||||
case 'birthbetween':
|
||||
$condition = array('birthbetween', $search);
|
||||
break;
|
||||
|
||||
case 'pacs':
|
||||
$condition = array('pacs', $search);
|
||||
break;
|
||||
case 'region':
|
||||
$condition = array('region', $search);
|
||||
break;
|
||||
|
||||
case 'in':
|
||||
$condition = array('in', explode(',', $search));
|
||||
break;
|
||||
|
||||
case 'dialog':
|
||||
$condition = array('in', explode(',', $search));
|
||||
break;
|
||||
|
||||
case 'address':
|
||||
$condition = array('!=', '');
|
||||
break;
|
||||
|
||||
case 'second2':
|
||||
$condition = array('second2', [strtotime($search[0]), strtotime($search[1])]);
|
||||
break;
|
||||
|
@ -314,7 +306,7 @@ function regionCustomer($table = 'customer')
|
|||
$role_type = 'region';
|
||||
}
|
||||
|
||||
// 销售团队
|
||||
// 销售组
|
||||
if ($level == 5) {
|
||||
$role_type = 'region';
|
||||
}
|
||||
|
@ -1220,7 +1212,7 @@ function array_nest(&$items, $text = 'name')
|
|||
/**
|
||||
* 百度编辑器
|
||||
*/
|
||||
function ueditor($name = 'content', $value = '', $config = array())
|
||||
function ueditor($name = 'content', $value = '', $config = [])
|
||||
{
|
||||
static $loaded;
|
||||
if (empty($loaded)) {
|
||||
|
@ -1247,7 +1239,7 @@ function option($key, $value = '')
|
|||
if ($parent === null) {
|
||||
return [];
|
||||
}
|
||||
$items[$key] = DB::table('option')->where('parent_id', $parent['id'])->orderBy('sort', 'asc')->get(['name', 'value as id']);
|
||||
$items[$key] = DB::table('option')->where('parent_id', $parent['id'])->orderBy('sort', 'asc')->get(['name', 'value as id']);
|
||||
$values[$key] = array_by($items[$key], 'id');
|
||||
}
|
||||
|
||||
|
@ -1523,18 +1515,18 @@ function response_json($data, $status = false)
|
|||
return response()->json($json);
|
||||
}
|
||||
|
||||
// 判断登录是客户
|
||||
// 登录是客户
|
||||
function is_customer()
|
||||
{
|
||||
return auth()->user()->role_id == 2;
|
||||
return auth()->user()->group_id == 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查账户是否超级管理员
|
||||
* 登录是管理员
|
||||
*/
|
||||
function is_admin()
|
||||
{
|
||||
return Auth::user()->admin == 1 ? true : false;
|
||||
return auth()->user()->admin == 1;
|
||||
}
|
||||
|
||||
// 获取生产日期
|
||||
|
|
|
@ -187,7 +187,7 @@ Builder::macro('search', function ($search) {
|
|||
} elseif ($condition == 'in') {
|
||||
$this->whereIn($search['field'], $value);
|
||||
|
||||
// 销售团队
|
||||
// 销售组
|
||||
} elseif ($search['field'] == 'customer.region_id') {
|
||||
if ($value[0]) {
|
||||
$this->where($search['field'], $value[0]);
|
||||
|
@ -299,6 +299,7 @@ Builder::macro('permission', function ($field, $user = null, $null = false, $all
|
|||
$where[] = db_instr($fids, 'd'.$_deps);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = join(' or ', $where);
|
||||
if ($sql) {
|
||||
$sql = '('.$sql.')';
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -111,7 +111,7 @@
|
|||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "味聚特商务系统",
|
||||
"navigationBarTitleText": "Gdoo协同办公",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
|
|
|
@ -20,10 +20,6 @@ Gdoo\Model\Services\ModuleService::allWithDetails();
|
|||
|
||||
$path = Request::path();
|
||||
|
||||
if (strpos($path, 'caldav') === 0) {
|
||||
App\Support\DAV::caldav('caldav');
|
||||
}
|
||||
|
||||
if (strpos($path, 'calendar/caldav') === 0) {
|
||||
App\Support\DAV::caldav('calendar/caldav');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue