Example #1
0
 public function view($supplierId = null)
 {
     $supplierService = new SupplierService();
     $supplierDetails = $supplierService->fetchDetailed($supplierId);
     if ($supplierDetails == null) {
         $this->renderView('/common/general_error', array('errorMessage' => "Oops, this supplier does not exist."));
         return;
     }
     $itemsSupplied = $supplierService->fetchItemsSupplied($supplierId);
     $this->renderView('view', array('supplier' => $supplierDetails, 'itemsSupplied' => $itemsSupplied));
 }
 public function getOrderById($id)
 {
     $sql = sprintf("select * from t_order where id=%d", $id);
     $order = $this->g_db->getOne($sql);
     $supplier_service = new SupplierService();
     $supplier_id = $order->supplier_id;
     $supplier = $supplier_service->getSupplierById($supplier_id);
     $supplier_name = $supplier->supplier_name;
     $order->supplier_name = $supplier_name;
     return $order;
 }
 public function getProblemById($id)
 {
     $sql = sprintf("select * from t_problem where id=%d", $id);
     $problem = $this->g_db->getOne($sql);
     require_once 'class/supplier_service.class.php';
     $supplier_service = new SupplierService();
     $supplier_id = $problem->supplier_id;
     $supplier = $supplier_service->getSupplierById($supplier_id);
     $supplier_name = $supplier->supplier_name;
     $problem->supplier_name = $supplier_name;
     return $problem;
 }
Example #4
0
File: item.php Project: noikiy/vis
 /**
  * Shows a detailed view of the item
  */
 public function view($itemId)
 {
     try {
         $itemService = new ItemService();
         $item = $itemService->fetchDetailed($itemId);
         $supplierService = new SupplierService();
         $suppliers = $supplierService->fetchSuppliersForItem($itemId);
         $itemExpenseService = new ItemExpenseService();
         $buyingPrices = $itemExpenseService->fetchBuyingPricesForItem($itemId);
     } catch (Exception $e) {
         Debug::log($e->getMessage(), 'error');
         redirect('/dashboard');
         exit;
     }
     $this->renderView('view', array('item' => $item, 'suppliers' => $suppliers, 'buyingPrices' => $buyingPrices));
 }
Example #5
0
 public function processItemExpenseForm($data)
 {
     $this->db->trans_begin();
     try {
         $itemService = new ItemService();
         if ($data['newItem'] == 1) {
             $data['itemId'] = $itemService->saveItem($data);
         }
         if ($data['supplier']) {
             $supplierService = new SupplierService();
             $data['supplierId'] = $supplierService->saveOrUpdate($data);
         }
         $stockService = new StockService();
         $stockService->addItemsToStock($data['itemId'], $data['quantity']);
         $itemExpenseService = new ItemExpenseService();
         $itemExpenseService->saveItemExpense($data);
         $itemService->updateSuggestedSellingPrice($data['itemId'], $data['price']);
     } catch (Exception $e) {
         $this->db->trans_rollback();
         throw new Exception($e->getMessage());
     }
     $this->db->trans_commit();
 }
<?php

