Esempio n. 1
0
 public static function Create($mobile, $user_id, $secret = null, $enable = false)
 {
     if (!Utility::IsMobile($mobile, true)) {
         return;
     }
     $secret = $secret ? $secret : Utility::VerifyCode();
     $table = new Table('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'enable' => $enable ? 'Y' : 'N', 'secret' => $secret));
     $condition = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'N');
     $haveone = DB::GetTableRow('toolsbind', $condition);
     if ($haveone) {
         return Table::UpdateCache('toolsbind', $haveone['id'], array('secret' => $secret, 'enable' => 'N'));
     }
     //已经绑定了本号码
     $loginbind = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'Y');
     $havebind = DB::GetTableRow('toolsbind', $loginbind);
     if ($havebind) {
         return false;
     }
     //$table->insert(array( 'user_id', 'tools','secret', 'enable'));
     DB::Insert('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'secret' => $secret, 'enable' => 'N', 'create_time' => time()));
     $have = Table::Fetch('toolsbind', $mobile, 'tools');
     if ($have && 'Y' == $have['enable']) {
         return true;
     }
 }
Esempio n. 2
0
 public static function BindRenRen($user_row, $renren_uid)
 {
     $user_renren_row['uid'] = $user_row['id'];
     $user_renren_row['renren_uid'] = $renren_uid;
     $user_renren_row['id'] = DB::Insert('user_renren', $user_renren_row);
     return $user_renren_row['id'];
 }
Esempio n. 3
0
 public static function Create($user_row, $uc = true)
 {
     if (function_exists('zuitu_uc_register') && $uc) {
         $pp = $user_row['password'];
         $em = $user_row['email'];
         $un = $user_row['username'];
         $ret = zuitu_uc_register($em, $un, $pp);
         if (!$ret) {
             return false;
         }
     }
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['create_time'] = $user_row['login_time'] = time();
     $user_row['ip'] = Utility::GetRemoteIp();
     $user_row['secret'] = md5(Utility::GenSecret(12));
     $user_row['id'] = DB::Insert('user', $user_row);
     $_rid = abs(intval(cookieget('_rid')));
     if ($_rid) {
         $r_user = Table::Fetch('user', $_rid);
         if ($r_user) {
             ZInvite::Create($r_user, $user_row);
         }
     }
     if ($user_row['id'] == 1) {
         Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
     }
     return $user_row['id'];
 }
Esempio n. 4
0
 public static function Create($user_row)
 {
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['login_time'] = time();
     $user_row['id'] = DB::Insert('user', $user_row);
     return $user_row['id'];
 }
Esempio n. 5
0
 /**
  * 记日志 实现
  * @see Log_Model::log()
  */
 public function log($data, $type = 1)
 {
     $data = self::buildData($data);
     $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $log = array('type' => intval($type), 'url' => $url, 'post_data' => file_get_contents("php://input"), 'content' => $data, 'create_time' => time());
     return DB::Insert($this->table, $log, null, $this->dbType);
 }
Esempio n. 6
0
function log_admin($type, $operation, $relate_data = array())
{
    global $login_user;
    $user_id = $login_user['id'];
    $user_email = $login_user['email'];
    $create_on = date('Y-m-d H:i:s');
    $relate_data = serialize($relate_data);
    DB::Insert('logger_admin', array('user_id' => $user_id, 'user_email' => $user_email, 'type' => $type, 'operation' => $operation, 'relate_data' => $relate_data, 'create_on' => $create_on));
}
Esempio n. 7
0
 public static function Create($ruser, $newuser)
 {
     if ($ruser['id'] == $newuser['id']) {
         return;
     }
     $invite = array('user_id' => $ruser['id'], 'user_ip' => $ruser['ip'], 'other_user_id' => $newuser['id'], 'other_user_ip' => $newuser['ip'], 'create_time' => time());
     cookieset('_rid', null, -1);
     return DB::Insert('invite', $invite);
 }
Esempio n. 8
0
 public static function CreateFromCharge($money, $user_id, $time, $service)
 {
     if (!$money || !$user_id || !$time || !$service) {
         return 0;
     }
     $pay_id = "charge-{$user_id}-{$time}";
     $oarray = array('user_id' => $user_id, 'pay_id' => $pay_id, 'service' => $service, 'state' => 'pay', 'money' => $money, 'origin' => $money, 'create_time' => $time);
     return DB::Insert('order', $oarray);
 }
