private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (masterRecord == null)
            {
                return;
            }

            CWAddGLOffsetAccountTemplate childWindow = new CWAddGLOffsetAccountTemplate(masterRecord.Name);

            childWindow.Closing += async delegate
            {
                if (childWindow.DialogResult == true)
                {
                    masterRecord._Name   = childWindow.offSetAccountName;
                    busyIndicator.IsBusy = true;
                    var err = await api.Update(masterRecord);

                    busyIndicator.IsBusy = false;
                    if (err != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(err);
                    }
                }
            };
            childWindow.Show();
        }
        public async override Task InitQuery()
        {
            busyIndicator.IsBusy = true;
            var tranApi = new Uniconta.API.GeneralLedger.ReportAPI(api);
            var tsk     = tranApi.GetBank(new GLTransClientTotal(), master._Account, fromDate, toDate, true);

            StartLoadCache(tsk);

            var listtran = (GLTransClientTotal[])await tsk;

            if (listtran != null)
            {
                Array.Sort(listtran, new GLTransClientSort());

                var  ShowCurrency = this.ShowCurrency;
                long Total        = 0;
                for (int i = 0; (i < listtran.Length); i++)
                {
                    var p = listtran[i];
                    Total   += ShowCurrency ? p._AmountCurCent : p._AmountCent;
                    p._Total = Total;
                }
            }
            else
            {
                busyIndicator.IsBusy = false;
                UtilDisplay.ShowErrorCode(tranApi.LastError);
            }
            dgAccountsTransGrid.SetSource(listtran);
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            CWAddGLOffsetAccountTemplate childWindow = new CWAddGLOffsetAccountTemplate(null);

            childWindow.Closing += async delegate
            {
                if (childWindow.DialogResult == true)
                {
                    var offsetAccTemp = new GLOffsetAccountTemplateClient();
                    offsetAccTemp._Name  = childWindow.offSetAccountName;
                    busyIndicator.IsBusy = true;
                    var res = await api.Insert(offsetAccTemp);

                    busyIndicator.IsBusy = false;
                    if (res != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                    else
                    {
                        GlOffSetAccTemList.Add(offsetAccTemp);
                    }
                }
            };
            childWindow.Show();
        }
示例#4
0
        void DeleteClosingSheetLine()
        {
            CWPostClosingSheet postingDialog = new CWPostClosingSheet(masterRecord._ToDate, true);

            postingDialog.Closed += async delegate
            {
                if (postingDialog.DialogResult == true)
                {
                    if (UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("ConfirmDeleteOBJ"), Uniconta.ClientTools.Localization.lookup("ClosingSheetLines")), Uniconta.ClientTools.Localization.lookup("Confirmation"), MessageBoxButton.OKCancel) != MessageBoxResult.OK)
                    {
                        return;
                    }

                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("BusyMessage");
                    busyIndicator.IsBusy      = true;
                    var deleteResult = await postingApi.DeleteJournalLines(masterRecord, postingDialog.Code);

                    if (deleteResult != ErrorCodes.Succes)
                    {
                        busyIndicator.IsBusy = false;
                        UtilDisplay.ShowErrorCode(deleteResult);
                    }
                    else
                    {
                        BindGrid();
                    }
                }
            };
            postingDialog.Show();
        }
        void ModifyApprover(VouchersClient voucher)
        {
            var cwEmployee = new CWEmployee(api);

#if !SILVERLIGHT
            cwEmployee.DialogTableId = 2000000076;
#endif
            cwEmployee.Closed += async delegate
            {
                if (cwEmployee.DialogResult == true)
                {
                    var result = await docApi.ChangeApprover(voucher, cwEmployee.Employee, cwEmployee.Comment);

                    if (result == ErrorCodes.Succes)
                    {
                        RemoveRow(voucher);
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                }
            };
            cwEmployee.Show();
        }
示例#6
0
        async void SendMail(SubscriptionInvoice Invoice, DateTime selectedDate, bool SendALL = false)
        {
            var subscriptionMsg = SendALL ? Uniconta.ClientTools.Localization.lookup("SendAllInvoiceMsg") : string.Format(Uniconta.ClientTools.Localization.lookup("SendInvoiceSubscriptionMsg"), Invoice._Sid);

            if (UnicontaMessageBox.Show(subscriptionMsg, Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.OKCancel
#if !SILVERLIGHT
                                        , MessageBoxImage.Question
#endif
                                        ) == MessageBoxResult.OK)
            {
                Task <ErrorCodes> task;
                var subsApi = new SubscriptionAPI(api);
                if (invoicePartner != null && SendALL && api.session.User._Role >= (byte)Uniconta.Common.User.UserRoles.Reseller)
                {
                    task = subsApi.EmailSubscriptionInvoice(invoicePartner, masterSub as Subscription, selectedDate);
                }
                else
                {
                    task = subsApi.EmailSubscriptionInvoice(Invoice, SendALL && api.session.User._Role >= (byte)Uniconta.Common.User.UserRoles.Reseller);
                }

                busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait");
                busyIndicator.IsBusy      = true;
                var result = await task;
                busyIndicator.IsBusy = false;
                UtilDisplay.ShowErrorCode(result);
            }
        }
        private void CreateAnchorBudget()
        {
            var cwCreateAnchorBjt = new CwCreateAnchorBudget(api);

#if !SILVERLIGHT
            cwCreateAnchorBjt.DialogTableId = 2000000102;
#endif
            cwCreateAnchorBjt.Closed += async delegate
            {
                if (cwCreateAnchorBjt.DialogResult == true)
                {
                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateAnchorBudget(CwCreateAnchorBudget.Group);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("AnchorBudget"), " ", Uniconta.ClientTools.Localization.lookup("Updated").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateAnchorBjt.Show();
        }
示例#8
0
        void SaveAttachment(GLTransClient selectedItem, VouchersClient doc)
        {
            CWForAllTrans cwconfirm = new CWForAllTrans();

            cwconfirm.Closing += async delegate
            {
                if (cwconfirm.DialogResult == true)
                {
                    if (selectedItem._DocumentRef != 0)
                    {
                        VoucherCache.RemoveGlobalVoucherCache(selectedItem.CompanyId, selectedItem._DocumentRef);
                    }
                    busyIndicator.IsBusy = true;
                    var errorCodes = await postingApiInv.AddPhysicalVoucher(selectedItem, doc, cwconfirm.ForAllTransactions, cwconfirm.AppendDoc);

                    busyIndicator.IsBusy = false;
                    if (errorCodes == ErrorCodes.Succes)
                    {
                        BindGrid();
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(errorCodes);
                    }
                }
            };
            cwconfirm.Show();
        }
示例#9
0
        async void SetNewDim(GLTransClient selectedItem, CWChangeDimension ChangeDimensionDialog)
        {
            var postingApiInv = this.postingApiInv;
            var nDim          = postingApiInv.CompanyEntity.NumberOfDimensions;
            var accs          = postingApiInv.CompanyEntity.GetCache(typeof(Uniconta.DataModel.GLAccount));
            var acc           = (Uniconta.DataModel.GLAccount)accs.Get(selectedItem._Account);

            if ((nDim >= 1 && ChangeDimensionDialog.Dimension1.HasValue && !acc.GetDimUsed(1)) ||
                (nDim >= 2 && ChangeDimensionDialog.Dimension2.HasValue && !acc.GetDimUsed(2)) ||
                (nDim >= 3 && ChangeDimensionDialog.Dimension3.HasValue && !acc.GetDimUsed(3)) ||
                (nDim >= 4 && ChangeDimensionDialog.Dimension4.HasValue && !acc.GetDimUsed(4)) ||
                (nDim >= 5 && ChangeDimensionDialog.Dimension5.HasValue && !acc.GetDimUsed(5)))
            {
                UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoDimActivedForAccount"), Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
            }

            busyIndicator.IsBusy = true;
            var errorCodes = await postingApiInv.SetNewDimensions(selectedItem, ChangeDimensionDialog.AllLine, ChangeDimensionDialog.Dimension1,
                                                                  ChangeDimensionDialog.Dimension2, ChangeDimensionDialog.Dimension3, ChangeDimensionDialog.Dimension4, ChangeDimensionDialog.Dimension5, ChangeDimensionDialog.GLAccount);

            busyIndicator.IsBusy = false;
            UtilDisplay.ShowErrorCode(errorCodes);
            if (errorCodes == ErrorCodes.Succes)
            {
                BindGrid();
            }
        }
        public async void CopyBalance()
        {
            ErrorCodes res = ErrorCodes.FieldCannotBeBlank;

            busyIndicator.IsBusy = true;
            Balance newItem = null;

            if (objBalance != null && objBalance.RowId != 0)
            {
                newItem = new Balance();
                StreamingManager.Copy(objBalance, newItem);

                var name = newItem.Name + Uniconta.ClientTools.Localization.lookup("Copy");
                newItem._Name = name;
                if (objBalance._Name != null)
                {
                    res = await api.Insert(newItem);
                }
                else
                {
                    res = ErrorCodes.FieldCannotBeBlank;
                }
            }
            busyIndicator.IsBusy = false;
            if (res == ErrorCodes.Succes)
            {
                itemsBalance.Add(newItem);
                cbBalance.SelectedItem = newItem;
            }
            else
            {
                UtilDisplay.ShowErrorCode(res);
            }
        }
        private void CreateTaskFromTask()
        {
            var cwCreateTask = new CWCreateTaskFromTask(api, proj?._Number);

            cwCreateTask.DialogTableId = 2000000104;
            cwCreateTask.Closed       += async delegate
            {
                if (cwCreateTask.DialogResult == true)
                {
                    var taskLst = (IEnumerable <Uniconta.DataModel.ProjectTask>)dgProjectTaskGrid.GetVisibleRows();

                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateTaskFromTask(CWCreateTaskFromTask.FromPrWorkSpace, CWCreateTaskFromTask.ToPrWorkSpace, cwCreateTask.ToProject, cwCreateTask.BudgetTaskDatePrincip, cwCreateTask.NewDate, CWCreateTaskFromTask.AddYear, taskLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Tasks"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateTask.Show();
        }
示例#12
0
        async private void CompnayActivation(string action)
        {
            var        compApi = new CompanyAPI(api);
            ErrorCodes result;
            string     message;

            if (action == "Activate")
            {
                message = "ActivateCompany";
                result  = await compApi.Activate();
            }
            else if (action == "Deactivate")
            {
                message = "CompanyIsDeactivated";
                result  = await compApi.Deactivate();
            }
            else
            {
                message = null;
                result  = ErrorCodes.NoSucces;
            }

            if (result != ErrorCodes.Succes)
            {
                UtilDisplay.ShowErrorCode(result);
            }
            else
            {
                CloseDockItem();
                UnicontaMessageBox.Show(string.Format("{0}. {1}", Uniconta.ClientTools.Localization.lookup(message), api.CompanyEntity._Name),
                                        Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
            }
        }
示例#13
0
        async void CreateBackup(string name, bool copyTrans, bool copyPhysicalVouchers, bool copyAttachments)
        {
            var compApi = new CompanyAPI(api);
            var result  = await compApi.CreateCopy(name, copyTrans, copyPhysicalVouchers, copyAttachments);

            UtilDisplay.ShowErrorCode(result);
        }
示例#14
0
        void MoveJournalLines(GLDailyJournalClient journal)
        {
            CwMoveJournalLines cwWin = new CwMoveJournalLines(api);

            cwWin.Closed += async delegate
            {
                if (cwWin.DialogResult == true && cwWin.GLDailyJournal != null)
                {
                    busyIndicator.IsBusy = true;
                    var result = await(new Uniconta.API.GeneralLedger.PostingAPI(api)).MoveJournalLines(journal, cwWin.GLDailyJournal);
                    busyIndicator.IsBusy = false;
                    UtilDisplay.ShowErrorCode(result);
                    if (result == 0)
                    {
                        foreach (var lin in (IEnumerable <GLDailyJournalClient>)dgGldailyJournal.ItemsSource)
                        {
                            if (lin.RowId == cwWin.GLDailyJournal.RowId)
                            {
                                lin.NumberOfLines     = lin._NumberOfLines + journal._NumberOfLines;
                                journal.NumberOfLines = 0;
                                break;
                            }
                        }
                    }
                }
            };
            cwWin.Show();
        }
示例#15
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();
        }
        private void CreateBudget()
        {
            var cwCreateBjt = new CwCreateUpdateBudget(api);

#if !SILVERLIGHT
            cwCreateBjt.DialogTableId = 2000000100;
#endif
            cwCreateBjt.Closed += async delegate
            {
                if (cwCreateBjt.DialogResult == true)
                {
                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateBudget(CwCreateUpdateBudget.FromDate, CwCreateUpdateBudget.ToDate, CwCreateUpdateBudget.Employee, CwCreateUpdateBudget.Payroll,
                                                                       CwCreateUpdateBudget.PrCategory, CwCreateUpdateBudget.Group, CwCreateUpdateBudget.BudgetMethod, CwCreateUpdateBudget.BudgetName,
                                                                       CwCreateUpdateBudget.PrWorkSpace, cwCreateBjt.DeleteBudget, cwCreateBjt.InclProjectTask, null);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Budget"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateBjt.Show();
        }
示例#18
0
        private void DeleteJournal(ProjectJournalPostedClient selectedItem)
        {
            if (selectedItem == null)
            {
                return;
            }
            var deleteDialog = new DeletePostedJournal();

            deleteDialog.Closed += async delegate
            {
                if (deleteDialog.DialogResult == true)
                {
                    var        pApi = new UnicontaAPI.Project.API.PostingAPI(api);
                    ErrorCodes res  = await pApi.DeletePostedJournal(selectedItem, deleteDialog.Comment);

                    if (res == ErrorCodes.Succes)
                    {
                        UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("Journaldeleted"), selectedItem.RowId), Uniconta.ClientTools.Localization.lookup("Message"));
                        dgProjectPostedJournal.UpdateItemSource(2, selectedItem);
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                }
            };
            deleteDialog.Show();
        }
示例#19
0
        void SendEmail()
        {
            var rows = (ICollection <CrmCampaignMemberClient>)dgEmailList.GetVisibleRows();

            if (rows.Count == 0)
            {
                return;
            }

            var cwSendEmail = new CwSendEmail(api);

            cwSendEmail.Closed += async delegate
            {
                if (cwSendEmail.DialogResult == true && cwSendEmail.CompanySMTP != null)
                {
                    var        crmAPI = new CrmAPI(api);
                    ErrorCodes res;
                    if (cwSendEmail.SendTestEmail)
                    {
                        res = await crmAPI.SendMailTest(cwSendEmail.CompanySMTP, cwSendEmail.Email, cwSendEmail.Name);
                    }
                    else
                    {
                        res = await crmAPI.SendMail(cwSendEmail.CompanySMTP, rows, cwSendEmail.FollowUp);
                    }
                    UtilDisplay.ShowErrorCode(res);
                }
            };
            cwSendEmail.Show();
        }
示例#20
0
        private async void MarkOrderLineAgainstIT(InvTransClient selectedItem)
        {
            busyIndicator.IsBusy = true;
            Task <ErrorCodes> t;

            if (debtorOrderLine != null)
            {
                t = (new Uniconta.API.DebtorCreditor.OrderAPI(api)).MarkedOrderLineAgainstInvTrans(debtorOrderLine, selectedItem);
            }
            else
            {
                t = (new Uniconta.API.Inventory.TransactionsAPI(api)).MarkInvTransAgainstInvTrans(invtrans, selectedItem);
            }
            var err = await t;

            busyIndicator.IsBusy = false;
            if (err != ErrorCodes.Succes)
            {
                UtilDisplay.ShowErrorCode(err);
            }
            else
            {
                CloseDockItem();
            }
        }
示例#21
0
        private void UpdatePrices()
        {
            var cwUpdateBjt = new CwCreateUpdateBudget(api, 1);

#if !SILVERLIGHT
            cwUpdateBjt.DialogTableId = 2000000178;
#endif
            cwUpdateBjt.Closed += async delegate
            {
                if (cwUpdateBjt.DialogResult == true)
                {
                    var projLst = dgProjectGrid.GetVisibleRows() as IList <Uniconta.DataModel.Project>;

                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.UpdatePrices(CwCreateUpdateBudget.FromDate, CwCreateUpdateBudget.ToDate, CwCreateUpdateBudget.Employee, CwCreateUpdateBudget.Payroll,
                                                                       CwCreateUpdateBudget.PrCategory, CwCreateUpdateBudget.Group, CwCreateUpdateBudget.PrWorkSpace, cwUpdateBjt.InclProjectTask, projLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Prices"), " ", Uniconta.ClientTools.Localization.lookup("Updated").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwUpdateBjt.Show();
        }
示例#22
0
        private void CreateTaskFromTask()
        {
            var cwCreateTask = new CWCreateTaskFromTask(api);

#if !SILVERLIGHT
            cwCreateTask.DialogTableId = 2000000105;
#endif
            cwCreateTask.Closed += async delegate
            {
                if (cwCreateTask.DialogResult == true)
                {
                    var       projLst   = dgProjectGrid.GetVisibleRows() as IList <Uniconta.DataModel.Project>;
                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateTaskFromTask(CWCreateTaskFromTask.FromPrWorkSpace, CWCreateTaskFromTask.ToPrWorkSpace, CWCreateTaskFromTask.ProjectTemplate, CWCreateTaskFromTask.AddYear, projLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Tasks"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateTask.Show();
        }
示例#23
0
        static public void ExecuteDebtorCollection(CrudAPI Api, BusyIndicator busyIndicator, IEnumerable <DCTransOpen> dcTransOpenList, IEnumerable <double> feelist, IEnumerable <double> changelist, bool isCurrencyReport, DebtorEmailType emailType,
                                                   string emails = null, bool onlyThisEmail = false, bool isAddInterest = false)
        {
            var rapi = new ReportAPI(Api);

            var cwDateSelector = new CWDateSelector();

#if !SILVERLIGHT
            cwDateSelector.DialogTableId = 2000000025;
#endif
            cwDateSelector.Closed += async delegate
            {
                if (cwDateSelector.DialogResult == true)
                {
                    busyIndicator.IsBusy      = true;
                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait");
                    var result = await rapi.DebtorCollection(dcTransOpenList, feelist, changelist, cwDateSelector.SelectedDate, emailType, isCurrencyReport, emails, onlyThisEmail);

                    busyIndicator.IsBusy = false;

                    if (result == ErrorCodes.Succes)
                    {
                        UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("SendEmailMsgOBJ"), isAddInterest ? Uniconta.ClientTools.Localization.lookup("InterestNote") : Uniconta.ClientTools.Localization.lookup("CollectionLetter")),
                                                Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.OK);
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                }
            };
            cwDateSelector.Show();
        }
示例#24
0
        private void CreateBudgetTask()
        {
            var cwCreateBjtTask = new CwCreateBudgetTask(api, 0);

#if !SILVERLIGHT
            cwCreateBjtTask.DialogTableId = 2000000179;
#endif
            cwCreateBjtTask.Closed += async delegate
            {
                if (cwCreateBjtTask.DialogResult == true)
                {
                    var projLst = dgProjectGrid.GetVisibleRows() as IList <Uniconta.DataModel.Project>;

                    BudgetAPI budgetApi = new BudgetAPI(api);
                    var       result    = await budgetApi.CreateBudgetTask(CwCreateBudgetTask.Employee, CwCreateBudgetTask.Payroll, CwCreateBudgetTask.Group,
                                                                           CwCreateBudgetTask.PrWorkSpace, cwCreateBjtTask.DeleteBudget, CwCreateBudgetTask.BudgetTaskPrincip,
                                                                           CwCreateBudgetTask.TaskHours, projLst);

                    if (result != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
                        UnicontaMessageBox.Show(string.Concat(Uniconta.ClientTools.Localization.lookup("Budget"), " ", Uniconta.ClientTools.Localization.lookup("Created").ToLower()),
                                                Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    }
                }
            };
            cwCreateBjtTask.Show();
        }
        private void ReOpenAllTrans()
        {
            CWConfirmationBox dialog = new CWConfirmationBox(Uniconta.ClientTools.Localization.lookup("AreYouSureToContinue"), Uniconta.ClientTools.Localization.lookup("Confirmation"), false);

            dialog.Closing += async delegate
            {
                if (dialog.ConfirmationResult == CWConfirmationBox.ConfirmationResultEnum.Yes)
                {
                    TransactionAPI transApi      = new TransactionAPI(this.api);
                    var            masterAccount = dgCreditorTranOpenGrid.masterRecord as DCAccount;
                    if (masterAccount != null)
                    {
                        busyIndicator.IsBusy = true;
                        var errorCodes = await transApi.ReOpenAll(masterAccount, true);

                        busyIndicator.IsBusy = false;
                        UtilDisplay.ShowErrorCode(errorCodes);
                        if (errorCodes == ErrorCodes.Succes)
                        {
                            InitQuery();
                        }
                    }
                }
            };
            dialog.Show();
        }
        void ConvertProspectToDebtor(CrmProspectClient crmProspect)
        {
            CWConvertProspectToDebtor cwwin = new CWConvertProspectToDebtor(api, crmProspect);

            cwwin.Closing += async delegate
            {
                if (cwwin.DialogResult == true)
                {
                    if (cwwin?.DebtorClient == null)
                    {
                        return;
                    }
                    CrmAPI crmApi = new CrmAPI(api);
                    var    res    = await crmApi.ConvertToDebtor(crmProspect, cwwin.DebtorClient);

                    UtilDisplay.ShowErrorCode(res);

                    if (res == ErrorCodes.Succes)
                    {
                        InitQuery();
                    }
                }
            };
            cwwin.Show();
        }
示例#27
0
        private async void LoadInvTran()
        {
            setExpandAndCollapse(true);

            InventoryStatement.setDateTime(txtDateFrm, txtDateTo);
            DateTime FromDate = InventoryStatement.DefaultFromDate, ToDate = InventoryStatement.DefaultToDate;

            var fromItem = Convert.ToString(cmbFromAccount.EditValue);
            var toItem   = Convert.ToString(cmbToAccount.EditValue);

            var transApi = new ReportAPI(api);

            busyIndicator.IsBusy = true;
            var listtran = (InvTransClientTotal[])await transApi.GetInvTrans(new InvTransClientTotal(), FromDate, ToDate, fromItem, toItem);

            if (listtran != null)
            {
                FillStatement(listtran);
            }
            else if (transApi.LastError != 0)
            {
                busyIndicator.IsBusy = false;
                UtilDisplay.ShowErrorCode(transApi.LastError);
            }
            dgInvTran.Visibility = Visibility.Visible;
            busyIndicator.IsBusy = false;
        }
示例#28
0
        async void LoadNotInvoiced(DateTime fromdate, DateTime todate)
        {
            busyIndicator.IsBusy = true;

            var lst = (ProjectTransClientLocal[])await(new InvoiceAPI(api)).GetTransNotOnOrder(master, fromdate, todate, new ProjectTransClientLocal());

            if (lst == null)
            {
                busyIndicator.IsBusy = false;
                UtilDisplay.ShowErrorCode(ErrorCodes.NoLinesFound);
                return;
            }

            var orgList = dgGenerateOrder.ItemsSource as ICollection <ProjectTransClientLocal>;
            var newList = new List <ProjectTransClientLocal>(orgList.Count + lst.Length);

            foreach (var rec in orgList)
            {
                if (rec._SendToOrder != 0)
                {
                    newList.Add(rec);
                }
            }
            for (int i = 0; (i < lst.Length); i++)
            {
                var rec = lst[i];
                rec._remove = true;
                newList.Add(rec);
            }
            busyIndicator.IsBusy        = false;
            dgGenerateOrder.ItemsSource = newList;
            api.ForcePrimarySQL         = true;
        }
        private void Init()
        {
            InitializeComponent();
            layoutStDate.Label  = Uniconta.ClientTools.Localization.lookup("FromDate");
            layoutEndDate.Label = Uniconta.ClientTools.Localization.lookup("ToDate");
            layoutControl       = layoutItems;
            editrow             = CreateNew() as CompanyClient;
            var defaultCompany = UtilDisplay.GetDefaultCompany();

            if (defaultCompany != null)
            {
                editrow.Country         = defaultCompany._CountryId;
                layoutItems.DataContext = editrow;
                int year = BasePage.GetSystemDefaultDate().Year;
                dateFrm.DateTime         = new DateTime(year, 1, 1);
                dateTo.DateTime          = new DateTime(year, 12, 31);
                frmRibbon.OnItemClicked += frmRibbon_OnItemClicked;
                SetOwnCompany();
                CompanySetupPage.SetCountry(cmbCountry, cmbStandardCompany, editrow, true);
                browseTopLogo.FileSelected += BrowseTopLogo_FileSelected;
#if !SILVERLIGHT
                lblImportInvoice.Label = string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Invoice"));
                BindSetupType();
                grpImportSetup.Header               = string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Company"));
                cmbImportFrom.ItemsSource           = Enum.GetNames(typeof(ImportFrom));
                cmbImportFrom.SelectedIndexChanged += cmbImportFrom_SelectionChanged;
                cmbImportDimension.ItemsSource      = new List <string>()
                {
                    "Ingen", "Kun Afdeling", "Afdeling, Bærer", "Afdeling, Bærer, Formål"
                };
                cmbImportDimension.SelectedIndex = 3;

                lblDim1.Label           = string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Dimension")), " 1");
                lblDim2.Label           = string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Dimension")), " 2");
                lblDim3.Label           = string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Dimension")), " 3");
                lblDim4.Label           = string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Dimension")), " 4");
                lblDim5.Label           = string.Concat(string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Dimension")), " 5");
                txtNavDim1.Text         = Uniconta.ClientTools.Localization.lookup("Optional");
                txtNavDim2.Text         = Uniconta.ClientTools.Localization.lookup("Optional");
                txtNavDim3.Text         = Uniconta.ClientTools.Localization.lookup("Optional");
                txtNavDim4.Text         = Uniconta.ClientTools.Localization.lookup("Optional");
                txtNavDim5.Text         = Uniconta.ClientTools.Localization.lookup("Optional");
                txtNavErrorAccount.Text = Uniconta.ClientTools.Localization.lookup("Required");
                txtAccountForPrimo.Text = Uniconta.ClientTools.Localization.lookup("Required");

                var navEmailType = new List <string>()
                {
                    Uniconta.ClientTools.Localization.lookup("InvoiceEmail"),
                    Uniconta.ClientTools.Localization.lookup("ContactEmail")
                };
                cmbInvoiceOrContactMail.ItemsSource = navEmailType;
#endif
            }
            else
            {
                UtilDisplay.ShowErrorCode(ErrorCodes.NoRights);
            }
        }
        async void PostJournal(Uniconta.DataModel.InvJournal invJournal, DateTime date)
        {
            if (invJournal == null)
            {
                return;
            }
            var mainList           = (IEnumerable <InvItemStorageCount>)dgInvStockStatus.GetVisibleRows();
            var invJournalLineList = new List <InvJournalLine>(100);

            foreach (var item in mainList)
            {
                var dif = item.Difference;
                if (dif != 0d)
                {
                    var journalLine = new InvJournalLine();
                    journalLine._Date         = date;
                    journalLine._MovementType = Uniconta.DataModel.InvMovementType.Counting;
                    journalLine._Item         = item._Item;
                    journalLine._Variant1     = item._Variant1;
                    journalLine._Variant2     = item._Variant2;
                    journalLine._Variant3     = item._Variant3;
                    journalLine._Variant4     = item._Variant4;
                    journalLine._Variant5     = item._Variant5;
                    journalLine._Warehouse    = item._Warehouse;
                    journalLine._Location     = item._Location;
                    journalLine._SerieBatch   = item._SerieBatch;
                    var itm = item.itemRec;
                    if (itm != null)
                    {
                        journalLine._CostPrice = itm._CostPrice;
                    }
                    journalLine._Qty = dif;
                    journalLine.SetMaster(invJournal);
                    journalLine._Dim1 = invJournal._Dim1;
                    journalLine._Dim2 = invJournal._Dim2;
                    journalLine._Dim3 = invJournal._Dim3;
                    journalLine._Dim4 = invJournal._Dim4;
                    journalLine._Dim5 = invJournal._Dim5;
                    invJournalLineList.Add(journalLine);
                }
            }

            if (invJournalLineList.Count == 0)
            {
                return;
            }

            api.AllowBackgroundCrud = true;
            var result = await api.Insert(invJournalLineList);

            UtilDisplay.ShowErrorCode(result);
            if (result == ErrorCodes.Succes)
            {
                isTransToJrnl = true;
            }
        }