PurchaseController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use bizGhs\order\classes\PurchaseOrderClass;
  5. use bizGhs\order\services\PurchaseOrderService;
  6. use common\components\dateUtil;
  7. use common\components\util;
  8. use Yii;
  9. class PurchaseController extends BaseController
  10. {
  11. //待结款明细 ssh 2021.1.26
  12. public function actionDebtList()
  13. {
  14. $get = Yii::$app->request->get();
  15. $id = $get['id'] ?? 0;
  16. $shortOrderSn = $get['shortOrderSn'] ?? '';
  17. $info = GhsClass::getGhsInfo($id);
  18. GhsClass::valid($info, $this->shopId);
  19. $where = ['ghsId' => $id, 'debt' => PurchaseOrderClass::DEBT_YES];
  20. $searchTime = $get['searchTime'] ?? '';
  21. if (!empty($searchTime)) {
  22. $startTime = $get['startTime'] ?? '';
  23. $endTime = $get['endTime'] ?? '';
  24. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  25. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  26. }
  27. if (!empty($shortOrderSn)) {
  28. $where['orderSn'] = ['like', $shortOrderSn];
  29. }
  30. $respond = PurchaseOrderService::getDebtList($where);
  31. $respond['ghsInfo'] = $info;
  32. util::success($respond);
  33. }
  34. }