/// <summary>
        /// 调整发票号
        /// </summary>
        /// <param name="billKind"></param>
        /// <param name="OperatorId"></param>
        /// <param name="NewInvoiceNo"></param>
        /// <returns></returns>
        public static bool AdjustInvoiceNo(OPDBillKind billKind, int OperatorId, string PerfChar, string NewInvoiceNo)
        {
            string strWhere = Tables.mz_invoice.STATUS + oleDb.EuqalTo() + "0";

            strWhere += oleDb.And() + Tables.mz_invoice.EMPLOYEE_ID + oleDb.EuqalTo() + OperatorId;
            strWhere += oleDb.And( ) + Tables.mz_invoice.INVOICE_TYPE + oleDb.EuqalTo( ) + (int)billKind;
            strWhere += oleDb.And( ) + Tables.mz_invoice.PERFCHAR + oleDb.EuqalTo( ) + "'" + PerfChar + "'";

            Model.MZ_INVOICE mz_invoice = BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).GetModel(strWhere);

            long newInvoiceNo = Convert.ToInt64(NewInvoiceNo);

            if (mz_invoice != null)
            {
                if (newInvoiceNo > Convert.ToInt64(mz_invoice.END_NO))
                {
                    throw new OperatorException("要调整的发票号不能超出本卷票的结束号!");
                }
                if (newInvoiceNo <= Convert.ToInt64(mz_invoice.CURRENT_NO))
                {
                    throw new OperatorException("要调整的发票号不能小于当前票号!");
                }
                BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).Update(strWhere, Tables.mz_invoice.CURRENT_NO + oleDb.EuqalTo( ) + newInvoiceNo);

                return(true);
            }
            else
            {
                throw new OperatorException("没有找到当前在用发票记录!");
            }
        }
        /// <summary>
        /// 删除发票卷
        /// </summary>
        /// <param name="VolumnID">发票卷号</param>
        /// <remarks>
        /// 对于在用的,已用的,停用的但之前有使用过的不能删除
        /// 备用的,停用的但还未使用的可以删除
        /// </remarks>
        /// <returns></returns>
        public static bool DeleteInvoiceVolumn(int VolumnID)
        {
            Model.MZ_INVOICE invoice = BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).GetModel(VolumnID);

            if (invoice != null)
            {
                if (invoice.STATUS == 0)
                {
                    throw new OperatorException("该卷发票正在使用中,不能删除");
                }
                if (invoice.STATUS == 1)
                {
                    throw new OperatorException("该卷发票已经有使用记录,不能删除");
                }
                if (invoice.STATUS == 3 && invoice.START_NO != invoice.CURRENT_NO)
                {
                    throw new OperatorException("该卷发票已停用,但有部分票据已经使用过,不能删除!\r\n如果要使用未用的票据号,请将这段票据号重新分配");
                }
            }
            try
            {
                BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).Delete(VolumnID);

                return(true);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err);
                throw new Exception("删除票卷发生错误!");
            }
        }