protected void FV_TransportPriceListDetail_DataBound(object sender, EventArgs e) { ((Literal)(this.FV_WarehouseLease.FindControl("lbCurrentTransportPriceList"))).Text = this.TransportPriceListCode; if (TransportPriceListDetailId != null && TransportPriceListDetailId != string.Empty) { TransportPriceListDetail transportPriceListDetail = (TransportPriceListDetail)((FormView)sender).DataItem; Controls_TextBox tbCurrency = (Controls_TextBox)(this.FV_WarehouseLease.FindControl("tbCurrency")); if (transportPriceListDetail.Currency != null && transportPriceListDetail.Currency.Code != string.Empty) { tbCurrency.Text = transportPriceListDetail.Currency.Code; } TextBox tbStartDate = ((TextBox)(this.FV_WarehouseLease.FindControl("tbStartDate"))); if (transportPriceListDetail.StartDate != null) { tbStartDate.Text = transportPriceListDetail.StartDate.ToString("yyyy-MM-dd"); } TextBox tbEndDate = ((TextBox)(this.FV_WarehouseLease.FindControl("tbEndDate"))); if (transportPriceListDetail.EndDate != null) { tbEndDate.Text = ((DateTime)transportPriceListDetail.EndDate).ToString("yyyy-MM-dd"); } } }
public void CreateTransportationActBill(TransportPriceListDetail priceListDetail) { TransportationActBill actBill = new TransportationActBill(); actBill.BillAddress = billAddressMgr.GetDefaultBillAddress(priceListDetail.TransportPriceList.Party.Code); if (actBill.BillAddress == null) { throw new BusinessErrorException("Transportation.Error.CarrierPrimaryBillAddressEmpty"); } actBill.PriceListDetail = priceListDetail; actBill.PriceList = priceListDetail.TransportPriceList; actBill.UnitPrice = priceListDetail.UnitPrice * (1 + priceListDetail.ServiceCharge); actBill.TransType = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_WAREHOUSELEASE; actBill.BillQty = 1; actBill.BillAmount = actBill.BillQty * actBill.UnitPrice; actBill.Currency = priceListDetail.Currency; actBill.EffectiveDate = DateTime.Now.Date; actBill.CreateDate = DateTime.Now; actBill.CreateUser = userMgr.GetMonitorUser(); actBill.IsIncludeTax = priceListDetail.IsIncludeTax; actBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = userMgr.GetMonitorUser(); actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; actBill.TaxCode = priceListDetail.TaxCode; CreateTransportationActBill(actBill); }
public TransportPriceListDetail GetLastestLadderStereTransportPriceListDetail(TransportPriceList priceList, Item item, DateTime effectiveDate, Currency currency, Uom uom, string pricingMethod, TransportationAddress shipFrom, TransportationAddress shipTo, string priceListType, string billingMethod, string vehicleType, decimal qty) { TransportPriceListDetail priceListDetail = null; DetachedCriteria detachedCriteria = DetachedCriteria.For <TransportPriceListDetail>(); detachedCriteria.Add(Expression.Eq("TransportPriceList.Code", priceList.Code)); if (item != null) { detachedCriteria.Add(Expression.Eq("Item.Code", item.Code)); } detachedCriteria.Add(Expression.Eq("Currency.Code", currency.Code)); if (uom != null) { detachedCriteria.Add(Expression.Eq("Uom.Code", uom.Code)); } detachedCriteria.Add(Expression.Le("StartDate", effectiveDate)); detachedCriteria.Add(Expression.Or(Expression.Ge("EndDate", effectiveDate.Date), Expression.IsNull("EndDate"))); if (pricingMethod != null && pricingMethod != string.Empty) { detachedCriteria.Add(Expression.Eq("PricingMethod", pricingMethod)); } if (shipFrom != null) { detachedCriteria.Add(Expression.Eq("ShipFrom.Id", shipFrom.Id)); } if (shipTo != null) { detachedCriteria.Add(Expression.Eq("ShipTo.Id", shipTo.Id)); } if (billingMethod != null && billingMethod != string.Empty) { detachedCriteria.Add(Expression.Eq("BillingMethod", billingMethod)); } if (vehicleType != null && vehicleType != string.Empty) { detachedCriteria.Add(Expression.Eq("VehicleType", vehicleType)); } detachedCriteria.Add(Expression.Eq("Type", priceListType)); detachedCriteria.Add(Expression.IsNotNull("StartQty")); // detachedCriteria.Add(Expression.IsNotNull("EndQty")); detachedCriteria.AddOrder(Order.Desc("StartDate")); //按StartDate降序,取最新的价格 IList <TransportPriceListDetail> priceListDetailList = criteriaMgr.FindAll <TransportPriceListDetail>(detachedCriteria); if (priceListDetailList != null && priceListDetailList.Count > 0) { priceListDetail = priceListDetailList.Where(p => p.StartQty.Value < qty && (p.EndQty == null || p.EndQty.Value >= qty)).FirstOrDefault(); if (priceListDetail == null) { priceListDetail = priceListDetailList.OrderBy(p => p.StartQty.Value).FirstOrDefault(); } } return(priceListDetail); }
protected void ODS_TransportPriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_WarehouseLease.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_WarehouseLease.FindControl("tbEndDate"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.Remark = transportPriceListDetail.Remark.Trim(); transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_WAREHOUSELEASE; }
public TransportationActBill CreateTransportationItemActBill(Receipt receipt, string billingMethod) { TransportationActBill actBill = new TransportationActBill(); TransportPriceList transportPriceList = null; if (billingMethod == BusinessConstants.TRANSPORTATION_BILLING_METHOD_OUT) { transportPriceList = transportPriceListMgr.LoadTransportPriceList(receipt.PartyFrom.Code); } if (transportPriceList != null) { Currency currency = receipt.ReceiptDetails[0].OrderLocationTransaction.OrderDetail.OrderHead.Currency; foreach (ReceiptDetail receiptDetail in receipt.ReceiptDetails) { TransportPriceListDetail priceListDetail = transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportPriceList, receiptDetail.OrderLocationTransaction.Item, receipt.CreateDate, currency, receiptDetail.OrderLocationTransaction.OrderDetail.Item.Uom, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION, billingMethod); if (priceListDetail != null) { priceListDetail = transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportPriceList, null, receipt.CreateDate, currency, null, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION, billingMethod); } actBill.BillAddress = billAddressMgr.GetDefaultBillAddress(priceListDetail.TransportPriceList.Party.Code); actBill.PriceListDetail = priceListDetail; actBill.PriceList = priceListDetail.TransportPriceList; actBill.UnitPrice = priceListDetail.UnitPrice * (1 + priceListDetail.ServiceCharge); actBill.TransType = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION; actBill.BillQty = receiptDetail.ReceivedQty.Value; actBill.BillAmount = actBill.BillQty * actBill.UnitPrice; actBill.Currency = priceListDetail.Currency; actBill.EffectiveDate = DateTime.Now.Date; actBill.CreateDate = DateTime.Now; actBill.CreateUser = userMgr.GetMonitorUser(); actBill.IsIncludeTax = priceListDetail.IsIncludeTax; actBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = userMgr.GetMonitorUser(); actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; actBill.TaxCode = priceListDetail.TaxCode; } } return(actBill); }
protected void ODS_TransportPriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbItem = ((Controls_TextBox)(this.FV_Operation.FindControl("tbItem"))); com.Sconit.Control.CodeMstrDropDownList ddlBillingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Operation.FindControl("ddlBillingMethod"))); Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_Operation.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_Operation.FindControl("tbEndDate"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.Item = tbItem.Text.Trim() == String.Empty ? null : TheItemMgr.LoadItem(tbItem.Text.Trim()); transportPriceListDetail.BillingMethod = ddlBillingMethod.SelectedValue; transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION; }
protected void FV_TransportPriceListDetail_DataBound(object sender, EventArgs e) { ((Literal)(this.FV_Operation.FindControl("lbCurrentTransportPriceList"))).Text = this.TransportPriceListCode; if (TransportPriceListDetailId != null && TransportPriceListDetailId != string.Empty) { TransportPriceListDetail transportPriceListDetail = (TransportPriceListDetail)((FormView)sender).DataItem; Controls_TextBox tbItem = (Controls_TextBox)this.FV_Operation.FindControl("tbItem"); if (transportPriceListDetail.Item != null && transportPriceListDetail.Item.Code != string.Empty) { tbItem.Text = transportPriceListDetail.Item.Code; } com.Sconit.Control.CodeMstrDropDownList ddlBillingMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Operation.FindControl("ddlBillingMethod"); if (transportPriceListDetail.BillingMethod != null) { ddlBillingMethod.SelectedValue = transportPriceListDetail.BillingMethod; } Controls_TextBox tbCurrency = (Controls_TextBox)(this.FV_Operation.FindControl("tbCurrency")); if (transportPriceListDetail.Currency != null && transportPriceListDetail.Currency.Code != string.Empty) { tbCurrency.Text = transportPriceListDetail.Currency.Code; } TextBox tbStartDate = ((TextBox)(this.FV_Operation.FindControl("tbStartDate"))); if (transportPriceListDetail.StartDate != null) { tbStartDate.Text = transportPriceListDetail.StartDate.ToString("yyyy-MM-dd"); } TextBox tbEndDate = ((TextBox)(this.FV_Operation.FindControl("tbEndDate"))); if (transportPriceListDetail.EndDate != null) { tbEndDate.Text = ((DateTime)transportPriceListDetail.EndDate).ToString("yyyy-MM-dd"); } } }
protected void ODS_TransportPriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbShipFrom = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipFrom"))); Controls_TextBox tbShipTo = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipTo"))); com.Sconit.Control.CodeMstrDropDownList ddlPricingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlPricingMethod"))); DropDownList ddlVehicleType = ((DropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlVehicleType"))); Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbEndDate"))); DropDownList transportMethodSelect = ((DropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlTransportMethod"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.ShipFrom = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipFrom.Text.Trim())); transportPriceListDetail.ShipTo = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipTo.Text.Trim())); transportPriceListDetail.PricingMethod = ddlPricingMethod.SelectedValue; transportPriceListDetail.VehicleType = ddlVehicleType.SelectedValue; transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION; transportPriceListDetail.TransportMethod = transportMethodSelect.SelectedValue; }
public void RecalculatePrice(IList <TransportationActBill> transportationActBillList, User user, DateTime?efftiveDate) { if (transportationActBillList != null && transportationActBillList.Count > 0) { DateTime dateTimeNow = DateTime.Now; foreach (TransportationActBill transportationActBill in transportationActBillList) { TransportPriceListDetail transportPriceListDetail = null; if (efftiveDate.HasValue) { if (transportationActBill.PriceList != null) { transportPriceListDetail = this.transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportationActBill.PriceList, efftiveDate.Value, transportationActBill.Currency, transportationActBill.PricingMethod, transportationActBill.ShipFrom, transportationActBill.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, transportationActBill.VehicleType, transportationActBill.TransportMethod); } } else { if (transportationActBill.PriceList != null) { transportPriceListDetail = this.transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportationActBill.PriceList, transportationActBill.EffectiveDate, transportationActBill.Currency, transportationActBill.PricingMethod, transportationActBill.ShipFrom, transportationActBill.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, transportationActBill.VehicleType, transportationActBill.TransportMethod); } } if (transportPriceListDetail != null) { transportationActBill.UnitPrice = transportPriceListDetail.UnitPrice; transportationActBill.IsProvisionalEstimate = transportPriceListDetail.IsProvisionalEstimate; transportationActBill.LastModifyDate = dateTimeNow; transportationActBill.LastModifyUser = user; //不计折扣 transportationActBill.BillAmount = transportationActBill.UnitPrice * transportationActBill.BillQty; this.UpdateTransportationActBill(transportationActBill); } } } }
public void CreateTransportPriceListDetail(TransportPriceListDetail transportPriceListDetail) { TransportPriceListDetailMgr.CreateTransportPriceListDetail(transportPriceListDetail); }
protected void ODS_TransportPriceListDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbShipFrom = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipFrom"))); Controls_TextBox tbShipTo = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipTo"))); com.Sconit.Control.CodeMstrDropDownList ddlPricingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlPricingMethod"))); DropDownList ddlVehicleType = ((DropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlVehicleType"))); Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbEndDate"))); com.Sconit.Control.CodeMstrDropDownList ddlTransportMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlTransportMethod"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.ShipFrom = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipFrom.Text.Trim())); transportPriceListDetail.ShipTo = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipTo.Text.Trim())); transportPriceListDetail.PricingMethod = ddlPricingMethod.SelectedValue; transportPriceListDetail.VehicleType = ddlVehicleType.SelectedValue; transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION; transportPriceListDetail.TransportMethod = ddlTransportMethod.SelectedValue; }
protected void ODS_TransportPriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbItem = ((Controls_TextBox)(this.FV_Operation.FindControl("tbItem"))); com.Sconit.Control.CodeMstrDropDownList ddlBillingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Operation.FindControl("ddlBillingMethod"))); Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_Operation.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_Operation.FindControl("tbEndDate"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.Item = tbItem.Text.Trim() == String.Empty ? null : TheItemMgr.LoadItem(tbItem.Text.Trim()); transportPriceListDetail.BillingMethod = ddlBillingMethod.SelectedValue; transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION; }
protected void ODS_TransportPriceListDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_WarehouseLease.FindControl("tbCurrency"))); TextBox tbEndDate = ((TextBox)(this.FV_WarehouseLease.FindControl("tbEndDate"))); transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0]; transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode); transportPriceListDetail.Remark = transportPriceListDetail.Remark.Trim(); transportPriceListDetail.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); transportPriceListDetail.TaxCode = transportPriceListDetail.TaxCode.Trim(); transportPriceListDetail.EndDate = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate; transportPriceListDetail.Type = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_WAREHOUSELEASE; }
public void CreateTransportationActBill(TransportPriceListDetail priceListDetail) { TransportationActBill actBill = new TransportationActBill(); actBill.BillAddress = billAddressMgr.GetDefaultBillAddress(priceListDetail.TransportPriceList.Party.Code); if (actBill.BillAddress == null) { throw new BusinessErrorException("Transportation.Error.CarrierPrimaryBillAddressEmpty"); } actBill.PriceListDetail = priceListDetail; actBill.PriceList = priceListDetail.TransportPriceList; actBill.UnitPrice = priceListDetail.UnitPrice * (1 + priceListDetail.ServiceCharge); actBill.TransType = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_WAREHOUSELEASE; actBill.BillQty = 1; actBill.BillAmount = actBill.BillQty * actBill.UnitPrice; actBill.Currency = priceListDetail.Currency; actBill.EffectiveDate = DateTime.Now.Date; actBill.CreateDate = DateTime.Now; actBill.CreateUser = userMgr.GetMonitorUser(); actBill.IsIncludeTax = priceListDetail.IsIncludeTax; actBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = userMgr.GetMonitorUser(); actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; actBill.TaxCode = priceListDetail.TaxCode; CreateTransportationActBill(actBill); }
protected void FV_TransportPriceListDetail_DataBound(object sender, EventArgs e) { ((Literal)(this.FV_TransportPriceListDetail.FindControl("lbCurrentTransportPriceList"))).Text = this.TransportPriceListCode; if (TransportPriceListDetailId != null && TransportPriceListDetailId != string.Empty) { TransportPriceListDetail transportPriceListDetail = (TransportPriceListDetail)((FormView)sender).DataItem; Controls_TextBox tbShipFrom = (Controls_TextBox)this.FV_TransportPriceListDetail.FindControl("tbShipFrom"); if (transportPriceListDetail.ShipFrom != null && transportPriceListDetail.ShipFrom.Id.ToString() != string.Empty) { tbShipFrom.Text = transportPriceListDetail.ShipFrom.FullAddressAndId; } Controls_TextBox tbShipTo = (Controls_TextBox)this.FV_TransportPriceListDetail.FindControl("tbShipTo"); if (transportPriceListDetail.ShipTo != null && transportPriceListDetail.ShipTo.Id.ToString() != string.Empty) { tbShipTo.Text = transportPriceListDetail.ShipTo.FullAddressAndId; } com.Sconit.Control.CodeMstrDropDownList ddlPricingMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_TransportPriceListDetail.FindControl("ddlPricingMethod"); if (transportPriceListDetail.PricingMethod != null) { ddlPricingMethod.SelectedValue = transportPriceListDetail.PricingMethod; ddlPricingMethod_SelectedIndexChanged(null, null); } else { ddlPricingMethod.SelectedIndex = 0; } DropDownList ddlVehicleType = (DropDownList)this.FV_TransportPriceListDetail.FindControl("ddlVehicleType"); if (transportPriceListDetail.VehicleType != null) { ddlVehicleType.SelectedValue = transportPriceListDetail.VehicleType; } Controls_TextBox tbCurrency = (Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbCurrency")); if (transportPriceListDetail.Currency != null && transportPriceListDetail.Currency.Code != string.Empty) { tbCurrency.Text = transportPriceListDetail.Currency.Code; } TextBox tbStartDate = ((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbStartDate"))); if (transportPriceListDetail.StartDate != null) { tbStartDate.Text = transportPriceListDetail.StartDate.ToString("yyyy-MM-dd"); } TextBox tbEndDate = ((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbEndDate"))); if (transportPriceListDetail.EndDate != null) { tbEndDate.Text = ((DateTime)transportPriceListDetail.EndDate).ToString("yyyy-MM-dd"); } TextBox tbStartQty = (TextBox)(this.FV_TransportPriceListDetail.FindControl("tbStartQty")); if (transportPriceListDetail.StartQty != null) { tbStartQty.Text = transportPriceListDetail.StartQty.Value.ToString("0.########"); } TextBox tbEndQty = (TextBox)(this.FV_TransportPriceListDetail.FindControl("tbEndQty")); if (transportPriceListDetail.EndQty != null) { tbEndQty.Text = transportPriceListDetail.EndQty.Value.ToString("0.########"); } TextBox tbMinPrice = (TextBox)(this.FV_TransportPriceListDetail.FindControl("tbMinPrice")); if (transportPriceListDetail.MinPrice != null) { tbMinPrice.Text = transportPriceListDetail.MinPrice.Value.ToString("0.########"); } DropDownList ddlTransportMethod = (DropDownList)this.FV_TransportPriceListDetail.FindControl("ddlTransportMethod"); if (transportPriceListDetail.TransportMethod != null) { ddlTransportMethod.SelectedValue = transportPriceListDetail.TransportMethod; } //HtmlSelect transportMethodSelect = (HtmlSelect)(this.FV_TransportPriceListDetail.FindControl("TransportMethodSelect")); //IList<CodeMaster> codeMasterList = TheGenericMgr.FindAllWithCustomQuery<CodeMaster>(" from CodeMaster as c where c.Code='TransportMethod' " ); //string transportMethod=transportPriceListDetail.TransportMethod; //foreach (var codeMaster in codeMasterList.OrderBy(c => c.Seq)) //{ // if (transportMethod == codeMaster.Code) // { // transportMethodSelect.Items.Add(new ListItem(codeMaster.Description, codeMaster.Value)); // } // else // { // transportMethodSelect.Items.Add(new ListItem(codeMaster.Description, codeMaster.Value)); // } //} } }
public virtual void DeleteTransportPriceListDetail(TransportPriceListDetail entity) { Delete(entity); }
public TransportationActBill CreateTransportationActBill(TransportationOrder order, User user) { TransportationActBill actBill = new TransportationActBill(); if (order.Expense != null) { actBill.BillAmount = order.Expense.Amount; actBill.UnitPrice = order.Expense.Amount; actBill.BillQty = 1; actBill.Currency = order.Expense.Currency; actBill.IsIncludeTax = order.Expense.IsIncludeTax; actBill.Currency.Code = order.Expense.Currency.Code; actBill.IsProvisionalEstimate = false; } else { string currency = null; foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { #region currency if (orderDetail.InProcessLocation.Flow.Currency == null) { throw new BusinessErrorException("Transportation.Flow.CurrencyEmpty", orderDetail.InProcessLocation.Flow.Code); } if (currency == null) { currency = orderDetail.InProcessLocation.Flow.Currency.Code; } else if (currency != orderDetail.InProcessLocation.Flow.Currency.Code) { throw new BusinessErrorException("Transportation.OrderDetail.CurrencyNotEqual"); } #endregion } IList <TransportPriceList> transportPriceList = transportPriceListMgr.GetTransportPriceList(order.Carrier.Code); if (transportPriceList == null || transportPriceList.Count == 0) { throw new BusinessErrorException("Transportation.PriceList.Empty", order.Carrier.Code); } if (transportPriceList.Count > 1) { throw new BusinessErrorException("Transportation.PriceList.MoreThanOne", order.Carrier.Code); } TransportPriceListDetail priceListDetail = null; if (order.PricingMethod != BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { priceListDetail = this.transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportPriceList[0] , order.CreateDate, currencyMgr.LoadCurrency(currency), order.PricingMethod, order.TransportationRoute.ShipFrom, order.TransportationRoute.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, order.VehicleType, order.TransportMethod); } #region 包车 if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_SHIPT) { actBill.BillQty = 1; if (priceListDetail != null && actBill.UnitPrice == 0) { actBill.UnitPrice = priceListDetail.UnitPrice; actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; } } #endregion #region 体积和阶梯 else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { decimal totalVolume = 0; foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { foreach (InProcessLocationDetail ipDet in orderDetail.InProcessLocation.InProcessLocationDetails) { if (!ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.HasValue || ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.Value == 0) { throw new BusinessErrorException("Transportation.PackageVolumn.Empty", ipDet.InProcessLocation.IpNo, ipDet.OrderLocationTransaction.Item.Code); } else { if (ipDet.OrderLocationTransaction.OrderDetail.HuLotSize == null || ipDet.OrderLocationTransaction.OrderDetail.HuLotSize.Value == 0) { throw new BusinessErrorException("Transportation.HuLotSize.Empty", ipDet.InProcessLocation.IpNo, ipDet.OrderLocationTransaction.Item.Code); } int box = Convert.ToInt32(Math.Ceiling(ipDet.Qty / (decimal)(ipDet.OrderLocationTransaction.OrderDetail.HuLotSize.Value))); totalVolume += ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.Value * box; } } } #region 托盘数 if (order.PallentCount != 0) { decimal pallentVolume = decimal.Parse(entityPreferenceMgr.LoadEntityPreference( BusinessConstants.ENTITY_PREFERENCE_CODE_PALLENTVOLUME).Value); totalVolume += pallentVolume * order.PallentCount; } #endregion if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3) { #region 最小起运量 if (totalVolume < priceListDetail.MinVolume) { totalVolume = priceListDetail.MinVolume; } #endregion actBill.BillQty = totalVolume; if (priceListDetail != null && actBill.UnitPrice == 0) { actBill.UnitPrice = priceListDetail.UnitPrice; } actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; } #region 阶梯 else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { priceListDetail = this.transportPriceListDetailMgr.GetLastestLadderStereTransportPriceListDetail(transportPriceList[0], null, order.CreateDate, currencyMgr.LoadCurrency(currency), null, order.PricingMethod, order.TransportationRoute.ShipFrom, order.TransportationRoute.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, null, order.VehicleType, totalVolume); if (priceListDetail == null) { throw new BusinessErrorException("Transportation.PriceListDetail.Empty", order.PricingMethod); } #region 最小起运量 if (totalVolume < priceListDetail.MinVolume) { totalVolume = priceListDetail.MinVolume; } #endregion actBill.UnitPrice = priceListDetail.UnitPrice; actBill.BillQty = totalVolume; decimal minPrice = priceListDetail.MinPrice.HasValue ? priceListDetail.MinPrice.Value : 0; actBill.BillAmount = minPrice + actBill.UnitPrice * actBill.BillQty; } #endregion } #endregion #region 重量 else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) { } #endregion else { throw new BusinessErrorException("Transportation.PricingMethod.Empty"); } actBill.UnitPrice = priceListDetail.UnitPrice; // actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; actBill.Currency = priceListDetail.Currency; actBill.IsIncludeTax = priceListDetail.IsIncludeTax; actBill.Currency = priceListDetail.Currency; actBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate; actBill.PricingMethod = order.PricingMethod; actBill.PriceList = priceListDetail.TransportPriceList; actBill.PriceListDetail = priceListDetail; actBill.VehicleType = priceListDetail.VehicleType; if (order.TransportationRoute != null) { actBill.ShipFrom = order.TransportationRoute.ShipFrom; actBill.ShipTo = order.TransportationRoute.ShipTo; } } actBill.OrderNo = order.OrderNo; actBill.BillAddress = order.CarrierBillAddress; actBill.EffectiveDate = DateTime.Parse(order.CreateDate.ToString("yyyy-MM-dd")); actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; actBill.TransType = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION; actBill.CreateDate = DateTime.Now; actBill.CreateUser = user; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = user; actBill.TransportMethod = order.TransportMethod; this.CreateTransportationActBill(actBill); return(actBill); }
public virtual void DeleteTransportPriceListDetail(TransportPriceListDetail entity) { entityDao.DeleteTransportPriceListDetail(entity); }
public virtual void UpdateTransportPriceListDetail(TransportPriceListDetail entity) { entityDao.UpdateTransportPriceListDetail(entity); }
public void DeleteTransportPriceListDetail(TransportPriceListDetail transportPriceListDetail) { TransportPriceListDetailMgr.DeleteTransportPriceListDetail(transportPriceListDetail); }
public virtual void CreateTransportPriceListDetail(TransportPriceListDetail entity) { entityDao.CreateTransportPriceListDetail(entity); }
public void UpdateTransportPriceListDetail(TransportPriceListDetail transportPriceListDetail) { TransportPriceListDetailMgr.UpdateTransportPriceListDetail(transportPriceListDetail); }
public virtual void UpdateTransportPriceListDetail(TransportPriceListDetail entity) { Update(entity); }
public virtual void CreateTransportPriceListDetail(TransportPriceListDetail entity) { Create(entity); }