protected void btnCheck_Click(object sender, EventArgs e) { try { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); RequiredFieldValidator rfvType = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvType")); RequiredFieldValidator rfvTransportMethod = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvTransportMethod")); //add by ljz //modify by ljz start //if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid) if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid || !rfvTransportMethod.IsValid) //modify by ljz end { return; } btnSave_Click(sender, e); ShowSuccessMessage("Transportation.TransportationOrder.Checked.Successfully", this.OrderNo); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Status = "Checked"; order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); UpdateView(); this.FV_Order.DataBind(); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TransportationBillDetail transportationBillDetail = (TransportationBillDetail)e.Row.DataItem; TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(transportationBillDetail.ActBill.OrderNo); if (to != null) { Label lb_createDate = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_createDate");//运输日期 lb_createDate.Text = to.CreateDate.ToString("yyyy-MM-dd") != null?to.CreateDate.ToString("yyyy-MM-dd") : ""; Label lb_route = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_route"); //运输路线 lb_route.Text = to.TransportationRoute != null ? to.TransportationRoute.Description : ""; Label lb_pricingMethod = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_pricingMethod"); //运输方式 lb_pricingMethod.Text = to.PricingMethod != null ? to.PricingMethod : ""; Label lb_OrderNo = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_OrderNo"); //运单号码 lb_OrderNo.Text = to.OrderNo != null ? to.OrderNo : ""; } TextBox tbAmount = (TextBox)e.Row.FindControl("tbAmount"); tbAmount.Attributes["oldValue"] = tbAmount.Text; TextBox tbQty = (TextBox)e.Row.FindControl("tbQty"); TextBox tbDiscountRate = (TextBox)e.Row.FindControl("tbDiscountRate"); TextBox tbDiscount = (TextBox)e.Row.FindControl("tbDiscount"); if (transportationBillDetail.Bill.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { tbQty.ReadOnly = true; tbAmount.ReadOnly = true; tbDiscountRate.ReadOnly = true; tbDiscount.ReadOnly = true; } /* * * 1.TransType=Transportation 价格单明细(承运商) 或 短拨费(区域)时 * a.PricingMethod=M3或KG 按数量 * b.SHIPT 按金额 * 2.TransType=WarehouseLease(固定费用) 按金额 * 3.TransType=Operation(操作费) 按数量 */ if (transportationBillDetail.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION || (transportationBillDetail.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION && (transportationBillDetail.ActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || transportationBillDetail.ActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) ) ) { tbQty.Attributes["onchange"] = "qtyChanged(this);"; tbQty.Attributes["onmouseup"] = "if(!readOnly)select();"; tbAmount.Attributes["onfocus"] = "this.blur();"; } else { tbQty.Attributes["onfocus"] = "this.blur();"; tbAmount.Attributes["onmouseup"] = "if(!readOnly)select();"; } } }
protected void btnRestore_Click(object sender, EventArgs e) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo, true); if (to.IsValuated == true) { try { string connstring = getCONN(); string sql = "select * from tactbill where orderno ='" + to.OrderNo + "' and status='Create'"; DataSet ds = SqlHelper.ExecuteDataset(connstring, CommandType.Text, sql); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { ShowErrorMessage("该运单已经开票,无法还原状态!"); } else { string updSql = "update tactbill set status='Close' where id='" + dt.Rows[0]["id"].ToString() + "'"; SqlHelper.ExecuteNonQuery(connstring, CommandType.Text, updSql); to.IsValuated = false; to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); ShowSuccessMessage("运单状态还原成功!"); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } catch (Exception ex) { ShowErrorMessage(ex.Message); } } else { ShowSuccessMessage("运单状态还原成功!"); to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); } }
protected void btnCancel_Click(object sender, EventArgs e) { try { TheTransportationOrderMgr.CancelTransportationOrder(this.OrderNo, this.CurrentUser); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); ShowSuccessMessage("Transportation.TransportationOrder.CancelTransportationOrder.Successfully", this.OrderNo); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public void InitPageParameter(string orderNo, bool isEdit) { if (isEdit) { IList <InProcessLocation> ipList = new List <InProcessLocation>(); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(orderNo, true); if (order.OrderDetails != null && order.OrderDetails.Count > 0) { foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { ipList.Add(orderDetail.InProcessLocation); } } this.GV_List.Columns[0].Visible = false; this.GV_List.DataSource = ipList; this.GV_List.DataBind(); } }
private void UpdateView() { TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); bool showInputTxt = false; User currentUser = this.Page.Session["Current_User"] as User; if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { showInputTxt = true; } if (currentUser.HasPermission("btnIPSave")) { showInputTxt = true; } else { showInputTxt = false; } if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { showInputTxt = false; } ((Controls_TextBox)(this.FV_Order.FindControl("tbVehicle"))).Visible = showInputTxt; ((com.Sconit.Control.ReadonlyTextBox)(this.FV_Order.FindControl("tbVehicle1"))).Visible = !showInputTxt; ((Controls_TextBox)(this.FV_Order.FindControl("tbExpense"))).Visible = showInputTxt; ((com.Sconit.Control.ReadonlyTextBox)(this.FV_Order.FindControl("tbExpense1"))).Visible = !showInputTxt; ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrier"))).Visible = showInputTxt && order.Expense == null; ((TextBox)(this.FV_Order.FindControl("tbCarrier1"))).Visible = !showInputTxt || order.Expense != null; ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress"))).Visible = showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress1"))).Visible = !showInputTxt; ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlPricingMethod"))).Enabled = showInputTxt; ((DropDownList)(this.FV_Order.FindControl("ddlType"))).Enabled = showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbDriver"))).ReadOnly = !showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbPallentCount"))).ReadOnly = !showInputTxt; ((CheckBox)(this.FV_Order.FindControl("IsExcess"))).Checked = order.ReferencePallentCount == 1?true:false; if (order.Status == "Cancel" || order.Status == "Complete") { ((TextBox)(this.FV_Order.FindControl("tbRemark"))).ReadOnly = true; ((CheckBox)(this.FV_Order.FindControl("IsExcess"))).Enabled = false; } }
protected void btnComplete_Click(object sender, EventArgs e) { try { ds = needCaluate(); if (onlyWSNFlag == false) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "In-Process"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); TheTransportationOrderMgr.CompleteTransportationOrder(this.OrderNo, this.CurrentUser); } else { createTBill(); TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "Complete"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); } if (ds != null)//djin { Caluate(); } ShowSuccessMessage("Transportation.TransportationOrder.CompleteTransportationOrder.Successfully", this.OrderNo); if (ds != null) { Restore(ds); } UpdateViewButton(); } catch (BusinessErrorException ex) { Restore(ds); ShowErrorMessage(ex); } }
/// <summary> /// 金董春:添加打印功能,添加了TransportationBill.xls模板打印功能 2012-5-28 /// </summary> /// <param name="list"></param> /// <returns></returns> public string WriteToFile(IList <object> list) { string path = Server.MapPath(".") + @"\Reports\Templates\YFKExcelTemplates\TransportationBill.xls"; if (File.Exists(path)) { TransportationBill tb = (TransportationBill)list[0]; string filename = @"/Reports/Templates/TempFiles/temp_" + DateTime.Now.ToString("yyyyMMddhhmmss") + tb.BillNo + ".xls"; string _wpath = Server.MapPath(".") + filename; File.Copy(path, _wpath); FileStream file = new FileStream(_wpath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); Sheet sheet = hssfworkbook.GetSheet("sheet1"); NPOI.SS.UserModel.CellStyle normalStyle = setCellstyle(hssfworkbook, new string[] { "Border", "Center" }); NPOI.SS.UserModel.CellStyle dateStyle = setCellstyle(hssfworkbook, new string[] { "Border", "Center", "DateTime" }); Cell cell = sheet.GetRow(2).GetCell(1); cell.SetCellValue(tb.BillNo); cell = sheet.GetRow(2).GetCell(6); cell.SetCellValue(tb.ReferenceBillNo); cell = sheet.GetRow(3).GetCell(1); cell.SetCellValue(tb.Status); int i = 10; decimal cnt = 0; foreach (TransportationBillDetail tbd in tb.TransportationBillDetails) { Row row = sheet.CreateRow(i); TransportationOrder tord = TheTransportationOrderMgr.LoadTransportationOrder(tbd.ActBill.OrderNo); row.CreateCell(0).SetCellValue(tord.CreateDate); //运输日期 row.CreateCell(1).SetCellValue(tord.TransportationRoute != null ? tord.TransportationRoute.Description : ""); //运输路线 row.CreateCell(2).SetCellValue(tbd.ActBill.PricingMethod != null ? tbd.ActBill.PricingMethod : ""); //运输形式 row.CreateCell(3).SetCellValue(tord.OrderNo); //运单号码 row.CreateCell(4).SetCellValue(tbd.ActBill.EffectiveDate); //生效日期 row.CreateCell(5).SetCellValue(tbd.ActBill.UnitPrice.ToString("F2")); //单价 row.CreateCell(6).SetCellValue(tbd.ActBill.Currency.Name); //币种 row.CreateCell(7).SetCellValue(tbd.ActBill.BillQty.ToString("F0")); //开票数 row.CreateCell(8).SetCellValue(tbd.ActBill.BillAmount.ToString("F2")); //金额 cnt = Convert.ToInt32(tbd.ActBill.BillAmount) + cnt; for (int y = 0; y < 9; y++) { row.GetCell(y).CellStyle = normalStyle; } row.GetCell(0).CellStyle = dateStyle; row.GetCell(4).CellStyle = dateStyle; i++; } if (i <= 20) { for (int j = i; j < 21; j++) { Row row = sheet.CreateRow(j); for (int y = 0; y < 9; y++) { row.CreateCell(y).CellStyle = normalStyle; } } i = 20; } Row _row = sheet.CreateRow(i + 1); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(i + 1, i + 1, 6, 7)); _row.CreateCell(6).SetCellValue("合计发票金额:"); _row.GetCell(6).CellStyle.Alignment = HorizontalAlignment.RIGHT; _row.CreateCell(8).SetCellValue(cnt.ToString("F2")); MemoryStream ms = new MemoryStream(); hssfworkbook.Write(ms); // Response.AddHeader("Content-Disposition", string.Format("attachment;filename=TempWorkBook.xls")); // Response.BinaryWrite(ms.ToArray());Reports/Templates/TempFiles FileStream f = new FileStream(_wpath, FileMode.Open, FileAccess.Write); byte[] data = ms.ToArray(); f.Write(data, 0, data.Length); f.Close(); f.Dispose(); hssfworkbook = null; ms.Close(); ms.Dispose(); return("http://" + Request.Url.Authority + filename); } return(""); }
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/>"; } } }
private void UpdateViewButton() { TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); User currentUser = this.Page.Session["Current_User"] as User; Button btnSave = ((Button)(this.FV_Order.FindControl("btnSave"))); Button btnStart = ((Button)(this.FV_Order.FindControl("btnStart"))); Button btnCancel = ((Button)(this.FV_Order.FindControl("btnCancel"))); Button btnPrint = ((Button)(this.FV_Order.FindControl("btnPrint"))); Button btnComplete = ((Button)(this.FV_Order.FindControl("btnComplete"))); Button btnValuate = ((Button)(this.FV_Order.FindControl("btnValuate"))); Button btnCheck = ((Button)(this.FV_Order.FindControl("btnCheck"))); Button btnRestore = ((Button)(this.FV_Order.FindControl("btnRestore"))); btnSave.Visible = false; btnStart.Visible = false; btnCancel.Visible = false; btnPrint.Visible = false; btnComplete.Visible = false; btnCheck.Visible = false; btnRestore.Visible = false; btnValuate.Visible = !order.IsValuated && (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE && order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL); if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { btnSave.Visible = true; //btnStart.Visible = true; // if (currentUser.HasPermission("btnIPCreate")) btnCancel.Visible = true; btnCheck.Visible = true; } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT) { btnCancel.Visible = true; btnPrint.Visible = true; } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS) { btnCancel.Visible = true; btnPrint.Visible = true; btnRestore.Visible = true; if (currentUser.HasPermission("btnIPStart")) { btnComplete.Visible = true; } } else if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { btnPrint.Visible = true; btnValuate.Visible = false; btnCancel.Visible = false; btnRestore.Visible = true; } else if (order.Status == "Checked")//已审核 { btnStart.Visible = true; btnValuate.Visible = false; btnCancel.Visible = true; btnRestore.Visible = true; } else if (order.Status == "Close") { btnComplete.Visible = true; btnPrint.Visible = true; btnRestore.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; } }