예제 #1
0
        private void InvPrint(Int32 iInfoNumber, string sInfoTypeCode, short iGoodsListFlag = 0, short iInfoShowPrtDlg = 1)
        {
            iResult = 0;

            MyTax.InfoTypeCode   = sInfoTypeCode;
            MyTax.InfoNumber     = iInfoNumber;
            MyTax.GoodsListFlag  = iGoodsListFlag;
            MyTax.InfoShowPrtDlg = iInfoShowPrtDlg;

            MyTax.PrintInv();

            iResult = MyTax.RetCode;

            if ((MyTax.RetCode != 5011) && (MyTax.RetCode != 5001) && (MyTax.RetCode != 5012) && (MyTax.RetCode != 5013))
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印失败,其他原因!"; iResult = 1;
            }

            if (MyTax.RetCode == 5001)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 未找到发票或清单"; iResult = 1;
            }
            if (MyTax.RetCode == 5011)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印成功"; iResult = 0;
            }
            if (MyTax.RetCode == 5012)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 未打印"; iResult = 0;
            }
            if (MyTax.RetCode == 5013)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印失败"; iResult = 1;
            }
        }
예제 #2
0
        private void btnInvPrint_Click(object sender, EventArgs e)
        {
            int iResult    = 0;
            int iRetrun    = 0;
            int iInvNumber = 0;

            iCurrentItemId = gridView1.FocusedRowHandle;
            DataRow row = gridView1.GetDataRow(iCurrentItemId);

            iInvNumber = Convert.ToInt32(row["INVOICENO"]);

            MyTax.InfoKind       = iInfoKind;
            MyTax.InfoTypeCode   = Convert.ToString(row["INVOICECODE"]);
            MyTax.InfoNumber     = iInvNumber;
            MyTax.GoodsListFlag  = 0;
            MyTax.InfoShowPrtDlg = 1;

            MyTax.PrintInv();

            iResult = MyTax.RetCode;

            if ((MyTax.RetCode != 5011) && (MyTax.RetCode != 5001) && (MyTax.RetCode != 5012) && (MyTax.RetCode != 5013))
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印失败,其他原因!"; iRetrun = 1;
            }

            if (MyTax.RetCode == 5001)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 未找到发票或清单"; iRetrun = 1;
            }
            if (MyTax.RetCode == 5011)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印成功"; iRetrun = 0;
            }
            if (MyTax.RetCode == 5012)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 未打印"; iRetrun = 0;
            }
            if (MyTax.RetCode == 5013)
            {
                sRetMsg = MyTax.RetCode.ToString() + " 打印失败"; iRetrun = 1;
            }

            MessageBox.Show(sRetMsg);
        }
예제 #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
        public int InvoiceBill()
        {
            //MyTax
            //int iRetCode = 0;
            sRetInfoTypeCode = "0";
            sRetInfoNumber   = 0;

            MyTax.InfoKind = iInfoKind;
            int iRetrun = 0;

            if (iCurrentItemId != -1)
            {
                fGetDetailCount(iCurrentItemId);
                InvoiceBillHeader(iCurrentItemId);
                if (InvoiceBillDetail(iCurrentItemId) == 1)
                {
                    return(1);
                }

                int iRetCode = 0;
                MyTax.Invoice();
                iRetCode = MyTax.RetCode;

                if (iRetCode == 4011)
                {
                    dRetInfoAmount    = MyTax.InfoAmount;
                    dRetInfoTaxAmount = MyTax.InfoTaxAmount;
                    dRetInfoInvDate   = MyTax.InfoDate;
                    dRetInfoMonth     = MyTax.InfoMonth;
                    sRetInfoTypeCode  = MyTax.InfoTypeCode;
                    sRetInfoNumber    = MyTax.InfoNumber;
                    sRetGoodsListFlag = MyTax.GoodsListFlag;

                    MyTax.GoodsListFlag = 0;
                    if (chkPrtDlg.Checked)
                    {
                        MyTax.InfoShowPrtDlg = 1;
                    }
                    else
                    {
                        MyTax.InfoShowPrtDlg = 0;
                    }

                    MyTax.PrintInv();

                    if ((MyTax.RetCode != 5001) && MyTax.RetCode != 5011 && MyTax.RetCode != 5012 && MyTax.RetCode != 5013)
                    {
                        sRetMsg = MyTax.RetCode.ToString() + " 打印失败:其他原因!"; iRetrun = 1; return(1);
                    }

                    if (MyTax.RetCode == 5001)
                    {
                        sRetMsg = MyTax.RetCode.ToString() + " 未找到发票或清单"; iRetrun = 1; return(1);
                    }
                    if (MyTax.RetCode == 5011)
                    {
                        sRetMsg = MyTax.RetCode.ToString() + " 打印成功"; iRetrun = 0;
                    }
                    if (MyTax.RetCode == 5012)
                    {
                        sRetMsg = MyTax.RetCode.ToString() + " 未打印"; iRetrun = 0; return(1);
                    }
                    if (MyTax.RetCode == 5013)
                    {
                        sRetMsg = MyTax.RetCode.ToString() + " 打印失败"; iRetrun = 1; return(1);
                    }
                }
                else
                {
                    sRetMsg = iRetCode.ToString() + " 开票失败";

                    if (iRetCode == 4001)
                    {
                        sRetMsg = iRetCode.ToString() + " 传入发票数据不合法"; return(1);
                    }
                    if (iRetCode == 4002)
                    {
                        sRetMsg = iRetCode.ToString() + " 开票前金税卡状态错"; return(1);
                    }
                    if (iRetCode == 4003)
                    {
                        sRetMsg = iRetCode.ToString() + " 金税卡开票调用错误"; return(1);
                    }
                    if (iRetCode == 4001)
                    {
                        sRetMsg = iRetCode.ToString() + " 开票后取金税卡状态错"; return(1);
                    }
                    if (iRetCode == 4012)
                    {
                        sRetMsg = iRetCode.ToString() + " 开票失败"; return(1);
                    }
                    if (iRetCode == 4013)
                    {
                        sRetMsg = iRetCode.ToString() + " 所开发票已作废"; return(1);
                    }

                    iRetrun = 1;
                }
            }
            return(iRetrun);
        }