|
@@ -96,32 +96,18 @@ class Sale extends Base
|
|
}
|
|
}
|
|
$origin_price = 0;
|
|
$origin_price = 0;
|
|
}else{
|
|
}else{
|
|
- $origin = Db::name("good_nake")->where([["spuCode","=",$spuCode],["min_num","<=",$good_num],["is_del","=",0]])->order("min_num desc")->find();
|
|
|
|
- if($origin==false){
|
|
|
|
- return error_show(1003,"未找到相关阶梯成本价格");
|
|
|
|
|
|
+ if($is_activity==0){
|
|
|
|
+ $origin = Db::name("good_nake")->where([["spuCode","=",$spuCode],["min_num","<=",$good_num],["is_del","=",0]])->order("min_num desc")->find();
|
|
|
|
+ if($origin==false){
|
|
|
|
+ return error_show(1003,"未找到相关阶梯成本价格");
|
|
|
|
+ }
|
|
|
|
+ $origin_price = $origin['nake_total'];
|
|
}
|
|
}
|
|
- $origin_price = $origin['nake_total'];
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- $sale_price = isset($this->post['good_price'])&&$this->post['good_price']!="" ? floatval($this->post['good_price']):0;
|
|
|
|
|
|
+ $sale_price = isset($this->post['good_price'])&&$this->post['good_price']!=="" ? floatval($this->post['good_price']):'';
|
|
$ct['cgd_gold_price']=0;
|
|
$ct['cgd_gold_price']=0;
|
|
- if($goodtype==1){
|
|
|
|
- $good = Db::name("good_ladder")->where(["skuCode"=>$skuCode,"is_del"=>0,"status"=>1])->where([["min_num","<=",$good_num]])->order("min_num desc")->find();
|
|
|
|
- if($good==false){
|
|
|
|
- return error_show(1003,"未找到相关阶梯价格");
|
|
|
|
- }
|
|
|
|
- $sale_price = $good['sale_price'];
|
|
|
|
- if($ct['is_gold_price']==1 && $is_stock!=1){
|
|
|
|
- $gold = Db::name("gold_price1")
|
|
|
|
- ->field('id,price')
|
|
|
|
- ->where(["type" => $ct['noble_metal'], "is_del" => 0, "status" => 1])
|
|
|
|
- ->order("addtime desc")
|
|
|
|
- ->find();
|
|
|
|
-
|
|
|
|
- //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100);
|
|
|
|
- $sale_price = $ct['demo_fee'] / $good_num + $ct['open_fee'] / $good_num + $ct['noble_weight'] * $gold["price"] + $good['cost_fee'] * $ct['noble_weight'] + $origin['package_fee'] + $origin['mark_fee'] + $origin['cert_fee'] + $origin['nake_fee'] + $origin['delivery_fee'];
|
|
|
|
- $ct['cgd_gold_price']=$gold["price"];
|
|
|
|
- }
|
|
|
|
|
|
+ if($goodtype==1 ){
|
|
if($is_activity==1){
|
|
if($is_activity==1){
|
|
$act = Db::name("activity_info")->alias("a")->leftJoin("good_activity b","a.activity_code=b.activity_code")
|
|
$act = Db::name("activity_info")->alias("a")->leftJoin("good_activity b","a.activity_code=b.activity_code")
|
|
->where(["a.skuCode"=>$skuCode,"a.activity_code"=>$actcode,"a.is_del"=>0,"a.status"=>1,"b.status"=>6,"b.is_del"=>0])
|
|
->where(["a.skuCode"=>$skuCode,"a.activity_code"=>$actcode,"a.is_del"=>0,"a.status"=>1,"b.status"=>6,"b.is_del"=>0])
|
|
@@ -135,8 +121,30 @@ class Sale extends Base
|
|
if($act['activity_stock']<$good_num){
|
|
if($act['activity_stock']<$good_num){
|
|
return error_show(1003,"商品活动库存剩余{$act['activity_stock']}");
|
|
return error_show(1003,"商品活动库存剩余{$act['activity_stock']}");
|
|
}
|
|
}
|
|
- $sale_price=$act['activity_price'];
|
|
|
|
|
|
+ $sale_price = $sale_price!==""?$sale_price:$act['activity_price'];
|
|
|
|
+ $origin_price = $act['cost_price'];
|
|
|
|
+ }else{
|
|
|
|
+ $good = Db::name("good_ladder")->where(["skuCode"=>$skuCode,"is_del"=>0,"status"=>1])->where([["min_num","<=",$good_num]])->order("min_num desc")->find();
|
|
|
|
+ if($good==false){
|
|
|
|
+ return error_show(1003,"未找到相关阶梯价格");
|
|
|
|
+ }
|
|
|
|
+ $sale_price = $sale_price!==""?$sale_price: $good['sale_price'];
|
|
|
|
+ if($ct['is_gold_price']==1 && $is_stock!=1){
|
|
|
|
+ $gold = Db::name("gold_price1")
|
|
|
|
+ ->field('id,price')
|
|
|
|
+ ->where(["type" => $ct['noble_metal'], "is_del" => 0, "status" => 1])
|
|
|
|
+ ->order("addtime desc")
|
|
|
|
+ ->find();
|
|
|
|
+
|
|
|
|
+ //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100);
|
|
|
|
+ $sale_price = $sale_price!==""?$sale_price:($ct['demo_fee'] / $good_num + $ct['open_fee'] / $good_num
|
|
|
|
+ + $ct['noble_weight'] * $gold["price"] + $good['cost_fee'] * $ct['noble_weight'] + $origin['package_fee'] + $origin['mark_fee'] + $origin['cert_fee'] + $origin['nake_fee'] + $origin['delivery_fee']);
|
|
|
|
+ $ct['cgd_gold_price']=$gold["price"];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ $sale_price=0;
|
|
}
|
|
}
|
|
$cgd=[
|
|
$cgd=[
|
|
"supplierNo"=>$ct['supplierNo'],
|
|
"supplierNo"=>$ct['supplierNo'],
|
|
@@ -287,7 +295,7 @@ class Sale extends Base
|
|
foreach ($addrlist as $value){
|
|
foreach ($addrlist as $value){
|
|
$temp=[];
|
|
$temp=[];
|
|
$addrs=[];
|
|
$addrs=[];
|
|
- if($value['addr_code']!==''&&is_array($value['addr_code'])){
|
|
|
|
|
|
+ if($value['addr_code']!==''&&is_array($value['addr_code'])&&!empty($value['addr_code'])){
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
@@ -564,7 +572,7 @@ class Sale extends Base
|
|
foreach ($addrlist as $value){
|
|
foreach ($addrlist as $value){
|
|
$temp=[];
|
|
$temp=[];
|
|
$addrs=[];
|
|
$addrs=[];
|
|
- if($value['addr_code']!==''&&is_array($value['addr_code'])){
|
|
|
|
|
|
+ if($value['addr_code']!==''&&is_array($value['addr_code'])&&!empty($value['addr_code'])){
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
@@ -973,7 +981,7 @@ class Sale extends Base
|
|
foreach ($va as $value){
|
|
foreach ($va as $value){
|
|
$temp=[];
|
|
$temp=[];
|
|
$addrs=[];
|
|
$addrs=[];
|
|
- if($value['addr_code']!==''&&is_array($value['addr_code'])){
|
|
|
|
|
|
+ if($value['addr_code']!==''&&is_array($value['addr_code'])&&!empty($value['addr_code'])){
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
@@ -1417,7 +1425,7 @@ class Sale extends Base
|
|
foreach ($data['addrlist'] as $value) {
|
|
foreach ($data['addrlist'] as $value) {
|
|
$temp = [];
|
|
$temp = [];
|
|
$addrs = [];
|
|
$addrs = [];
|
|
- if ($value['addr_code'] !== '' && is_array($value['addr_code'])) {
|
|
|
|
|
|
+ if ($value['addr_code'] !== '' && is_array($value['addr_code'])&&!empty($value['addr_code'])) {
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
@@ -1668,7 +1676,7 @@ class Sale extends Base
|
|
foreach ($data['addrlist'] as $value) {
|
|
foreach ($data['addrlist'] as $value) {
|
|
$temp = [];
|
|
$temp = [];
|
|
$addrs = [];
|
|
$addrs = [];
|
|
- if ($value['addr_code'] !== '' && is_array($value['addr_code'])) {
|
|
|
|
|
|
+ if ($value['addr_code'] !== '' && is_array($value['addr_code'])&&!empty($value['addr_code'])) {
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['provice_code'] = $value['addr_code'][0];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['city_code'] = $value['addr_code'][1];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
$addrs['area_code'] = $value['addr_code'][2];
|
|
@@ -2114,7 +2122,7 @@ class Sale extends Base
|
|
foreach ($fo as $value) {
|
|
foreach ($fo as $value) {
|
|
$value['addr_info'] = "";
|
|
$value['addr_info'] = "";
|
|
$value['send_num'] = 0;
|
|
$value['send_num'] = 0;
|
|
- if ($value['addr_code'] != "") {
|
|
|
|
|
|
+ if ($value['addr_code'] != ""&&!empty($value['addr_code'])) {
|
|
$place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
|
|
$place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
|
|
list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$value['addr_code']);
|
|
list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$value['addr_code']);
|
|
$addr = GetAddr(json_encode($place));
|
|
$addr = GetAddr(json_encode($place));
|
|
@@ -3265,7 +3273,6 @@ class Sale extends Base
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$datainfo = Db::name('order_out')->insert($data,true);
|
|
$datainfo = Db::name('order_out')->insert($data,true);
|
|
@@ -3759,7 +3766,7 @@ class Sale extends Base
|
|
$status = [0 => '待发货', 1 => '待库管发货', 2 => '已发货待收货', 3 => '已收货', 4 => '已全部退货'];
|
|
$status = [0 => '待发货', 1 => '待库管发货', 2 => '已发货待收货', 3 => '已收货', 4 => '已全部退货'];
|
|
$list = Db::name("order_out")
|
|
$list = Db::name("order_out")
|
|
->alias('a')
|
|
->alias('a')
|
|
- ->field('"" as 序号,a.addtime as 创建时间,po.cgdNo as 采购单编号,po.status as 采购单状态,po.cgder as 采购员,b.orderCode as 确认单号,b.addtime as 确认单时间,b.good_code as 产品编号,b.good_name as 产品名称,"" as 规格,"" as 单位,wi.name as 供应商名称,s.code as 供应商编号,po.nake_fee as 裸价,a.post_fee as 物流费,b.send_type as 发货方式,po.good_price as 采购单价,b.remark as 确认单备注,po.good_num as 采购数量,po.total_fee as 采购货款,a.send_num 发货数量,oa.contactor as 收货人,oa.mobile as 联系方式,oa.addr as 收货地址,oa.arrive_time as 到货时间,a.outCode as 发货申请单号,po.order_type,"" 发货申请单物流单号,"" 发货申请单物流费用,"" 发货申请单备注')
|
|
|
|
|
|
+ ->field('"" as 序号,a.addtime as 创建时间,po.cgdNo as 采购单编号,po.status as 采购单状态,po.cgder as 采购员,b.orderCode as 确认单号,b.addtime as 确认单时间,b.good_code as 产品编号,b.good_name as 产品名称,"" as 规格,"" as 单位,wi.name as 供应商名称,s.code as 供应商编号,po.nake_fee as 裸价,a.post_fee as 物流费,b.send_type as 发货方式,po.good_price as 采购单价,b.remark as 确认单备注,po.good_num as 采购数量,po.total_fee as 采购货款,a.send_num 发货数量,oa.contactor as 收货人,oa.mobile as 联系方式,oa.addr as 收货地址,oa.arrive_time as 到货时间,a.outCode as 发货申请单号,po.order_type,b.platform_order 平台订单号,a.post_name 发货申请单物流公司,a.post_code 发货申请单物流单号,a.post_fee 发货申请单物流费用,a.remark 发货申请单备注')
|
|
->whereIn('a.outCode', $outCodes)
|
|
->whereIn('a.outCode', $outCodes)
|
|
->order("a.addtime desc")
|
|
->order("a.addtime desc")
|
|
->withAttr('序号', function () use (&$i) {
|
|
->withAttr('序号', function () use (&$i) {
|
|
@@ -3814,7 +3821,7 @@ class Sale extends Base
|
|
unset($value['order_type']);
|
|
unset($value['order_type']);
|
|
}
|
|
}
|
|
|
|
|
|
- if(empty($list)) $list[]='没有可供导出的数据';
|
|
|
|
|
|
+ if (empty($list)) $list[] = '没有可供导出的数据';
|
|
|
|
|
|
$headerArr = array_keys($list[0]);
|
|
$headerArr = array_keys($list[0]);
|
|
excelSave('发货申请单导出' . date('YmdHis'), $headerArr, $list);
|
|
excelSave('发货申请单导出' . date('YmdHis'), $headerArr, $list);
|