public function log()
 {
     if (I('type') == 'excel') {
         $field = 'target.uid,target.uname,target.introducer_uid,target.introducer_uname,target.created,target.reg_ip,target.mobile,i.university_name,i.campus_name,target.channel,target.device_code,m.area,m.type';
         $model = M()->table('zj_user target')->join('zj_user_info i on i.uid=target.uid')->join('left join zj_common_mobile m on m.number=left(target.mobile,7)');
         $list = $model->where('introducer_uid>0')->field($field)->order('target.uid DESC')->select();
         foreach ($list as $key => $vo) {
             $list[$key]['created'] = date('Y-m-d', $vo['created']);
         }
         csv('推荐注册人', $list, ['推荐人编号' => 'introducer_uid', '推荐人名称' => 'introducer_uname', '注册日期' => 'created', '用户编号' => 'uid', '用户名' => 'uname', '手机号' => 'mobile', '所属大学' => 'university_name', '来源渠道' => 'channel']);
     }
     $where = [];
     $code = I('code');
     if ($code) {
         $where['s.introducer_code'] = $code;
     }
     $this->meta_title = '推荐记录';
     $model = M()->table('zj_user target')->join('zj_user_info i on i.uid=target.uid');
     $model->join('left join zj_common_mobile m on m.number=left(target.mobile,7)');
     $model->join('zj_user_source s on s.uid=target.uid');
     $list = $this->lists($model, $where, 'target.created desc', 'target.uid,target.uname,target.created,target.reg_ip,target.mobile,i.university_name,i.campus_name,s.*,m.area,m.type');
     $Ip = new \Org\Net\IpLocation('UTFWry.dat');
     foreach ($list as &$vo) {
         $vo['location'] = $Ip->getlocation(long2ip($vo['reg_ip']));
     }
     $this->assign('_list', $list);
     $this->display();
 }
 public function _order_excel()
 {
     $where = $this->_getWhere();
     $model = M()->table('zj_loan_order o')->join('zj_university_campus c on  c.id=o.campus_id', 'left');
     $model->join('zj_loan_order_finance f on f.order_id=o.id');
     $model->field('c.university_name,o.created,realname,loan_money,month,month_total,last_bill_issue');
     $list = $model->where($where)->order('o.id')->select();
     $title = ['序号' => 'pos', '姓名' => 'realname', '学校' => 'university_name', '借款金额' => 'loan_money', '借款期限' => 'return_day_range', '分期期数' => 'month', '已还期数' => 'have_pay_month', '未还期数' => 'remain_month', '每月偿还金额' => 'month_total'];
     $start = date('2015-04');
     $end = date('Y-m', strtotime('+24 month'));
     for ($i = $start; $i <= $end; $i = date('Y-m', strtotime('+1 month', strtotime($i)))) {
         $title[date('y.n', strtotime($i)) . '月偿还金额'] = $i;
     }
     foreach ($list as $key => $vo) {
         $have_pay_month = $vo['last_bill_issue'] > 0 ? $vo['last_bill_issue'] - 1 : $vo['month'];
         $list[$key]['pos'] = $key + 1;
         $list[$key]['return_day_range'] = date('Y.m.d', $vo['created']) . ' - ' . date('Y.m.', strtotime('+' . $vo['month'] . ' month', $vo['created'])) . date('d', $vo['created']);
         $list[$key]['have_pay_month'] = $have_pay_month;
         $list[$key]['remain_month'] = $vo['month'] - $have_pay_month;
         for ($i = $start; $i <= $end; $i = date('Y-m', strtotime('+1 month', strtotime($i)))) {
             $start_month = date('Y-m', strtotime('+1 month', $vo['created']));
             $end_month = date('Y-m', strtotime('+' . $vo['month'] . ' month', $vo['created']));
             $in_repay = $i >= $start_month && $i <= $end_month;
             $list[$key][$i] = $in_repay ? $vo['month_total'] : 0;
         }
     }
     csv('分期还款_' . $this->type_text, $list, $title);
 }
 protected function _money_excel($model, $where)
 {
     $fields = 'm.*,o.type order_type,o.title,o.realname,o.seller_name,o.first_money,f.payee_account';
     $list = $model->where($where)->order('o.id')->field($fields)->select();
     int_to_string($list, $this->_field_text_map);
     foreach ($list as $key => $vo) {
         $list[$key]['created'] = date('Y-m-d H:i:s', $vo['created']);
     }
     csv('资金记录', $list, ['编号' => 'id', '时间' => 'created', '学生姓名' => 'realname', '收款账号' => 'payee_account', '订单类型' => 'order_type_text', '交易类型' => 'type_text', '金额' => 'money', '首付款' => 'first_money', '订单号' => 'order_id', '标题' => 'title']);
 }
