Files
OMS/app/finance/lib/bill/order.php
2026-01-04 19:08:31 +08:00

105 lines
4.3 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 finance_bill_order extends eccommon_analysis_abstract implements eccommon_analysis_interface{
public $detail_options = array(
'hidden' => true,
);
public $graph_options = array(
'hidden' => true,
);
public $type_options = array(
'display' => 'true',
);
function __construct(&$app)
{
parent::__construct($app);
$this->_render = kernel::single('desktop_controller');
for($i=0;$i<=5;$i++){
if ($i == 1) continue;
$val = $i+1;
$this->_render->pagedata['time_shortcut'][$i] = $val;
}
#店铺
$shopObj = &app::get('ome')->model('shop');
$shopdata = $shopObj->getList('name,shop_id');
$this->_render->pagedata['shopdata']= $shopdata;
$this->_render->pagedata['shop_id']= $_POST['shop_id'] ? $_POST['shop_id'] : '0';
#各费用类的总额
$feedata = kernel::single('finance_bill')->get_fee_type_money_by_shop_id($_POST['time_from'],$_POST['time_to'],$this->_render->pagedata['shop_id']);
$this->_render->pagedata['feedata']= $feedata;
$this->_extra_view = array('finance' => 'bill/order.html');
}
/**
* 查找er
* @return mixed 返回结果
*/
public function finder(){
//$base_query_string = 'time_from='.$_POST['time_from'].'&time_to='.$_POST['time_to'];
$this->export_href = 'index.php?app=finance&ctl=bill_order&act=index&action=export';
$params = array(
'model' => 'finance_mdl_bill_order',
'params' => array(
'actions'=>array(
array(
'label' => '导出',
'href' => $this->export_href,
'target' => '{width:600,height:300,title:\'导出\'}',
//'id'=>'export_id',
'class'=>'export',
),
),
'title'=>'订单账单<script>if($$(".finder-list").getElement("tbody").get("html") == "\n" || $$(".finder-list").getElement("tbody").get("html") == "" ){$$(".export").set("href","javascript:;").set("onclick", "alert(\"没有可以生成的数据\")");}else{$$(".export").set("href",\'index.php?app=finance&ctl=bill_order&act=index&action=export\');}</script>',
'use_buildin_recycle'=>false,
'use_buildin_selectrow'=>false,
'use_buildin_filter'=>false,
'finder_aliasname'=>'order_bill',
'object_method'=>array('count'=>'count_order_bill','getlist'=>'getlist_order_bill'),
'finder_cols'=>'order_bn,channel_name,column_trade,column_plat,column_branch,column_delivery,column_other,column_total',
//'base_query_string'=>$base_query_string,
//'base_filter'=>array('time_from'=>$this->_params['time_from'],'time_to'=>$this->_params['time_to'],'shop_id'=>$this->_params['shop_id']),
),
);
#增加财务导出权限
$is_export = kernel::single('desktop_user')->has_permission('finance_export');
if(!$is_export){
unset($params['params']['actions']);
}
return $params;
}
function export_href()
{
$base_href = $this->export_href;
$str = <<<EOF
<script>
$('export_id').href="{$base_href}";
$('export_id').addEvent('click',function(){var finder_id = $('workground').getElement('input[name^=_finder[finder_id]');
var filter_input = $('finder-filter-'+finder_id.value);
if(filter_input){
$('export_id').href="{$base_href}"+"&"+filter_input.value+"&export_href=true";
}
});
</script>
EOF;
return $str;
}
}