예제 #1
0
        private void OpretNyeKonti_Click(object sender, EventArgs e)
        {
            var api = UCInitializer.GetBaseAPI;

            foreach (var recNyKontoplan in this.karNyKontoplanBindingSource.DataSource as KarNyKontoplan)
            {
                recKontoplan recKontoplan = null;
                if (recNyKontoplan.SkalOprettes)
                {
                    try
                    {
                        recKontoplan = (from x in Program.karKontoplan where x.Kontonr == recNyKontoplan.Kontonr select x).First();

                        var crit = new List <PropValuePair>();
                        var pair = PropValuePair.GenereteWhereElements("Account", typeof(String), recNyKontoplan.NytKontonr);
                        crit.Add(pair);
                        var taskQueryGLAccount = api.Query <GLAccountClient>(crit);
                        taskQueryGLAccount.Wait();
                        var col = taskQueryGLAccount.Result;
                        if (col.Count() == 0)
                        {
                            GLAccountClient recGLAccount = new GLAccountClient()
                            {
                                Account = recNyKontoplan.NytKontonr,
                                Name    = recNyKontoplan.Kontonavn,
                            };
                            if (recKontoplan.Type == "Drift")
                            {
                                if (recKontoplan.DK == "1")
                                {
                                    recGLAccount.AccountTypeEnum = Uniconta.DataModel.GLAccountTypes.Revenue;
                                }
                                else
                                {
                                    recGLAccount.AccountTypeEnum = Uniconta.DataModel.GLAccountTypes.Expense;
                                }
                            }
                            else
                            {
                                if (recKontoplan.DK == "0")
                                {
                                    recGLAccount.AccountTypeEnum = Uniconta.DataModel.GLAccountTypes.Asset;
                                }
                                else
                                {
                                    recGLAccount.AccountTypeEnum = Uniconta.DataModel.GLAccountTypes.Liability;
                                }
                            }

                            var taskInsertGLAccount = api.Insert(recGLAccount);
                            taskInsertGLAccount.Wait();
                            var err = taskInsertGLAccount.Result;
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
예제 #2
0
        void localMenu_OnItemClicked(string ActionType)
        {
            GLAccountClient selectedItem = dgGLAccount.View.MasterRootRowsContainer.FocusedView.DataControl.CurrentItem as GLAccountClient;

            switch (ActionType)
            {
            case "Search":
                InitQuery();
                break;

            case "GLAccountFilter":
                if (glAccountFilterDialog == null)
                {
                    glAccountFilterDialog          = new CWServerFilter(api, typeof(GLAccountClient), glAccountDefaultFilter, null, GLAccountUserFields);
                    glAccountFilterDialog.Closing += glAccountFilterDialog_Closing;
#if !SILVERLIGHT
                    glAccountFilterDialog.Show();
                }
                else
                {
                    glAccountFilterDialog.Show(true);
                }
#elif SILVERLIGHT
                }
                glAccountFilterDialog.Show();
#endif
                break;
예제 #3
0
        //Initialize page
        void InitPage(CrudAPI crudapi)
        {
            var Comp = crudapi.CompanyEntity;

            BusyIndicator = busyIndicator;
            layoutControl = layoutItems;
            if (LoadedRow == null)
            {
                frmRibbon.DisableButtons("Delete");
                if (!isCopiedRow)
                {
                    editrow = CreateNew() as GLAccountClient;
                }
                for (int n = Comp.NumberOfDimensions; (n > 0); n--)
                {
                    editrow.SetDimUsed(n, true);
                }
            }
            layoutItems.DataContext       = editrow;
            PrimoAccountLookupEditor.api  = leVat.api = Withholdinglookupeditior.api = VatOprlookupeditior.api = OffsetAccountLookupEditor.api =
                lbPrCategory.api          = dim1lookupeditior.api = dim2lookupeditior.api = dim3lookupeditior.api = dim4lookupeditior.api =
                    dim5lookupeditior.api = StandardAccountLookupEditor.api = crudapi;
            UseVatOperation = Comp._UseVatOperation;
            if (!UseVatOperation)
            {
                VatOprlookupeditiorItem.Visibility = Visibility.Collapsed;
            }
            if (!Comp._HasWithholding)
            {
                WithholdinglookupeditiorItem.Visibility = Visibility.Collapsed;
            }
            if (!Comp.Project)
            {
                grpProject.Visibility = Visibility.Collapsed;
            }
            if (Comp.NumberOfDimensions == 0)
            {
                usedim.Visibility    = Visibility.Collapsed;
                useNewdim.Visibility = Visibility.Collapsed;
            }
            if (Comp._CountryId != CountryCode.Germany && Comp._CountryId != CountryCode.Austria)
            {
                liDATEVAuto.Visibility = Visibility.Collapsed;
            }

            SetAccountTotals();
            SetOffsetAccountSource();
            Utility.SetDimensions(crudapi, lbldim1, lbldim2, lbldim3, lbldim4, lbldim5, cmbDim1, cmbDim2, cmbDim3, cmbDim4, cmbDim5, usedim);
            Utility.SetDimensions(crudapi, lblNewdim1, lblNewdim2, lblNewdim3, lblNewdim4, lblNewdim5, dim1lookupeditior, dim2lookupeditior, dim3lookupeditior, dim4lookupeditior, dim5lookupeditior, useNewdim);

            frmRibbon.OnItemClicked += frmRibbon_OnItemClicked;
        }
        void CopyRecord(GLAccountClient selectedItem)
        {
            if (selectedItem == null)
            {
                return;
            }
            var glAccount = Activator.CreateInstance(selectedItem.GetType()) as GLAccountClient;

            CorasauDataGrid.CopyAndClearRowId(selectedItem, glAccount);
            var parms = new object[2] {
                glAccount, false
            };

            AddDockItem(TabControls.GLAccountPage2, parms, Uniconta.ClientTools.Localization.lookup("Accounts"), "Add_16x16.png");
        }
        void localMenu_OnItemClicked(string ActionType)
        {
            GLAccountClient selectedItem = dgGLTable.SelectedItem as GLAccountClient;

            switch (ActionType)
            {
            case "EditAll":
                if (dgGLTable.Visibility == Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "AddItem":
                AddDockItem(TabControls.GLAccountPage2, api, Uniconta.ClientTools.Localization.lookup("Accounts"), "Add_16x16.png");
                break;

            case "EditItem":
                if (selectedItem == null)
                {
                    return;
                }
                var param = new object[2] {
                    selectedItem, true
                };
                AddDockItem(TabControls.GLAccountPage2, param, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Accounts"), selectedItem.Account));
                break;

            case "AddRow":
                if (dgGLTable.Readonly)
                {
                    AddDockItem(TabControls.GLAccountPage2, api, Uniconta.ClientTools.Localization.lookup("Accounts"), "Add_16x16.png");
                }
                else
                {
                    dgGLTable.AddRow();
                }
                break;

            case "CopyRow":
                if (selectedItem != null)
                {
                    if (copyRowIsEnabled)
                    {
                        dgGLTable.CopyRow();
                    }
                    else
                    {
                        CopyRecord(selectedItem);
                    }
                }
                break;

            case "DeleteRow":
                dgGLTable.DeleteRow();
                break;

            case "SaveGrid":
                dgGLTable.SaveData();
                break;

            case "AllocationAccounts":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.GLAllocationAccounts, dgGLTable.syncEntity);
                }
                break;

            case "GLTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.TransactionReport, dgGLTable.syncEntity);
                }
                break;

            case "Trans":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.AccountsTransaction, dgGLTable.syncEntity, string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("AccountsTransaction"), selectedItem._Name));
                }
                break;

            case "Budget":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.GLBudgetLinePage, dgGLTable.syncEntity);
                }
                break;

            case "AddNote":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserNotesPage, dgGLTable.syncEntity);
                }
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, dgGLTable.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem._Name));
                }
                break;

            case "VatOnClient":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.VatOnClientsReport, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("VATprDC"), selectedItem._Name));
                }
                break;

            case "GLTransSum":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.GLTransSumClientPage, dgGLTable.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("AccountTotals"), selectedItem._Account));
                }
                break;

            case "CopyRecord":
                CopyRecord(selectedItem);
                break;

            case "UndoDelete":
                dgGLTable.UndoDeleteRow();
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
예제 #6
0
        void localMenu_OnItemClicked(string ActionType)
        {
            GLAccountClient selectedItem = dgGLTable.SelectedItem as GLAccountClient;

            switch (ActionType)
            {
            case "EditAll":
                if (dgGLTable.Visibility == Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "AddItem":
                AddDockItem(TabControls.GL_AccountPage2, api, Uniconta.ClientTools.Localization.lookup("Accounts"), ";component/Assets/img/Add_16x16.png");
                break;

            case "EditItem":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.GL_AccountPage2, selectedItem);
                break;

            case "AddRow":
                if (dgGLTable.Readonly)
                {
                    AddDockItem(TabControls.GL_AccountPage2, api, Uniconta.ClientTools.Localization.lookup("Accounts"), ";component/Assets/img/Add_16x16.png");
                }
                else
                {
                    dgGLTable.AddRow();
                }
                break;

            case "CopyRow":
                dgGLTable.CopyRow();
                break;

            case "DeleteRow":
                dgGLTable.DeleteRow();
                break;

            case "SaveGrid":
                dgGLTable.SaveData();
                break;

            case "AllocationAccounts":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.GL_AllocationsAccounts, dgGLTable.syncEntity);
                break;

            case "GLTran":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.TransactionReport, dgGLTable.syncEntity);
                break;

            case "Trans":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.AccountsTransaction, dgGLTable.syncEntity, string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Name));
                break;

            case "Budget":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.GLBudgetLinePage, dgGLTable.syncEntity);
                break;

            case "AddNote":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserNotesPage, dgGLTable.syncEntity);
                }
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, dgGLTable.syncEntity);
                }
                break;

            case "VatOnClient":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.VatOnClientsReport, selectedItem, string.Format("{0}:{1}", Uniconta.ClientTools.Localization.lookup("VATprDC"), selectedItem._Name));
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }