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 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("账单创建失败!"); } }