public function dcontract() { $id = intval($_REQUEST['id']); if ($id == 0) { showErr("操作失败!"); } $deal = get_deal($id); if (!$deal) { showErr("操作失败!"); } $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC"); if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) { showErr("操作失败!"); } $GLOBALS['tmpl']->assign('deal', $deal); $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC"); foreach ($loan_list as $k => $v) { $vv_deal['borrow_amount'] = $v['money']; $vv_deal['rate'] = $deal['rate']; $vv_deal['repay_time'] = $deal['repay_time']; $vv_deal['loantype'] = $deal['loantype']; $vv_deal['repay_time_type'] = $deal['repay_time_type']; $deal_rs = deal_repay_money($vv_deal); $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money']; if (is_last_repay($deal['loantype'])) { $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money']; } } $GLOBALS['tmpl']->assign('loan_list', $loan_list); $u_info = get_user("*", $deal['user_id']); $GLOBALS['tmpl']->assign('user_info', $u_info); if ($u_info['sealpassed'] == 1) { $credit_file = get_user_credit_file($deal['user_id']); $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]); } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); /*header("Content-type:text/html;charset=utf-8"); header("Content-Disposition: attachment; filename=借款协议.html"); echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo '<html>'; echo '<head>'; echo '<title>借款协议</title>'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<meta http-equiv="X-UA-Compatible" content="IE=7" />'; echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html"); echo '</body>'; echo '</html>';*/ require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "借款协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html"); $word->save($wordname); }
if ((!$read_permission && !$write_permission && !$manage_permission) || $id_company === false) { audit_db($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation","Trying to access a contact without permission"); include ("general/noaccess.php"); exit; } } $new_contact = (bool) get_parameter ('new_contact'); $create_contact = (bool) get_parameter ('create_contact'); $update_contact = (bool) get_parameter ('update_contact'); $delete_contact = (bool) get_parameter ('delete_contact'); $get_contacts = (bool) get_parameter ('get_contacts'); $offset = get_parameter ('offset', 0); if ($get_contacts && $id) { $contract = get_contract ($id); $company = get_company ($contract['id']); $contacts = get_company_contacts ($company['id'], false); echo json_encode ($contacts); if (defined ('AJAX')) return; } // Create if ($create_contact) { if (!$id_company) { echo ui_print_error_message (__('Error creating contact. Company is empty'), '', true, 'h3', true); } else { if (!$write_permission && !$manage_permission) {
function fill_inventories_table($inventories, &$table) { global $config; $table->width = "99%"; foreach ($inventories as $inventory) { $data = array(); $id_group = get_inventory_group($inventory['id']); $has_permission = true; if (!give_acl($config['id_user'], $id_group, 'VR')) { $has_permission = false; } $contract = get_contract($inventory['id_contract']); $company = get_company($contract['id_company']); $data[0] = $inventory['name']; if ($has_permission) { $table->head[1] = __('Company'); $table->head[2] = __('Contract'); if ($inventory['description']) { $data[0] .= ' ' . print_help_tip($inventory['description'], true, 'tip_info'); } $data[1] = $company['name']; $data[2] = $contract['name']; } if (give_acl($config['id_user'], $id_group, "VW")) { $table->head[4] = __('Edit'); $table->align[4] = 'center'; $data[4] = '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory_detail&check_inventory=1&id=' . $inventory['id'] . '">' . '<img src="images/wrench.png" /></a>'; } $table->head[5] = __('More info'); $data[5] = '<a href="javascript: openInventoryMoreInfo(' . $inventory['id'] . ');" id="show_info-' . $inventory["id"] . '">'; $data[5] .= print_image("images/information.png", true, array("title" => __('Show object type fields'))); $data[5] .= '</a> '; array_push($table->data, $data); } }
function send_transfer_contract_email($id, $transfer) { if ($id == 0 && !$transfer) { return false; } if (app_conf('MAIL_ON') == 0 || app_conf('MAIL_SEND_CONTRACT_ON') == 0) { return false; } if (!$transfer) { $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; /* $sql = 'SELECT dlt.id,dlt.deal_id,dlt.load_id,dlt.transfer_amount,dlt.near_repay_time,dlt.user_id,d.next_repay_time,d.last_repay_time,d.rate,d.repay_start_time,d.repay_time,dlt.load_money,dlt.id as dltid,dlt.status as tras_status,dlt.t_user_id,dlt.transfer_amount,dlt.create_time as tras_create_time,dlt.transfer_time,d.user_id as duser_id,d.tcontract_id FROM '.DB_PREFIX.'deal_load dl LEFT JOIN '.DB_PREFIX.'deal d ON d.id = dl.deal_id '.$union_sql.' WHERE 1=1 '.$condition; $transfer = $GLOBALS['db']->getRow($sql);*/ require_once APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); } if ($transfer) { /* //下个还款日 $transfer['next_repay_time_format'] = to_date($transfer['near_repay_time'],"Y 年 m 月 d 日"); $transfer['near_repay_time_format'] = to_date(next_replay_month($transfer['near_repay_time']," -1 "),"Y 年 m 月 d 日"); //什么时候开始借 $transfer['repay_start_time_format'] = to_date($transfer['repay_start_time'],"Y 年 m 月 d 日"); //还款日 $transfer['final_repay_time'] = next_replay_month($transfer['repay_start_time'],$transfer['repay_time']); $transfer['final_repay_time_format'] = to_date($transfer['final_repay_time'],"Y 年 m 月 d 日"); //剩余期数 $transfer['how_much_month'] = how_much_month($transfer['near_repay_time'],$transfer['final_repay_time']) +1; $transfer_rs = deal_transfer($transfer); //本息还款金额 $transfer['month_repay_money'] = $transfer_rs['month_repay_money']; //剩余多少钱未回 $transfer['all_must_repay_money'] = $transfer_rs['all_must_repay_money']; //剩余多少本金未回 $transfer['left_benjin'] = $transfer_rs['left_benjin']; $transfer['month_repay_money_format'] = format_price($transfer['month_repay_money']); $transfer['all_must_repay_money_format'] = format_price($transfer['all_must_repay_money']); $transfer['left_benjin_format'] = format_price($transfer['left_benjin']); //剩多少利息 $transfer['left_lixi'] = $transfer['all_must_repay_money'] - $transfer['left_benjin']; $transfer['left_lixi_format'] = format_price($transfer['left_lixi']); //投标价格 $transfer['load_money_format'] = format_price($transfer['load_money']); //转让价格 $transfer['transfer_amount_format'] = format_price($transfer['transfer_amount']); //转让管理费 $transfer['transfer_fee_format'] = format_price($transfer['transfer_amount']*(float)app_conf("USER_LOAD_TRANSFER_FEE")); //转让收益 $transfer['transfer_income_format'] = format_price($transfer['all_must_repay_money']-$transfer['transfer_amount']); if($transfer['tras_create_time'] !=""){ $transfer['tras_create_time_format'] = to_date($transfer['tras_create_time'],"Y 年 m 月 d 日"); } $transfer['transfer_time_format'] = to_date($transfer['transfer_time'],"Y 年 m 月 d 日"); $transfer['user'] = get_user("user_name,email,real_name,idno,level_id",$transfer['user_id']); $transfer['tuser'] = get_user("user_name,email,real_name,idno,level_id",$transfer['t_user_id']); $transfer['duser'] = get_user("user_name,email,real_name,idno,level_id",$transfer['duser_id']); $GLOBALS['tmpl']->assign('transfer',$transfer); */ $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $msg_data['dest'] = $transfer['user']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = "债权“Z-" . $transfer['load_id'] . "”的电子协议!"; $msg_data['content'] = addslashes($contract); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = TIME_UTC; $msg_data['user_id'] = $transfer['user_id']; $msg_data['is_html'] = 1; //发送给转让者 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //发送给承接者 $msg_data['dest'] = $transfer['tuser']['email']; $msg_data['user_id'] = $transfer['t_user_id']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); } }
public function contact() { $id = intval($_REQUEST['id']); if ($id == 0) { echo "不存在的债权"; die; } //先执行更新借贷信息 $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } else { syn_deal_status($deal_id); } $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; /*$sql = 'SELECT dlt.id,dlt.deal_id,dlt.load_id,dlt.transfer_amount,dlt.near_repay_time,dlt.user_id,d.next_repay_time,d.last_repay_time,d.rate,d.repay_start_time,d.repay_time,dlt.load_money,dlt.id as dltid,dlt.status as tras_status,dlt.t_user_id,dlt.transfer_amount,dlt.create_time as tras_create_time,dlt.transfer_time,d.user_id as duser_id FROM '.DB_PREFIX.'deal_load dl LEFT JOIN '.DB_PREFIX.'deal d ON d.id = dl.deal_id '.$union_sql.' WHERE 1=1 '.$condition; $transfer = $GLOBALS['db']->getRow($sql);*/ require APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); if ($transfer) { /*//下个还款日 $transfer['next_repay_time_format'] = to_date($transfer['near_repay_time'],"Y 年 m 月 d 日"); $transfer['near_repay_time_format'] = to_date(next_replay_month($transfer['near_repay_time']," -1 "),"Y 年 m 月 d 日"); //什么时候开始借 $transfer['repay_start_time_format'] = to_date($transfer['repay_start_time'],"Y 年 m 月 d 日"); //还款日 $transfer['final_repay_time'] = next_replay_month($transfer['repay_start_time'],$transfer['repay_time']); $transfer['final_repay_time_format'] = to_date($transfer['final_repay_time'],"Y 年 m 月 d 日"); //剩余期数 $transfer['how_much_month'] = how_much_month($transfer['near_repay_time'],$transfer['final_repay_time']) +1; //本息还款金额 $transfer['month_repay_money'] = pl_it_formula($transfer['load_money'],$transfer['rate']/12/100,$transfer['repay_time']); $transfer['month_repay_money_format'] = format_price($transfer['month_repay_money']); //剩余多少钱未回 $transfer['all_must_repay_money'] = $transfer['month_repay_money'] * $transfer['how_much_month']; $transfer['all_must_repay_money_format'] = format_price($transfer['all_must_repay_money']); //剩余多少本金未回 $transfer['left_benjin'] = get_benjin($transfer['repay_time']-$transfer['how_much_month']-1,$transfer['repay_time'],$transfer['load_money'],$transfer['month_repay_money'],$transfer['rate']); $transfer['left_benjin_format'] = format_price($transfer['left_benjin']); //剩多少利息 $transfer['left_lixi'] = $transfer['all_must_repay_money'] - $transfer['left_benjin']; $transfer['left_lixi_format'] = format_price($transfer['left_lixi']); //投标价格 $transfer['load_money_format'] = format_price($transfer['load_money']); //转让价格 $transfer['transfer_amount_format'] = format_price($transfer['transfer_amount']); //转让管理费 $transfer_fee = $transfer['transfer_amount']*(float)app_conf("USER_LOAD_TRANSFER_FEE"); if($transfer_fee!=0) $transfer_fee = $transfer_fee / 100; $transfer['transfer_fee_format'] = format_price($transfer_fee); //转让收益 $transfer['transfer_income_format'] = format_price($transfer['all_must_repay_money']-$transfer['transfer_amount']); if($transfer['tras_create_time'] !=""){ $transfer['tras_create_time_format'] = to_date($transfer['tras_create_time'],"Y 年 m 月 d 日"); } $transfer['transfer_time_format'] = to_date($transfer['transfer_time'],"Y 年 m 月 d 日"); $transfer['user'] = get_user("user_name,real_name,idno,level_id",$transfer['user_id']); $transfer['tuser'] = get_user("user_name,real_name,idno,level_id",$transfer['t_user_id']); $transfer['duser'] = get_user("user_name,real_name,idno,level_id",$transfer['duser_id']);*/ $GLOBALS['tmpl']->assign('transfer', $transfer); } else { echo "不存在的债权"; die; } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); $GLOBALS['tmpl']->display("inc/uc/transfer_contact.html"); }
function dtcontact() { $win = 1; $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TT_CONTACT'] . ' - ' . $GLOBALS['lang']['TOOLS']); $id = intval($_REQUEST['id']); if ($id > 0) { //先执行更新借贷信息 $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } else { syn_deal_status($deal_id); } $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; require APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); if ($transfer) { $GLOBALS['tmpl']->assign('transfer', $transfer); } else { echo "不存在的债权"; die; } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); } require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "债权转让及受让协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/tool/tcontact.html"); $word->save($wordname); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $id = intval($GLOBALS['request']['id']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/uc.php'; require APP_ROOT_PATH . 'app/Lib/deal.php'; // require_once APP_ROOT_PATH.'system/common.php'; $root['user_login_status'] = 1; $root['response_code'] = 1; if ($id == 0) { showErr("操作失败!"); } $deal = get_deal($id); if (!$deal) { showErr("操作失败!"); } $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC"); if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) { showErr("操作失败!"); } //$root['deal'] = $deal; $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC"); foreach ($loan_list as $k => $v) { $vv_deal['borrow_amount'] = $v['money']; $vv_deal['rate'] = $deal['rate']; $vv_deal['repay_time'] = $deal['repay_time']; $vv_deal['loantype'] = $deal['loantype']; $vv_deal['repay_time_type'] = $deal['repay_time_type']; $deal_rs = deal_repay_money($vv_deal); $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money']; if (is_last_repay($deal['loantype'])) { $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money']; } } //$root['loan_list'] = $loan_list; $u_info = get_user("*", $deal['user_id']); //$root['user_info'] = $u_info; if ($u_info['sealpassed'] == 1) { $credit_file = get_user_credit_file($deal['user_id']); //$GLOBALS['tmpl']->assign('user_seal_url',$credit_file['credit_seal']['file_list'][0]); $root['user_seal_url'] = $credit_file['credit_seal']['file_list'][0]; } // $GLOBALS['tmpl']->assign('SITE_URL',str_replace(array("https://","http://"),"",SITE_DOMAIN)); // $GLOBALS['tmpl']->assign('SITE_TITLE',app_conf("SITE_TITLE")); // $GLOBALS['tmpl']->assign('CURRENCY_UNIT',app_conf("CURRENCY_UNIT")); // $root['SITE_URL'] = str_replace(array("https://","http://"),"",SITE_DOMAIN); // $root['SITE_TITLE'] = app_conf("SITE_TITLE"); // $root['CURRENCY_UNIT'] = app_conf("CURRENCY_UNIT"); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id'])); $root['contract'] = $contract; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }