Commit f2d13f84 authored by clone's avatar clone

1

parent 6905e4c3
...@@ -281,6 +281,7 @@ class StoreFeeService ...@@ -281,6 +281,7 @@ class StoreFeeService
$districtAttendanceNum = $this->sumAttendanceNum(0, 2, $setting_date); $districtAttendanceNum = $this->sumAttendanceNum(0, 2, $setting_date);
$discountsNum = $this->sumAttendanceNum(0, 4, $setting_date); $discountsNum = $this->sumAttendanceNum(0, 4, $setting_date);
foreach ($storeSettingInfo as $key => $item) { foreach ($storeSettingInfo as $key => $item) {
$applyForFeeArr = $this->getApplyForFee($item["store_id"], $setting_date); $applyForFeeArr = $this->getApplyForFee($item["store_id"], $setting_date);
$site_id = $applyForFeeArr[0]["site_id"]; $site_id = $applyForFeeArr[0]["site_id"];
$store_id = $item["store_id"]; $store_id = $item["store_id"];
...@@ -314,95 +315,98 @@ class StoreFeeService ...@@ -314,95 +315,98 @@ class StoreFeeService
$assume_fee, $purpose $assume_fee, $purpose
)); ));
} }
//todo 处理 房租租金 上海固定成本分部固定成本 发展基金社保报销 总经理薪资 手续费 }
//门店租金 //todo 处理 房租租金 上海固定成本分部固定成本 发展基金社保报销 总经理薪资 手续费
$storeModel = new AStore(); //门店租金
$rent = $storeModel->getStoreCost("b.id,b.rent", ["a.id" => $item["store_id"]]); $storeModel = new AStore();
$rent = $storeModel->getStoreCost("b.id,b.rent", ["a.id" => $item["store_id"]]);
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 1, 100, 0, $item["create_time"], array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 1, 100, 0, $item["create_time"],
$rent["rent"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum, $rent["rent"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
ceil($attendance_num * 100 / $officeAttendanceNum) * $rent["rent"] * 0.01, "" ceil($attendance_num * 100 / $officeAttendanceNum) * $rent["rent"] * 0.01, ""
)); ));
//上海总部固定成本 门店是上海的只承担总部成本,否则承担总部和分部成本 //上海总部固定成本 门店是上海的只承担总部成本,否则承担总部和分部成本
//上海 //上海
$attendance_discount = $attendance_num;
if ($item["is_discounts"] == 1) {
$attendance_discount = $attendance_num * $tree[0]["discounts"] * 0.01;
} $attendance_discount = $attendance_num;
$assume_fee1 = ceil($attendance_discount / ($companyAttendanceNum - $discountsNum) * $tree[0]["fixed_fee"] * 100) * 0.01; if ($item["is_discounts"] == 1) {
$assume_fee2 = ceil($attendance_discount / ($companyAttendanceNum - $discountsNum) * $tree[0]["apply_for_fee"] * 100) * 0.01; $attendance_discount = $attendance_num * $tree[0]["discounts"] * 0.01;
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 2, 201, 0, $tree[0]["create_time"],
$tree[0]["fixed_fee"], $attendance_discount, $officeAttendanceNum, $districtNum, $companyAttendanceNum - $discountsNum,
$assume_fee1, ""
));
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 2, 202, 0, $tree[0]["create_time"],
$tree[0]["apply_for_fee"], $attendance_discount, $officeAttendanceNum, $districtNum, $companyAttendanceNum - $discountsNum,
$assume_fee2, ""
));
if ($site_id != 10001) { }
$create_time = ""; $assume_fee1 = ceil($attendance_discount / ($companyAttendanceNum - $discountsNum) * $tree[0]["fixed_fee"] * 100) * 0.01;
$rent_fixed = $apply_for_fee = 0; $assume_fee2 = ceil($attendance_discount / ($companyAttendanceNum - $discountsNum) * $tree[0]["apply_for_fee"] * 100) * 0.01;
switch ($site_id) { array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 2, 201, 0, $tree[0]["create_time"],
case 10002: $tree[0]["fixed_fee"], $attendance_discount, $officeAttendanceNum, $districtNum, $companyAttendanceNum - $discountsNum,
$create_time = $tree[1]["create_time"]; $assume_fee1, ""
$rent_fixed = $tree[1]["fixed_fee"]; ));
$apply_for_fee = $tree[1]["apply_for_fee"]; array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 2, 202, 0, $tree[0]["create_time"],
break; $tree[0]["apply_for_fee"], $attendance_discount, $officeAttendanceNum, $districtNum, $companyAttendanceNum - $discountsNum,
case 10003: $assume_fee2, ""
$create_time = $tree[2]["create_time"]; ));
$rent_fixed = $tree[2]["fixed_fee"];
$apply_for_fee = $tree[2]["apply_for_fee"]; if ($site_id != 10001) {
break; $create_time = "";
case 10004: $rent_fixed = $apply_for_fee = 0;
$create_time = $tree[3]["create_time"]; switch ($site_id) {
$rent_fixed = $tree[3]["fixed_fee"]; case 10002:
$apply_for_fee = $tree[3]["apply_for_fee"]; $create_time = $tree[1]["create_time"];
break; $rent_fixed = $tree[1]["fixed_fee"];
case 10005: $apply_for_fee = $tree[1]["apply_for_fee"];
$create_time = $tree[4]["create_time"]; break;
$rent_fixed = $tree[4]["fixed_fee"]; case 10003:
$apply_for_fee = $tree[4]["apply_for_fee"]; $create_time = $tree[2]["create_time"];
break; $rent_fixed = $tree[2]["fixed_fee"];
$apply_for_fee = $tree[2]["apply_for_fee"];
break;
case 10004:
$create_time = $tree[3]["create_time"];
$rent_fixed = $tree[3]["fixed_fee"];
$apply_for_fee = $tree[3]["apply_for_fee"];
break;
case 10005:
$create_time = $tree[4]["create_time"];
$rent_fixed = $tree[4]["fixed_fee"];
$apply_for_fee = $tree[4]["apply_for_fee"];
break;
}
//分部
$disc_assume_fee1 = ceil($attendance_num / $officeAttendanceNum * $apply_for_fee * 100) * 0.01;
$disc_assume_fee2 = ceil($attendance_num / $officeAttendanceNum * $apply_for_fee * 100) * 0.01;
array_push($insertArr, $this->storeCostExtBin($cost_id, 3, 301, 0, $create_time,
$rent_fixed, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$disc_assume_fee1, ""
));
array_push($insertArr, $this->storeCostExtBin($cost_id, 3, 302, 0, $create_time,
$apply_for_fee, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$disc_assume_fee2, ""
));
} }
//同联发展基金 //分部
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 4, 401, 0, $tree[4]["create_time"], $disc_assume_fee1 = ceil($attendance_num / $officeAttendanceNum * $apply_for_fee * 100) * 0.01;
0, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum, $disc_assume_fee2 = ceil($attendance_num / $officeAttendanceNum * $apply_for_fee * 100) * 0.01;
$attendance_num * $tree[4]["fixed_fee"], "" array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id,3, 301, 0, $create_time,
)); $rent_fixed, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
//社保报销费用 $disc_assume_fee1, ""
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 502, 0, $item["create_time"],
$item["social_security_fee"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$item["social_security_fee"], ""
)); ));
//总经理基薪 array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id,3, 302, 0, $create_time,
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 503, 0, $tree[6]["create_time"], $apply_for_fee, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$tree[6]["fixed_fee"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum, $disc_assume_fee2, ""
$tree[6]["fixed_fee"], ""
));
//手续费
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 509, 0, $item["create_time"],
$item["transfer_charge"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$item["transfer_charge"], ""
)); ));
} }
//同联发展基金
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 4, 401, 0, $tree[4]["create_time"],
0, $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$attendance_num * $tree[4]["fixed_fee"], ""
));
//社保报销费用
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 502, 0, $item["create_time"],
$item["social_security_fee"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$item["social_security_fee"], ""
));
//总经理基薪
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 503, 0, $tree[6]["create_time"],
$tree[6]["fixed_fee"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$tree[6]["fixed_fee"], ""
));
//手续费
array_push($insertArr, $this->storeCostExtBin($cost_id, $store_id, 5, 509, 0, $item["create_time"],
$item["transfer_charge"], $attendance_num, $officeAttendanceNum, $districtNum, $companyAttendanceNum,
$item["transfer_charge"], ""
));
$storeCostExtModel = new FStoreCostExt(); $storeCostExtModel = new FStoreCostExt();
$is_ok = $storeCostExtModel->addCostExt($insertArr); $is_ok = $storeCostExtModel->addCostExt($insertArr);
if ($is_ok) { if ($is_ok) {
...@@ -567,11 +571,11 @@ class StoreFeeService ...@@ -567,11 +571,11 @@ class StoreFeeService
$params["store_id"] = $store_id; $params["store_id"] = $store_id;
$params["cost_id"] = $storeCostInfo["id"]; $params["cost_id"] = $storeCostInfo["id"];
$params["is_del"] = 0; $params["is_del"] = 0;
$storeCostExtInfo = $storeCostExtModel->getStoreCostFeeList($field, $params); $storeCostExtInfo = $storeCostExtModel->getStoreCostFeeList($field, $params);
if (!$storeCostExtInfo) { if (!$storeCostExtInfo) {
return false; return false;
} }
$tree = []; $tree = [];
foreach ($storeCostExtInfo as $key => $item) { foreach ($storeCostExtInfo as $key => $item) {
$tree[$item["type"]][] = $item; $tree[$item["type"]][] = $item;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment