using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        Wkpjk.Ifwkpjk_Wservice kpjk = new Wkpjk.Ifwkpjk_Wservice();
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            kpjk.Url = "http://127.0.0.1:8089/soap/Ifwkpjk_W";
        }
        private void button1_Click(object sender, EventArgs e)
        {


            tBx1.Text += "\r\n 税号信息：" + kpjk.kpjk1(24, "10,0");  //查询税号信息

            string s2 = "||";   /////////字段分隔符
            string s1;
            
            
            
            //注意： 明细条数、总金额、总税额
            

            s1 = "2" + s2 + "X150208001" + s2 + "123" + s2
                    + "开票测试1" + s2 + "310106666888866" + s2
                    + "购方地址电话123456" + s2 + "购方银行账号12345678" + s2
                    + "232" + s2 + "" + s2 + "" + s2
                    + "收款人" + s2 + "复核人" + s2
                    + "" + s2 + "商品1" + s2 + "8";

            tBx1.Text += "\r\n 导入主表：" + kpjk.kpjk1(1, s1);//////////////////////////////////////导入发票主表


            s1 = "开票测试\\n开票测试";
            tBx1.Text += "\r\n 导入备注：" + kpjk.kpjk1(2, s1);//////////////////////////////////////导入发票备注


            /////////////////////////////////////////导入发票明细
            //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 + "116" + s2 + "3" + s2
                    + "116" + s2 + "0.16" + s2 + "0" + s2
                    + "0" + s2 + "1" + s2 + "4001" + s2 + "1090602050000000000";

            tBx1.Text += "\r\n 导入明细：" + kpjk.kpjk1(3, s1);//////////////////////////////////////导入发票明细

            s1 = "001" + s2 + "商品2" + s2 + "ABC-456" + s2 + "pcs" + s2
                    + "10" + s2 + "10" + s2 + "0" + s2
                    + "100" + s2 + "0.16" + s2 + "16" + s2
                    + "0" + s2 + "2" + s2 + "4001" + s2 + "1090602050000000000";

            tBx1.Text += "\r\n 导入明细：" + kpjk.kpjk1(3, s1);//////////////////////////////////////导入发票明细


            tBx1.Text += "\r\n 导入发票：" + kpjk.kpjk1(4, "");//////////////////////////////////////导入发票





        }

        private void button2_Click(object sender, EventArgs e)
        {
            tBx1.Text += "\r\n 自动开票：" + kpjk.kpjk1(5, "") + "\r\n";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            tBx1.Text += "\r\n 切换发票：" + kpjk.kpjk1(15, "2");    //参数: 1.专用发票  2.普通发票  3.电子普通发票  4.收购发票  5.电子收购发票


        }

        private void button4_Click(object sender, EventArgs e)
        {
            string s1 = "开票测试\n开票测试";
            tBx1.Text += "\r\n 导入备注：" + kpjk.kpjk1(2, s1);//////////////////////////////////////导入发票备注

        }

        private void button15_Click(object sender, EventArgs e)
        {
             //////////////// 查询 销售单据  返回0未开发票 大于0 已开发票
            tBx1.Text += "\r\n 查询 销售单据：" + kpjk.kpjk1(25, "X190208001");

        }
    }
}
