async private void ShowInvoice(SubscriptionInvoiceClient selectedItem) { var subsApi = new SubscriptionAPI(api); var invoicePdf = await subsApi.SubscriptionInvoicePDF(selectedItem); if (invoicePdf != null) { var viewer = new CWDocumentViewer(invoicePdf, FileextensionsTypes.PDF); viewer.Show(); } }
async Task <SubscriptionInvDetails> getInvData(SubscriptionInvoiceClient selecteditem) { SubscriptionInvDetails subDetails = new SubscriptionInvDetails(); if (masterSub != null && masterSub is SubscriptionClient) { subDetails.clientSubscriptions = (SubscriptionClient)masterSub; } else { subDetails.clientSubscriptions = new SubscriptionClient(); subDetails.clientSubscriptions.SetMaster(selecteditem); await api.Read(subDetails.clientSubscriptions); } subDetails.DefaultDebtorAcc = invoicePartner?._DebitorAccountIfBlank; subDetails.invHeader = selecteditem; /* We only can load Logo, if we are in the right company * if (api.CompanyId == PartnerCompanyId) * { * CompanyDocumentClient documentClient = new CompanyDocumentClient(); * documentClient.UseFor = CompanyDocumentUse.CompanyLogo; * await api.Read(documentClient); * subDetails.CompanyLogo = documentClient.DocumentData; * } */ List <UnicontaBaseEntity> masterlist = new List <UnicontaBaseEntity>(); masterlist.Add(selecteditem); var lines = (SubscriptionInvoiceLineClient[])await api.Query(new SubscriptionInvoiceLineClient(), masterlist, null); subDetails.invLines = lines; subDetails.Language = session.User._Language; return(subDetails); }