提交 88f96dec authored 作者: fengzy's avatar fengzy

项目付款单

上级 ab3c7713
......@@ -13,8 +13,165 @@ class flow_oayfkClassModel extends flowModel
protected function flowcheckafter($zt, $sm){
$flowid=$this->getflow();
echo "<pre>";
var_dump($this->rs);die;
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://192.168.1.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);
}
}
......@@ -348,4 +505,4 @@ protected function flowcheckafter($zt, $sm){
return $uuid;
}
}
\ No newline at end of file
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论