Giter Site home page Giter Site logo

harvest-invoice-calculator's Introduction

Harvest invoice calculator

Create your invoice based on Harvest timesheets and calculate the exchange rate to your currency using Transferwise.

Optional: generate invoice using Sevdesk

Requirements

Generate your personal access token in Harvest using this page.

cp .envrc.local-template .envrc.local

Save your Account ID and your token in .envrc.local

Usage / Examples

  • Generate for the current month
harvest-exporter
  • Generate for march:
harvest-exporter --month 3
  • Filter by user
harvest-exporter --user "Hans Maier"
  • Generate using json output
harvest-exporter --format json
  • Generate using other currency
harvest-exporter --currency CHF
  • Override hourly rate:
harvest-exporter  --hourly-rate 100

This will override the hourly rate reported by harvest prior to applying the nutmide rate.

  • Filter by client:
harvest-exporter --client "Some client"

This can be also used to export hours for clients that are external to numtide (client name starting with "External -")

Generate a bill from the harvest exprt for the customer with the ID 1000

$ sevdesk-invoicer --customer "1000" harvest.json
  • Calculate working days from harvest time report.

    For income tax in Germany one can claim money back for each day. The time report can be obtained from here for each user. Than run this script:

$ working-days-calculator report.csv
Working days: 171 from 2022-01-12 00:00:00 to 2022-12-29 00:00:00

API References

harvest-invoice-calculator's People

Contributors

aldoborrero avatar bors[bot] avatar davhau avatar hsjobeki avatar jfroche avatar lassulus avatar mic92 avatar qubasa avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hsjobeki qubasa

harvest-invoice-calculator's Issues

Unknown transaction type ACCRUAL_CHARGE in transaction above of type ACCRUAL_CHARGE

Describe the bug

when running sevdesk-wise-importer

{'activityAssetAttributions': [],
 'amount': {'currency': 'EUR', 'value': -0.82, 'zero': False},
 'attachment': None,
 'date': '2023-09-01T12:49:39.712101Z',
 'details': {'description': 'EUR Assets service fee', 'type': 'ACCRUAL_CHARGE'},
 'exchangeDetails': None,
 'referenceNumber': 'ACCRUAL_CHECKOUT-invoice-7772810',
 'runningBalance': {'currency': 'EUR', 'value': 12089.28, 'zero': False},
 'totalFees': {'currency': 'EUR', 'value': 0.0, 'zero': True},
 'type': 'DEBIT'}

To Reproduce

Steps to reproduce the behavior:

run sevdesk-wise-importer

Expected behavior

returncode 0

Additional context

Use project default rate if task does not have an hourly rate set

I don't know if the convention before has been to set the hourly rate on each task type within a project explicitly, but currently the script is failing to work for me because the tasks I have recorded are billable but have no hourly rate set.

In this instance I would expect the script to fallback to the default project hourly rate.

Pip is missing for the `buildPythonApplication` python derivation?

Describe the bug

It seems like the buildPythonApplication python derivation is missing pip.

direnv: loading ~/code-root/github.com/numtide/harvest-invoice-calculator/.envrc                               
direnv: using nix
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
Executing setuptoolsShellHook
Obtaining file:///home/ninjatrappeur/code-root/github.com/numtide/harvest-invoice-calculator
  Preparing metadata (setup.py) ... done
Installing collected packages: harvest-exporter
  Running setup.py develop for harvest-exporter
Successfully installed harvest-exporter-0.0.1
--- Logging error ---
Traceback (most recent call last):
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1673, in print
    extend(render(renderable, render_options))
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1305, in render
    for render_output in iter_render:
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
    for segment in segments:
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/rich/console.py", line 1283, in render
    renderable = rich_cast(renderable)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
    if found_executable and os.path.samefile(
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/genericpath.py", line 101, in samefile
    s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/bin/pip'
Call stack:
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/self_outdated_check.py", line 236, in pip_self_version_check
    logger.warning("[present-rich] %s", upgrade_prompt)
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1489, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/lib/python3.10/logging/__init__.py", line 968, in handle
    self.emit(record)
  File "/nix/store/8vv7kyzmff6ng13mr0hk38hg9lk4hcg0-python3.10-pip-22.2.2/lib/python3.10/site-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3.1'),)
Finished executing setuptoolsShellHook
direnv: loading ~/code-root/github.com/numtide/harvest-invoice-calculator/.envrc.local
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +HARVEST_ACCOUNT_ID +HARVEST_BEARER_TOKEN +HARVEST_USER +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_PYTHONPATH +NIX_STORE +NM +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +_PYTHON_HOST_PLATFORM +_PYTHON_SYSCONFIGDATA_NAME +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

Looking at the $out/bin directory:

~/code-root/github.com/numtide/harvest-invoice-calculator (main) » ll /nix/store/xcaaly5shfy227ffs8nipxrd49b56iqq-python3-3.10.8/bin                                                        
total 32
lrwxrwxrwx 1 root root     9 janv.  1  1970 2to3 -> 2to3-3.10
-r-xr-xr-x 1 root root   150 janv.  1  1970 2to3-3.10
lrwxrwxrwx 1 root root     8 janv.  1  1970 idle -> idle3.10
lrwxrwxrwx 1 root root     8 janv.  1  1970 idle3 -> idle3.10
-r-xr-xr-x 1 root root   148 janv.  1  1970 idle3.10
lrwxrwxrwx 1 root root     9 janv.  1  1970 pydoc -> pydoc3.10
lrwxrwxrwx 1 root root     9 janv.  1  1970 pydoc3 -> pydoc3.10
-r-xr-xr-x 1 root root   133 janv.  1  1970 pydoc3.10
lrwxrwxrwx 1 root root    10 janv.  1  1970 python -> python3.10
lrwxrwxrwx 1 root root    10 janv.  1  1970 python3 -> python3.10
-r-xr-xr-x 1 root root 15616 janv.  1  1970 python3.10
-r-xr-xr-x 1 root root  3447 janv.  1  1970 python3.10-config
lrwxrwxrwx 1 root root    17 janv.  1  1970 python3-config -> python3.10-config
lrwxrwxrwx 1 root root    17 janv.  1  1970 python-config -> python3.10-config

Pip is not there anymore.

To Reproduce

  1. Checkout this repository.
  2. direnv allow .

flake.lock:

{
  "nodes": {
    "flake-utils": {
      "locked": {
        "lastModified": 1656928814,
        "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1659098164,
        "narHash": "sha256-BwEInGrJ/0N4iSGirOFCjoL7vwftc2E1vD6I69jkb84=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "bde80c54db106bf0de020898b7922c0e70476260",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "master",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.