void SetDebtorFilterUserFields() { var debtorRow = new DebtorClient(); debtorRow.SetMaster(api.CompanyEntity); DebtorUserFields = debtorRow.UserFieldDef(); }
private void OKButton_Click(object sender, RoutedEventArgs e) { var debtor = crudApi.CompanyEntity.CreateUserType <DebtorClient>(); debtor.Account = AccountNumber; debtor.Group = Group; debtor._Name = crmProspect._Name; debtor._Address1 = crmProspect._Address1; debtor._Address2 = crmProspect._Address2; debtor._Address3 = crmProspect._Address3; debtor._City = crmProspect._City; debtor._ZipCode = crmProspect._ZipCode; debtor._Country = crmProspect._Country; debtor._LegalIdent = crmProspect._LegalIdent; debtor._Currency = crmProspect._Currency; debtor._Phone = crmProspect._Phone; debtor._VatZone = crmProspect._VatZone; debtor._PriceList = crmProspect._PriceList; debtor._PriceGroup = crmProspect._PriceGroup; debtor._ItemNameGroup = crmProspect._ItemNameGroup; debtor._LayoutGroup = crmProspect._LayoutGroup; debtor._Blocked = crmProspect._Blocked; debtor._Language = crmProspect._Language; debtor._ContactEmail = crmProspect._ContactEmail; debtor._InvoiceEmail = crmProspect._InvoiceEmail; debtor._ContactPerson = crmProspect._ContactPerson; debtor._Employee = crmProspect._Employee; debtor._EAN = crmProspect._EAN; debtor._Interests = crmProspect._Interests; debtor._Products = crmProspect._Products; DebtorClient = debtor; this.DialogResult = true; }
async private Task PrintDebtorPaymentStatementPage(CompanyClient companyClient, byte[] logo, DebtorPaymentStatementList selectedItem, string emailType) { int indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(emailType); var debtorEmailType = (DebtorEmailType)indexDebtorEmailType; var dbClientTotal = selectedItem.ChildRecords.FirstOrDefault(); if (dbClientTotal != null) { var debtorClient = new DebtorClient(); StreamingManager.Copy(dbClientTotal.Debtor, debtorClient); var debtorMessageClient = await Utility.GetDebtorMessageClient(api, debtorClient._Language, debtorEmailType); string messageText = debtorMessageClient?.Text; var dbStatementCustomPrint = new DebtorPaymentStatementCustPrint(api, selectedItem, companyClient, debtorClient, txtDateFrm.DateTime, txtDateTo.DateTime, logo, debtorEmailType.ToString(), this.AddInterest, messageText); object[] obj = new object[1]; obj[0] = dbStatementCustomPrint as CustomPrintTemplateData; AddDockItem(TabControls.DebtorPaymentStatementPrintPage, obj, true, string.Format("{0} : {1},{2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.Name, selectedItem.AccountNumber)); } }
void CopyRecord(DebtorClient selectedItem) { if (selectedItem == null) { return; } var debtor = Activator.CreateInstance(selectedItem.GetType()) as DebtorClient; StreamingManager.Copy(selectedItem, debtor); var parms = new object[2] { debtor, false }; AddDockItem(TabControls.DebtorAccountPage2, parms, Uniconta.ClientTools.Localization.lookup("DebtorAccount"), ";component/Assets/img/Add_16x16.png"); }
void CopyRecord(DebtorClient selectedItem) { if (selectedItem == null) { return; } var debtor = Activator.CreateInstance(selectedItem.GetType()) as DebtorClient; CorasauDataGrid.CopyAndClearRowId(selectedItem, debtor); debtor._Created = DateTime.MinValue; debtor._D2CAccount = null; AddDockItem(TabControls.DebtorAccountPage2, new object[2] { debtor, IdObject.get(false) }, Uniconta.ClientTools.Localization.lookup("DebtorAccount"), "Add_16x16.png"); }
public DebtorOrdersPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for add from particular account */ : base(crudApi, "") { InitializeComponent(); if (master != null) { if (master is DebtorClient) { Debtor = master as DebtorClient; } else if (master is ProjectClient) { Project = master as ProjectClient; } } InitPage(api); }
public DebtorOrdersPage2(UnicontaBaseEntity sourcedata, UnicontaBaseEntity master) /* called for edit from particular account */ : base(sourcedata, true) { InitializeComponent(); if (master != null) { if (master is DebtorClient) { Debtor = master as DebtorClient; } else if (master is ProjectClient) { Project = master as ProjectClient; } } InitPage(api); }
public DebtorOfferPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for add from particular account */ : base(crudApi, "") { InitializeComponent(); if (master != null) { Debtor = master as DebtorClient; if (Debtor == null) { Prospect = master as CrmProspectClient; if (Prospect == null) { Contact = master as ContactClient; } } } InitPage(crudApi, master); }
public DebtorOfferPage2(UnicontaBaseEntity sourcedata, UnicontaBaseEntity master) /* called for edit from particular account */ : base(sourcedata, true) { InitializeComponent(); if (master != null) { Debtor = master as DebtorClient; if (Debtor == null) { Prospect = master as CrmProspectClient; if (Prospect == null) { Contact = master as ContactClient; } } } InitPage(api, master); }
void setUserFields() { var row = new DebtorClient(); row.SetMaster(api.CompanyEntity); var UserFieldDef = row.UserFieldDef(); if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnPage2(layoutItems, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], this.api, true, lastGroup); } var Comp = api.CompanyEntity; if (Comp.CRM) { crmGroup.Visibility = Visibility.Visible; GetInterestAndProduct(); } if (!Comp._UseVatOperation) { itmVatOpr.Visibility = Visibility.Collapsed; } if (!Comp.InvPrice) { priceListLayoutItem.Visibility = Visibility.Collapsed; } if (!Comp.InvClientName) { itemNameGrpLayoutItem.Visibility = Visibility.Collapsed; } if (!Comp.Shipments) { shipmentItem.Visibility = Visibility.Collapsed; } if (Comp.NumberOfDimensions == 0) { usedim.Visibility = Visibility.Collapsed; } if (!Comp.DeliveryAddress) { dAddress.Visibility = Visibility.Collapsed; } }
void InitPage(CrudAPI crudapi) { ribbonControl = frmRibbon; BusyIndicator = busyIndicator; dAddress.Header = Uniconta.ClientTools.Localization.lookup("DeliveryAddr"); layoutControl = layoutItems; cbDeliveryCountry.ItemsSource = cbCountry.ItemsSource = Enum.GetValues(typeof(Uniconta.Common.CountryCode)); ItemNameGrouplookupeditior.api = Vatlookupeditior.api = VatOprlookupeditior.api = PriceListlookupeditior.api = Employeelookupeditor.api = leInvoiceAccount.api = leShipment.api = dim1lookupeditior.api = dim2lookupeditior.api = dim3lookupeditior.api = dim4lookupeditior.api = dim5lookupeditior.api = Paymentlookupeditior.api = grouplookupeditor.api = LayoutGrouplookupeditior.api = lePostingAccount.api = leCrmGroup.api = leDeliveryTerm.api = lePaymtFormat.api = crudapi; AdjustLayout(); Task t; if (crudapi.CompanyEntity.CRM) { t = GetInterestAndProduct(); } else { t = null; } StartLoadCache(t); if (LoadedRow == null) { frmRibbon.DisableButtons("Delete"); if (!isCopiedRow) { editrow = CreateNew() as DebtorClient; editrow.Country = crudapi.CompanyEntity._CountryId; } } layoutItems.DataContext = editrow; frmRibbon.OnItemClicked += frmRibbon_OnItemClicked; txtCompanyRegNo.EditValueChanged += TxtCVR_EditValueChanged; editrow.PropertyChanged += Editrow_PropertyChanged; #if !SILVERLIGHT txtCompanyRegNo.LostFocus += TxtCompanyRegNo_LostFocus; }
private ErrorCodes CreateLines(List <string[]> lines, DebtorClient debtorClient) { var ols = new List <DebtorOrderLineClient>(); var items = _crudAPI.Query <InvItemClient>().Result; var order = new DebtorOrderClient(); order.SetMaster(debtorClient); var orderres = _crudAPI.Insert(order).Result; foreach (string[] s in lines) { var item = items.First(i => i.Item == s[1]); var fp = new FindPrices(order, _crudAPI); fp.UseCustomerPrices = true; fp.loadPriceList(); var ol = new DebtorOrderLineClient { Qty = double.Parse(s[2]), Item = item.Item, //Date = DateTime.Parse(s[3]), }; ol.SetMaster(order); fp.SetPriceFromItem(ol, item); ols.Add(ol); } var result = _crudAPI.Insert(ols).Result; if (result == ErrorCodes.Succes) { openOrderLines(order); } return(result); }
public static DebtorEntity GetDebtorInfo(int debtorId) { DebtorEntity result; using (_debtorClient = new DebtorClient()) { try { _debtorClient.Open(); result = _debtorClient.GetDebtorInfo(debtorId); } catch (Exception) { _debtorClient.Abort(); throw; } finally { _debtorClient.Close(); } } return result; }
public ProjInvProposalPage2(UnicontaBaseEntity sourcedata, UnicontaBaseEntity master) /* called for edit from particular account */ : base(sourcedata, true) { InitializeComponent(); if (master != null) { Debtor = master as DebtorClient; if (Debtor == null) { Contact = master as ContactClient; if (Contact == null) { Project = master as ProjectClient; Debtor = Project?.Debtor; } else { Debtor = Contact.Debtor; } } } InitPage(api); }
public ProjInvProposalPage2(CrudAPI crudApi, UnicontaBaseEntity master) /* called for add from particular account */ : base(crudApi, "") { InitializeComponent(); if (master != null) { Debtor = master as DebtorClient; if (Debtor == null) { Contact = master as ContactClient; if (Contact == null) { Project = master as ProjectClient; Debtor = Project?.Debtor; } else { Debtor = Contact.Debtor; } } } InitPage(api); }
private void karKartotekBindingNavigatorSaveItem_Click(object sender, EventArgs e) { var api = UCInitializer.GetBaseAPI; //var task = api.Query<CreditorClient>(); //task.Wait(); //var col1 = task.Result; foreach (var recKartotek in this.karKartotekBindingSource.DataSource as KarKartotek) { if (recKartotek.DK == "1") //Kreditor { var crit = new List <PropValuePair>(); var pair = PropValuePair.GenereteWhereElements("Account", typeof(String), recKartotek.Kontonr.ToString()); crit.Add(pair); var taskQueryCreditor = api.Query <CreditorClient>(null, crit); taskQueryCreditor.Wait(); var col = taskQueryCreditor.Result; if (col.Count() == 0) { CreditorClient recCreditor = new CreditorClient() { Account = recKartotek.Kontonr.ToString(), Name = recKartotek.Kontonavn, Address1 = recKartotek.Adresse, ZipCode = recKartotek.Postnr, City = recKartotek.Bynavn, ContactEmail = recKartotek.Email, CompanyRegNo = recKartotek.Cvrnr, PaymentMethod = "Kreditors bankkonto", //PaymentId = recKartotek.bankkonto, }; var taskInsertCreditor = api.Insert(recCreditor); taskInsertCreditor.Wait(); var err = taskInsertCreditor.Result; } } else //Debitor { var crit = new List <PropValuePair>(); var pair = PropValuePair.GenereteWhereElements("Account", typeof(String), recKartotek.Kontonr.ToString()); crit.Add(pair); var taskQueryDebtor = api.Query <DebtorClient>(null, crit); taskQueryDebtor.Wait(); var col = taskQueryDebtor.Result; if (col.Count() == 0) { DebtorClient recDebtor = new DebtorClient() { Account = recKartotek.Kontonr.ToString(), Name = recKartotek.Kontonavn, Address1 = recKartotek.Adresse, ZipCode = recKartotek.Postnr, City = recKartotek.Bynavn, ContactEmail = recKartotek.Email, CompanyRegNo = recKartotek.Cvrnr, }; var taskInsertDebtor = api.Insert(recDebtor); taskInsertDebtor.Wait(); var err = taskInsertDebtor.Result; } } } }
async private void PrintData() { busyIndicator.IsBusy = true; busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage"); try { //Get Company related details var companyClient = new CompanyClient(); StreamingManager.Copy(api.CompanyEntity, companyClient); byte[] getLogoBytes = await UtilDisplay.GetLogo(api); #if SILVERLIGHT if (dgDebtorTrans.SelectedItem != null) { var selectedItem = dgDebtorTrans.SelectedItem as DebtorStatementList; if (selectedItem.ChildRecords.Count == 0) { return; } var debt = new DebtorClient(); StreamingManager.Copy(selectedItem.deb, debt); if (debt != null) { debt.Transactions = selectedItem.ChildRecords; //Setting the Localization for the debtor var debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(UtilDisplay.GetLanguage(debt, api.CompanyEntity)); foreach (var rec in debt.Transactions) { rec.LocOb = debtLocalize; } var debtorMessageClient = await Utility.GetDebtorMessageClient(api, debt._Language, DebtorEmailType.AccountStatement); string messageText = debtorMessageClient?._Text; DebtorStatementCustomPrint dbStatementCustomPrint = new DebtorStatementCustomPrint(api, selectedItem, companyClient, debt, txtDateFrm.DateTime, txtDateTo.DateTime, getLogoBytes, messageText); object[] obj = new object[1]; obj[0] = dbStatementCustomPrint as Controls.CustomPrintTemplateData; if (chkShowCurrency.IsChecked == true) { AddDockItem(TabControls.DebtorStatementCurrencyCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name)); } else { AddDockItem(TabControls.DebtorStatementCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name)); } } } #else IEnumerable <DebtorStatementList> debtorStatementList = (IEnumerable <DebtorStatementList>)dgDebtorTrans.ItemsSource; var layoutSelectedDebtorStatementList = new Dictionary <string, List <DebtorStatementList> >(); var Comp = api.CompanyEntity; var layoutgrpCache = Comp.GetCache(typeof(Uniconta.DataModel.DebtorLayoutGroup)); if (layoutgrpCache == null) { layoutgrpCache = await Comp.LoadCache(typeof(Uniconta.DataModel.DebtorLayoutGroup), api); } var xtraReports = new List <DevExpress.XtraReports.UI.XtraReport>(); var iReports = new List <IPrintReport>(); var marked = debtorStatementList.Any(m => m.Mark == true); foreach (var db in debtorStatementList) { if (db.ChildRecords.Count == 0 || (marked && !db.Mark)) { continue; } var statementPrint = await GenerateStandardStatementReport(companyClient, txtDateFrm.DateTime, txtDateTo.DateTime, db, getLogoBytes); if (statementPrint == null) { continue; } var standardReports = new IDebtorStandardReport[1] { statementPrint }; IPrintReport standardPrint; if (chkShowCurrency.IsChecked == true) { standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.StatementCurrency); } else { standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.Statement); } await standardPrint.InitializePrint(); if (standardPrint.Report != null) { iReports.Add(standardPrint); } } if (iReports.Count > 0) { var dockJName = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), Uniconta.ClientTools.Localization.lookup("Statement")); AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { iReports, Uniconta.ClientTools.Localization.lookup("Statement") }, dockJName); } #endif } catch (Exception ex) { busyIndicator.IsBusy = false; api.ReportException(ex, string.Format("DebtorStatement.PrintData(), CompanyId={0}", api.CompanyId)); UnicontaMessageBox.Show(ex.Message, Uniconta.ClientTools.Localization.lookup("Exception"), MessageBoxButton.OK); } finally { busyIndicator.IsBusy = false; } }
public List <VatOSSTable> UpdateValues(DebtorInvoiceLines[] listOfDebInvLines) { var listOfResults = new List <VatOSSTable>(listOfDebInvLines.Length); string lastVat = null; string lastVatName = null; GLVat lastGLVat = null; DebtorClient debtor = null; foreach (var invLine in listOfDebInvLines) { if (invLine.NetAmount == 0 || invLine._DCAccount == null) { continue; } if (debtor?._Account != invLine._DCAccount) { debtor = invLine.Debtor; if (debtor == null || debtor._Country == api.CompanyEntity._CountryId || !Country2Language.IsEU(debtor._Country)) { continue; } } if (invLine._Vat == null) { continue; } if (lastVat != invLine._Vat) { lastVat = invLine._Vat; lastGLVat = glVatCache.Get(lastVat); if (lastGLVat != null) { lastVatName = GetMOSSTypeName(AppEnums.VATMOSSType.ToString((int)lastGLVat._MOSSType)); } } if (lastGLVat == null) { continue; } var vatOSS = new VatOSSTable(); vatOSS._CompanyId = api.CompanyId; vatOSS._Account = invLine._DCAccount; vatOSS._Date = invLine._Date; vatOSS._InvoiceNumber = invLine._InvoiceNumber; vatOSS._Item = invLine._Item; vatOSS._Vat = lastVat; vatOSS._MOSSType = lastGLVat._MOSSType; vatOSS._MOSSTypeName = lastVatName; vatOSS._VatCountry = lastGLVat._VatCountry; vatOSS._BusinessCountry = lastGLVat._BusinessCountry; vatOSS._ShipmentCountry = lastGLVat._ShipmentCountry; vatOSS._Id = lastGLVat._Id; vatOSS._Amount = -invLine.NetAmount; vatOSS._VatAmount = lastGLVat.VatAmount(vatOSS._Amount, vatOSS._Date, false, invLine.InvoiceRef._PricesInclVat ? GLVatCalculationMethod.Brutto : GLVatCalculationMethod.Netto); listOfResults.Add(vatOSS); } var search = new VatOSSTable(); var sort = new VatOSSTableVatSort(); int pos = 0; listOfResults.Sort(sort); var glVatLst = glVatCache.OrderBy(s => s._Id); string lastId = null; foreach (var glvat in glVatLst) { if (glvat._TypeSales != CreateVatOSSFile.VATTYPE_MOSS || (glvat._BusinessCountry == CountryCode.Unknown && glvat._ShipmentCountry == CountryCode.Unknown)) { continue; } if (lastId == glvat._Id) { continue; } lastId = glvat._Id; search._Vat = glvat._Vat; pos = listOfResults.BinarySearch(search, sort); if (pos == -1 && vatOSSReportType == 0) { var vatOSS = new VatOSSTable(); vatOSS._CompanyId = api.CompanyId; vatOSS._Date = DefaultFromDate; vatOSS.MOSSType = CreateVatOSSFile.MOSSTYPE_007; vatOSS._MOSSTypeName = GetMOSSTypeName(vatOSS.MOSSType); vatOSS.BusinessCountry = glvat._BusinessCountry; vatOSS.ShipmentCountry = glvat._ShipmentCountry; vatOSS.Id = glvat._Id; listOfResults.Add(vatOSS); } } return(listOfResults); }
async private void PrintData() { busyIndicator.IsBusy = true; busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage"); try { #if SILVERLIGHT //Get Company related details var companyClient = new CompanyClient(); StreamingManager.Copy(api.CompanyEntity, companyClient); byte[] getLogoBytes = await UtilDisplay.GetLogo(api); if (dgDebtorTrans.SelectedItem != null) { var selectedItem = dgDebtorTrans.SelectedItem as DebtorStatementList; if (selectedItem.ChildRecords.Length == 0) { return; } var debt = new DebtorClient(); StreamingManager.Copy(selectedItem.deb, debt); debt.Transactions = selectedItem.ChildRecords; //Setting the Localization for the debtor var lan = UtilDisplay.GetLanguage(debt, companyClient); var debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(lan); foreach (var rec in debt.Transactions) { rec.LocOb = debtLocalize; if (rec._Primo) { rec._Text = debtLocalize.Lookup("Primo"); } } if (lastMessage == null || messageLanguage != lan) { messageLanguage = lan; var msg = await Utility.GetDebtorMessageClient(api, lan, DebtorEmailType.AccountStatement); if (msg != null) { lastMessage = msg._Text; } else { lastMessage = string.Empty; } } DebtorStatementCustomPrint dbStatementCustomPrint = new DebtorStatementCustomPrint(api, selectedItem, companyClient, debt, txtDateFrm.DateTime, txtDateTo.DateTime, getLogoBytes, lastMessage); object[] obj = new object[1]; obj[0] = dbStatementCustomPrint as Controls.CustomPrintTemplateData; if (chkShowCurrency.IsChecked == true) { AddDockItem(TabControls.DebtorStatementCurrencyCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name)); } else { AddDockItem(TabControls.DebtorStatementCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name)); } } #else var debtorStatementList = dgDebtorTrans.VisibleItems.Cast <DebtorStatementList>(); var marked = debtorStatementList.Any(m => m.Mark == true); var iReports = await GeneratePrintReport(debtorStatementList.ToList(), marked, chkShowCurrency.IsChecked == true, true); if (iReports.Count() > 0) { var dockJName = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), Uniconta.ClientTools.Localization.lookup("Statement")); AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { iReports, Uniconta.ClientTools.Localization.lookup("Statement") }, dockJName); } #endif } catch (Exception ex) { busyIndicator.IsBusy = false; api.ReportException(ex, string.Format("DebtorStatement.PrintData(), CompanyId={0}", api.CompanyId)); UnicontaMessageBox.Show(ex); } finally { busyIndicator.IsBusy = false; } }
public List <EUSaleWithoutVAT> UpdateValues(DebtorInvoiceLines[] listOfDebInvLines) { var listOfResults = new List <EUSaleWithoutVAT>(listOfDebInvLines.Length); var companyCountryId = api.CompanyEntity._CountryId; bool triangularTrade = false; string lastVat = null; DebtorClient debtor = null; string debtorCVR = null; bool DebtorOk = false; foreach (var invLine in listOfDebInvLines) { var netAmount = invLine.NetAmount; if (netAmount == 0 || invLine._DCAccount == null) { continue; } if (debtor?._Account != invLine._DCAccount) { debtor = invLine.Debtor; if (debtor == null || debtor._Country == companyCountryId || !Country2Language.IsEU(debtor._Country)) { DebtorOk = false; continue; } DebtorOk = true; debtorCVR = debtor._LegalIdent; if (debtorCVR != null) { long value; if (!long.TryParse(debtorCVR, out value)) { debtorCVR = Regex.Replace(debtorCVR, @"[-/ ]", ""); } if (char.IsLetter(debtorCVR[0]) && char.IsLetter(debtorCVR[1])) { debtorCVR = debtorCVR.Substring(2); } } } if (!DebtorOk) { continue; } if (lastVat != invLine._Vat) { lastVat = invLine._Vat; triangularTrade = glVatCache.Get(lastVat)?._TypeSales == "s7"; } var invoice = new EUSaleWithoutVAT(); invoice._CompanyId = api.CompanyId; invoice.CompanyRegNo = companyRegNo; invoice.RecordType = "2"; invoice.ReferenceNumber = "X"; invoice._Account = invLine._DCAccount; invoice._Date = invLine._Date; invoice._InvoiceNumber = invLine._InvoiceNumber; invoice._Item = invLine._Item; invoice._Vat = lastVat; invoice._Amount = -netAmount; invoice._IsTriangularTrade = triangularTrade; invoice._DebtorRegNoFile = debtorCVR; if (invLine._Item != null) { invoice._ItemOrService = invLine.InvItem._ItemType == 1 ? ItemOrServiceType.Service : ItemOrServiceType.Item; } sumOfAmount += invoice._Amount; listOfResults.Add(invoice); } ; return(listOfResults); }