Esempio n. 9
0
 public static function Create($score, $user_id, $action = 'charge', $detail_id = 0)
 {
     if (!$score || !$user_id) {
         return 0;
     }
     //update user score;
     $user = Table::Fetch('user', $user_id);
     Table::UpdateCache('user', $user_id, array('score' => array("`score`+{$score}")));
     $u = array('user_id' => $user_id, 'admin_id' => 0, 'score' => $score, 'action' => $action, 'detail_id' => $detail_id, 'create_time' => time());
     return DB::Insert('credit', $u);
 }
Esempio n. 10
0
function expense_voucher_detail($voucher_id, $voucher_paid_from_account, $expense_type, $expense_detail, $expense_ammount, $expense_attachment)
{
    $now = getDateTime(0, 'mySQL');
    $insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'voucher_expense_detail', array('voucher_id' => $voucher_id, 'expense_account_id' => $voucher_paid_from_account, 'expense_type' => $expense_type, 'expense_description' => $expense_detail, 'expense_amount' => $expense_ammount, 'has_attachment' => $expense_attachment, 'created_by' => $_SESSION['user_name'], 'created_on' => $now, 'voucher_detail_status' => 'Draft'));
    $voucher_detail_id = DB::insertId();
    if ($voucher_detail_id) {
        return $voucher_detail_id;
        return $voucher_id;
    } else {
        return 0;
    }
}
Esempio n. 11
0
 public static function CreateFromStore($user_id = 0, $money = 0)
 {
     $money = abs(intval($money));
     if ($money <= 0 || $user_id <= 0) {
         return;
     }
     //update user money;
     $user = Table::Fetch('user', $user_id);
     Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}")));
     $u = array('user_id' => $user_id, 'money' => $money, 'direction' => 'income', 'action' => 'store', 'detail_id' => 0, 'create_time' => time());
     return DB::Insert('flow', $u);
 }
Esempio n. 12
0
 public static function PayCardCreate($query)
 {
     $need = $query['quantity'];
     while (true) {
         $id = Utility::GenSecret(16, Utility::CHAR_NUM);
         $paycard = array('id' => $id, 'value' => $query['money'], 'consume' => 'N', 'expire_time' => $query['expire_time']);
         $need -= DB::Insert('paycard', $paycard) ? 1 : 0;
         if ($need <= 0) {
             return true;
         }
     }
     return true;
 }
Esempio n. 13
0
 public static function CardCreate($query)
 {
     $need = $query['quantity'];
     while (true) {
         $id = Utility::GenSecret(16, Utility::CHAR_NUM);
         $card = array('id' => $id, 'code' => $query['code'], 'partner_id' => $query['partner_id'], 'credit' => $query['money'], 'consume' => 'N', 'begin_time' => $query['begin_time'], 'end_time' => $query['end_time']);
         $need -= DB::Insert('card', $card) ? 1 : 0;
         if ($need <= 0) {
             return true;
         }
     }
     return true;
 }
Esempio n. 14
0
 public static function Create($ruser, $newuser)
 {
     if ($ruser['id'] == $newuser['id']) {
         return;
     }
     cookieset('_rid', null, -1);
     if ($newuser['newbie'] == 'N') {
         return;
     }
     $have = Table::Fetch('invite', $newuser['id'], 'other_user_id');
     cookieset('_rid', null, -1);
     if ($have) {
         return false;
     }
     $invite = array('user_id' => $ruser['id'], 'user_ip' => $ruser['ip'], 'other_user_id' => $newuser['id'], 'other_user_ip' => $newuser['ip'], 'create_time' => time());
     return DB::Insert('invite', $invite);
 }
Esempio n. 15
0
 public static function Create($user_row)
 {
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['create_time'] = $user_row['login_time'] = time();
     $user_row['ip'] = Utility::GetRemoteIp();
     $user_row['secret'] = md5(Utility::GenSecret(12));
     $user_row['id'] = DB::Insert('user', $user_row);
     if ($_COOKIE['_rid']) {
         $r_user = Table::Fetch('user', $_COOKIE['_rid']);
         if ($r_user) {
             ZInvite::Create($r_user, $user_row);
         }
     }
     if ($user_row['id'] == 1) {
         Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
     }
     return $user_row['id'];
 }
