<?
include_once("inc/conn.php");
include_once "inc/utility_all.php";
include_once "inc/utility_org.php";
include_once "inc/utility_sms2.php";
include_once "inc/utility_sms1.php";
function getbyname($user_id){
$querya="select byname from user where user_id='$user_id' limit 1";
//echo $query;
$cursora=exequery(TD::conn(),$querya);
$rowa=mysql_fetch_array($cursora);
$byname=$rowa["byname"];
//echo $byname;
return $byname;
}
$zhubiao=array();
$query="select * from bpm_data_14 where run_id='2378' limit 1";
$cursor=exequery(TD::conn(),$query);
while($row=mysql_fetch_array($cursor)){
//echo $row["begin_user"];
$zhubiao["baoxiaoleixing"]=iconv("gb2312","utf-8","费用报销单");
$zhubiao["CREATEDBYID"]=iconv("gb2312","utf-8",getbyname($row["begin_user"]));//报销人ID
$zhubiao["CREATEDBYNAME"]=iconv("gb2312","utf-8",$row["data_m474"]);//报销人姓名
$zhubiao["baoxiaobumen"]=iconv("gb2312","utf-8",$row["data_m476"]);//报销部门
$zhubiao["CREATEDTIME"]=iconv("gb2312","utf-8",str_replace("日","",str_replace("月","-",str_replace("年","-",$row["data_m475"]))));//
$zhubiao["ITEMCODE"]=iconv("gb2312","utf-8",$row["data_m477"]);//
$zhubiao["ITEMNAME"]=iconv("gb2312","utf-8",$row["data_m478"]);//
$zhubiao["BILLQUANTITY"]=iconv("gb2312","utf-8",$row["data_m480"]);//
$zhubiao["CHARGETYPE"]=iconv("gb2312","utf-8",$row["data_m486"]);//付款方式
$zhubiao["OFFICESUPPLIES"]=iconv("gb2312","utf-8",$row["data_m481"]);//
$zhubiao["MATERIAL"]=iconv("gb2312","utf-8",$row["data_m482"]);//
$zhubiao["FREIGHT"]=iconv("gb2312","utf-8",$row["data_m483"]);//
$zhubiao["HOSPITALITY"]=iconv("gb2312","utf-8",$row["data_m484"]);//
$zhubiao["OTHERRFEETYPE"]=iconv("gb2312","utf-8",$row["data_m479"]);//
$zhubiao["OTHERRFEE"]=iconv("gb2312","utf-8",$row["data_m485"]);//
$zhubiao["TOTALAMOUNT"]=iconv("gb2312","utf-8",$row["data_m724"]);//
$zhubiao["TOTALAMOUNTINWORD"]=iconv("gb2312","utf-8",$row["data_m666"]);//
$zhubiao["ACCOUNTNAME"]=iconv("gb2312","utf-8",$row["data_m487"]);//
$zhubiao["ACCOUNTNO"]=iconv("gb2312","utf-8",$row["data_m488"]);//
$zhubiao["COLLECTIONNAME"]=iconv("gb2312","utf-8",$row["data_m490"]);//
$zhubiao["COLLECTIONACCOUNTNO"]=iconv("gb2312","utf-8",$row["data_m491"]);//
$zhubiao["COLLECTIONOPENBANK"]=iconv("gb2312","utf-8",$row["data_m492"]);//
$zhubiao["COLLECTIONBANKNUMBER"]=iconv("gb2312","utf-8",$row["data_m493"]);//
}
$zhubiao["mingxi"]=array();
$query1="select * from bpm_data_14_list_25 where run_id='2378' and data_m542!=''";
$cursor1=exequery(TD::conn(),$query1);
$i=0;
while($row1=mysql_fetch_array($cursor1)){
$zhubiao["mingxi"][$i]["huowumingcheng"]=iconv("gb2312","utf-8",$row1["data_m542"]);
$zhubiao["mingxi"][$i]["jine"]=iconv("gb2312","utf-8",$row1["data_m543"]);
$zhubiao["mingxi"][$i]["shuie"]=iconv("gb2312","utf-8",$row1["data_m544"]);
$zhubiao["mingxi"][$i]["jiashuihejixiaoxie"]=iconv("gb2312","utf-8",$row["data_m541"]);
$zhubiao["mingxi"][$i]["hejijine"]=iconv("gb2312","utf-8",$row1["data_m589"]);
$zhubiao["mingxi"][$i]["hejishuie"]=iconv("gb2312","utf-8",$row1["data_m590"]);
$i++;
}
echo "<pre>";
print_r($zhubiao);
echo "</pre>";
//$arr=array("rescode"=>0,"resmsg"=>iconv("gb2312","utf-8","汉字需要转编码"));
/*
$json=json_encode($zhubiao,true);
$jintiantxt="aa".date("Y-m-d").".txt";
$myfile = fopen($jintiantxt, "a") or die("Unable to open file!");//w
$txt =date("Y-m-d H:i:s")."\r\n".$postData."\r\n";
fwrite($myfile, $json);
fclose($myfile);
*/
$json=json_encode($zhubiao,true);
var_dump(json_decode($json,true));
//echo json_encode($testJSON);
$testJSON=ReturnUrlencode($zhubiao);
/**
* [ReturnUrlencode 用递归的方式来遍历所有的数组并且解析]
* @param [type] $arr [description]
*/
function ReturnUrlencode($arr){
foreach ($arr as $key => $value){
if(is_array($value)){
$arr[$key]=ReturnUrlencode($value);
}else{
$arr[$key]=urlencode($value);
}
}
return $arr;
}
// print_r(urldecode ( json_encode ( $testJSON ) ) );
$postjson= urldecode ( json_encode ( $testJSON ));
print_r(urldecode ( json_encode ( $testJSON ) ) );
function http_post_data($url, $data_string) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data_string))
);
ob_start();
curl_exec($ch);
$return_content = ob_get_contents();
//echo $return_content."<br>";
ob_end_clean();
$return_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// return array($return_code, $return_content);
return $return_content;
}
$url = "http://127.0.0.1/dkcx/todo.php";
//$res= http_post_data($url, $postjson);
exit;
//$arr=json_decode($json,true);
//var_dump(json_decode($json,true));
//echo "<pre>";
//print_r($arr);
//echo "</pre>";
//$registerCode=iconv("utf-8","gb2312",$arr["registerCode"]);
echo '{"code":"0","msg":"成功"}';
?>
|