mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
78 lines
3.0 KiB
PHP
78 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
class purchase_ctl_admin_appropriation extends desktop_controller{
|
|
var $name = "调拔单管理";
|
|
var $workground = "storage_center";
|
|
function index(){
|
|
|
|
$params = array(
|
|
'actions' => array(
|
|
array(
|
|
'label'=>'导出模板',
|
|
'href'=>'index.php?app=purchase&ctl=admin_appropriation&act=exportTemplate',
|
|
'target'=>'_bank'
|
|
)
|
|
),
|
|
'title'=>'调拔单',
|
|
'use_buildin_new_dialog' => false,
|
|
'use_buildin_set_tag'=>false,
|
|
'use_buildin_recycle'=>false,
|
|
'use_buildin_export'=>false,
|
|
'use_buildin_import'=>true,
|
|
'use_buildin_filter'=>true,
|
|
);
|
|
/*
|
|
* 获取操作员管辖仓库
|
|
*/
|
|
$oBranch = app::get('ome')->model('branch');
|
|
$is_super = kernel::single('desktop_user')->is_super();
|
|
if (!$is_super){
|
|
$branch_ids = $oBranch->getBranchByUser(true);
|
|
if ($branch_ids){
|
|
$oApp = $this->app->model('appropriation_items');
|
|
$app_list = $oApp->getList('appropriation_id', array('to_branch_id'=>$branch_ids), 0,-1);
|
|
if ($app_list)
|
|
foreach ($app_list as $p){
|
|
$applist[] = $p['appropriation_id'];
|
|
}
|
|
if ($applist){
|
|
$applist = array_unique($applist);
|
|
$params['base_filter']['appropriation_id'] = $applist;
|
|
}else{
|
|
$params['base_filter']['appropriation_id'] = 'false';
|
|
}
|
|
}else{
|
|
$params['base_filter']['appropriation_id'] = 'false';
|
|
}
|
|
}
|
|
|
|
$this->finder('purchase_mdl_appropriation', $params);
|
|
}
|
|
|
|
function exportTemplate(){
|
|
header("Content-Type: text/csv");
|
|
header("Content-Disposition: attachment; filename=allocation".date('YmdHis').".csv");
|
|
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
|
|
header('Expires:0');
|
|
header('Pragma:public');
|
|
$appropriationObj = $this->app->model('appropriation');
|
|
$title1 = $appropriationObj->exportTemplate('appropriation');
|
|
echo '"'.implode('","',$title1).'"';
|
|
}
|
|
}
|
|
?>
|