require_once 'include.php';
AdminCheck();
global $arr_header;
global $key_id;
$key_id = "supplier_id";
$arr_header = array("supplier_name" => "Supplier name", "supplier_home_phone" => "Home phone", "supplier_work_phone" => "Work phoe", "supplier_mobile_phone" => "Mobile phone", "supplier_fax_number" => "Fax number", "supplier_address" => "Address");
global $needEdit;
$needEdit = false;
global $service_list;
global $totalCount;
global $curPage;
global $totalPage;
$service_list = new SupplierService();
$totalCount = $service_list->GetCount("select count(*) from supplier");
$totalPage = $service_list->GetTotalPage($totalCount);
$curPage = $service_list->GetCurrentPage($totalPage);
$sql = " select * from supplier ";
$sql = $service_list->SetPaging($sql, $curPage);
global $rows;
$rows = $service_list->GetRows($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CRAZY HATS</title>
<link rel="stylesheet" href="../css/style2.css" type="text/css" />
<script src="../js/Common.js" type="text/javascript"></script>
<style type="text/css">
<?php

/*
 * @auther lion
 * @2013-2-2
 */
require_once 'class/supplier.class.php';
require_once 'class/supplier_service.class.php';
$supplier_service = new SupplierService();
$array_supplier = $supplier_service->getAll();
?>
<h3>新增合作问题记录</h3>
<hr class="bs-docs-separator">
<div class="div-form">
<form class="form-horizontal" action="./index.php?mod=problem&action=add_post" method="post">
     <div class="control-group">
    <label class="control-label" for="problem_name_category">合作问题类型</label>
    <div class="controls">
      <select name="problem_name_category" id="problem_name_category" class="input-xlarge">
 			<option value="给样期限、给样是否及时">给样期限、给样是否及时问题</option>
 			<option value="给样与大货是否一致问题">给样与大货是否一致问题</option>
 			<option value="下单问题">下单问题</option>
 			<option value="服务态度问题">服务态度问题</option>
 			<option value="收货验收问题">收货验收问题</option>
 			<option value="发货速度、正确发货率及售后问题">发货速度、正确发货率及售后问题</option>
 			<option value="其他">其他</option>
      		
      </select>
    </div>
  </div> 
       <div class="control-group">
<?php

/*
 * @auther lion
 * @date 2013-2-5
 */
require_once 'class/supplier.class.php';
require_once 'class/supplier_service.class.php';
require_once 'class/order_goods.class.php';
require_once 'class/order_service.class.php';
require_once 'class/code_names.class.php';
$supplier_service = new SupplierService();
$order = unserialize($_SESSION['order']);
$id = $order->id;
$order_number = $order->order_number;
$supplier_id = $order->supplier_id;
$supplier = $supplier_service->getSupplierById($supplier_id);
$supplier_name = $supplier->supplier_name;
$status = $order->status;
$note = $order->note;
unset($_SESSION["order"]);
$_SESSION['id'] = $id;
$order_service = new OrderService();
$array_order_goods = $order_service->getGoodsByOrderId($id);
?>
<div class="span12" style="margin-left: auto;margin-right: auto;">
<h3 style="float:left">采购单信息</h3>
<div style="float:right;margin-top:12px">
<a class='btn btn-primary' href='./index.php?mod=order&action=edit_get&eid=<?php 
echo $id;
?>
/*
 * @auther udzhou
 * @date 2013-2-1
 */
require_once 'class/supplier_service.class.php';
require_once 'class/supplier.class.php';
require_once 'class/sub_pages.class.php';
if (isset($_GET["p"])) {
    $pageCurrent = $_GET["p"];
} else {
    $pageCurrent = 1;
}
//每页显示的条数
$page_size = 10;
$supplier_service = new SupplierService();
//总条目数
//每次显示的页数
$sub_pages = 10;
$url = "index.php?mod=supplier&action=ls&p=";
if (isset($_GET["keywords"])) {
    $keywords = $_GET["keywords"];
    $array_supplier = $supplier_service->listAllByKeywords($pageCurrent, $page_size, $keywords);
    $nums = $supplier_service->getListRowsByKeywords($keywords);
    if (!empty($keywords)) {
        $url = "index.php?mod=supplier&action=ls&keywords={$keywords}&p=";
    }
} else {
    $array_supplier = $supplier_service->listAll($pageCurrent, $page_size);
    $nums = $supplier_service->getListRows();
}
                $supplier_category_id = $_POST['supplier_category_id'];
                $wholesale_num_min = $_POST['wholesale_num_min'];
                $wholesale_num_max = $_POST['wholesale_num_max'];
                $goods_style = $_POST['goods_style'];
                $goods_category = $_POST['goods_category'];
                $is_provide_pictures = $_POST['is_provide_pictures'];
                $website = $_POST['website'];
                $linkman = $_POST['linkman'];
                $telephone = $_POST['telephone'];
                $province = $_POST['province'];
                $city = $_POST['city'];
                $village = $_POST['village'];
                $address_detial = $_POST['address_detial'];
                $note = $_POST['note'];
                $supplier = new Supplier($id, $supplier_name, $supplier_category_id, $wholesale_num_min, $wholesale_num_max, $goods_style, $goods_category, $is_provide_pictures, $website, $linkman, $telephone, $province, $city, $village, $address_detial, $note);
                $supplier_service = new SupplierService();
                $supplier_service->updateSupplier($supplier);
                $_SESSION['operation'] = true;
                $_SESSION['operation_msg'] = "修改供应商信息:" . $supplier_name . " 成功";
                $log_service->addLog("update", "供应商", $id);
            } else {
                $_SESSION['operation'] = false;
                $_SESSION['operation_msg'] = "修改供应商信息:" . $supplier_name . " 失败";
            }
            header("Location: ./index.php?mod=supplier&action=ls");
        default:
            break;
    }
} else {
    header("Location: ./index.php?mod=supplier&action=ls");
}
					</tr>
			  </table>
			</td>
		</tr>
    </table>

   
    <input id="supplier_id" type="hidden" value=""  />
    </form>
     </div>
</body>
</html>

<?php 
if (isset($_POST['btnSave'])) {
    $service = new SupplierService();
    $sql = ' insert into supplier ';
    $name = $_POST["txtEditName"];
    $home = $_POST["txtEditHomePhone"];
    $work = $_POST["txtEditWorkPhone"];
    $mobile = $_POST["txtEditMobilePhone"];
    $fax = $_POST["txtEditFaxNumber"];
    $address = $_POST["txtEditSupplierAddress"];
    $dataArray = array("supplier_name" => "'" . $name . "'", "supplier_home_phone" => "'" . $home . "'", "supplier_work_phone" => "'" . $work . "'", "supplier_mobile_phone" => "'" . $mobile . "'", "supplier_fax_number" => "'" . $fax . "'", "supplier_address" => "'" . $address . "'");
    $sql .= $service->GetInsertSQL($dataArray);
    $id = $service->save($sql);
    if ($id != 0) {
        alertRedirect(true, 'DisplaySupplier.php');
    } else {
        alertRedirect(false, 'DisplaySupplier.php');
    }