To install this application, first ensure you have Composer installed, then:
# clone the repository
$ git clone [email protected]:medunes/cache-billing.git
# Enter your app folder
$ cd cache-billing
# Install dependencies
$ composer setup:clean
# Run the build script (phpunit, psalm, phpstan etc.)
$ composer build
- Cache Billing (CB) customers are receiving a bill, which is based on the page impressions (PI) their online shop made in the last month.
- The billing amount of the invoice depends on the PI, and the cost is based per 100,000 PI.
- Currently, Cache Billing is generating a CSV "CacheBilling_1.csv", which includes date, URL, pi / day, and pi / day.
- Based on this CSV, Cache billing system will generate a Bill, in PDF format, which will be delivered to the customer.
-
The bill report contains the following information:
-
The current effort when a new customer signs a contract is to open the file Template_Bill.odt and create a new template for that new customer editing following items:
- Invoice address of the client
- Sender address
- Phone
- Fax
- Header
- Footer
- Column heading
- Text in column "Usage"
- Calculation of the invoice amount
- Due date of the payment
- Signature
-
100,000 PI x Unit Price = CacheBilling-cost per month excluding VAT
Depending on the BC package the costs varies: -
Basic = 50, - €
-
Professional = 120, - €
-
Enterprise = custom
docker compose up --build -d
docker compose exec --user=1000:1000 php-cli bash
PHP_VERSION
can be changed from the .env (default isPHP_VERSION=8.0
)- If you face permission issues, most probably it is about your host's UID is not 1000. (1000 is the Debian/Ubuntu/Linux deafault UID).
As this is not a fully featured project, you might adjust this to your needs by changing the
1000
to your UID. Changes should go under theDockerfile
anddocker-compose.yml
.
This is an example of a bill generation command:
bin/console cache:bill:generate john_doe -y 2020 -m 12 -x odt -x html -vvv 2>&1 >/dev/null
And the result will look like this:
16:16:59 INFO [app] Successfully generated Cache Bill
[
"customer" => "john_doe",
"billMonth" => "12",
"billYear" => "2020",
"exportType" => [
"odt",
"html"
],
"generatedFiles" => [
"cache-billing/public/export/john_doe/2020/12/2021-M1234.odt",
"cache-billing/public/export/john_doe/2020/12/2021-M1234.html"
]
]
Under the public/export folder.
Everytime you generate an export for a customer names "John Doe" for the month December of year 2020, a folder tree: public/export/john_doe/2020/12 will be automatically created, and the last version of the exported bills (html and/or odt) can be found there
Yes, but not out of the box. The application exports the bill to an HTML file, fitted to an A4 size. You only have to launch the File->Print menu from your browser and save it as a PDF ;)
This is very easy!
Open the download/customer/customers.ods file, and then add rows corresponding to customers' data
Yes, the -f or --files option accepts a list of file paths.
Once you provide these files, hte application will combine them all and make a one "table" out of them
Yes!
Just edit and activate the cron under etc/crontab/sync.cron It is currently configured to download the latest cache export file every start of a month, it should hold the name cache-2021-01.csv for example for the month February 2021
It will also download customers data file data daily (customers.ods)
Take your time to adjust this schedules from sites like this one https://crontab.guru/
Also do not forget to replace the placeholders of the remote file locations in the crontab file
Definitely. It follows the principle of configuration over code.
Mainly, the system is highly and easily configurable through the config/services.yaml file.
There you can explore and edit many parameters. Just as an example you can manually change the placeholders of the template, the headers of the cache CSV or the export path.
Although a navigation throughout the code can (hopefully) answer this question, here is a dataflow
diagram explaining how the bill is generated.