protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetCompaniesResult = await SimpleInvoice.GetCompanies();

            getCompaniesForCompanyIdResult = simpleInvoiceGetCompaniesResult;

            var simpleInvoiceGetCustomersResult = await SimpleInvoice.GetCustomers();

            getCustomersForCustomerIdResult = simpleInvoiceGetCustomersResult;

            var simpleInvoiceGetTaxesResult = await SimpleInvoice.GetTaxes();

            getTaxesForTaxIdResult = simpleInvoiceGetTaxesResult;

            invoice = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Invoice()
            {
            };

            var simpleInvoiceGetInvoiceLinesResult = await SimpleInvoice.GetInvoiceLines();

            getInvoiceLinesResult = simpleInvoiceGetInvoiceLinesResult;

            CompanyAddress = "";

            CompanyCity = "";

            CustomerAddress = "";

            CustomerCity = "";

            await DataInitialization();
        }
        public async Task RecalculateSummary(Invoice invoice, IEnumerable <InvoiceLine> invoiceLines)
        {
            invoice.InvoiceLines = invoiceLines.ToList();
            invoice.RecalculateTotal();

            await SimpleInvoice.UpdateInvoice(invoice.InvoiceId, invoice);
        }
        protected async System.Threading.Tasks.Task BtnDeleteClick(MouseEventArgs args, dynamic data)
        {
            try
            {
                if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
                {
                    var simpleInvoiceDeleteInvoiceLineResult = await SimpleInvoice.DeleteInvoiceLine(data.InvoiceLineId);

                    if (simpleInvoiceDeleteInvoiceLineResult != null)
                    {
                        await RecalculateMasterAfterChildDelete(invoice, InvoiceLines);
                    }

                    if (simpleInvoiceDeleteInvoiceLineResult != null)
                    {
                        await grid0.Reload();
                    }
                }
            }
            catch (System.Exception simpleInvoiceDeleteInvoiceLineException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to delete InvoiceLine"
                });
            }
        }
        public async Task RecalculateMasterAfterChildDelete(Invoice invoice, IEnumerable <InvoiceLine> invoiceLines)
        {
            invoice.InvoiceLines = invoiceLines.ToList();
            invoice.RecalculateTotal();

            await SimpleInvoice.UpdateInvoice(invoice.InvoiceId, invoice);
        }
Exemple #5
0
 public async Task ResetDraftInvoiceNumber(Invoice invoice)
 {
     if (invoice.InvoiceNumber.Contains("DRAFT"))
     {
         invoice.InvoiceNumber = $"INV#{invoice.InvoiceId.ToString().PadLeft(4, '0')}";
         await SimpleInvoice.UpdateInvoice(invoice.InvoiceId, invoice);
     }
 }
        public async Task ChangeDiscount(double discountAmount, IEnumerable <InvoiceLine> invoiceLines)
        {
            invoice.InvoiceLines = invoiceLines.ToList();
            invoice.Discount     = discountAmount;
            invoice.RecalculateTotal();

            await SimpleInvoice.UpdateInvoice(invoice.InvoiceId, invoice);
        }
Exemple #7
0
        public async Task SelectedProduct(int productId, InvoiceLine invoiceLine)
        {
            var product = await SimpleInvoice.GetProductByProductId(productId);

            if (product != null)
            {
                invoiceline.UnitPrice = product.UnitPrice;
                invoiceline.RecalculateTotal();
            }
        }
Exemple #8
0
        public async Task CompanySelected(int companyId)
        {
            var company = await SimpleInvoice.GetCompanyByCompanyId(companyId);

            if (company != null)
            {
                CompanyAddress = company.Address;
                CompanyCity    = company.City;
            }
        }
Exemple #9
0
        public async Task CustomerSelected(int customerId)
        {
            var customer = await SimpleInvoice.GetCustomerByCustomerId(customerId);

            if (customer != null)
            {
                CustomerAddress = customer.Address;
                CustomerCity    = customer.City;
            }
        }
        public async Task SelectedTax(int taxId, IEnumerable <InvoiceLine> invoiceLines)
        {
            invoice.InvoiceLines = invoiceLines.ToList();
            invoice.TaxId        = taxId;
            invoice.Tax          = await SimpleInvoice.GetTaxByTaxId(taxId);

            invoice.RecalculateTotal();

            await SimpleInvoice.UpdateInvoice(invoice.InvoiceId, invoice);
        }
        protected async System.Threading.Tasks.Task Load()
        {
            if (string.IsNullOrEmpty(search))
            {
                search = "";
            }

            var simpleInvoiceGetInvoiceLinesResult = await SimpleInvoice.GetInvoiceLines(new Query()
            {
                Expand = "Invoice,Product"
            });

            getInvoiceLinesResult = simpleInvoiceGetInvoiceLinesResult;
        }
        protected async System.Threading.Tasks.Task Load()
        {
            if (string.IsNullOrEmpty(search))
            {
                search = "";
            }

            var simpleInvoiceGetInvoicesResult = await SimpleInvoice.GetInvoices(new Query()
            {
                Filter = $@"i => i.InvoiceNumber.Contains(@0)", FilterParameters = new object[] { search }, Expand = "Company,Customer,Tax"
            });

            getInvoicesResult = simpleInvoiceGetInvoicesResult;
        }
