|
|
@@ -16,11 +16,14 @@ class PurchaseController extends Controller
|
|
|
//采购订单过期变更 shish 2021.5.14
|
|
|
public function actionExpireOrder()
|
|
|
{
|
|
|
- $hdInvite = dict::getDict('cgStyle', 'ghs');
|
|
|
+ //采购单由花店发起的!!!!!
|
|
|
+ $hdInvite = dict::getDict('cgStyle', 'hd');
|
|
|
$query = new \yii\db\Query();
|
|
|
$query->from(Purchase::tableName());
|
|
|
$date = date("Y-m-d H:i:s");
|
|
|
- $query->where(['status' => PurchaseClass::STATUS_UN_PAY])->where(['cgStyle' => $hdInvite])->andWhere(['<=', 'deadline', $date]);
|
|
|
+ //找出一个星期内可以标记为过期的订单
|
|
|
+ $startDate = date("Y-m-d H:i:s", strtotime('-7 days'));
|
|
|
+ $query->where(['status' => PurchaseClass::STATUS_UN_PAY])->where(['cgStyle' => $hdInvite])->andWhere(['>', 'deadline', $startDate])->andWhere(['<=', 'deadline', $date]);
|
|
|
$query->orderBy('deadline ASC');
|
|
|
|
|
|
Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
|
|
|
@@ -66,11 +69,14 @@ class PurchaseController extends Controller
|
|
|
//待付款订单自动变成欠款订单
|
|
|
public function actionSetDebtOrder()
|
|
|
{
|
|
|
+ //采购单由供应商发起的!!!!!
|
|
|
$ghsInvite = dict::getDict('cgStyle', 'ghs');
|
|
|
$query = new \yii\db\Query();
|
|
|
$query->from(Purchase::tableName());
|
|
|
$date = date("Y-m-d H:i:s");
|
|
|
- $query->where(['status' => PurchaseClass::STATUS_UN_PAY])->where(['cgStyle' => $ghsInvite])->andWhere(['<=', 'autoSetTime', $date]);
|
|
|
+ //找出一个星期内可以标记为欠款的订单
|
|
|
+ $startDate = date("Y-m-d H:i:s", strtotime('-7 days'));
|
|
|
+ $query->where(['status' => PurchaseClass::STATUS_UN_PAY])->where(['cgStyle' => $ghsInvite])->andWhere(['>', 'autoSetTime', $startDate])->andWhere(['<=', 'autoSetTime', $date]);
|
|
|
$query->orderBy('autoSetTime ASC');
|
|
|
|
|
|
Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
|
|
|
@@ -80,7 +86,6 @@ class PurchaseController extends Controller
|
|
|
|
|
|
$arr = [];
|
|
|
foreach ($query->batch() as $purchases) {
|
|
|
-
|
|
|
foreach ($purchases as $purchase) {
|
|
|
$connection = Yii::$app->db;//事务处理
|
|
|
$transaction = $connection->beginTransaction();
|