Exemple #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;
                }
            };
        }
        public async void LoadCloseProfitLosss()
        {
            IsBusy          = true;
            AccDocumentItem = new AccDocumentItem();
            var dateDocument = _appContextService.CurrentFinancialYear;

            Close = await _openingClosingsService.GetCloseAccAsync(dateDocument);

            EndFinancialYear = await _currencyExchangesService.GetEndFinancialYear(dateDocument);

            PersianCalendar persianCalendar = new PersianCalendar();

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

            StartFinancialYear = await _currencyExchangesService.GetStartFinancialYear(dateDocument);

            if (Close == false)
            {
                IsEnable = true;

                if (dateDocument == accDate)
                {
                    AccHeaderDate = DateTime.Now;
                }
                else
                {
                    AccHeaderDate = EndFinancialYear;
                }


                if (SLs == null)
                {
                    _allSLs = await _sLsService.GetSLsActiveAsync();

                    SLs = new ObservableCollection <SL>(_allSLs);
                }



                AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_closeProfitLossAccountsService.GetGroupedAccDocumentItems(dateDocument));
                IsBusy           = false;
            }
            else
            {
                IsEnable = false;
            }
            IsBusy = false;
            _appContextService.PropertyChanged += async(sender, eventArgs) =>
            {
                var appContextService = sender as IAppContextService;
                if (eventArgs.PropertyName == "CurrentFinancialYear")
                {
                    dateDocument = _appContextService.CurrentFinancialYear;
                }
                if (Close == false)
                {
                    IsEnable           = true;
                    IsBusy             = true;
                    StartFinancialYear = _currencyExchangesService.GetStartFinancialYear1(dateDocument);

                    EndFinancialYear = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
                    AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_closeProfitLossAccountsService.GetGroupedAccDocumentItems(_appContextService.CurrentFinancialYear));
                    IsBusy           = false;
                }
                else
                {
                    IsEnable = false;
                }
            };
            SelectedAccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>();
            AccDocumentItems1        = new ObservableCollection <AccDocumentItemGroupedDTO>();
        }
        public async void LoadTLDocumentHeaders()
        {
            IsBusy = true;

            TLDocumentHeader = new EditableTLDocumentHeader();
            var dateDocument = _appContextService.CurrentFinancialYear;

            HasTL  = _tLDocumentsService.HasTLDocumentItem(dateDocument);
            HasACC = _accDocumentItemsService.HasAccDocumentItemDate(dateDocument);
            if (HasTL == true && HasACC == true)
            {
                ToDate = _tLDocumentsService.LastDate(dateDocument);
                //  ToNumber= _tLDocumentsService.LastNumber(dateDocument);
            }
            else if (HasTL == false && HasACC == true)
            {
                ToDate = _accDocumentItemsService.Firstdate(dateDocument);
                //ToNumber= _accDocumentItemsService.FirstNumber(dateDocument)+1;
            }
            else if (HasTL == false && HasACC == false)
            {
                ToDate = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
            }
            HasType(dateDocument);
            // LastTLDoc(dateDocument);
            Close = await _openingClosingsService.GetCloseAccAsync(dateDocument);

            if (Close == false)
            {
                IsEnable = true;
            }
            else
            {
                IsEnable = false;
            }

            await LastTLDoc(dateDocument);

            TLDocumentHeaders = new ObservableCollection <TLDocumentHeader>(_tLDocumentsService.GetTLDocumentHeadersAsync(dateDocument).Result);


            _appContextService.PropertyChanged += async(sender, eventArgs) =>
            {
                var appContextService = sender as IAppContextService;
                if (eventArgs.PropertyName == "CurrentFinancialYear")
                {
                    dateDocument = _appContextService.CurrentFinancialYear;
                }
                HasTL  = _tLDocumentsService.HasTLDocumentItem(dateDocument);
                HasACC = _accDocumentItemsService.HasAccDocumentItemDate(dateDocument);
                if (HasTL == true && HasACC == true)
                {
                    ToDate = _tLDocumentsService.LastDate(dateDocument);
                    //  ToNumber= _tLDocumentsService.LastNumber(dateDocument);
                }
                else if (HasTL == false && HasACC == true)
                {
                    ToDate = _accDocumentItemsService.Firstdate(dateDocument);
                    //ToNumber= _accDocumentItemsService.FirstNumber(dateDocument)+1;
                }
                else if (HasTL == false && HasACC == false)
                {
                    ToDate = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
                }
                HasType(dateDocument);
                // LastTLDoc(dateDocument);
                Close = await _openingClosingsService.GetCloseAccAsync(dateDocument);

                if (Close == false)
                {
                    IsEnable = true;
                }
                else
                {
                    IsEnable = false;
                }

                LastTLDocSync(dateDocument);
                TLDocumentHeaders = new ObservableCollection <TLDocumentHeader>(_tLDocumentsService.GetTLDocumentHeadersAsync(dateDocument).Result);
            };
            IsBusy = false;
        }
