예제 #1
0
        public void OpenCard()
        {
            int    iResult = 0;
            string sRetMsg = "";

            MyTax.OpenCard();

            iResult = MyTax.RetCode;
            sRetMsg = MyTax.RetMsg;

            if (iResult == 1011)
            {
                _OpenTaxInfo.iInvLimit      = MyTax.InvLimit;
                _OpenTaxInfo.sTaxCode       = MyTax.TaxCode;
                _OpenTaxInfo.sMachineNo     = MyTax.MachineNo;
                _OpenTaxInfo.iIsInvEmpty    = MyTax.IsInvEmpty;
                _OpenTaxInfo.iIsRepReached  = MyTax.IsRepReached;
                _OpenTaxInfo.iIsLockReached = MyTax.IsLockReached;

                //查询库存发票

                MyTax.InfoKind = 0;
                MyTax.GetInfo();

                _StockTaxInfoPro.sInfoTypeCode = MyTax.InfoTypeCode;
                _StockTaxInfoPro.iInfoNumber   = MyTax.InfoNumber;
                _StockTaxInfoPro.iInvStock     = MyTax.InvStock;
                _StockTaxInfoPro.dTaxClock     = MyTax.TaxClock;

                MyTax.InfoKind = 2;
                MyTax.GetInfo();

                _StockTaxInfo.sInfoTypeCode = MyTax.InfoTypeCode;
                _StockTaxInfo.iInfoNumber   = MyTax.InfoNumber;
                _StockTaxInfo.iInvStock     = MyTax.InvStock;
                _StockTaxInfo.dTaxClock     = MyTax.TaxClock;
            }
            else
            {
                iResult = 1;
                sRetMsg = "金税卡打开失败!";
            }
        }
예제 #2
0
        private void btnSureList_Click(object sender, EventArgs e)
        {
            int    iResult    = 0;
            string sResultMsg = "";

            MyTax.OpenCard();

            iResult    = MyTax.RetCode;
            sResultMsg = MyTax.RetMsg;

            if (iResult == 1011)
            {
                iInvLimit      = MyTax.InvLimit;
                sTaxCode       = MyTax.TaxCode;
                sMachineNo     = MyTax.MachineNo;
                iIsInvEmpty    = MyTax.IsInvEmpty;
                iIsRepReached  = MyTax.IsRepReached;
                iIsLockReached = MyTax.IsLockReached;

                //查询库存发票
                MyTax.InfoKind = iInfoKind;
                MyTax.GetInfo();

                sInfoTypeCode = MyTax.InfoTypeCode;
                iInfoNumber   = MyTax.InfoNumber;
                iInvStock     = MyTax.InvStock;
                dTaxClock     = MyTax.TaxClock;


                lblNote.Text = "本单位税号:" + sTaxCode + "开票机号码:" + sMachineNo.ToString() + "发票库存:" + iInvStock.ToString();
                lblInfo.Text = "开票限额:" + iInvLimit.ToString() + (iIsInvEmpty == 0 ? ",金税卡无票可开" : ",金税卡有票可开") + (iIsRepReached == 0 ? ",未到抄税期" : ",已到抄税期") + (iIsLockReached == 0 ? ",未到锁死期" : ",已到锁死期");

                btnCloseCard.Enabled = true;
                btnSureList.Enabled  = false;
                txtBseqId.Enabled    = true;

                btnCancled.Enabled   = true;
                btnInvPrint.Enabled  = true;
                btnListPrint.Enabled = true;
                btnQuery.Enabled     = true;
                cbbInvType.Enabled   = false;
            }
            else
            {
                MessageBox.Show(sResultMsg);
            }
        }
