protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvCode": if (TheVehicleMgr.LoadVehicle(args.Value) != null) { ShowWarningMessage("Transportation.Vehicle.Code.Exists", args.Value); args.IsValid = false; } break; case "cvCarrier": if (TheCarrierMgr.LoadCarrier(args.Value) == null) { ShowWarningMessage("Transportation.Carrier.Code.NotExist", args.Value); args.IsValid = false; } break; default: break; } }
protected void checkCarrierExists(object source, ServerValidateEventArgs args) { string code = ((TextBox)(this.FV_Carrier.FindControl("tbCode"))).Text.Trim(); if (TheCarrierMgr.LoadCarrier(code) != null) { args.IsValid = false; } }
protected void ODS_Vehicle_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbCarrier = ((Controls_TextBox)(this.FV_Vehicle.FindControl("tbCarrier"))); com.Sconit.Control.CodeMstrDropDownList ddlType = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Vehicle.FindControl("ddlType"))); vehicle = (Vehicle)e.InputParameters[0]; vehicle.Code = vehicle.Code.Trim(); vehicle.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); vehicle.Type = ddlType.SelectedValue; vehicle.Driver = vehicle.Driver.Trim(); vehicle.MobilePhone = vehicle.MobilePhone.Trim(); }
protected void ODS_Expense_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbCarrier = ((Controls_TextBox)(this.FV_Expense.FindControl("tbCarrier"))); Controls_TextBox tbCurrency = ((Controls_TextBox)(this.FV_Expense.FindControl("tbCurrency"))); expense = (Expense)e.InputParameters[0]; expense.Code = expense.Code.Trim(); expense.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); expense.CreateDate = DateTime.Now; expense.CreateUser = this.CurrentUser; expense.TaxCode = expense.TaxCode.Trim(); expense.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); expense.Remark = expense.Remark.Trim(); }
protected void CV_ServerValidate(object source, ServerValidateEventArgs args) { CustomValidator cv = (CustomValidator)source; switch (cv.ID) { case "cvCode": if (TheExpenseMgr.LoadExpense(args.Value) != null) { ShowWarningMessage("Transportation.Expense.Code.Exists", args.Value); args.IsValid = false; } break; case "cvCarrier": if (TheCarrierMgr.LoadCarrier(args.Value) == null) { ShowWarningMessage("Transportation.Carrier.Code.NotExist", args.Value); args.IsValid = false; } break; case "cvAmount": try { Convert.ToDecimal(args.Value); } catch (Exception) { ShowWarningMessage("Transportation.Expense.Amount.Error"); args.IsValid = false; } break; case "cvCurrency": if (TheCurrencyMgr.LoadCurrency(args.Value) == null) { ShowWarningMessage("MasterData.Currency.Code.NotExist", args.Value); args.IsValid = false; } break; default: break; } }
protected void ODS_Flow_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { flow = (Flow)e.InputParameters[0]; Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCheckDetailOption"); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); Controls_TextBox tbCurrency = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency"); Controls_TextBox tbPriceListTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPriceListTo"); Controls_TextBox tbTPriceList = (Controls_TextBox)this.FV_Flow.FindControl("tbTPriceList"); Controls_TextBox tbTRoute = (Controls_TextBox)this.FV_Flow.FindControl("tbTRoute"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flow.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlGrGapTo != null && ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption != null && ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (tbTPriceList != null && tbTPriceList.Text.Trim() != string.Empty) { flow.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(tbTPriceList.Text.Trim()); } if (tbTRoute != null && tbTRoute.Text.Trim() != string.Empty) { flow.TransportationRoute = TheTransportationRouteMgr.LoadTransportationRoute(tbTRoute.Text.Trim()); } if (tbCurrency != null && tbCurrency.Text.Trim() != string.Empty) { flow.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); } else { string currencyCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value; flow.Currency = TheCurrencyMgr.LoadCurrency(currencyCode); } flow.BillSettleTerm = null; flow.CheckDetailOption = BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_NOT_CHECK; flow.Type = BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER; flow.AntiResolveHu = BusinessConstants.CODE_MASTER_ANTI_RESOLVE_HU_VALUE_NOT_RESOLVE; flow.CreateUser = this.CurrentUser; flow.CreateDate = DateTime.Now; flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version = 0; }
protected void CostCenterCal() { CostString = string.Empty; ErrorString = string.Empty; // string billno = ((com.Sconit.Control.ReadonlyTextBox)(FV_TransportationBill.FindControl("tbBillNo"))).Text; string billno = this.BillNo; if (billno != string.Empty) { #region Sql语句 StringBuilder cc = new StringBuilder(); cc.Append("select c.orderno,sum(vol) as V,plant,tactbill.billedqty*tactbill.unitprice as cost1,min(tbilldet.amount) as cost from " + "(select a.orderno,orderdet.packvol,qty,orderdet.packvol*qty as vol,item.plant from (" + "select orderloctransid,ipdet.ipno,sum(abs(qty)) as QTY ,orderno " + "from torderdet join ipdet on torderdet.ipno=ipdet.ipno " + "where orderno in(" + "select tordermstr.orderno from tactbill " + "left join tordermstr on tactbill.orderno=tordermstr.orderno " + "where id in(" + "select distinct transid from tbillmstr join tbilldet on tbillmstr.billno=tbilldet.billno "); cc.Append( "where tbillmstr.billno='" + billno + "'))" + "group by orderloctransid,ipdet.ipno,orderno ) a " + "left join orderloctrans on a.orderloctransid=id " + "left join orderdet on orderdet.id=orderloctrans.orderdetid " + "left join item on item.code=orderdet.item " + ") c left join tactbill on c.orderno=tactbill.orderno left join tbilldet on transid=tactbill.id and tbilldet.billno='" + billno + "' " + "group by c.orderno,plant,tactbill.billedqty,tactbill.unitprice,tactbill.id " + " having min(tbilldet.amount) is not null " + "order by c.orderno"); #endregion string sql = cc.ToString(); XmlTextReader reader = new XmlTextReader(Server.MapPath("Config/properties.config")); XmlDocument doc = new XmlDocument(); doc.Load(reader); // reader.Close(); // string ConnString = doc.SelectSingleNode("/configuration/properties/connectionString").InnerText.Trim(); DataSet result = SqlHelper.ExecuteDataset(ConnString, CommandType.Text, sql); Dictionary <string, decimal> orderTotal = new Dictionary <string, decimal>(); Dictionary <string, decimal> plantcost = new Dictionary <string, decimal>(); Dictionary <string, string> error = new Dictionary <string, string>(); Dictionary <string, string> noplant = new Dictionary <string, string>(); // Dictionary<string, decimal> lxcost = new Dictionary<string, decimal>(); Dictionary <string, string> filter = new Dictionary <string, string>(); #region 处理常规的 foreach (DataRow i in result.Tables[0].Rows) { if (error.ContainsKey(i["orderno"].ToString()) || noplant.ContainsKey(i["orderno"].ToString())) { continue; } if (i["V"].ToString() == "") { error.Add(i["orderno"].ToString(), ""); continue; } if (i["plant"].ToString() == "") { noplant.Add(i["orderno"].ToString(), ""); continue; } if (orderTotal.ContainsKey(i["orderno"].ToString()) == false) { orderTotal.Add(i["orderno"].ToString(), decimal.Parse(i["V"].ToString())); } else { orderTotal[i["orderno"].ToString()] = orderTotal[i["orderno"].ToString()] + decimal.Parse(i["V"].ToString()); } } foreach (DataRow i in result.Tables[0].Rows) { if (error.ContainsKey(i["orderno"].ToString()) || noplant.ContainsKey(i["orderno"].ToString())) { continue; } decimal cost = decimal.Parse(i["V"].ToString()) / orderTotal[i["orderno"].ToString()] * decimal.Parse(i["cost"].ToString()); cost = Math.Round(cost, 2); if (plantcost.ContainsKey(mappingCC(i["plant"].ToString())) == false) { plantcost.Add(mappingCC(i["plant"].ToString()), cost); } else { plantcost[mappingCC(i["plant"].ToString())] = plantcost[mappingCC(i["plant"].ToString())] + cost; } } #endregion #region 零星运单 StringBuilder lxsb = new StringBuilder(); lxsb.Append("select tordermstr.orderno,torderdet.ipno,expense from tordermstr left join torderdet on tordermstr.orderno=torderdet.orderno " + "where tordermstr.orderno in (" + "select distinct tordermstr.orderno from tactbill " + "left join tordermstr on tactbill.orderno=tordermstr.orderno " + "where id in( " + "select distinct transid from tbillmstr join tbilldet on tbillmstr.billno=tbilldet.billno " + "where tbillmstr.billno='" + billno + "')) " + "and (left(ipno,1)='W' or expense is not null)"); string lxsql = lxsb.ToString(); DataSet lxdt = SqlHelper.ExecuteDataset(ConnString, CommandType.Text, lxsql); foreach (DataRow r in lxdt.Tables[0].Rows) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(r["orderno"].ToString(), true); IList <TransportationOrderDetail> tods = to.OrderDetails; if (tods.Count == 0) { string wfcon = @"Data Source=192.168.210.190\SQL2005;Initial Catalog=EPROCESS;Persist Security Info=true;User ID=sa;PWD=temp100;Packet Size=4096;"; string sqltext = "select esportran_costsrc+'_'+cast(esportran_totalcost as nvarchar(50)) from dbo.eSporadicTran_mstr where esportran_nbr='" + r["expense"].ToString() + "'"; SqlConnection con = new SqlConnection(wfcon); SqlCommand cmd = new SqlCommand(sqltext, con); object obj = null; try { con.Open(); obj = cmd.ExecuteScalar(); con.Close(); } catch { con.Close(); } if (obj != null) { string _obj = obj.ToString(); if (_obj.StartsWith("AR")) { string obj_cc = _obj.Split(new char[] { '_' })[0].Substring(3); decimal cost = decimal.Parse(_obj.Split(new char[] { '_' })[1]); if (plantcost.ContainsKey(obj_cc)) { plantcost[obj_cc] = plantcost[obj_cc] + Math.Round(cost, 2); } else { plantcost.Add(obj_cc, Math.Round(cost, 2)); } } if (_obj.StartsWith("CC")) { string obj_cc = mappingCC(_obj.Substring(3, 4)).Trim(); decimal cost = decimal.Parse(_obj.Split(new char[] { '_' })[1]); if (plantcost.ContainsKey(obj_cc)) { plantcost[obj_cc] = plantcost[obj_cc] + Math.Round(cost, 2); } else { plantcost.Add(obj_cc, Math.Round(cost, 2)); } } } continue; } #endregion if (tods != null) { var l = (from i in tods where i.InProcessLocation.IpNo.Substring(0, 1) == "W" select i).ToList(); if (l != null && l.Count == tods.Count) { if (filter.ContainsKey(r["orderno"].ToString()) == true) { continue; } filter.Add(r["orderno"].ToString(), r["ipno"].ToString()); InProcessLocation ip = TheInProcessLocationMgr.LoadInProcessLocation(r["ipno"].ToString()); string orderAmountsql = "select top 1 BilledAmount from tactbill where orderno='" + r["orderno"].ToString() + "' order by lastmodifydate desc ";//and status='Close' SqlConnection ordercon = new SqlConnection(ConnString); SqlCommand ordercmd = new SqlCommand(orderAmountsql, ordercon); object amount = null; try { ordercon.Open(); amount = ordercmd.ExecuteScalar(); ordercon.Close(); } catch { ordercon.Close(); } string ip_cc = mappingCC(ip.HuTemplate); if (amount != null) { if (plantcost.ContainsKey(ip_cc)) { plantcost[ip_cc] = plantcost[ip_cc] + Math.Round(decimal.Parse(amount.ToString()), 2); } else { plantcost.Add(ip_cc, Math.Round(decimal.Parse(amount.ToString()), 2)); } } } } } var disacct = TheCarrierMgr.LoadCarrier(TheTransportationBillMgr.LoadTransportationBill(BillNo).BillAddress.Party.Code).TradeTerm; int di = 0; if (string.IsNullOrEmpty(disacct)) { disacct = "0"; } foreach (KeyValuePair <string, decimal> key in plantcost) { decimal tax = 0; if (disacct.StartsWith("$")) { tax = Math.Round(key.Value / (1 + decimal.Parse(disacct.Substring(1)) * (decimal)0.01) * decimal.Parse(disacct.Substring(1)) * (decimal)0.01, 2); } else { tax = Math.Round(key.Value * (decimal.Parse(disacct) * (decimal)0.01), 2); } decimal outTax = key.Value - tax; TaxTotal += tax; OutTaxTotal += outTax; if (di % 2 == 0) { CostString += "<tr style='background-color:white;text-align:center'><td>" + key.Key + "</td><td>" + mappingAcc(key.Key) + "</td><td>" + outTax + "</td><td>" + tax + "</td></tr>"; } if (di % 2 == 1) { CostString += "<tr style='background-color:#DAD6C5;text-align:center'><td>" + key.Key + "</td><td>" + mappingAcc(key.Key) + "</td><td>" + outTax + "</td><td>" + tax + "</td></tr>"; } // CostString += key.Key + ":" + key.Value + "<br/>"; di++; } if (error.Count > 0) { ErrorString = "以下运单货物存在未设置体积不予计算:<br/>"; } foreach (KeyValuePair <string, string> key in error) { ErrorString += key.Key + "<br/>"; } if (noplant.Count > 0) { ErrorString += "以下运单中含有为设置工厂的零件不予计算:<br/>"; } foreach (KeyValuePair <string, string> key in noplant) { ErrorString += key.Key + "<br/>"; } } }
protected void ODS_Flow_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { flow = (Flow)e.InputParameters[0]; Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); Controls_TextBox tbShipFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbShipFrom"); Controls_TextBox tbShipTo = (Controls_TextBox)this.FV_Flow.FindControl("tbShipTo"); Controls_TextBox tbBillFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbBillFrom"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); Controls_TextBox tbCurrency = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency"); Controls_TextBox tbPriceListFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPriceListFrom"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCheckDetailOption"); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (tbShipFrom != null && tbShipFrom.Text.Trim() != string.Empty) { flow.ShipFrom = TheAddressMgr.LoadShipAddress(tbShipFrom.Text.Trim()); } if (tbShipTo != null && tbShipTo.Text.Trim() != string.Empty) { flow.ShipTo = TheAddressMgr.LoadShipAddress(tbShipTo.Text.Trim()); } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (ddlGrGapTo != null && ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption != null && ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } flow.Type = BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS; flow.AntiResolveHu = BusinessConstants.CODE_MASTER_ANTI_RESOLVE_HU_VALUE_NOT_RESOLVE; flow.CreateUser = this.CurrentUser; flow.CreateDate = DateTime.Now; flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version = 0; }
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 ODS_Flow_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Flow flow = (Flow)e.InputParameters[0]; Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode); CloneHelper.CopyProperty(oldFlow, flow, EditFields, true); Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); Controls_TextBox tbShipFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbShipFrom"); Controls_TextBox tbShipTo = (Controls_TextBox)this.FV_Flow.FindControl("tbShipTo"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlCheckDetailOption")); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (tbShipFrom != null && tbShipFrom.Text.Trim() != string.Empty) { flow.ShipFrom = TheAddressMgr.LoadShipAddress(tbShipFrom.Text.Trim()); } if (tbShipTo != null && tbShipTo.Text.Trim() != string.Empty) { flow.ShipTo = TheAddressMgr.LoadShipAddress(tbShipTo.Text.Trim()); } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version += 1; }
protected void ODS_Flow_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Flow flow = (Flow)e.InputParameters[0]; Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode); CloneHelper.CopyProperty(oldFlow, flow, EditFields, true); Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); Controls_TextBox tbShipFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbShipFrom"); Controls_TextBox tbShipTo = (Controls_TextBox)this.FV_Flow.FindControl("tbShipTo"); Controls_TextBox tbBillFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbBillFrom"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); Controls_TextBox tbCurrency = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency"); Controls_TextBox tbPriceListFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPriceListFrom"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlCheckDetailOption")); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); DropDownList ddlBillSettleTerm = (DropDownList)this.FV_Flow.FindControl("ddlBillSettleTerm"); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); com.Sconit.Control.CodeMstrDropDownList ddlAntiResolveHu = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlAntiResolveHu"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (tbShipFrom != null && tbShipFrom.Text.Trim() != string.Empty) { flow.ShipFrom = TheAddressMgr.LoadShipAddress(tbShipFrom.Text.Trim()); } if (tbShipTo != null && tbShipTo.Text.Trim() != string.Empty) { flow.ShipTo = TheAddressMgr.LoadShipAddress(tbShipTo.Text.Trim()); } if (tbBillFrom != null && tbBillFrom.Text.Trim() != string.Empty) { flow.BillFrom = TheAddressMgr.LoadBillAddress(tbBillFrom.Text.Trim()); } if (ddlBillSettleTerm.SelectedIndex != -1) { flow.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } if (ddlAntiResolveHu.SelectedIndex != -1) { flow.AntiResolveHu = ddlAntiResolveHu.SelectedValue; } if (tbPriceListFrom != null && tbPriceListFrom.Text.Trim() != string.Empty) { flow.PriceListFrom = ThePurchasePriceListMgr.LoadPurchasePriceList(tbPriceListFrom.Text.Trim()); } if (tbCurrency != null && tbCurrency.Text.Trim() != string.Empty) { flow.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); } else { string currencyCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value; flow.Currency = TheCurrencyMgr.LoadCurrency(currencyCode); } flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version += 1; }