Esempio n. 16
0
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     $partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('coupon', $ccon);
     while ($count < $order['quantity']) {
         $id = Utility::GenSecret(8, Utility::CHAR_NUM);
         $cv = Table::Fetch('coupon', $id);
         if ($cv) {
             continue;
         }
         $coupon = array('id' => $id, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(6, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time());
         DB::Insert('coupon', $coupon);
         sms_coupon($coupon);
         $count = Table::Count('coupon', $ccon);
     }
 }
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     //$partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('code', $ccon);
     require dirname(dirname(dirname(__FILE__))) . "/zhongyu/Zhongyu.class.php";
     $zhongyu = new Zhongyu();
     while ($count < $order['quantity']) {
         $id = date('YmdHis', time()) . rand(100000, 999999);
         $id = Utility::VerifyCode($id);
         $cv = Table::Fetch('code', $id);
         if ($cv) {
             continue;
         }
         /* 这里请求第三方发码接口 */
         if ('zhongyu' == $team['codeform']) {
             //判断为中娱发码方式
             $codeform = 'zhongyu';
             $info = array('req_seq' => $id, 'serv_code' => $team['serv_code'], 'phone_rece' => $order['mobile'], 'notes' => '');
             $result = $zhongyu->send($info);
             //print_r($result);exit;
             $doc = new DOMDocument();
             $doc->loadXML($result);
             $response_id = $doc->getElementsByTagName("id")->item(0)->nodeValue;
             if ('0000' == $response_id) {
                 //成功
                 $sys_seq = $doc->getElementsByTagName("order_num")->item(0)->nodeValue;
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 1;
             } else {
                 //失败
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 0;
             }
         }
         $code = array('id' => $id, 'sys_seq' => $sys_seq, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'city_id' => $team['city_id'], 'order_id' => $order['id'], 'team_id' => $order['team_id'], 'expire_time' => $team['expire_time'], 'create_time' => time(), 'msg' => $msg, 'mms' => $mms, 'codeform' => $codeform);
         if (DB::Insert('code', $code)) {
             //sms_coupon($coupon);
             $count = Table::Count('code', $ccon);
         }
     }
 }
Esempio n. 18
0
 public static function Create($user_row, $uc = true)
 {
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['create_time'] = $user_row['login_time'] = time();
     $user_row['ip'] = Utility::GetRemoteIp();
     $user_row['secret'] = md5(rand(1000000, 9999999) . time() . $user_row['email']);
     $user_row['id'] = DB::Insert('user', $user_row);
     $_rid = abs(intval(cookieget('_rid')));
     if ($_rid) {
         $r_user = Table::Fetch('user', $_rid);
         if ($r_user) {
             ZInvite::Create($r_user, $user_row);
         }
     }
     if ($user_row['id'] == 1) {
         Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
     }
     return $user_row['id'];
 }