Exemple #13
0
        protected async System.Threading.Tasks.Task Load()
        {
            if (string.IsNullOrEmpty(search))
            {
                search = "";
            }

            var simpleInvoiceGetCustomersResult = await SimpleInvoice.GetCustomers(new Query()
            {
                Filter = $@"i => i.Name.Contains(@0) || i.Description.Contains(@1) || i.Address.Contains(@2) || i.City.Contains(@3)", FilterParameters = new object[] { search, search, search, search }
            });

            getCustomersResult = simpleInvoiceGetCustomersResult;
        }
Exemple #14
0
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetInvoiceLineByInvoiceLineIdResult = await SimpleInvoice.GetInvoiceLineByInvoiceLineId(InvoiceLineId);

            invoiceline = simpleInvoiceGetInvoiceLineByInvoiceLineIdResult;

            var simpleInvoiceGetInvoicesResult = await SimpleInvoice.GetInvoices();

            getInvoicesForInvoiceIdResult = simpleInvoiceGetInvoicesResult;

            var simpleInvoiceGetProductsResult = await SimpleInvoice.GetProducts();

            getProductsForProductIdResult = simpleInvoiceGetProductsResult;
        }
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Product args)
        {
            try
            {
                var simpleInvoiceCreateProductResult = await SimpleInvoice.CreateProduct(product);

                DialogService.Close(product);
            }
            catch (System.Exception simpleInvoiceCreateProductException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Product!"
                });
            }
        }
Exemple #16
0
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetInvoicesResult = await SimpleInvoice.GetInvoices();

            getInvoicesForInvoiceIdResult = simpleInvoiceGetInvoicesResult;

            var simpleInvoiceGetProductsResult = await SimpleInvoice.GetProducts();

            getProductsForProductIdResult = simpleInvoiceGetProductsResult;

            invoiceline = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.InvoiceLine()
            {
            };

            await InitObject(invoiceline);
        }
Exemple #17
0
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.InvoiceLine args)
        {
            try
            {
                var simpleInvoiceUpdateInvoiceLineResult = await SimpleInvoice.UpdateInvoiceLine(InvoiceLineId, invoiceline);

                DialogService.Close(invoiceline);
            }
            catch (System.Exception simpleInvoiceUpdateInvoiceLineException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update InvoiceLine"
                });
            }
        }
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Invoice args)
        {
            try
            {
                var simpleInvoiceUpdateInvoiceResult = await SimpleInvoice.UpdateInvoice(InvoiceId, invoice);

                UriHelper.NavigateTo("invoices");
            }
            catch (System.Exception simpleInvoiceUpdateInvoiceException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update Invoice"
                });
            }
        }
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Invoice args)
        {
            try
            {
                var simpleInvoiceCreateInvoiceResult = await SimpleInvoice.CreateInvoice(invoice);
                await ResetDraftInvoiceNumber(invoice);

                await RedirectToEdit(invoice);
            }
            catch (System.Exception simpleInvoiceCreateInvoiceException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Invoice!"
                });
            }
        }
        protected async System.Threading.Tasks.Task Splitbutton0Click(RadzenSplitButtonItem args)
        {
            if (args?.Value == "csv")
            {
                await SimpleInvoice.ExportInvoiceLinesToCSV(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "Invoice,Product", Select = "InvoiceLineId,Invoice.InvoiceNumber,Product.Name,Qty,UnitPrice,Total"
                }, $"Invoice Lines");
            }

            if (args == null || args.Value == "xlsx")
            {
                await SimpleInvoice.ExportInvoiceLinesToExcel(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "Invoice,Product", Select = "InvoiceLineId,Invoice.InvoiceNumber,Product.Name,Qty,UnitPrice,Total"
                }, $"Invoice Lines");
            }
        }
