Ejemplo n.º 1
0
        /// <summary>
        /// 保存开票申请
        /// </summary>
        /// <param name="require"></param>
        /// <returns></returns>
        public int AddInvoiceRequire(InvoiceRequire require)
        {
            InvoiceRequire ir = new InvoiceRequire();

            ir.ComId           = require.ComId;
            ir.Id              = require.Id;
            ir.InvoiceAmount   = require.InvoiceAmount;
            ir.InvoiceContent  = require.InvoiceContent;
            ir.InvoiceMemo     = (require.InvoiceMemo != null) ? require.InvoiceMemo : "";
            ir.InvoiceName     = require.InvoiceName;
            ir.InvoiceType     = require.InvoiceType;
            ir.StatementId     = require.StatementId;
            ir.UpdateTime      = DateTime.Now;
            ir.UserId          = require.UserId;
            ir.InvoiceStatus   = require.InvoiceStatus;
            ir.MemberInvoiceId = require.MemberInvoiceId;
            int r = ir.Save();

            if (r > 0)
            {
                //重置对账单发票状态
                OrderStatementManager osm = new OrderStatementManager();
                osm.UpdateOrderStatementInvoiceData(require.StatementId);

                //记录最新的客户开票信息
                Customer customer = new Customer();
                customer.Load(require.ComId);
                customer.Invoice_Content = require.InvoiceContent;
                customer.Invoice_Name    = require.InvoiceName;
                customer.InvoiceType     = require.InvoiceType;
                customer.Save();
            }
            return(r);
        }
Ejemplo n.º 2
0
        public int Save()
        {
            ArrayList arrayList = new ArrayList();

            if (m_Id > 0)
            {
                arrayList.Add(new SqlParameter("@Id", m_Id));
            }
            arrayList.Add(new SqlParameter("@BranchId", m_BranchId));
            arrayList.Add(new SqlParameter("@ComId", m_ComId));
            arrayList.Add(new SqlParameter("@OrderStatementId", m_OrderStatementId));
            arrayList.Add(new SqlParameter("@InvoiceRequireId", m_InvoiceRequireId));
            arrayList.Add(new SqlParameter("@InvoiceDate", m_InvoiceDate));
            arrayList.Add(new SqlParameter("@InvoiceNo", m_InvoiceNo));
            arrayList.Add(new SqlParameter("@InvoiceType", m_InvoiceType));
            arrayList.Add(new SqlParameter("@InvoiceMoney", Math.Round(m_InvoiceMoney, 2)));
            arrayList.Add(new SqlParameter("@Memo", m_Memo));
            arrayList.Add(new SqlParameter("@UpdateTime", m_UpdateTime));
            arrayList.Add(new SqlParameter("@UserId", m_UserId));
            arrayList.Add(new SqlParameter("@PrintNum", m_PrintNum));
            arrayList.Add(new SqlParameter("@PrintTime", m_PrintTime));

            if (this.Id > 0)
            {
                m_dbo.UpdateData("Invoice", (SqlParameter[])arrayList.ToArray(typeof(SqlParameter)));
            }
            else
            {
                this.Id = m_dbo.InsertData("Invoice", (SqlParameter[])arrayList.ToArray(typeof(SqlParameter)));
            }
            if (this.Id > 0)
            {
                //修改相关开票申请的开票状态
                InvoiceRequire ir = new InvoiceRequire();
                ir.Id = this.InvoiceRequireId;
                ir.Load();
                ir.InvoiceStatus = CommenClass.InvoiceStatus.已开票.ToString();
                ir.Save();
                OrderStatementManager osm = new OrderStatementManager();
                osm.UpdateOrderStatementInvoiceData(ir.StatementId);
            }
            return(this.Id);
        }
Ejemplo n.º 3
0
        public bool Delete()
        {
            this.Load();
            string sql = string.Format(" delete from Invoice where id={0} ", m_Id);
            bool   r   = m_dbo.ExecuteNonQuery(sql);

            if (r)
            {
                //修改相关开票申请的开票状态
                InvoiceRequire ir = new InvoiceRequire();
                ir.Id = this.InvoiceRequireId;
                ir.Load();
                ir.InvoiceStatus = CommenClass.InvoiceStatus.待开票.ToString();
                ir.Save();
                //更新对账单 开金额数据
                OrderStatementManager osm = new OrderStatementManager();
                osm.UpdateOrderStatementInvoiceData(ir.StatementId);
            }
            return(r);
        }