Esempio n. 19
0
 public static function Create($order)
 {
     if ($order['state'] == 'unpay') {
         return;
     }
     $team = Table::Fetch('team', $order['team_id']);
     $partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('coupon', $ccon);
     while ($count < $order['quantity']) {
         $id = Utility::GenSecret(12, Utility::CHAR_NUM);
         $cv = Table::Fetch('coupon', $id);
         $coupon = array('id' => Utility::GenSecret(12, Utility::CHAR_NUM), 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(8, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time());
         DB::Insert('coupon', $coupon);
         $count = Table::Count('coupon', $ccon);
         $user = Table::Fetch('user', $order['user_id']);
         mail_coupon($team, $partner, $order, $user, $coupon);
     }
 }
Esempio n. 20
0
 public function create($condition, $duplicateCondition = null, $actorType = 0, $actorID = 0)
 {
     $table = $this->tableName;
     if (!$table) {
         $this->error = 'Table name is null';
         return false;
     }
     if ($this->hasCreateTime) {
         $condition['create_time'] = $condition['create_time'] ? $condition['create_time'] : time();
     }
     if ($this->hasUpdateTime) {
         $condition['update_time'] = $condition['update_time'] ? $condition['update_time'] : time();
     }
     $insertID = DB::Insert($table, $condition, $duplicateCondition, $this->writeDB);
     if (!$insertID) {
         $this->error = DB::$error;
     }
     $this->log($insertID, '', $condition, DB_Log::TYPE_CREATE, $actorType, $actorID);
     return $insertID;
 }
Esempio n. 21
0
 public function log($tableName, $tableID, $oldData, $updateData, $type, $actorType, $actorID)
 {
     if (!$tableName || !$tableID) {
         return false;
     }
     $log = array('create_time' => time(), 'table_name' => $tableName, 'table_id' => $tableID, 'type' => $type, 'actor_id' => $actorID, 'actor_type' => $actorType);
     $oldData = $oldData ? $oldData : array();
     $updateData = $updateData ? $updateData : array();
     foreach ($updateData as $index => $one) {
         if (isset($oldData[$index]) && $one == $oldData[$index]) {
             unset($updateData[$index]);
             unset($oldData[$index]);
         }
     }
     foreach ($oldData as $index => $one) {
         if (!isset($updateData[$index])) {
             unset($oldData[$index]);
         }
     }
     if (!$oldData && !$updateData) {
         return false;
     }
     $oldData = $oldData ? http_build_query($oldData) : '';
     $updateData = $updateData ? http_build_query($updateData) : '';
     switch ($type) {
         case self::TYPE_CREATE:
             $log['update_data'] = $updateData;
             break;
         case self::TYPE_DELLETE:
             $log['old_data'] = '';
             $log['update_data'] = '';
             break;
         case self::TYPE_UPDATE:
             $log['old_data'] = $oldData;
             $log['update_data'] = $updateData;
             break;
     }
     $id = DB::Insert($this->logTable, $log);
     return $id;
 }
Esempio n. 22
0
function add_coa($account_code, $account_group, $account_desc_short, $account_desc_long, $parent_account_id, $account_type)
{
    $consolidate_only = 0;
    $activity_account = 0;
    $has_parent = 0;
    $has_children = 0;
    $coa_level = 1;
    $code_exists = 0;
    $desc_exists = 0;
    if ($parent_account_id != 0) {
        $has_parent = 1;
    }
    if ($has_parent == 1) {
        $coa_level = get_account_level($parent_account_id) + 1;
    }
    if ($account_type == "consolidate_only") {
        $consolidate_only = 1;
    }
    if ($account_type == "activity_account") {
        $activity_account = 1;
    }
    if (account_code_exists($account_code)) {
        $code_exists = 1;
    }
    //check if account desc already exists
    if (account_desc_exists($account_desc_short)) {
        $desc_exists = 1;
    }
    if ($code_exists != 1 and $desc_exists != 1) {
        $insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'coa', array('account_code' => $account_code, 'account_group' => $account_group, 'account_desc_short' => $account_desc_short, 'account_desc_long' => $account_desc_long, 'activity_account' => $activity_account, 'consolidate_only' => $consolidate_only, 'has_parent' => $has_parent, 'coa_level' => $coa_level, 'has_children' => $has_children, 'parent_account_id' => $parent_account_id, 'last_modified_by' => $_SESSION['user_name'], 'last_modified_on' => getDateTime(date('now'), "mySQL"), 'created_by' => $_SESSION['user_name'], 'created_on' => getDateTime(date('now'), "mySQL"), 'account_status' => 'Active'));
        $new_coa_id = DB::insertId();
        if ($new_coa_id > 0 and $has_parent == 1) {
            DB::update(DB_PREFIX . $_SESSION['co_prefix'] . 'coa', array('has_children' => 1), "account_id=%s", $parent_account_id);
        }
        return $new_coa_id;
    } else {
        return "0";
    }
}
Esempio n. 23
0
	static public function Create($order) {
		$team = Table::Fetch('team', $order['team_id']);
		$partner = Table::Fetch('partner', $order['partner_id']);
		$ccon = array('order_id' => $order['id']);
		$count = Table::Count('coupon', $ccon);
		while($count<$order['quantity']) {
			/* 配合400验证,ID统一修改为12位伪随机数字,密码为6位数字 */
			$id = (ceil(time()/100)+rand(10000000,20000000));
			$id = Utility::VerifyCode($id);
			$cv = Table::Fetch('coupon', $id);
			if ($cv) continue;
            $coupon = array(
					'id' => $id,
					'user_id' => $order['user_id'],
					'buy_id' => $order['buy_id'],
					'partner_id' => $team['partner_id'],
					'order_id' => $order['id'],
					'credit' => $team['credit'],
					'team_id' => $order['team_id'],
					'secret' => Utility::VerifyCode(Utility::GenSecret(6, Utility::CHAR_NUM)),
					'expire_time' => $team['expire_time'],
					'create_time' => time(),
					);
			DB::Insert('coupon', $coupon);
			$count = Table::Count('coupon', $ccon);
			
			//send_goods_confirm_by_platform
			/**
			if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) {
				alipay_send_goods($order['trade_no']);		
			}
			*/
			
		}
		sms_all_coupon($order);
	}
