예제 #1
0
        private void JoinAllOrdersToSelectedItem(DebtorOrderClient selectedItem, IEnumerable <DebtorOrderClient> allOrderList)
        {
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow("", true);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    var        ordersApi = new OrderAPI(api);
                    List <int> errors    = new List <int>();
                    foreach (var order in allOrderList)
                    {
                        if (order._OrderNumber == selectedItem._OrderNumber)
                        {
                            continue;
                        }
                        var result = await ordersApi.JoinTwoOrders(order, selectedItem);

                        if (result != Uniconta.Common.ErrorCodes.Succes)
                        {
                            errors.Add(order._OrderNumber);
                        }
                    }
                    if (errors.Count > 0)
                    {
                        var failedOrderNumbers = string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("OrderNumber"), string.Join(",", errors));
                        var message            = string.Format(Uniconta.ClientTools.Localization.lookup("FailedJoinOBJ"), failedOrderNumbers, selectedItem._OrderNumber);
                        UnicontaMessageBox.Show(message, Uniconta.ClientTools.Localization.lookup("Error"), MessageBoxButton.OK);
                    }
                    var propValpair = Uniconta.Common.PropValuePair.GenereteWhereElements("OrderNumber", typeof(int), Convert.ToString(selectedItem._OrderNumber));
                    dgJoinMultiOrderGrid.Filter(new Uniconta.Common.PropValuePair[] { propValpair });
                }
            };
            EraseYearWindowDialog.Show();
        }
예제 #2
0
        private void ResetFiscalYear()
        {
            var p = getSelectedItem();

            if (p == null)
            {
                return;
            }

            var interval = string.Format(Uniconta.ClientTools.Localization.lookup("FromTo"), p._FromDate.ToShortDateString(), p._ToDate.ToShortDateString());
            var Header   = string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("DeleteTrans"), interval);

            var EraseYearWindowDialog = new EraseYearWindow(Header, false);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    ErrorCodes res = await FiApi.EraseAllTransactions(p);

                    if (res != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                    else
                    {
                        dgFinanceYearGrid.DeleteRow();
                        (dgFinanceYearGrid.View as TableView).FocusedRowHandle = 0;
                    }
                }
            };
            EraseYearWindowDialog.Show();
        }
        private void GeneratePrimo()
        {
            var p = getSelectedItem();

            if (p == null)
            {
                return;
            }
            CWCreatePrimo dialogPrimo = new CWCreatePrimo(this.api, p);

            dialogPrimo.Closed += delegate
            {
                if (dialogPrimo.DialogResult == true)
                {
                    var s = string.Format(Uniconta.ClientTools.Localization.lookup("PrimoOnDate"), p._FromDate.ToShortDateString());
                    var EraseYearWindowDialog = new EraseYearWindow(s, true);
                    EraseYearWindowDialog.Closed += async delegate
                    {
                        if (EraseYearWindowDialog.DialogResult == true)
                        {
                            ErrorCodes res = await FiApi.GeneratePrimoTransactions(p, dialogPrimo.BalanceName, dialogPrimo.PLText, dialogPrimo.Voucher, dialogPrimo.NumberserieText);

                            UtilDisplay.ShowErrorCode(res);
                            if (res == ErrorCodes.Succes && !p._Current)
                            {
                                var text = string.Format(Uniconta.ClientTools.Localization.lookup("MoveToOBJ"), string.Format("{0} - {1}", p._FromDate.ToShortDateString(), p._ToDate.ToShortDateString()));
                                CWConfirmationBox dialog = new CWConfirmationBox(text, Uniconta.ClientTools.Localization.lookup("IsYearEnded"), true);
                                dialog.Closing += delegate
                                {
                                    var res2 = dialog.ConfirmationResult;
                                    if (res2 == CWConfirmationBox.ConfirmationResultEnum.Yes)
                                    {
                                        var source = (IList)dgFinanceYearGrid.ItemsSource;
                                        if (source != null)
                                        {
                                            IEnumerable <CompanyFinanceYearClient> gridItems = source.Cast <CompanyFinanceYearClient>();
                                            foreach (var y in gridItems)
                                            {
                                                if (y._Current)
                                                {
                                                    y.Current = false;
                                                    break;
                                                }
                                            }
                                        }
                                        var org = StreamingManager.Clone(p);
                                        p.Current = true;
                                        api.UpdateNoResponse(org, p);
                                    }
                                    ;
                                };
                                dialog.Show();
                            }
                        }
                    };
                    EraseYearWindowDialog.Show();
                }
            };
            dialogPrimo.Show();
        }
