提交 dfa173ce authored 作者: fengzy's avatar fengzy

费用报销脚本

上级 9089a6b0
...@@ -76,6 +76,7 @@ protected function flowcheckafter($zt, $sm){ ...@@ -76,6 +76,7 @@ protected function flowcheckafter($zt, $sm){
$cookie_jar = tempnam('/tmp','CloudSession'); $cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data); $post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar); $result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
var_dump($result);die;
header("Content-type: text/html; charset=utf8"); header("Content-type: text/html; charset=utf8");
$applicant=$this->rs['applicant'];//申请人 $applicant=$this->rs['applicant'];//申请人
$applicationdpt=$this->rs['applicationdpt'];//申请部门 $applicationdpt=$this->rs['applicationdpt'];//申请部门
...@@ -194,6 +195,7 @@ protected function flowcheckafter($zt, $sm){ ...@@ -194,6 +195,7 @@ protected function flowcheckafter($zt, $sm){
$orglist = m('option')->getone("pid='".$data['id']."' and name='".$name."'", 'name,num'); $orglist = m('option')->getone("pid='".$data['id']."' and name='".$name."'", 'name,num');
return $orglist['num']; return $orglist['num'];
} }
public static function dept($data) public static function dept($data)
{ {
$sql=" name= '$data'"; $sql=" name= '$data'";
......
...@@ -14,163 +14,7 @@ protected function flowcheckafter($zt, $sm){ ...@@ -14,163 +14,7 @@ protected function flowcheckafter($zt, $sm){
$flowid=$this->getflow(); $flowid=$this->getflow();
if($flowid['nowcheckid']=='1085'){ if($flowid['nowcheckid']=='1085'){
$payee = $this->rs['payee'];//收款方
$supplier = m('supplier')->getone("name = '$payee' ",'number');
$details_yfk=$this->db->getrows('oa_c_fund_details_yfk',"mid='".$this->rs['id']."'");
$arr=[];
foreach ($details_yfk as $k=> $value) {
foreach ($value as $key => $val) {
switch ($key) {
case 'charge_type':
$arr['FPAYBILLENTRY'][$k]['F_KXType']['FNUMBER']=self::getkxlx($val);
break;
case 'cbzx_code':
$arr['FPAYBILLENTRY'][$k]['F_PAEZ_Cbzx']['FNUMBER']=substr($val,0,strpos($val, "("));;
break;
case 'charge_amount':
$arr['FPAYBILLENTRY'][$k]['FPAYTOTALAMOUNTFOR']=$val;
$arr['FPAYBILLENTRY'][$k]['FPAYAMOUNTFOR_E']=$val;
$arr['FPAYBILLENTRY'][$k]['FSETTLEPAYAMOUNTFOR']=$val;
$arr['FPAYBILLENTRY'][$k]['FREALPAYAMOUNTFOR_D']=$val;
break;
default:
$arr['FPAYBILLENTRY'][$k]['FSETTLETYPEID']['FNumber']='JSFS04_SYS';
$arr['FPAYBILLENTRY'][$k]['FPURPOSEID']['FNumber']='SFKYT12_SYS';
$arr['FPAYBILLENTRY'][$k]['FPOSTDATE']=$this->rs['applydt'].' 00:00:00';
$arr['FPAYBILLENTRY'][$k]['FACCOUNTID']['FNumber']='10285000001001779';
// $arr['FPAYBILLENTRY'][$k]['FOPPOSITEBANKACCOUNT']=$data['bank_code'];
// $arr['FPAYBILLENTRY'][$k]['FOPPOSITECCOUNTNAME']=$data['bank_holder'];
// $arr['FPAYBILLENTRY'][$k]['FOPPOSITEBANKNAME']=$data['open_bank_name'];
// $arr['FPAYBILLENTRY'][$k]['FOpenAddressRec']=$data['open_address'];
break;
}
}
}
$cloudUrl = "http://36.110.39.211/k3cloud/";
//登陆参数
$data = array(
'5e64f6ff0bd47f',//帐套Id
// '5ef2c166ad1afa',//帐套Id
'Administrator',//用户名
'666666',//密码
'2052'//语言标识359010087
);
//定义记录Cloud服务端返回的Session
$cookie_jar = tempnam('/tmp','CloudSession');
$post_content = self::create_postdata($data);
$result = self::invoke_login($cloudUrl,$post_content,$cookie_jar);
header("Content-type: text/html; charset=utf8");
$applicant=$this->rs['applicant'];//申请人
$applicationdpt=$this->rs['applicationdpt'];//申请部门
$applydt=$this->rs['applydt'];//申请日期
$data_model ='{
"Creator": "",
"NeedUpDateFields": [],
"NeedReturnFields": [],
"IsDeleteEntry": "true",
"SubSystemId": "",
"IsVerifyBaseDataField": "false",
"IsEntryBatchFill": "true",
"ValidateFlag": "true",
"NumberSearch": "true",
"InterationFlags": "",
"IsAutoSubmitAndAudit": "false",
"Model": {
"FID": 0,
"FBillTypeID": {
"FNUMBER": "FKDLX11_SYS"
},
"FDATE": "2020-08-03 00:00:00",
"FCONTACTUNITTYPE": "BD_Supplier",
"FCONTACTUNIT": {
"FNumber": "GDGYS-0003"
},
"FRECTUNITTYPE": "BD_Supplier",
"FRECTUNIT": {
"FNumber": "GDGYS-0003"
},
"FISINIT": false,
"FCURRENCYID": {
"FNumber": "PRE001"
},
"FDepartment": {
"FNumber": ""
},
"FEXCHANGERATE": 1.0,
"FSETTLERATE": 1.0,
"FSETTLEORGID": {
"FNumber": "1000"
},
"FPURCHASEORGID": {
"FNumber": "1000"
},
"FPURCHASEDEPTID": {
"FNumber": "GS.BM.08"
},
"FDOCUMENTSTATUS": "Z",
"FCancelStatus": "A",
"FPAYORGID": {
"FNumber": "1000"
},
"FISSAMEORG": true,
"FIsCredit": false,
"FSETTLECUR": {
"FNUMBER": "PRE001"
},
"FIsWriteOff": false,
"FREALPAY": false,
"FISCARRYRATE": false,
"FSETTLEMAINBOOKID": {
"FNUMBER": "PRE001"
},
"F_PAEZ_OADJBH": "213123213"
}
}';
$model=json_decode($data_model,true);
$model['Model']['FDATE']=$applydt;
$model['Model']['F_PAEZ_OADJBH']=$this->rs['docnum'];
$model['Model']['FCONTACTUNIT']['FNumber']=$supplier['number'];
$model['Model']['FRECTUNIT']['FNumber']=$supplier['number'];
$model['Model']['FDepartment']['FNumber']=self::dept($this->rs['application']);
$model['Model']['FSETTLEORGID']['FNumber']=self::getorg($this->rs['fkorg']);
$model['Model']['FPAYORGID']['FNumber']=self::getorg($this->rs['fkorg']);
$model['Model']['FPAYBILLENTRY']=$arr['FPAYBILLENTRY'];
$data_model=json_encode($model);
$data = array(
'AP_PAYBILL',//业务对象标识FormId
$data_model//具体Json字串
);
$post_content = self::create_postdata($data);
$result = self::invoke_add($cloudUrl,$post_content,$cookie_jar);
$array = json_decode($result,true);
$num=$array['Result']['Number'];
if($array['Result']['ResponseStatus']['IsSuccess']){
$this->update("`fbillno`='$num'", $this->rs['id']);
$this->erplog($this->rs['docnum'],'c_fininfom_oayfk','保存成功',json_encode($array),date("Y-m-d H:i:s"),2,$num,$array['Result']['Id'],1);
}else{
$this->erplog($this->rs['docnum'],'c_fininfom_oayfk','保存失败',json_encode($array),date("Y-m-d H:i:s"),1,$num,$array['Result']['Id'],1);
}
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论