Esempio n. 24
0
 public static function Address($user_id, $address)
 {
     if (!$user_id || !is_array($address)) {
         return false;
     }
     $count = Table::Count('address', array('user_id' => $user_id));
     $default = $count == 0 ? 'Y' : 'N';
     if ($count > 10) {
         return false;
     }
     $add = array('user_id' => $user_id, 'province' => $address['province'], 'area' => $address['area'], 'city' => $address['city'], 'street' => $address['street'], 'zipcode' => $address['zipcode'], 'name' => $address['name'], 'mobile' => $address['mobile'], 'default' => $default, 'create_time' => time());
     return DB::Insert('address', $add);
 }
Esempio n. 25
0
File: auth.php Progetto: noikiy/mdwp
else if($action == 'resource'){
	$role_id = $_GET['id'];
	$role = Table::Fetch('rbac_auth_role',$role_id);

	if($_POST){
		$resource = $_POST['resource'];

		//	delete old
		DB::Delete('rbac_role_resource',array('role_id'=>$role_id));

		foreach($resource as $v){
			$arr = array(
				'role_id'=>$role_id,
				'item_id'=>$v
			);
			DB::Insert('rbac_role_resource',$arr);
		}

		Session::Set('notice', '配置角色权限成功');	
		redirect( WEB_ROOT . "/manage/user/auth.php?action=resource&id=".$role_id);
	}

	$items = DB::LimitQuery('rbac_auth_items');

	$relation = DB::LimitQuery('rbac_role_resource',array(
		'condition'=>array('role_id'=>$role_id)
	));
	foreach($relation as $r){
		$format_relation[] = $r['item_id'];
	}
Esempio n. 26
0
<?php
/**
 * 异步处理
 * @author abei<*****@*****.**>
 */
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');
import('qalipay');
$alipayNotify = new QAlipayNotify($INI['qalipay']);
$verify_result = $alipayNotify->verifyNotify();

if($verify_result) {
	//$notify_data = $alipayNotify->decrypt($_POST['notify_data']);
	$doc = new DOMDocument();
	$doc->loadXML($_POST['notify_data']);
	
	if( ! empty($doc->getElementsByTagName( "notify" )->item(0)->nodeValue) ) {
		//商户订单号
		$out_trade_no = $doc->getElementsByTagName( "out_trade_no" )->item(0)->nodeValue;
		//支付宝交易号
		$trade_no = $doc->getElementsByTagName( "trade_no" )->item(0)->nodeValue;
		//交易状态
		$trade_status = $doc->getElementsByTagName( "trade_status" )->item(0)->nodeValue;
		$total_fee = $doc->getElementsByTagName( "total_fee" )->item(0)->nodeValue;
		DB::Insert('alipay_log',array('value'=>$total_fee.$out_trade_no.$trade_no.$trade_status));	
		if($trade_status == 'TRADE_FINISHED') {
			@list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4);
			if (Table::Fetch('pay', $out_trade_no)) die('success');
			$currency = 'CNY';
			$service = 'alipay';
			$bank = '支付宝';
			$order = Table::Fetch('order',$order_id);
Esempio n. 27
0
File: buy.php Progetto: noikiy/mdwp
	$insert = array(
			'user_id', 'team_id', 'city_id', 'state','express_id', 
			'fare', 'express', 'origin', 'price',
			'address', 'zipcode', 'realname', 'mobile', 'quantity',
			'create_time', 'remark','is_mobile'
		);
	
	if ($flag = $table->update($insert)) {
		$order_id = abs(intval($table->id));

		/* 插入订单来源 */
		$data['order_id'] = $order_id;
		$data['user_id'] = $login_user_id;
		$data['referer'] = $_COOKIE['referer'];
		$data['create_time'] = time();
		DB::Insert('referer', $data);

		redirect("check.php?id={$order_id}");
	}
}

//each user per day per buy
if (!$order) { 
	$order = json_decode(Session::Get('loginpagepost'),true);
	settype($order, 'array');
	if ($order['mobile']) $login_user['mobile'] = $order['mobile'];
	if ($order['zipcode']) $login_user['zipcode'] = $order['zipcode'];
	if ($order['address']) $login_user['address'] = $order['address'];
	if ($order['realname']) $login_user['realname'] = $order['realname'];
	$order['quantity'] = 1;
}
Esempio n. 28
0
<?php
/**
 * 新增一个员工
 * @author abei <*****@*****.**> 
 */
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');

need_manager();
need_auth('worker');

if($_POST){
	$worker = $_POST['worker'];
	$worker['create_time'] = time();
	$worker['birth'] = !empty($worker['birth']) ? strtotime($worker['birth']) : NULL;
	$worker['in_time'] = !empty($worker['in_time']) ? strtotime($worker['in_time']) : NULL;

	if($worker_id = DB::Insert('worker',$worker)){
		log_admin('worker', '新建员工成功',$worker);
		Session::Set('notice', '新建员工成功');
		redirect( WEB_ROOT . "/manage/worker/index.php");
	}

}

include template('manage_worker_create');
?>
Esempio n. 29
0
$group_id = '';
if (isset($_POST['submit'])) {
    $group_code = $_POST['group_code'];
    $group_description = $_POST['group_description'];
    $balance_sheet_side = $_POST['balance_sheet_side'];
    $pls_side = $_POST['pls_side'];
    $group_status = $_POST['group_status'];
    $account_type = $_POST['account_type'];
    if ($account_type == 'balance_sheet') {
        $insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'coa_groups', array('group_code' => $group_code, 'group_description' => $group_description, 'balance_sheet_group' => 1, 'balance_sheet_side' => $balance_sheet_side, 'pls_group' => '', 'pls_side' => '', 'statistics_only' => 0, 'group_status' => $group_status));
    } else {
        if ($account_type == 'pls_group') {
            $insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'coa_groups', array('group_code' => $group_code, 'group_description' => $group_description, 'balance_sheet_group' => '', 'balance_sheet_side' => '', 'pls_group' => $pls_group, 'pls_side' => $pls_side, 'statistics_only' => 0, 'group_status' => $group_status));
        } else {
            $insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'coa_groups', array('group_code' => $group_code, 'group_description' => $group_description, 'balance_sheet_group' => '', 'balance_sheet_side' => '', 'pls_group' => '', 'pls_side' => '', 'statistics_only' => 1, 'group_status' => $group_status));
        }
    }
}
?>
    
	
	<section class="content-header">
          <h1>
           Add Chart of Account Group
           
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-book"></i></a>General Ledger</li>
            <li><a href="#">Chart of Account Group</a></li>
            <li class="active">Add new Account Group</li>
Esempio n. 30
0
 public function Update()
 {
     //echo "table update*****"; debug by kong insert order
     $fields = func_get_args();
     if (empty($fields)) {
         return true;
     }
     if (is_array($fields[0])) {
         $fields = $fields[0];
     }
     $up_array = array();
     foreach ($fields as $f) {
         if (array_key_exists($f, $this->column_values)) {
             $up_array[$f] = $this->BuildDBValue($this->column_values[$f], $f);
         }
     }
     if (empty($up_array)) {
         return true;
     }
     if ($this->pk_value) {
         return self::UpdateCache($this->table_name, $this->pk_value, $up_array);
     } else {
         return $this->pk_value = $this->id = DB::Insert($this->table_name, $up_array);
     }
 }