总账账龄分析表支持两种方式的API查询,一是按方案查询,即通过已保存的方案ID来查询,指定"SchemeId"的值即可,比较简单,这里不详细阐述。另一种是自定义条件查询,这里将重点说明。
前言说明:
FDATE,FVOUCHERGROUPID,FVOUCHERGROUPNO,FEXPLANATION,FBUSDATE,FBUSNO等凭证相关字段只有在"FShowVoucher": "true"时才有效。
下面示例中的FFLEXNAME,FAGINGRANGEFOR,FAGINGRANGE等是动态字段,需要根据查询条件动态确定。最终列名可以参考最后生成的临时表。其中:
FFLEXNAME的实际列名为:该维度在T_BD_FLEXITEMDETAILV表中的列名,如:客户(BD_Customer)的列名是FFLEX6,按组合查询时,有多个列名,如:FFLEX6,FFLEX7
FAGINGRANGEFOR,FAGINGRANGE的数量由"FAgingGroupEntity"中的区间数来决定,其中带“FOR”表示原币账龄。FAGINGRANGEFOR的实际列是:"F"加上"FAgingGroupEntity"中"FDays"的值,再加上"FOR",如F30FOR,F60FOR,F2147483647FOR等。FAGINGRANGE值为本位币的账龄区间,如F30,F60,F2147483647等。注,"FDays": 2147483647放在区间的最后,它是INT的最大值,表示后面所有天数。一般情况下,"FAgingGroupEntity"的最后一项都应该为:"FDays": 0,对应的字段名为F2147483647或F2147483647FOR'。
FFlexRadioGroup表示按连续编码查询还是非连续编码查询,其中0表示连续,1表示非连续。
1,查询单个维度(客户),显示凭证
{
"FieldKeys": "FACCTNUMBER,FACCTNAME,FFLEXNAME,FDCNAME,FCURRENCYNAME,FDATE,FVOUCHERGROUPID,FVOUCHERGROUPNO,FEXPLANATION,FBUSDATE,FBUSNO,FRESERVEDFOR,FAGINGRANGEFOR,FRESERVED,FAGINGRANGE,FBUSNO",
"SchemeId": "",
"StartRow": 0,
"Limit": 2000,
"IsVerifyBaseDataField": "true",
"Model": {
"FCurrency": "1",
"FBalance": "",
"FShowForbidenAcct": "false",
"FShowNopostedVch": "false",
"FFlexGroup": "",
"FDeadLine": "2023-01-01",
"FFlex": "BD_Customer",
"FFlexNumberFrom": "",
"FShowFullName": "false",
"FUseFlexGroup": "false",
"FFlexNumberTo": "",
"FMultiAcctMerge": "false",
"FFlexGRPSerialized": "",
"FFlexRadioGroup": "0",
"FFlexNumber": "",
"FShowAgingGrpPercent": "false",
"FShowVoucher": "true",
"FShowFlexTotal": "false",
"FShowAcctTotal": "false",
"FACCTBOOKID": {
"FNUMBER": "214"
},
"FMatchType": "0",
"FNegativeMatch": "false",
"FAgingGroupEntity": [
{
"FSection": "30天以内",
"FDays": 30
},
{
"FSection": "30-60天",
"FDays": 60
},
{
"FSection": "60以上",
"FDays": 0
}
]
}
}
当"FFlexRadioGroup": "1",时,表示非连续查询,此时在"FFlexNumber"中指定维度的编码,如 "FFlexNumber":"A,B,C"。
2,按维度组合查询时:维度组合的定义由"FFlexGRPSerialized"的值决定,详细参考下在示例:按供应商和部门组合查询,其中供应商编码从A到B,部门编码从C到D
"FUseFlexGroup": "true",
"FFlexGRPSerialized": "<ArrayOfDetailGroup>
<DetailGroup>
<DetailType>BD_Supplier</DetailType>
<DetailTypeShow>BD_Supplier.BD_Supplier</DetailTypeShow>
<BeginNo>A</BeginNo>
<BeginNoUnInput>false</BeginNoUnInput>
<EndNo>B</EndNo>
<EndNoUnInput>false</EndNoUnInput>
<ValueDataType>0</ValueDataType>
</DetailGroup>
<DetailGroup>
<DetailType>BD_Department</DetailType>
<DetailTypeShow>BD_Department.BD_Department</DetailTypeShow>
<BeginNo>C</BeginNo>
<BeginNoUnInput>false</BeginNoUnInput>
<EndNo>D</EndNo>
<EndNoUnInput>false</EndNoUnInput>
<ValueDataType>0</ValueDataType>
</DetailGroup>
</ArrayOfDetailGroup>"
如果是编码非连续的查询,即"FFlexRadioGroup": "1",则在<AcctDems>中逐一列出所有编码:
<ArrayOfDetailGroup>
<DetailGroup>
<DetailType>BD_Supplier</DetailType>
<DetailTypeShow>BD_Supplier.BD_Supplier</DetailTypeShow>
<BeginNoUnInput>false</BeginNoUnInput>
<EndNoUnInput>false</EndNoUnInput>
<AcctDems>
<string>SUP000001</string>
<string>SUP000009</string>
</AcctDems>
<ValueDataType>0</ValueDataType>
</DetailGroup>
<DetailGroup>
<DetailType>BD_Department</DetailType>
<DetailTypeShow>BD_Department.BD_Department</DetailTypeShow>
<BeginNoUnInput>false</BeginNoUnInput>
<EndNoUnInput>false</EndNoUnInput>
<AcctDems>
<string>A</string>
<string>B</string>
</AcctDems>
<ValueDataType>0</ValueDataType>
</DetailGroup>
</ArrayOfDetailGroup>
关键参数说明:
"FFlexRadioGroup": "0", //0为维度连续查询,1为非连续查询(连续查询时,无需再指定非连续查询时的相关参数,反之亦然)
"FUseFlexGroup": "true", //是否采用维度组合查询(组合查询时,无需再指定单个维度查询时的相关参数,反之亦然)
"FFlex": "BD_Customer", //单维度时维度的ID
"FFlexNumberFrom": "", //连续查询,单维度时维度的起始编码
"FFlexNumberTo": "", //连续查询,单维度时维度的截止编码
"FFlexNumber": "", //非连续查询,单维度时维度的编码
"FFlexGRPSerialized": "", //定义维度组合查询时的xml,包含维度和范围
推荐阅读