예제 #4
0
        private void JoinOrdersPerCustomer()
        {
            var ordersToBeJoined = dgJoinMultiOrderGrid.GetVisibleRows() as IEnumerable <DebtorOrderClient>;

            if (ordersToBeJoined == null || ordersToBeJoined.Count() == 0)
            {
                return;
            }
            var             allOrderList          = ordersToBeJoined.GroupBy(x => x.Account).Select(x => x.First()).ToList();
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow("", true);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    var        ordersApi = new OrderAPI(api);
                    List <int> errors    = new List <int>();
                    List <int> orders    = new List <int>();
                    foreach (var order in allOrderList)
                    {
                        foreach (var customerOrder in ordersToBeJoined)
                        {
                            if (order.Account == customerOrder.Account)
                            {
                                if (order._OrderNumber == customerOrder._OrderNumber)
                                {
                                    continue;
                                }
                                var result = await ordersApi.JoinTwoOrders(customerOrder, order);

                                if (result != Uniconta.Common.ErrorCodes.Succes)
                                {
                                    errors.Add(customerOrder._OrderNumber);
                                    orders.Add(order._OrderNumber);
                                }
                            }
                        }
                    }
                    if (errors.Count > 0)
                    {
                        var failedOrderNumbers = string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("OrderNumber"), string.Join(",", errors));
                        var message            = string.Format(Uniconta.ClientTools.Localization.lookup("FailedJoinOBJ"), failedOrderNumbers, string.Join(",", orders));
                        UnicontaMessageBox.Show(message, Uniconta.ClientTools.Localization.lookup("Error"), MessageBoxButton.OK);
                    }
                    InitQuery();
                }
            };
            EraseYearWindowDialog.Show();
        }
        private void RemovePrimo(CompanyFinanceYearClient financialYearClient)
        {
            var removePrimoWindowDialog = new EraseYearWindow(financialYearClient.BalanceName, false);

            removePrimoWindowDialog.Closed += async delegate
            {
                if (removePrimoWindowDialog.DialogResult == true)
                {
                    var financialYearApi = new FinancialYearAPI(api);
                    var result           = await financialYearApi.RemovePrimoTransactions(financialYearClient);

                    UtilDisplay.ShowErrorCode(result);
                }
            };
            removePrimoWindowDialog.Show();
        }
예제 #6
0
        void GDPRCleanUp()
        {
            closePageOnSave = false;
            saveForm();
            var cwobj = new CwSimulateGDPR();

            cwobj.Closing += async delegate
            {
                if (cwobj.DialogResult == true)
                {
                    var compApi = new CompanyAPI(api);
                    if (cwobj.Simulate)
                    {
                        var res = await compApi.GDPRTextCleanup();

                        if (res == null || res.Length == 0)
                        {
                            UtilDisplay.ShowErrorCode(res == null ? compApi.LastError : ErrorCodes.NoLinesFound);
                        }
                        else
                        {
                            AddDockItem(TabControls.DebtorCreditorGDPRTextCleanUp, new object[] { api, res }, string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("CleanUp"), Uniconta.ClientTools.Localization.lookup("Account")));
                        }
                    }
                    else
                    {
                        EraseYearWindow delDialog = new EraseYearWindow("", false);
                        delDialog.Closed += async delegate
                        {
                            if (delDialog.DialogResult == true)
                            {
                                var res = await compApi.GDPRCleanup();

                                UtilDisplay.ShowErrorCode(res);
                            }
                        };
                        delDialog.Show();
                    }
                }
            };
            cwobj.Show();
        }
