/// <summary>
        /// 调整票据号
        /// </summary>
        /// <param name="invoicetype">票据类型</param>
        /// <param name="OperatorId">操作员ID</param>
        /// <param name="PerfChar">前缀</param>
        /// <param name="NewInvoiceNo">新票据号</param>
        /// <returns></returns>
        public bool AdjustInvoiceNo(InvoiceType invoicetype, int OperatorId, string PerfChar, string NewInvoiceNo)
        {
            //  Basic_Invoice invoice =(Basic_Invoice) NewObject<Basic_Invoice>().getmodel(" status=0 and empid="+OperatorId+" and invoicetype="+(int)invoicetype+" and perfchar='"+PerfChar+"'");
            List <Basic_Invoice> listInvoice = NewObject <Basic_Invoice>().getlist <Basic_Invoice>(" status=0 and empid=" + OperatorId + " and invoicetype=" + (int)invoicetype + " and perfchar='" + PerfChar + "'");
            int newInvoiceNo = Convert.ToInt32(NewInvoiceNo);

            if (listInvoice != null && listInvoice.Count > 0)
            {
                Basic_Invoice invoice = listInvoice[0] as Basic_Invoice;
                if (newInvoiceNo > Convert.ToInt64(invoice.EndNO))
                {
                    throw new Exception("要调整的发票号不能超出本卷票的结束号!");
                }
                if (newInvoiceNo <= Convert.ToInt64(invoice.CurrentNO))
                {
                    throw new Exception("要调整的发票号不能小于当前票号!");
                }
                invoice.CurrentNO = newInvoiceNo;
                this.BindDb(invoice);
                invoice.save();
                return(true);
            }
            else
            {
                throw new Exception("没有找到当前在用发票记录!");
            }
        }
Esempio n. 2
0
        public ServiceResponseData SaveNewAllot()
        {
            Basic_Invoice invoice = requestData.GetData <Basic_Invoice>(0);

            invoice.AllotDate = DateTime.Now;
            this.BindDb(invoice);
            invoice.save();
            responseData.AddData(true);
            return(responseData);
        }