示例#1
0
        public IList <ActingBill> ManualCreateActingBill(IList <PlannedBill> plannedBillList, User user)
        {
            if (plannedBillList != null && plannedBillList.Count > 0)
            {
                IList <ActingBill> actingBillList       = new List <ActingBill>();
                IList <ActingBill> actingBillToBillList = new List <ActingBill>();

                foreach (PlannedBill plannedBill in plannedBillList)
                {
                    ActingBill actingBill = ManualCreateActingBill(plannedBill, user);
                    actingBillList.Add(actingBill);
                    if (plannedBill.IsAutoBill)
                    {
                        actingBill.CurrentBillQty  = actingBill.BillQty;
                        actingBill.CurrentDiscount = actingBill.UnitPrice * actingBill.BillQty - actingBill.BillAmount;
                        actingBillToBillList.Add(actingBill);
                    }
                }

                if (actingBillToBillList.Count > 0)
                {
                    this.CreateBill(actingBillToBillList, user);
                }

                return(actingBillList);
            }

            return(null);
        }
示例#2
0
    public IList <ActingBill> PopulateSelectedData()
    {
        if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0)
        {
            IList <ActingBill> actingBillList = new List <ActingBill>();
            foreach (GridViewRow row in this.GV_List.Rows)
            {
                CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    HiddenField hfId       = row.FindControl("hfId") as HiddenField;
                    TextBox     tbQty      = row.FindControl("tbQty") as TextBox;
                    TextBox     tbDiscount = row.FindControl("tbDiscount") as TextBox;

                    ActingBill actingBill = new ActingBill();
                    actingBill.Id              = int.Parse(hfId.Value);
                    actingBill.CurrentBillQty  = decimal.Parse(tbQty.Text);
                    actingBill.CurrentDiscount = decimal.Parse(tbDiscount.Text);

                    actingBillList.Add(actingBill);
                }
            }
            return(actingBillList);
        }

        return(null);
    }
示例#3
0
    protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ActingBill actingBill = (ActingBill)e.Row.DataItem;

            decimal billAmount = actingBill.BillAmount;
            decimal unitPrice  = actingBill.UnitPrice;

            decimal remailQty    = actingBill.BillQty - actingBill.BilledQty;
            decimal remailAmount = unitPrice * remailQty;
            decimal discount     = unitPrice * remailQty - remailAmount;

            TextBox tbQty          = e.Row.FindControl("tbQty") as TextBox;
            TextBox tbDiscountRate = e.Row.FindControl("tbDiscountRate") as TextBox;
            TextBox tbDiscount     = e.Row.FindControl("tbDiscount") as TextBox;
            TextBox tbAmount       = e.Row.FindControl("tbAmount") as TextBox;

            tbQty.Text = remailQty.ToString("F2");
            if (unitPrice != 0 && remailQty != 0)
            {
                tbDiscountRate.Text = "0";
                // tbDiscountRate.Text = (Math.Round(discount / (unitPrice * remailQty), this.DecimalLength, MidpointRounding.AwayFromZero) * 100).ToString("F2");
            }
            tbDiscount.Text = "0";
            tbAmount.Text   = remailAmount.ToString("F2");
            tbAmount.Attributes["oldValue"] = tbAmount.Text;
        }
    }
示例#4
0
    public IList <ActingBill> PopulateSelectedData()
    {
        if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0)
        {
            IList <ActingBill> actingBillList = new List <ActingBill>();
            foreach (GridViewRow row in this.GV_List.Rows)
            {
                CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    HiddenField hfId       = row.FindControl("hfId") as HiddenField;
                    ActingBill  actingBill = TheActingBillMgr.LoadActingBill(int.Parse(hfId.Value));
                    actingBillList.Add(actingBill);
                }
            }
            return(actingBillList);
        }

        return(null);
    }