예제 #7
0
        private void JoinToSelectedItem(DebtorOrderClient selectedItem)
        {
            var    ordersToBeJoined = dgJoinMultiOrderGrid.GetVisibleRows() as IEnumerable <DebtorOrderClient>;
            var    acc  = selectedItem._DCAccount;
            string acc2 = null;

            foreach (var rec in ordersToBeJoined)
            {
                if (rec._DCAccount != acc)
                {
                    acc2 = rec._DCAccount;
                    break;
                }
            }
            if (acc2 != null)
            {
                string msg = string.Format("{0}\r\n{1}", string.Format(Uniconta.ClientTools.Localization.lookup("DifferentAccountMessage"), acc, acc2),
                                           Uniconta.ClientTools.Localization.lookup("AreYouSureToContinue"));
                var confirmationDialog = new CWConfirmationBox(msg, Uniconta.ClientTools.Localization.lookup("Confirmation"), false);
                confirmationDialog.Closing += delegate
                {
                    if (confirmationDialog.ConfirmationResult == CWConfirmationBox.ConfirmationResultEnum.Yes)
                    {
                        EraseYearWindow EraseYearWindowDialog = new EraseYearWindow("", true);
                        EraseYearWindowDialog.Closed += delegate
                        {
                            if (EraseYearWindowDialog.DialogResult == true)
                            {
                                JoinAllOrdersToSelectedItem(selectedItem, ordersToBeJoined);
                            }
                        };
                        EraseYearWindowDialog.Show();
                    }
                };
                confirmationDialog.Show();
            }
            else
            {
                JoinAllOrdersToSelectedItem(selectedItem, ordersToBeJoined);
            }
        }
예제 #8
0
        private void DeleteAllAttachmentsCompany()
        {
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(editrow.CompanyName, false);

            EraseYearWindowDialog.Closed += delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    EnterPasswordWindow passwordConfirmationDailog = new EnterPasswordWindow();
                    passwordConfirmationDailog.Closed += async delegate
                    {
                        if (passwordConfirmationDailog.DialogResult == true)
                        {
                            if (UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("ConfirmDeleteTrans"), editrow.CompanyName), Uniconta.ClientTools.Localization.lookup("Confirmation"),
#if !SILVERLIGHT
                                                        MessageBoxButton.YesNo) == MessageBoxResult.Yes)
#else
                                                        MessageBoxButton.OKCancel) == MessageBoxResult.OK)
#endif
                            {
                                CompanyAPI compApi = new CompanyAPI(api);
                                var        res     = await compApi.EraseAllTransactions(passwordConfirmationDailog.Password);

                                if (res != ErrorCodes.Succes)
                                {
                                    UtilDisplay.ShowErrorCode(res);
                                }
                                else
                                {
                                    UtilDisplay.ShowErrorCode(res);
                                }
                            }
                        }
                    };

                    passwordConfirmationDailog.Show();
                }
            };
            EraseYearWindowDialog.Show();
        }
예제 #9
0
        private void DeleteCompany()
        {
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(editrow.CompanyName, false);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    CompanyAPI compApi = new CompanyAPI(api);
                    var        res     = await compApi.Delete();

                    if (res != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                    else
                    {
                        var companiesTemp = Controls.CWDefaultCompany.loadedCompanies.ToList();
                        companiesTemp.Remove(editrow);
                        Controls.CWDefaultCompany.loadedCompanies = companiesTemp.ToArray();

                        var defCompId = session.User._DefaultCompany;
                        //Check to Ensure that User hasn't deleted his own default company
                        var comp = companiesTemp.Where(c => c.CompanyId == defCompId).SingleOrDefault();

                        if (comp != null)
                        {
                            globalEvents.OnRefresh(TabControls.CreateCompany, comp.CompanyId);
                        }
                        else
                        {
                            globalEvents.OnRefresh(TabControls.CreateCompany, companiesTemp.FirstOrDefault());
                        }

                        dockCtrl?.CloseAllDocuments(true);
                    }
                }
            };
            EraseYearWindowDialog.Show();
        }
