protected function getColMap(GoodsPassport $product, User $user) { return $product->isOwn($user) && $user->getRole()->hasAuth('READ_PRODUCT_OWN') || $user->getRole()->hasAuth('READ_PRODUCT_ALL') ? array('A' => $product->getCreatedAt() ? $product->getCreatedAt()->format('Y-m-d H:i:s') : null, 'B' => ($brand = $product->getBrand()) ? $brand->getName() : null, 'C' => ($pattern = $product->getPattern()) ? $pattern->getName() : null, 'D' => $product->getModel(), 'E' => (($color = $product->getColor()) ? $color->getName() . '-' : null) . $product->getColorSn(), 'F' => $product->getOrgSn(), 'G' => ($level = $product->getLevel()) ? $level->getName() : null, 'H' => $product->getName(), 'I' => $product->getSn(), 'J' => $product->getPrice(), 'K' => $product->getCostVerifyed($user), 'L' => ($consigner = $product->getCustom()) ? $consigner->getExcelFormatData() : null, 'M' => $product->getCustomSn()) : array('A' => '無閱讀權限', 'B' => '無閱讀權限', 'C' => '無閱讀權限', 'D' => $product->getModel(), 'E' => '無閱讀權限', 'F' => '無閱讀權限', 'G' => '無閱讀權限', 'H' => $product->getName(), 'I' => $product->getSn(), 'J' => '無閱讀權限', 'K' => '無閱讀權限', 'L' => '無閱讀權限', 'M' => '無閱讀權限'); }
protected function getColMap(GoodsPassport $product) { $order = $product->getValidOutOrder(); if (!$order) { return array('A' => '尚未結清', 'B' => '尚未結清', 'C' => '尚未結清', 'D' => $product->getModel(), 'E' => '尚未結清', 'F' => $product->getName(), 'G' => $product->getSn(), 'H' => '尚未結清', 'I' => '尚未結清', 'J' => '尚未結清', 'K' => '尚未結清', 'L' => '尚未結清', 'M' => '尚未結清', 'N' => '尚未結清', 'O' => '尚未結清', 'P' => '尚未結清', 'Q' => '尚未結清', 'R' => '尚未結清', 'S' => '尚未結清', 'T' => '尚未結清', 'U' => '尚未結清', 'V' => '尚未結清'); } return $product->isOwn($this->user) && $this->user->getRole()->hasAuth('READ_ORDER_OWN') || $this->user->getRole()->hasAuth('READ_ORDER_ALL') ? array('A' => $order->getOpes()->last()->getDatetime()->format('Y-m-d H:i:s'), 'B' => ($brand = $product->getBrand()) ? $brand->getName() : null, 'C' => ($pattern = $product->getPattern()) ? $pattern->getName() : null, 'D' => $product->getModel(), 'E' => $product->getColorSn(), 'F' => $product->getName(), 'G' => $product->getSn(), 'H' => ($level = $product->getLevel()) ? $level->getName() : null, 'I' => $product->getCostVerifyed($this->user), 'J' => $product->getFeedBack(), 'K' => $order->getKind()->getName(), 'L' => $order->getRequired(), 'M' => $product->getCostVerifyed($this->user), 'N' => ($profit = $order->getRequired() - $product->getCostVerifyed($this->user)) > 0 ? $profit : 0, 'O' => $order->getOrgRequired(), 'P' => $order->getRequired() === 0 ? 0 : round($order->getOrgRequired() * ($order->getPaid() / $order->getRequired())), 'Q' => $order->getOrgRequired() - $product->getCostVerifyed($this->user), 'R' => $order->getOpes()->last()->getUser()->getUsername(), 'S' => $order->getMemo(), 'T' => ($activity = $product->getActivity()) ? $activity->getName() : '門市出售', 'U' => $product->getParent()->getSn(), 'V' => $this->map[substr($product->getParent()->getSn(), 0, 1)]->getName()) : array('A' => '無閱讀權限', 'B' => '無閱讀權限', 'C' => '無閱讀權限', 'D' => $product->getModel(), 'E' => '無閱讀權限', 'F' => $product->getName(), 'G' => $product->getSn(), 'H' => '無閱讀權限', 'I' => '無閱讀權限', 'J' => '無閱讀權限', 'K' => '無閱讀權限', 'L' => '無閱讀權限', 'M' => '無閱讀權限', 'N' => '無閱讀權限', 'O' => '無閱讀權限', 'P' => '無閱讀權限', 'Q' => '無閱讀權限', 'R' => '無閱讀權限', 'S' => '無閱讀權限', 'T' => '無閱讀權限', 'U' => '無閱讀權限', 'V' => '無閱讀權限'); }