Example #4
0
function csv_data($data, $fields)
{
    foreach ($data as $line) {
        $set = array();
        // create a set with the fields ordered properly.
        // i know php keeps keys in insert order, but I'm a paranoid perl programmer too.
        foreach ($fields as $f) {
            $set[] = $line[$f];
        }
        print csv($set);
    }
}
Example #5
0
 /**
  * @param $option 'first' or 'all'
  * @return when $option is 'first', then returns object or null.
  *			when $option is 'all', then returns array.
  */
 public function find($option = 'first')
 {
     $db = Context::get('db');
     // init query
     if (empty($this->query->select)) {
         $this->query->select = csv($this->get_select_column($this->query->joins));
     }
     /*
      if ($option == 'first') {
     $this->query->limit = 1;
     }
     */
     // get result
     $result = $db->select($this->query);
     // cleans up query object
     $this->query = new Query($this->tablename);
     // return result
     $result = $this->parse_result($result);
     if ($option == 'first') {
         return count($result) > 0 ? $result[0] : null;
     }
     return $result;
 }
Example #6
0
    unset($_POST['submit']);
    unset($_POST['task']);
    $fields = formquery($_POST);
    mysql_query("DELETE FROM {$tbl} WHERE {$primary}=" . $_POST[$primary]);
    echo '<div class="noti"><ul class="fa-ul"><li><i class="fa fa-check fa-li"></i>Done deleting the data.</li></ul></div>';
}
/*SQL*/
if ($_SESSION['role'] != 1) {
    exit("hey your not allowed here");
}
if ($_GET['task'] == '') {
    include $_GET['pages'] . "/main.php";
}
if ($_GET['task'] == 'setclaim') {
    include $_GET['pages'] . "/main.php";
}
if ($_GET['task'] == 'csv') {
    csv();
}
if ($_GET['task'] == 'add') {
    echo "<a href='?pages=" . $_GET['pages'] . "'>Go back</a>";
    include $_GET['pages'] . "/add.php";
}
if ($_GET['task'] == 'edit') {
    echo "<a href='?pages=" . $_GET['pages'] . "'>Go back</a>";
    include $_GET['pages'] . "/edit.php";
}
if ($_GET['task'] == 'delete') {
    echo "<a href='?pages=" . $_GET['pages'] . "'>Go back</a>";
    include $_GET['pages'] . "/delete.php";
}
Example #7
0
function outputdatacsv($qid, $fid = "", $labels = false, $unverified = false, $return = false, $mergenamedfields = false)
{
    global $db;
    //first get data desc
    $sql = "SELECT b.bgid, bg.btid, count( b.bid ) as count,bg.width\n\t\tFROM boxes as b\n\t\tJOIN boxgroupstype as bg ON (b.bgid = bg.bgid)\n\t\tJOIN pages as p ON (p.pid = b.pid)\n\t\tWHERE p.qid = '{$qid}'\n\t\tAND bg.btid > 0\n\t\tGROUP BY b.bgid\n\t\tORDER BY bg.sortorder";
    $desc = $db->GetAssoc($sql);
    //get completed forms for this qid
    if ($unverified) {
        $sql = "SELECT 0 AS vid, f.fid as fid, f.qid as qid, f.description as description, f.rpc_id\n\t\t\tFROM forms as f\n\t\t\tWHERE f.qid = '{$qid}'";
    } else {
        $sql = "SELECT w.vid AS vid, w.fid AS fid, w.assigned AS assigned, w.completed AS completed, f.qid AS qid, f.description AS description, f.rpc_id\n\t\t\tFROM `worklog` AS w\n\t\t\tLEFT JOIN forms AS f ON w.fid = f.fid\n\t\t\tWHERE f.qid = '{$qid}'";
    }
    if ($fid != "") {
        $sql .= " AND f.fid = '{$fid}'";
    }
    $forms = $db->GetAll($sql);
    $unv = "";
    if ($unverified) {
        $unv = T_("unverified") . "_";
    }
    if (!$return) {
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Type: text/ascii");
        header("Content-Disposition: attachment; filename={$unv}data_{$qid}.csv");
    }
    $sql = "SELECT bg.varname, bg.btid, count(b.bid) as count\n\t\tFROM boxes as b\n\t\tJOIN boxgroupstype as bg ON (bg.bgid = b.bgid)\n\t\tJOIN pages as p ON (p.pid = b.pid)\n\t\tWHERE p.qid = '{$qid}'\n\t\tAND bg.btid > 0\n\t\tGROUP BY b.bgid\n\t\tORDER BY bg.sortorder";
    $varnames = $db->GetAll($sql);
    $rv = array();
    $prevarname = "@";
    foreach ($varnames as $vn) {
        if ($vn['btid'] == 2) {
            for ($i = 1; $i <= $vn['count']; $i++) {
                $rv[] = $vn['varname'] . "_{$i}";
            }
        } else {
            //don't add the variable name if we are merging and it matches the last varname
            if (!($mergenamedfields == true && $prevarname == $vn['varname'])) {
                $rv[] = $vn['varname'];
            }
            $prevarname = $vn['varname'];
        }
    }
    $rv[] = "formid";
    $rv[] = "rpc_id";
    //print the header row
    if (!$return) {
        print csv($rv);
    }
    $prevarname = "@";
    foreach ($forms as $form) {
        $sql = "SELECT bg.btid,f.val\n\t\t\tFROM boxes AS b\n\t\t\tJOIN boxgroupstype as bg ON (bg.bgid = b.bgid)\n\t\t\tJOIN pages as p ON (p.pid = b.pid)\n\t\t\tLEFT JOIN formboxverifychar AS f ON (f.vid = '{$form['vid']}' AND f.fid = '{$form['fid']}' AND f.bid = b.bid)\n\t\t\tWHERE p.qid = '{$qid}'\n\t\t\tAND bg.btid > 0\n\t\t\tORDER BY bg.sortorder, b.bid";
        $sql = "(select b.bid,b.bgid,g.btid,f.val,sortorder,b.value,b.label,g.varname\n\t\tfrom boxes as b, boxgroupstype as g, pages as p, formboxverifychar as f\n\t\twhere b.bgid = g.bgid\n\t\tand g.btid > 0\n\t\tand g.btid < 5\n\t\tand p.pid = b.pid\n\t\tand p.qid = '{$qid}'\n\t\tand f.bid = b.bid and f.vid = '{$form['vid']}' and f.fid = '{$form['fid']}')\n\t\tUNION\n\t\t(select b.bid,b.bgid,g.btid,f.val,sortorder,b.value,b.label,g.varname\n\t\tfrom boxes as b\n\t\tJOIN  boxgroupstype as g on (b.bgid = g.bgid and g.btid = 6)\n\t\tJOIN pages as p on  (p.pid = b.pid and p.qid = '{$qid}')\n\t\tLEFT JOIN formboxverifytext as f on (f.bid = b.bid and f.vid = '{$form['vid']}' and f.fid = '{$form['fid']}'))\n\t\tUNION\n\t\t(select b.bid,b.bgid,g.btid,f.val,sortorder,b.value,b.label,g.varname\n\t\tfrom boxes as b\n\t\tJOIN  boxgroupstype as g on (b.bgid = g.bgid and g.btid = 5)\n\t\tJOIN pages as p on  (p.pid = b.pid and p.qid = '{$qid}')\n\t\tLEFT JOIN formboxverifytext as f on (f.bid = b.bid and f.vid = 0 and f.fid = '{$form['fid']}'))\n\t\torder by sortorder asc,bid asc";
        $data = $db->GetAll($sql);
        $bgid = $data[0]['bgid'];
        $btid = "";
        $count = 1;
        $done = "";
        $rr = array();
        $tmpstr = "";
        $labelval = "";
        $valueval = "";
        $data[] = array('btid' => 0, 'bgid' => 0, 'val' => "", 'varname' => "");
        $prebtid = 0;
        $varlist = array();
        $varlistc = 0;
        //print_r($data);
        foreach ($data as $val) {
            $btid = $val['btid'];
            if ($bgid != $val['bgid']) {
                $varlist[] = $val['varname'];
                $varlistc++;
                if ($prebtid == 1 || $prebtid == 3 || $prebtid == 4) {
                    //multiple boxes -> down to one variable
                    if ($prebtid == 1) {
                        if ($done == 1) {
                            if ($labels) {
                                $rr[] = $labelval;
                            } else {
                                if (strlen(trim($valueval)) == 0) {
                                    $rr[] = $count;
                                } else {
                                    $rr[] = $valueval;
                                }
                            }
                        } else {
                            $rr[] = "";
                        }
                        //blank if no val entered
                    } else {
                        if ($mergenamedfields == true) {
                            if ($varlistc > 1 && $varlist[$varlistc - 2] == $varlist[$varlistc - 1]) {
                            } else {
                                $rr[] = trim($tmpstr);
                                $tmpstr = "";
                            }
                        } else {
                            $rr[] = trim($tmpstr);
                            $tmpstr = "";
                        }
                    }
                    $labelval = "";
                    $valueval = "";
                }
                if ($val['btid'] == 6 || $val['btid'] == 5) {
                    //one box per variable - just export
                    $rr[] = $val['val'];
                }
                $bgid = $val['bgid'];
                //reset counters
                $count = 1;
                $done = 0;
            } else {
                if ($val['btid'] == 6 || $val['btid'] == 5) {
                    //one box per variable - just export
                    $rr[] = $val['val'];
                }
            }
            if ($val['btid'] == 1) {
                if ($val['val'] == 1) {
                    $done = 1;
                    $labelval = $val['label'];
                    $valueval = $val['value'];
                }
                if ($done != 1) {
                    $count++;
                }
            } else {
                if ($val['btid'] == 3 || $val['btid'] == 4) {
                    if ($val['val'] == "") {
                        $tmpstr .= " ";
                    } else {
                        $tmpstr .= $val['val'];
                    }
                } else {
                    if ($val['btid'] == 2) {
                        if ($val['val'] == 1) {
                            if ($labels) {
                                $rr[] = $val['label'];
                            } else {
                                if ($val['value'] == "") {
                                    $rr[] = 1;
                                } else {
                                    $rr[] = $val['value'];
                                }
                            }
                        } else {
                            $rr[] = "";
                        }
                    }
                }
            }
            $prebtid = $val['btid'];
        }
        $rr[] = $form['fid'];
        //print str_pad($form['fid'], 10, " ", STR_PAD_LEFT);
        $rr[] = $form['rpc_id'];
        //print_r($rr);
        if (!$return) {
            print csv($rr);
        }
    }
    if ($return) {
        return array($rv, $rr);
    }
}
				}
				$sacoche_htm .= '</tbody></table>';
				$sacoche_csv .= "\r\n";
				$sacoche_pdf->cartouche_interligne(2);
			}
		}
	}
	// On archive le cartouche dans un fichier tableur zippé (csv tabulé)
	$zip = new ZipArchive();
	$result_open = $zip->open($dossier_export.$fnom_export.'_cartouche.zip', ZIPARCHIVE::CREATE);
	if($result_open!==TRUE)
	{
		require('./_inc/tableau_zip_error.php');
		exit('Problème de création de l\'archive ZIP ('.$result_open.$tab_zip_error[$result_open].') !');
	}
	$zip->addFromString($fnom_export.'_cartouche.csv',csv($sacoche_csv));
	$zip->close();
	// On archive le cartouche dans un fichier pdf
	$sacoche_pdf->Output($dossier_export.$fnom_export.'_cartouche.pdf','F');
	// Affichage
	exit($sacoche_htm);
}