Exemple #4
0
        public async void LoadOpeningClosing()
        {
            var dateDocument = _appContextService.CurrentFinancialYear;

            var getAcc = await _openingClosingsService.GetAccDocumentItemsAsync(dateDocument);

            GetAcc  = getAcc.Count;
            Opening = await _openingClosingsService.GetCloseAccAsync(dateDocument);

            var newOpening = await _openingClosingsService.GetOpenAccAsync(dateDocument + 1);

            Closing = await _openingClosingsService.GetCloseProfitLossAccountAsync(dateDocument);

            if (GetAcc > 0 && Closing == true && Opening == false)
            {
                CheckType  = "اختتامیه";
                Enable     = true;
                TypeHeader = 4;
            }

            else if (GetAcc > 0 && Opening == true && newOpening == false)
            {
                CheckType  = "افتتاحیه";
                Enable     = true;
                TypeHeader = 3;
            }

            else if (GetAcc > 0 && Opening == true && newOpening == true)
            {
                CheckType = "سند افتتاحیه و اختتامیه صادر شده است";
                Enable    = false;
            }
            else if (GetAcc > 0 && Closing == false)
            {
                CheckType = "سندهای سود و زیانی بسته نشده است";
                Enable    = false;
            }
            else if (GetAcc == 0)
            {
                CheckType = "هیچ سندی صادر نشده است.";
                Enable    = false;
            }

            _appContextService.PropertyChanged += async(sender, eventArgs) =>
            {
                var appContextService = sender as IAppContextService;
                if (eventArgs.PropertyName == "CurrentFinancialYear")
                {
                    dateDocument = _appContextService.CurrentFinancialYear;
                }

                getAcc     = _openingClosingsService.GetAccDocumentItemsAsync(dateDocument).Result;
                GetAcc     = getAcc.Count;
                Opening    = _openingClosingsService.GetCloseAccAsync(dateDocument).Result;
                newOpening = _openingClosingsService.GetOpenAccAsync(dateDocument + 1).GetAwaiter().GetResult();
                Closing    = _openingClosingsService.GetCloseProfitLossAccountAsync(dateDocument).Result;
                if (GetAcc > 0 && Closing == true && Opening == false)
                {
                    CheckType = "اختتامیه";
                    Enable    = true;
                }

                else if (GetAcc > 0 && Opening == true && newOpening == false)
                {
                    CheckType = "افتتاحیه";
                    Enable    = true;
                }

                else if (GetAcc > 0 && Opening == true && newOpening == true)
                {
                    CheckType = "سند افتتاحیه و اختتامیه صادر شده است";
                    Enable    = false;
                }
                else if (GetAcc > 0 && Closing == false)
                {
                    CheckType = "سندهای سود و زیانی بسته نشده است";
                    Enable    = false;
                }
                else if (GetAcc == 0)
                {
                    CheckType = "هیچ سندی صادر نشده است.";
                    Enable    = false;
                }
            };
        }