async void InitialLoad()
        {
            await TransactionReport.SetDailyJournal(cmbJournal, api);

            var t = SetNoOfDimensions();

            StartLoadCache(t);
        }
示例#2
0
 void IntialLoad()
 {
     TransactionReport.SetDailyJournal(cmbJournal, api);
 }
        async void LoadGLTrans()
        {
            SetExpandAndCollapse(true);
            statementList.Clear();
            List <int> dim1 = null, dim2 = null, dim3 = null, dim4 = null, dim5 = null;

            var NumberOfDimensions = api.CompanyEntity.NumberOfDimensions;

            if (NumberOfDimensions >= 1)
            {
                dim1 = TransactionReport.GetRowIDs(cbdim1);
            }
            if (NumberOfDimensions >= 2)
            {
                dim2 = TransactionReport.GetRowIDs(cbdim2);
            }
            if (NumberOfDimensions >= 3)
            {
                dim3 = TransactionReport.GetRowIDs(cbdim3);
            }
            if (NumberOfDimensions >= 4)
            {
                dim4 = TransactionReport.GetRowIDs(cbdim4);
            }
            if (NumberOfDimensions >= 5)
            {
                dim5 = TransactionReport.GetRowIDs(cbdim5);
            }
            AccountStatement2.SetDateTime(txtDateFrm, txtDateTo);
            DateTime fromDate = AccountStatement2.DefaultFromDate, toDate = AccountStatement2.DefaultToDate;

            var isAscending = cbxAscending.IsChecked.Value;
            var skipBlank   = cbxSkipBlank.IsChecked.Value;

            var Pref = api.session.Preference;

            Pref.TransactionReport_isAscending = isAscending;
            Pref.TransactionReport_skipBlank   = skipBlank;

            string fromAccount = null, toAccount = null;
            var    accountObj = cmbFromAccount.EditValue;

            if (accountObj != null)
            {
                fromAccount = accountObj.ToString();
            }

            accountObj = cmbToAccount.EditValue;
            if (accountObj != null)
            {
                toAccount = accountObj.ToString();
            }

            string journal = cmbJournal.Text;

            busyIndicator.IsBusy = true;
            var transApi        = new Uniconta.API.GeneralLedger.ReportAPI(api);
            var dimensionParams = BalanceReport.SetDimensionParameters(dim1, dim2, dim3, dim4, dim5, true, true, true, true, true);
            var listTrans       = (GLTransClientTotal[])await transApi.GetTransactions(new GLTransClientTotal(), journal, fromAccount, toAccount, fromDate, toDate, dimensionParams, ReportAPI.SimplePrimo);

            if (listTrans != null)
            {
                string currentItem = null;
                AccountStatementList2     masterDbStatement = null;
                List <GLTransClientTotal> dbTransClientChildList = null;
                long SumAmount = 0, SumAmountCur = 0;
                byte currentCur = 0;

                foreach (var trans in listTrans)
                {
                    if (trans._Account != currentItem)
                    {
                        currentItem = trans._Account;

                        if (masterDbStatement != null)
                        {
                            if (!skipBlank || SumAmount != 0 || SumAmountCur != 0 || dbTransClientChildList.Count > 1)
                            {
                                masterDbStatement._SumAmount    = SumAmount / 100d;
                                masterDbStatement._SumAmountCur = SumAmountCur / 100d;
                                statementList.Add(masterDbStatement);
                            }
                        }

                        masterDbStatement              = new AccountStatementList2((GLAccount)accountCache.Get(currentItem));
                        dbTransClientChildList         = new List <GLTransClientTotal>();
                        masterDbStatement.ChildRecords = dbTransClientChildList;
                        SumAmount  = SumAmountCur = 0;
                        currentCur = (byte)masterDbStatement.Acc._Currency;
                    }

                    SumAmount   += trans._AmountCent;
                    trans._Total = SumAmount;
                    masterDbStatement._SumAmount = SumAmount;

                    if (trans._AmountCurCent != 0 && trans._Currency == currentCur)
                    {
                        SumAmountCur   += trans._AmountCurCent;
                        trans._TotalCur = SumAmountCur;
                    }

                    if (isAscending)
                    {
                        dbTransClientChildList.Add(trans);
                    }
                    else
                    {
                        dbTransClientChildList.Insert(0, trans);
                    }
                }

                if (masterDbStatement != null)
                {
                    if (!skipBlank || SumAmount != 0 || SumAmountCur != 0 || dbTransClientChildList.Count > 1)
                    {
                        masterDbStatement._SumAmount    = SumAmount / 100d;
                        masterDbStatement._SumAmountCur = SumAmountCur / 100d;
                        statementList.Add(masterDbStatement);
                    }
                }

                if (statementList.Count > 0)
                {
                    dgGLTrans.ItemsSource = null;
                    dgGLTrans.ItemsSource = statementList;
                }
                dgGLTrans.Visibility = Visibility.Visible;
            }
            else if (transApi.LastError != 0)
            {
                Uniconta.ClientTools.Util.UtilDisplay.ShowErrorCode(transApi.LastError);
            }
            busyIndicator.IsBusy = false;
            if (_master != null)
            {
                SetExpandAndCollapse(false);
            }
        }
        private async Task SetNoOfDimensions()
        {
            var api            = this.api;
            int noofDimensions = api.CompanyEntity.NumberOfDimensions;

            if (noofDimensions < 5)
            {
#if SILVERLIGHT
                cbdim5.Visibility = cldim5.Visibility = Visibility.Collapsed;
#endif
                lblDim5.Visibility = Visibility.Collapsed;
                cldim5.Visible     = false;
                cbdim5.Visibility  = Visibility.Collapsed;
            }
            else
            {
                await TransactionReport.SetDimValues(typeof(GLDimType5), cbdim5, api);
            }

            if (noofDimensions < 4)
            {
#if SILVERLIGHT
                cbdim4.Visibility = cldim4.Visibility = Visibility.Collapsed;
#endif
                lblDim4.Visibility = Visibility.Collapsed;
                cldim4.Visible     = false;
                cbdim4.Visibility  = Visibility.Collapsed;
            }
            else
            {
                await TransactionReport.SetDimValues(typeof(GLDimType4), cbdim4, api);
            }

            if (noofDimensions < 3)
            {
#if SILVERLIGHT
                cbdim3.Visibility = cldim3.Visibility = Visibility.Collapsed;
#endif
                lblDim3.Visibility = Visibility.Collapsed;
                cldim3.Visible     = false;
                cbdim3.Visibility  = Visibility.Collapsed;
            }
            else
            {
                await TransactionReport.SetDimValues(typeof(GLDimType3), cbdim3, api);
            }

            if (noofDimensions < 2)
            {
#if SILVERLIGHT
                cbdim2.Visibility = cldim2.Visibility = Visibility.Collapsed;
#endif
                lblDim2.Visibility = Visibility.Collapsed;
                cldim2.Visible     = false;
                cbdim2.Visibility  = Visibility.Collapsed;
            }
            else
            {
                await TransactionReport.SetDimValues(typeof(GLDimType2), cbdim2, api);
            }

            if (noofDimensions < 1)
            {
#if SILVERLIGHT
                cbdim1.Visibility = cldim1.Visibility = Visibility.Collapsed;
#endif
                lblDim1.Visibility = Visibility.Collapsed;
                cldim1.Visible     = false;
                cbdim1.Visibility  = Visibility.Collapsed;
            }
            else
            {
                await TransactionReport.SetDimValues(typeof(GLDimType1), cbdim1, api);
            }
        }