示例#5
0
        public ActingBill ManualCreateActingBill(PlannedBill plannedBill, LocationLotDetail locationLotDetail, User user)
        {
            IList <LocationLotDetail> locationLotDetailList = this.locationLotDetailMgr.GetLocationLotDetail(plannedBill);

            if (locationLotDetailList != null && locationLotDetailList.Count > 0)
            {
                decimal actingQty = Math.Round(plannedBill.CurrentActingQty * plannedBill.UnitQty, 8);

                foreach (LocationLotDetail currentLocationLotDetail in locationLotDetailList)
                {
                    if (actingQty > 0)
                    {
                        #region 更新库存寄售标记
                        if (actingQty - currentLocationLotDetail.Qty >= 0)
                        {
                            actingQty -= currentLocationLotDetail.Qty;
                            currentLocationLotDetail.IsConsignment = false;
                            currentLocationLotDetail.PlannedBill   = null;
                        }
                        else
                        {
                            //不支持同一库存记录进行部分结算
                            throw new BusinessErrorException("Location.Error.PlannedBill.CantSplitInventory");
                        }

                        this.locationLotDetailMgr.UpdateLocationLotDetail(currentLocationLotDetail);
                        #endregion
                    }
                    else
                    {
                        break;
                    }
                }
            }

            #region 创建ActBill
            ActingBill actingBill = this.CreateActingBill(plannedBill, locationLotDetail, user);
            #endregion

            return(actingBill);
        }
        public void RecordBillTransaction(PlannedBill plannedBill, ActingBill actingBill, LocationLotDetail locationLotDetail, User user)
        {
            #region 记BillTransaction
            DateTime dateTimeNow = DateTime.Now;

            BillTransaction billTransaction = new BillTransaction();
            billTransaction.OrderNo           = plannedBill.OrderNo;
            billTransaction.ExternalReceiptNo = plannedBill.ExternalReceiptNo;
            billTransaction.ReceiptNo         = plannedBill.ReceiptNo;
            billTransaction.Item                   = plannedBill.Item.Code;
            billTransaction.ItemDescription        = plannedBill.Item.Description;
            billTransaction.Uom                    = plannedBill.Uom.Code;
            billTransaction.BillAddress            = plannedBill.BillAddress.Code;
            billTransaction.BillAddressDescription = plannedBill.BillAddress.Address;
            billTransaction.Party                  = plannedBill.BillAddress.Party.Code;
            billTransaction.PartyName              = plannedBill.BillAddress.Party.Name;
            billTransaction.Qty                    = plannedBill.CurrentActingQty;
            billTransaction.EffectiveDate          = DateTime.Parse(dateTimeNow.ToShortDateString()); //仅保留年月日;
            billTransaction.TransactionType        = plannedBill.TransactionType;
            billTransaction.PlannedBill            = plannedBill.Id;
            billTransaction.CreateUser             = user.Code;
            billTransaction.CreateDate             = dateTimeNow;
            billTransaction.ActingBill             = actingBill.Id;
            billTransaction.LocationFrom           = plannedBill.LocationFrom;
            billTransaction.PartyFrom              = plannedBill.PartyFrom;
            billTransaction.IpNo                   = plannedBill.IpNo;
            billTransaction.ReferenceItemCode      = plannedBill.ReferenceItemCode;
            if (locationLotDetail != null)
            {
                billTransaction.Location     = locationLotDetail.Location.Code;
                billTransaction.LocationName = locationLotDetail.Location.Name;
                billTransaction.HuId         = locationLotDetail.Hu != null ? locationLotDetail.Hu.HuId : string.Empty;
                billTransaction.LotNo        = locationLotDetail.LotNo;
                billTransaction.BatchNo      = locationLotDetail.Id;
            }

            this.CreateBillTransaction(billTransaction);
            #endregion
        }
