VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "开票接口测试"
   ClientHeight    =   9360
   ClientLeft      =   75
   ClientTop       =   390
   ClientWidth     =   13980
   LinkTopic       =   "Form1"
   ScaleHeight     =   9360
   ScaleWidth      =   13980
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "切换发票"
      Height          =   375
      Left            =   5520
      TabIndex        =   5
      Top             =   120
      Width           =   1000
   End
   Begin VB.CommandButton Command4 
      Caption         =   "开具发票"
      Height          =   375
      Left            =   4080
      TabIndex        =   4
      Top             =   120
      Width           =   1000
   End
   Begin VB.CommandButton Command3 
      Caption         =   "导入折扣"
      Height          =   375
      Left            =   2640
      TabIndex        =   3
      Top             =   120
      Width           =   1000
   End
   Begin VB.CommandButton Command2 
      Caption         =   "导入明细"
      Height          =   375
      Left            =   1440
      TabIndex        =   2
      Top             =   120
      Width           =   1000
   End
   Begin VB.TextBox Tx1 
      Height          =   8175
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Text            =   "Form1.frx":0000
      Top             =   720
      Width           =   13695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "启动接口"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public WithEvents Kpjk As Nfwkpjk.JkinClass   ''''先引用 Nfwkpjk.tlb
Attribute Kpjk.VB_VarHelpID = -1



Private Sub Command1_Click()
Dim R As Long
   R = Kpjk.Xkpjk0                         '''//成功返回 0
   Tx1.Text = Tx1.Text & vbCrLf & R
End Sub


Private Sub Command2_Click()
'   //成功返回 0
'   /////////////////////////////导入发票主表
'   //0 明细条数,单据编号,购方编号
'   //3 购方名称,税号
'   //5 地址电话，银行账号
'   //7 金额,税额,税率
'   //10 收款人,复核人
'   //12 销方账号,主要商品名称
'   //14 清单模式(0~8 设定明细条数超过转清单，0 始终是清单模式)
'   //15 对应蓝字发票号码,对应蓝字发票代码
'   //17 ""
'   //18 0税类型  (0 0%   1 免税 2 不征税)

'   //注意： 明细条数、总金额、总税额

Dim S1 As String, S2 As String, R As Long
   
   S2 = Chr(29)
   
   S1 = "2" & S2 & "X150208001" & S2 & "123" & S2 _
      & "开票测试1" & S2 & "310106666888866" & S2 _
      & "购方地址电话123456" & S2 & "购方银行账号12345678" & S2 _
      & "200" & S2 & "34" & S2 & "0.17" & S2 _
      & "收款人" & S2 & "复核人" & S2 _
      & "" & S2 & "商品1" & S2 & "8"
      
   R = Kpjk.Xkpjk1(1, S1)  ''//////////////////////////////////////导入发票主表
   
   Tx1.Text = Tx1.Text & vbCrLf & "导入主表：" & R
   
   S1 = "开票测试"
   R = Kpjk.Xkpjk1(2, S1)  ''//////////////////////////////////////导入发票备注
   
   Tx1.Text = Tx1.Text & vbCrLf & "导入备注：" & R
   
   
'   /////////////////////////////////////////导入发票明细
'   //0 商品编号,商品名称，规格型号，计量单位
'   //4 数量,单价,含税标志(0-不含税单价 1-含税单价  2-不含税单价＋含税金额 3-含税单价＋含税金额)
'   //7 金额,税率,税额
'   //10 发票行性质,序号,商品税目  (发票行性质：0－正常发票行；3－被折扣行；4－折扣行)
'   //13 税务编码(19位)
'
'   //注意： 发票行性质,序号
   
   
   S1 = "001" & S2 & "商品1" & S2 & "ABC-123" & S2 & "pcs" & S2 _
      & "1" & S2 & "100" & S2 & "0" & S2 _
      & "100" & S2 & "0.17" & S2 & "17" & S2 _
      & "0" & S2 & "1" & S2 & "4001" & S2 & "1090602050000000000"
   
   R = Kpjk.Xkpjk1(3, S1)  ''//////////////////////////////////////导入发票明细
   Tx1.Text = Tx1.Text & vbCrLf & "导入明细：" & R
   
   S1 = "001" & S2 & "商品2" & S2 & "ABC-456" & S2 & "pcs" & S2 _
      & "10" & S2 & "10" & S2 & "0" & S2 _
      & "100" & S2 & "0.17" & S2 & "17" & S2 _
      & "0" & S2 & "2" & S2 & "4001" & S2 & "1090602050000000000"
   
   R = Kpjk.Xkpjk1(3, S1)  ''//////////////////////////////////////导入发票明细
   Tx1.Text = Tx1.Text & vbCrLf & "导入明细：" & R
   
   
   
   R = Kpjk.Xkpjk1(4, "")  ''//////////////////////////////////////导入发票
   Tx1.Text = Tx1.Text & vbCrLf & "导入发票：" & R
   
   

End Sub



Private Sub Command4_Click()
Dim R As Long
   R = Kpjk.Xkpjk1(5, "")  ''//////////////////////////////////////自动开票
   Tx1.Text = Tx1.Text & vbCrLf & "自动开票：" & R
   
End Sub

Private Sub Command5_Click()
Dim R As Long
   R = Kpjk.Xkpjk1(15, "2")  ''//////////////////////////////////////切换发票
   ''参数: 1.专用发票  2.普通发票  3.电子普通发票  4.收购发票  5.电子收购发票
   Tx1.Text = Tx1.Text & vbCrLf & "切换发票：" & R
End Sub

Private Sub Form_Load()
   Set Kpjk = New Nfwkpjk.JkinClass
End Sub


Private Sub Kpjk_OnCallback(ByVal Lx As Long, ByVal fphm As Long, ByVal fpdm As String, ByVal ds As String)
   Tx1.Text = Tx1.Text & vbCrLf & "回调：" & Str(Lx) & " -" & Str(fphm) & " - " & fpdm & " - " & ds
End Sub






