Example #1
0
 public function InsertGBPenCustomers($PostInfo)
 {
     $this->__LoadModules('/modules/class.CustomersModule.php');
     $CustomersModule = new CustomersModule();
     $InsertInfo['CompanyName'] = $PostInfo['cus_company'];
     //查询公司名称是否存在
     $CustomersInfo = $CustomersModule->GetOneInfoByArrayKeys(array('CompanyName' => $InsertInfo['CompanyName']));
     if (!empty($CustomersInfo)) {
         //公司名称存在就插入产品信息
         $IsInsertGBPenCustomersProjectOk = $this->InsertGBPenCustomersProject($PostInfo, $CustomersInfo['CustomersID']);
     } else {
         //插入公司和产品信息
         $CustomersID = $this->InsertCustomersInfo($PostInfo);
         if ($CustomersID > 0) {
             $IsInsertGBPenCustomersProjectOk = $this->InsertGBPenCustomersProject($PostInfo, $CustomersID);
         }
     }
     if ($IsInsertGBPenCustomersProjectOk) {
         return 1;
     } else {
         return 0;
     }
 }
Example #2
0
    public function Renewals()
    {
        $CustomersID = $this->_GET['ID'];
        $CustomersModule = new CustomersModule();
        $SearchArray['CustomersID'] = $CustomersID;
        $SearchArray['AgentID'] = $_SESSION['AgentID'];
        $CustomInfo = $CustomersModule->GetOneInfoByArrayKeys($SearchArray);
        //dd($CustomInfo);
        $CompanyName = $CustomInfo['CompanyName'];
        //获取G宝盆项目id
        $ProjectId = TONGYI_ID;
        $QuerryArray['CustomersID'] = $CustomersID;
        $QuerryArray['ProjectId'] = $ProjectId;
        $QuerryArray['AgentID'] = $_SESSION['AgentID'];
        $CustProModule = new CustProModule();
        $CustProInfo = $CustProModule->GetOneInfoByArrayKeys($QuerryArray);
        //dd($CustProInfo);
        $CustomersProjectID = $CustProInfo['CustomersProjectID'];
        $time = date('Y');
        $LastTime = date('Y', strtotime($CustProInfo['EndTime'])) - $time;
        //dd($i);
        $CanAddTime = 10 - $LastTime;
        $option = '';
        $show = '';
        if ($CanAddTime <= 0) {
            $option .= '<option value="0">已达最高年限</option>';
        } else {
            $data = $this->GetRenewals($CustomersProjectID, 1);
            $show = '<center>到期时间调整为<span class="red rendtime">' . $data['newEndTime'] . '</span></center>
			  <center class="Consumption">将消费金额:<span class="red font22">¥' . $data['StandardCost'] . '</span></center>';
            for ($i; $i < $CanAddTime; $i++) {
                $k = $i + 1;
                $option .= '<option value="' . $k . '">' . $k . '年</option>';
            }
        }
        $String = '<h1 class="Bombbox-top">
						<span class="close"><img src="images/close.png" /></span>续费
					</h1>
					<div class="Bombbox-m">
    				<form name="form2" method="post" action="' . UrlRewriteSimple($this->MyModule, 'FinalRenewals', true) . '" id="form2">
						<table width="100%" border="0">
							<tr height="40">
								<td>确定<b class="blue">' . $CompanyName . '</b>&nbsp;&nbsp;续费&nbsp;
									<input type="hidden" name="CustoProID" value="' . $CustProInfo['CustomersProjectID'] . '" />
									<select name="ryear">
									' . $option . '
									</select> <br />
								</td>
							</tr>
							<tr>
								<td class="rshow">' . $show . '</td>
							</tr>
							<tr height="45">
								<td align="center"><input name="" type="submit" value="确定"
									class="btn-Determine" /> <input name="" type="button"
									value="取消" class="btn-Cancel" /></td>
							</tr>
						</table>
					</form>
					</div>';
        die($String);
    }
