|
@@ -7,7 +7,7 @@ use app\abutment\model\SupplierUser;
|
|
|
use app\admin\model\CgdPrice;use app\admin\model\ConsultTemp;use app\admin\model\DataGroup as DataGroupModel;
|
|
|
use app\admin\model\GoodLog;
|
|
|
use app\admin\model\GoodPlatform;use app\admin\model\GoodStockInfo;
|
|
|
-use app\admin\model\GoodTax;use app\admin\model\OrderOutChild;use app\admin\model\ProcessOrder;
|
|
|
+use app\admin\model\GoodTax;use app\admin\model\OrderOutChild;use app\admin\model\OrderTax;use app\admin\model\ProcessOrder;
|
|
|
use app\admin\model\SaleCgdPrice;use app\admin\model\SaleInfo;
|
|
|
use app\bbc\model\BbcFill;use app\model\TaxCategory;use app\model\TaxRelation;use Exception;
|
|
|
use think\App;
|
|
@@ -275,6 +275,19 @@ class Sale extends Base
|
|
|
$paytime == "" ? "" : $data['paytime'] = $paytime;
|
|
|
$datainfo = Db::name('sale')->insert($data, true);
|
|
|
if ($datainfo > 0) {
|
|
|
+ $taxInfo = OrderTax::SpuCat($spuCode,1,2);
|
|
|
+ if (!empty($taxInfo)) {
|
|
|
+ OrderTax::saveAll(array_map(function ($item)use($orderCode){
|
|
|
+ $temp=[];
|
|
|
+ $temp['code']=$orderCode;
|
|
|
+ $temp['spuCode']=$item['spuCode'];
|
|
|
+ $temp['tax_code']=$item['cat_code'];
|
|
|
+ $temp['tax_name']=$item['cat_name'];
|
|
|
+ $temp['inv_tax']=$item['tax'];
|
|
|
+ $temp['inv_good_name']=$item['inv_good_name'];
|
|
|
+ return $temp;
|
|
|
+ },$taxInfo));
|
|
|
+ }
|
|
|
//修改状态,添加待办
|
|
|
ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $orderCode,//销售单code
|
|
@@ -576,6 +589,19 @@ class Sale extends Base
|
|
|
];
|
|
|
$up = Db::name("purchease_order")->insert($cg, true);
|
|
|
if ($up) {
|
|
|
+ $taxInfo = OrderTax::SpuCat($data['spuCode'],1,1);
|
|
|
+ if (!empty($taxInfo)) {
|
|
|
+ OrderTax::saveAll(array_map(function ($item)use($cgdCode){
|
|
|
+ $temp=[];
|
|
|
+ $temp['code']=$cgdCode;
|
|
|
+ $temp['spuCode']=$item['spuCode'];
|
|
|
+ $temp['tax_code']=$item['cat_code'];
|
|
|
+ $temp['tax_name']=$item['cat_name'];
|
|
|
+ $temp['inv_tax']=$item['tax'];
|
|
|
+ $temp['inv_good_name']=$item['inv_good_name'];
|
|
|
+ return $temp;
|
|
|
+ },$taxInfo));
|
|
|
+ }
|
|
|
//修改状态,添加待办
|
|
|
ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], [
|
|
|
"order_code" => $cg['cgdNo'],//销售单code
|
|
@@ -1077,7 +1103,6 @@ class Sale extends Base
|
|
|
];
|
|
|
$datainfo = Db::name('sale')->insert($data, true);
|
|
|
if ($datainfo > 0) {
|
|
|
-
|
|
|
$standing_book_data = [
|
|
|
'sale_id' => $datainfo,
|
|
|
'infoNo' => $zxinfo['infoNo'],
|
|
@@ -1115,11 +1140,6 @@ class Sale extends Base
|
|
|
], "ZXD", 5, $zx);
|
|
|
|
|
|
}
|
|
|
- $bol = $this->createCgd($cgd, $standing_book_data);
|
|
|
- if ($bol == false) {
|
|
|
- Db::rollback();
|
|
|
- return error_show(1002, "咨询订单创建失败");
|
|
|
- }
|
|
|
$limt = [
|
|
|
"spuCode" => $zxinfo['spuCode'],
|
|
|
"good_name" => $zxinfo['good_name'],
|
|
@@ -1210,6 +1230,24 @@ class Sale extends Base
|
|
|
];
|
|
|
GoodTax::create($data);
|
|
|
}
|
|
|
+ $taxInfo = OrderTax::SpuCat($spuCode,1,2);
|
|
|
+ if (!empty($taxInfo)) {
|
|
|
+ OrderTax::saveAll(array_map(function ($item)use($orderCode){
|
|
|
+ $temp=[];
|
|
|
+ $temp['code']=$orderCode;
|
|
|
+ $temp['spuCode']=$item['spuCode'];
|
|
|
+ $temp['tax_code']=$item['cat_code'];
|
|
|
+ $temp['tax_name']=$item['cat_name'];
|
|
|
+ $temp['inv_tax']=$item['tax'];
|
|
|
+ $temp['inv_good_name']=$item['inv_good_name'];
|
|
|
+ return $temp;
|
|
|
+ },$taxInfo));
|
|
|
+ }
|
|
|
+ $bol = $this->createCgd($cgd, $standing_book_data);
|
|
|
+ if ($bol == false) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1002, '咨询订单创建失败');
|
|
|
+ }
|
|
|
if (!empty($va)) {
|
|
|
$order = Db::name("order_num")->where(["orderCode" => $orderCode, "status" => 1])->where([["wsend_num", ">=", 0]])
|
|
|
->find();
|
|
@@ -1678,10 +1716,6 @@ class Sale extends Base
|
|
|
"before_status" => 0,
|
|
|
'holder_id' => $datas['apply_id']
|
|
|
]);
|
|
|
- $bol = $this->createCgd($cgd, $standing_book_data);
|
|
|
- if ($bol == false) {
|
|
|
- throw new Exception("采购单生成失败");
|
|
|
- }
|
|
|
$bidstatus = $goodinfo['status'];
|
|
|
$goodinfo['status'] = 6;
|
|
|
$goodinfo['updatetime'] = date("Y-m-d H:i:s");
|
|
@@ -1793,6 +1827,23 @@ class Sale extends Base
|
|
|
];
|
|
|
GoodTax::create($data);
|
|
|
}
|
|
|
+ $taxInfo = OrderTax::SpuCat( $data['spuCode'],1,2);
|
|
|
+ if (!empty($taxInfo)) {
|
|
|
+ OrderTax::saveAll(array_map(function ($item)use($orderCode){
|
|
|
+ $temp=[];
|
|
|
+ $temp['code']=$orderCode;
|
|
|
+ $temp['spuCode']=$item['spuCode'];
|
|
|
+ $temp['tax_code']=$item['cat_code'];
|
|
|
+ $temp['tax_name']=$item['cat_name'];
|
|
|
+ $temp['inv_tax']=$item['tax'];
|
|
|
+ $temp['inv_good_name']=$item['inv_good_name'];
|
|
|
+ return $temp;
|
|
|
+ },$taxInfo));
|
|
|
+ }
|
|
|
+ $bol = $this->createCgd($cgd, $standing_book_data);
|
|
|
+ if ($bol == false) {
|
|
|
+ throw new Exception('采购单生成失败');
|
|
|
+ }
|
|
|
if ($data['sendtype'] == 1 && !empty($data['addrlist'])) {
|
|
|
$order = Db::name("order_num")->where(["orderCode" => $orderCode, "status" => 1])
|
|
|
->find();
|
|
@@ -2060,6 +2111,20 @@ class Sale extends Base
|
|
|
'cgd_apply_id'=>$good['cgd_apply_id'],//竞单人
|
|
|
'cgd_apply_name'=>$good['cgd_apply_name'],//竞单人
|
|
|
];
|
|
|
+ $taxInfo = OrderTax::SpuCat( $data['spuCode'],1,2);
|
|
|
+ if (!empty($taxInfo)) {
|
|
|
+ OrderTax::saveAll(array_map(function ($item)use($orderCode){
|
|
|
+ $temp=[];
|
|
|
+ $temp['code']=$orderCode;
|
|
|
+ $temp['spuCode']=$item['spuCode'];
|
|
|
+ $temp['tax_code']=$item['cat_code'];
|
|
|
+ $temp['tax_name']=$item['cat_name'];
|
|
|
+ $temp['inv_tax']=$item['tax'];
|
|
|
+ $temp['inv_good_name']=$item['inv_good_name'];
|
|
|
+ return $temp;
|
|
|
+ },$taxInfo));
|
|
|
+ }
|
|
|
+
|
|
|
if ($good['is_stock'] == 0) {
|
|
|
$bol = $this->createCgd($cgd, $standing_book_data);
|
|
|
if ($bol == false) {
|
|
@@ -2515,12 +2580,10 @@ class Sale extends Base
|
|
|
if ($goon == false) {
|
|
|
return error_show(1003, "未找到商品数据");
|
|
|
} else {
|
|
|
- $taxInfo=GoodTax::with(['tax'])->where(['spuCode'=>$einfo['good_code']])->findOrEmpty();
|
|
|
- $einfo['tax_id'] = $taxInfo['tax_id']??'';
|
|
|
- $einfo['tax_name'] = $taxInfo['cat_name']??'';
|
|
|
- $einfo['tax_short_name'] =$taxInfo['short_name']??'';
|
|
|
- $einfo['tax_code'] =$taxInfo['merge_code']??'';
|
|
|
- $einfo['tax']=$taxInfo['tax']??'';
|
|
|
+ $taxInfo=OrderTax::where(['code'=>$einfo['orderCode']])->findOrEmpty();
|
|
|
+ $einfo['tax_name'] = $taxInfo['tax_name']??'';
|
|
|
+ $einfo['tax_code'] =$taxInfo['tax_code']??'';
|
|
|
+ $einfo['tax']=$taxInfo['inv_tax']??'';
|
|
|
$einfo['inv_good_name']=$taxInfo['inv_good_name']??'';
|
|
|
$goon['exclusive'] = isset($goon['is_exclusive']) ? makeExcluse($goon['is_exclusive']) : "";
|
|
|
$unit = Db::name("unit")->where(["id" => $goon['good_unit']])->find();
|