示例#5
0
 async void LoadJournals()
 {
     await TransactionReport.SetDailyJournal(cmbJournal, api);
 }
示例#6
0
        async void LoadGLTrans()
        {
            childDgGLTrans.ClearSorting();
            SetExpandAndCollapse(true);
            List <int> dim1 = null, dim2 = null, dim3 = null, dim4 = null, dim5 = null;

            var NumberOfDimensions = api.CompanyEntity.NumberOfDimensions;

            if (NumberOfDimensions >= 1)
            {
                dim1 = TransactionReport.GetRowIDs(cbdim1);
            }
            if (NumberOfDimensions >= 2)
            {
                dim2 = TransactionReport.GetRowIDs(cbdim2);
            }
            if (NumberOfDimensions >= 3)
            {
                dim3 = TransactionReport.GetRowIDs(cbdim3);
            }
            if (NumberOfDimensions >= 4)
            {
                dim4 = TransactionReport.GetRowIDs(cbdim4);
            }
            if (NumberOfDimensions >= 5)
            {
                dim5 = TransactionReport.GetRowIDs(cbdim5);
            }
            AccountStatement.SetDateTime(txtDateFrm, txtDateTo);
            DateTime fromDate = AccountStatement.DefaultFromDate, toDate = AccountStatement.DefaultToDate;

            var showDimOnPrimo = cmbShowDimOnPrimo.SelectedIndex;

#if !SILVERLIGHT
            pageBreak = cbxPageBreak.IsChecked.Value;
#endif
            setShowDimOnPrimoIndex = showDimOnPrimo;

            string fromAccount = null, toAccount = null;
            var    accountObj = cmbFromAccount.EditValue;
            if (accountObj != null)
            {
                fromAccount = accountObj.ToString();
            }

            accountObj = cmbToAccount.EditValue;
            if (accountObj != null)
            {
                toAccount = accountObj.ToString();
            }

            busyIndicator.IsBusy = true;

            if (Simulated.Visible)
            {
                SimulatedVisible = true;
            }
            string journal = cmbJournal.Text;
            Simulated.Visible = SimulatedVisible && !string.IsNullOrWhiteSpace(journal);

            var dimensionParams = BalanceReport.SetDimensionParameters(dim1, dim2, dim3, dim4, dim5, true, true, true, true, true);
            var listTrans       = (GLTransClientTotal[])await transApi.GetTransactions(new GLTransClientTotal(), journal, fromAccount, toAccount, fromDate, toDate, dimensionParams, showDimOnPrimo);

            if (accountCache == null)
            {
                accountCache = await transApi.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.GLAccount), api);
            }

            if (listTrans != null)
            {
                FillStatement(listTrans);
            }
            else if (transApi.LastError != 0)
            {
                Uniconta.ClientTools.Util.UtilDisplay.ShowErrorCode(transApi.LastError);
            }
            dgGLTrans.Visibility = Visibility.Visible;
            busyIndicator.IsBusy = false;
            SetExpandAndCollapse(IsCollapsed);
        }
        public CWChangeDimension(CrudAPI api, bool isChangeDimension = true, bool isChangeText = true)
        {
            this.DataContext = this;
            this.api         = api;
            InitializeComponent();
#if !SILVERLIGHT
            if (string.IsNullOrWhiteSpace(leAccount.Text))
            {
                FocusManager.SetFocusedElement(leAccount, leAccount);
            }
#endif
            leAccount.api = api;
            if (isChangeDimension)
            {
                setDim();
                int noofDimensions = api.CompanyEntity.NumberOfDimensions;
                if (noofDimensions >= 1)
                {
                    TransactionReport.SetDimValues(typeof(GLDimType1), lookupDim1, api, true);
                }
                if (noofDimensions >= 2)
                {
                    TransactionReport.SetDimValues(typeof(GLDimType2), lookupDim2, api, true);
                }
                if (noofDimensions >= 3)
                {
                    TransactionReport.SetDimValues(typeof(GLDimType3), lookupDim3, api, true);
                }
                if (noofDimensions >= 4)
                {
                    TransactionReport.SetDimValues(typeof(GLDimType4), lookupDim4, api, true);
                }
                if (noofDimensions >= 5)
                {
                    TransactionReport.SetDimValues(typeof(GLDimType5), lookupDim5, api, true);
                }
                //lookupDim1.SelectedIndex = lookupDim2.SelectedIndex = lookupDim3.SelectedIndex = lookupDim4.SelectedIndex = lookupDim5.SelectedIndex = 0;

                //Text Row
                HideRow(6);
                //Qty Row
                HideRow(7);

                double h = this.Height - 60;
                this.Height = h;
                this.Title  = Uniconta.ClientTools.Localization.lookup("ChangeDimension");
            }
            else if (isChangeText)
            {
                //Account Row
                HideRow(0);
                //Dimension1 Row
                HideRow(1);
                //Dimension3 Row
                HideRow(2);
                //Dimension3 Row
                HideRow(3);
                //Dimension4 Row
                HideRow(4);
                //Dimension5 Row
                HideRow(5);
                //Qty Row
                HideRow(7);

                double h = this.Height - 210;
                this.Height = h;
                this.Title  = Uniconta.ClientTools.Localization.lookup("ChangeText");
            }
            else
            {
                //Account Row
                HideRow(0);
                //Dimension1 Row
                HideRow(1);
                //Dimension3 Row
                HideRow(2);
                //Dimension3 Row
                HideRow(3);
                //Dimension4 Row
                HideRow(4);
                //Dimension5 Row
                HideRow(5);
                //Text Row
                HideRow(6);

                double h = this.Height - 210;
                this.Height = h;
                this.Title  = string.Format(Uniconta.ClientTools.Localization.lookup("ChangeOBJ"), Uniconta.ClientTools.Localization.lookup("Qty"));
            }
            this.Loaded += CW_Loaded;
        }