예제 #10
0
        private void RemoveBankStatmentOrSettelements(string ActionType, BankStatementClient selectedItem)
        {
            var        text        = string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("BankStatement"), selectedItem._Account, selectedItem._Name);
            var        defaultdate = BasePage.GetSystemDefaultDate().Date;
            CWInterval Wininterval = new CWInterval(defaultdate, defaultdate, showJrPostId: true);

            Wininterval.Closing += delegate
            {
                if (Wininterval.DialogResult == true)
                {
                    EraseYearWindow erWindow = new EraseYearWindow(text, false);
                    erWindow.Closing += async delegate
                    {
                        if (erWindow.DialogResult == true)
                        {
                            BankStatementAPI bkapi  = new BankStatementAPI(api);
                            ErrorCodes       result = ErrorCodes.NoSucces;

                            if (ActionType == "DeleteStatement")
                            {
                                result = await bkapi.DeleteLines(selectedItem, Wininterval.FromDate, Wininterval.ToDate, OnlyVoided : Wininterval.OnlyVoided);
                            }
                            else if (ActionType == "RemoveSettlements")
                            {
                                result = await bkapi.RemoveSettlements(selectedItem, Wininterval.FromDate, Wininterval.ToDate, Wininterval.JournalPostedId, Wininterval.Voucher);
                            }

                            if (result != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(result);
                            }
                        }
                    };
                    erWindow.Show();
                }
            };
            Wininterval.Show();
        }
예제 #11
0
        void DeleteEmailList(CrmCampaignClient campaign)
        {
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(campaign.Name, false);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    CrmAPI crmApi = new CrmAPI(api);
                    var    res    = await crmApi.DeleteMembers(campaign);

                    if (res != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                }
            };
            EraseYearWindowDialog.Show();
        }
예제 #12
0
        private void MoveButton_Click(object sender, RoutedEventArgs e)
        {
            var startDialog = new EraseYearWindow("", true);

            startDialog.Closed += async delegate
            {
                if (startDialog.DialogResult == true)
                {
                    busyIndicator.IsBusy = true;

                    var lst = _dimensionItemDataModel;
                    if (_api == null || lst == null || lst.Count == 0)
                    {
                        DialogResult = false;
                        return;
                    }

                    int?dim1 = null, dim2 = null, dim3 = null, dim4 = null, dim5 = null;
                    int?toDim1 = null, toDim2 = null, toDim3 = null, toDim4 = null, toDim5 = null;
                    int dimCount = lst.Count;

                    for (int i = 0; i < dimCount; i++)
                    {
                        var dx   = lst[i].ActualDimensionValue;
                        var todx = lst[i].SelectedDimensionValue;
                        switch (i)
                        {
                        case 0:
                            dim1   = dx;
                            toDim1 = todx;
                            break;

                        case 1:
                            dim2   = dx;
                            toDim2 = todx;
                            break;

                        case 2:
                            dim3   = dx;
                            toDim3 = todx;
                            break;

                        case 3:
                            dim4   = dx;
                            toDim4 = todx;
                            break;

                        case 4:
                            dim5   = dx;
                            toDim5 = todx;
                            break;
                        }
                    }

                    Result = await(new Uniconta.API.GeneralLedger.PostingAPI(_api)).MoveDimensions(dim1, dim2, dim3, dim4, dim5, toDim1, toDim2, toDim3, toDim4, toDim5);
                    busyIndicator.IsBusy = false;
                    DialogResult         = true;
                }
            };
            startDialog.Show();
        }
예제 #13
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgProjectJournal.SelectedItem as ProjectJournalClient;

            switch (ActionType)
            {
            case "AddRow":
                AddDockItem(TabControls.ProjectJournalPage2, api, string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("Project"), Uniconta.ClientTools.Localization.lookup("Journal")), "Add_16x16.png");
                break;

            case "EditRow":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ProjectJournalPage2, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Journal"), selectedItem.Journal));
                }
                break;

            case "ProjectJournalLine":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ProjectJournalLinePage, selectedItem, string.Format("{0} {1} : {2}", Uniconta.ClientTools.Localization.lookup("Project"), Uniconta.ClientTools.Localization.lookup("Journal"), selectedItem.Journal));
                }
                break;

            case "JournalPosted":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ProjectPostedJournalsPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("PostedJournals"), selectedItem.Journal));
                }
                break;

            case "DeleteAllJournalLines":
                if (selectedItem == null)
                {
                    return;
                }
                var             text = string.Format(Uniconta.ClientTools.Localization.lookup("JournalContainsLines"), selectedItem.Journal);
                EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(text, false);
                EraseYearWindowDialog.Closed += async delegate
                {
                    if (EraseYearWindowDialog.DialogResult == true)
                    {
                        CloseDockItem(TabControls.ProjectJournalLinePage, selectedItem);
                        PostingAPI postApi = new PostingAPI(api);
                        var        res     = await postApi.DeleteJournalLines(selectedItem);

                        if (res != ErrorCodes.Succes)
                        {
                            UtilDisplay.ShowErrorCode(res);
                        }
                    }
                };
                EraseYearWindowDialog.Show();
                break;

            case "ImportData":
                if (selectedItem != null)
                {
                    OpenImportDataPage(selectedItem);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgGldailyJournal.SelectedItem as GLDailyJournalClient;

            switch (ActionType)
            {
            case "AddRow":
                AddDockItem(TabControls.GLDailyJournalPage2, api, Uniconta.ClientTools.Localization.lookup("Posting"), "Add_16x16.png");
                break;

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

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

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

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

            case "DeleteAllJournalLines":
                if (selectedItem == null)
                {
                    return;
                }
                var             text = string.Format(Uniconta.ClientTools.Localization.lookup("JournalContainsLines"), selectedItem._Name);
                EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(text, false);
                EraseYearWindowDialog.Closed += async delegate
                {
                    if (EraseYearWindowDialog.DialogResult == true)
                    {
                        CloseDockItem(TabControls.GL_DailyJournalLine, selectedItem);
                        PostingAPI postApi = new PostingAPI(api);
                        var        res     = await postApi.DeleteJournalLines(selectedItem);

                        UtilDisplay.ShowErrorCode(res);
                        selectedItem.NumberOfLines = 0;
                    }
                };
                EraseYearWindowDialog.Show();
                break;

            case "ImportBankStatement":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.ImportGLDailyJournal, selectedItem, string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"),
                                                                                                        Uniconta.ClientTools.Localization.lookup("BankStatement")), " : ", selectedItem._Journal), null, true);
                break;

            case "TransType":
                AddDockItem(TabControls.GLTransTypePage, null, Uniconta.ClientTools.Localization.lookup("TransTypes"));
                break;

            case "AppendTransType":
                CWAppendEnumeratedLabel dialog = new CWAppendEnumeratedLabel(api);
                dialog.Show();
                break;

            case "ImportData":
                if (selectedItem == null)
                {
                    return;
                }
                OpenImportDataPage(selectedItem);
                break;

            case "GLOffSetAccountTemplate":
                AddDockItem(TabControls.GLOffsetAccountTemplate, null, Uniconta.ClientTools.Localization.lookup("OffsetAccountTemplates"));
                break;

            case "AccountActivity":
                if (selectedItem == null)
                {
                    return;
                }

                AddDockItem(TabControls.GLTransLogPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("GLTransLog"), selectedItem._Journal));
                break;

            case "BilagscanReadVouchers":
                ReadFromBilagscan(selectedItem);
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }