航天,百旺组件开票调用说明

调用方法一:(SHKJKP.dll) 
32位

functionSHKP(parameter:pansichar):pansichar;stdcall; external SHKJKP.dll';

64位平台

functionSHKP(parameter:pansichar):pansichar;stdcall; external SHKJKPx64.dll';

 

说明:不同的parameter功能传不同的值,下面为各功能的值。

相应文件可以在http://sh-gz.cn/下载

航天初始化:

'{"LX":"Of_Uninit"}'

'{"LX":"Of_init","QYSH":"企业税号","CERT":"12345678","FJH":"0"}'

JSON说明:企业税号,证书密码,分机号

 

百旺初始化

'{"LX":"of_bw_init","URL":"https://skfp.tax.sh.gov.cn/acceptFramework/UniAcceptService","JSPPASSWORD":"","ZSPASSWORD":"12345678"}'

JSON说明:税务局URL(参考百旺的参数设置),金税盘口令,证书口令

  初始化调用示例1: 传入参数:{"LX":"of_bw_init","JSPPASSWORD":"66666666","ZSPASSWORD":"12345678"}

  初始化返回值:  成功 {"Result":"1","Message":""}

                失败 {"Result":"0","Message":"失败说明"}

 

获取发票信息

'{"LX":"GetInfo","KPJLX":"0","FPZL":"41"}'

 

JSON说明:

开票机类型(0航天1百旺)、发票种类(0 专票,2 普票,51 电票,41卷式发票 12 机动车发票)

 调用示例1: 查询参数:{"LX":"GetInfo","KPJLX":"1","FPZL":"0"}

返回{"Result":"1","FPDM":"4400173130","FPHM":"4094639","COUNT":"79","Message":""}

 

开票

'{"LX":"KP","KPJLX":"0","FPZL":"41","TEST":"1","XML":"XML并且经过base64编码"}'

 

JSON说明:

开票机类型(0航天1百旺)、发票种类 (0 专票,2 普票,51 电票,41卷式发票 12 机动车发票),TEST 是否检验数据1不开票仅做数据检查、0直接开票,KP的xml数据

 开票调用示例1: 传入参数:

{"LX":"KP","KPJLX":"1","FPZL":"0","XML":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iR0IyMzEyIj8+DQo8Q29uZmlnPg0KICA8SW52b2ljZUxpc3Q+DQogICAgICAgIDxJbnZIZWFkIEludm9pY2VOdW1iZXI9IjQ5ODQwMzEwNTIwN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IiBBbW91bnQ9IjEwMCIgVGF4QW1vdW50PSI2IiBJblRheEFtb3VudD0iMTA2IiBUYXhSYXRlPSI2IiBJc0xpc3Rpbmc9IjAiIEpFRlM9IjAiIFJvd0NvdW50PSIwIiBSRVRDT0RFPSIwMDAwMDAzMiIgUkVUTVNHPSLLsL/YyeixuNC0t6LGscP3z7jKsdLss6MgIERpc2tFcnI6MDlkMTFmIi8+DQoJCTxJbnZEZXRhaWw+DQoJCQk8RGV0YWlsRW50cnkgUHJvZHVjdENvZGU9IjMwNDAyMDEwMyIgRW50cnlOdW1iZXI9IjEiIFByb2R1Y3ROYW1lPSK8vMr1t/7O8bfRIiBQcm9kdWN0TW9kZWw9ItX7zNciIFByb2R1Y3RVbml0PSLM1yIgVGF4UmF0ZT0iNiIgUXVhbnRpdHk9IjEiIFByaWNlPSIxMDAiIEhTREo9IjEwNiIgQW1vdW50PSIxMDAiIFRheEFtb3VudD0iNiIgUm93QXR0cmliPSIwIiBQcm9kdWN0VHlwZXM9IjQwMDEiIEZsYm09IjMwNDAyMDEwMzAwMDAwMDAwMDAiIFhzeWg9IjAiIExzbHZicz0iIiBZaHNtPSIiLz4NCgkJPC9JbnZEZXRhaWw+DQoJPC9JbnZvaWNlTGlzdD4NCjwvQ29uZmlnPg0K"}

 

作废

'{"LX":"ZF","KPJLX":"0","FPZL":"41","FPDM":"","FPHM":""}'

JSON说明:

开票机类型(0航天1百旺)、发票种类 (0 专票,2 普票,51 电票,41卷式发票 12 机动车发票)、发票代码,发票号码

  作废调用 示例1:

     传入参数{"LX":"ZF","KPJLX":"1","FPZL":"0","FPDM":"4400173130","FPHM":"04138547"}

     返回值  {"Result":"0","Message":"FPZF-ZF-不能作废发票或开具红字发票,原发票已开作废发票"}

打印发票

'{"LX":"PrintFP","KPJLX":"0","FPZL":"41","FPDM":"","FPHM":"","QDBZ":"","ISVISIBLE":""}'

JSON说明:

开票机类型(0航天1百旺)、发票种类(0 专票,2 普票,51 电票,41卷式发票 12 机动车发票),发票代码,发票号码,打印类型(0打印发票 1打印清单),是否显示打印设置窗口(0不显示 1显示)

   打印调用示例1:

           传入参数:

{"LX":"PrintFP","KPJLX":"1","FPZL":"0","FPDM":"4400173130","FPHM":"04138532","QDBZ":"0","ISVISIBLE":"0"}

           返回值  :{"Result":"1","Message":""}

调用方法二:采用OCX调用
COM名称:KPOCXDLL.KP

 

functionSHKP(const Param1: WideString): WideString; safecall;

调用方法三:在 B/S架构中,JS写法
myCst.CallFun('SHKJKP.dll','SHKP','{"LX":"Of_init","QYSH":"税号","CERT":"12345678","FJH":"0"}');

myCst.CallFun('SHKJKP.dll','SHKP',''{"LX":"Of_Uninit"}');

myCst.CallFun('SHKJKP.dll','SHKP',''{"LX":"of_bw_init","JSPPASSWORD":"","ZSPASSWORD":"12345678"}'

);

alert(myCst.CallFun('SHKJKP.dll','SHKP','{"LX":"GetInfo","KPJLX":"0","FPZL":"41"}'));

alert(myCst.CallFun('SHKJKP.dll','SHKP','{"LX":"KP","KPJLX":"0","FPZL":"41","XML":"XML并且经过base64编码"}'));

alert(myCst.CallFun('SHKJKP.dll','SHKP','{"LX":"ZF","KPJLX":"0","FPZL":"41","FPDM":"","FPHM":""}'));

alert(myCst.CallFun('SHKJKP.dll','SHKP','{"LX":"PrintFP","KPJLX":"0","FPZL":"41","FPDM":"","FPHM":"","QDBZ":"0","ISVISIBLE":"1"}'));

 

xml:说明:

  

        

        

            

        

  

如果是多张发票:那么就多个 InvoiceList节点,如果一张发票,多行明细,那么就多个 DetailEntry节点

 

名称

说明

是否可以为空

备注

默认值

InvoiceNumber

单据号

 

 

CustomerName

客户名称

 

 

CustomerTaxCode

客户税号

按税务规定,开具给企业的发票必需有税号

 

AddressAndPhone

客户地址电话

 

 

BankAndAccount

客户银行账号

 

 

KHSJ

客户手机

 

 

KHYJ

客户邮件

 

 

SellerBankName

销方银行账号

 

 

SellerAdrrPhone

销方地址和电话

 

 

SellerTaxCode

销方税号

 

 

FPZL

发票种类

 

 

InvoiceMemo

备注

 

 

KPR

开票人

 

 

SKR

收款人

 

 

FHR

复核人

 

 

FPHM

红冲发票原发票号

当发票种类是普票、电票、卷票、运输发票并且JEFS=1时,必需传原发票号过来

 

CHFPH

红字信息表编码

当发票种类是专票并且JEFS=1时,必需传红字信息表编号

 

Amount

整张发票不含税金额

等于 明细行的 Amount 之和

 

TaxAmount

整张发票税额

等于 明细行的 TaxAmount 之和

 

InTaxAmount

整张发票价税合计

等于 Amount+ TaxAmount

 

TaxRate

税率

可以是17,也可以是0.17,当明细行有多种税率时,必需是空

 

IsListing

是否强制开具清单

0 不进行强制,由系统自动处理,当超过8行明细时,系统自动出具清单。

1 进行强制转换成清单,强制转换后,没超过8行明细也会出具清单

0

JEFS

开具类型

0 正常发票 1 红字发票

0

RowCount

明细汇总行数

用固定值 0

0

明细字段说明

ProductCode

产品代码

 

 

EntryNumber

行号

从1开始算起

 

ProductName

产品名称

 

 

ProductModel

产品型号

 

 

ProductUnit

产品单位

 

 

TaxRate

税率

可以是17,也可以是0.17

 

Quantity

数量

当不需要打印数量时,传空

 

Price

不含税价

当不需要打印单价时,传空

 

HSDJ

含税价

当不需要打印单价时,传空

 

Amount

不含税金额

 

 

TaxAmount

税额

 

 

RowAttrib

行性质

正常行 :0 被折扣行 3 折扣行 4

 

ProductTypes

商品税目

4001代表是 商品销售

4001

Flbm

分类编码

 

 

Xsyh

税收优惠

无税收优惠0 有税收优惠1

 

Lslvbs

零税率标志

当税收优惠=1时 免税 1出口零税 0不征税 2 其它3,当税收优惠是0时,空

 

Yhsm

优惠说明

 

 

 

 

注意:如果红字 带清单的,只需要传一行明细, 产品名称必需是 详见对应正数发票及清单
--------------------- 
作者:f805122102 
来源:CSDN 
原文:https://blog.csdn.net/f805122102/article/details/80108194 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(财务软件)