|
@@ -138,19 +138,19 @@ class WaterQueryController
|
|
|
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '顶板', 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
|
|
|
+ $table[] = ['title' => '顶板', 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
|
|
|
}elseif ($k == '1*0.5'){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['roof'])->where($where)->where([['long', '=', 1], ['wide', '=', 0.5]])->find();
|
|
|
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
|
|
|
+ $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v ,'type' => 1];
|
|
|
}elseif ($k == '0.5*0.5'){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['roof'])->where($where)->where([['long', '=', 0.5], ['wide', '=', 0.5]])->find();
|
|
|
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 1];
|
|
|
+ $table[] = ['title' => '顶板','name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 1];
|
|
|
}
|
|
|
}
|
|
|
// 底板
|
|
@@ -160,7 +160,7 @@ class WaterQueryController
|
|
|
foreach ($science as $item) {
|
|
|
$m2 = $item['long'] * $item['wide'];
|
|
|
$floor1 = ceil($floor / $m2);
|
|
|
- $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' => $item['long'] . '*' . $item['wide'], 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $v, 'type' => 4];
|
|
|
+ $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $v, 'type' => 4];
|
|
|
}
|
|
|
}else {
|
|
|
$floor = $calculation['floor_number'];
|
|
@@ -174,12 +174,13 @@ class WaterQueryController
|
|
|
$floor1 += 1;
|
|
|
$floor = 0;
|
|
|
}
|
|
|
- $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' => $item['long'] . '*' . $item['wide'], 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $v, 'type' => 4];
|
|
|
+ $table[] = ['title' => '底板', 'name' => $item['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $floor1, 'unit_price' => $item['unit_price'], 'company' => $item['company'], 'ot_price' => $item['unit_price'] * $floor1, 'weight' => $item['weight'] * $v, 'type' => 4];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 侧板
|
|
|
+ $tables = [];
|
|
|
$storey = 0;
|
|
|
foreach ($calculation['side_number'] as $item){
|
|
|
$storey ++;
|
|
@@ -188,22 +189,28 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 1], ['wide', '=', 1]])->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
+ $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
}elseif ($k == '1*0.5'){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 1], ['wide', '=', 0.5]])->find();
|
|
|
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
+ $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
}elseif ($k == '0.5*0.5'){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['side_plate'][$storey-1])->where($where)->where([['long', '=', 0.5], ['wide', '=', 0.5]])->find();
|
|
|
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '侧板B'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'], 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
+ $tables[] = ['title' => '侧板'.$storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'m*'.$details['wide'].'m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 2];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ $table = array_merge($table, Array_reverse($tables));
|
|
|
+
|
|
|
+ $tables1 = [];
|
|
|
+ $tables2 = [];
|
|
|
//拉筋
|
|
|
$lac_storey = 0;
|
|
|
foreach ($calculation['lacing_number'] as $v){
|
|
@@ -211,7 +218,7 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['lacing'][$lac_storey-1])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '主拉B'.$lac_storey.'层' , 'name' => $details['name'], 'specifications' => '1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 3];
|
|
|
+ $tables1[] = ['title' => '主拉'.$lac_storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 3];
|
|
|
}
|
|
|
|
|
|
//辅拉
|
|
@@ -221,14 +228,16 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['fula'][$fula_storey-1])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '辅拉B'.$fula_storey.'层' , 'name' => $details['name'], 'specifications' => '1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 6];
|
|
|
+ $tables2[] = ['title' => '辅拉'.$fula_storey.'层' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 6];
|
|
|
}
|
|
|
|
|
|
+ $table = array_merge($table, Array_reverse($tables1));
|
|
|
+ $table = array_merge($table, Array_reverse($tables2));
|
|
|
// 立柱
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['column'])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $calculation['column_number'];
|
|
|
$zzl += $details['weight'] * $calculation['column_number'];
|
|
|
- $table[] = ['title' => '立柱' , 'name' => $details['name'], 'specifications' => '1', 'number' => $calculation['column_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['column_number'], 'weight' => $details['weight'] * $calculation['column_number'] , 'type' => 5];
|
|
|
+ $table[] = ['title' => '立柱' , 'name' => $details['name'], 'specifications' => $details['long'].'*'.$details['wide'].'*'.'2.1', 'number' => $calculation['column_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['column_number'], 'weight' => $details['weight'] * $calculation['column_number'] , 'type' => 5];
|
|
|
|
|
|
//保温
|
|
|
foreach ($calculation['warm'] as $k => $v){
|
|
@@ -236,17 +245,17 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 1]])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1*1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*1m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
}elseif ($k == 'warm2' and $v > 0){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 0.5]])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
}elseif ($k == 'warm3' and $v > 0){
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 0.5], ['wide', '=', 0.5]])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $v;
|
|
|
$zzl += $details['weight'] * $v;
|
|
|
- $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '0.5*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
+ $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '0.5m*0.5m', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -255,7 +264,7 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', $data['channel'])->where($where)->find();
|
|
|
$zj += $details['unit_price'] * $calculation['channel_number'];
|
|
|
$zzl += $details['weight'] * $calculation['channel_number'];
|
|
|
- $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => '1', 'number' => $calculation['channel_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['channel_number'], 'weight' => $details['weight'] * $calculation['channel_number'] , 'type' => 8];
|
|
|
+ $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['channel_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['channel_number'], 'weight' => $details['weight'] * $calculation['channel_number'] , 'type' => 8];
|
|
|
}
|
|
|
|
|
|
// 扶梯
|
|
@@ -263,22 +272,22 @@ class WaterQueryController
|
|
|
$details = WaterMaterialScience::where('cate_id', 9)->find();
|
|
|
$zj += $details['unit_price'] * $calculation['ladder'];
|
|
|
$zzl += $details['weight'] * $calculation['ladder'];
|
|
|
- $table[] = ['title' => '扶梯' , 'name' => $details['name'], 'specifications' => '1', 'number' => $calculation['ladder'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['ladder'], 'weight' => $details['weight'] * $calculation['ladder'] , 'type' => 9];
|
|
|
+ $table[] = ['title' => '扶梯' , 'name' => $details['name'], 'specifications' => $details['company'], 'number' => $calculation['ladder'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['ladder'], 'weight' => $details['weight'] * $calculation['ladder'] , 'type' => 9];
|
|
|
}
|
|
|
|
|
|
foreach ($table as &$i){
|
|
|
$i['ot_price'] = round($i['ot_price'], 2);
|
|
|
+ $i['weight'] = round($i['weight'], 2);
|
|
|
}
|
|
|
if ($discount > 0){
|
|
|
-
|
|
|
foreach ($table as &$item)
|
|
|
{
|
|
|
$item['unit_price'] = $item['unit_price'] * $discount;
|
|
|
$item['ot_price'] = $item['ot_price'] * $discount;
|
|
|
}
|
|
|
- return ['table' => $table, 'zj' => $zj * $discount, 'zzl' => $zzl];
|
|
|
+ return ['table' => $table, 'zj' => round($zj * $discount, 2), 'zzl' => round($zzl,2)];
|
|
|
}else{
|
|
|
- return ['table' => $table, 'zj' => $zj, 'zzl' => $zzl];
|
|
|
+ return ['table' => $table, 'zj' => round($zj, 2), 'zzl' => round($zzl, 2)];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -556,9 +565,29 @@ class WaterQueryController
|
|
|
$list = WaterDefault::where('high', $data['high'])->find();
|
|
|
|
|
|
if ($list){
|
|
|
+ $list['roof'] = ['id' => $list['roof'] , 'name' => WaterCate::where('id', $list['roof'])->value('name')];
|
|
|
+ $list['floor'] = ['id' => $list['floor'] , 'name' => WaterCate::where('id', $list['floor'])->value('name')];
|
|
|
+ $list['column'] = ['id' => $list['column'] , 'name' => WaterCate::where('id', $list['column'])->value('name')];
|
|
|
+
|
|
|
+
|
|
|
$list['side_plate'] = explode(',', $list['side_plate']);
|
|
|
+ $array = [];
|
|
|
+ foreach ($list['side_plate'] as $item){
|
|
|
+ $array[] = ['id' => $item , 'name'=> WaterCate::where('id', $item)->value('name')];
|
|
|
+ }
|
|
|
+ $list['side_plate'] = $array;
|
|
|
$list['lacing'] = explode(',', $list['lacing']);
|
|
|
+ $array = [];
|
|
|
+ foreach ($list['lacing'] as $item){
|
|
|
+ $array[] = ['id' => $item , 'name'=> WaterCate::where('id', $item)->value('name')];
|
|
|
+ }
|
|
|
+ $list['lacing'] = $array;
|
|
|
$list['fula'] = explode(',', $list['fula']);
|
|
|
+ $array = [];
|
|
|
+ foreach ($list['fula'] as $item){
|
|
|
+ $array[] = ['id' => $item , 'name'=> WaterCate::where('id', $item)->value('name')];
|
|
|
+ }
|
|
|
+ $list['fula'] = $array;
|
|
|
$list = $list->toArray();
|
|
|
}else{
|
|
|
$list = [];
|