protected override void DoSearch() { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string expenseNo = this.tbExpenseNo.Text != string.Empty ? this.tbExpenseNo.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } IList <TransportationActBill> transportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, this.billNo, true); this.ucNewList.BindDataSource(transportationActBillList != null && transportationActBillList.Count > 0 ? transportationActBillList : null); this.ucNewList.DataBind(); this.ucNewList.Visible = true; }
protected void btnRecalculate_Click(object sender, EventArgs e) { try { IList <TransportationActBill> transportationActBillList = this.ucNewList.PopulateSelectedData(); if (transportationActBillList != null && transportationActBillList.Count > 0) { TheTransportationActBillMgr.RecalculatePrice(transportationActBillList, this.CurrentUser); this.ShowSuccessMessage("Transportation.TransportationActBill.Recalculate.Successfully"); DoSearch(); } } catch (BusinessErrorException ex) { this.ShowErrorMessage(ex); } }
public IList <TransportationActBill> PopulateSelectedData() { if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0) { IList <TransportationActBill> transportationActBillList = new List <TransportationActBill>(); foreach (GridViewRow row in this.GV_List.Rows) { CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox; if (checkBoxGroup.Checked) { HiddenField hfId = row.FindControl("hfId") as HiddenField; TransportationActBill transportationActBill = TheTransportationActBillMgr.LoadTransportationActBill(int.Parse(hfId.Value)); transportationActBillList.Add(transportationActBill); } } return(transportationActBillList); } return(null); }
protected override void DoSearch() { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string expenseNo = this.tbExpenseNo.Text != string.Empty ? this.tbExpenseNo.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } bool needRecalculate = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_RECALCULATE_WHEN_TRANSPORTATIONBILL).Value); if (needRecalculate) { IList <TransportationActBill> allTransportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, this.billNo, true); TheTransportationActBillMgr.RecalculatePrice(allTransportationActBillList, this.CurrentUser); } IList <TransportationActBill> transportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, this.billNo); this.ucNewList.BindDataSource(transportationActBillList != null && transportationActBillList.Count > 0 ? transportationActBillList : null); this.ucNewList.Visible = true; }
protected void btnConfirm_Click(object sender, EventArgs e) { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string expenseNo = this.tbExpenseNo.Text != string.Empty ? this.tbExpenseNo.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } //重新计价 bool needRecalculate = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_RECALCULATE_WHEN_TRANSPORTATIONBILL).Value); if (needRecalculate) { IList <TransportationActBill> allTransportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, null, true); TheTransportationActBillMgr.RecalculatePrice(allTransportationActBillList, this.CurrentUser); } IList <TransportationActBill> transportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, null); if (transportationActBillList != null && transportationActBillList.Count > 0) { foreach (TransportationActBill transportationActBill in transportationActBillList) { /* * * 1.TransType=Transportation 价格单明细(承运商) 或 短拨费(区域)时 * a.PricingMethod=M3或KG 按数量 * b.SHIPT 按金额 * 2.TransType=WarehouseLease(固定费用) 按金额 * 3.TransType=Operation(操作费) 按数量 */ if (transportationActBill.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION || (transportationActBill.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION && (transportationActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || transportationActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) ) ) { transportationActBill.CurrentBillQty = transportationActBill.BillQty - transportationActBill.BilledQty; decimal orgAmount = transportationActBill.UnitPrice * transportationActBill.CurrentBillQty; transportationActBill.CurrentDiscount = orgAmount - (transportationActBill.BillAmount - transportationActBill.BilledAmount); } else { transportationActBill.CurrentBillAmount = transportationActBill.BillAmount - transportationActBill.BilledAmount; transportationActBill.CurrentDiscount = 0; } } IList <TransportationBill> transportationBillList = this.TheTransportationBillMgr.CreateTransportationBill(transportationActBillList, this.CurrentUser, (this.IsRelease.Checked ? BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT : BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)); ; DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(TransportationBill)); DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(TransportationBill)) .SetProjection(Projections.Count("BillNo")); selectCriteria.Add(Expression.Eq("CreateDate", transportationBillList[0].CreateDate)); selectCriteria.Add(Expression.Eq("CreateUser.Code", this.CurrentUser.Code)); selectCountCriteria.Add(Expression.Eq("CreateDate", transportationBillList[0].CreateDate)); selectCountCriteria.Add(Expression.Eq("CreateUser.Code", this.CurrentUser.Code)); SearchEvent((new object[] { selectCriteria, selectCountCriteria }), null); this.ShowSuccessMessage("Transportation.TransportationBill.BatchCreateSuccessfully"); } else { this.ShowErrorMessage("TransportationBill.Error.EmptyBillDetail"); } }
/// <summary> /// 文件上传 taskno:181695 /// djin 2013-9-2 /// </summary> protected void btnUpload_Click(object sender, EventArgs e) { HSSFWorkbook excel = new HSSFWorkbook(fileUpload.PostedFile.InputStream); Sheet sheet = excel.GetSheetAt(0); IEnumerator rows = sheet.GetRowEnumerator(); //Row custrow = sheet.GetRow(2); // string sup = custrow.GetCell(1).StringCellValue;//客户代码 //Supplier su = TheSupplierMgr.LoadSupplier(sup); //Row row_startdate = sheet.GetRow(3); //string startdate = row_startdate.GetCell(1).StringCellValue;//开始日期 //Row row_enddate = sheet.GetRow(4); //string enddate = row_enddate.GetCell(1).StringCellValue;//结束日期 //startdate = startdate == string.Empty ? DateTime.Now.AddMonths(-1).ToShortDateString() : startdate; //enddate = enddate == string.Empty ? DateTime.Now.ToShortDateString() : enddate; ImportHelper.JumpRows(rows, 1); IList <TransportationActBill> tactbillList = new List <TransportationActBill>(); Hashtable th = new Hashtable(); string supply = string.Empty; while (rows.MoveNext()) { Row curow = (HSSFRow)rows.Current; string shiporder = curow.GetCell(0).StringCellValue; if (th.ContainsKey(shiporder)) { continue; //避免重复 } // decimal cur = decimal.Parse(curow.GetCell(1).NumericCellValue.ToString()); if (shiporder != string.Empty) { IList <TransportationActBill> tactbill = TheTransportationActBillMgr.GetTransportationActBill(shiporder); if (tactbill.Count > 0) { foreach (TransportationActBill tbill in tactbill) { if (!string.IsNullOrEmpty(supply)) { if (tbill.BillAddress.Party.Code != supply) { ShowErrorMessage("行" + curow.RowNum.ToString() + "供应商的代码不一致!"); return; } } else { supply = tbill.BillAddress.Party.Code; } if (tbill.Status == "Create") { tbill.CurrentBillQty = tbill.BillQty - tbill.BilledQty; tbill.CurrentBillAmount = tbill.CurrentBillQty * tbill.UnitPrice; tactbillList.Add(tbill); } } } else { ShowErrorMessage("行" + curow.RowNum.ToString() + "还没有计价!"); return; } } else { ShowErrorMessage("行" + curow.RowNum.ToString() + "无运单号!"); return; } } if (tactbillList.Count > 0) { try { IList <TransportationBill> transportationBillList = TheTransportationBillMgr.CreateTransportationBill(tactbillList, this.CurrentUser); if (transportationBillList != null && transportationBillList.Count > 0) { ExportResult(transportationBillList); btnBack_Click(sender, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } catch (Exception ex) { ShowErrorMessage(ex.Message); } } else { ShowErrorMessage("账单创建失败!"); } }
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; } }