|
@@ -774,13 +774,19 @@ class Consult extends Base
|
|
|
$spucode=makeNo('SSU');
|
|
|
}
|
|
|
$tax_id = isset($this->post['tax_id'])&&$this->post['tax_id']!==''? intval($this->post['tax_id']):'0';
|
|
|
+ $cgd_tax_id = isset($this->post['cgd_tax_id'])&&$this->post['cgd_tax_id']!==''? intval($this->post['cgd_tax_id']):'0';
|
|
|
+ $cgd_tax = isset($this->post['cgd_tax'])&&$this->post['cgd_tax']!==''? trim($this->post['cgd_tax']):'';
|
|
|
$open_type= isset($this->post['open_type'])&&$this->post['open_type']!==''? intval($this->post['open_type']):1;
|
|
|
$inv_good_name = isset($this->post['inv_good_name'])&&$this->post['inv_good_name']!==''? trim($this->post['inv_good_name']):'';
|
|
|
if($open_type=='') return error_show(1004,'开票商品类型不能为空');
|
|
|
- if($open_type==1){
|
|
|
- if($tax_id=='') return error_show(1004,'商品税目id不能为空');
|
|
|
- if($inv_good_name=='') return error_show(1004,'开票商品名称不能为空');
|
|
|
+ if($open_type==1){
|
|
|
+ if($tax_id=='') return error_show(1004,'商品税目id不能为空');
|
|
|
+ if($inv_good_name=='') return error_show(1004,'开票商品名称不能为空');
|
|
|
+ if($cgd_supplier_code!=""){
|
|
|
+ if($cgd_tax_id==0) return error_show(1004,'源头供应商开票税目不能为空');
|
|
|
+ if($cgd_tax==='') return error_show(1004,'源头供应商开票税率不能为空');
|
|
|
}
|
|
|
+ }
|
|
|
//计算毛利率
|
|
|
$budget = get_budget($zxinfo['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
@@ -909,6 +915,8 @@ class Consult extends Base
|
|
|
"open_type"=>$open_type,
|
|
|
"inv_good_name"=>$inv_good_name,//采购商品名称
|
|
|
"tax_id"=>$tax_id,//税目id
|
|
|
+ "cgd_tax"=>$cgd_tax,//税目
|
|
|
+ "cgd_tax_id"=>$cgd_tax_id
|
|
|
];
|
|
|
Db::startTrans();
|
|
|
try{
|
|
@@ -1082,9 +1090,10 @@ class Consult extends Base
|
|
|
$info['child'] =[];
|
|
|
if($info['is_combind']==1){
|
|
|
$info['child'] =ConsultTemp::where(['bidNo'=>$bidNo])->select()->each(function(&$item){
|
|
|
- $tax = TaxCategory::where(['id'=>[$item['tax_id'],$item['out_tax_id']]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
+ $tax = TaxCategory::where(['id'=>[$item['tax_id'],$item['out_tax_id'],$item['cgd_tax_id']]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
$item['in_info'] = $tax[$item['tax_id']]??[];
|
|
|
$item['out_info'] = $tax[$item['out_tax_id']]??[];
|
|
|
+ $item['cgd_info'] = $tax[$item['cgd_tax_id']]??[];
|
|
|
});
|
|
|
}
|
|
|
//添加商品创建人字段
|
|
@@ -1164,7 +1173,6 @@ class Consult extends Base
|
|
|
$cgd_apply_id = isset($this->post['cgd_apply_id'])&&$this->post['cgd_apply_id']!=''? trim($this->post['cgd_apply_id']):0;
|
|
|
$cgd_apply_name = isset($this->post['cgd_apply_name'])&&$this->post['cgd_apply_name']!=''? trim($this->post['cgd_apply_name']):'';
|
|
|
$supplier_origin_price = isset($this->post['supplier_origin_price'])&&$this->post['supplier_origin_price']!=''? floatval($this->post['supplier_origin_price']):0;
|
|
|
- $cgd_supplier_name='';
|
|
|
$user= \app\admin\common\User::getIns();
|
|
|
$supplier =$user->handle("getCodeAndName",["code"=>[$supplierNo,$cgd_supplier_code]]);
|
|
|
|
|
@@ -1244,10 +1252,16 @@ class Consult extends Base
|
|
|
$tax_id = isset($this->post['tax_id'])&&$this->post['tax_id']!==''? intval($this->post['tax_id']):'';
|
|
|
$open_type= isset($this->post['open_type'])&&$this->post['open_type']!==''? intval($this->post['open_type']):'';
|
|
|
$inv_good_name = isset($this->post['inv_good_name'])&&$this->post['inv_good_name']!==''? trim($this->post['inv_good_name']):'';
|
|
|
+ $cgd_tax_id = isset($this->post['cgd_tax_id'])&&$this->post['cgd_tax_id']!==''? intval($this->post['cgd_tax_id']):'0';
|
|
|
+ $cgd_tax = isset($this->post['cgd_tax'])&&$this->post['cgd_tax']!==''? trim($this->post['cgd_tax']):'';
|
|
|
if($open_type=='') return error_show(1004,'开票商品类型不能为空');
|
|
|
if($open_type==1){
|
|
|
if($tax_id=='') return error_show(1004,'商品税目id不能为空');
|
|
|
if($inv_good_name=='') return error_show(1004,'开票商品名称不能为空');
|
|
|
+ if($cgd_supplier_code!=''){
|
|
|
+ if($cgd_tax_id==0) return error_show(1004,'源头供应商开票税目不能为空');
|
|
|
+ if($cgd_tax==='') return error_show(1004,'源头供应商开票税率不能为空');
|
|
|
+ }
|
|
|
}
|
|
|
Db::startTrans();
|
|
|
try{
|
|
@@ -1302,6 +1316,8 @@ class Consult extends Base
|
|
|
'open_type'=>$open_type,
|
|
|
'inv_good_name'=>$inv_good_name,//采购商品名称
|
|
|
'tax_id'=>$tax_id,//税目id
|
|
|
+ 'cgd_tax'=>$cgd_tax,//税目
|
|
|
+ 'cgd_tax_id'=>$cgd_tax_id
|
|
|
];
|
|
|
$insert= Db::name("consult_bids")->where($bidinfo)->save($data);
|
|
|
if($insert){
|
|
@@ -2070,9 +2086,10 @@ class Consult extends Base
|
|
|
list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$value['origin_place']);
|
|
|
}
|
|
|
$value['origin_addr']=GetAddr(json_encode($place));
|
|
|
- $tax = TaxCategory::where(['id'=>[$value['tax_id'],$value['out_tax_id']]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
+ $tax = TaxCategory::where(['id'=>[$value['tax_id'],$value['out_tax_id'],["cgd_tax_id"]]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
$value['in_info'] = $tax[$value['tax_id']]??[];
|
|
|
$value['out_info'] = $tax[$value['out_tax_id']]??[];
|
|
|
+ $value['cgd_info'] = $tax[$value['cgd_tax_id']]??[];
|
|
|
$good_info = Db::name('good_basic')
|
|
|
->field('id,createrid,creater')
|
|
|
->where('is_del',0)
|