示例#8
0
        async void SetSources()
        {
            var api  = this.api;
            var Comp = api.CompanyEntity;

            cmbBudgetModel.api = api;
            cmbAccount100.api  = api;
            var noofDimensions = Comp.NumberOfDimensions;

            dim1.Text    = Comp._Dim1;
            dim2.Text    = Comp._Dim2;
            dim3.Text    = Comp._Dim3;
            dim4.Text    = Comp._Dim4;
            dim5.Text    = Comp._Dim5;
            company.Text = Uniconta.ClientTools.Localization.lookup("Company");

            cbCompany.ItemsSource = companyList;

            var journalSource = new List <string>();
            var cache         = Comp.GetCache(typeof(Uniconta.DataModel.GLDailyJournal)) ?? await api.LoadCache(typeof(Uniconta.DataModel.GLDailyJournal));

            if (cache != null)
            {
                journalSource.Capacity = cache.Count;
                foreach (var rec in cache.GetKeyStrRecords)
                {
                    journalSource.Add(rec.KeyStr);
                }
            }

            cmbJournal.ItemsSource = journalSource;

            var actSource = new List <string>();

            cache = Comp.GetCache(typeof(Uniconta.DataModel.GLAccount)) ?? await api.LoadCache(typeof(Uniconta.DataModel.GLAccount));

            if (cache != null)
            {
                actSource.Capacity = cache.Count;
                foreach (var rec in cache.GetKeyStrRecords)
                {
                    actSource.Add(rec.KeyStr);
                }
            }

            cmbAccount100.ItemsSource = actSource;

            if (noofDimensions < 5)
            {
                cbdim5.Visibility = dim5.Visibility = Visibility.Collapsed;
                rowdim5.Height    = GridLength.Auto;
            }
            else
            {
                TransactionReport.SetDimValues(typeof(GLDimType5), cbdim5, api);
            }

            if (noofDimensions < 4)
            {
                cbdim4.Visibility = dim4.Visibility = Visibility.Collapsed;
                rowdim4.Height    = GridLength.Auto;
            }
            else
            {
                TransactionReport.SetDimValues(typeof(GLDimType4), cbdim4, api);
            }

            if (noofDimensions < 3)
            {
                cbdim3.Visibility = dim3.Visibility = Visibility.Collapsed;
                rowdim3.Height    = GridLength.Auto;
            }
            else
            {
                TransactionReport.SetDimValues(typeof(GLDimType3), cbdim3, api);
            }

            if (noofDimensions < 2)
            {
                cbdim2.Visibility = dim2.Visibility = Visibility.Collapsed;
                rowdim2.Height    = GridLength.Auto;
            }
            else
            {
                TransactionReport.SetDimValues(typeof(GLDimType2), cbdim2, api);
            }

            if (noofDimensions < 1)
            {
                cbdim1.Visibility = dim1.Visibility = Visibility.Collapsed;
                rowdim1.Height    = GridLength.Auto;
            }
            else
            {
                TransactionReport.SetDimValues(typeof(GLDimType1), cbdim1, api);
            }
        }