Example #3
0
 public function AddCustomer()
 {
     if ($this->_POST) {
         $LogsFunction = new LogsFunction();
         $Data['CompanyName'] = trim($this->_POST['CompanyName']);
         $CustomersModule = new CustomersModule();
         $IsCompanyInfo = $CustomersModule->GetOneInfoByArrayKeys($Data);
         if (!empty($IsCompanyInfo)) {
             $LogsFunction->logsinfile('101', 2, $CustomersID);
             JsMessage('该公司已经存在!');
         }
         $Data['CustomersName'] = trim($this->_POST['CustomersName']);
         $Data['Area'] = trim($this->_POST['Area']);
         $Data['Tel'] = trim($this->_POST['Tel']);
         $Data['Fax'] = trim($this->_POST['Fax']);
         $Data['Email'] = trim($this->_POST['Email']);
         $Data['Address'] = trim($this->_POST['Address']);
         $Data['Remark'] = addslashes($this->_POST['Remark']);
         $Data['UpdateTime'] = date("Y-m-d H:i:s");
         $Data['AddTime'] = date("Y-m-d H:i:s");
         $Data['AgentID'] = $_SESSION['AgentID'];
         if ($Data['Tel'] == '' || $Data['Email'] == '' || $Data['AgentID'] == '') {
             JsMessage('信息填写不完整!');
         }
         if ($CustomersModule->InsertArray($Data)) {
             $LogsFunction->logsinfile('101', 1, $CustomersID);
             JsMessage('添加客户成功!', UrlRewriteSimple('Agent', 'Customer', true), '继续操作');
         } else {
             $LogsFunction->logsinfile('101', 0, $CustomersID);
             JsMessage('添加客户失败,请再一次尝试!');
         }
     }
 }
