|
|
@@ -63,26 +63,27 @@ class StaffSalary extends Api
|
|
|
$endDate = $params['end_date'];
|
|
|
$where = [];
|
|
|
$where['a.sczl_rq'] = ['between',[$startDate,$endDate]];
|
|
|
- $fields = "a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_gxmc as sczl_type,a.sczl_rq,a.sczl_jtbh,a.sczl_ms,a.sczl_cl as 班组车头产量,a.sczl_zcfp,
|
|
|
+ $option['a.sczl_jtbh'] = ['like','JP09%'];
|
|
|
+ $fields = "a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_gxmc as sczl_type,a.sczl_rq,a.sczl_jtbh,a.sczl_ms,a.sczl_cl as 班组车头产量,a.sczl_Pgcl,a.sczl_zcfp,
|
|
|
a.sczl_装版工时 as 装版工时,a.sczl_保养工时 as 保养工时,a.sczl_打样工时 as 打样工时,a.sczl_异常停机工时 as 异常停机工时,a.sczl_设备运行工时 as 车头产量占用机时,
|
|
|
a.sczl_bh1,a.sczl_bh2,a.sczl_bh3,a.sczl_bh4,a.sczl_bh5,a.sczl_bh6,a.sczl_bh7,a.sczl_bh8,a.sczl_bh9,a.sczl_bh10,
|
|
|
- a.sczl_rate1,a.sczl_rate2,a.sczl_rate3,a.sczl_rate4,a.sczl_rate5,a.sczl_rate6,a.sczl_rate7,a.sczl_rate8,a.sczl_rate9,a.sczl_rate10,
|
|
|
+ a.sczl_rate1,a.sczl_rate2,a.sczl_rate3,a.sczl_rate4,a.sczl_rate5,a.sczl_rate6,a.sczl_rate7,a.sczl_rate8,a.sczl_rate9,a.sczl_rate10,a.sczl_废品率系数,
|
|
|
b.千件工价,b.日定额,b.补产标准,c.工价系数 as 工序难度系数
|
|
|
,d1.员工姓名 as name1,d2.员工姓名 as name2,d3.员工姓名 as name3,d4.员工姓名 as name4,d5.员工姓名 as name5,d6.员工姓名 as name6,d7.员工姓名 as name7,d8.员工姓名 as name8
|
|
|
,d9.员工姓名 as name9,d10.员工姓名 as name10";
|
|
|
-// $query = \db('设备_产量计酬')->alias('a')->field($fields);
|
|
|
-// // 连接 dic_lzde 表
|
|
|
-// $query->join('dic_lzde b', 'a.sczl_dedh = b.sys_bh', 'LEFT');
|
|
|
-// // 连接 工单_工艺资料 表
|
|
|
-// $query->join('工单_工艺资料 c', 'a.sczl_gdbh = c.Gy0_gdbh AND a.sczl_yjno = c.Gy0_yjno AND a.sczl_gxh = c.Gy0_gxh', 'LEFT');
|
|
|
-// // 循环连接 人事_基本资料 表(仅当 sczl_bh 不为空时才连接)
|
|
|
-// for ($i = 1; $i <= 10; $i++) {
|
|
|
-// $field = 'a.sczl_bh' . $i;
|
|
|
-// $alias = 'd' . $i;
|
|
|
-// $query->join("人事_基本资料 $alias", "$field = {$alias}.员工编号 AND {$field} IS NOT NULL", 'LEFT');
|
|
|
-// }
|
|
|
-// $query->where($where);
|
|
|
-// $list = $query->select();
|
|
|
+ $query = Db::connect('db3')->name('设备_产量计酬')->alias('a')->field($fields);
|
|
|
+ // 连接 dic_lzde 表
|
|
|
+ $query->join('dic_lzde b', 'a.sczl_dedh = b.sys_bh', 'LEFT');
|
|
|
+ // 连接 工单_工艺资料 表
|
|
|
+ $query->join('工单_工艺资料 c', 'a.sczl_gdbh = c.Gy0_gdbh AND a.sczl_yjno = c.Gy0_yjno AND a.sczl_gxh = c.Gy0_gxh', 'LEFT');
|
|
|
+ // 循环连接 人事_基本资料 表(仅当 sczl_bh 不为空时才连接)
|
|
|
+ for ($i = 1; $i <= 10; $i++) {
|
|
|
+ $field = 'a.sczl_bh' . $i;
|
|
|
+ $alias = 'd' . $i;
|
|
|
+ $query->join("人事_基本资料 $alias", "$field = {$alias}.员工编号 AND {$field} IS NOT NULL", 'LEFT');
|
|
|
+ }
|
|
|
+ $query->where($where);
|
|
|
+ $list = $query->select();
|
|
|
$UniqId = \db('绩效工资汇总_temp')->field('UniqID')->order('UniqID desc')->find();
|
|
|
if (empty($UniqId)){
|
|
|
$UniqId = 1;
|
|
|
@@ -90,59 +91,70 @@ class StaffSalary extends Api
|
|
|
$UniqId = $UniqId['UniqID'];
|
|
|
}
|
|
|
$data = [];
|
|
|
- //设备_产量计酬数据
|
|
|
-// foreach ($list as $value){
|
|
|
-// $value['班组车头产量'] = $value['班组车头产量'] - $value['sczl_zcfp'];
|
|
|
-// //计件产量
|
|
|
-// if ($value['工序难度系数'] <= 0 || empty($value['工序难度系数'])){
|
|
|
-// $value['工序难度系数'] = '1.0000';
|
|
|
-// $byThePieceYield = $value['班组车头产量'];
|
|
|
-// }else{
|
|
|
-// $byThePieceYield = round($value['班组车头产量'] * $value['工序难度系数']);
|
|
|
-// }
|
|
|
-// //补产产量/班组换算产量
|
|
|
-// $afterProductionYield = ($value['装版工时'] + $value['保养工时'] + $value['打样工时']) * $value['补产标准'];
|
|
|
-// //核算产量
|
|
|
-// $accountingYield = $byThePieceYield + $afterProductionYield;
|
|
|
-// //工时占比
|
|
|
-// $manHourRate = number_format($accountingYield / $value['日定额'],4);
|
|
|
-// for ($i=1; $i<11; $i++){
|
|
|
-// $bhKey = 'sczl_bh'.$i;
|
|
|
-// $xmKey = 'name'.$i;
|
|
|
-// $rateKey = 'sczl_rate'.$i;
|
|
|
-// if (!empty($value[$bhKey]) && $value[$bhKey] != '000000'){
|
|
|
-// $item = [];
|
|
|
-// $item['sczl_gdbh'] = $value['sczl_gdbh'];
|
|
|
-// $item['sczl_yjno'] = $value['sczl_yjno'];
|
|
|
-// $item['sczl_gxh'] = $value['sczl_gxh'];
|
|
|
-// $item['sczl_type'] = substr($value['sczl_type'],0,30);
|
|
|
-// $item['sczl_rq'] = $value['sczl_rq'];
|
|
|
-// $item['sczl_jtbh'] = $value['sczl_jtbh'];
|
|
|
-// $item['班组车头产量'] = $value['班组车头产量'];
|
|
|
-// $item['工价系数'] = '0.0000';
|
|
|
-// $item['工序难度系数'] = $value['工序难度系数'];
|
|
|
-// $item['装版工时'] = $value['装版工时'];
|
|
|
-// $item['保养工时'] = $value['保养工时'];
|
|
|
-// $item['打样工时'] = $value['打样工时'];
|
|
|
-// $item['异常停机工时'] = $value['异常停机工时'];
|
|
|
-// $item['车头产量占用机时'] = $value['车头产量占用机时'];
|
|
|
-// $item['日定额'] = (int)$value['日定额'];
|
|
|
-// $item['千件工价'] = $value['千件工价'];
|
|
|
-// $item['补产标准'] = $value['补产标准'];
|
|
|
-// $item['班组换算产量'] = $afterProductionYield;
|
|
|
-// $item['计时补差额工资'] = '0.00';
|
|
|
-// $item['bh'] = $value[$bhKey];
|
|
|
-// $item['xm'] = $value[$xmKey];
|
|
|
-// $item['Rate'] = $value[$rateKey];
|
|
|
-// $item['sczl_ms'] = $value['sczl_ms'];
|
|
|
-// $item['核算产量'] = $accountingYield;
|
|
|
-// $item['工时占比'] = floatval($manHourRate);
|
|
|
-// array_push($data,$item);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
- //拆片工序数据
|
|
|
- $query = Db::table('db_sczl')->alias('a')
|
|
|
+ /**
|
|
|
+ * 设备_产量计酬数据
|
|
|
+ */
|
|
|
+ foreach ($list as $value){
|
|
|
+ $value['班组车头产量'] = $value['班组车头产量'] - $value['sczl_zcfp'];
|
|
|
+ //计件产量
|
|
|
+ if (substr($value['sczl_jtbh'],0,2) == 'JP'){
|
|
|
+ $value['工序难度系数'] = $value['sczl_废品率系数'];
|
|
|
+ $value['班组车头产量'] = $value['班组车头产量'] * $value['sczl_Pgcl'];
|
|
|
+ $byThePieceYield = round($value['班组车头产量'] * $value['sczl_废品率系数']);
|
|
|
+ }else{
|
|
|
+ if ($value['工序难度系数'] <= 0 || empty($value['工序难度系数'])){
|
|
|
+ $value['工序难度系数'] = '1.0000';
|
|
|
+ $byThePieceYield = $value['班组车头产量'];
|
|
|
+ }else{
|
|
|
+ $byThePieceYield = round($value['班组车头产量'] * $value['工序难度系数']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //补产产量/班组换算产量
|
|
|
+ $afterProductionYield = ($value['装版工时'] + $value['保养工时'] + $value['打样工时']) * $value['补产标准'];
|
|
|
+ //核算产量
|
|
|
+ $accountingYield = $byThePieceYield + $afterProductionYield;
|
|
|
+ //工时占比
|
|
|
+ $manHourRate = number_format($accountingYield / $value['日定额'],4);
|
|
|
+ for ($i=1; $i<11; $i++){
|
|
|
+ $bhKey = 'sczl_bh'.$i;
|
|
|
+ $xmKey = 'name'.$i;
|
|
|
+ $rateKey = 'sczl_rate'.$i;
|
|
|
+ if (!empty($value[$bhKey]) && $value[$bhKey] != '000000'){
|
|
|
+ $item = [];
|
|
|
+ $item['sczl_gdbh'] = $value['sczl_gdbh'];
|
|
|
+ $item['sczl_yjno'] = $value['sczl_yjno'];
|
|
|
+ $item['sczl_gxh'] = $value['sczl_gxh'];
|
|
|
+ $item['sczl_type'] = substr($value['sczl_type'],0,30);
|
|
|
+ $item['sczl_rq'] = $value['sczl_rq'];
|
|
|
+ $item['sczl_jtbh'] = $value['sczl_jtbh'];
|
|
|
+ $item['班组车头产量'] = $value['班组车头产量'];
|
|
|
+ $item['工价系数'] = '0.0000';
|
|
|
+ $item['工序难度系数'] = $value['工序难度系数'];
|
|
|
+ $item['装版工时'] = $value['装版工时'];
|
|
|
+ $item['保养工时'] = $value['保养工时'];
|
|
|
+ $item['打样工时'] = $value['打样工时'];
|
|
|
+ $item['异常停机工时'] = $value['异常停机工时'];
|
|
|
+ $item['车头产量占用机时'] = $value['车头产量占用机时'];
|
|
|
+ $item['日定额'] = (int)$value['日定额'];
|
|
|
+ $item['千件工价'] = $value['千件工价'];
|
|
|
+ $item['补产标准'] = $value['补产标准'];
|
|
|
+ $item['班组换算产量'] = $afterProductionYield;
|
|
|
+ $item['计时补差额工资'] = '0.00';
|
|
|
+ $item['bh'] = $value[$bhKey];
|
|
|
+ $item['xm'] = $value[$xmKey];
|
|
|
+ $item['Rate'] = $value[$rateKey];
|
|
|
+ $item['sczl_ms'] = $value['sczl_ms'];
|
|
|
+ $item['核算产量'] = $accountingYield;
|
|
|
+ $item['工时占比'] = $manHourRate;
|
|
|
+ array_push($data,$item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// halt($data);
|
|
|
+ /**
|
|
|
+ * 拆片工序数据
|
|
|
+ */
|
|
|
+ $query = Db::connect('db3')->name('db_sczl')->alias('a')
|
|
|
->field('a.sczl_gdbh, a.sczl_yjno, a.sczl_gxh, sczl_type, a.sczl_rq, a.sczl_jtbh,
|
|
|
a.sczl_ms, a.sczl_cl as 班组车头产量, a.sczl_fp as sczl_zcfp, a.sczl_装版工时 as 装版工时, a.sczl_保养工时 as 保养工时,
|
|
|
a.sczl_打样工时 as 打样工时, a.sczl_异常停机工时 as 异常停机工时, a.sczl_设备运行工时 as 车头产量占用机时, a.sczl_bh1,
|
|
|
@@ -151,9 +163,7 @@ class StaffSalary extends Api
|
|
|
->join('工单_工艺资料 c', 'a.sczl_gdbh = c.Gy0_gdbh AND a.sczl_yjno = c.Gy0_yjno AND a.sczl_gxh = c.Gy0_gxh','left')
|
|
|
->join('人事_基本资料 d', 'a.sczl_bh1 = d.员工编号','left')
|
|
|
->where($where)
|
|
|
-// ->fetchSql(true)
|
|
|
->select();
|
|
|
-// halt($query);
|
|
|
foreach ($query as $value){
|
|
|
$value['班组车头产量'] = $value['班组车头产量'] - $value['sczl_zcfp'];
|
|
|
//计件产量
|
|
|
@@ -195,9 +205,11 @@ class StaffSalary extends Api
|
|
|
$item['sczl_ms'] = $value['sczl_ms'];
|
|
|
$item['核算产量'] = $accountingYield;
|
|
|
$item['工时占比'] = floatval($manHourRate);
|
|
|
-// array_push($data,$item);
|
|
|
+ array_push($data,$item);
|
|
|
}
|
|
|
- //手工检验工序数据
|
|
|
+ /**
|
|
|
+ * 手工检验工序数据
|
|
|
+ */
|
|
|
$shoujianfields = "a.sczl_gdbh,a.sczl_yjgx,sczl_gxmc AS sczl_type,a.sczl_rq,a.sczl_cl AS 班组车头产量,
|
|
|
sczl_废品率系数 AS 工序难度系数,a.sczl_bh0,a.sczl_bh1,a.sczl_bh2,a.sczl_bh3,a.sczl_bh4,a.sczl_bh5,a.sczl_bh6,
|
|
|
a.sczl_bh7,a.sczl_bh8,a.sczl_bh9,a.sczl_bh10,a.sczl_bh11,b.千件工价,b.日定额,b.补产标准,d0.员工姓名 AS name0,
|
|
|
@@ -206,7 +218,7 @@ class StaffSalary extends Api
|
|
|
d10.员工姓名 AS name11,d10.员工姓名 AS name12,a.sczl_cl0,a.sczl_cl1,a.sczl_cl2,a.sczl_cl3,a.sczl_cl4,a.sczl_cl5,a.sczl_cl6,
|
|
|
a.sczl_cl7,a.sczl_cl8,a.sczl_cl9,a.sczl_cl10,a.sczl_cl11,a.sczl_cl12,a.sczl_fp0,a.sczl_fp1,a.sczl_fp2,a.sczl_fp3,
|
|
|
a.sczl_fp4,a.sczl_fp5,a.sczl_fp6,a.sczl_fp7,a.sczl_fp8,a.sczl_fp9,a.sczl_fp10,a.sczl_fp11,a.sczl_fp12";
|
|
|
- $query = \db('db_手工检验')->alias('a')->field($shoujianfields);
|
|
|
+ $query = Db::connect('db3')->name('db_手工检验')->alias('a')->field($shoujianfields);
|
|
|
//链接dic_lzde表
|
|
|
$query->join('dic_lzde b','a.sczl_dedh = b.sys_bh','LEFT');
|
|
|
//链接人事基本资料表
|
|
|
@@ -265,6 +277,118 @@ class StaffSalary extends Api
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 包装计件工序数据
|
|
|
+ */
|
|
|
+ $result = Db::connect('db3')->name('db_包装计件')->alias('a')
|
|
|
+ ->field('a.sczl_gdbh1, a.sczl_gdbh2, a.sczl_gdbh3, a.sczl_gdbh4, a.sczl_gdbh5, a.sczl_gdbh6,
|
|
|
+ a.sczl_yjGx1, a.sczl_yjGx2, a.sczl_yjGx3, a.sczl_yjGx4, a.sczl_yjGx5, a.sczl_yjGx6,
|
|
|
+ rtrim(a.sczl_gxmc1) as gxmc1,rtrim(a.sczl_gxmc2) as gxmc2,rtrim(a.sczl_gxmc3) as gxmc3,rtrim(a.sczl_gxmc4) as gxmc4,rtrim(a.sczl_gxmc5) as gxmc5,rtrim(a.sczl_gxmc6) as gxmc6,
|
|
|
+ a.sczl_cl1, a.sczl_cl2, a.sczl_cl3, a.sczl_cl4, a.sczl_cl5, a.sczl_cl6,
|
|
|
+ a.sczl_返工产量1, a.sczl_返工产量2, a.sczl_返工产量3, a.sczl_返工产量4, a.sczl_返工产量5, a.sczl_返工产量6,
|
|
|
+ a.sczl_Jtbh1,a.sczl_Jtbh2,a.sczl_Jtbh3,a.sczl_Jtbh4,a.sczl_Jtbh5,a.sczl_Jtbh6,
|
|
|
+ a.sczl_PgCl1,a.sczl_PgCl2,a.sczl_PgCl3,a.sczl_PgCl4,a.sczl_PgCl5,a.sczl_PgCl6,
|
|
|
+ a.sczl_计产系数1,a.sczl_计产系数2,a.sczl_计产系数3,a.sczl_计产系数4,a.sczl_计产系数5,a.sczl_计产系数6,
|
|
|
+ c1.工价系数 as 工序难度系数1,c2.工价系数 as 工序难度系数2,c3.工价系数 as 工序难度系数3,c4.工价系数 as 工序难度系数4,c5.工价系数 as 工序难度系数5,c6.工价系数 as 工序难度系数6,
|
|
|
+ b1.千件工价 as 千件工价1, b2.千件工价 as 千件工价2, b3.千件工价 as 千件工价3, b4.千件工价 as 千件工价4, b5.千件工价 as 千件工价5, b6.千件工价 as 千件工价6,
|
|
|
+ b1.日定额 as 日定额1, b2.日定额 as 日定额2, b3.日定额 as 日定额3, b4.日定额 as 日定额4, b5.日定额 as 日定额5, b6.日定额 as 日定额6,
|
|
|
+ b1.补产标准 as 补产标准1, b2.补产标准 as 补产标准2, b3.补产标准 as 补产标准3, b4.补产标准 as 补产标准4, b5.补产标准 as 补产标准5, b6.补产标准 as 补产标准6,
|
|
|
+ a.sczl_rq,a.sczl_bh,rtrim(d.员工姓名) as xm,
|
|
|
+ e1.成品名称 as cpmc1,e2.成品名称 as cpmc2,e3.成品名称 as cpmc3,e4.成品名称 as cpmc4,e5.成品名称 as cpmc5,e6.成品名称 as cpmc6')
|
|
|
+ ->join('工单_工艺资料 c1', 'a.sczl_gdbh1 = c1.Gy0_gdbh AND a.sczl_yjGx1 = CONCAT("0",c1.Gy0_yjno, "-", c1.Gy0_gxh) AND a.sczl_gdbh1 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('工单_工艺资料 c2', 'a.sczl_gdbh2 = c2.Gy0_gdbh AND a.sczl_yjGx2 = CONCAT("0",c2.Gy0_yjno, "-", c2.Gy0_gxh) AND a.sczl_gdbh2 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('工单_工艺资料 c3', 'a.sczl_gdbh3 = c3.Gy0_gdbh AND a.sczl_yjGx3 = CONCAT("0",c3.Gy0_yjno, "-", c3.Gy0_gxh) AND a.sczl_gdbh3 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('工单_工艺资料 c4', 'a.sczl_gdbh4 = c4.Gy0_gdbh AND a.sczl_yjGx4 = CONCAT("0",c4.Gy0_yjno, "-", c4.Gy0_gxh) AND a.sczl_gdbh4 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('工单_工艺资料 c5', 'a.sczl_gdbh5 = c5.Gy0_gdbh AND a.sczl_yjGx5 = CONCAT("0",c5.Gy0_yjno, "-", c5.Gy0_gxh) AND a.sczl_gdbh5 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('工单_工艺资料 c6', 'a.sczl_gdbh6 = c6.Gy0_gdbh AND a.sczl_yjGx6 = CONCAT("0",c6.Gy0_yjno, "-", c6.Gy0_gxh) AND a.sczl_gdbh6 IS NOT NULL', 'LEFT')
|
|
|
+ ->join('dic_lzde b1', 'a.sczl_dedh1 = b1.sys_bh', 'LEFT')
|
|
|
+ ->join('dic_lzde b2', 'a.sczl_dedh2 = b2.sys_bh', 'LEFT')
|
|
|
+ ->join('dic_lzde b3', 'a.sczl_dedh3 = b3.sys_bh', 'LEFT')
|
|
|
+ ->join('dic_lzde b4', 'a.sczl_dedh4 = b4.sys_bh', 'LEFT')
|
|
|
+ ->join('dic_lzde b5', 'a.sczl_dedh5 = b5.sys_bh', 'LEFT')
|
|
|
+ ->join('dic_lzde b6', 'a.sczl_dedh6 = b6.sys_bh', 'LEFT')
|
|
|
+ ->join('人事_基本资料 d', 'a.sczl_bh = d.员工编号', 'LEFT')
|
|
|
+ ->join('工单_基本资料 e1','a.sczl_gdbh1 = e1.Gd_gdbh AND a.sczl_gdbh1 IS NOT NULL','LEFT')
|
|
|
+ ->join('工单_基本资料 e2','a.sczl_gdbh2 = e2.Gd_gdbh AND a.sczl_gdbh2 IS NOT NULL','LEFT')
|
|
|
+ ->join('工单_基本资料 e3','a.sczl_gdbh3 = e3.Gd_gdbh AND a.sczl_gdbh3 IS NOT NULL','LEFT')
|
|
|
+ ->join('工单_基本资料 e4','a.sczl_gdbh4 = e4.Gd_gdbh AND a.sczl_gdbh4 IS NOT NULL','LEFT')
|
|
|
+ ->join('工单_基本资料 e5','a.sczl_gdbh5 = e5.Gd_gdbh AND a.sczl_gdbh5 IS NOT NULL','LEFT')
|
|
|
+ ->join('工单_基本资料 e6','a.sczl_gdbh6 = e6.Gd_gdbh AND a.sczl_gdbh6 IS NOT NULL','LEFT')
|
|
|
+ ->where($where)
|
|
|
+ ->select();
|
|
|
+// halt($result);
|
|
|
+ foreach ($result as $value){
|
|
|
+ for ($i=1;$i<7;$i++){
|
|
|
+ $item = [];
|
|
|
+ $gdbhKey = 'sczl_gdbh'.$i;
|
|
|
+ $yjgxKey = 'sczl_yjGx'.$i;
|
|
|
+ $jtbhKey = 'sczl_Jtbh'.$i;
|
|
|
+ $gxmcKey = 'gxmc'.$i;
|
|
|
+ $clKey = 'sczl_cl'.$i;
|
|
|
+ $reworkKey = 'sczl_返工产量'.$i;
|
|
|
+ $gxKey = '工序难度系数'.$i;
|
|
|
+ $thousandKey = '千件工价'.$i;
|
|
|
+ $dailyKey = '日定额'.$i;
|
|
|
+ $afterKey = '补产标准'.$i;
|
|
|
+ $pgclKey = 'sczl_PgCl'.$i;
|
|
|
+ $jcxsKey = 'sczl_计产系数'.$i;
|
|
|
+ $cpmcKey = 'cpmc'.$i;
|
|
|
+ if (!empty($value[$gdbhKey])){
|
|
|
+ $item['sczl_gdbh'] = $value[$gdbhKey];
|
|
|
+ $item['sczl_yjno'] = ltrim(substr($value[$yjgxKey],0,2), '0');
|
|
|
+ $item['sczl_gxh'] = substr($value[$yjgxKey],-2);
|
|
|
+ $item['sczl_type'] = substr($value[$gxmcKey],0,30);
|
|
|
+ if (!empty($value[$reworkKey]) && $value[$reworkKey] > 0){
|
|
|
+ $item['sczl_type'] = '返工('.$item['sczl_type'].')';
|
|
|
+ }
|
|
|
+ $item['sczl_rq'] = $value['sczl_rq'];
|
|
|
+ $item['sczl_jtbh'] = $value[$jtbhKey];
|
|
|
+ if (strpos($value[$cpmcKey],'条')){
|
|
|
+ $num = 1000;
|
|
|
+ }else{
|
|
|
+ $num = 2500;
|
|
|
+ }
|
|
|
+ if (!empty($value[$reworkKey]) && $value[$reworkKey] > 0){
|
|
|
+ $cl = $value[$reworkKey];
|
|
|
+ }else{
|
|
|
+ $cl = $value[$clKey];
|
|
|
+ }
|
|
|
+ if (strpos($item['sczl_type'],'包装')){
|
|
|
+ $item['班组车头产量'] = $cl * $value[$pgclKey] * $value[$jcxsKey] / $num;
|
|
|
+ }else{
|
|
|
+ $item['班组车头产量'] = $cl;
|
|
|
+ }
|
|
|
+ $item['工价系数'] = '0.0000';
|
|
|
+ $item['工序难度系数'] = $value[$gxKey];
|
|
|
+ if ($value[$gxKey] <= 0){
|
|
|
+ $item['工序难度系数'] = '1.0000';
|
|
|
+ }
|
|
|
+ $item['装版工时'] = '0.00';
|
|
|
+ $item['保养工时'] = '0.00';
|
|
|
+ $item['打样工时'] = '0.00';
|
|
|
+ $item['异常停机工时'] = '0.00';
|
|
|
+ $item['车头产量占用机时'] = '0.00';
|
|
|
+ $item['日定额'] = $value[$dailyKey];
|
|
|
+ $item['千件工价'] = $value[$thousandKey];
|
|
|
+ $item['补产标准'] = $value[$afterKey];
|
|
|
+ $item['班组换算产量'] = '0.00';
|
|
|
+ $item['计时补差额工资'] = '0.00';
|
|
|
+ $item['bh'] = $value['sczl_bh'];
|
|
|
+ $item['xm'] = $value['xm'];
|
|
|
+ $item['Rate'] = 1.000;
|
|
|
+ $item['sczl_ms'] = '0.00';
|
|
|
+ $item['核算产量'] = $item['班组车头产量'] * $item['工序难度系数'];
|
|
|
+ //工时占比
|
|
|
+ if ($item['日定额'] > 0){
|
|
|
+ $manHourRate = number_format($item['核算产量'] / $item['日定额'],4);
|
|
|
+ }else{
|
|
|
+ $manHourRate = '0.0000';
|
|
|
+ }
|
|
|
+ $item['工时占比'] = floatval($manHourRate);
|
|
|
+ array_push($data,$item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// halt($data);
|
|
|
// 用于存储bh对应的工时占比总和
|
|
|
$bhTotals = [];
|
|
|
@@ -282,17 +406,21 @@ class StaffSalary extends Api
|
|
|
foreach ($data as $key=>$item){
|
|
|
$bh = substr($item['sczl_rq'],0,10) . '-' .$item['bh'];
|
|
|
//达标定额
|
|
|
- $standardQuota = floatval($item['工时占比'] / $bhTotals[$bh] * $item['日定额']);
|
|
|
- $data[$key]['达标定额'] = number_format($standardQuota,2,'.', '');
|
|
|
+ if ($item['工时占比'] > 0){
|
|
|
+ $standardQuota = floatval($item['工时占比'] / $bhTotals[$bh] * $item['日定额']);
|
|
|
+ $data[$key]['达标定额'] = number_format($standardQuota,2,'.', '');
|
|
|
+ }else{
|
|
|
+ $data[$key]['达标定额'] = number_format($item['班组车头产量'],2,'.', '');
|
|
|
+ }
|
|
|
$date = substr($item['sczl_rq'],0,10);
|
|
|
if (in_array($date,$vacationOneArr) || in_array($date,$vacationTwoArr)){
|
|
|
//计件工资
|
|
|
- $pieceWorkWage = $standardQuota/1000*$item['千件工价']*$item['Rate']*3;
|
|
|
+ $pieceWorkWage = $data[$key]['达标定额']/1000*$item['千件工价']*$item['Rate']*3;
|
|
|
//加班工资
|
|
|
- $overTimePay = ($item['核算产量'] - $standardQuota) / 1000 *$item['千件工价'] * $item['Rate'] *1.5*3;
|
|
|
+ $overTimePay = ($item['核算产量'] - $data[$key]['达标定额']) / 1000 *$item['千件工价'] * $item['Rate'] *1.5*3;
|
|
|
}else{
|
|
|
- $pieceWorkWage = $standardQuota/1000*$item['千件工价']*$item['Rate'];
|
|
|
- $overTimePay = ($item['核算产量'] - $standardQuota) / 1000 *$item['千件工价'] * $item['Rate'] *1.5;
|
|
|
+ $pieceWorkWage = $data[$key]['达标定额']/1000*$item['千件工价']*$item['Rate'];
|
|
|
+ $overTimePay = ($item['核算产量'] - $data[$key]['达标定额']) / 1000 *$item['千件工价'] * $item['Rate'] *1.5;
|
|
|
}
|
|
|
$data[$key]['个人计件工资'] = number_format($pieceWorkWage,2,'.', '');
|
|
|
$data[$key]['个人加班工资'] = number_format($overTimePay,2,'.', '');
|
|
|
@@ -301,7 +429,7 @@ class StaffSalary extends Api
|
|
|
unset($data[$key]['核算产量']);
|
|
|
}
|
|
|
// halt($data);
|
|
|
-// $res = \db('绩效工资汇总_temp')->insertAll($data);
|
|
|
+ $res = \db('绩效工资汇总_temp')->insertAll($data);
|
|
|
|
|
|
}
|
|
|
}
|