Commit de918446 authored by Dmitrii Poddubnyi's avatar Dmitrii Poddubnyi
Browse files

initial

parents
Pipeline #5833 passed with stages
in 1 minute and 3 seconds
.git
/.env.local
**/.env.*
**/.app_env*
**/*.log
**/._*
**/.DS_Store
**/.gitignore
**/.gitattributes
**/Thumbs.db
**/*.md
**/.dockerignore
Dockerfile*
docs/
node_modules/
public/build/
public/bundles/
var/
vendor/
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=3247a721904471e968b39c1652eff071
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://dev:dev@127.0.0.1:3316/qb_api?serverVersion=mariadb-10.2.22
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
MAILER_DSN=smtp://localhost
###< symfony/mailer ###
###> symfony/amazon-mailer ###
# MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
# MAILER_DSN=ses+smtp://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
###< symfony/amazon-mailer ###
DOMAIN=app.easyquickimport.com
WEBDAV_URL=
WEBDAV_USERNAME=
WEBDAV_PASSWORD=
WEBDAV_PATH=
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='s$cretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/.idea
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
#ENV variables: https://docs.gitlab.com/ce/ci/variables/
image: karser/docker-compose-ci
stages:
- test
- build
- deploy
before_script:
- docker -v && docker-compose -v
test dev:
stage: test
only:
refs:
- branches
variables:
COMPOSE_PROJECT_NAME: "easyquickimport_test${CI_JOB_ID}"
DOCKER_ENV: test
APP_ENV: test
script:
- cd docker
- bin/copy-env.sh
- bin/build.sh
- docker-compose run --rm php sh -c "bin/run-tests.sh"
after_script:
- cd docker
- docker-compose down --remove-orphans
artifacts:
expire_in: 1 week
when: always
paths:
- var/log
build image:
stage: build
variables:
DOCKER_ENV: prod
APP_ENV: prod
script:
- cd docker
- bin/copy-env.sh
- bin/build.sh
- bin/push.sh
deploy prod:
stage: deploy
environment:
name: easyquickimport-prod
url: https://app.easyquickimport.com/
only:
- tags
- branches
when: manual
variables:
DOCKER_ENV: prod
ENVIRONMENT: prod
APP_ENV: prod
COMPOSE_PROJECT_NAME: easyquickimport
VIRTUAL_HOST: app.easyquickimport.com
DATABASE_HOST: ${HZ4_DB_HOST}
MAILER_DSN: ${PROD_MAILER_DSN}
DATABASE_URL: ${PROD_DATABASE_URL}
# connect to the server
DOCKER_TLS_VERIFY: "1"
DOCKER_HOST: $HZ4_DOCKER_HOST
DOCKER_CERT_PATH: "/tmp/certs"
before_script:
- mkdir -p $DOCKER_CERT_PATH
- echo "$HZ4_CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$HZ4_CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem
- echo "$HZ4_CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem
- ls -alh $DOCKER_CERT_PATH
- echo ${CI_REGISTRY_PASSWORD} | docker login ${CI_REGISTRY} -u ${CI_REGISTRY_USER} --password-stdin
script:
- cd docker
- bin/copy-env.sh
- docker-compose config | docker stack deploy --with-registry-auth -c - ${COMPOSE_PROJECT_NAME}
after_script:
- rm -rf $DOCKER_CERT_PATH
ARG PHP_VERSION=7.4
ARG NGINX_VERSION=1.18.0
# "php base" stage
FROM php:${PHP_VERSION}-fpm-alpine AS app_php_base
# persistent / runtime deps
RUN apk add --no-cache \
acl \
bash \
fcgi \
file \
gettext \
git \
freetype \
libjpeg-turbo \
libpng \
nano \
;
ARG APCU_VERSION=5.1.18
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
postgresql-dev \
zlib-dev \
; \
\
docker-php-ext-configure zip; \
docker-php-ext-configure gd \
--with-freetype=/usr/include/ \
--with-jpeg=/usr/include/ \
; \
docker-php-ext-install -j$(nproc) \
gd \
intl \
mysqli \
pdo \
pdo_mysql \
zip \
; \
pecl install \
apcu-${APCU_VERSION} \
; \
pecl clear-cache; \
docker-php-ext-enable \
gd \
apcu \
# opcache \
mysqli \
pdo_mysql \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .api-phpexts-rundeps $runDeps; \
\
apk del .build-deps
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY docker/php/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/app.ini
RUN set -eux; \
{ \
echo '[www]'; \
echo 'ping.path = /ping'; \
echo 'clear_env = no'; \
} | tee /usr/local/etc/php-fpm.d/docker-config.conf
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
# install Symfony Flex globally to speed up download of Composer packages (parallelized prefetching)
RUN set -eux; \
composer global require "symfony/flex" --prefer-dist --no-progress --no-suggest --classmap-authoritative; \
composer clear-cache
ENV PATH="${PATH}:/root/.composer/vendor/bin"
WORKDIR /var/www/app
# "php prod" stage
FROM app_php_base AS app_php
# prevent the reinstallation of vendors at every changes in the source code
COPY composer.json composer.lock symfony.lock ./
RUN set -eux; \
composer install --prefer-dist --no-dev --no-scripts --no-progress --no-suggest; \
composer clear-cache
# do not use .env files in production
COPY .env ./
RUN composer dump-env prod; \
rm .env
# copy only specifically what we need
COPY bin bin/
COPY config config/
COPY public public/
COPY src src/
COPY templates templates/
COPY translations translations/
RUN set -eux; \
mkdir -p var/cache var/log; \
composer dump-autoload --classmap-authoritative --no-dev; \
composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync
VOLUME /var/www/app/var
COPY docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
# "nginx" stage
# depends on the "php" stage above
FROM nginx:${NGINX_VERSION}-alpine AS app_nginx
ADD ./docker/nginx/nginx.conf /etc/nginx/
COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
WORKDIR /var/www/app/public
COPY --from=app_php /var/www/app/public ./
ARG PUID=1000
ARG PGID=1000
RUN if [[ -z $(getent group ${PGID}) ]] ; then \
addgroup -g ${PGID} www-data; \
else \
addgroup www-data; \
fi; \
adduser -D -u ${PUID} -G www-data www-data
MIT License
Copyright (c) 2021 Dmitrii Poddubnyi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# EasyQuickImport — Import transactions, invoices and bills into QuickBooks Desktop from Excel or CSV
[![Build Status](https://gitlab.dev.trackmage.com/karser/easyquickimport/badges/master/pipeline.svg)](https://gitlab.dev.trackmage.com/karser/easyquickimport/pipelines)
[![Total Downloads](https://poser.pugx.org/karser/easy-quick-import/downloads)](https://packagist.org/packages/karser/easy-quick-import)
EasyQuickImport is a tool that helps you import invoices, bills, transactions,
customers and vendors into QuickBooks Desktop in multiple currencies in bulk.
### Features
- **Invoices, bills, transactions (General Journal entries), customers, and vendors import in csv, xlsx, xls formats.**
- **Multicurrency support with NON-USD base currency**. The currency of your accounts is automatically detected
from the imported Chart of accounts.
- **Cross Currency Transactions**. Transfer between accounts of different currencies goes through the Undeposited
funds account. The Undeposited funds balance remains zero because EasyQuickImport uses the accurate historical exchange rate.
- **Historical exchange rate**. EasyQuickImport automatically obtains the exchange rate from European Central Bank
on a given date for any currency for each transaction. You can use [other exchange rate sources](https://github.com/florianv/exchanger) as well.
- **Multi-tenancy**: if you have multiple company files on the same computer, you can add them all to EasyQuickImport.
## Getting started:
Either install [self-hosted](#how-to-install-easyquickimport) or [sign up](https://app.easyquickimport.com/register) for a free cloud account.
### Connect EasyQuickImport to QuickBooks Desktop
**In EasyQuickImport**:
Add a company file in Users, define username, password and specify the home currency.
It's recommended to specify the company file location if you are going to use multiple company files on the same computer.
Once it's done download the QWC file.
**In Quickbooks** click `File / Update Web Services`
Then Add an Application, in the file dialog select the downloaded QWC.
Then click Yes, then select "When company file is open" and click continue.
When it's done don't forget to specify the password that you defined in EasyQuickImport.
[![Connect EasyQuickImport to QuickBooks Desktop](https://user-images.githubusercontent.com/1675033/117167904-5a9d6780-add0-11eb-901d-8228443be18c.png)](https://www.youtube.com/watch?v=6kVJrthCQr0)
### How to import invoices from Excel into QuickBooks Desktop
[![Import invoices from Excel into QuickBooks Desktop](https://user-images.githubusercontent.com/1675033/117167991-7274eb80-add0-11eb-99ef-e6f27e72e509.png)](https://www.youtube.com/watch?v=ZKe002JUIww)
### How to import transactions from Excel into QuickBooks Desktop
[![How to import transactions from Excel into QuickBooks Desktop](https://user-images.githubusercontent.com/1675033/117168077-83bdf800-add0-11eb-8ad9-9d8668164752.png)](https://www.youtube.com/watch?v=-hmhxs72W1E)
### How to import bills and vendors from Excel into QuickBooks Desktop
[![How to import bills and vendors from Excel into QuickBooks Desktop](https://user-images.githubusercontent.com/1675033/117168137-90dae700-add0-11eb-826d-b09c1cbd1b71.png)](https://www.youtube.com/watch?v=vcSeREomzuE)
### How to import multicurrency transactions from Excel into QuickBooks Desktop
[![How to import multicurrency transactions from Excel into QuickBooks Desktop](https://user-images.githubusercontent.com/1675033/117168217-a223f380-add0-11eb-8033-def86fc9c824.png)](https://www.youtube.com/watch?v=NvMpb3wVIXc)
## How to install EasyQuickImport
1. Clone the repo
```
git clone https://github.com/karser/EasyQuickImport.git
```
2. Install packages with composer
```
composer install
```
3. Copy `.env` to `.env.local` and configure DATABASE_URL and DOMAIN
4. Recreate the database
```
bin/console doctrine:schema:drop --full-database --force \
&& bin/console doctrine:migrations:migrate -n
#fixtures
bin/console doctrine:fixtures:load
```
5. Create the user
```
bin/console app:create-user user@example.com --password pass123
```
6. Run the server
```
cd ./public
php -S 127.0.0.1:9090
```
### Tests
```
bin/phpunit
```
### phpstan
```
vendor/bin/phpstan analyse -c phpstan.neon
vendor/bin/phpstan analyse -c phpstan-tests.neon
```
### Lookup historical currency rate
```
bin/console app:currency:get USD --date 2020-03-05 --base HKD
```
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
#!/usr/bin/env php
<?php
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
#!/usr/bin/env bash
set -e
if [[ ! -e ./public/build/manifest.json ]]; then
mkdir -p ./public/build
echo "{}" > ./public/build/manifest.json
fi
composer install --dev --prefer-dist --no-interaction --no-scripts --no-progress --no-suggest
echo "Waiting for db to be ready..."
until bin/console doctrine:query:sql "SELECT 1" > /dev/null 2>&1; do
sleep 1
done
bin/console doctrine:migrations:migrate --no-interaction
vendor/bin/simple-phpunit -c ./phpunit.xml.dist
{
"name": "karser/easy-quick-import",
"type": "project",
"description": "Import transactions, invoices and bills into QuickBooks Desktop from Excel or CSV",
"keywords": ["quickbooks", "quickbooks-desktop", "quickbooks-web-connector", "importer"],
"homepage": "https://github.com/karser/EasyQuickImport",
"license": "MIT",
"require": {
"php": "^7.4",
"ext-ctype": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-sqlite3": "*",
"ext-json": "*",
"consolibyte/quickbooks": "dev-qbxmlops130",
"craue/formflow-bundle": "^3.3",
"doctrine/doctrine-bundle": "^1.11",
"doctrine/doctrine-migrations-bundle": "^2.0",
"doctrine/orm": "^2.6",
"easycorp/easyadmin-bundle": "^2.2",
"florianv/exchanger": "^2.7",
"league/flysystem-webdav": "^1.0.7",
"nyholm/psr7": "^1.1",
"oneup/flysystem-bundle": "^3.1",
"php-http/guzzle6-adapter": "^2.0",
"php-http/message": "^1.7",
"phpoffice/phpspreadsheet": "^1.7",
"ramsey/uuid": "^4.0",
"symfony/amazon-mailer": "*",
"symfony/console": "*",
"symfony/dotenv": "*",
"symfony/flex": "^1.1",
"symfony/form": "*",
"symfony/framework-bundle": "*",
"symfony/http-client": "*",
"symfony/mailer": "*",
"symfony/monolog-bundle": "^3.5",
"symfony/security": "*",
"symfony/security-bundle": "*",
"symfony/serializer-pack": "^1.0",
"symfony/translation": "*",
"symfony/twig-bundle": "*",
"symfony/validator": "*",
"symfony/yaml": "*",
"symfonycasts/reset-password-bundle": "^1.1"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"repositories": [
{
"type": "git",
"url": "https://github.com/karser/quickbooks-php.git"
}
],
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"symfony/maker-bundle": "^1.16",
"symfony/test-pack": "^1.0",
"symfony/flex": "^1.6"
}