Beispiel #1
0
        //public void Get()
        //{
        //    var Get = _systemAccountingSettingsService.GetSystemAccountingSettingModel();
        //    StatusConvert = Get.StatusAcc;
        //    if (StatusConvert != "")
        //    {
        //        if (StatusConvert == "Date")
        //        {
        //            EnableDate = true;
        //            EnableNumber = false;
        //        }
        //        else if (StatusConvert == "Number")
        //        {
        //            EnableDate = false;
        //            EnableNumber = true;
        //        }
        //    }
        //    else
        //    {
        //        EnableDate = true;
        //        EnableNumber = true;
        //    }
        //}
        public async void LoadAccDocumentItems()
        {
            IsBusy           = true;
            SystemAccounting = AutoMapper.Mapper.Map <SystemAccountingSettingModel, EditableSystemAccountingSettingModel>(_systemAccountingSettingsService.GetSystemAccountingSettingModel());
            ToDate           = DateTime.Now;
            PersianCalendar persianCalendar = new PersianCalendar();
            var             dateConvert     = persianCalendar.GetYear(ToDate.Value);
            var             dateDocument    = _appContextService.CurrentFinancialYear;

            if (dateConvert != dateDocument)
            {
                ToDate = _convertDocumentsService.GetEndFinancialYear1(dateDocument);
            }
            //  Get();
            Close = await _openingClosingsService.GetCloseAccAsync(dateDocument);

            if (Close == false)
            {
                IsBusy   = true;
                IsEnable = true;
                await GetLast(dateDocument);

                AccDocumentHeaders = new ObservableCollection <AccDocumentHeaderDTO>(await _accDocumentHeadersService.GetAccDocumentHeadersAsync(dateDocument));
                IsBusy             = false;
            }
            else
            {
                IsEnable = false;
            }
            _appContextService.PropertyChanged += async(sender, eventArgs) =>
            {
                var appContextService = sender as IAppContextService;
                if (eventArgs.PropertyName == "CurrentFinancialYear")
                {
                    dateDocument = _appContextService.CurrentFinancialYear;
                }
                Close = _openingClosingsService.GetCloseAcc(dateDocument);

                if (Close == false)
                {
                    IsBusy   = true;
                    IsEnable = true;
                    await GetLast(dateDocument);

                    //NumberPermanent = await _convertDocumentsService.GetLastNumberPermanentAsync(dateDocument);
                    //DatePermanent = await _convertDocumentsService.GetLastDatePermanentAsync(dateDocument);
                    AccDocumentHeaders = new ObservableCollection <AccDocumentHeaderDTO>(_accDocumentHeadersService.GetAccDocumentHeadersAsync(dateDocument).Result);
                    IsBusy             = false;
                }
                else
                {
                    IsEnable = false;
                }
            };
        }
Beispiel #2
0
        //}
        public async void LoadCurrencyExchanges()
        {
            //باید سندهایی که از آخرین تسعیر تا الان هستند را نشان دهند
            // برگشتی حتما کاملش کن

            AccDocumentItem = new AccDocumentItem();
            var dateDocument = _appContextService.CurrentFinancialYear;

            Close            = _openingClosingsService.GetCloseAcc(dateDocument);
            EndFinancialYear = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
            PersianCalendar persianCalendar = new PersianCalendar();

            var accDate = persianCalendar.GetYear(DateTime.Now);

            //  var endFinancialYear = await _currencyExchangesService.GetEndFinancialYear(dateDocument);
            StartFinancialYear = _currencyExchangesService.GetStartFinancialYear1(dateDocument);
            var GetEnd = GetEndExchange(dateDocument);

            if (Close == false)
            {
                //  IsBusy = true;
                IsEnable = true;
                if (dateDocument == accDate)
                {
                    AccHeaderDate = DateTime.Now;
                    DocumentDate  = DateTime.Now;
                }
                else
                {
                    AccHeaderDate = EndFinancialYear;
                    DocumentDate  = EndFinancialYear;
                }
                if (SLs == null)
                {
                    _allSLs = _sLsService.GetSLsActiveAsync().Result;
                    SLs     = new ObservableCollection <SL>(_allSLs);
                }


                AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_currencyExchangesService.GetGroupedAccDocumentItems(GetEnd.Value.Date

                                                                                                                                             , EndFinancialYear.Date));
                //  IsBusy = false;
            }
            else
            {
                IsEnable = false;
            }
            //IsBusy = false;

            _appContextService.PropertyChanged += async(sender, eventArgs) =>
            {
                var appContextService = sender as IAppContextService;
                if (eventArgs.PropertyName == "CurrentFinancialYear")
                {
                    dateDocument = _appContextService.CurrentFinancialYear;
                }
                EndFinancialYear   = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
                StartFinancialYear = _currencyExchangesService.GetStartFinancialYear1(dateDocument);
                GetEnd             = GetEndExchange(dateDocument);
                Close = _openingClosingsService.GetCloseAcc(dateDocument);
                if (Close == false)
                {
                    IsBusy   = true;
                    IsEnable = true;
                    if (dateDocument == accDate)
                    {
                        AccHeaderDate = DateTime.Now;
                    }
                    else
                    {
                        AccHeaderDate = EndFinancialYear;
                    }
                    //    LastDate = await _currencyExchangesService.GetLastDateDocAsync(dateDocument);
                    AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_currencyExchangesService.GetGroupedAccDocumentItems(GetEnd.Value.Date, EndFinancialYear.Date));
                    IsBusy           = false;
                }
                else
                {
                    IsEnable = false;
                }
            };
        }