Exemplo n.º 1
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            vendorInfoVM          = new VendorInfoVM();
            serviceFacade         = new VendorFacade(this);
            payTermsServiceFacade = new VendorPayTermsFacade(this);

            //账期类型,初始化默认为:经销:
            BindPayTermsData(VendorConsignFlag.Sell);
            //默认送货分仓:
            CodeNamePairHelper.GetList("PO", "VendorDefaultShippingStock", (obj, args) =>
            {
                this.cmbDefaultStock.ItemsSource = args.Result;
            });
            vendorInfoVM.VendorBasicInfo.PaySettleCompany = PaySettleCompany.SH;
            this.DataContext = vendorInfoVM;
            //this.cmbEPort.SelectedEPort = 0;
            //SetAccessControl();
            //this.cmbEPort.ItemsSource = EnumConverter.GetKeyValuePairs<EPortStatusENUM>(EnumConverter.EnumAppendItemType.Select);
        }
        void VendorFinanceInfoMaintain_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= new RoutedEventHandler(VendorFinanceInfoMaintain_Loaded);
            payTermsServiceFacade = new VendorPayTermsFacade(CPApplication.Current.CurrentPage);
            serviceFacade = new VendorFacade(CPApplication.Current.CurrentPage);

            if (editVM.VendorBasicInfo.ConsignFlag != VendorConsignFlag.Consign)
            {
                this.lblettlePeriodType.Visibility = Visibility.Collapsed;
                this.cmbSettlePeriodTypeForModify.Visibility = Visibility.Collapsed;
                this.lblAutoAudit.Visibility = Visibility.Visible;
                this.chkAutoAudit.Visibility = Visibility.Visible;
            }

            //财务 - 账期类型(调用Invoice接口获取LIST):
            payTermsServiceFacade.QueryVendorPayTermsList(CPApplication.Current.CompanyCode, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                //this.cmbPayPeriodType.ItemsSource = args.Result.Where(i => i.IsConsignment == (int)editVM.VendorBasicInfo.ConsignFlag).OrderBy(j => j.PayTermsNo).ToList();
                List<VendorPayTermsItemInfo> listItems = args.Result.Where(i => i.IsConsignment == (int)editVM.VendorBasicInfo.ConsignFlag).OrderBy(j => j.PayTermsNo).ToList();
                listItems.RemoveAll(item => item.PayTermsNo != 19);//只留账期类型为月结的
                this.cmbPayPeriodType.ItemsSource = listItems;


                //如果是新申请财务信息:
                if (this.isNewFinanceInfo)
                {
                    // 新申请财务默认合作金额10万,有效期1年
                    editVM.VendorFinanceInfo.CooperateAmt = "100000";
                    editVM.VendorFinanceInfo.CooperateValidDate = DateTime.Now.Date;
                    editVM.VendorFinanceInfo.CooperateExpiredDate = DateTime.Now.Date.AddYears(1);

                    this.btnRequestForApproval.Visibility = Visibility.Visible;
                }
                //如果是审核已有的财务信息 :
                else
                {
                    this.editVM.VendorFinanceInfo.PayPeriodType = this.editVM.VendorFinanceInfo.FinanceRequestInfo.PayPeriodType;
                    this.editVM.VendorFinanceInfo.SettlePeriodType = this.editVM.VendorFinanceInfo.FinanceRequestInfo.SettlePeriodType;
                    this.editVM.VendorFinanceInfo.CooperateAmt = this.editVM.VendorFinanceInfo.FinanceRequestInfo.ContractAmt.HasValue ? this.editVM.VendorFinanceInfo.FinanceRequestInfo.ContractAmt.Value.ToString() : string.Empty;
                    this.editVM.VendorFinanceInfo.CooperateValidDate = this.editVM.VendorFinanceInfo.FinanceRequestInfo.ValidDate;
                    this.editVM.VendorFinanceInfo.CooperateExpiredDate = this.editVM.VendorFinanceInfo.FinanceRequestInfo.ExpiredDate;
                    this.editVM.VendorBasicInfo.VendorNameLocal = this.editVM.VendorFinanceInfo.FinanceRequestInfo.VendorName;
                    this.editVM.VendorFinanceInfo.IsAutoAudit = this.editVM.VendorFinanceInfo.FinanceRequestInfo.AutoAudit;
                    this.btnCancelAudit.Visibility = Visibility.Visible;
                    this.btnDeclineAudit.Visibility = Visibility.Visible;
                    this.btnPassAudit.Visibility = Visibility.Visible;
                    this.lblMemo.Visibility = Visibility.Visible;
                    this.txtMemo.Visibility = Visibility.Visible;

                    this.cmbPayPeriodType.IsEnabled = false;
                    this.cmbSettlePeriodTypeForModify.IsEnabled = false;
                    this.txtContractAmt.IsReadOnly = true;
                    this.txtVendorName.IsReadOnly = true;
                    this.dpContractDateFrom.IsEnabled = false;
                    this.dpContractDateTo.IsEnabled = false;
                }
                this.DataContext = editVM;
                LoadComboBoxData();
                SetAccessControl();
                editVM.ValidationErrors.Clear();
            });
        }