Пример #1
0
        public ServiceResponseData DeleteInvoice()
        {
            int invoiceId = requestData.GetData <int>(0);

            HIS_Entity.BasicData.Basic_Invoice invoice = (Basic_Invoice)NewObject <Basic_Invoice>().getmodel(invoiceId);
            if (invoice != null)
            {
                if (invoice.Status == 0)
                {
                    throw new Exception("该卷发票正在使用中,不能删除");
                }

                if (invoice.Status == 1)
                {
                    throw new Exception("该卷发票已经有使用记录,不能删除");
                }

                if (invoice.Status == 3 && invoice.StartNO != invoice.CurrentNO)
                {
                    throw new Exception("该卷发票已停用,但有部分票据已经使用过,不能删除!\r\n如果要使用未用的票据号,请将这段票据号重新分配");
                }
            }

            invoice.delete();
            responseData.AddData(true);
            return(responseData);
        }
Пример #2
0
        public ServiceResponseData StopInvoice()
        {
            int invoiceId = requestData.GetData <int>(0);

            HIS_Entity.BasicData.Basic_Invoice currInvoice = (Basic_Invoice)NewObject <Basic_Invoice>().getmodel(invoiceId);
            if (currInvoice != null)
            {
                if (currInvoice.EndNO == currInvoice.CurrentNO &&
                    currInvoice.Status == 1)
                {
                    throw new Exception("本卷发票已经使用完,不能再停用!");
                }

                currInvoice.Status = 3;
                currInvoice.save();
                responseData.AddData(true);
            }
            else
            {
                responseData.AddData(false);
            }

            return(responseData);
        }