Example #1
0
        private void Frm_registerOut_Load(object sender, EventArgs e)
        {
            rc001 = this.swapdata["RC001"].ToString();

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                txtEdit_rc303.EditValue = reader["RC303"];
                rg_rc002.EditValue      = reader["RC002"];
                rg_rc202.EditValue      = reader["RC202"];
                txtEdit_rc004.EditValue = reader["RC004"];
                txtEdit_rc404.EditValue = reader["RC404"];
                txtEdit_rc150.EditValue = reader["RC150"];                   //寄存到期日期
                be_position.EditValue   = RegisterAction.GetRegPathName(rc001);

                price = RegisterAction.GetBitPrice(reader["RC130"].ToString());
                txtEdit_price.EditValue = price;

                int diff = RegisterAction.CalcOutDiffDays(rc001);

                int compare = string.Compare(Convert.ToDateTime(reader["RC150"]).ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"));
                if (compare == 0)
                {
                    checkEdit1.Enabled   = false;
                    txtEdit_nums.Enabled = false;
                }
                else if (compare > 0)                  //退费
                {
                    lc_1.Text = "剩余天数";
                    lc_2.Text = "应退费年份(年限)";
                    lc_3.Text = "退费金额";
                    isrefund  = true;
                    ///佳木斯东郊不用退费
                    txtEdit_nums.EditValue = 0;
                    txtEdit_fee.EditValue  = 0;
                }
                else
                {
                    lc_1.Text = "过期天数";
                    lc_2.Text = "应补费年份(年限)";
                    lc_3.Text = "补费金额";

                    txtEdit_nums.EditValue = Math.Round((diff * 1.0f) / 365, 2);
                    txtEdit_fee.EditValue  = Convert.ToDecimal(Math.Round((diff * 1.0f) / 365, 2)) * price;
                }


                txtEdit_diff.EditValue = diff;
            }

            ////是否允许取消迁出补退 /////
            //if(Tools.GetRight(Envior.cur_userId,"02070") == "0")
            //{
            checkEdit1.Enabled = false;
            //}
        }
Example #2
0
        private void Frm_RegisterPay_Load(object sender, EventArgs e)
        {
            string s_rc130 = string.Empty;

            rc001 = this.swapdata["RC001"].ToString();

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                txtEdit_rc303.EditValue = reader["RC303"];
                txtEdit_rc004.EditValue = reader["RC004"];
                txtEdit_rc404.EditValue = reader["RC404"];
                rg_rc002.EditValue      = reader["RC002"];
                rg_rc202.EditValue      = reader["RC202"];
                be_position.Text        = RegisterAction.GetRegPathName(rc001);

                s_rc130  = reader["RC130"].ToString();
                bitprice = Convert.ToDecimal(SqlAssist.ExecuteScalar("select bi009 from bi01 where bi001='" + s_rc130 + "'", null));
                txtedit_price.EditValue = bitprice;
            }

            rc04Adapter.SelectCommand.CommandText = "select * from v_rc04 where rc001='" + rc001 + "' order by rc020";
            rc04Adapter.Fill(dt_rc04);
            gridControl1.DataSource = dt_rc04;

            comboBox1.Text = "";
        }