示例#7
0
        public void AddBillDetail(string billNo, IList <ActingBill> actingBillList, User user)
        {
            Bill oldBill = this.CheckAndLoadBill(billNo, true);

            #region 检查状态
            if (oldBill.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
            {
                throw new BusinessErrorException("Bill.Error.StatusErrorWhenAddDetail", oldBill.Status, oldBill.BillNo);
            }
            #endregion

            if (actingBillList != null && actingBillList.Count > 0)
            {
                foreach (ActingBill actingBill in actingBillList)
                {
                    ActingBill oldActingBill = this.actingBillMgr.LoadActingBill(actingBill.Id);
                    oldActingBill.CurrentBillQty  = actingBill.CurrentBillQty;
                    oldActingBill.CurrentDiscount = actingBill.CurrentDiscount;

                    BillDetail billDetail = this.billDetailMgr.TransferAtingBill2BillDetail(oldActingBill);
                    billDetail.Bill = oldBill;
                    oldBill.AddBillDetail(billDetail);

                    if (billDetail.IsProvEst && !oldBill.HasProvEst)
                    {
                        oldBill.HasProvEst = true;
                    }

                    this.billDetailMgr.CreateBillDetail(billDetail);
                    //扣减ActingBill数量和金额
                    this.actingBillMgr.ReverseUpdateActingBill(null, billDetail, user);
                }

                oldBill.LastModifyDate = DateTime.Now;
                oldBill.LastModifyUser = user;

                this.UpdateBill(oldBill);
            }
        }
示例#8
0
        public BillDetail TransferAtingBill2BillDetail(ActingBill actingBill)
        {
            EntityPreference entityPreference = this.entityPreferenceMgr.LoadEntityPreference(
                BusinessConstants.ENTITY_PREFERENCE_CODE_AMOUNT_DECIMAL_LENGTH);
            int        amountDecimalLength = int.Parse(entityPreference.Value);
            BillDetail billDetail          = new BillDetail();

            billDetail.ActingBill = actingBill;

            billDetail.Currency          = actingBill.Currency;
            billDetail.IsIncludeTax      = actingBill.IsIncludeTax;
            billDetail.TaxCode           = actingBill.TaxCode;
            billDetail.UnitPrice         = actingBill.UnitPrice;
            billDetail.BilledQty         = actingBill.CurrentBillQty;
            billDetail.Discount          = actingBill.CurrentDiscount;
            billDetail.LocationFrom      = actingBill.LocationFrom;
            billDetail.IpNo              = actingBill.IpNo;
            billDetail.ReferenceItemCode = actingBill.ReferenceItemCode;
            billDetail.IsProvEst         = actingBill.IsProvisionalEstimate;
            if (actingBill.CurrentBillQty != (actingBill.BillQty - actingBill.BilledQty))
            {
                //本次开票数量大于剩余数量
                if (Math.Abs(actingBill.CurrentBillQty) > Math.Abs(actingBill.BillQty - actingBill.BilledQty))
                {
                    throw new BusinessErrorException("ActingBill.Error.CurrentBillQtyGeRemainQty");
                }

                //本次开票数量小于剩余数量
                billDetail.OrderAmount = Math.Round((actingBill.BillAmount / actingBill.BillQty * actingBill.CurrentBillQty), amountDecimalLength, MidpointRounding.AwayFromZero);
            }
            else
            {
                //本次开票数量等于剩余数量
                billDetail.OrderAmount = actingBill.BillAmount - actingBill.BilledAmount;
            }

            return(billDetail);
        }
 public virtual void CreateActingBill(ActingBill entity)
 {
     Create(entity);
 }
示例#10
0
        private ActingBill RetriveActingBill(PlannedBill plannedBill, DateTime dateTimeNow, User user)
        {
            DateTime effectiveDate = DateTime.Parse(plannedBill.EffectiveDate.ToShortDateString());   //仅保留年月日

            DetachedCriteria criteria = DetachedCriteria.For <ActingBill>();

            criteria.Add(Expression.Eq("OrderNo", plannedBill.OrderNo));
            if (plannedBill.ExternalReceiptNo != null)
            {
                criteria.Add(Expression.Eq("ExternalReceiptNo", plannedBill.ExternalReceiptNo));
            }
            else
            {
                criteria.Add(Expression.IsNull("ExternalReceiptNo"));
            }
            criteria.Add(Expression.Eq("ReceiptNo", plannedBill.ReceiptNo));
            criteria.Add(Expression.Eq("TransactionType", plannedBill.TransactionType));
            criteria.Add(Expression.Eq("Item", plannedBill.Item));
            criteria.Add(Expression.Eq("BillAddress", plannedBill.BillAddress));
            criteria.Add(Expression.Eq("Uom", plannedBill.Uom));
            criteria.Add(Expression.Eq("UnitCount", plannedBill.UnitCount));
            criteria.Add(Expression.Eq("PriceList", plannedBill.PriceList));
            criteria.Add(Expression.Eq("UnitPrice", plannedBill.UnitPrice));
            criteria.Add(Expression.Eq("Currency", plannedBill.Currency));
            criteria.Add(Expression.Eq("IsIncludeTax", plannedBill.IsIncludeTax));
            if (plannedBill.TaxCode != null)
            {
                criteria.Add(Expression.Eq("TaxCode", plannedBill.TaxCode));
            }
            else
            {
                criteria.Add(Expression.IsNull("TaxCode"));
            }

            if (plannedBill.LocationFrom != null)
            {
                criteria.Add(Expression.Eq("LocationFrom", plannedBill.LocationFrom));
            }
            else
            {
                criteria.Add(Expression.IsNull("LocationFrom"));
            }

            criteria.Add(Expression.Eq("IsProvisionalEstimate", plannedBill.IsProvisionalEstimate));
            criteria.Add(Expression.Eq("EffectiveDate", effectiveDate));

            IList <ActingBill> actingBillList = this.criteriaMgr.FindAll <ActingBill>(criteria);

            ActingBill actingBill = null;

            if (actingBillList.Count == 0)
            {
                actingBill = new ActingBill();
                CloneHelper.CopyProperty(plannedBill, actingBill, PlannedBill2ActingBillCloneField);
                actingBill.EffectiveDate = effectiveDate;
                actingBill.CreateUser    = user;
                actingBill.CreateDate    = dateTimeNow;
            }
            else if (actingBillList.Count == 1)
            {
                actingBill = actingBillList[0];
            }
            else
            {
                throw new TechnicalException("Acting bill record consolidate error, find target acting bill number great than 1.");
            }


            actingBill.BillQty += plannedBill.CurrentActingQty;
            if (actingBill.BillQty != actingBill.BilledQty)
            {
                actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
            }
            else
            {
                actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
            }
            actingBill.LastModifyUser = user;
            actingBill.LastModifyDate = dateTimeNow;
            return(actingBill);
        }
示例#11
0
        public ActingBill CreateActingBill(PlannedBill plannedBill, LocationLotDetail locationLotDetail, User user)
        {
            PlannedBill oldPlannedBill = plannedBillMgr.LoadPlannedBill(plannedBill.Id);

            oldPlannedBill.CurrentActingQty = plannedBill.CurrentActingQty;

            //检验,已结算数+本次结算数不能大于总结算数量,可能有负数结算,所以要用绝对值比较
            if (!oldPlannedBill.ActingQty.HasValue)
            {
                oldPlannedBill.ActingQty = 0;
            }
            if (Math.Abs(oldPlannedBill.ActingQty.Value + oldPlannedBill.CurrentActingQty) > Math.Abs(oldPlannedBill.PlannedQty))
            {
                throw new BusinessErrorException("PlannedBill.Error.ActingQtyExceed");
            }

            DateTime dateTimeNow = DateTime.Now;

            ActingBill actingBill = this.RetriveActingBill(oldPlannedBill, dateTimeNow, user);

            #region 计算结算金额
            decimal currentBillAmount = 0;
            if (Math.Abs(oldPlannedBill.ActingQty.Value + oldPlannedBill.CurrentActingQty) < Math.Abs(oldPlannedBill.PlannedQty))
            {
                //总结算数小于计划数,用实际单价计算待开票金额

                #region 计算实际单价
                EntityPreference entityPreference = entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AMOUNT_DECIMAL_LENGTH);
                int     decimalLength             = int.Parse(entityPreference.Value);
                decimal actualUnitPrice           = Math.Round((oldPlannedBill.PlannedAmount / oldPlannedBill.PlannedQty), decimalLength, MidpointRounding.AwayFromZero);
                #endregion

                currentBillAmount = actualUnitPrice * oldPlannedBill.CurrentActingQty;
            }
            else
            {
                //总结算数等于计划数,先用剩余金额作为待开票金额
                if (!oldPlannedBill.ActingAmount.HasValue)
                {
                    oldPlannedBill.ActingAmount = 0;
                }
                currentBillAmount = oldPlannedBill.PlannedAmount - oldPlannedBill.ActingAmount.Value;
            }
            actingBill.BillAmount += currentBillAmount;
            #endregion

            #region 更新Planed Bill的已结算数量和金额
            if (!oldPlannedBill.ActingQty.HasValue)
            {
                oldPlannedBill.ActingQty = 0;
            }
            oldPlannedBill.ActingQty += oldPlannedBill.CurrentActingQty;

            if (!oldPlannedBill.ActingAmount.HasValue)
            {
                oldPlannedBill.ActingAmount = 0;
            }
            oldPlannedBill.ActingAmount  += currentBillAmount;
            oldPlannedBill.LastModifyDate = dateTimeNow;
            oldPlannedBill.LastModifyUser = user;

            this.plannedBillMgr.UpdatePlannedBill(oldPlannedBill);
            #endregion

            if (actingBill.Id == 0)
            {
                actingBillMgr.CreateActingBill(actingBill);
            }
            else
            {
                actingBillMgr.UpdateActingBill(actingBill);
            }

            #region 记BillTransaction
            billTransactionMgr.RecordBillTransaction(plannedBill, actingBill, locationLotDetail, user);
            #endregion

            return(actingBill);
        }
 public virtual void DeleteActingBill(ActingBill entity)
 {
     Delete(entity);
 }
示例#13
0
        public IList <Bill> CreateBill(IList <ActingBill> actingBillList, User user, string status, decimal discount)
        {
            if (status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE &&
                status != BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT &&
                status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE)
            {
                throw new TechnicalException("status specified is not valided");
            }


            if (actingBillList == null || actingBillList.Count == 0)
            {
                throw new BusinessErrorException("Bill.Error.EmptyBillDetails");
            }

            DateTime     dateTimeNow = DateTime.Now;
            IList <Bill> billList    = new List <Bill>();

            foreach (ActingBill actingBill in actingBillList)
            {
                ActingBill oldActingBill = this.actingBillMgr.LoadActingBill(actingBill.Id);
                oldActingBill.CurrentBillQty  = actingBill.CurrentBillQty;
                oldActingBill.CurrentDiscount = actingBill.CurrentDiscount;

                ////检查ActingBill的剩余待开数量是否为0
                //if (oldActingBill.Qty - oldActingBill.BilledQty == 0)
                //{
                //    throw new BusinessErrorException("Bill.Create.Error.ZeroActingBillRemainQty");
                //}

                Bill bill = null;

                #region 查找和待开明细的transactionType、billAddress、currency一致的BillMstr
                foreach (Bill thisBill in billList)
                {
                    if (thisBill.TransactionType == oldActingBill.TransactionType &&
                        thisBill.BillAddress.Code == oldActingBill.BillAddress.Code &&
                        thisBill.Currency.Code == oldActingBill.Currency.Code)
                    {
                        bill = thisBill;
                        break;
                    }
                }
                #endregion

                #region 没有找到匹配的Bill,新建
                if (bill == null)
                {
                    #region 检查权限
                    bool hasPermission = false;
                    if (user.Code == BusinessConstants.SYSTEM_USER_MONITOR)
                    {
                        hasPermission = true;
                    }
                    else
                    {
                        foreach (Permission permission in user.OrganizationPermission)
                        {
                            if (permission.Code == oldActingBill.BillAddress.Party.Code)
                            {
                                hasPermission = true;
                                break;
                            }
                        }
                    }

                    if (!hasPermission)
                    {
                        throw new BusinessErrorException("Bill.Create.Error.NoAuthrization", oldActingBill.BillAddress.Party.Code);
                    }
                    #endregion

                    #region 创建Bill
                    bill                 = new Bill();
                    bill.BillNo          = numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_BILL);
                    bill.Status          = status;
                    bill.TransactionType = oldActingBill.TransactionType;
                    bill.BillAddress     = oldActingBill.BillAddress;
                    bill.Currency        = oldActingBill.Currency;
                    bill.Discount        = discount;            //可能有问题
                    bill.BillType        = BusinessConstants.CODE_MASTER_BILL_TYPE_VALUE_NORMAL;
                    bill.CreateDate      = dateTimeNow;
                    bill.CreateUser      = user;
                    bill.LastModifyDate  = dateTimeNow;
                    bill.LastModifyUser  = user;
                    bill.HasProvEst      = false;

                    this.CreateBill(bill);
                    billList.Add(bill);
                    #endregion
                }
                #endregion

                BillDetail billDetail = this.billDetailMgr.TransferAtingBill2BillDetail(oldActingBill);
                billDetail.Bill = bill;
                bill.AddBillDetail(billDetail);

                #region 更新头上暂估表及
                if (billDetail.IsProvEst && !bill.HasProvEst)
                {
                    bill.HasProvEst     = true;
                    bill.LastModifyDate = dateTimeNow;
                    bill.LastModifyUser = user;
                    this.UpdateBill(bill);
                }
                #endregion

                this.billDetailMgr.CreateBillDetail(billDetail);
                //扣减ActingBill数量和金额
                this.actingBillMgr.ReverseUpdateActingBill(null, billDetail, user);
            }


            return(billList);
        }
