protected void tbVehicle_TextChanged(object sender, EventArgs e) { Controls_TextBox tbVehicle = (Controls_TextBox)(this.FV_Order.FindControl("tbVehicle")); string vehicleCode = tbVehicle.Text.Trim(); if (vehicleCode != String.Empty) { Vehicle vehicle = TheVehicleMgr.LoadVehicle(vehicleCode); if (vehicle != null) { Controls_TextBox tbCarrier = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrier")); if (vehicle.Carrier != null) { tbCarrier.Text = vehicle.Carrier.Code; Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress")); BillAddress carrierBillAddress = TheBillAddressMgr.GetDefaultBillAddress(vehicle.Carrier.Code); if (carrierBillAddress != null) { tbCarrierBillAddress.Text = carrierBillAddress.Code; } } if (vehicle.Carrier != null) { tbCarrier.Text = vehicle.Carrier.Code; } DropDownList ddlType = (DropDownList)(this.FV_Order.FindControl("ddlType")); if (vehicle.Type != null) { ddlType.SelectedValue = vehicle.Type; } TextBox tbDriver = (TextBox)(this.FV_Order.FindControl("tbDriver")); if (vehicle.Driver != null) { tbDriver.Text = vehicle.Driver; } } } }
protected void tbExpense_TextChanged(object sender, EventArgs e) { Controls_TextBox tbExpense = (Controls_TextBox)(this.FV_Order.FindControl("tbExpense")); Controls_TextBox tbCarrier = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrier")); TextBox tbCarrier1 = (TextBox)(this.FV_Order.FindControl("tbCarrier1")); string expenseCode = tbExpense.Text.Trim(); if (expenseCode != String.Empty) { Expense expense = TheExpenseMgr.LoadExpense(expenseCode); if (expense != null) { if (expense.Carrier != null) { tbCarrier.Text = expense.Carrier.Code; Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress")); BillAddress carrierBillAddress = TheBillAddressMgr.GetDefaultBillAddress(expense.Carrier.Code); if (carrierBillAddress != null) { tbCarrierBillAddress.Text = carrierBillAddress.Code; } tbCarrier1.Text = expense.Carrier.Code; } tbCarrier1.Visible = true; tbCarrier.Visible = false; } else { tbCarrier1.Visible = false; tbCarrier.Visible = true; } } else { tbCarrier1.Visible = false; tbCarrier.Visible = true; } }
private TransportationOrder PrepareOrder() { TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); Controls_TextBox tbCarrier = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrier")); if (tbCarrier.Text.Trim() != string.Empty) { order.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress")); if (tbCarrierBillAddress.Text.Trim() != string.Empty) { order.CarrierBillAddress = TheBillAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } else { order.CarrierBillAddress = TheBillAddressMgr.GetDefaultBillAddress(order.Carrier.Code); } Controls_TextBox tbVehicle = (Controls_TextBox)(this.FV_Order.FindControl("tbVehicle")); order.Vehicle = tbVehicle.Text.Trim(); Controls_TextBox tbExpense = (Controls_TextBox)(this.FV_Order.FindControl("tbExpense")); order.Expense = TheExpenseMgr.LoadExpense(tbExpense.Text.Trim()); DropDownList ddlType = (DropDownList)(this.FV_Order.FindControl("ddlType")); if (ddlType.SelectedValue != string.Empty) { order.VehicleType = ddlType.SelectedValue; } com.Sconit.Control.CodeMstrDropDownList ddlPricingMethod = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlPricingMethod")); if (ddlPricingMethod.SelectedValue != string.Empty) { order.PricingMethod = ddlPricingMethod.SelectedValue; } order.VehicleDriver = ((TextBox)(this.FV_Order.FindControl("tbDriver"))).Text.Trim(); order.PallentCount = Int32.Parse(((TextBox)(this.FV_Order.FindControl("tbPallentCount"))).Text.Trim()); order.LastModifyDate = DateTime.Now; order.LastModifyUser = this.CurrentUser; order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); //add by ljz start com.Sconit.Control.CodeMstrDropDownList ddlTransportMethod = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlTransportMethod")); if (ddlTransportMethod.SelectedValue != string.Empty) { order.TransportMethod = ddlTransportMethod.SelectedValue; } //add by ljz end //added by [email protected] order.ReferencePallentCount = ((CheckBox)(this.FV_Order.FindControl("IsExcess"))).Checked ? 1 : 0; //added end return(order); }
protected void createTBill() { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); if (to.Status == "In-Process") { TransportationActBill tb = new TransportationActBill(); tb.BillAddress = TheBillAddressMgr.LoadBillAddress(((Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress"))).Text); tb.Currency = TheCurrencyMgr.LoadCurrency("RMB"); tb.Status = "Create"; tb.IsIncludeTax = false; tb.OrderNo = this.OrderNo; tb.TransType = "Transportation"; tb.EffectiveDate = DateTime.Now; tb.CreateDate = DateTime.Now; tb.CreateUser = CurrentUser; tb.LastModifyUser = CurrentUser; tb.LastModifyDate = DateTime.Now; tb.IsProvisionalEstimate = false; string carrier = string.Empty; tb.PricingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlPricingMethod"))).SelectedValue; carrier = ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrier"))).Text + "WL"; string vchtype = ((DropDownList)(this.FV_Order.FindControl("ddlType"))).SelectedValue; int shipto = (TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo)).TransportationRoute.ShipTo.Id; int shipfrom = (TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo)).TransportationRoute.ShipFrom.Id; DataSet ds = SqlHelper.ExecuteDataset(connstring, CommandType.Text, "select id from TPriceListDet where Tpricelist='" + carrier + "' and startdate<'" + to.CreateDate.ToShortDateString() + "' and enddate >'" + to.CreateDate.ToShortDateString() + "' and currency='RMB' and pricingmethod='" + tb.PricingMethod + "' and vehicletype='" + vchtype + "' and shipto='" + shipto + "' and shipfrom='" + shipfrom + "' "); if (ds.Tables[0].Rows.Count == 0) { throw new BusinessErrorException("没有找到该类型的价格单"); } int _id = Convert.ToInt32(ds.Tables[0].Rows[0][0]); tb.PriceListDetail = TheTransportPriceListDetailMgr.LoadTransportPriceListDetail(_id); tb.PriceList = TheTransportPriceListMgr.LoadTransportPriceList(carrier); tb.UnitPrice = tb.PriceListDetail.UnitPrice; tb.ShipFrom = tb.PriceListDetail.ShipFrom; tb.ShipTo = tb.PriceListDetail.ShipTo; tb.VehicleType = tb.PriceListDetail.VehicleType; if (tb.PricingMethod != "SHIPT") { decimal qty = 0; foreach (DataRow dr in ds_ip.Tables[0].Rows) { qty += Convert.ToDecimal((TheInProcessLocationMgr.LoadInProcessLocation(dr["ipno"].ToString())).CompleteLatency); } tb.BillQty = qty; tb.BilledQty = 0; if (qty < tb.PriceListDetail.MinVolume) { tb.BillAmount = tb.PriceListDetail.MinVolume * tb.UnitPrice; } else { tb.BillAmount = qty * tb.UnitPrice; } tb.BilledAmount = 0; } else { tb.BillQty = 1; tb.BilledQty = 0; tb.BillAmount = tb.PriceListDetail.UnitPrice; tb.BilledAmount = 0; } TheTransportationActBillMgr.CreateTransportationActBill(tb); } else { return; } }