模板下载功能添加

master
zhengyongxing 4 years ago
parent 07ee17ca1d
commit 9fceedd10e

@ -26,7 +26,8 @@ class MarketPercentageController extends ThinkController
parent::_initialize();
}
public function index($row = 10, $p = 1){
public function index($row = 10, $p = 1)
{
$map = [];
@ -204,7 +205,8 @@ class MarketPercentageController extends ThinkController
}
public function indexuncaculate($row = 10, $p = 1){
public function indexuncaculate($row = 10, $p = 1)
{
$map = [];
@ -382,7 +384,8 @@ class MarketPercentageController extends ThinkController
}
public function addcoefficient() {
public function addcoefficient()
{
$batch = date('Ymd') . date('His') . sp_random_num(3);
$this->assign("batch", $batch);
@ -467,7 +470,8 @@ class MarketPercentageController extends ThinkController
}
public function coefficientSave() {
public function coefficientSave()
{
$pay_time = date('Y-m', strtotime(date('Y', time()) . '-' . (date('m', time()) - 1) . '-01'));
@ -523,7 +527,6 @@ class MarketPercentageController extends ThinkController
])->save($marketSave);
} else {
$save['create_time'] = time();
M("coefficient", "tab_")->add($save);
@ -560,7 +563,8 @@ class MarketPercentageController extends ThinkController
}
public function marketStaffSettle($row = 10, $p = 1) {
public function marketStaffSettle($row = 10, $p = 1)
{
$map = [];
@ -841,8 +845,7 @@ class MarketPercentageController extends ThinkController
} elseif ($month == '04') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus'];
}
elseif($month == '01') {
} elseif ($month == '01') {
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus'];
}
@ -890,8 +893,7 @@ class MarketPercentageController extends ThinkController
$data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '09' . 'achievement_bonus'];
} elseif ($month == '04') {
$data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus'];
}
elseif($month == '01') {
} elseif ($month == '01') {
$data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
}
}
@ -910,7 +912,6 @@ class MarketPercentageController extends ThinkController
$sum['company_profit'] += $data[$key]['company_profit'];
}
$sum['wait_commission'] = '-------';
$sum['pay_time'] = '总计';
@ -966,7 +967,6 @@ class MarketPercentageController extends ThinkController
}
// $data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)";
} else {
$data[$key]['performance_commission'] .= ',2)';
@ -974,8 +974,6 @@ class MarketPercentageController extends ThinkController
}
// if ($value['achievement_profit'] != "0.00") {
// if ($data[$key]['performance_commission'] == "=ROUND(") {
// $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)";
@ -1021,7 +1019,8 @@ class MarketPercentageController extends ThinkController
}
public function personMarketStaffSettle($row = 10, $p = 1) {
public function personMarketStaffSettle($row = 10, $p = 1)
{
// var_dump(getMarketAdmin());
$map = [];
@ -1246,7 +1245,8 @@ class MarketPercentageController extends ThinkController
}
public function sendBonus() {
public function sendBonus()
{
$map['pay_time'] = $_REQUEST['pay_time'];
@ -1304,7 +1304,8 @@ class MarketPercentageController extends ThinkController
}
public function reCaculateBonus() {
public function reCaculateBonus()
{
$pay_time = $_REQUEST['pay_time'];
@ -1320,7 +1321,8 @@ class MarketPercentageController extends ThinkController
$this->ajaxReturn(['status' => 1]);
}
public function showBonusList($row = 10, $p = 1) {
public function showBonusList($row = 10, $p = 1)
{
//排序
if (!array_key_exists("time_start", $_REQUEST)) {
@ -1520,7 +1522,8 @@ class MarketPercentageController extends ThinkController
}
public function editTaxRatio() {
public function editTaxRatio()
{
if (IS_POST) {
@ -1569,8 +1572,10 @@ class MarketPercentageController extends ThinkController
}
}
//市场部确认操作
public function doMarketCheck() {
public function doMarketCheck()
{
$ids = $_REQUEST['ids'];
@ -1591,8 +1596,10 @@ class MarketPercentageController extends ThinkController
$this->ajaxReturn(['status' => 1, 'info' => '市场部确认成功']);
}
//财务部审批操作
public function doFinanceCheck() {
public function doFinanceCheck()
{
$ids = $_REQUEST['ids'];
@ -1615,7 +1622,8 @@ class MarketPercentageController extends ThinkController
}
public function companybelonggame($row = 10, $p = 1) {
public function companybelonggame($row = 10, $p = 1)
{
if ($_REQUEST['relation_game_id']) {
$game_id = $_REQUEST['relation_game_id'];
@ -1688,8 +1696,8 @@ class MarketPercentageController extends ThinkController
}
public function addcompanybelonggame() {
public function addcompanybelonggame()
{
if (IS_POST) {
@ -1744,7 +1752,8 @@ class MarketPercentageController extends ThinkController
}
public function editcompanybelonggame() {
public function editcompanybelonggame()
{
$id = $_REQUEST["id"];
@ -1794,22 +1803,19 @@ class MarketPercentageController extends ThinkController
$last_month = strtotime(date('Y-m-t', strtotime("-2 month")));
if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month)
{
if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month) {
$time_end = $last_month;
$data['end_time'] = $last_month;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
$last_month_first = strtotime(date('Y-m-1', strtotime("-1 month")));
if ($company_belong_game_data['begin_time'] > $last_month && $data['begin_time'] < $last_month)
{
if ($company_belong_game_data['begin_time'] > $last_month && $data['begin_time'] < $last_month) {
// $time_end = $last_month;
$data['begin_time'] = $last_month_first;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) {
if ($company_belong_game_data['end_time'] <= $last_month) {
@ -1897,7 +1903,8 @@ class MarketPercentageController extends ThinkController
}
public function delcompanybelonggame() {
public function delcompanybelonggame()
{
$id = $_REQUEST["id"];
@ -1926,7 +1933,8 @@ class MarketPercentageController extends ThinkController
}
public function showGame() {
public function showGame()
{
$data = $_REQUEST;
@ -1969,4 +1977,32 @@ class MarketPercentageController extends ThinkController
}
}
//模板导出
public function downloadCoefficient()
{
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
//设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/coefficient.xlsx");
$fileName = "绩效导入模板";
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
}

@ -104,6 +104,9 @@
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="下载模板" title="下载模板" href="{:U('downloadCoefficient')}">
下载模板
</a>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>

@ -534,4 +534,32 @@ class ExcelPaymentController extends BaseController
}
//模板导出
public function downloadTemplate()
{
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
//设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/underPayment.xlsx");
$fileName = "线下打款导入模板";
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
}

@ -53,6 +53,9 @@
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="下载模板" title="下载模板" href="{:U('downloadTemplate')}">
下载模板
</a>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>

Loading…
Cancel
Save