//	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	Traiter une demande d'importation d'une saisie déportée ; on n'enregistre rien, on ne fait que décrypter le contenu du fichier et renvoyer une chaine résultante au javascript
//	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if( (isset($_GET['f_action'])) && ($_GET['f_action']=='importer_saisie_csv') )
{
	// Récupérer le contenu du fichier
	$tab_file = $_FILES['userfile'];
Example #9
0
 public static function id_condition($id)
 {
     if (!is_array($id)) {
         return " = {$id}";
     }
     if (empty($id)) {
         // always nothing
         return " = 1 AND 0 = 1";
     }
     return " IN (" . csv($id) . ')';
 }
Example #10
0
      * License
      */
 /***
  * License
  */
 case "license":
     include "license.mtree.php";
     break;
     /***
      * CSV Import/Export
      */
 /***
  * CSV Import/Export
  */
 case "csv":
     csv($option);
     break;
 case "csv_export":
     csv_export($option);
     break;
     /***
      * Upgrade routine
      */
 /***
  * Upgrade routine
  */
 case "upgrade":
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_mtree' . DS . 'upgrade.php';
     break;
     /***
      * Diagnosis
Example #11
0
function csv_array($array)
{
    $r = array();
    foreach ($array as $value) {
        $r[] = csv($value);
    }
    return implode(",", $r) . "\n";
}
 protected function _excel($where)
 {
     foreach ($where as $key => $val) {
         $where['o.' . str_replace('|', '|o.', $key)] = $val;
         unset($where[$key]);
     }
     $model = M()->table('zj_loan_order o')->join('zj_university_campus c on c.id=o.campus_id', 'left');
     $model->join('zj_user u on u.uid=o.salesman_uid', 'left');
     $model->join('zj_loan_user_contract uc on uc.uid=o.uid', 'left');
     $model->join('zj_loan_order_delivery d on d.order_id=o.id');
     $model->join('zj_loan_shop_goods g on g.id=o.goods_id', 'left');
     $model->join('zj_loan_shop_goods_seller s on s.goods_id=g.id', 'left');
     $field = 'o.id,o.created,c.city city_name,c.university_name,o.realname,o.mobile,o.status,o.source,o.goods_property';
     $field .= ',d.address,uc.id_card';
     $field .= ',o.title,o.type,money,loan_money,month,first_money,month_fee,o.seller_name,o.seller_telephone';
     $field .= ',u.mobile salesman_mobile,u.realname salesman_realname,c.name campus_name,g.pname,g.cname';
     $field .= ',s.name,s.contact';
     $data = $model->where($where)->field($field)->order('o.created')->select();
     foreach ($data as $key => $vo) {
         $data[$key]['created'] = date('Y-m-d H:i:s', $vo['created']);
     }
     int_to_string($data, ['status' => $this->_status, 'source' => ['', '网站', '客户端'], 'type' => $this->_type]);
     $field = ['订单号' => ['field' => 'id', 'width' => 17], '创建时间' => ['field' => 'created', 'width' => 18], '城市' => ['field' => 'city_name', 'width' => 8], '学校' => ['field' => 'university_name', 'width' => 15], '校区' => 'campus_name', '学生姓名' => 'realname', '身份证号' => 'id_card', '手机号码' => ['field' => 'mobile', 'width' => 14], '收货地址' => 'address', '订单状态' => ['field' => 'status_text', 'width' => 18], '订单类型' => 'type_text', '订单来源' => 'source_text', '商品名称' => ['field' => 'title', 'width' => 25], '商品属性' => 'goods_property', '一级分类' => 'pname', '二级分类' => 'cname', '商品总价' => ['field' => 'money', 'width' => 10, 'type' => 'f'], '贷款金额' => ['field' => 'loan_money', 'width' => 10, 'type' => 'f'], '分期数' => ['field' => 'month', 'width' => 10, 'type' => 'i'], '首付' => ['field' => 'first_money', 'width' => 10, 'type' => 'f'], '月服务费' => ['field' => 'month_fee', 'width' => 10, 'type' => 'f'], '线下商家名' => 'seller_name', '线下商家电话' => 'seller_telephone', '业务员手机号' => 'salesman_mobile', '业务员真实姓名' => 'salesman_realname', '线上商家名' => 'name', '线上商家电话' => 'contact'];
     csv('订单列表', $data, $field);
 }
Example #13
0
        /*
         * Kembalikan hasil perhitungan + status sukses
         */
        echo json_encode(array_merge(array('sukses' => true), $hasil));
        break;
    case 'order':
        echo json_encode(order($link, $_POST['poId'], $_POST['barcode'], $_POST['qty']));
        break;
    case 'hapus':
        echo json_encode(hapus($link, $_POST['poId'], $_POST['barcode']));
        break;
    case 'simpan':
        echo json_encode(simpan($link, $_POST['poId']));
        break;
    case 'csv':
        csv($link, $_GET['poId']);
        break;
    case 'hapuspo':
        hapusPo($link, $_GET['poid']);
        header('location:index.php');
        break;
}
/**
 * Fungsi untuk menghapus po (header dan detail)
 * @param mysqli $link
 * @param int $poId
 */
