|
@@ -94,28 +94,28 @@ class Set
|
|
|
$type = Dever::input('type', 'shop');
|
|
|
$table = 'cash/' . $type;
|
|
|
|
|
|
- $info = Dever::db($table)->one($id);
|
|
|
+ $data = Dever::db($table)->one($id);
|
|
|
|
|
|
- if ($info) {
|
|
|
+ if ($data) {
|
|
|
Dever::db($table)->update(array('where_id' => $id, 'status' => 2));
|
|
|
- $data = Dever::db('cash/shop')->find($info);
|
|
|
- $card = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>2,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
|
|
|
- $shop = Dever::db('shop/info')->find($data['shop_id']);
|
|
|
- if($card && $card['cash']>0){
|
|
|
- $cash = sprintf("%01.2f", $card['cash']);
|
|
|
- $yue = $shop['price'] + $cash;
|
|
|
- $explan = date('Y年m月d日',$data['end']).'礼品卡对账金额';
|
|
|
- Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
|
|
|
- Dever::db('shop/info')->update(array('where_id'=>$shop['id'],'price'=>$yue));
|
|
|
- }
|
|
|
- $bao = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>3,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
|
|
|
- if($bao && $bao['cash']>0){
|
|
|
- $shop = Dever::db('shop/info')->find(array('id'=>$shop['id'],'s'=>1));
|
|
|
- $cash = sprintf("%01.2f", $bao['cash']);
|
|
|
- $yue = $shop['price'] + $cash;
|
|
|
- $explan = date('Y年m月d日',$data['end']).'钱包对账金额';
|
|
|
- Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
|
|
|
- Dever::db('shop/info')->update(array('where_id'=>$shop['id'],'price'=>$yue));
|
|
|
+
|
|
|
+ if ($type == 'shop_sell') {
|
|
|
+ $card = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>2,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
|
|
|
+ $shop = Dever::db('shop/info')->find($data['shop_id']);
|
|
|
+ if ($card && $card['cash'] > 0) {
|
|
|
+ $cash = sprintf("%01.2f", $card['cash']);
|
|
|
+ $yue = $shop['price'] + $cash;
|
|
|
+ $explan = date('Y年m月d日',$data['end']).'礼品卡对账金额';
|
|
|
+ Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
|
|
|
+ }
|
|
|
+ $bao = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>3,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
|
|
|
+ if($bao && $bao['cash']>0){
|
|
|
+ $shop = Dever::db('shop/info')->find(array('id'=>$shop['id'],'s'=>1));
|
|
|
+ $cash = sprintf("%01.2f", $bao['cash']);
|
|
|
+ $yue = $shop['price'] + $cash;
|
|
|
+ $explan = date('Y年m月d日',$data['end']).'钱包对账金额';
|
|
|
+ Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -147,11 +147,15 @@ class Set
|
|
|
}
|
|
|
|
|
|
$show = Dever::input('show', 1);
|
|
|
-
|
|
|
$type = Dever::input('type', 'shop');
|
|
|
+ $pay_type = 1;
|
|
|
if ($type == 'shop') {
|
|
|
$search_option_type = 1;
|
|
|
$name = '门店';
|
|
|
+ } if ($type == 'shop_sell') {
|
|
|
+ $search_option_type = 1;
|
|
|
+ $pay_type = '2,3';
|
|
|
+ $name = '门店零售';
|
|
|
} elseif ($type == 'store') {
|
|
|
$search_option_type = 3;
|
|
|
$name = '仓库';
|
|
@@ -266,7 +270,7 @@ class Set
|
|
|
|
|
|
$html .= '</tbody></table></div></div>';
|
|
|
|
|
|
- $data = $this->getOrderData($type, $info, '');
|
|
|
+ $data = $this->getOrderData($type, $info, '', $pay_type);
|
|
|
|
|
|
if ($data) {
|
|
|
|
|
@@ -394,12 +398,16 @@ class Set
|
|
|
$id = Dever::input('id');
|
|
|
|
|
|
$table = 'cash/' . $type;
|
|
|
+ $pay_type = 1;
|
|
|
+ if ($type == 'shop_sell') {
|
|
|
+ $pay_type = '2,3';
|
|
|
+ }
|
|
|
|
|
|
$config = Dever::db($table)->config;
|
|
|
|
|
|
$info = Dever::db($table)->one($id);
|
|
|
|
|
|
- $data = $this->getOrderData($type, $info);
|
|
|
+ $data = $this->getOrderData($type, $info, 'NoPage', $pay_type);
|
|
|
|
|
|
$stat_type = Dever::db('cash/shop')->config['config_type'];
|
|
|
$other = Dever::db($type . '/info')->find($info[$type . '_id']);
|
|
@@ -470,8 +478,12 @@ class Set
|
|
|
}
|
|
|
|
|
|
$type = Dever::input('type', 'shop');
|
|
|
+ $pay_type = 1;
|
|
|
if ($type == 'shop') {
|
|
|
$name = '门店';
|
|
|
+ } elseif ($type == 'shop_sell') {
|
|
|
+ $pay_type = '2,3';
|
|
|
+ $name = '门店';
|
|
|
} elseif ($type == 'store') {
|
|
|
$name = '仓库';
|
|
|
} elseif ($type == 'factory') {
|
|
@@ -506,7 +518,7 @@ class Set
|
|
|
|
|
|
$pdf->hr();
|
|
|
|
|
|
- $data = $this->getOrderData($type, $info);
|
|
|
+ $data = $this->getOrderData($type, $info, 'NoPage', $pay_type);
|
|
|
|
|
|
$body = array();
|
|
|
$body_total = array();
|
|
@@ -595,12 +607,13 @@ class Set
|
|
|
}
|
|
|
|
|
|
# 获取对账单数据
|
|
|
- public function getOrderData($type, $info, $page = 'NoPage')
|
|
|
+ public function getOrderData($type, $info, $page = 'NoPage', $pay_type = 1)
|
|
|
{
|
|
|
$id = $info[$type . '_id'];;
|
|
|
- if ($type == 'shop') {
|
|
|
+ if ($type == 'shop' || $type == 'shop_sell') {
|
|
|
$where['type'] = 1;
|
|
|
$where['type_id'] = $id;
|
|
|
+ $where['pay_type'] = $pay_type;
|
|
|
$m = 'getAll';
|
|
|
} elseif ($type == 'factory') {
|
|
|
$where['source_type'] = 3;
|