private void OKButton_Click(object sender, RoutedEventArgs e) { var str = txtInvNumber.Text; if (!string.IsNullOrEmpty(str) && str != "0") { if (str.Length < 18) { InvoiceNumber = NumberConvert.ToInt(str); } else { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NumberTooBig"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OK); return; } } SendByEmail = chkSendEmail.IsChecked.Value; IsSimulation = chkSimulation.IsChecked.Value; GenrateDate = dpDate.DateTime; ShowInvoice = chkShowInvoice.IsChecked.Value; UpdateInventory = chkUpdateInv.IsChecked.Value; #if !SILVERLIGHT InvoiceQuickPrint = chkPrintInvoice.IsChecked.Value; GenerateOIOUBLClicked = chkOIOUBL.IsChecked.Value; #endif Emails = (string.IsNullOrEmpty(txtEmail.Text) || string.IsNullOrWhiteSpace(txtEmail.Text)) ? null : txtEmail.Text; sendOnlyToThisEmail = chkSendOnlyEmail.IsChecked.Value; PostOnlyDelivered = chkPostOnlyDel.IsChecked.Value; this.DialogResult = true; }
private void OKButton_Click(object sender, RoutedEventArgs e) { BalanceName = txtBalance.Text; PLText = txtPL.Text; if (!string.IsNullOrEmpty(txtVoucher.Text)) { Voucher = (int)NumberConvert.ToInt(txtVoucher.Text); } else { Voucher = 0; } this.DialogResult = true; }
private GLDailyJournalLineClient GetJournalLine(List <string> line, int year, string account, string contraAccount, string VAT) { var date = DateTime.ParseExact(line[9], "ddMM", null); date = new DateTime(year, date.Month, date.Day); int accInt = (int)NumberConvert.ToInt(account); int offaccInt = (int)NumberConvert.ToInt(contraAccount); var journalLine = new GLDailyJournalLineClient { _Date = date, _Account = account, _OffsetAccount = contraAccount, _Vat = VAT, // 0-9999=Ledger, 10000-69999=Customer, 70000-99999=Vendor _AccountType = (accInt < DebtorLower ? (byte)GLJournalAccountType.Finans : (accInt < CreditorLower ? (byte)GLJournalAccountType.Debtor : (byte)GLJournalAccountType.Creditor)), _OffsetAccountType = (offaccInt < DebtorLower ? (byte)GLJournalAccountType.Finans : (offaccInt < CreditorLower ? (byte)GLJournalAccountType.Debtor : (byte)GLJournalAccountType.Creditor)), _Text = line[13], _Dim1 = line[36], _Dim2 = line[37], _Invoice = line[10] }; var amount = NumberConvert.ToDoubleNoThousandSeperator(line[0]); var amountLin = line[1][0]; if (amountLin == 'S') { journalLine._Debit = amount; } else if (amountLin == 'H') { journalLine._Credit = amount; } journalLine._OffsetAccount = contraAccount; if (journalLine._AccountType == (byte)GLJournalAccountType.Finans && string.IsNullOrEmpty(journalLine._Vat)) { var gla = GLAccCache.Get(journalLine._Account) as GLAccount; if (gla != null && gla._DATEVAuto) { journalLine._Vat = gla._Vat; } } return(journalLine); }
public override async void Utility_Refresh(string screenName, object argument) { var param = argument as object[]; if (param != null) { if (screenName == TabControls.AddMultipleInventoryItem) { var orderNumber = (int)NumberConvert.ToInt(Convert.ToString(param[1])); if (orderNumber == Order._OrderNumber) { if (dgProjInvProposedLineGrid.isDefaultFirstRow) { dgProjInvProposedLineGrid.DeleteRow(); dgProjInvProposedLineGrid.isDefaultFirstRow = false; } var invItems = param[0] as List <UnicontaBaseEntity>; dgProjInvProposedLineGrid.PasteRows(invItems); } } else if (screenName == TabControls.ItemVariantAddPage) { var orderNumber = (int)NumberConvert.ToInt(Convert.ToString(param[1])); if (orderNumber == Order._OrderNumber) { var invItems = param[0] as List <UnicontaBaseEntity>; dgProjInvProposedLineGrid.PasteRows(invItems); } } else if (screenName == TabControls.SerialToOrderLinePage) { var orderLine = param[0] as ProjectInvoiceProposalLineClient; if (IsDataChaged) { var t = saveGrid(); if (t != null && orderLine.RowId == 0) { await t; } } } } if (screenName == TabControls.RegenerateOrderFromProjectPage) { InitQuery(); } }
Balance setbalanceFields(Balance updaterow) { #if !SILVERLIGHT if (frontpageText != null) { updaterow._FrontPage = frontpageText; } updaterow._ReportFrontPage = frontPageTemplate; #endif updaterow._FromAccount = cbFromAccount.Text; updaterow._ToAccount = cbToAccount.Text; updaterow._Skip0Accounts = (bool)chk0Account.IsChecked; updaterow._ShowType = cmbAccountType.SelectedIndex; if (cmbSumAccount.SelectedIndex == 0) //Show { updaterow._SkipSumAccounts = updaterow._OnlySumAccounts = false; } else if (cmbSumAccount.SelectedIndex == 1) // Don't Show { updaterow._SkipSumAccounts = true; updaterow._OnlySumAccounts = false; } else if (cmbSumAccount.SelectedIndex == 2) // Only Show { updaterow._SkipSumAccounts = false; updaterow._OnlySumAccounts = true; } updaterow._UseExternal = (bool)chkUseExternal.IsChecked; objBalance._Template = cbTemplate.Text; updaterow._Name = txtbalanceName.Text; updaterow._Landscape = (cbPrintOrientation.SelectedIndex <= 0); updaterow.ColumnSizeAccount = (byte)NumberConvert.ToInt(txtColumnSizeAccount.Text); updaterow.ColumnSizeName = (byte)NumberConvert.ToInt(txtColoumnSizeName.Text); updaterow.ColumnSizeDim = (byte)NumberConvert.ToInt(txtColoumnSizeDim.Text); updaterow.ColumnSizeAmount = (byte)NumberConvert.ToInt(txtColoumnSizeAmount.Text); #if !SILVERLIGHT updaterow._PrintFrontPage = (bool)chkPrintFrtPage.IsChecked; #endif updaterow.LineSpace = (byte)NumberConvert.ToInt(txtLineSpace.Text); updaterow.FontSize = (byte)NumberConvert.ToInt(txtFontSize.Text); updaterow.LeftMargin = (byte)NumberConvert.ToInt(txtLeftMargin.Text); return(updaterow); }
private void OKButton_Click(object sender, RoutedEventArgs e) { var str = txtInvNumber.Text; if (!string.IsNullOrEmpty(str) && str != "0") { var n = NumberConvert.ToInt(str); if (n != 0 && n <= int.MaxValue && n >= int.MinValue) { InvoiceNumber = (int)n; } else { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NumberTooBig"), Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK); return; } } SendByEmail = chkSendEmail.IsChecked.Value; IsSimulation = chkSimulation.IsChecked.Value; GenrateDate = dpDate.DateTime; InvoiceCategory = cmbCategory.Text; this.DialogResult = true; }
private void btnSerach_Click(object sender, System.Windows.RoutedEventArgs e) { if (txtDateFrm.Text == string.Empty) { fromDate = DateTime.MinValue; } else { fromDate = txtDateFrm.DateTime.Date; } if (txtDateTo.Text == string.Empty) { toDate = DateTime.MinValue; } else { toDate = txtDateTo.DateTime.Date; } noDaysSinceLastDunning = (int)NumberConvert.ToInt(neDunningDays.Text); Filter(); }
private bool ReadDataFromDB(byte[] selectedDashBoardBinary) { busyIndicator.IsBusy = true; bool retVal = true; try { lstOfFilters.Clear(); lstOfNewFilters.Clear(); var customReader = StreamingManagerReuse.Create(selectedDashBoardBinary); var version = customReader.readByte(); if (version < 1 || version > 3) { return(false); } var bufferedReport = StreamingManager.readMemory(customReader); var st = Compression.UncompressStream(bufferedReport); if (version < 3 && customReader.readBoolean()) { int filterCount = (int)customReader.readNum(); for (int i = 0; i < filterCount; i++) { var key = customReader.readString(); var arrpropval = (PropValuePair[])customReader.ToArray(typeof(PropValuePair)); lstOfFilters.Add(key, arrpropval); } } else if (version == 3) { if (customReader.readBoolean()) { int filterCount = (int)customReader.readNum(); for (int i = 0; i < filterCount; i++) { var key = customReader.readString(); var arrFilter = (FilterProperties[])customReader.ToArray(typeof(FilterProperties)); lstOfNewFilters.Add(key, arrFilter.ToList()); } } if (customReader.readBoolean()) { int filterCount = (int)customReader.readNum(); for (int i = 0; i < filterCount; i++) { var key = customReader.readString(); List <PropValuePair> propVal = new List <PropValuePair>(); var arrpropval = (PropValuePair[])customReader.ToArray(typeof(PropValuePair)); propVal = arrpropval.ToList(); lstOfFilters.Add(key, arrpropval); } } } if (customReader.readBoolean()) { int sortCount = (int)customReader.readNum(); for (int i = 0; i < sortCount; i++) { var key = customReader.readString(); var arrSort = (SortingProperties[])customReader.ToArray(typeof(SortingProperties)); FilterSorter propSort = new FilterSorter(arrSort); if (lstOfSorters != null && !lstOfSorters.ContainsKey(key)) { lstOfSorters.Add(key, propSort); } } } customReader.Release(); XDocument xdoc = XDocument.Load(st); var element = xdoc.Root.Attributes().Where(x => x.Name == "RefreshTimer").FirstOrDefault(); if (element != null) { int refreshTimer = (int)NumberConvert.ToInt(element.Value); if (refreshTimer > 0) { if (timer == null) { timer = new System.Windows.Forms.Timer(); } timer.Interval = refreshTimer < 300 ? 300 * 1000 : refreshTimer * 1000; timer.Tick += Timer_Tick; timer.Start(); } } ShowBusyIndicator(); st.Seek(0, System.IO.SeekOrigin.Begin); dashboardViewerUniconta.LoadDashboard(st); st.Release(); return(retVal); } catch (Exception ex) { ClearBusy(); UnicontaMessageBox.Show(ex); CloseDockItem(); return(false); } }
private void InitGridView(IEnumerable <string> markedList) { var settle = SelectedJournalLine?._Settlements ?? SelectedBankStatemenLine?._Settlement; if (settle != null) { var settlements = settle.Split(';'); if (SelectedJournalLine != null) { var SettleValue = SelectedJournalLine._SettleValue; foreach (var p in settlements) { if (string.IsNullOrWhiteSpace(p)) { continue; } if (SettleValue == Uniconta.DataModel.SettleValueType.Invoice) { selectedInvoices.Add(p); } else { var n = NumberConvert.ToInt(p); if (n == 0) { continue; } if (SettleValue == Uniconta.DataModel.SettleValueType.Voucher) { selectedVouchers.Add((int)n); } else if (SettleValue == Uniconta.DataModel.SettleValueType.RowId) { selectedRowIds.Add((int)n); } } } } else if (SelectedBankStatemenLine != null) { selectedInvoices.AddRange(settlements); } } else { if (!string.IsNullOrEmpty(SelectedJournalLine?._Invoice)) { selectedInvoices.Add(SelectedJournalLine._Invoice); } else if (!string.IsNullOrEmpty(SelectedBankStatemenLine?._Invoice)) { selectedInvoices.Add(SelectedBankStatemenLine._Invoice); } } markedlist = GetAllReadyMarked(markedList); if (OpenTransactionType == 1) { LoadDebtorTransOpen(); } else if (OpenTransactionType == 2) { LoadCreditorTransOpen(); } dgOpenTransactionGrid.Focus(); }
private async void SaveCompany(Company fromCompany) { int setupType = 1; /*Copy Setup */ int importFrom = -1; string path = string.Empty; bool set0InAccount, set0InCustAcc, set0InVendAcc; bool includeVatInPrices, concatC5ItemNames; int importDim; #if !SILVERLIGHT setupType = lstSetupType.SelectedIndex; importFrom = cmbImportFrom.SelectedIndex; if (importFrom == (int)ImportFrom.BC_NAVOnline) { path = txtImportFromFile.Text; } else { path = txtImportFromDirectory.Text; } set0InAccount = chkSet0InAct.IsChecked.Value; set0InCustAcc = chkSet0InCustAcc.IsChecked.Value; set0InVendAcc = chkSet0InVendAcc.IsChecked.Value; concatC5ItemNames = chkConcatC5ItemNames.IsChecked.Value; includeVatInPrices = chkInvoiceVatPriceCheck.IsChecked.Value; importDim = cmbImportDimension.SelectedIndex; switch ((ImportFrom)importFrom) { case ImportFrom.c5_Danmark: case ImportFrom.c5_Iceland: editrow._ConvertedFrom = (int)ConvertFromType.C5; break; case ImportFrom.economic_Danmark: case ImportFrom.economic_English: case ImportFrom.economic_Norge: case ImportFrom.economic_Germany: case ImportFrom.economic_Sweden: editrow._ConvertedFrom = (int)ConvertFromType.Eco; break; case ImportFrom.BC_NAVOnline: case ImportFrom.NAV: editrow._ConvertedFrom = (int)ConvertFromType.Nav; break; case ImportFrom.Ax30_eCTRL: editrow._ConvertedFrom = (int)ConvertFromType.eCtrl; break; case ImportFrom.dk_Iceland: editrow._ConvertedFrom = (int)ConvertFromType.dk_Iceland; break; } #endif if (setupType == 1) { if (dateFrm.DateTime.Date < new DateTime(2000, 1, 1)) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("YearStartError"), dateFrm.DateTime.Date), Uniconta.ClientTools.Localization.lookup("Warning")); return; } } else { if (importFrom == -1) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("CannotBeBlank"), Uniconta.ClientTools.Localization.lookup("ImportFrom")), Uniconta.ClientTools.Localization.lookup("Warning")); return; } if (string.IsNullOrEmpty(path)) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("CannotBeBlank"), Uniconta.ClientTools.Localization.lookup("SelectDirectory")), Uniconta.ClientTools.Localization.lookup("Warning")); return; } } try { if (setupType == 1) { if (fromCompany != null) { editrow.CopyFunctions(fromCompany); busyIndicator.BusyContent = string.Format(Uniconta.ClientTools.Localization.lookup("CopyingCompany"), fromCompany._Name, editrow._Name); } busyIndicator.IsBusy = true; if (chkDimensions.IsChecked == true && fromCompany != null) { var dim = await session.GetCompany(fromCompany.CompanyId); if (dim != null) { editrow.NumberOfDimensions = dim.NumberOfDimensions; editrow._Dim1 = dim._Dim1; editrow._Dim2 = dim._Dim2; editrow._Dim3 = dim._Dim3; editrow._Dim4 = dim._Dim4; editrow._Dim5 = dim._Dim5; } } } else { busyIndicator.IsBusy = true; } ErrorCodes err; if (editrow._Name == null) { editrow._Name = "import"; } if (usermaster != null) { err = await session.CreateCompany(editrow, usermaster); } else { err = await session.CreateCompany(editrow); } if (err == ErrorCodes.Succes) { Company[] companies = await BasePage.session.GetCompanies(); UnicontaClient.Controls.CWDefaultCompany.loadedCompanies = companies; if (Utility.GetDefaultCompany() == null) { globalEvents.OnRefresh(NameOfControl); } if (setupType == 1)/* Import- Financial year not required*/ { await SaveFinancialYear(editrow, dateFrm.DateTime.Date, dateTo.DateTime.Date); if (fromCompany != null) { await CopyBaseData(); } } await SaveCompanyLogos(); if (setupType != 1) { #if !SILVERLIGHT var pastYears = string.IsNullOrWhiteSpace(invoiceDateCounter.Text) ? 0 : -(int)NumberConvert.ToInt(invoiceDateCounter.Text); DateTime invoiceFrmDate = DateTime.Today.AddYears(pastYears); var listOfNavDim = new List <string>(); var dim = string.IsNullOrWhiteSpace(txtNavDim1.Text) ? string.Empty : txtNavDim1.Text; listOfNavDim.Add(dim); dim = string.IsNullOrWhiteSpace(txtNavDim2.Text) ? string.Empty : txtNavDim2.Text; listOfNavDim.Add(dim); dim = string.IsNullOrWhiteSpace(txtNavDim3.Text) ? string.Empty : txtNavDim3.Text; listOfNavDim.Add(dim); dim = string.IsNullOrWhiteSpace(txtNavDim4.Text) ? string.Empty : txtNavDim4.Text; listOfNavDim.Add(dim); dim = string.IsNullOrWhiteSpace(txtNavDim5.Text) ? string.Empty : txtNavDim5.Text; listOfNavDim.Add(dim); var arrayOfNavDim = listOfNavDim.ToArray(); object[] compParams = new object[18]; compParams[0] = path; compParams[1] = editrow; compParams[2] = (ImportFrom)importFrom; compParams[3] = set0InAccount; compParams[4] = importDim; compParams[5] = arrayOfNavDim; compParams[6] = cmbInvoiceOrContactMail.SelectedIndex == 0; compParams[7] = txtNavErrorAccount.Text; compParams[8] = includeVatInPrices; compParams[9] = chkLedgerTransactions.IsChecked.Value; compParams[10] = chkDebtorTransactions.IsChecked.Value; compParams[11] = chkCreditorTransactions.IsChecked.Value; compParams[12] = txtAccountForPrimo.Text; compParams[13] = chkImportInvoice.IsChecked.Value; compParams[14] = set0InCustAcc; compParams[15] = set0InVendAcc; compParams[16] = concatC5ItemNames; compParams[17] = invoiceFrmDate; string header = string.Format(Uniconta.ClientTools.Localization.lookup("ImportOBJ"), Uniconta.ClientTools.Localization.lookup("Company")); AddDockItem(TabControls.ImportFromOtherCompanySetup, compParams, header); #endif } if (usermaster != null && usermaster.Uid != session.Uid) { busyIndicator.IsBusy = false; return; } if (setupType == 1) { globalEvents.OnRefresh(TabControls.CreateCompany, editrow.RowId); CloseDockItem(); } } else { busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(err); } } catch (Exception ex) { BasePage.session.ReportException(ex, "Create Company. Setup Page", 0); UnicontaMessageBox.Show(ex); } if (setupType == 1) { busyIndicator.IsBusy = false; } }
public static Type GeneraterUserType(Type BaseType, List <DashboardUserField> flds) { try { AssemblyName an = new AssemblyName("UserAssembly_" + BaseType.Name); AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(an, AssemblyBuilderAccess.Run); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule"); TypeBuilder builder = moduleBuilder.DefineType(BaseType.Name + "Dashboard", TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.AutoClass | TypeAttributes.AnsiClass | TypeAttributes.BeforeFieldInit | TypeAttributes.AutoLayout, BaseType); foreach (var fld in flds) { Type t; switch (fld.DataType) { case 0: // string t = typeof(string); break; case 1: // int t = typeof(int); break; case 2: // double t = typeof(double); break; case 3: // date time t = typeof(DateTime); break; case 4: // bool t = typeof(bool); break; default: // long t = typeof(long); break; } var getMethodBuilder = builder.DefineMethod("get_" + fld.FieldName, MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, t, Type.EmptyTypes); var getIL = getMethodBuilder.GetILGenerator(); switch (fld.DataType) { case 0: // string getIL.Emit(OpCodes.Ldstr, fld.Value); break; case 1: // int getIL.Emit(OpCodes.Ldc_I4, (int)NumberConvert.ToInt(fld.Value)); break; case 2: // double getIL.Emit(OpCodes.Ldc_R8, NumberConvert.ToDoubleNoThousandSeperator(fld.Value)); break; case 3: // date time getIL.Emit(OpCodes.Ldc_I8, StringSplit.DateParse(fld.Value, 0).Ticks); getIL.Emit(OpCodes.Call, typeof(DashBoardViewerPage).GetMethod("MakeDate")); break; case 4: // bool getIL.Emit((fld.Value == "1" || string.Compare(fld.Value, "true", StringComparison.OrdinalIgnoreCase) == 0) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); break; default: // long getIL.Emit(OpCodes.Ldc_I8, NumberConvert.ToInt(fld.Value)); break; } getIL.Emit(OpCodes.Ret); var propertyBuilder = builder.DefineProperty(fld.FieldName, System.Reflection.PropertyAttributes.HasDefault, t, null); propertyBuilder.SetGetMethod(getMethodBuilder); } return(builder.CreateType()); } catch { return(null); } }