Example #3
0
        /// <summary>
        /// 打印财政发票
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int rowHandle = gridView1.FocusedRowHandle;

            if (rowHandle >= 0)
            {
                if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(0, 1) == "1")
                {
                    string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();
                    //如果是新接口上线前开具的发票,不能打印
                    if (MiscAction.FinRefundBeforeOnline(s_fa001))
                    {
                        XtraMessageBox.Show("此笔收费财政发票为新接口上线前开具,不能通过新接口打印!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                        return;
                    }

                    OracleDataReader reader = SqlAssist.ExecuteReader("select INVOICENO,INVOICEZCH from fin_log where settleId ='" + s_fa001 + "'");
                    if (reader.HasRows && reader.Read())
                    {
                        string s_batch_code = reader["INVOICEZCH"].ToString();
                        string s_billno     = reader["INVOICENO"].ToString();
                        reader.Dispose();
                        if (XtraMessageBox.Show("打印财政发票?\r\n" + "注册号:" + s_batch_code + "\r\n" + "发票号:" + s_billno, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            FinInvoice.PrintInvoice(s_batch_code, s_billno);
                        }
                    }
                }
                else
                {
                    XtraMessageBox.Show("当前收费记录未开财政发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #4
0
        private void Frm_RegEdit_Load(object sender, EventArgs e)
        {
            ac001       = this.swapdata["AC001"].ToString();
            register_ds = this.swapdata["dataset"] as Register_ds;

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + ac001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.EditValue = reader["RC001"];
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                txtEdit_rc303.EditValue = reader["RC303"];
                be_position.EditValue   = RegisterAction.GetRegPathName(ac001);

                rg_rc002.EditValue      = reader["RC002"];
                rg_rc202.EditValue      = reader["RC202"];
                txtEdit_rc004.EditValue = reader["RC004"];
                txtEdit_rc404.EditValue = reader["RC404"];
                txtedit_rc014.EditValue = reader["RC014"];
                txtEdit_rc050.EditValue = reader["RC050"];
                txtEdit_rc051.EditValue = reader["RC051"];
                lookUp_rc052.EditValue  = reader["RC052"];
                txtEdit_ac055.EditValue = reader["RC055"];
                mem_rc099.EditValue     = reader["RC099"];
            }

            lookUp_rc052.Properties.DataSource    = register_ds.Relation;
            lookUp_rc052.Properties.ValueMember   = "ST003";
            lookUp_rc052.Properties.DisplayMember = "ST003";
        }
Example #5
0
        private void Frm_registerOut_Load(object sender, EventArgs e)
        {
            rc001 = this.swapdata["RC001"].ToString();
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];                              //寄存证号
                txtEdit_rc003.EditValue = reader["RC003"];                              //逝者姓名
                txtEdit_rc303.EditValue = reader["RC303"];                              //逝者姓名2
                rg_rc002.EditValue      = reader["RC002"];                              //性别
                rg_rc202.EditValue      = reader["RC202"];                              //性别2
                txtEdit_rc004.EditValue = reader["RC004"];                              //年龄
                txtEdit_rc404.EditValue = reader["RC404"];
                txtEdit_rc150.EditValue = reader["RC150"];                              //寄存到期日期
                be_position.EditValue   = RegisterAction.GetRegPathName(rc001);

                //price = Math.Round(  RegisterAction.GetBitPrice(reader["RC130"].ToString()) / 12, 0);
                price = RegisterAction.GetBitPrice(reader["RC130"].ToString());
                txtEdit_price.EditValue = price;

                //比较到期日期 (判断是否应该补或退)
                compare = string.Compare(Convert.ToDateTime(reader["RC150"]).ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"));

                //设置补退信息
                this.SetBTInfo();
            }


            //TODO 5. 根据权限设置 是否允许补退费
            checkEdit1.Enabled = true;
        }
Example #6
0
 private void Frm_bookinDelay_Load(object sender, EventArgs e)
 {
     s_bk001 = this.swapdata["bk001"].ToString();
     using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from bk01 where bk001='" + s_bk001 + "'"))
     {
         if (reader.Read())
         {
             be_position.Text = MiscAction.GetTombPosition(reader["BI001"].ToString());
         }
     }
 }
Example #7
0
        /// <summary>
        /// 业务初始化
        /// </summary>
        public override void Business_Init()
        {
            //获取逝者编号
            AC001 = this.swapdata["parm"].ToString();

            //填充逝者个人信息
            parm1.Value = AC001;
            parm2.Value = AC001;

            reader = SqlAssist.ExecuteReader("select * from v_ac01 where ac001 = :ac001", new OracleParameter[] { parm2 });


            if (!reader.HasRows)
            {
                XtraMessageBox.Show("参数传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            reader.Read();

            txtedit_ac001.EditValue = AC001;
            txtedit_ac003.EditValue = reader["AC003"];              //逝者姓名
            txtedit_ac004.EditValue = reader["AC004"];              //年龄
            rg_ac002.EditValue      = reader["AC002"];              //性别
            txtedit_ac020.EditValue = reader["AC020"];              //到达中心时间
            txtedit_ac050.EditValue = reader["AC050"];              //联系人
            txtedit_ac051.EditValue = reader["AC051"];              //电话
            txtedit_ac052.Text      = reader["AC052"].ToString();   //与逝者关系

            this.Parent.Text = "火化业务办理" + "【" + reader["AC003"] + "】";

            reader.Dispose();

            //读入照片
            if (MiscAction.HasIDC(AC001))
            {
                OracleDataReader photo_reader = SqlAssist.ExecuteReader("select ic020 from ic01 where ic000 = '0' and ac001 ='" + AC001 + "'");
                if (photo_reader.HasRows && photo_reader.Read())
                {
                    MemoryStream ms        = new MemoryStream((byte[])photo_reader["IC020"]); //把照片读到MemoryStream里
                    Image        imageBlob = Image.FromStream(ms, true);                      //用流创建Image
                    pictureEdit1.Image = imageBlob;                                           //输出图片
                }
                photo_reader.Dispose();
            }
            else
            {
                pictureEdit1.Image = null;
            }

            ///刷新销售数据
            this.RefreshSalesData();
        }
Example #8
0
        private void Frm_invoiceLog_Load(object sender, EventArgs e)
        {
            s_fa001       = this.swapdata["fa001"].ToString();
            te_fa001.Text = s_fa001;

            using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from fa01 where fa001='" + s_fa001 + "'"))
            {
                if (reader.Read())
                {
                    s_fa190       = reader["FA190"].ToString();
                    s_fa195       = reader["FA195"].ToString();
                    te_fa003.Text = reader["FA003"].ToString();

                    //计算财政票据金额
                    te_fin.Text = SqlAssist.ExecuteScalar("select nvl(sum(sa007),0) from v_sa01 where sa020 ='F' and sa010 ='" + s_fa001 + "'").ToString();
                    //计算税务票据金额
                    te_tax.Text = SqlAssist.ExecuteScalar("select nvl(sum(sa007),0) from v_sa01 where sa020 ='T' and sa010 ='" + s_fa001 + "'").ToString();

                    if (!s_fa190.Equals(s_fa195))  //应开、已开不相等
                    {
                        if (s_fa195.Substring(0, 1) == s_fa190.Substring(0, 1))
                        {
                            xtraTabPage1.PageEnabled = false;
                        }
                        else
                        {
                            //te_pjlx.Text = Envior.FIN_INVOICE_TYPE;  //财政票据类型
                            //te_zch.Text = GetZch();
                        }

                        if (s_fa195.Substring(1, 1) == s_fa190.Substring(1, 1))
                        {
                            xtraTabPage2.PageEnabled = false;
                        }
                        else
                        {
                            te_tax_code.Text = GetFPDM();
                        }

                        if (!xtraTabPage1.PageEnabled && xtraTabPage2.PageEnabled)
                        {
                            xtraTabControl1.SelectedTabPage = xtraTabPage2;
                        }
                    }
                    else
                    {
                        xtraTabPage1.PageEnabled = false;
                        xtraTabPage2.PageEnabled = false;
                        b_ok.Enabled             = false;
                    }
                }
            }
        }
Example #9
0
        private void Frm_AdjustRegisterDate_Load(object sender, EventArgs e)
        {
            s_ac001 = this.swapdata["AC001"].ToString();
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + s_ac001 + "'");

            while (reader.Read())
            {
                txtEdit_rc003.EditValue = reader["RC003"];
                txtedit_pos.Text        = RegisterAction.GetRegPathName(s_ac001);
                de_begin.EditValue      = reader["RC140"];
                de_end.EditValue        = reader["RC150"];
            }
        }
Example #10
0
        private void Frm_RegisterPay_Load(object sender, EventArgs e)
        {
            string s_rc130 = string.Empty;

            rc001 = this.swapdata["RC001"].ToString();

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                txtEdit_rc303.EditValue = reader["RC303"];
                txtEdit_rc004.EditValue = reader["RC004"];
                txtEdit_rc404.EditValue = reader["RC404"];
                rg_rc002.EditValue      = reader["RC002"];
                rg_rc202.EditValue      = reader["RC202"];
                be_position.Text        = RegisterAction.GetRegPathName(rc001);

                s_rc130  = reader["RC130"].ToString();
                bitprice = Convert.ToDecimal(SqlAssist.ExecuteScalar("select bi009 from bi01 where bi001='" + s_rc130 + "'", null));
                txtedit_price.EditValue = bitprice;

                //如果最后缴费日期 大于 2018-01-01 则无需混合价格
                if (string.Compare(Convert.ToDateTime(reader["RC150"]).ToString("yyyyMMdd"), "20180101") > 0)
                {
                    checkEdit1.Enabled = false;
                }
                else
                {
                    oldprice = RegisterAction.GetLastRegPrice(rc001);
                }
            }
            reader.Dispose();

            rc04Adapter.SelectCommand.CommandText = "select * from v_rc04 where rc001='" + rc001 + "' order by rc020";
            rc04Adapter.Fill(dt_rc04);
            gridControl1.DataSource = dt_rc04;

            fpAdapter.Fill(dt_fpsource);
            lookup_sa004.DataSource    = dt_fpsource;
            lookup_sa004.DisplayMember = "ITEM_TEXT";
            lookup_sa004.ValueMember   = "ITEM_ID";

            sa01Adapter.Fill(dt_sa01);
            gridControl2.DataSource = dt_sa01;

            //comboBox1.Text = "";
            this.Calc_Hj(12);
        }
Example #11
0
        private void Frm_Register_Load(object sender, EventArgs e)
        {
            register_ds = this.swapdata["dataset"] as Register_ds;
            source      = this.swapdata["source"].ToString();

            if (source == "0")              //本馆火化寄存
            {
                ac001 = this.swapdata["AC001"].ToString();
                OracleDataReader reader = SqlAssist.ExecuteReader("select * from ac01 where ac001='" + ac001 + "'");
                while (reader.Read())
                {
                    txtEdit_rc001.EditValue = reader["AC001"];
                    txtEdit_rc003.EditValue = reader["AC003"];
                    rg_rc002.EditValue      = reader["AC002"];
                    txtEdit_rc004.EditValue = reader["AC004"];
                    txtedit_rc014.EditValue = reader["AC014"];
                    txtEdit_rc050.EditValue = reader["AC050"];
                    txtEdit_rc051.EditValue = reader["AC051"];
                    lookUp_rc052.EditValue  = reader["AC052"];
                    txtEdit_ac055.EditValue = reader["AC055"];
                }
            }

            lookup_sa004.DataSource    = register_ds.Jcfp;
            lookup_sa004.DisplayMember = "ITEM_TEXT";
            lookup_sa004.ValueMember   = "ITEM_ID";

            lookUp_rc052.Properties.DataSource    = register_ds.Relation;
            lookUp_rc052.Properties.ValueMember   = "ST003";
            lookUp_rc052.Properties.DisplayMember = "ST003";

            register_ds.Sa01.Rows.Clear();
            gridControl1.DataSource = register_ds.Sa01;

            //寄存所属套餐
            DataRow dr_new = null;

            foreach (DataRow r in register_ds.RegCombo.Rows)
            {
                dr_new          = register_ds.Sa01.NewRow();
                dr_new["SA004"] = r["CB021"];                   //商品或服务编号
                dr_new["PRICE"] = MiscAction.GetItemFixPrice(r["CB021"].ToString());
                dr_new["NUMS"]  = r["CB030"];
                dr_new["SA007"] = Convert.ToDecimal(dr_new["PRICE"]) * Convert.ToInt32(dr_new["NUMS"]);

                fpfee += Convert.ToDecimal(dr_new["SA007"]);
                register_ds.Sa01.Rows.Add(dr_new);
            }
            this.CalcHJ();
        }
Example #12
0
        private void Frm_RegisterMove_Load(object sender, EventArgs e)
        {
            rc001 = this.swapdata["RC001"].ToString();

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                bitId_Old             = reader["RC130"].ToString();
                be_position.EditValue = RegisterAction.GetRegPathName(rc001);
            }
        }
Example #13
0
        /// <summary>
        /// 发票作废
        /// </summary>
        /// <param name="fa001"></param>
        /// <returns></returns>
        public static int InvoiceRemoved(string fa001)
        {
            OracleDataReader reader = SqlAssist.ExecuteReader("select INVOICENO,INVOICEZCH from fin_log where settleId ='" + fa001 + "'");

            if (reader.HasRows && reader.Read())
            {
                string s_batch_code = reader["INVOICEZCH"].ToString();
                string s_billno     = reader["INVOICENO"].ToString();
                reader.Dispose();
                return(InvoiceRemoved(s_batch_code, s_billno));
            }
            else
            {
                XtraMessageBox.Show("未找到财政发票日志!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(0);
            }
        }
Example #14
0
        /// <summary>
        /// 打印税票清单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!AppAction.CheckRight("补打发票"))
            {
                return;
            }

            string s_fa001 = string.Empty;
            int    rowHandle;

            if (tabPane1.SelectedPageIndex == 0)
            {
                rowHandle = gridView1.FocusedRowHandle;
                if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(1, 1) == "0")
                {
                    XtraMessageBox.Show("当前收费记录未开具税务发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();
            }
            else if (tabPane1.SelectedPageIndex == 1)
            {
                rowHandle = gridView3.FocusedRowHandle;
                if (gridView3.GetRowCellValue(rowHandle, "BILLTYPE").ToString() == "F")
                {
                    XtraMessageBox.Show("当前发票为财政发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                s_fa001 = gridView3.GetRowCellValue(rowHandle, "FA001").ToString();
            }
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from tax_log where settleId='" + s_fa001 + "'");

            {
                reader.Read();
                string s_fpdm = reader["INVOICECODE"].ToString();
                string s_fphm = reader["INVOICENUM"].ToString();
                if (XtraMessageBox.Show("发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm + "\r\n是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    TaxInvoice.PrintInvoice(s_fa001, "1");
                }
            }
            reader.Dispose();
        }
Example #15
0
        /// <summary>
        /// 购墓时必选项目
        /// </summary>
        private void AutoAdd()
        {
            using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from v_all_validitem where autochoose = '1' "))
            {
                SA01 sa01 = null;
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        sa01        = new SA01(unitOfWork1);
                        sa01.SA004  = reader["ITEM_ID"].ToString();
                        sa01.SA001  = MiscAction.GetEntityPK("SA01");
                        sa01.SA002  = '1';                              //销售项目类型 1 - 商品或服务
                        sa01.SA003  = reader["ITEM_NAME"].ToString();   //项目名称
                        sa01.STATUS = '1';
                        sa01.AC001  = s_ac001;                          //购墓流水号
                        sa01.SA005  = '0';                              //销售类型 0-购墓
                        sa01.SA008  = '0';                              //结算标志 0-未结算
                        sa01.SA100  = Envior.cur_userId;                //经办人
                        sa01.SA200  = Tools.GetServerDate();            //经办日期
                        sa01.SA025  = Convert.ToDecimal(reader["TAXRATE"]);

                        if (sa01.SA003 == "管理费")
                        {
                            sa01.NUMS = MiscAction.GetSysParaValue1("MANAGEFEE_NUMS");
                        }
                        else
                        {
                            sa01.NUMS = 1;
                        }

                        sa01.PRICE = Convert.ToDecimal(reader["PRICE"]);//单价
                        sa01.SA007 = sa01.PRICE * sa01.NUMS;
                        sa01.SA006 = sa01.PRICE;

                        xpCollection_sa01.Add(sa01);
                    }
                }
            }
        }
Example #16
0
        /// <summary>
        /// 打印发票
        /// </summary>
        /// <param name="fa001"></param>
        /// <returns></returns>
        public static int PrintInvoice(string fp001, string dylx)
        {
            string          s_fphm   = string.Empty;
            OracleParameter op_fp001 = new OracleParameter("fp001", OracleDbType.Varchar2, 10);

            op_fp001.Direction = ParameterDirection.Input;
            op_fp001.Value     = fp001;
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from fp01 where fp001 = :fp001", new OracleParameter[] { op_fp001 });

            reader.Read();
            if (reader.HasRows)
            {
                //查询发票代码和发票号码
                string s_fpdm = reader["INVOICECODE"].ToString();
                s_fphm = reader["INVOICENUM"].ToString();
                return(PrintInvoice(s_fpdm, s_fphm, dylx));
            }
            else
            {
                XtraMessageBox.Show("未找到开票记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(-1);
            }
        }
Example #17
0
        /// <summary>
        /// 打印发票清单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem30_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int    rowHandle = gridView1.FocusedRowHandle;
            int    papers    = 0;
            string s_fa001   = string.Empty;

            if (rowHandle >= 0)
            {
                s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();
                papers  = BusinessAction.GetHaveInvoicePapers(s_fa001);
                if (papers == 0)
                {
                    Tools.msg(MessageBoxIcon.Exclamation, "提示", "此收费记录尚未开具发票!");
                    return;
                }
                else if (papers == 1)  //一张发票
                {
                    using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from fp01 where fa001='" + s_fa001 + "' and flag = '1' and rownum < 2"))
                    {
                        reader.Read();
                        string s_fpdm = reader["INVOICECODE"].ToString();
                        string s_fphm = reader["INVOICENUM"].ToString();
                        if (XtraMessageBox.Show("发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm + "\r\n是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            TaxInvoice.PrintInvoice(s_fpdm, s_fphm, "1");
                        }
                    }
                }
                else if (papers > 1)   //多张发票
                {
                    Frm_InvoiceDisplay frm_1 = new Frm_InvoiceDisplay();
                    frm_1.swapdata["fa001"] = s_fa001;
                    frm_1.ShowDialog();
                    frm_1.Dispose();
                }
            }
        }
Example #18
0
        /// <summary>
        /// 业务初始化
        /// </summary>
        public override void Business_Init()
        {
            //获取逝者编号
            AC001 = this.swapdata["parm"].ToString();

            //填充逝者个人信息
            parm1.Value = AC001;
            parm2.Value = AC001;

            reader = SqlAssist.ExecuteReader("select * from v_ac01 where ac001 = :ac001", new OracleParameter[] { parm2 });


            if (!reader.HasRows)
            {
                XtraMessageBox.Show("参数传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            reader.Read();

            txtedit_ac001.EditValue = AC001;
            txtedit_ac003.EditValue = reader["AC003"];              //逝者姓名
            txtedit_ac004.EditValue = reader["AC004"];              //年龄
            rg_ac002.EditValue      = reader["AC002"];              //性别
            txtedit_ac020.EditValue = reader["AC020"];              //到达中心时间
            txtedit_ac050.EditValue = reader["AC050"];              //联系人
            txtedit_ac051.EditValue = reader["AC051"];              //电话
            txtedit_ac052.Text      = reader["AC052"].ToString();   //与逝者关系

            this.Parent.Text = "火化业务办理" + "【" + reader["AC003"] + "】";

            reader.Dispose();

            ///刷新销售数据
            this.RefreshSalesData();
        }
Example #19
0
        private void Frm_InvoiceInfo_Load(object sender, EventArgs e)
        {
            ///设置检索参数
            fa001 = this.swapdata["FA001"].ToString();
            op_fa001.Direction = ParameterDirection.Input;
            op_fa001.Value     = fa001;
            this.Text          = "发票信息【流水号" + fa001 + "】";

            ////检索结算信息
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from v_financeday where fa001='" + fa001 + "'");

            reader.Read();
            if (reader.HasRows)
            {
                te_fa001.EditValue = reader["FA001"];
                te_fa002.EditValue = reader["FA002_TEXT"];
                te_fa003.EditValue = reader["GUYNAME"];
                te_fa100.EditValue = reader["HANDLER"];
            }

            adapter.SelectCommand.Parameters.Add(op_fa001);
            gridControl2.DataSource = dt_invoice;
            adapter.Fill(dt_invoice);
        }
Example #20
0
        /// <summary>
        /// 打印 火化、临时性销售发票
        /// </summary>
        /// <param name="settleId"></param>
        /// <param name="invClient"></param>
        public static void Print_Invoice(string settleId, InvoiceInfo invClient)
        {
            string s_tax_name = string.Empty;
            string s_nextNum  = GetTaxInvoiceNextNum();

            MessageBox.Show("下一张发票号:" + s_nextNum, "", MessageBoxButtons.OK, MessageBoxIcon.Information);


            OracleDataReader reader      = SqlAssist.ExecuteReader("select * from v_sa01 where sa010 ='" + settleId + "'");
            OracleDataReader itemTaxInfo = null;
            int i_counter = 0;

            ///1.设置发票整体信息
            Envior.mform.goldTax.InvInfoInit();                                             //发票信息初始化
            Envior.mform.goldTax.InfoKind = 2;                                              //发票类型 - 普通发票
            Envior.mform.goldTax.InfoSellerBankAccount  = MiscAction.GetTaxSellerBank();    //销方开户行及账号
            Envior.mform.goldTax.InfoSellerAddressPhone = MiscAction.GetTaxSellerAddress(); //销方地址电话
            Envior.mform.goldTax.InfoInvoicer           = Envior.cur_invoicer;              //开票人
            Envior.mform.goldTax.InfoCashier            = Envior.cur_invoicer;              //收款人
            Envior.mform.goldTax.InfoChecker            = Envior.cur_checker;               //复核人

            Envior.mform.goldTax.InfoClientName         = invClient.InfoClientName;         //客户名称
            Envior.mform.goldTax.InfoClientTaxCode      = invClient.InfoClientTaxCode;      //购方税号
            Envior.mform.goldTax.InfoClientBankAccount  = invClient.infoclientbankaccount;  //购方银行账号
            Envior.mform.goldTax.InfoClientAddressPhone = invClient.infoclientaddressphone; //购方地址电话

            Envior.mform.goldTax.InfoTaxRate    = 17;                                       //税率
            Envior.mform.goldTax.InfoBillNumber = settleId;                                 //销售单据编号

            Envior.mform.goldTax.ClearInvList();
            while (reader.Read())
            {
                Envior.mform.goldTax.InvListInit();

                if (reader["SA002"].ToString() == "08" || reader["SA003"].ToString().Contains("寄存费"))
                {
                    s_tax_name = GetRegLevel_TaxName(Convert.ToDecimal(reader["PRICE"]));
                    Envior.mform.goldTax.ListGoodsName = s_tax_name;
                    Envior.mform.goldTax.InfoTaxRate   = 0;
                    Envior.mform.goldTax.ListNumber    = Convert.ToDouble(reader["NUMS"]);
                    Envior.mform.goldTax.ListPrice     = Convert.ToDouble(reader["PRICE"]);

                    Envior.mform.goldTax.ListPriceKind = 1;                           //含税价标志,单价和金额的种类, 0 为不含税价,1 为含税价
                    Envior.mform.goldTax.AddInvList();
                }
                else
                {
                    itemTaxInfo = SqlAssist.ExecuteReader("select * from v_allItem where item_id ='" + reader["SA004"].ToString() + "'");
                    if (itemTaxInfo.HasRows)
                    {
                        while (itemTaxInfo.Read())
                        {
                            if (string.IsNullOrEmpty(itemTaxInfo["TX003"].ToString()))
                            {
                                MessageBox.Show(reader["SA003"] + "未设置对应的税务项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                            else
                            {
                                s_tax_name = itemTaxInfo["TX003"].ToString();
                            }
                            Envior.mform.goldTax.ListGoodsName = s_tax_name;
                            Envior.mform.goldTax.InfoTaxRate   = Convert.ToSByte(itemTaxInfo["TX005"]);
                            Envior.mform.goldTax.ListNumber    = Convert.ToDouble(reader["NUMS"]);
                            Envior.mform.goldTax.ListPrice     = Convert.ToDouble(reader["PRICE"]);

                            Envior.mform.goldTax.ListPriceKind = 1;                                   //含税价标志,单价和金额的种类, 0 为不含税价,1 为含税价
                            Envior.mform.goldTax.AddInvList();
                        }
                    }
                }
                i_counter++;
            }

            if (i_counter > 7 /*AppInfo.TAXITEMCOUNT*/)
            {
                Envior.mform.goldTax.InfoListName = "商品服务项目清单" + settleId;                   //设置后才会打印清单
            }

            //开具发票
            Envior.mform.goldTax.Invoice();

            string s_invoice_code = string.Empty;
            int    i_invoice_num  = 0;

            if (Envior.mform.goldTax.RetCode == 4011)
            {
                s_invoice_code = Envior.mform.goldTax.InfoTypeCode;
                i_invoice_num  = Envior.mform.goldTax.InfoNumber;
                if (Tax_Log(settleId, s_invoice_code, i_invoice_num.ToString()) == 1)
                {
                    MessageBox.Show("开票成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                /////////////////////  打印发票  ///////////////////////////
                Envior.mform.goldTax.InfoKind       = 2;                                        //发票类型
                Envior.mform.goldTax.InfoTypeCode   = s_invoice_code;                           //发票代码
                Envior.mform.goldTax.InfoNumber     = i_invoice_num;                            //发票号
                Envior.mform.goldTax.InfoShowPrtDlg = 1;                                        //是否显示确认对话框
                Envior.mform.goldTax.GoodsListFlag  = 0;                                        //打印发票
                Envior.mform.goldTax.PrintInv();

                if (i_counter > 7 /*AppInfo.TAXITEMCOUNT*/)
                {
                    if (MessageBox.Show("是否打印发票清单?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Envior.mform.goldTax.InfoKind       = 2;                                        //发票类型
                        Envior.mform.goldTax.InfoTypeCode   = s_invoice_code;                           //发票代码
                        Envior.mform.goldTax.InfoNumber     = i_invoice_num;                            //发票号
                        Envior.mform.goldTax.InfoShowPrtDlg = 1;                                        //是否显示确认对话框
                        Envior.mform.goldTax.GoodsListFlag  = 1;                                        //打印清单
                        Envior.mform.goldTax.PrintInv();
                    }
                }
            }
            else
            {
                MessageBox.Show("错误代码:" + Envior.mform.goldTax.RetCode + "\n" + "错误信息:" + Envior.mform.goldTax.RetMsg, "开票失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #21
0
        /// <summary>
        /// 窗口装入事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_fireCheckin_Load(object sender, EventArgs e)
        {
            //获取传入 数据集
            checkin_ds = this.swapdata["dataset"] as Checkin_ds;
            action     = this.swapdata["action"].ToString();

            if (this.swapdata.ContainsKey("businessObject"))
            {
                businessObject = this.swapdata["businessObject"] as BaseBusiness;
            }

            lookUp_ac005.Properties.DataSource    = checkin_ds.St01_reason;
            lookUp_ac005.Properties.ValueMember   = "ST003";
            lookUp_ac005.Properties.DisplayMember = "ST003";
            checkin_ds.St01_reason.Sort           = "SORTID ASC";

            lookUp_ac052.Properties.DataSource    = checkin_ds.St01_relation;
            lookUp_ac052.Properties.ValueMember   = "ST003";
            lookUp_ac052.Properties.DisplayMember = "ST003";
            checkin_ds.St01_relation.Sort         = "SORTID ASC";

            lookUp_ac060.Properties.DataSource    = checkin_ds.St01_driver;
            lookUp_ac060.Properties.ValueMember   = "ST001";
            lookUp_ac060.Properties.DisplayMember = "ST003";
            checkin_ds.St01_driver.Sort           = "SORTID ASC";

            lookUp_ac007.Properties.DataSource    = checkin_ds.St01_district;
            lookUp_ac007.Properties.ValueMember   = "ST003";
            lookUp_ac007.Properties.DisplayMember = "ST003";
            checkin_ds.St01_district.Sort         = "SORTID ASC";

            lookup_gtype.Properties.DataSource    = checkin_ds.St01_gtype;
            lookup_gtype.Properties.ValueMember   = "ST001";
            lookup_gtype.Properties.DisplayMember = "ST003";
            checkin_ds.St01_gtype.Sort            = "SORTID ASC";

            if (string.Equals(action, "edit"))
            {
                this.Text = "登记修改";
                AC001     = this.swapdata["AC001"].ToString();

                ac01 = ac01_dao.GetSingle(s => s.ac001 == AC001);
                if (ac01 == null)
                {
                    b_ok.Enabled = false;
                    MessageBox.Show("查找数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    b_ok.Enabled = false;
                    return;
                }

                txtEdit_ac003.EditValue  = ac01.ac003;
                rg_ac002.EditValue       = ac01.ac002;
                txtEdit_ac004.EditValue  = ac01.ac004;
                txtedit_ac014.EditValue  = ac01.ac014;
                txtEdit_ac009.EditValue  = ac01.ac009;
                dateEdit_ac010.EditValue = ac01.ac010;
                lookUp_ac005.EditValue   = ac01.ac005;
                lookUp_ac060.EditValue   = ac01.ac060;
                lookUp_ac007.EditValue   = ac01.ac007;
                lookup_gtype.EditValue   = ac01.ac300;                  //逝者类型
                txtEdit_ac008.EditValue  = ac01.ac008;

                txtEdit_ac050.EditValue = ac01.ac050;
                txtEdit_ac051.EditValue = ac01.ac051;
                lookUp_ac052.EditValue  = ac01.ac052;

                txtEdit_ac150.EditValue = ac01.ac150;
                txtEdit_ac151.EditValue = ac01.ac151;
                lookUp_ac152.EditValue  = ac01.ac152;

                txtEdit_ac055.EditValue = ac01.ac055;
                mem_ac099.EditValue     = ac01.ac099;
                be_url.Enabled          = false;

                //读入照片
                if (MiscAction.HasIDC(AC001))
                {
                    OracleDataReader photo_reader = SqlAssist.ExecuteReader("select ic020 from ic01 where ic000 = '0' and ac001 ='" + AC001 + "'");
                    if (photo_reader.HasRows && photo_reader.Read())
                    {
                        MemoryStream ms        = new MemoryStream((byte[])photo_reader["IC020"]); //把照片读到MemoryStream里
                        Image        imageBlob = Image.FromStream(ms, true);                      //用流创建Image
                        pictureEdit1.Image = imageBlob;                                           //输出图片
                    }
                    photo_reader.Dispose();
                }
            }
            else
            {
                ac01 = new Ac01();
                if (checkin_ds.St01_gtype.Count > 0)
                {
                    lookup_gtype.EditValue = checkin_ds.St01_gtype.ToTable().Rows[0]["ST001"];
                }
            }
        }
Example #22
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            if (rc001 == null)
            {
                XtraMessageBox.Show("数据传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtEdit_oc003.EditValue == null || txtEdit_oc003.EditValue is System.DBNull)
            {
                txtEdit_oc003.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                txtEdit_oc003.ErrorText = "请输入迁出办理人!";
                return;
            }
            if (mem_oc005.EditValue == null)
            {
                mem_oc005.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                mem_oc005.ErrorText = "请输入迁出原因!";
                return;
            }
            string s_oc003 = txtEdit_oc003.Text;               //迁出人
            string s_oc005 = mem_oc005.Text;                   //迁出原因
            string s_oc004 = txtEdit_oc004.Text;               //迁出人身份证号

            int     diff       = int.Parse(txtEdit_diff.EditValue.ToString());
            decimal nums       = decimal.Zero;
            string  fa001      = Tools.GetEntityPK("FA01");
            string  last_fa001 = RegisterAction.GetREGLastSettleId(rc001);                //获取最后一次缴费 结算流水号

            //补退情况
            if (checkEdit1.Checked && (!string.IsNullOrEmpty(txtEdit_nums.Text)))
            {
                nums = decimal.Parse(txtEdit_nums.Text);
            }
            else
            {
                nums = 0;
            }

            if (XtraMessageBox.Show("确认要继续办理迁出吗?本业务将不能回退!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            //if ((!string.IsNullOrEmpty(txtEdit_fee.Text)) && Convert.ToDecimal(txtEdit_fee.Text) > 0 && Envior.cur_userId != AppInfo.ROOTID && !isrefund )
            //{
            //	XtraMessageBox.Show("当前记录已经欠费,不能迁出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //	return;
            //}

            int re = RegisterAction.RegisterOut(rc001,
                                                s_oc003,
                                                s_oc004,
                                                s_oc005,
                                                diff,
                                                fa001,
                                                price,
                                                isrefund ? 0 - nums : nums,
                                                Envior.cur_userId
                                                );

            if (re > 0)
            {
                XtraMessageBox.Show("迁出办理成功!现在打印【迁出通知单】", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PrtServAction.PrtRegisterOutNotice(rc001, this.Handle.ToInt32());

                if (!isrefund && nums > 0)
                {
                    if (XtraMessageBox.Show("现在开具【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        if (FinInvoice.GetCurrentPh() > 0)
                        {
                            if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                FinInvoice.Invoice(fa001);
                            }
                        }
                    }
                }
                else if (isrefund && Math.Abs(nums) > 0)                   //退费发票
                {
                    string           s_old_pjlx = string.Empty;
                    string           s_old_pjh  = string.Empty;
                    string           s_old_zch  = string.Empty;
                    OracleDataReader reader_log = SqlAssist.ExecuteReader("select * from fin_log where settleId ='" + last_fa001 + "'");
                    reader_log.Read();
                    if (reader_log.HasRows)
                    {
                        s_old_pjlx = reader_log["INVOICEKIND"].ToString();                            //票据类型
                        s_old_pjh  = reader_log["INVOICENO"].ToString();                              //票据号
                        s_old_zch  = reader_log["INVOICEZCH"].ToString();                             //注册号
                    }
                    else
                    {
                        XtraMessageBox.Show("读取缴费发票信息出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    reader_log.Dispose();
                    Frm_refundInfo frm_refund = new Frm_refundInfo(s_old_pjlx, s_old_pjh, s_old_zch);
                    if (frm_refund.ShowDialog() == DialogResult.OK)
                    {
                        s_old_zch = frm_refund.swapdata["zch"].ToString();                         //注册号
                        //if (!Envior.FIN_READY)
                        //	XtraMessageBox.Show("未连接到博思开票服务器!请稍后补开!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //else
                        //{
                        //	string s_newpjh = FinInvoice.GetCurrentPh(Envior.FIN_INVOICE_TYPE);
                        //	if (String.IsNullOrEmpty(s_newpjh))
                        //		XtraMessageBox.Show("未获取到下一张财政发票号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //	else
                        //	{
                        //		if (XtraMessageBox.Show("下一张财政发票号码:" + s_newpjh + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        //		{
                        //			string s_tkitem = MiscAction.GetItemInvoiceCode("08", "") + "	" + Math.Abs(nums * price) + "	";
                        //			FinInvoice.Refund(s_old_pjlx, s_old_pjh, s_old_zch, s_tkitem, "F_Qt1=xxx|F_Qt2=xxx|F_Qt3=xxx",fa001, s_newpjh,nums * price);
                        //		}
                        //	}
                        //}
                    }
                    frm_refund.Dispose();
                }
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }
Example #23
0
        private void Frm_registerOut_Load(object sender, EventArgs e)
        {
            rc001 = this.swapdata["RC001"].ToString();

            OracleDataReader reader = SqlAssist.ExecuteReader("select * from rc01 where rc001='" + rc001 + "'");

            while (reader.Read())
            {
                txtEdit_rc001.Text      = rc001;
                txtEdit_rc109.EditValue = reader["RC109"];
                txtEdit_rc003.EditValue = reader["RC003"];
                txtEdit_rc303.EditValue = reader["RC303"];
                rg_rc002.EditValue      = reader["RC002"];
                rg_rc202.EditValue      = reader["RC202"];
                txtEdit_rc004.EditValue = reader["RC004"];
                txtEdit_rc404.EditValue = reader["RC404"];
                txtEdit_rc150.EditValue = reader["RC150"];                   //寄存到期日期
                be_position.EditValue   = RegisterAction.GetRegPathName(rc001);

                price = Math.Round(RegisterAction.GetBitPrice(reader["RC130"].ToString()) / 12, 0);
                txtEdit_price.EditValue = price;

                int diff = RegisterAction.CalcOutDiffDays(rc001);

                int compare = string.Compare(Convert.ToDateTime(reader["RC150"]).ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"));
                if (compare == 0)
                {
                    checkEdit1.Enabled   = false;
                    txtEdit_nums.Enabled = false;
                }
                else if (compare > 0)                  //退费
                {
                    lc_1.Text = "剩余天数";
                    lc_2.Text = "应退费月数";
                    lc_3.Text = "退费金额";
                    isrefund  = true;

                    txtEdit_nums.EditValue = Math.Round((diff * 1.0f) / 30, 0);
                    txtEdit_fee.EditValue  = Convert.ToDecimal(Math.Round((diff * 1.0f) / 30, 0)) * price;
                }
                else
                {
                    lc_1.Text = "过期天数";
                    lc_2.Text = "应补费月数";
                    lc_3.Text = "补费金额";

                    txtEdit_nums.EditValue = Math.Round((diff * 1.0f) / 30, 0);
                    txtEdit_fee.EditValue  = Convert.ToDecimal(Math.Round((diff * 1.0f) / 30, 0)) * price;
                }


                txtEdit_diff.EditValue = diff;
            }

            //TODO 5. 根据权限设置 是否允许补退费
            //权限检查
            if (!AppAction.CheckRight("迁出时允许选择补退"))
            {
                checkEdit1.Enabled = false;
            }
        }
Example #24
0
        /// <summary>
        /// 读取发票信息
        /// </summary>
        private void ReadInvoiceBaseInfo()
        {
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from sp01 where sp001  < '0000000100' ");

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    if (reader["SP002"].ToString() == "tax_no")                        //纳税人识别号
                    {
                        Envior.TAX_ID = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_addrtele")             //税票-销方地址电话
                    {
                        Envior.TAX_ADDR_TELE = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_bankaccount")          //税票-销方银行账号
                    {
                        Envior.TAX_BANK_ACCOUNT = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_appid")                //税票-应用账号
                    {
                        Envior.TAX_APPID = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_invoicetype")          //税票-发票类型
                    {
                        Envior.TAX_INVOICE_TYPE = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_server_url")           //税票-服务请求URL
                    {
                        Envior.TAX_SERVER_URL = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_publickey")            //税票-公钥
                    {
                        Envior.TAX_PUBLIC_KEY = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_privatekey")           //税票-私钥
                    {
                        Envior.TAX_PRIVATE_KEY = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_cashier")              //税票-收款人
                    {
                        Envior.TAX_CASHIER = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_checker")              //税票-复核人
                    {
                        Envior.TAX_CHECKER = reader["SP005"].ToString();
                    }
                    else if (reader["SP002"].ToString() == "tax_max_fee")
                    {
                        decimal dec_max;
                        if (decimal.TryParse(reader["SP006"].ToString(), out dec_max))
                        {
                            Envior.TAX_MAX_FEE = dec_max;
                        }
                        else
                        {
                            Envior.TAX_MAX_FEE = 0;
                        }
                    }
                }
            }
            reader.Dispose();
        }
Example #25
0
        ///// <summary>
        ///// 根据结算流水号开具发票
        ///// </summary>
        ///// <param name="fa001"></param>
        ///// <returns></returns>
        public static int Invoice(string fa001)
        {
            OracleParameter op_fa001 = new OracleParameter("fa001", OracleDbType.Varchar2, 10);

            op_fa001.Direction = ParameterDirection.Input;
            op_fa001.Value     = fa001;
            OracleDataReader reader_fa01 = SqlAssist.ExecuteReader("select fa003,fa180 from fa01 where fa001 = :fa001", new OracleParameter[] { op_fa001 });

            string  s_head   = string.Empty;
            string  s_memo   = string.Empty;           //备注
            decimal dec_hjje = decimal.Zero;

            while (reader_fa01.Read())
            {
                //读取交款人
                s_head = reader_fa01["FA003"].ToString();
                s_memo = reader_fa01["FA180"].ToString();
            }
            reader_fa01.Dispose();

            Dictionary <string, object> bdata = new Dictionary <string, object>();
            Dictionary <string, Dictionary <string, object> > msg = new Dictionary <string, Dictionary <string, object> >();

            bdata.Add("serial_number", fa001);                                              //业务流水号
            bdata.Add("place_code", Envior.FIN_BILL_SITE);                                  //开票点
            bdata.Add("payer", s_head);                                                     //缴款人单位
            bdata.Add("date", string.Format("{0:yyyy-MM-dd}", MiscAction.GetServerTime())); //开票日期
            bdata.Add("author", Envior.cur_userName);                                       //开票人
            bdata.Add("payer_type", "1");                                                   //缴款人类型:1 个人 2 单位
            bdata.Add("credit_code", "");                                                   //组织机构代码
            bdata.Add("bill_code", Envior.FIN_CODE);                                        //票据种类编码
            bdata.Add("rec_mode", "1");                                                     //收款方式:1现金,2转账,3其它
            bdata.Add("memo", s_memo);                                                      //备注

            string           s_sql       = @"select sa002,
		                            sa004,
		                            sa003,
		                            price,
		                            nums,
		                            sa020,
		                            sa007,
		                            pkg_business.fun_GetInvoiceCode(sa002,sa004) invcode
		                     from v_sa01
		                    where sa010 = :fa001 order by sa001"        ;
            OracleDataReader reader_sa01 = SqlAssist.ExecuteReader(s_sql, new OracleParameter[] { op_fa001 });

            List <Dictionary <string, object> > detail_list = new List <Dictionary <string, object> >();
            Dictionary <string, object>         detail_data = null;

            while (reader_sa01.Read())
            {
                if (reader_sa01["SA020"].ToString() != "F")
                {
                    continue;                                                          //如果不是财政发票,忽略
                }
                detail_data = new Dictionary <string, object>();
                detail_data.Add("item_code", reader_sa01["INVCODE"].ToString());                   //项目名
                detail_data.Add("std", reader_sa01["PRICE"]);                                      //单价
                detail_data.Add("number", reader_sa01["NUMS"]);                                    //数量
                detail_data.Add("amt", reader_sa01["SA007"]);                                      //金额
                detail_list.Add(detail_data);

                dec_hjje += Convert.ToDecimal(reader_sa01["SA007"]);
            }
            reader_sa01.Dispose();

            bdata.Add("item_details", detail_list);
            bdata.Add("total_amt", dec_hjje);                                                     //合计金额
            msg.Add("message", bdata);

            string s_json = Tools.ConvertObjectToJson(msg);
            string s_ret  = SendRequest("invoice.issue.do", s_json);

            Dictionary <string, object> retdata = JsonConvert.DeserializeObject <Dictionary <string, object> >(s_ret);

            if (retdata != null)
            {
                if (retdata.ContainsKey("message"))
                {
                    string s_batch_code = string.Empty;
                    string s_bill_no    = string.Empty;
                    Dictionary <string, string> success_msg = JsonConvert.DeserializeObject <Dictionary <string, string> >(retdata["message"].ToString());
                    s_batch_code = success_msg["bill_batch_code"];
                    s_bill_no    = success_msg["bill_no"];

                    if (FinInvoiceLog(fa001, Envior.FIN_CODE, s_bill_no, s_batch_code, dec_hjje, Envior.cur_userId) > 0)
                    {
                        XtraMessageBox.Show("发票开具成功!\r\n" + "注册号:" + s_batch_code + "\r\n" + "票据号:" + s_bill_no, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("发票开具成功!!!但记录日志失败,请与管理员联系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        XtraMessageBox.Show("票据号:" + s_bill_no + "\r\n注册号:" + s_batch_code + "\r\n");
                    }
                    if (XtraMessageBox.Show("现在打印【财政发票】吗?" + "\r\n" + "发票号:" + s_bill_no, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        PrintInvoice(s_batch_code, s_bill_no);
                    }
                    return(1);
                }
                else
                {
                    Dictionary <string, string> error_msg = JsonConvert.DeserializeObject <Dictionary <string, string> >(retdata["error_message"].ToString());
                    XtraMessageBox.Show("开财政发票失败!" + error_msg["error_msg"] + "\r\n" + "错误代码:" + error_msg["error_code"], "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(-1);
                }
            }
            else
            {
                XtraMessageBox.Show("未获取到数据!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(-1);
            }
        }
Example #26
0
        /// <summary>
        /// 开退费发票
        /// </summary>
        /// <param name="fa001"></param>
        /// <returns></returns>
        public static int Refund(string fa001)
        {
            string  s_ori_batch     = string.Empty;
            string  s_ori_billno    = string.Empty;
            string  s_refund_reason = string.Empty;
            decimal dec_hjje        = decimal.Zero;

            //检索原发票注册号和票号
            OracleDataReader inv_reader = SqlAssist.ExecuteReader("select * from fin_log where settleId = (select rf300 from refund where rf001 = '" + fa001 + "')");

            if (inv_reader.HasRows && inv_reader.Read())
            {
                s_ori_batch     = inv_reader["INVOICEZCH"].ToString();
                s_ori_billno    = inv_reader["INVOICENO"].ToString();
                s_refund_reason = inv_reader["RF003"].ToString();
            }
            inv_reader.Dispose();

            //业务数据
            Dictionary <string, object> bdata = new Dictionary <string, object>();
            Dictionary <string, Dictionary <string, object> > msg = new Dictionary <string, Dictionary <string, object> >();
            List <Dictionary <string, object> > detail_list       = new List <Dictionary <string, object> >();
            Dictionary <string, object>         detail_data       = new Dictionary <string, object>();

            bdata.Add("bill_batch_code", s_ori_batch);                        //原发票注册号
            bdata.Add("bill_no", s_ori_billno);                               //发票号
            bdata.Add("scarlet_bill_code", "");                               //红票票据种类编码
            bdata.Add("scarlet_bill_batch_code", Envior.FIN_NEXT_BATCH_CODE); //红票票据注册号
            bdata.Add("scarlet_bill_no", Envior.FIN_NEXT_BILL_NO);            //红票票据号
            bdata.Add("writeoff_reason", s_refund_reason);                    //冲红原因

            OracleDataReader sa01_reader = SqlAssist.ExecuteReader("select * from v_sa01 where sa010 = '" + fa001 + "'");

            if (sa01_reader.HasRows)
            {
                while (sa01_reader.Read())
                {
                    if (sa01_reader["SA020"].ToString() == "F")
                    {
                        detail_data = new Dictionary <string, object>();
                        detail_data.Add("item_code", sa01_reader["INVOICECODE"]);                           //项目发票代码
                        detail_data.Add("refund_amt", sa01_reader["SA007"]);                                //退费金额
                        detail_list.Add(detail_data);
                        dec_hjje += Convert.ToDecimal(sa01_reader["SA007"]);
                    }
                }
            }
            sa01_reader.Dispose();
            bdata.Add("item_details", detail_list);
            msg.Add("message", bdata);

            string s_json = Tools.ConvertObjectToJson(msg);
            string s_ret  = SendRequest("invoice.p.writeOff.do", s_json);
            Dictionary <string, object> retdata = JsonConvert.DeserializeObject <Dictionary <string, object> >(s_ret);

            if (retdata != null)
            {
                if (retdata.ContainsKey("message"))
                {
                    string s_batch_code = string.Empty;
                    string s_bill_no    = string.Empty;
                    Dictionary <string, string> success_msg = JsonConvert.DeserializeObject <Dictionary <string, string> >(retdata["message"].ToString());
                    s_batch_code = success_msg["bill_batch_code"];
                    s_bill_no    = success_msg["bill_no"];

                    if (FinInvoiceLog(fa001, Envior.FIN_CODE, s_bill_no, s_batch_code, dec_hjje, Envior.cur_userId) > 0)
                    {
                        XtraMessageBox.Show("退费发票开具成功!\r\n" + "注册号:" + s_batch_code + "\r\n" + "票据号:" + s_bill_no, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(1);
                    }
                    else
                    {
                        XtraMessageBox.Show("退费发票开具成功!!!但记录日志失败,请与管理员联系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        XtraMessageBox.Show("票据号:" + s_bill_no + "\r\n注册号:" + s_batch_code + "\r\n");
                        return(1);
                    }
                }
                else
                {
                    Dictionary <string, string> error_msg = JsonConvert.DeserializeObject <Dictionary <string, string> >(retdata["error_message"].ToString());
                    XtraMessageBox.Show("退费发票开具失败!" + error_msg["error_msg"] + "\r\n" + "错误代码:" + error_msg["error_code"], "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(-1);
                }
            }
            else
            {
                XtraMessageBox.Show("未获取到数据!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(-1);
            }
        }
Example #27
0
        /// <summary>
        /// 发票作废
        /// </summary>
        /// <param name="fpdm"></param>
        /// <param name="fphm"></param>
        /// <returns></returns>
        public static int Remove(string fa001, string zfr)
        {
            string  s_fpdm   = string.Empty;
            string  s_fphm   = string.Empty;
            decimal dec_hjje = new decimal(0);

            OracleParameter op_fa001 = new OracleParameter("fa001", OracleDbType.Varchar2, 10);

            op_fa001.Direction = ParameterDirection.Input;
            op_fa001.Value     = fa001;
            OracleDataReader reader = SqlAssist.ExecuteReader("select * from fp01 where fa001 = :fa001", new OracleParameter[] { op_fa001 });

            try
            {
                reader.Read();
                if (reader.HasRows)
                {
                    s_fpdm   = reader["INVOICECODE"].ToString();
                    s_fphm   = reader["INVOICENUM"].ToString();
                    dec_hjje = Convert.ToDecimal(reader["HJJE"]);
                    reader.Dispose();

                    //1.组装业务数据
                    Dictionary <string, Object> bdata = new Dictionary <string, object>();
                    bdata.Add("fplxdm", Envior.TAX_INVOICE_TYPE);                                 //发票类型代码
                    bdata.Add("fpdm", s_fpdm);                                                    //发票代码
                    bdata.Add("fphm", s_fphm);                                                    //发票号码
                    bdata.Add("hjje", dec_hjje.ToString());                                       //合计金额
                    bdata.Add("zfr", zfr);                                                        //作废人

                    //2.将业务数据转换为Json字符串
                    string s_json    = Tools.ConvertObjectToJson(bdata);
                    string s_req_sid = MiscAction.GetEntityPK("TAXREQ");                     //报文请求ID
                    string s_retstr  = WrapData("FPZF", s_req_sid, s_json);

                    //3.分析返回结果
                    Object obj = JsonConvert.DeserializeObject(s_retstr);
                    Newtonsoft.Json.Linq.JObject js = obj as Newtonsoft.Json.Linq.JObject;
                    if (js["code"].ToString() == "00000")                       //成功
                    {
                        XtraMessageBox.Show("作废税务发票成功!\r\n" + "发票代码:" + s_fpdm + "," + "发票号码:" + s_fphm, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(1);
                    }
                    else
                    {
                        Tools.msg(MessageBoxIcon.Error, "错误", "作废发票失败, 请与管理员联系!\r\n" + js["msg"]);
                        return(-1);
                    }
                }
                else
                {
                    XtraMessageBox.Show("未找到开票记录!税务发票作废失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(-1);
                }
            }
            catch (Exception ee)
            {
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
            finally
            {
                reader.Dispose();
            }
            return(-1);
        }
Example #28
0
        /// <summary>
        /// 负数发票开具
        /// </summary>
        /// <returns></returns>
        public static int InvoiceRefund(string fp001, TaxClientInfo taxClient)
        {
            //组装业务数据
            Dictionary <string, object> bdata = new Dictionary <string, object>();

            int             i_order    = 0;
            List <C_detail> detaildata = new List <C_detail>();

            decimal dec_rate        = new decimal();
            decimal dec_price       = new decimal();               //含税价格
            decimal dec_price_notax = new decimal();               //不含税价格
            decimal dec_je_notax    = new decimal();               //不含税金额
            decimal dec_tax         = new decimal();               //税额

            decimal dec_sum_notax = new decimal(0);                //合计金额(不含税)
            decimal dec_sum_tax   = new decimal(0);                //合计税额
            decimal dec_sum_sum   = new decimal(0);                //价税合计
            decimal dec_nums      = new decimal(0);

            string s_ggxh  = string.Empty;                         //规格型号
            string s_jldw  = string.Empty;                         //计量单位
            string s_spmc  = string.Empty;                         //商品名称
            string s_spbm  = string.Empty;                         //商品编码
            string s_yfpdm = string.Empty;                         //原发票代码
            string s_yfphm = string.Empty;                         //原发票号码

            //发票明细数量
            int itemCount = Convert.ToInt32(SqlAssist.ExecuteScalar("select count(*) from v_invoice_detail where fp001 ='" + fp001 + "'"));
            //退费总金额
            decimal dec_sum = Convert.ToDecimal(SqlAssist.ExecuteScalar("select sum(fp022) from v_invoice_detail where fp001='" + fp001 + "'"));
            string  s_memo  = SqlAssist.ExecuteScalar("select fa180 from fa01 f,v_fp01_nopen p where f.fa001 = p.fa001 and fp001='" + fp001 + "'").ToString();

            bdata.Add("fplxdm", Envior.TAX_INVOICE_TYPE);                         //发票类型代码
            bdata.Add("kplx", "1");                                               //开票类型 0-正数发票 1-负数
            bdata.Add("tspz", "00");                                              //特殊票种 00-不是 01-农产品销售 02-农产品收购
            bdata.Add("xhdwdzdh", Envior.TAX_ADDR_TELE);                          //销货单位地址电话
            bdata.Add("xhdwyhzh", Envior.TAX_BANK_ACCOUNT);                       //销货单位银行账号
            bdata.Add("ghdwsbh", taxClient.InfoClientTaxCode);                    //购货单位纳税识别号
            bdata.Add("ghdwmc", taxClient.InfoClientName);                        //购货单位名称
            bdata.Add("ghdwdzdh", taxClient.infoclientaddressphone);              //购货单位地址电话
            bdata.Add("ghdwyhzh", taxClient.infoclientbankaccount);               //购货单位银行账号

            OracleParameter op_fp001 = new OracleParameter("fp001", OracleDbType.Varchar2, 10);

            op_fp001.Direction = ParameterDirection.Input;
            op_fp001.Value     = fp001;
            OracleDataReader reader_sa01 = SqlAssist.ExecuteReader("select * from v_invoice_detail where fp001 = :fp001", new OracleParameter[] { op_fp001 });

            bool b_split = false;                                  //项目是否分割

            if (itemCount > AppInfo.TAXITEMCOUNT)                  //超出清单阈值
            {
                while (reader_sa01.Read())
                {
                    i_order++;

                    if (Convert.ToDecimal(reader_sa01["SA007"]) != Convert.ToDecimal(reader_sa01["FP022"]))
                    {
                        b_split = true;
                    }
                    else
                    {
                        b_split = false;
                    }

                    dec_rate  = Convert.ToDecimal(reader_sa01["SA025"]);                                                     //获取税率
                    dec_price = b_split ? Convert.ToDecimal(reader_sa01["FP022"]) : Convert.ToDecimal(reader_sa01["PRICE"]); //含税价格
                    dec_nums  = b_split ? 1 : Convert.ToDecimal(reader_sa01["NUMS"].ToString());

                    dec_price_notax = Math.Round(dec_price / (1 + dec_rate), 2);                                        //不含税价格
                    dec_je_notax   += Math.Round((dec_price / (1 + dec_rate)) * dec_nums, 2);                           //不含税金额
                    dec_tax        += Math.Round((dec_price / (1 + dec_rate)) * dec_rate * dec_nums, 2);                //税额

                    if (i_order == 1)
                    {
                        s_ggxh = BusinessAction.GetItemGGXH(reader_sa01["SA004"].ToString());                                                                       //规格型号
                    }
                    if (i_order == 1)
                    {
                        s_jldw = BusinessAction.GetItemDW(reader_sa01["SA004"].ToString());                                                                         //计量单位
                    }
                    if (i_order == 1)
                    {
                        s_spmc = reader_sa01["SA003"].ToString();                                                                                                                                                                       //商品名称
                    }
                    if (i_order == 1)
                    {
                        s_spbm = BusinessAction.GetItemInvoiceCode("", reader_sa01["SA004"].ToString());                                                            //商品编码
                    }
                }
                reader_sa01.Dispose();

                C_detail c_detail = new C_detail();
                c_detail.xh    = "1";                      //序号
                c_detail.fphxz = "0";                      //发票行性质	0 正常行1 折扣行2 被折扣行
                c_detail.ggxh  = s_ggxh;                   //规格型号

                c_detail.dw     = s_jldw;                  //计量单位
                c_detail.spmc   = "详见对应正数发票及清单";           //商品名称 s_spmc;
                c_detail.spsl   = "";                      //数量
                c_detail.dj     = "";                      //单价(不含税)
                c_detail.je     = dec_je_notax.ToString(); //金额(不含税)
                c_detail.sl     = "";                      //税率
                c_detail.se     = dec_tax.ToString();      //税额
                c_detail.hsbz   = "0";                     //含税标志 0 不含税1 含税
                c_detail.spbm   = "";                      //s_spbm;											 //商品编码(税务发票编码)
                c_detail.zxbm   = "";                      //自行编码
                c_detail.yhzcbs = "0";                     //优惠政策标识
                c_detail.slbs   = "";

                c_detail.zzstsgl = "";                                                                   //增值税特殊管理
                detaildata.Add(c_detail);

                dec_sum_notax = dec_je_notax;                              //合计金额(不含税)
                dec_sum_tax   = dec_tax;                                   //合计税额
                dec_sum_sum   = dec_je_notax + dec_tax;                    //价税合计

                bdata.Add("mx", detaildata);

                bdata.Add("zhsl", "99.01");                                      //综合税率 固定传 99.01
                bdata.Add("hjje", dec_sum_notax.ToString());                     //合计金额(不含税)
                bdata.Add("hjse", dec_sum_tax.ToString());                       //合计税额
                bdata.Add("jshj", dec_sum_sum.ToString());                       //价税合计
                bdata.Add("bz", s_memo);                                         //备注
                bdata.Add("skr", Envior.TAX_CASHIER);                            //收款人
                bdata.Add("fhr", Envior.TAX_CHECKER);                            //复核人
                bdata.Add("kpr", Envior.cur_userName);                           //开票人
                bdata.Add("tzdbh", "");                                          //通知单编号 专票红字必填
            }
            else
            {
                while (reader_sa01.Read())
                {
                    if (reader_sa01["SA020"].ToString() != "T")
                    {
                        continue;                                                               //不是税务项目 忽略
                    }
                    i_order++;

                    if (Convert.ToDecimal(reader_sa01["SA007"]) != Convert.ToDecimal(reader_sa01["FP022"]))
                    {
                        b_split = true;
                    }
                    else
                    {
                        b_split = false;
                    }

                    C_detail c_detail = new C_detail();
                    dec_rate  = Convert.ToDecimal(reader_sa01["SA025"]);                                                                                        //获取税率
                    dec_price = b_split ? Convert.ToDecimal(reader_sa01["FP022"]) : Convert.ToDecimal(reader_sa01["PRICE"]);                                    //含税价格
                    dec_nums  = b_split ? 1 : Convert.ToDecimal(reader_sa01["NUMS"].ToString());

                    dec_price_notax = Math.Round(dec_price / (1 + dec_rate), 2);                                 //不含税价格
                    dec_je_notax    = Math.Round((dec_price / (1 + dec_rate)) * dec_nums, 2);                    //不含税金额
                    dec_tax         = Math.Round((dec_price / (1 + dec_rate)) * dec_rate * dec_nums, 2);         //税额

                    c_detail.xh     = i_order.ToString();                                                        //序号
                    c_detail.fphxz  = "0";                                                                       //发票行性质	0 正常行1 折扣行2 被折扣行
                    c_detail.ggxh   = BusinessAction.GetItemGGXH(reader_sa01["SA004"].ToString());               //规格型号
                    c_detail.dw     = BusinessAction.GetItemDW(reader_sa01["SA004"].ToString());                 //计量单位
                    c_detail.spmc   = reader_sa01["SA003"].ToString();                                           //商品名称
                    c_detail.spsl   = dec_nums.ToString();;                                                      //数量
                    c_detail.dj     = dec_price_notax.ToString();                                                //单价(不含税)
                    c_detail.je     = dec_je_notax.ToString();                                                   //金额(不含税)
                    c_detail.sl     = dec_rate.ToString("#0.00");                                                //税率
                    c_detail.se     = dec_tax.ToString();                                                        //税额
                    c_detail.hsbz   = "0";                                                                       //含税标志 0 不含税1 含税
                    c_detail.spbm   = BusinessAction.GetItemInvoiceCode("", reader_sa01["SA004"].ToString());    //商品编码(税务发票编码)
                    c_detail.zxbm   = "";                                                                        //自行编码
                    c_detail.yhzcbs = "0";                                                                       //优惠政策标识

                    c_detail.slbs = dec_rate == 0 ? "1" : "";                                                    //税率标识: 空,是正常税率  1-免税 2-不征税 3-普通零税率

                    c_detail.zzstsgl = "";                                                                       //增值税特殊管理
                    detaildata.Add(c_detail);

                    dec_sum_notax += dec_je_notax;                                  //合计金额(不含税)
                    dec_sum_tax   += dec_tax;                                       //合计税额
                    dec_sum_sum   += dec_je_notax + dec_tax;                        //价税合计
                }

                bdata.Add("mx", detaildata);
                bdata.Add("hjje", dec_sum_notax.ToString());                     //合计金额(不含税)
                bdata.Add("hjse", dec_sum_tax.ToString());                       //合计税额
                bdata.Add("jshj", dec_sum_sum.ToString());                       //价税合计
                bdata.Add("bz", "");                                             //备注
                bdata.Add("skr", Envior.TAX_CASHIER);                            //收款人
                bdata.Add("fhr", Envior.TAX_CHECKER);                            //复核人
                bdata.Add("kpr", Envior.cur_userName);                           //开票人
                bdata.Add("tzdbh", "");                                          //通知单编号 专票红字必填
            }

            ///检索原发票代码、号码
            string s_log_sql = String.Format(@"select * from tax_log where settleId = 
												 (select rf300 from refund where rf001 = '"                                                 + fp001 + "')");

            using (OracleDataReader reader_log = SqlAssist.ExecuteReader(s_log_sql))
            {
                if (reader_log.Read())
                {
                    s_yfpdm = reader_log["INVOICECODE"].ToString();                       //原发票代码
                    s_yfphm = reader_log["INVOICENUM"].ToString();                        //原发票号码
                }
                else
                {
                    Tools.msg(MessageBoxIcon.Error, "错误", "读取原发票信息错误!");
                    return(-1);
                }
            }

            bdata.Add("yfphm", s_yfphm);                                 //原发票号码 负数发票必填
            bdata.Add("yfpdm", s_yfpdm);                                 //原发票代码 负数发票必填
            bdata.Add("gmf_dzyx", "");                                   //购买方电子邮箱 推送使用,电子发票,购买方电子邮箱和手机号码微信id三个必填一
            bdata.Add("gmf_sjhm", "1");                                  //购买方手机号码
            bdata.Add("gmf_openid", "");                                 //购买方微信id

            //将业务数据转换为Json字符串
            string s_json = Tools.ConvertObjectToJson(bdata);

            string s_req_sid = string.Empty;
            string s_retstr  = string.Empty;

            s_req_sid = MiscAction.GetEntityPK("TAXREQ");             //报文请求ID
            LogUtils.Debug("报文请求Id:" + s_req_sid);

            s_retstr = WrapData("FPKJ", s_req_sid, s_json);

            //分析返回结果
            Object obj = JsonConvert.DeserializeObject(s_retstr);

            Newtonsoft.Json.Linq.JObject js = obj as Newtonsoft.Json.Linq.JObject;

            if (js["code"].ToString() == "00000")               //成功
            {
                string data = js["data"].ToString();
                //解密 返回数据
                string resultText = Tools.AesDecrypt(data, Envior.TAX_PRIVATE_KEY);

                //解析真正的业务数据
                Object obj2 = JsonConvert.DeserializeObject(resultText);
                Newtonsoft.Json.Linq.JObject js2 = obj2 as Newtonsoft.Json.Linq.JObject;

                string  s_fpdm = js2["fpdm"].ToString();                    //发票代码
                string  s_fphm = js2["fphm"].ToString();                    //发票号码
                string  s_mw   = js2["mw"].ToString();                      //密文
                string  s_jym  = js2["jym"].ToString();                     //校验码
                decimal d_hjje = Convert.ToDecimal(js2["hjje"].ToString()); //合计金额
                decimal d_jshj = Convert.ToDecimal(js2["jshj"].ToString()); //价税合计

                //记录发票日志
                int result = InvoiceLog(fp001, Envior.TAX_INVOICE_TYPE, Envior.cur_userId, Envior.cur_userName, Envior.cur_userName,
                                        taxClient.InfoClientName, taxClient.InfoClientTaxCode, taxClient.infoclientbankaccount, taxClient.infoclientaddressphone,
                                        s_fpdm, s_fphm, s_mw, s_jym, d_hjje, d_jshj);

                if (result > 0)
                {
                    XtraMessageBox.Show("发票开具成功!\r\n" + "发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    XtraMessageBox.Show("发票开具成功!但记录开票日志失败!\r\n" + "发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                ////////// 打印发票和清单 //////////
                if (XtraMessageBox.Show("现在打印【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintInvoice(s_fpdm, s_fphm, "0");
                }
                if (i_order > AppInfo.TAXITEMCOUNT && XtraMessageBox.Show("现在打印【发票清单】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintInvoice(s_fpdm, s_fphm, "1");
                }
                return(1);
            }
            else
            {
                Tools.msg(MessageBoxIcon.Error, "错误", "发票开具失败!\r\n" + js["msg"].ToString());
                return(-1);
            }
        }
Example #29
0
        /// <summary>
        /// 退费办理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!gridView1.PostEditor())
            {
                return;
            }
            if (!gridView1.UpdateCurrentRow())
            {
                return;
            }

            List <string>  itemIdList   = new List <string>();
            List <decimal> numsList     = new List <decimal>();
            List <decimal> priceList    = new List <decimal>();
            List <string>  itemTypeList = new List <string>();

            decimal dec_fin_sum = decimal.Zero;
            decimal dec_temp    = decimal.Zero;

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (decimal.TryParse(gridView1.GetRowCellValue(i, "REFUNDFEE").ToString(), out dec_temp))
                {
                    if (dec_temp <= 0)
                    {
                        continue;
                    }
                    itemIdList.Add(gridView1.GetRowCellValue(i, "SA004").ToString());
                    priceList.Add(Convert.ToDecimal(gridView1.GetRowCellValue(i, "REFUNDFEE")));
                    numsList.Add(-1);
                    itemTypeList.Add(gridView1.GetRowCellValue(i, "SA002").ToString());
                    dec_fin_sum += Convert.ToDecimal(gridView1.GetRowCellValue(i, "REFUNDFEE"));
                }
            }
            if (numsList.Count <= 0)
            {
                XtraMessageBox.Show("还未选择退费的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string s_fa001 = Tools.GetEntityPK("FA01");
            string s_memo  = te_memo.Text;


            try
            {
                int re = MiscAction.FinRefundSettle(s_fa001, itemIdList.ToArray(), itemTypeList.ToArray(), priceList.ToArray(), numsList.ToArray(), Envior.cur_userId, s_memo, s_sa010);

                if (re > 0)
                {
                    XtraMessageBox.Show("退费结算完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    string s_fa190 = SqlAssist.ExecuteScalar("select fa190 from fa01 where fa001='" + s_sa010 + "'").ToString();
                    if (s_fa190.Substring(0, 1) == "1")  //原收费记录  财政发票已开
                    {
                        string           s_pjlx     = string.Empty;
                        string           s_pjh      = string.Empty;
                        string           s_zch      = string.Empty;
                        string           s_invcode  = string.Empty;
                        OracleDataReader reader_fin = SqlAssist.ExecuteReader("select * from fin_log where settleId='" + s_sa010 + "'");
                        {
                            reader_fin.Read();
                            s_pjlx = reader_fin["INVOICEKIND"].ToString();
                            s_pjh  = reader_fin["INVOICENO"].ToString();
                            s_zch  = reader_fin["INVOICEZCH"].ToString();
                            if (string.IsNullOrEmpty(s_zch))
                            {
                                Frm_Zch_input frm_zch = new Frm_Zch_input();
                                if (frm_zch.ShowDialog() == DialogResult.OK)
                                {
                                    s_zch = frm_zch.swapdata["zch"].ToString();
                                }
                                frm_zch.Dispose();
                            }
                        }
                        reader_fin.Dispose();

                        StringBuilder sb_content = new StringBuilder();
                        decimal       dec_fee    = decimal.Zero;
                        ///获取原票据号、类型成功!!!
                        if (!string.IsNullOrEmpty(s_zch) && !string.IsNullOrEmpty(s_pjlx) && !string.IsNullOrEmpty(s_pjh))
                        {
                            for (int i = 0; i < itemIdList.Count; i++)
                            {
                                //if (MiscAction.GetItemInvoiceType(itemIdList[i]) != "F") continue;
                                s_invcode = MiscAction.GetItemInvoiceCode(itemTypeList[i], itemIdList[i]);
                                dec_fee   = Math.Abs(priceList[i] * numsList[i]);
                                sb_content.Append(s_invcode + "	" + dec_fee.ToString() + "	");
                            }

                            //if (!Envior.FIN_READY)
                            //    XtraMessageBox.Show("未连接到博思开票服务器!请稍后补开!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            //else
                            //{
                            //    string s_newpjh = FinInvoice.GetCurrentPh(Envior.FIN_INVOICE_TYPE);
                            //    if (String.IsNullOrEmpty(s_newpjh))
                            //        XtraMessageBox.Show("未获取到下一张财政发票号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            //    else
                            //    {
                            //        if (XtraMessageBox.Show("下一张财政发票号码:" + s_newpjh + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            //        {
                            //            FinInvoice.Refund(s_pjlx, s_pjh, s_zch, sb_content.ToString(), "F_Qt1 = xxx | F_Qt2 = xxx | F_Qt3 = xxx", s_fa001, s_newpjh, dec_fin_sum);
                            //        }
                            //    }
                            //}
                        }
                    }
                    //else if (Math.Abs(dec_tax_sum) > 0 && s_fa190.Substring(1, 1) == "1")  //退费项目含税票项目 并且税务发票已开
                    //{
                    //    //获取税务客户信息
                    //    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo();
                    //    if (frm_taxClient.ShowDialog() == DialogResult.OK)
                    //    {
                    //        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;
                    //        if (TaxInvoice.GetNextInvoiceNo() > 0)
                    //        {
                    //            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    //            {
                    //                TaxInvoice.Invoice(s_fa001, clientInfo);
                    //            }
                    //        }
                    //    }
                    //}
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                XtraMessageBox.Show(ee.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }