Ejemplo n.º 1
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            if (suspensionState.Any())
            {
            }
            await Task.CompletedTask;
            var sett = Services.SettingsServices.SettingsService.Instance.OrganisationId;

            Views.Busy.SetBusy(true, "Loading ledger list");
            var temp = await AccountingServices.ListLedgers(sett);

            Views.Busy.SetBusy(false);
            if (temp.result)
            {
                Ledgers = temp.data as List <Ledgers>;
                RaisePropertyChanged("Ledgers");
            }
            if (parameter == null)
            {
                account      = new Accounts();
                account.date = DateTime.Now;
                RaisePropertyChanged("account");
            }
            else
            {
                account        = parameter as Accounts;
                selectedcredit = Ledgers.Where(x => x.id.Equals(account.credit)).FirstOrDefault();
                selecteddebit  = Ledgers.Where(x => x.id.Equals(account.debit)).FirstOrDefault();
                RaisePropertyChanged("selectedcredit");
                RaisePropertyChanged("selecteddebit");
                RaisePropertyChanged("account");
            }
        }
Ejemplo n.º 2
0
        async public void Submit()
        {
            ContentDialog dialog = new ContentDialog();

            dialog.Title = "Error";
            dialog.IsPrimaryButtonEnabled = true;
            dialog.PrimaryButtonText      = "OK";
            dialog.PrimaryButtonClick    += delegate
            {
                dialog.Hide();
            };
            if (selecteddebit == null)
            {
                dialog.Content = "You Should Select Debit Ledger";
                await dialog.ShowAsync();
            }
            else if (selectedcredit == null)
            {
                dialog.Content = "You Should Select Credit Ledger";
                await dialog.ShowAsync();
            }
            else if (double.IsNaN(account.amount) || account.amount < 0)
            {
                dialog.Content = "You should enter a valid amount";
                await dialog.ShowAsync();
            }
            else if (string.IsNullOrWhiteSpace(account.particular))
            {
                dialog.Content = "You should enter particulars";
                await dialog.ShowAsync();
            }
            else
            {
                if (account.organisation == null)
                {
                    account.organisation = Services.SettingsServices.SettingsService.Instance.OrganisationId;
                }
                account.debit  = selecteddebit.id;
                account.credit = selectedcredit.id;
                Views.Busy.SetBusy(true, "Adding/Updating entry");
                var res = await AccountingServices.AddJorunal(account);

                Views.Busy.SetBusy(false);
                if (res.result)
                {
                    dialog.Title   = "Success";
                    dialog.Content = "Successfully added/updated the entry";
                    await dialog.ShowAsync();

                    NavigationService.Navigate(typeof(Views.Accounting.AccountingHome));
                }
                else
                {
                    dialog.Content = res.message;
                    await dialog.ShowAsync();
                }
            }
        }
Ejemplo n.º 3
0
        async public void Submit()
        {
            ContentDialog dialog = new ContentDialog();

            dialog.Title = "Error";
            dialog.IsPrimaryButtonEnabled = true;
            dialog.PrimaryButtonText      = "OK";
            dialog.PrimaryButtonClick    += delegate
            {
                dialog.Hide();
            };
            if (SelectedItem != null)
            {
                ledger.group = SelectedItem;
            }
            if (string.IsNullOrWhiteSpace(ledger.title))
            {
                dialog.Content = "Ledger Title Can't be Empty";
                await dialog.ShowAsync();
            }
            else if (string.IsNullOrWhiteSpace(ledger.group))
            {
                dialog.Content = "Group can't be Empty";
                await dialog.ShowAsync();
            }
            else
            {
                if (string.IsNullOrWhiteSpace(ledger.organisation))
                {
                    ledger.organisation = Services.SettingsServices.SettingsService.Instance.OrganisationId;
                }
                Views.Busy.SetBusy(true, "Updating");
                var res = await AccountingServices.AddLedger(ledger);

                Views.Busy.SetBusy(false);
                if (res.result)
                {
                    dialog.Title   = "Success";
                    dialog.Content = "Ledger Added/Updated Successfully";
                    await dialog.ShowAsync();
                }
                else
                {
                    dialog.Content = res.message;
                    await dialog.ShowAsync();
                }
            }
        }
Ejemplo n.º 4
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            if (suspensionState.Any())
            {
            }
            await Task.CompletedTask;
            var sett = Services.SettingsServices.SettingsService.Instance.OrganisationId;

            Views.Busy.SetBusy(true, "Loading Ledgers");
            var status = await AccountingServices.ListLedgers(sett);

            Views.Busy.SetBusy(false);
            if (status.result)
            {
                if (status.data != null)
                {
                    ledgers = status.data as List <Ledgers>;
                    RaisePropertyChanged("ledgers");
                }
            }
        }
Ejemplo n.º 5
0
        async public void Submit()
        {
            Views.Busy.SetBusy(true, "Loading Entries");
            var sett     = Services.SettingsServices.SettingsService.Instance.OrganisationId;
            var journals = await AccountingServices.ListJournals(sett, fromDate.Date, toDate.Date);

            Views.Busy.SetBusy(false);
            if (journals.result)
            {
                Journals = journals.data as List <Accounts>;
                try {
                    for (int i = 0; i < Journals.Count; i++)
                    {
                        Journals[i].debitedto  = Ledgers.Where(x => x.id.Equals(Journals[i].debit)).FirstOrDefault().title;
                        Journals[i].creditedto = Ledgers.Where(x => x.id.Equals(Journals[i].credit)).FirstOrDefault().title;
                    }
                }
                catch (Exception e)
                {
                }

                RaisePropertyChanged("Journals");
            }
        }
Ejemplo n.º 6
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            if (suspensionState.Any())
            {
            }
            await Task.CompletedTask;

            Views.Busy.SetBusy(true, "Loading ledger list");
            var sett = Services.SettingsServices.SettingsService.Instance.OrganisationId;
            var temp = await AccountingServices.ListLedgers(sett);

            Views.Busy.SetBusy(false);
            if (temp.result)
            {
                Ledgers = temp.data as List <Ledgers>;
            }
            Views.Busy.SetBusy(true, "Loading Entries");
            var journals = await AccountingServices.ListJournals(sett, DateTime.Now.Date, DateTime.Now.Date);

            Views.Busy.SetBusy(false);
            if (journals.result)
            {
                Journals = journals.data as List <Accounts>;
                for (int i = 0; i < Journals.Count; i++)
                {
                    Journals[i].debitedto  = Ledgers.Where(x => x.id.Equals(Journals[i].debit)).FirstOrDefault().title;
                    Journals[i].creditedto = Ledgers.Where(x => x.id.Equals(Journals[i].credit)).FirstOrDefault().title;
                }
                //foreach (var x in Journals)
                //{
                //    x.debit = Ledgers.Where(z => z.id.Equals(x.id)).First().title;
                //    x.credit = Ledgers.Where(z => z.id.Equals(x.id)).First().title;
                //}
                RaisePropertyChanged("Journals");
            }
        }