예제 #3
0
        public void invok(string msg)
        {
            String GS = GT.RetCode.ToString();

            if (GS.Equals("1011"))
            {
                GT.InvInfoInit();    //初始化
                GT.InfoKind      = 2;
                GT.SellerAddress = "2";
                // GT.InfoTypeCode = "6500143320"; //发票类别
                GT.GetInfo();


                //textBox2.Text = GT.InfoTypeCode;

                //textBox1.Text = GT.InfoNumber.ToString();

                GT.InfoClientName         = "开票企业名称";          //购方名称
                GT.InfoClientTaxCode      = "650105999990003"; //购方税号
                GT.InfoClientBankAccount  = "246234524";       //购方开户账号
                GT.InfoClientAddressPhone = "新疆";              //购方地址
                //GT.InfoSellerBankAccount = ""; //销方开户行
                GT.InfoSellerAddressPhone = "";                //销方地址
                GT.InfoTaxRate            = 3;                 //税率
                GT.InfoNotes    = "新A79972";                   //备注
                GT.InfoInvoicer = "admin";                     //开票人
                GT.InfoChecker  = "崔杰";                        //复核人
                GT.InfoCashier  = "崔浩";                        //收款人
                //GT.InfoListName = "详见销货清单";
                //明细数据\
                GT.ClearInvList();

                GT.InvListInit();    //初始化明细

                //if ("是否含税" == "含税")
                //    {
                //        GT.ListPriceKind = 1;
                //    }
                //    else
                //    {
                //        GT.ListPriceKind = 0;
                //    }
                GT.ListPriceKind = 1;

                GT.ListGoodsName = "细绒棉";  //名称
                GT.ListStandard  = "3128"; //规格
                GT.ListUnit      = "KG";   //规格

                GT.ListNumber = 2;         //数量
                GT.ListPrice  = 100;       //单价
                GT.ListAmount = 200;       //金额


                GT.AddInvList();

                GT.Invoice();    //发票开具

                //textBox3.Text = GT.InfoNumber.ToString();

                if (GT.RetCode.ToString() == "4001")    // 传入发票数据不合法
                {
                    //"传入发票数据不合法", "信息提示";
                }
                else if (GT.RetCode.ToString() == "4002")    //开票前金税卡状态错误
                {
                    // MessageBox.Show("开票前金税卡状态错误", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //保存发票ToolStripMenuItem.Enabled = false;
                }
                else if (GT.RetCode.ToString() == "4003")    //金税卡开票调用错误
                {
                    //  MessageBox.Show("金税卡开票调用错误,请确认组件版本号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //保存发票ToolStripMenuItem.Enabled = false;
                }
                else if (GT.RetCode.ToString() == "4004")    //开票后金税卡状态错误
                {
                    // MessageBox.Show("开票后金税卡状态错误", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //保存发票ToolStripMenuItem.Enabled = false;
                }
                else if (GT.RetCode.ToString() == "4011")    //开票成功
                {
                    GT.GoodsListFlag = 0;
                    GT.PrintInv();

                    if (GT.RetCode == 5001)
                    {
                        //  MessageBox.Show("发票打印失败,失败原因:未找到发票,请先保存发票", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (GT.RetCode == 5011)
                    {
                        //  MessageBox.Show("发票打印成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //if (GetFPStyle == "发票")
                        //{
                        //    toolStripButton2_Click(null, null);
                        //}
                    }
                    else if (GT.RetCode == 5012)
                    {
                        // MessageBox.Show("发票打印失败,失败原因:未打印", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (GT.RetCode == 5013)
                    {
                        // MessageBox.Show("发票打印失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
예제 #4
0
        // 提交数据到后台服务器
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            //如果数据有错,提示不能保存
            GeneralObject kbfee = kbfee1.DataContext as GeneralObject;

            if (kbfee.HasErrors)
            {
                MessageBox.Show("输入数据有错,请检查!");
                return;
            }
            GeneralObject loginUser = (GeneralObject)FrameworkElementExtension.FindResource(this, "LoginUser");

            if (loginUser == null)
            {
                MessageBox.Show("无法获取当前登陆用户信息,请重新登陆后操作!");
                return;
            }
            //查询金税盘发票信息
            GoldTax tax = (GoldTax)(from r in loader.Res where r.Name.Equals("tax") select r).First();

            if (!tax.GetInfo())
            {
                return;
            }
            string loginid    = (string)loginUser.GetPropertyValue("id");
            string orgpathstr = (string)loginUser.GetPropertyValue("orgpathstr");

            //显示正在工作
            busy.IsBusy = true;
            string handids = "";

            //获得当前交费的欠费id
            foreach (GeneralObject item in dataGrid1.ItemsSource)
            {
                bool ischeck = (bool)item.IsChecked;
                if (ischeck)
                {
                    string id = item.GetPropertyValue("id") + "";
                    handids = id + "," + handids;
                }
            }
            if (handids == "")
            {
                handids = "0";
            }
            else
            {
                handids = handids.Substring(0, handids.Length - 1);
            }
            //发票号
            string f_invoicenum = kbfee.GetPropertyValue("f_invoicenum") + "";

            if (string.IsNullOrEmpty(f_invoicenum))
            {
                f_invoicenum = "0";
            }
            //获取基础地址
            WebClientInfo wci = (WebClientInfo)Application.Current.Resources["server"];

            // 提交
            string str = wci.BaseAddress + "/sell/" + ui_userid.Text + "/" + shoukuan.Text + "/"
                         + ui_zhinajin.Text + "/" + f_payment.SelectedValue + "/" + loginid + "/" + orgpathstr + "/" + handids + "/" + f_invoicenum + "?uuid=" + System.Guid.NewGuid().ToString();

            Uri       uri    = new Uri(str);
            WebClient client = new WebClient();

            client.DownloadStringCompleted += client_DownloadStringCompleted;
            client.DownloadStringAsync(uri);
        }