Esempio n. 1
0
 public void RemoveBillDetail(BillDetail billDetail)
 {
     if (this.BillDetails != null)
     {
         this.BillDetails.Remove(billDetail);
     }
 }
Esempio n. 2
0
 public void AddBillDetail(BillDetail billDetail)
 {
     if (this.BillDetails == null)
     {
         this.BillDetails = new List<BillDetail>();
     }
     this.BillDetails.Add(billDetail);
 }
Esempio n. 3
0
        private void RecordBillTransaction(BillDetail billDetail, DateTime effectiveDate, bool isCancel)
        {
            DateTime dateTimeNow = DateTime.Now;

            BillTransaction billTransaction = new BillTransaction();
            billTransaction.ActingBill = billDetail.ActingBillId;
            billTransaction.BillDetail = billDetail.Id;
            billTransaction.Currency = billDetail.Currency;
            billTransaction.EffectiveDate = effectiveDate;
            billTransaction.ExternalIpNo = billDetail.ExternalIpNo;
            billTransaction.ExternalReceiptNo = billDetail.ExternalReceiptNo;
            billTransaction.IpNo = billDetail.IpNo;
            billTransaction.IsIncludeTax = billDetail.IsIncludeTax;
            billTransaction.IsProvisionalEstimate = billDetail.IsProvisionalEstimate;
            billTransaction.Item = billDetail.Item;
            billTransaction.ItemDescription = billDetail.ItemDescription;
            billTransaction.LocationFrom = billDetail.LocationFrom;
            billTransaction.OrderNo = billDetail.OrderNo;
            billTransaction.Party = billDetail.Party;
            billTransaction.PartyName = billDetail.PartyName;
            billTransaction.PriceList = billDetail.PriceList;
            billTransaction.ReceiptNo = billDetail.ReceiptNo;
            billTransaction.UnitCount = billDetail.UnitCount;
            billTransaction.UnitPrice = billDetail.UnitPrice;
            billTransaction.Uom = billDetail.Uom;
            billTransaction.UnitQty = billDetail.UnitQty;

            if (billDetail.Type == CodeMaster.BillType.Procurement)
            {
                if (isCancel)
                {
                    //采购开票冲销负数
                    billTransaction.TransactionType = CodeMaster.BillTransactionType.POBilledVoid;
                    billTransaction.BillQty = -billDetail.Qty;
                    billTransaction.BillAmount = -billDetail.Amount;
                }
                else
                {
                    //采购开票正数
                    billTransaction.TransactionType = CodeMaster.BillTransactionType.POBilled;
                    billTransaction.BillQty = billDetail.Qty;
                    billTransaction.BillAmount = billDetail.Amount;
                }
            }
            else
            {
                if (isCancel)
                {
                    //销售开票冲销负数
                    billTransaction.TransactionType = CodeMaster.BillTransactionType.SOBilledVoid;
                    billTransaction.BillQty = -billDetail.Qty;
                    billTransaction.BillAmount = -billDetail.Amount;
                }
                else
                {
                    //销售开票正数
                    billTransaction.TransactionType = CodeMaster.BillTransactionType.SOBilled;
                    billTransaction.BillQty = billDetail.Qty;
                    billTransaction.BillAmount = billDetail.Amount;
                }
            }
            User user = SecurityContextHolder.Get();
            billTransaction.CreateUserId = user.Id;
            billTransaction.CreateUserName = user.FullName;
            billTransaction.CreateDate = DateTime.Now;
            this.genericMgr.Create(billTransaction);
        }
Esempio n. 4
0
        private void ReverseActingBill(BillDetail billDetail)
        {
            #region 扣减旧BillDetail的数量和金额
            ActingBill actingBill = this.genericMgr.FindById<ActingBill>(billDetail.ActingBillId);
            actingBill.BillingQty -= billDetail.Qty;
            actingBill.BillingAmount -= billDetail.Amount;
            actingBill.BillingQty += billDetail.CurrentBillQty;
            actingBill.BillingAmount += billDetail.CurrentBillAmount;

            if ((actingBill.BillQty > 0 && actingBill.BillQty < actingBill.BillingQty)
                || (actingBill.BillQty < 0 && actingBill.BillQty > actingBill.BillingQty))
            {
                throw new BusinessException("ActingBill.Error.CurrentBillQtyGeRemainQty");
            }

            if ((actingBill.BillAmount > 0 && actingBill.BillAmount < actingBill.BillingAmount)
                || (actingBill.BillAmount < 0 && actingBill.BillAmount > actingBill.BillingAmount))
            {
                throw new BusinessException("ActingBill.Error.CurrentBillAmountGeRemainAmount");
            }

            if (actingBill.BillQty == actingBill.BillingQty
                && actingBill.BillAmount == actingBill.BillingAmount)
            {
                actingBill.IsClose = true;
            }
            else
            {
                actingBill.IsClose = false;
            }
            this.genericMgr.Update(actingBill);
            #endregion
        }