Exemple #21
0
        protected async System.Threading.Tasks.Task Splitbutton0Click(RadzenSplitButtonItem args)
        {
            if (args?.Value == "csv")
            {
                await SimpleInvoice.ExportCustomersToCSV(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "", Select = "CustomerId,Name,Description,Address,City"
                }, $"Customers");
            }

            if (args == null || args.Value == "xlsx")
            {
                await SimpleInvoice.ExportCustomersToExcel(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "", Select = "CustomerId,Name,Description,Address,City"
                }, $"Customers");
            }
        }
        protected async System.Threading.Tasks.Task Splitbutton0Click(RadzenSplitButtonItem args)
        {
            if (args?.Value == "csv")
            {
                await SimpleInvoice.ExportTaxesToCSV(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "", Select = "TaxId,Name,Description,TaxTariffPercentage"
                }, $"Taxes");
            }

            if (args == null || args.Value == "xlsx")
            {
                await SimpleInvoice.ExportTaxesToExcel(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "", Select = "TaxId,Name,Description,TaxTariffPercentage"
                }, $"Taxes");
            }
        }
        protected async System.Threading.Tasks.Task Splitbutton0Click(RadzenSplitButtonItem args)
        {
            if (args?.Value == "csv")
            {
                await SimpleInvoice.ExportInvoicesToCSV(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "Company,Customer,Tax", Select = "InvoiceId,InvoiceNumber,Company.Name,Customer.Name,InvoiceDate,InvoiceDueDate,Tax.Name,Total,Discount,BeforeTax,TaxAmount,GrandTotal"
                }, $"Invoices");
            }

            if (args == null || args.Value == "xlsx")
            {
                await SimpleInvoice.ExportInvoicesToExcel(new Query()
                {
                    Filter = $@"{grid0.Query.Filter}", OrderBy = $"{grid0.Query.OrderBy}", Expand = "Company,Customer,Tax", Select = "InvoiceId,InvoiceNumber,Company.Name,Customer.Name,InvoiceDate,InvoiceDueDate,Tax.Name,Total,Discount,BeforeTax,TaxAmount,GrandTotal"
                }, $"Invoices");
            }
        }
        protected async System.Threading.Tasks.Task Load()
        {
            InvoiceId = int.Parse(InvoiceId);

            var simpleInvoiceGetInvoiceByInvoiceIdResult = await SimpleInvoice.GetInvoiceByInvoiceId(InvoiceId);

            invoice = simpleInvoiceGetInvoiceByInvoiceIdResult;

            var simpleInvoiceGetCompaniesResult = await SimpleInvoice.GetCompanies();

            getCompaniesForCompanyIdResult = simpleInvoiceGetCompaniesResult;

            var simpleInvoiceGetCustomersResult = await SimpleInvoice.GetCustomers();

            getCustomersForCustomerIdResult = simpleInvoiceGetCustomersResult;

            var simpleInvoiceGetTaxesResult = await SimpleInvoice.GetTaxes();

            getTaxesForTaxIdResult = simpleInvoiceGetTaxesResult;

            var simpleInvoiceGetInvoiceLinesResult = await SimpleInvoice.GetInvoiceLines(new Query()
            {
                Filter = $@"i => i.InvoiceId == {invoice.InvoiceId}"
            });

            InvoiceLines = simpleInvoiceGetInvoiceLinesResult;

            await SelectedTax(invoice.TaxId.Value, InvoiceLines);

            CompanyAddress = "";

            CompanyCity = "";

            CustomerAddress = "";

            CustomerCity = "";

            await SelectedCompany(invoice.CompanyId.Value);

            await SelectedCustomer(invoice.CustomerId.Value);
        }
Exemple #25
0
        protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data)
        {
            try
            {
                if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
                {
                    var simpleInvoiceDeleteCustomerResult = await SimpleInvoice.DeleteCustomer(data.CustomerId);

                    if (simpleInvoiceDeleteCustomerResult != null)
                    {
                        await grid0.Reload();
                    }
                }
            }
            catch (System.Exception simpleInvoiceDeleteCustomerException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to delete Customer"
                });
            }
        }
Exemple #26
0
        public async Task <InvoiceLine> ProcessSubmit(InvoiceLine invoiceLine)
        {
            var invoiceLines = await SimpleInvoice
                               .GetInvoiceLines(new Query()
            {
                Filter = $"x => x.InvoiceId = {invoiceLine.InvoiceId}"
            });

            var exists = invoiceLines
                         .ToList()
                         .Where(x => x.ProductId.Equals(invoiceLine.ProductId))
                         .FirstOrDefault();

            if (exists != null)
            {
                exists.Qty = exists.Qty + invoiceLine.Qty;
                exists.RecalculateTotal();
                return(await SimpleInvoice.UpdateInvoiceLine(exists.InvoiceLineId, exists));
            }
            else
            {
                return(await SimpleInvoice.CreateInvoiceLine(invoiceline));
            }
        }
Exemple #27
0
 public Form2(Form1 p,SimpleInvoice.Form1.stockItem s)
 {
     parent = p;
     item = s;
     InitializeComponent();
 }
 protected async System.Threading.Tasks.Task ExportPDF(Invoice invoice)
 {
     await SimpleInvoice.PrintInvoiceToPDF(invoice.InvoiceId, invoice.InvoiceNumber);
 }
Exemple #29
0
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetCustomerByCustomerIdResult = await SimpleInvoice.GetCustomerByCustomerId(CustomerId);

            customer = simpleInvoiceGetCustomerByCustomerIdResult;
        }
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetTaxByTaxIdResult = await SimpleInvoice.GetTaxByTaxId(TaxId);

            tax = simpleInvoiceGetTaxByTaxIdResult;
        }
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetProductByProductIdResult = await SimpleInvoice.GetProductByProductId(ProductId);

            product = simpleInvoiceGetProductByProductIdResult;
        }