示例#14
0
 public virtual void CreateActingBill(ActingBill entity)
 {
     entityDao.CreateActingBill(entity);
 }
 public virtual void UpdateActingBill(ActingBill entity)
 {
     Update(entity);
 }
示例#16
0
        public void ReverseUpdateActingBill(BillDetail oldBillDetail, BillDetail newBillDetail, User user)
        {
            if (oldBillDetail != null && newBillDetail != null &&
                oldBillDetail.ActingBill.Id != newBillDetail.ActingBill.Id)
            {
                throw new TechnicalException("oldBillDetail.ActingBill.Id != newBillDetail.ActingBill.Id when ReverseUpdateActingBill");
            }

            DateTime dateTimeNow = DateTime.Now;

            #region 扣减旧BillDetail的数量和金额
            if (oldBillDetail != null)
            {
                //todo 校验数量、金额
                ActingBill actingBill = this.LoadActingBill(oldBillDetail.ActingBill.Id);
                actingBill.BilledQty     -= oldBillDetail.BilledQty;
                actingBill.BilledAmount  -= oldBillDetail.OrderAmount;
                actingBill.LastModifyDate = dateTimeNow;
                actingBill.LastModifyUser = user;
                if (actingBill.BillQty == actingBill.BilledQty)
                {
                    actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                }
                else
                {
                    actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
                }
                this.UpdateActingBill(actingBill);
            }
            #endregion

            #region 增加新BillDetail的数量和金额
            if (newBillDetail != null)
            {
                //todo 校验数量、金额
                ActingBill actingBill = this.LoadActingBill(newBillDetail.ActingBill.Id);

                #region 根据新开票数量计算开票金额
                EntityPreference entityPreference = this.entityPreferenceMgr.LoadEntityPreference(
                    BusinessConstants.ENTITY_PREFERENCE_CODE_AMOUNT_DECIMAL_LENGTH);
                int amountDecimalLength = int.Parse(entityPreference.Value);
                if (newBillDetail.BilledQty != (actingBill.BillQty - actingBill.BilledQty))
                {
                    //本次开票数量大于剩余数量
                    if ((actingBill.BillQty > 0 && actingBill.BillQty - actingBill.BilledQty - newBillDetail.BilledQty < 0) ||
                        (actingBill.BillQty < 0 && actingBill.BillQty - actingBill.BilledQty - newBillDetail.BilledQty > 0))
                    {
                        throw new BusinessErrorException("ActingBill.Error.CurrentBillQtyGeRemainQty");
                    }

                    //本次开票数量小于剩余数量
                    newBillDetail.OrderAmount = Math.Round((actingBill.BillAmount / actingBill.BillQty * newBillDetail.BilledQty), amountDecimalLength, MidpointRounding.AwayFromZero);
                }
                else
                {
                    //本次开票数量等于剩余数量
                    newBillDetail.OrderAmount = actingBill.BillAmount - actingBill.BilledAmount;
                }
                #endregion

                actingBill.BilledQty     += newBillDetail.BilledQty;
                actingBill.BilledAmount  += newBillDetail.OrderAmount;
                actingBill.LastModifyDate = dateTimeNow;
                actingBill.LastModifyUser = user;
                if (actingBill.BillQty == actingBill.BilledQty)
                {
                    actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                }
                else
                {
                    actingBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
                }
                this.UpdateActingBill(actingBill);
            }
            #endregion
        }
示例#17
0
 public virtual void DeleteActingBill(ActingBill entity)
 {
     entityDao.DeleteActingBill(entity);
 }
示例#18
0
 public virtual void UpdateActingBill(ActingBill entity)
 {
     entityDao.UpdateActingBill(entity);
 }