private void hpkSettleRuleName_Click(object sender, RoutedEventArgs e) { CollectionPaymentItemInfoVM vm = this.SettleProductsQueryResultGrid.SelectedItem as CollectionPaymentItemInfoVM; if (null != vm) { Window.Navigate(string.Format("/ECCentral.Portal.UI.PO/SettledProductsRuleQuery/{0}", vm.SettleRuleName), null, true); } }
private void btnAddSettleItems_Click(object sender, RoutedEventArgs e) { //添加结算商品: int selectCount = 0; listProductsVM.ForEach(x => { if (x.IsCheckedItem) { selectCount++; } }); if (selectCount <= 0) { CurrentWindow.Alert(ResSettledProductsRuleQuery.InfoMsg_CheckProducts); return; } if (CheckMaxinumItemsCount()) { this.listProductsVM.Where(i => i.IsCheckedItem == true).ToList().ForEach(x => { x.IsCheckedItem = false; if (SettleSysNo.HasValue) { x.SettleSysNo = SettleSysNo.Value; } //添加进现有的List中(不重复添加:): CollectionPaymentItemInfoVM getExistItem = OldItemVM.SingleOrDefault(i => i.ConsignToAccLogInfo.LogSysNo == x.ConsignToAccLogInfo.LogSysNo); if (getExistItem == null) { x.IsSettleCostTextBoxReadOnly = x.SettleType == SettleType.O ? false : true; x.IsSettlePercentageTextBoxReadOnly = x.SettleType == SettleType.P ? false : true; x.SettlePercentageTextBoxVisibility = x.SettleType == SettleType.P ? Visibility.Visible : Visibility.Collapsed; //毛利: x.ConsignToAccLogInfo.RateMargin = x.ConsignToAccLogInfo.SalePrice.ToDecimal() - x.ConsignToAccLogInfo.Cost.ToDecimal(); //毛利总额 : x.ConsignToAccLogInfo.RateMarginTotal = x.ConsignToAccLogInfo.RateMargin.ToDecimal() * x.ConsignToAccLogInfo.ProductQuantity.ToInteger(); OldItemVM.Add(x); } else { if (getExistItem.SettleSysNo == -1) { getExistItem.SettleSysNo = null; getExistItem.Cost = string.IsNullOrEmpty(x.ConsignToAccLogInfo.Cost) ? (decimal?)null : x.ConsignToAccLogInfo.Cost.ToDecimal(); getExistItem.SettleRuleSysNo = x.SettleRuleSysNo; getExistItem.SettleRuleName = x.SettleRuleName; } } }); this.Dialog.ResultArgs.Data = OldItemVM; this.Dialog.ResultArgs.DialogResult = DialogResultType.OK; Dialog.Close(true); } }
private void hpkOrderCount_Click(object sender, RoutedEventArgs e) { //订单数量链接,链接至代销转财务记录查询: CollectionPaymentItemInfoVM vm = this.SettleProductsQueryResultGrid.SelectedItem as CollectionPaymentItemInfoVM; if (null != vm) { Window.Navigate(string.Format("/ECCentral.Portal.UI.PO/AccountLogQuery/{0}", vm.AllOrderSysNoFormatString), null, true); } }
private void txtSettleCost_LostFocus(object sender, RoutedEventArgs e) { TextBox txt = sender as TextBox; if (null != txt && !txt.IsReadOnly) { this.SettleProductsQueryResultGrid.UpdateLayout(); decimal getInputDecimal = 0; if (!string.IsNullOrEmpty(txt.Text.Trim()) && !decimal.TryParse(txt.Text.Trim(), out getInputDecimal)) { getInputDecimal = 0; //txt.Text = getInputDecimal.ToString("f2"); } //根据修改的结算金额,重新计算此行的其它Row: CollectionPaymentItemInfoVM getSelectedItemVM = txt.DataContext as CollectionPaymentItemInfoVM; if (null != getSelectedItemVM) { //结算: getSelectedItemVM.Cost = getInputDecimal; //总金额: getSelectedItemVM.ConsignToAccLogInfo.CountMany = getSelectedItemVM.ConsignToAccLogInfo.ProductQuantity * getInputDecimal; //毛利: getSelectedItemVM.ConsignToAccLogInfo.RateMargin = getSelectedItemVM.ConsignToAccLogInfo.SalePrice - getInputDecimal; //毛利总额 : getSelectedItemVM.ConsignToAccLogInfo.RateMarginTotal = getSelectedItemVM.ConsignToAccLogInfo.RateMargin * getSelectedItemVM.ConsignToAccLogInfo.ProductQuantity; //差额 getSelectedItemVM.ConsignToAccLogInfo.FoldCost = (getSelectedItemVM.ConsignToAccLogInfo.CreateCost ?? 0m) - (getSelectedItemVM.Cost ?? 0m); //把改变的结算价格更新到数据源中: foreach (var item in this.newVM.SettleItems) { if (item.ProductID == getSelectedItemVM.ProductID && item.ConsignToAccLogInfo.CreateCost == getSelectedItemVM.ConsignToAccLogInfo.CreateCost && item.ConsignToAccLogInfo.SettleType == getSelectedItemVM.ConsignToAccLogInfo.SettleType && item.ConsignToAccLogInfo.SalePrice == getSelectedItemVM.ConsignToAccLogInfo.SalePrice && item.ConsignToAccLogInfo.StockSysNo == getSelectedItemVM.ConsignToAccLogInfo.StockSysNo && item.SettleRuleSysNo == getSelectedItemVM.SettleRuleSysNo ) { item.Cost = getInputDecimal; item.ConsignToAccLogInfo.FoldCost = (item.ConsignToAccLogInfo.CreateCost ?? 0m) - (item.Cost ?? 0m); item.ConsignToAccLogInfo.CountMany = item.ConsignToAccLogInfo.ProductQuantity * getInputDecimal; item.ConsignToAccLogInfo.RateMargin = item.ConsignToAccLogInfo.SalePrice - getInputDecimal; item.ConsignToAccLogInfo.RateMarginTotal = item.ConsignToAccLogInfo.RateMargin * item.ConsignToAccLogInfo.ProductQuantity; } } CalcSettleProducts(); } } }