public void AddUpdatePurchaseInvoiceDetail(PurchaseInvoiceDetail purchaseinvoicedetail)
        {
            PurchaseInvoiceDetailData data = new PurchaseInvoiceDetailData();

            try
            {
                data.AddUpdatePurchaseInvoiceDetail(purchaseinvoicedetail);
                // this.PurchaseOrderStatusChanged += new OrderEventsHandler(PurchaseInvoiceDetail_OrderStatusChanged);

                PurchaseInvoiceHeader           head = new PurchaseInvoiceHeader();
                PurchaseInvoiceHeaderCollection col  = new PurchaseInvoiceHeaderCollection();

                head = head.GetPurchaseInvoiceHeader(purchaseinvoicedetail.InvoiceID);

                /*this.OrderStatusChanged += new OrderEventsHandler(PurchaseInvoiceHeader_OrderStatusChanged);*/
                // if (head.Status == (byte)OrderStatus.Received)
                // {
                //    OnPurchaseOrderStatusChanged(purchaseinvoicedetail.ProductID, purchaseinvoicedetail.Quantity);

                // }
                UpdateInvoiceTotal(purchaseinvoicedetail.InvoiceID);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddUpdatePurchaseInvoiceDetail");
                throw (ex);
            }
            finally
            {
                data = null;
            }
        }
        private void UpdateInvoiceTotal(int invoiceDetailID, bool flag)
        {
            PurchaseInvoiceHeader           pih     = new PurchaseInvoiceHeader();
            PurchaseInvoiceDetail           pid     = new PurchaseInvoiceDetail();
            PurchaseInvoiceDetailCollection pidColl = new PurchaseInvoiceDetailCollection();

            try
            {
                pid = pid.GetPurchaseInvoiceDetails(invoiceDetailID);
                int invoiceID = pid.InvoiceID;
                string where = "invoiceID = " + invoiceID;
                string orderby = String.Empty;
                pidColl = pid.GetPurchaseInvoiceDetailsCollection(where, orderby);

                decimal total = 0.00m;
                foreach (PurchaseInvoiceDetail p in pidColl)
                {
                    total += (decimal)(p.UnitPrice * p.Quantity);
                }
                pih          = pih.GetPurchaseInvoiceHeader(invoiceID);
                pih.TotalDue = total;
                pih.UpdatePurchaseInvoiceHeader(pih);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateInvoiceTotal");
                throw (ex);
            }
            finally
            {
                pih     = null;
                pid     = null;
                pidColl = null;
            }
        }
示例#3
0
        public PurchaseInvoiceHeader GetPurchaseInvoiceHeader(int purchaseInvoiceHeaderID)
        {
            PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData();
            PurchaseInvoiceHeader     pih  = new PurchaseInvoiceHeader();

            try
            {
                pih = data.GetPurchaseInvoiceHeader(purchaseInvoiceHeaderID);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetPurchaseInvoiceHeader");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(pih);
        }
示例#4
0
        public int AddPurchaseInvoiceHeader(PurchaseInvoiceHeader purchaseinvoiceheader)
        {
            PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData();
            int purchaseInoviceHeaderID    = 0;

            try
            {
                purchaseInoviceHeaderID = data.AddPurchaseInvoiceHeader(purchaseinvoiceheader);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddPurchaseInvoiceHeader");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(purchaseInoviceHeaderID);
        }
示例#5
0
        public bool UpdatePurchaseInvoiceHeader(PurchaseInvoiceHeader purchaseinvoiceheader)
        {
            PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData();
            bool ret = false;

            try
            {
                ret = data.UpdatePurchaseInvoiceHeader(purchaseinvoiceheader);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdatePurchaseInvoiceHeader");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(ret);
        }
示例#6
0
 public bool Contains(PurchaseInvoiceHeader purchaseInvoiceHeader)
 {
     return(this.List.Contains(purchaseInvoiceHeader));
 }
示例#7
0
 public void Remove(PurchaseInvoiceHeader purchaseInvoiceHeader)
 {
     this.List.Remove(purchaseInvoiceHeader);
 }
示例#8
0
 public void Insert(int index, PurchaseInvoiceHeader purchaseInvoiceHeader)
 {
     this.List.Insert(index, purchaseInvoiceHeader);
 }
示例#9
0
 public int IndexOf(PurchaseInvoiceHeader purchaseInvoiceHeader)
 {
     return(this.List.IndexOf(purchaseInvoiceHeader));
 }
示例#10
0
 public int Add(PurchaseInvoiceHeader purchaseInvoiceHeader)
 {
     return(this.List.Add(purchaseInvoiceHeader));
 }