function createMachineSumRow($category_id)
{
    $row = "<tr><td class='overviewNoWrapRight'>(Machine Totals)</td>";
    $machineArray = getArrayOfMachines();
    $total = 0;
    foreach ($machineArray as $machineInfo) {
        $district = $machineInfo[0];
        $machine = $machineInfo[1];
        $name = getDistrictName($district);
        $machine_total = getMachineTotal($category_id, $district, $machine);
        $total += $machine_total;
        $row .= "<td  class='overview'>";
        $row .= $machine_total;
        $row .= "</td>";
    }
    $row .= "<td class='overview'>{$total}</td></tr>";
    return $row;
}
 /**
  * 添加新的收货地址
  */
 public function curdAddress()
 {
     if (IS_POST) {
         $id = intval($_POST['addr_id']);
         $data['member_id'] = $this->mid;
         $data['name'] = str_rp($_POST['name'], 1);
         $data['province_id'] = intval($_POST['province']);
         $data['city_id'] = intval($_POST['city']);
         $data['area_id'] = intval($_POST['area']);
         $data['addr'] = str_rp($_POST['addr'], 1);
         $data['zip'] = intval($_POST['zip']);
         $data['mobile'] = str_rp($_POST['mobile'], 1);
         $data['addr_tag'] = str_rp($_POST['addr_tag'], 1);
         if ($id) {
             $rc = M('MemberAddrs')->where(array('addr_id' => $id))->save($data);
         } else {
             $rc = M('MemberAddrs')->add($data);
         }
     }
     if (IS_AJAX) {
         $res['addr_id'] = $rc;
         $res['province'] = getDistrictName($data['province_id']);
         $res['city'] = getDistrictName($data['city_id']);
         $res['area'] = getDistrictName($data['area_id']);
         echo json_encode($res);
     } elseif (IS_POST) {
         $this->redirect('Member/address');
     }
 }
 public function ajaxSearchOrderAddress()
 {
     $field_name = trim($_POST['field_name']);
     $field_value = trim($_POST['field_value']);
     $field_page = intval($_POST['field_page']);
     $_GET['p'] = $field_page;
     $where[$field_name] = array('like', '%' . $field_value . '%');
     $issuper = M('Admin')->where(array('admin_id' => AID))->getField('admin_issuper');
     if (!$issuper) {
         $where['creat_admin_id'] = array('in', '0,' . AID);
     }
     $count = M('Customer')->where($where)->count();
     $page = new Page($count, 10);
     $list = M('Customer')->where($where)->limit($page->firstRow . ',' . $page->listRows)->select();
     if (!empty($list)) {
         $result['code'] = 200;
         $result['msg'] = '';
         foreach ($list as $key => $item) {
             $list[$key]['address'] = getDistrictName($item['province_id']) . ' ' . getDistrictName($item['city_id']) . ' ' . getDistrictName($item['district_id']) . ' ' . $item['address'];
         }
     } else {
         $result['code'] = 300;
         $result['msg'] = '没有找到相关记录.';
     }
     $result['data'] = $list;
     $result['page']['listRows'] = $page->listRows;
     $result['page']['totalPages'] = ceil($page->totalRows / $page->listRows);
     $result['page']['totalRows'] = $page->totalRows;
     echo json_encode($result);
 }