Example #4
0
 public function Seach()
 {
     $MysqlWhere = ' where 1';
     $WhereGet = '';
     $this->seachValue = trim($this->_GET['seachValue']);
     //订单号
     $OrderNO = trim($this->_GET['OrderNO']);
     if ($OrderNO != 0) {
         $MysqlWhere .= ' and OrderNO=\'' . $OrderNO . '\'';
         $WhereGet .= '&OrderNO=' . $OrderNO;
         $this->OrderNO = $OrderNO;
     }
     //入账/消费
     $Type = $this->_GET['Type'];
     if ($Type == '入账') {
         $MysqlWhere .= ' and Type=1';
         $WhereGet .= '&Type=' . $Type;
         $this->Type = $Type;
     }
     if ($Type == '消费') {
         $MysqlWhere .= ' and Type=0';
         $WhereGet .= '&Type=' . $Type;
         $this->Type = $Type;
     }
     //代理商
     $AgentIDValue = trim($this->_GET['AgentIDValue']);
     if ($AgentIDValue != '') {
         $AgentModule = new AgentModule();
         $AgentInfo = $AgentModule->GetOneInfoByArrayKeys(array('UserName' => $AgentIDValue));
         $MysqlWhere .= ' and AgentID=' . $AgentInfo['AgentID'];
         $WhereGet .= '&AgentIDValue=' . $AgentIDValue;
         $this->AgentIDValue = $AgentIDValue;
     }
     //产品
     $ProjectIDValue = trim($this->_GET['ProjectIDValue']);
     if ($ProjectIDValue != '') {
         $MysqlWhere .= ' and ProjectID=' . $ProjectIDValue;
         $WhereGet .= '&ProjectIDValue=' . $ProjectIDValue;
         $this->ProjectIDValue = $ProjectIDValue;
     }
     //客户企业名称
     $CustomersIDValue = trim($this->_GET['CustomersIDValue']);
     if ($CustomersIDValue != '') {
         $CustomersModule = new CustomersModule();
         $CustomersInfo = $CustomersModule->GetOneInfoByArrayKeys(array('CompanyName' => $CustomersIDValue));
         $MysqlWhere .= ' and CustomersID=' . $CustomersInfo['CustomersID'];
         $WhereGet .= '&CustomersIDValue=' . $CustomersIDValue;
         $this->CustomersIDValue = $CustomersIDValue;
     }
     //下订单开始时间
     $StartTime = trim($this->_GET['StartTime']);
     $this->StartTime = $StartTime;
     if ($StartTime != '') {
         $StartTime = $StartTime . ' 00:00:00';
         $MysqlWhere .= ' and AddTime>\'' . $StartTime . '\'';
         $WhereGet .= '&StartTime=' . $StartTime;
     }
     //下订单结束时间
     $EndTime = trim($this->_GET['EndTime']);
     $this->EndTime = $EndTime;
     if ($EndTime != '') {
         $EndTime = $EndTime . ' 23:59:59';
         $MysqlWhere .= ' and AddTime<\'' . $EndTime . '\'';
         $WhereGet .= '&EndTime=' . $EndTime;
     }
     //最低交易金额
     $MinAmount = trim($this->_GET['MinAmount']);
     if ($MinAmount != '') {
         $MysqlWhere .= ' and Amount>' . $MinAmount;
         $WhereGet .= '&MinAmount=' . $MinAmount;
         $this->MinAmount = $MinAmount;
     }
     //最高交易金额
     $MaxAmount = trim($this->_GET['MaxAmount']);
     if ($MaxAmount != '') {
         $MysqlWhere .= ' and Amount<' . $MaxAmount;
         $WhereGet .= '&MaxAmount=' . $MaxAmount;
         $this->MaxAmount = $MaxAmount;
     }
     //客户端IP
     $FromIP = trim($this->_GET['FromIP']);
     if ($FromIP != '') {
         $MysqlWhere .= ' and FromIP=\'' . $FromIP . '\'';
         $WhereGet .= '&FromIP=' . $FromIP;
         $this->FromIP = $FromIP;
     }
     $Page = intval($this->_GET['Page']);
     $Page = $Page ? $Page : 1;
     $OrderModule = new OrderModule();
     $ListsNum = $OrderModule->GetListsNum($MysqlWhere);
     $Rscount = $ListsNum['Num'];
     $PageSize = 5000;
     if ($WhereGet == '') {
         $PageSize = 10;
     }
     if ($Rscount) {
         $Data['RecordCount'] = $Rscount;
         $Data['PageSize'] = $PageSize ? $PageSize : $Data['RecordCount'];
         $Data['PageCount'] = ceil($Data['RecordCount'] / $PageSize);
         $Data['Page'] = min($Page, $Data['PageCount']);
         $Offset = ($Page - 1) * $Data['PageSize'];
         if ($Page > $Data['PageCount']) {
             $Page = $Data['PageCount'];
         }
         $Data['Data'] = $OrderModule->GetLists($MysqlWhere, $Offset, $Data['PageSize']);
         $AgentModule = new AgentModule();
         $AgentAccountModule = new AgentAccountModule();
         $ProjectModule = new ProjectModule();
         $OrderDescriptionModule = new OrderDescriptionModule();
         $RuZhangNum = 0;
         $RuZhang = 0;
         $XiaoFei = 0;
         $XiaoFeiNum = 0;
         foreach ($Data['Data'] as $Key => $Value) {
             $Array['AgentID'] = $Value['AgentID'];
             $AgentInfo = $AgentModule->GetOneInfoByKeyID($Array['AgentID']);
             $Data['Data'][$Key]['UserName'] = $AgentInfo['UserName'];
             $ProjectInfo = $ProjectModule->GetOneInfoByKeyID($Value['ProjectID']);
             $Data['Data'][$Key]['ProjectName'] = $ProjectInfo['ProjectName'];
             $AgentAccountInfo = $AgentAccountModule->GetLists('where AgentID=' . $Array['AgentID']);
             $Num = count($AgentAccountInfo);
             if ($Num == 0) {
                 $Data['Data'][$Key]['Total'] = '0';
                 $Data['Data'][$Key]['Balance'] = '0';
             } else {
                 foreach ($AgentAccountInfo as $V) {
                     $Data['Data'][$Key]['Total'] += $V['Total'];
                     $Data['Data'][$Key]['Balance'] += $V['Balance'];
                 }
             }
             $OrderDescriptionInfo = $OrderDescriptionModule->GetOneInfoByKeyID($Value['DescriptionID']);
             $Data['Data'][$Key]['Description'] = $OrderDescriptionInfo['Description'];
             if ($Value['Type'] == 1) {
                 $Data['Data'][$Key]['TypeName'] = '入账';
                 $RuZhang += $Value['Amount'];
                 $RuZhangNum++;
             } else {
                 $Data['Data'][$Key]['TypeName'] = '消费';
                 $XiaoFei += $Value['Amount'];
                 $XiaoFeiNum++;
             }
         }
         $this->RuZhangNum = $RuZhangNum;
         $this->RuZhang = $RuZhang;
         $this->XiaoFei = $XiaoFei;
         $this->XiaoFeiNum = $XiaoFeiNum;
         MultiPage($Data, 10);
         $this->Data = $Data;
         $this->WhereGet = $WhereGet;
     }
 }
