Пример #1
0
 public function convertSingleToArray($data)
 {
     $array = array();
     $input = TransactionUtility::checkStore($data->getId(), INSERT_STORE_ACRION);
     if (isset($input[0])) {
         $input = $input[0]['sum_store'];
     } else {
         $input = 0;
     }
     $output = TransactionUtility::checkStore($data->getId(), ADD_ORDER_ACTION);
     if (isset($output[0])) {
         $output = $output[0]['sum_store'];
     } else {
         $output = 0;
     }
     $supplier = Utility::getSupplierInfo($data->getSupplier());
     $array['id'] = $data->getId();
     $array['name'] = $data->getName();
     $array['quantityInput'] = number_format($input);
     $array['quantityOutput'] = number_format($output);
     $array['quantityInStock'] = TransactionUtility::getMenuItemQuantityInStore($data->getId());
     $array['unit'] = $data->getUnit();
     $array['outOfStock'] = $data->getOutOfStock();
     $array['des'] = $data->getDes();
     $array['cost'] = $data->getCost();
     $array['supplier'] = $supplier->getCompanyName();
     $array['supplyType'] = $data->getSupplyItem();
     $array['InMenu'] = Utility::getMenuInMenuStore($data->getId());
     return $array;
 }
Пример #2
0
 public function convertToArray($datas, $store = SUB_STORE)
 {
     $return = array();
     foreach ($datas as $data) {
         $storeInfo = Utility::getStoreInfo($data->getMenuStoreId());
         if ($store == MAIN_STORE) {
             $storeInfo = Utility::getMainStoreInfo($data->getMenuStoreId());
         }
         $note = TransactionUtility::getStoreItemInOrder($data->getNote());
         if ($note == '') {
             $note = $data->getNote();
         }
         $supplier = Utility::getSupplierInfo($data->getSupplier());
         $array = array();
         $array['id'] = $data->getId();
         $array['menuStoreId'] = $storeInfo->getName();
         $array['action'] = $data->getAction();
         $array['quantity'] = $data->getQuantity();
         $array['unit'] = $data->getUnit();
         $array['date'] = date('d-m-Y', $data->getDate());
         $array['note'] = $note;
         $array['cost'] = $data->getCost();
         $array['supplier'] = $supplier->getCompanyName();
         $return[] = $array;
     }
     return $return;
 }
Пример #3
0
 public function getsuplierAction()
 {
     $suplierItemId = $this->params()->fromPost('suplier_item_id');
     $supplier = array();
     $suplierFor = $this->modelSupplyFor->findBy(array('supplierItem' => $suplierItemId));
     $response = array();
     if (!empty($suplierFor)) {
         foreach ($suplierFor as $suplierForItem) {
             $suppli = Utility::getSupplierInfo($suplierForItem->getSuppilerId());
             if ($suppli->getIsdelete() == 0) {
                 $supplier[$suppli->getId()] = $suppli->getCompanyName();
             }
         }
         $response['status'] = true;
         $response['result'] = $supplier;
     } else {
         $response['status'] = false;
     }
     echo json_encode($response);
     die;
 }
Пример #4
0
 public static function renderBestCostSupplier($costBetterSupplier)
 {
     $setting = Utility::getConfig();
     //        print_r($setting);
     $contactInfo = '';
     $checkExists = array();
     foreach ($costBetterSupplier as $supplierItem) {
         $supplierInfo = \Velacolib\Utility\Utility::getSupplierInfo($supplierItem['supplier_id']);
         if ($supplierInfo->getIsdelete() == 0) {
             if (!isset($checkExists[$supplierInfo->getId()])) {
                 $contactInfo .= '<b>' . $supplierInfo->getCompanyName() . ' - ' . $supplierItem['rating'] . ' ' . $setting['currency'] . '/' . $supplierItem['unit'] . ' </b><br/> - Phone: ' . $supplierInfo->getPhone() . '<br/> - Mobile: ' . $supplierInfo->getMobile() . '<br/> - Addr: ' . $supplierInfo->getAddr() . '<br/><br/>';
                 $checkExists[$supplierInfo->getId()] = $supplierInfo->getId();
             }
         }
         //}
     }
     return $contactInfo;
 }