function hapusPo($link, $poId)
{
    mysqli_query($link, "DELETE FROM purchase_order_detail WHERE purchase_order_id={$poId}") or die('Gagal hapus po detail, po#' . $poId . ', error: ' . mysqli_error($link));
    mysqli_query($link, "DELETE FROM purchase_order WHERE id={$poId}") or die('Gagal hapus po#' . $poId . ', error: ' . mysqli_error($link));
Example #14
0
function csvn($v = "", $e = ",")
{
    csv($v, $e);
    csv("", "\n");
}
Example #15
0
# If the record is null then it outputs field names instead.
function csv($record, $fields)
{
    $names = explode(",", $fields);
    for ($i = 0; $names[$i]; $i++) {
        if ($i != 0) {
            print ',';
        }
        if ($record == null) {
            print '"' . $names[$i] . '"';
        } else {
            if ($record[$names[$i]] != null) {
                $f = $record[$names[$i]];
                $f = str_replace('"', '""', $f);
                $f = str_replace("\t", "\\t", $f);
                $f = str_replace("\r", "\\r", $f);
                $f = str_replace("\n", "\\n", $f);
                print '"' . $f . '"';
            }
        }
    }
    print "\n";
}
$table = "calforum";
$fields = "id,modified,organizer,name,subject,body";
$order = "id,modified";
$result = mysql_query("SELECT {$fields} FROM {$table} ORDER BY {$order}", $conn) or die(mysql_error());
csv(null, $fields);
while ($record = mysql_fetch_array($result)) {
    csv($record, $fields);
}
Example #16
0
                     $_POST['save'] == 1 ? head($tmpfname, ($dbtr == 1 ? $_POST['db'] : $_POST['table_sel']) . $far[$_POST['compr'] + 3]) : ($message = '<center><b>' . $_POST['local'] . ' Saved</b><center>');
                 } else {
                     $message = '<center><b>No writeable select Dir</b><center>';
                 }
             }
             break;
         case 1:
             //-----------------------------------
             if ($dbtr == 1) {
                 $it = 0;
                 while ($table_sel = @mysql_tablename(mysql_list_tables($_POST['db']), $it++)) {
                     write("\n# Table: {$table_sel}\n");
                     csv($table_sel);
                 }
             } else {
                 csv($_POST['table_sel']);
             }
             if ($_POST['save'] > 0) {
                 eval($far[$_POST['compr']] . "close(\$fp);");
                 $_POST['save'] == 1 ? head($tmpfname, ($dbtr == 1 ? $_POST['db'] : $_POST['table_sel']) . $far[$_POST['compr'] + 3]) : '';
             }
             //------------------------------
             break;
     }
 }
 eval($text . ";echo \$etext.\"\n<table width=100% height=90%><tr><td width=10% style='vertical-align:top'><table><tr><td>\";");
 if (!isset($_POST['dd'])) {
     $db_list = mysql_list_dbs($connect);
     echo "<select name='db'>\n";
     while ($row = mysql_fetch_assoc($db_list)) {
         $db1 = $row['Database'];
Example #17
0
#Obtener los folios que ya fueron actualizados
$r = array();
$folios = array();
$haystack = array();
$notinWS = 0;
try {
    $bd = new formas($dsnReader);
    $sql = "SELECT RECEPCION_ID, FOLIO_RASTREO FROM examenes_adminte;";
    $res = $bd->query($sql);
    if ($res->rowCount() > 0) {
        foreach ($res->fetchAll(PDO::FETCH_ASSOC) as $id => $d) {
            $folios[$id]["RECEPCION_ID"] = $d["RECEPCION_ID"];
            $folios[$id]["FOLIO_RASTREO"] = $d["FOLIO_RASTREO"];
            $haystack[$id] = $d["RECEPCION_ID"];
        }
        $notinWS = csv($haystack);
    }
} catch (PDOException $e) {
    $r["err"] = true;
    $r["msg"] = $e->getMessage();
    vardump($r);
    exit;
}
$bd = NULL;
#Obtener los registros con adminte y rastreo
require_once '../includes/nusoap/lib/nusoap.php';
$cliente = new nusoap_client('http://192.232.212.191/~promedic/remoto/server.php');
$res = $cliente->call('sql', array("sql" => "updateAdminte", "folios" => $notinWS));
if (!$res["err"]) {
    #meter a la base de datos de multi los registros de recepcion_id, folio_rastreo y fecha
    $info = $res["data"];
 public function _lend_excel()
 {
     $search = $this->_getWhere();
     $model = M($this->_table);
     // 拼接SQL WHERE
     if ($search) {
         $where = " where c.id != 0 ";
         if ($search['type']) {
             $where .= " and type = " . $search['type'];
         }
         if ($search['city_id']) {
             $where .= " and city_id = " . $search['city_id'];
         }
         if ($search['id|name|contact']) {
             $where .= " and id|name|contact like '" . $search['id|name|contact'][1] . "' ";
         }
     }
     // 关联统计商家下单量 使用原生sql查询
     $data = $model->query("SELECT id,name,city_name,contact,telephone,contact_user,remark,(select count(id) from zj_loan_order as o\n    where o.company_id = c.uid and c.uid!= 0) as t FROM `zj_loan_company` as c {$where} order by c.city_id asc");
     $field = ['城市' => ['field' => 'city_name', 'width' => 17], '商家' => ['field' => 'name', 'width' => 18], '姓名' => ['field' => 'contact', 'width' => 8], '联系方式' => ['field' => 'telephone', 'width' => 15], '出单量' => ['field' => 't', 'width' => 15], '对接人' => ['field' => 'contact_user', 'width' => 14], '备注' => ['field' => 'remark', 'width' => 18]];
     csv('出单量', $data, $field);
     exit;
 }