总账类

    voucher/add


    目录

    1.接口说明

    1.1接口描述

         新增一张凭证

    1.2适用版本

         支持U8V12.0 及更高版本

    2.使用场景

    报销应用、财务管控应用

    3.接口调用说明

    3.1请求说明

    url https://api.yonyouup.com/api/voucher/add
    格式 JSON
    https请求方式 POST
    编码类型 UTF-8


    3.2url参数说明

    参数 类型 是否必填 描述
    from_account string 调用方id
    to_account string 提供方id
    app_key string 应用编码
    token string api调用唯一识别码
    tradeid string 交易唯一识别码,tradeid与biz_id只能传入一个
    ds_sequence number 数据源序号(默认取应用的第一个数据源)
    biz_id string 上游id,需要保证biz_id与ERP主键唯一对应关系,tradeid与biz_id只能传入一个
    sync number 0=异步新增(默认);1=同步新增;


    3.3请求体参数说明

    参数 类型 参数路径 是否必填 描述
    voucher_type string 凭证类别
    fiscal_year number 凭证所属的会计年度,不填写取当前年
    accounting_period number 所属的会计期间,不填写取当前月份
    voucher_id string 凭证号
    date date 制单日期
    enter string 制单人名称
    cashier string 出纳名称
    attachment_number number 附单据数
    voucher_making_system string 外部系统类型,如果需要传入外部凭证业务号,此属性必须传入固定值 CDM
    reserve2 string 外部凭证业务号,如果传入此属性,voucher_making_system 必须传入固定值 CDM。外部凭证U8里无法删除、修改,可以通过作废接口作废voucher/cancel即可,作废接口id参数就是对应此reserve2的值
    entry_id number debit/entry 分录号
    account_code string debit/entry 科目编码
    abstract string debit/entry 摘要
    currency string debit/entry 币种,默认人民币
    unit_price number debit/entry 单价,在科目有数量核算时,填写此项
    exchange_rate1 number debit/entry 汇率1,主辅币核算时使用,原币*汇率1=辅币,NC用户使用
    exchange_rate2 number debit/entry 汇率2,折本汇率,本币*汇率2=主币,U8用户使用
    debit_quantity number debit/entry 借方数量,在科目有数量核算时,填写此项
    primary_debit_amount number debit/entry 原币借方发生额
    secondary_debit_amount number debit/entry 辅币借方发生额
    natural_debit_currency number debit/entry 本币借方发生额*与本币贷方发生额不能同时为空
    dept_id string debit/entry/auxiliary 部门
    personnel_id string debit/entry/auxiliary 人员
    cust_id string debit/entry/auxiliary 客户
    supplier_id string debit/entry/auxiliary 供应商
    item_class string debit/entry/auxiliary 项目大类
    item_id string debit/entry/auxiliary 项目档案
    operator string debit/entry/auxiliary 业务员
    self_define1 string debit/entry/auxiliary 自定义字段1
    self_define2 string debit/entry/auxiliary 自定义字段2
    self_define3 string debit/entry/auxiliary 自定义字段3
    self_define4 string debit/entry/auxiliary 自定义字段4
    self_define5 string debit/entry/auxiliary 自定义字段5
    self_define6 string debit/entry/auxiliary 自定义字段6
    self_define7 string debit/entry/auxiliary 自定义字段7
    self_define8 string debit/entry/auxiliary 自定义字段8
    self_define9 string debit/entry/auxiliary 自定义字段9
    self_define10 string debit/entry/auxiliary 自定义字段10
    self_define11 string debit/entry/auxiliary 自定义字段11
    self_define12 string debit/entry/auxiliary 自定义字段12
    self_define13 string debit/entry/auxiliary 自定义字段13
    self_define14 string debit/entry/auxiliary 自定义字段14
    self_define15 string debit/entry/auxiliary 自定义字段15
    self_define16 string debit/entry/auxiliary 自定义字段16
    cexch_name number debit/entry/cash_flow 币种
    RowGuid string debit/entry/cash_flow 行标识
    iYPeriod date debit/entry/cash_flow 年期间
    iyear date debit/entry/cash_flow
    csign number debit/entry/cash_flow 凭证类别字
    nd_s number debit/entry/cash_flow 数量借方
    md_f number debit/entry/cash_flow 外币借方
    ccode number debit/entry/cash_flow 科目编码
    md number debit/entry/cash_flow 借方金额
    cCashItem string debit/entry/cash_flow 现金项目
    cash_item string debit/entry/cash_flow 现金项目
    natural_debit_currency number debit/entry/cash_flow 本币借方发生额*与本币贷方发生额不能同时为空
    cdept_id string debit/entry/cash_flow 部门
    cperson_id string debit/entry/cash_flow 人员
    ccus_id string debit/entry/cash_flow 客户
    csup_id string debit/entry/cash_flow 供应商
    citem_class string debit/entry/cash_flow 项目大类
    citem_id string debit/entry/cash_flow 项目档案
    cDefine1 string debit/entry/cash_flow 自定义字段1
    cDefine2 string debit/entry/cash_flow 自定义字段2
    cDefine3 string debit/entry/cash_flow 自定义字段3
    cDefine4 string debit/entry/cash_flow 自定义字段4
    cDefine5 string debit/entry/cash_flow 自定义字段5
    cDefine6 string debit/entry/cash_flow 自定义字段6
    cDefine7 string debit/entry/cash_flow 自定义字段7
    cDefine8 string debit/entry/cash_flow 自定义字段8
    cDefine9 string debit/entry/cash_flow 自定义字段9
    cDefine10 string debit/entry/cash_flow 自定义字段10
    cDefine11 string debit/entry/cash_flow 自定义字段11
    cDefine12 string debit/entry/cash_flow 自定义字段12
    cDefine13 string debit/entry/cash_flow 自定义字段13
    cDefine14 string debit/entry/cash_flow 自定义字段14
    cDefine15 string debit/entry/cash_flow 自定义字段15
    cDefine16 string debit/entry/cash_flow 自定义字段16
    entry_id number credit/entry 分录号
    account_code string credit/entry 科目编码
    abstract string credit/entry 摘要
    currency string credit/entry 币种,默认人民币
    unit_price number credit/entry 单价,在科目有数量核算时,填写此项
    exchange_rate1 number credit/entry 汇率1,主辅币核算时使用,原币*汇率1=辅币,NC用户使用
    exchange_rate2 number credit/entry 汇率2,折本汇率,本币*汇率2=主币,U8用户使用
    credit_quantity number credit/entry 贷方数量,在科目有数量核算时,填写此项
    primary_credit_amount number credit/entry 原币贷方发生额
    secondary_credit_amount number credit/entry 辅币贷方发生额
    natural_credit_currency number credit/entry 本币贷方发生额*与本币借方发生额不能同时为空
    dept_id string credit/entry/auxiliary 部门
    personnel_id string credit/entry/auxiliary 人员
    cust_id string credit/entry/auxiliary 客户
    supplier_id string credit/entry/auxiliary 供应商
    item_class string credit/entry/auxiliary 项目大类
    item_id string credit/entry/auxiliary 项目档案
    operator string credit/entry/auxiliary 业务员
    self_define1 string credit/entry/auxiliary 自定义字段1
    self_define2 string credit/entry/auxiliary 自定义字段2
    self_define3 string credit/entry/auxiliary 自定义字段3
    self_define4 string credit/entry/auxiliary 自定义字段4
    self_define5 string credit/entry/auxiliary 自定义字段5
    self_define6 string credit/entry/auxiliary 自定义字段6
    self_define7 string credit/entry/auxiliary 自定义字段7
    self_define8 string credit/entry/auxiliary 自定义字段8
    self_define9 string credit/entry/auxiliary 自定义字段9
    self_define10 string credit/entry/auxiliary 自定义字段10
    self_define11 string credit/entry/auxiliary 自定义字段11
    self_define12 string credit/entry/auxiliary 自定义字段12
    self_define13 string credit/entry/auxiliary 自定义字段13
    self_define14 string credit/entry/auxiliary 自定义字段14
    self_define15 string credit/entry/auxiliary 自定义字段15
    self_define16 string credit/entry/auxiliary 自定义字段16
    cexch_name number credit/entry/cash_flow 币种
    RowGuid string credit/entry/cash_flow 行标识
    iYPeriod date credit/entry/cash_flow 年期间
    iyear date credit/entry/cash_flow
    csign number credit/entry/cash_flow 凭证类别字
    nc_s number credit/entry/cash_flow 数量贷方
    mc_f number credit/entry/cash_flow 外币贷方
    ccode number credit/entry/cash_flow 科目编码
    mc number credit/entry/cash_flow 贷方金额
    cCashItem string credit/entry/cash_flow 现金项目
    cash_item string credit/entry/cash_flow 现金项目
    natural_credit_currency number credit/entry/cash_flow 本币贷方发生额*与本币借方发生额不能同时为空
    cdept_id string credit/entry/cash_flow 部门
    cperson_id string credit/entry/cash_flow 人员
    ccus_id string credit/entry/cash_flow 客户
    csup_id string credit/entry/cash_flow 供应商
    citem_class string credit/entry/cash_flow 项目大类
    citem_id string credit/entry/cash_flow 项目档案
    cDefine1 string credit/entry/cash_flow 自定义字段1
    cDefine2 string credit/entry/cash_flow 自定义字段2
    cDefine3 string credit/entry/cash_flow 自定义字段3
    cDefine4 string credit/entry/cash_flow 自定义字段4
    cDefine5 string credit/entry/cash_flow 自定义字段5
    cDefine6 string credit/entry/cash_flow 自定义字段6
    cDefine7 string credit/entry/cash_flow 自定义字段7
    cDefine8 string credit/entry/cash_flow 自定义字段8
    cDefine9 string credit/entry/cash_flow 自定义字段9
    cDefine10 string credit/entry/cash_flow 自定义字段10
    cDefine11 string credit/entry/cash_flow 自定义字段11
    cDefine12 string credit/entry/cash_flow 自定义字段12
    cDefine13 string credit/entry/cash_flow 自定义字段13
    cDefine14 string credit/entry/cash_flow 自定义字段14
    cDefine15 string credit/entry/cash_flow 自定义字段15
    cDefine16 string credit/entry/cash_flow 自定义字段16

    3.4请求示例

    POST https://api.yonyouup.com/api/voucher/add?from_account=openapi_dev&to_account=openapi_ent&app_key=opa6fdd4bea98b95ad7&token=843d03f66e6544e19707ccec11030296&biz_id=0971&ds_sequence=1
    
    POST 内容:
    {
    	"voucher":{
    		"accounting_period":"1",
    		"credit":{
    			"entry":[
    				{
    					"abstract":"222222",
    					"account_code":"122102",
    					"auxiliary":{
    						"dept_id":"0301",
    						"personnel_id":"00033"
    					},
    					"credit_quantity":"0",
    					"document_date":"2015-01-06",
    					"document_id":"321654",
    					"entry_id":"2",
    					"exchange_rate2":"0",
    					"natural_credit_currency":"1000",
    					"primary_credit_amount":"0",
    					"cash_flow":[
    						{
    							"cash_item":"02",
    							"natural_debit_currency":"4.00",
    							"natural_credit_currency":"0.00",
    							"cCashItem":"02",
    							"md":"4",
    							"mc":"0",
    							"ccode":"1001",
    							"md_f":"0",
    							"mc_f":"0",
    							"nd_s":"0",
    							"nc_s":"0",
    							"dbill_date":"2016-04-11",
    							"csign":"记",
    							"iyear":"2016",
    							"iYPeriod":"201604",
    							"RowGuid":""
    						},
    						{
    							"cash_item":"02",
    							"natural_debit_currency":"4.00",
    							"natural_credit_currency":"0.00",
    							"cCashItem":"02",
    							"md":"4",
    							"mc":"0",
    							"ccode":"1001",
    							"md_f":"0",
    							"mc_f":"0",
    							"nd_s":"0",
    							"nc_s":"0",
    							"dbill_date":"2016-04-11",
    							"csign":"记",
    							"iyear":"2016",
    							"iYPeriod":"201604",
    							"RowGuid":""
    						}
    					]
    				}
    			]
    		},
    		"date":"2015-01-06",
    		"debit":{
    			"entry":[
    				{
    					"abstract":"222222",
    					"account_code":"100202",
    					"auxiliary":{
    						
    					},
    					"debit_quantity":"0",
    					"document_date":"2015-01-06",
    					"document_id":"1234567",
    					"entry_id":"1",
    					"exchange_rate2":"0",
    					"natural_debit_currency":"1000",
    					"primary_debit_amount":"0",
    					"settlement":"8",
    					"cash_flow":[
    						{
    							"cash_item":"02",
    							"natural_debit_currency":"4.00",
    							"natural_credit_currency":"0.00",
    							"cCashItem":"02",
    							"md":"4",
    							"mc":"0",
    							"ccode":"1001",
    							"md_f":"0",
    							"mc_f":"0",
    							"nd_s":"0",
    							"nc_s":"0",
    							"dbill_date":"2016-04-11",
    							"csign":"记",
    							"iyear":"2016",
    							"iYPeriod":"201604",
    							"RowGuid":""
    						}
    					]
    				}
    			]
    		},
    		"enter":"demo",
    		"fiscal_year":"2015",
    		"voucher_type":"记"
    	}
    }
    


    3.5返回参数说明

    参数说明 类型 描述
    errcode string 错误码,0 为正常。
    errmsg string 错误信息。
    id string 新增成功后返回新凭证id。
    tradeid string 新增成功后返回交易唯一识别码

    3.6正确返回示例

    JSON示例:

    {
        "tradeid": "158f3f05730711e591c702004c4f4f50",
        "ping_after": "3",
        "url": "https://api.yonyouup.com/result?requestid=158f3f05730711e591c702004c4f4f50"
    }
    上述 api 请求返回信息表示建议客户端 3 秒钟后向 https://api.yonyouup.com/result?requestid=158f3f05730711e591c702004c4f4f50 发送 GET 请求获取真正的 api 调用结果,结果格式如下:
    {
      "errcode" : "0", 
      "errmsg" : "", 
      "id" : "883",
      "tradeid" : "158f3f05730711e591c702004c4f4f50"
    }  
    

    3.7错误返回示例

    application/json;charset=UTF-8
    {
    	"errcode" : "30021",
    	"errmsg" : "此应用未上线"
    } 

    4.API测试

    API测试 SDK下载