通过调用报表API工具接口、数据库SQL语句查询,实现财务报表的数据查询
**1、调用报表API工具接口实现财务报表数据查询**
引用类:
```
using Kingdee.BOS.WebApi.Client;
using Newtonsoft.Json.Linq;
```
请求参数说明:
```
/*
1、ReportType:报表类型(个别报表-1,合并个别报表-17,合并报表-15,汇总报表-14,工作底稿-16,抵消表-31,阿米巴报表-51)
2、ReportNumber:报表编码(在报表查看)
3、AcctSystemNumber:会计核算体系编码(在会计核算体系查看)
4、OrgNumber:所属组织编码(在组织机构查看)
5、AcctPolicyNumber:会计政策编码(在会计政策查看)
6、CurrencyNumber:币别编码(在币别查看)
7、CurrUnitNumber:金额单位编码(在金额单位查看)
8、ScopeTypeNumber:合并方案编码(在合并方案查看,合并报表必录)
9、ScopeNumber:合并范围编码(在合并方案查看,合并报表必录)
10、ProfitCenterNumber:利润中心编码(在利润考核体系查看,阿米巴报表必录)
11、CycleType:周期类型(周报-3,月报-4,季报-5,半年报-6,年报-7)
12、Year:报表年度
13、Period:报表期间
14、DataType:返回数据类型(Json,Excel,ItemData)
15、ResultType:输出类型(文本-0,文件-1)
*/
```
代码示例:
```
Console.WriteLine("报表类型(个别报表-1,合并个别报表-17,合并报表-15,汇总报表-14,工作底稿-16,抵消表-31,阿米巴报表-51)");
string ReportType = Console.ReadLine();
Console.WriteLine("报表编码(在报表查看)");
string ReportNumber = Console.ReadLine();
Console.WriteLine("会计核算体系编码(在会计核算体系查看,KJHSTX01_SYS)");
string AcctSystemNumber = Console.ReadLine();
Console.WriteLine("会计政策编码(在会计政策查看,KJZC01_SYS)");
string AcctPolicyNumber = Console.ReadLine();
Console.WriteLine("所属组织编码(在组织机构查看)");
string OrgNumber = Console.ReadLine();
Console.WriteLine("币别编码(在币别查看,PRE001)");
string CurrencyNumber = Console.ReadLine();
Console.WriteLine("金额单位编码(在金额单位查看,JEDW01_SYS)");
string CurrUnitNumber = Console.ReadLine();
Console.WriteLine("合并方案编码(在合并方案查看,合并报表必录)");
string ScopeTypeNumber = Console.ReadLine();
Console.WriteLine("合并范围编码(在合并方案查看,合并报表必录)");
string ScopeNumber = Console.ReadLine();
Console.WriteLine("利润中心编码(在利润考核体系查看,阿米巴报表必录)");
string ProfitCenterNumber = Console.ReadLine();
Console.WriteLine("周期类型(周报 - 3,月报 - 4,季报 - 5,半年报 - 6,年报 - 7)");
string CycleType = Console.ReadLine();
Console.WriteLine("报表年度");
string Year = Console.ReadLine();
Console.WriteLine("报表期间");
string Period = Console.ReadLine();
Console.WriteLine("返回数据类型(Json,Excel,ItemData)");
string DataType = Console.ReadLine();
Console.WriteLine("报表输出类型(文本 - 0,文件 - 1)期间");
string ResultType = Console.ReadLine();
JObject apiParam = new JObject();
apiParam.Add("ReportType", ReportType);
apiParam.Add("ReportNumber", ReportNumber);
apiParam.Add("AcctSystemNumber", AcctSystemNumber);
apiParam.Add("AcctPolicyNumber", AcctPolicyNumber);
apiParam.Add("OrgNumber", OrgNumber);
apiParam.Add("CurrencyNumber", CurrencyNumber);
apiParam.Add("CurrUnitNumber", CurrUnitNumber);
apiParam.Add("ScopeTypeNumber", ScopeTypeNumber);
apiParam.Add("ScopeNumber", ScopeNumber);
apiParam.Add("ProfitCenterNumber", ProfitCenterNumber);
apiParam.Add("CycleType", CycleType);
apiParam.Add("Year", Year);
apiParam.Add("Period", Period);
apiParam.Add("DataType", DataType);
apiParam.Add("ResultType", ResultType);
var reportData = client.Execute<string>("Kingdee.BOS.KDS.ServiceFacade.ServicesStub.KDSReportAPIStub.GetReportData, Kingdee.BOS.KDS.ServiceFacade.ServicesStub", new string[] { apiParam.ToString() });
```
**2、数据库SQL语句查询实现财务报表的数据查询**
报表:表头T_KDS_RPT;表体t_kds_sheet
报表项目:T_BD_RptItem T_BD_RptItem_l
项目数据查询:T_KDS_RptItemData
项目数据类型:T_BD_RptItemDataType
SQL语句查询:
```
select oo.FNumber as FOrgNumber,ool.FName as FOrgName,rpt.FNUMBER FReportNumber,rpt.FNAME FReportNname,rpt.FRPTTYPE,rpt.FCYCLEID, * from T_KDS_RPT rpt
Join T_Org_Organizations oo On oo.FOrgId = rpt.FOrgId
Join T_Org_Organizations_l ool On oo.FOrgId = ool.FOrgId And ool.FLocaleId = 2052
```
```
select oas.FNUMBER as FAcctSysNumber,oasl.FNAME as FAcctSysName,oo.FOrgId,oo.FNumber as FOrgNumber,ool.FName as FOrgName,krid.FYear as FYear,krid.FPeriod as FPeriod,
rpt.FNUMBER FReportNumber,rpt.FNAME FReportNname,rpt.FRPTTYPE,rpt.FCYCLEID,
krid.FSheetId,krid.FSheetName,krid.FROW,krid.FCOLUMN,bri.FNumber as FRptItemNumber,bril.FItemName as FRptItemName, bc.FNumber as FCyNumber,bc.FCode as FCyCode,bcl.FName as FCyName,bc.FAmountDigits as FMoneyAmountDigits, bau.FNumber as FCurrUnitNumber,baul.FName as FCurrUnitName, bridt.FNumber as FItemDataTypeNumber,bridtl.FName as FItemDataTypeName, krid.FAmount,krid.FModifyDate
from T_KDS_RptItemData krid
Left Join T_KDS_RPT rpt on rpt.FRPTID=krid.FRPTID --And rpt.FDOCUMENTSTATUS='C'
Left Join T_ORG_ACCOUNTSYSTEM oas on oas.FACCTSYSTEMID=krid.FACCTSYSTEMID
Left Join T_ORG_ACCOUNTSYSTEM_L oasl on oas.FACCTSYSTEMID=oasl.FACCTSYSTEMID And oasl.FLocaleId = 2052
Left Join T_Org_Organizations oo On oo.FOrgId = krid.FOrgId
Left Join T_Org_Organizations_l ool On oo.FOrgId = ool.FOrgId And ool.FLocaleId = 2052
Left Join T_BD_RptItem bri On krid.FRptItemId = bri.FItemId
Left Join T_BD_RptItem_l bril On bri.FItemId = bril.FItemId And bril.FLocaleId = 2052
Left Join T_BD_Currency bc On krid.FCurrencyId = bc.FCurrencyId
Left Join T_BD_Currency_l bcl On bcl.FCurrencyId = bc.FCurrencyId And bcl.FLocaleId = 2052
Left Join T_BD_AmountUnit bau On krid.FCurrUnitId = bau.FId
Left Join T_BD_AmountUnit_l baul On baul.FId = bau.FId And baul.FLocaleId = 2052
Left Join T_BD_RptItemDataType bridt On krid.FItemDataTypeId = bridt.FDataTypeId
Left Join T_BD_RptItemDataType_l bridtl On bridt.FDataTypeId = bridtl.FDataTypeId And bridtl.FLocaleId = 2052
where krid.FYEAR=2024 and krid.FPERIOD=3 and oo.FNUMBER='101'
order by krid.FITEMDATAID
```
通过调用报表API工具接口、数据库SQL语句查询,实现财务报表的数据查询
**1、调用报表API工具接口实现财务报表数据查询**引用类:```using Kingdee.BOS.WebApi.Client;using Newtonsoft.Json.Linq;```请求参数...
点击下载文档
本文2024-09-16 17:10:11发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-13970.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章