Exemplo n.º 1
0
        /// <summary>
        /// Create a new fortnox importer
        /// </summary>
        public FortnoxImporter(ILogger<IFortnoxImporter> logger, IFortnoxClient nox_client, IOptions<DefaultValues> default_values)
        {
            // Set values for instance variables
            this.logger = logger;
            this.nox_client = nox_client;
            this.default_values = default_values.Value;

        } // End of the constructor
Exemplo n.º 2
0
        /// <summary>
        /// Create a new post
        /// </summary>
        public AppSettings()
        {
            // Set values for instance variables
            this.Logging = new Logging();
            this.DoxservrOptions = new DoxservrOptions();
            this.FortnoxOptions = new FortnoxOptions();
            this.DefaultValues = new DefaultValues();

        } // End of the constructor
Exemplo n.º 3
0
        /// <summary>
        /// Create a new fortnox exporter
        /// </summary>
        public FortnoxExporter(ILogger<IFortnoxExporter> logger, IFortnoxClient nox_client, IOptions<DefaultValues> default_values)
        {
            // Set values for instance variables
            this.logger = logger;
            this.nox_client = nox_client;
            this.default_values = default_values.Value;
            this._company_settings = null;
            this._labels = null;

        } // End of the constructor
Exemplo n.º 4
0
        /// <summary>
        /// Create a new repository
        /// </summary>
        public FixerClient(HttpClient http_client, IOptions<DefaultValues> options)
        {
            // Set values for instance variables
            this.client = http_client;
            this.default_values = options.Value;

            // Set values for the client
            this.client.BaseAddress = new Uri("http://api.fixer.io");
            this.client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        } // End of the constructor
Exemplo n.º 5
0
        /// <summary>
        /// Create a new repository
        /// </summary>
        public WorkerRepository(ILogger<IWorkerRepository> logger, IFortnoxClient nox_client, IDoxservrFilesClient dox_files_client, IFixerClient fixer_client, IFortnoxImporter fortnox_importer, 
            IFortnoxExporter fortnox_exporter, IOptions<DefaultValues> default_values)
        {
            // Set values for instance variables
            this.logger = logger;
            this.nox_client = nox_client;
            this.dox_files_client = dox_files_client;
            this.fixer_client = fixer_client;
            this.fortnox_importer = fortnox_importer;
            this.fortnox_exporter = fortnox_exporter;
            this.default_values = default_values.Value;

        } // End of the constructor
Exemplo n.º 6
0
        } // End of the GetExtensions method

        /// <summary>
        /// Get customer vat type
        /// </summary>
        public static string GetCustomerVatType(Customer customer, DefaultValues default_values)
        {
            // Customer country codes
            string invoice_country_code = string.IsNullOrEmpty(customer.CountryCode) == false ? customer.CountryCode : "SE";
            string delivery_country_code = string.IsNullOrEmpty(customer.DeliveryCountryCode) == false ? customer.DeliveryCountryCode : invoice_country_code;

            // Create the vat type to return
            string vat_type = "";

            if (invoice_country_code == "SE" && delivery_country_code == "SE")
            {
                if(customer.VATType == "SEREVERSEDVAT")
                {
                    vat_type = "SEREVERSEDVAT";
                }
                else if (customer.VATType == "SEVAT")
                {
                    vat_type = "SEVAT";
                }
                else
                {
                    vat_type = default_values.SalesVatTypeSE;
                }            
            }
            else if (customer.VATNumber != null && IsCountryCodeEU(invoice_country_code) && IsCountryCodeEU(delivery_country_code))
            {
                vat_type = "EUREVERSEDVAT";
            }
            else if(customer.VATNumber == null && IsCountryCodeEU(invoice_country_code) && IsCountryCodeEU(delivery_country_code))
            {
                vat_type = "EUVAT";
            }
            else
            {
                vat_type = "EXPORT";
            }

            // Return the vat type
            return vat_type;

        } // End of the GetCustomerVatType method
Exemplo n.º 7
0
        } // End of the GetCustomerVatType method

        /// <summary>
        /// Get a default sales account for an article
        /// </summary>
        /// <param name="vat_rate"></param>
        /// <param name="default_values"></param>
        /// <returns></returns>
        public static string GetArticleSalesAccount(decimal? vat_rate, DefaultValues default_values)
        {
            // Create the account to return
            string account = default_values.SalesAccountSE0;

            if (vat_rate == 0.25M)
            {
                account = default_values.SalesAccountSE25;
            }
            else if (vat_rate == 0.12M)
            {
                account = default_values.SalesAccountSE12;
            }
            else if (vat_rate == 0.06M)
            {
                account = default_values.SalesAccountSE6;
            }

            // Return the account
            return account;

        } // End of the GetArticleSalesAccount method