Example #5
0
 public function gcreate()
 {
     $public = array();
     $AgentID = $this->_POST['agentid'];
     $token = $this->_POST['_token'];
     $timemap = $this->_POST['timemap'];
     $public['AgentID'] = $AgentID;
     $public['timemap'] = $timemap;
     $AgentApiModule = new AgentApiModule();
     $AgentApiInfo = $AgentApiModule->GetOneInfoByForID($AgentID);
     if ($AgentID == '' || $token == '' || ($timemap = '' || empty($AgentApiInfo))) {
         die(jsonp(array('0', '数据提供错误'), 'JSONP'));
     }
     $type = $this->_POST['type'];
     $public['private'] = $AgentApiInfo['private'];
     $verify = $this->verify($public, $token);
     if ($verify) {
         $username = $this->_POST['username'];
         $company = $this->_POST['company'];
         $realname = $this->_POST['realname'];
         $phone = $this->_POST['phone'];
         $fax = $this->_POST['fax'];
         $email = $this->_POST['email'];
         $address = $this->_POST['address'];
         $weixinname = $this->_POST['weixinname'];
         $weixinid = $this->_POST['weixinid'];
         $weixnno = $this->_POST['weixnno'];
         $remark = $this->_POST['remark'];
         $CustomersModule = new CustomersModule();
         $CustProModule = new CustProModule();
         $where = "where CompanyName='{$company}'";
         $num = $CustomersModule->GetListsNum($where);
         if ($num['Num']) {
             $where = "CompanyName='{$company}' and AgentID={$AgentID}";
             if ($realname != '') {
                 $update['CustomersName'] = $realname;
             }
             if ($phone != '') {
                 $update['Tel'] = $phone;
             }
             if ($fax != '') {
                 $update['Fax'] = $fax;
             }
             if ($email != '') {
                 $update['Email'] = $email;
             }
             if ($address != '') {
                 $update['Addresss'] = $address;
             }
             $update['UpdateTime'] = date('Y-m-d');
             if ($CustomersModule->UpdateWhere($update, $where)) {
                 $SelectID = $CustomersModule->GetOneInfoByArrayKeys();
                 $id = $SelectID['CustomersID'];
                 $message = '已更新' . $company . '公司的信息';
                 $show = array('err' => 0, 'msg' => $message);
             } else {
                 $show = array('err' => 1001, 'msg' => '更新客户信息失败');
             }
         } else {
             if ($company == '') {
                 $show = array('err' => 1001, 'msg' => '提供一个空的公司名,无法进行处理');
             } else {
                 $insert = array('CompanyName' => $company, 'CustomersName' => $realname, 'Tel' => $phone, 'Fax' => $fax, 'Email' => $email, 'Address' => $address, 'AgentID' => $AgentID);
                 if ($CustomersModule->InsertArray($insert)) {
                     $id = mysql_insert_id();
                     $show = array('err' => 0, 'msg' => '成功添加一个新的风信客户记录');
                 } else {
                     $show = array('err' => 1001, 'msg' => '添加新的客户记录失败');
                 }
             }
         }
         if ($domain != '') {
             $gbaopen['AddTime'] = date('Y-m-d');
             $gbaopen['StartTime'] = $fengxin['AddTime'];
             $gbaopen['EndTime'] = date('Y-m-d', strtotime("{$fengxin['AddTime']} + 7 days"));
             $gbaopen['CustomersID'] = $id;
             $gbaopen['G_domain'] = $domain;
             $fengxing['G_beian'] = $isbeian;
             $fengxing['G_name'] = $username;
             $CustProModule->InsertArray();
             $show['msg'] = $show['msg'] + ',创建G宝盆账号成功';
         }
     } else {
         $show = array('err' => 1001, 'msg' => '提供信息错误,无法进行处理');
     }
     print_r($show);
     die(jsonp($show, 'JSONP'));
 }