Skip to content

Development Progress

Ross Addison edited this page Aug 22, 2023 · 17 revisions
Development Summary: (...resources/views/invoice/info/invoice.php)

Aim: To develop a similar invoicing system to InvoicePlane integrating with the latest Jquery, and security features of Yii3 using wampserver as a test platform for WAMP and also Ubuntu 22.04 LTS for LAMP.

To Do's - Longer Term Goals

1. Integration of Payment GatewaysPCI Compliant Stripe, Amazon Pay, and Braintree have been introduced.

2. Accountant Role with the ability of an accountant/bookkeeper to record payments against invoices.

3. Include a Company Private Detail specific logo on an invoice.

4. Acceptance Tests for Invoice

5. Further validation and exceptions to be included in testing of e-Invoicing using PeppolHelper.

6. Filters to be introduced on grids

7. Improve Generator index template using Yiisoft functions.

8. Include Product images

9. Integrate https://github.com/php-finance/double-entry

Pdf template construction upon emailing.

Work on info issues

Work In Progress - Shorter Term Goals

Psalm Level 2 - Testing

Dead Code Removal with Psalm 3 Testing

Language array generator using Google Translate

All invoices with dates falling within CompanyPrivate start and end dates will have the specific logo uploaded

for this CompanyPrivate record attached to these invoices.

CompanyPrivate logo will be automatically input on invoice/quotes depending on whether the date of the invoice falls between the start and end date.

Introducing Paypal.

Introducing India's PayTm payment gateway's QR code method of payment and comparing this with Stripe's method.

A General Sales Tax (GST) Tax System will have to be implemented first for this purpose.

20 August 2023

Each Product has an additional field called Additional Item Property Name and Value. These product properties can be added from the product view.

A number of Additional Properties can be added to a product now by means of the Product Property Entity.

Introduce Peppol (src\Invoice\Helpers\Peppol\PeppolHelper)

An Ecosio validated 0 error xml e-invoice can be generated.

Introduce StoreCove (src\Invoice\Helpers\StoreCove\StoreCoveHelper)

A Storecove Json Encoded Invoice can be generated.

Requirement 1:

With VAT enabled - VAT Invoices can now be created.

Requirement 2:

Store Cove Api connection functions have been created. (src\Invoice\InvoiceController.php store_cove_call_api)

Requirement 3:

Xml electronic invoices - Can be output if the following sequence is followed:

a: A logged in Client sets up their Peppol details on their side via Client...View...Options...Edit Peppol Details for e-invoicing.

b: A quote is created and sent by the Administrator to the Client.

c: A logged in Client creates a sales order from the quote with their purchase order number, purchase order line number, and their contact person in the modal.

d: A logged in Client, on each of the sales order line items, inputs their line item reference number. (Mandatory or else exception will be raised).

e: A logged in Administrator, requests that terms and conditions be accepted.

f: A logged in Client accepts the terms and conditions.

g: A logged in Administrator, updates the status of the sales order from assembled, approved, confirmed, to generate.

h: A logged in Administrator can generate an invoice if the sales order status is on 'generate'

i: A logged in Administrator can now generate a Peppol Xml Invoice using today's exchange rates setup on Settings...View...Peppol Electronic Invoicing...One of From Currency and One of To Currency

j: Peppol exceptions will be raised.

22 March 2023

Preparation for Peppol e-Invoicing: UBL classes created using num-num/ubl-invoice. See folder src/Invoice/Ubl. Psalm Level 1 tested.

Html of invoice can be created - modal_inv_to_html - under View...Options

Logo introduced on invoices

A common company logo and address template created under invoice/setting/views.

A sumex extension table of table Invoice created. - Generating a sumex pdf is in its infancy.

Removed extensions causing DOM errors. F12 not carrying any errors.

Simplified Introductory Slider

Created 3 additional 'Yes/No' settings for 1. Stream (G Icon) 2. Archive (folder icon) 3. Html code (code icon) under Pdf Settings

Archives are saving consistently under src/Invoice/Uploads/Archives

Bugfix: Delete inv item redirects to interim page properly.

Bugfix: Cannot delete item if Invoice has 'sent' status.

Zugferd Invoices are archived under Invoice/Uploads/Temp/Zugferd wiht a random string filename.

04 March 2023

Introduce ZugferdHelper and ZugferXml

LoginForm and SignUp form - Extend both forms with RulesProviderInterfacehttps://github.com/yiisoft/form/pull/249

Psalm Level 1 Testing - 0 errors

23 February 2023

Psalm Level 1 Testing - 1 error - Framework related

ERROR: ImplementedReturnTypeMismatch - vendor/yiisoft/form/src/FormModel.php:218:33 - The inherited return type 'iterable>' for Yiisoft\Validator\RulesProviderInterface::getRules is different to the implemented return type for Yiisoft\Form\FormModel::getrules 'array' (see https://psalm.dev/123) public function getRules(): array

31 January 2023

Psalm Level 2 Testing - 0 errors

Bug Fix: Edit Task

28 January 2023

Helpers\CountryHelper\get_country_list

The following code is functional but results in UnresolvableInclude: Worth coming back to.

Psalm Level 2 Testing - Submission 1

`/**

  • Returns an array list of cldr => country, translated in the language $cldr.
  • If there is no translated country list, return the english one.
  • @param string $cldr
  • @return mixed
    /
    public function get_country_list(string $cldr) : mixed
    {
    $new_aliases = new Aliases(['@helpers' => DIR, '@country_list' => '@helpers/Country-list']);
    $file = $new_aliases->get('@country_list') .DIRECTORY_SEPARATOR. $cldr .DIRECTORY_SEPARATOR.'country.php';
    $default_english = $new_aliases->get('@country_list') .DIRECTORY_SEPARATOR.'en'.DIRECTORY_SEPARATOR.'country.php';
    if (file_exists($file)) {
    /
    *
  • @psalm-suppress UnresolvableInclude
    /
    return (include $file);
    } else {
    /
    *
  • @psalm-suppress UnresolvableInclude
    */
    return (include $default_english);
    }
    }
    `

27 January 2023

Psalm Level 3 Testing (0 errors)

Testing

Upgrade Amazon Pay: 2.4.0 => 2.5.1

Test Amazon Pay with a Client logon.

1. Client has been registered as a User via Yii Demo.

2. Client's User id has been transferred to UserInv via Settings ... User Account...+ by means of an Admin logon

3. Client's client_id has been assigned to their user_id via Settings ... User Account ...Assigned Clients by means of an Admin logon.

Remove unknown region 'gb' bug. Admin must select one of three amazon regions in dropdown under Settings ... Online Payment.

Include Amazon's 3 standard regions ie. North America, Europe, and Japan in regions dropdown on Amazon_pay Settings Payment Gateway.

If region is not set, default to 'eu' in PaymentInformation/amazon_get_region

Include default time/zone under InvoiceController

23 January 2023

Psalm Level 3 Testing (0 errors)

Improve security of client viewing their quotes/invoices online with following code in InvController/url_key function

// After signup the user was included in the userinv using Settings...User Account...+ $user_inv = $uiR->repoUserInvUserIdquery($currentUser_getId); // The client has been assigned to the user id using Setting...User Account...Assigned Clients $user_client = $ucR->repoUserClientqueryCount($currentUser_getId, $inv->getClient_id()) === 1 ? true : false; if ($user_inv && $user_client) {

If the currentUser getId returns a null value they are a guest. See documentation. Yiisoft/CurrentUser

Note: The Psalm PossiblyNullArgument has to be suppressed here to allow for a possible null value here for validation of Yiisoft guest status.

No user with Yiisoft guest status is allowed in.

3 January 2023

Issue 559

Uzbek Introduced

Psalm Level 7,6,5,4 Testing (0 errors)

2 January 2023

Psalm Level 7,6,5,4 Testing (0 errors)

30 December 2022

12 Post-setup Steps to Introducing Azerbaijani language

1. config/params {locales}

2. views/layout/invoice.php {az_Asset and menu construction}

3a. views/layout/main.php {menu construction}

3b. views/layout/guest.php {menu construction}

4. SettingRepository/locale_language_array

5. Settings...Views...Google Translate...select locale from dropdown

6. Generator... Translate src/Invoice/Language/English/ip_lang.php

7. Generator... Translate src/Invoice/Language/English/gateway_lang.php

8. Generator... Translate src/Invoice/Language/English/app_lang {copied from ...resources/messages/en/app.php

9. Retrieve from ...views/invoice/generator/output_overwrite

10. copy output_overwrite/_ip_lang to src/Invoice/Language/{new language}

11. copy output_overwrite/_gateway_lang to src/Invoice/Language/{new language}

12. copy output_overwrite/_app.php to ...resources/messages/{new locale}

Issue 559

Psalm level 4 php ./vendor/bin/psalm --alter --issues=InvalidReturnType,MissingReturnType,LessSpecificReturnType,MissingParamType --dry-run

29 December 2022

Psalm Level 4 Testing (0 errors)

Using Generator...Translate{language file} and Setting...View...Google Translate...locale,

Afrikaans, Russian, German, Ukrainian, Vietnamese language folders generated using Google Translate

Locale related files adjusted:

...src/Invoice/Setting/SettingRepository/locale_language_array/{insert the locale}

...src/Invoice/Asset/i18nAsset/{create your file with class name the same as the file name}

...resources/views/layout/main.php/{insert the language menu item}

...resources/views/layout/invoice.php{insert the 'use' namespace, 'case', and menu item.

...adjust the config/params 'locales' setting.

28 December 2022

Google Translate included to generate language files ie. ip_lang.php, gateway_lang.php, app.php for a locale.

Examples here

[Build your cloud project](https://console.cloud.google.com/iam-admin/serviceaccounts/details/ %20%20%20%20%20%20%20%20//%20{unique_project_id}/keys?project={your_project_name})

Steps to get the Json file that must be saved in src/Invoice/google_tranlate_unique_folder

1: Download https://curl.haxx.se/ca/cacert.pem into active c:\wamp64\bin\php\php8.1.12 folder

2: Select your project that you created under https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts?supportedpurview=project'

3: Click on Actions icon and select Manage Keys

4: Add Key

5: Choose the Json File option and Download the file to src/Invoice/Google_translate_unique_folder

6: You will have to enable the Cloud Translation API and provide your billing details. You will be charged 0 currency

7: Move the file from views/generator/output_overwrite to eg. src/Invoice/Language/{your language}

Step to choose a locale for translation: Settings...View...Google Translate...{dropdown}...save

Steps to generate eg. ip_lang.php

1: Generator ...Translate English\ip_lang.php

2: Either copy the array from off the screen or move it from ..resources/views/generator/output_overwrite into the appropriate folder

3. The separator ie. 'YYYY' will enable you to do a search and replace ie search 'YYYY' and replace ', to provide a comma separating each array item from the screen outputted array with a comma.

4. Dont forget to restart Netbeans 16 after adjusting C:\Program Files\NetBeans-16\netbeans\etc\netbeans.conf and inserting "-J-Dfile.encoding=UTF-8" to parameter "netbeans_default_options". when dealing with languages with special characters.

26th December 2022

Include additional demo languages

24th December 2022

1. Retesting Sending of invoices by email.

2. Remove 55 Psalm Errors mostly related to Issue #5

3. Psalm Level 7,6,5,4 Testing using Psalm 5.4 instead of 4.3

4. Auditing of Setting...View...Invoice...Default Public Template and Mark Invoices Sent Copy

.

5. Moved rossaddison/yii-invoice to rossaddison/yii3-i.

6. Resynced rossaddison/yii-invoice fork.

20th December 2022

1. Moved repository into separate working folder under blog, and blog-api for separate github workflow purposes.

2. Invoice works separately from blog. There are no hyperlinks to blog.

3. The Entity User's relations to comment and post have been removed since these are no longer needed.
However the user that is registered under the demo still has to be added to the userinv table using Setting...User Account.

4. New Setting: Invoices marked as 'sent' when copying so that a client can view them online immediately without having to be sent by email. See Settings...View...Invoices...Other Settings. This is also useful for testing a series of invoices against a payment gateway.

5. A checkbox 'sandbox' has been added to the SettingsRepository/payment_gateways array for amazon_pay, and braintree. If you plan to use a language other than English, you will need to include 'online_payment_sandbox' => 'Sandbox', in the corresponding src/Invoice/Language/{your_language}/gateway_lang.php file. ie. check that the gateway_lang.php in the English folder corresponds with your language folder.

6. The omnipay payment gateway with stripe will give the following warning (which is not recommended to accept):

Payment failed. Please try again. Response: Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing.

You will have to go into https://dashboard.stripe.com/settings/integration and toggle the following screen.

7. Github Static Analysis: Psalm Level 7,6,5,4 testing - errors 0

8. The function src\User\Console\AssignRoleCommand and CreateCommand is functional as the observer role can be assigned to a client with the result ending up as an assignment in ...invoices/resources/rbac

How to reach Psalm level 4 the following code is needed to suppress Psalm errors on level 4:

9. Braintree Payment Gateway has been introduced.

/** * @psalm-suppress InvalidReturnType, InvalidReturnStatement, UndefinedInterfaceMethod */

This will need to be looked at later.

10th December 2022

Github Static Analysis: Psalm Level 7,6,5,4 testing - errors 0

1. Payment and Merchant (Online log) views upgraded to GridView.

2. A subarray has been added to the gateway array under SettingRepository/payment_gateways function 'version' => array( 'type' => 'checkbox', 'label' => 'Omnipay Version' )
This is to facilitate the introduction of PCI compliant gateways. The two pci compliant tested gateways introduced here are: Stripe version 10 and Amazon_Pay.

3. If the above 'Omnipay version' checkbox is left unchecked for the specific gateway, you are implying that it is PCI compliant.

4. Uncheck 'Omnipay version' for Stripe Version 10 and the latest Amazon_Pay which have been introduced here.

5. The guest url has been removed from the guest view. The user/client when logged in with 'observer role', has a list of enabled gateways in a list under options under the guest's invoice view.

6. Stripe version 10 is PCI compliant because their js.stripe.com/v3 cdn is dealt with directly and no credit card details are shared.

7. Amazon Pay is PCI compliant because the user/client has to be logged into amazon.co.uk before they can use the Amazon Button. No credit card details are shared.

8. The PaymentInformationForm includes place to enter credit card details but this form only presents itself with Omnipay version checked gateways.

9. The PaymentInformationController handles Omnipay and PCI compliant gateways.

10. Amazon_Pay has been integrated with productType set to PayOnly (see function form) so clients can pay if they have an Amazon Account.

11. Register as a developer under Stripe to test the Omnipay Integration.

12. The following code under ...resources/views/invoice/paymentinformation/payment_information_stripe_pci is of importance.

. 'async function initialize() {' // To avoid Error 422 Unprocessible entity // const { clientSecret } = await fetch("/create.php", { // method: "POST", // headers: { "Content-Type": "application/json" }, // body: JSON.stringify({ items }), // }).then((r) => r.json()); . 'const { clientSecret } = {"clientSecret": "'. $client_secret .'"};' . 'elements = stripe.elements({ clientSecret });' . 'const paymentElementOptions = {' . 'layout: "tabs"' . '};' . 'const paymentElement = elements.create("payment", paymentElementOptions);' . 'paymentElement.mount("#payment-element");' . '}'

13. Stripe version 10 is working for debit/credit cards and for bacs. Login as a user with observer role.

14. Amazon Pay v2.40 is working if you are signed in to Amazon concurrently. Login as a user with observer role.

15. The PaymentController and MerchantController guest related functions adopt the same approach as the InvController:

`// Get the current user and determine from (@see Settings...User Account) whether they have been given
// either guest or admin rights. These rights are unrelated to rbac and serve as a second
// 'line of defense' to support role based admin control.

// Retrieve the user from Yii-Demo's list of users in the User Table
$user = $this->user_service->getUser();

// Use this user's id to see whether a user has been setup under UserInv ie. yii-invoice's list of users
$userinv = ($uiR->repoUserInvUserIdcount((string)$user->getId()) > 0
? $uiR->repoUserInvUserIdquery((string)$user->getId())
: null);

// Determine what clients have been allocated to this user (@see Settings...User Account)
// by looking at UserClient table

// eg. If the user is a guest-accountant, they will have been allocated certain clients
// A user-quest-accountant will be allocated a series of clients
// A user-guest-client will be allocated their client number by the administrator so that
// they can view their invoices and make payment
$user_clients = (null!== $userinv ? $ucR->get_assigned_to_user($user->getId()) : []);`

To configure Amazon Pay you will need your Merchant ID, Public Key, Public Key ID and Private Key.

To find your keys and IDs:

  1. sign in to your Amazon Payments merchant account in Seller Central
  2. click Integration, and then click Integration Central
  3. select your Integration channel
  4. choose your ecommerce solution provider, or choose self-developed
  5. choose your payment type in the Payment type dropdown
  6. click Get instructions, and then click Create keys in the Instructions section

To enable the Sign in with Amazon button on your website, you will need a Client ID/Store ID.

To create a Client ID/Store ID or to manage applications:

  1. sign in to your Amazon Payments merchant account in Seller Central
  2. choose Amazon Pay (Production View) from the dropdown on top of the page
  3. click Integration within the navigation bar, and then click Integration Central
  4. scroll to the end the page and click View Client ID/Store ID(s), or click Create new Client ID/Store ID

Api Key - private key not used in the package and not to be shown to anybody. It can be stored in the database if you choose.

Publishable Key eg. pk_... - Goto Stripe DashBoard at https://dashboard.stripe.com and store in Setting...View...Online Payment...Stripe

Secret Key eg sk_... - Goto Stripe DashBoard at https://dashboard.stripe.com and store in Setting...View...Online Payment...Stripe

All keys viewed by phpMyAdmin are encoded with Crypt and bear no resemblance to the original keys.

javascript $client_secret in views/invoice/paymentinformation/payment_information_stripe_pci.php - generated by Payment Intent in PaymentInformationController/get_stripe_pci_client_secret based on data passed to payment intent.

...resources/views/layout/invoice.php and quest.php incorporate the following settings which will load either the Stripe asset or the Amazon Pay Asset

// '0' => PCI Compliant version $s->get_setting('gateway_stripe_version') == '0' ? $assetManager->register(stripe_v10_Asset::class) : ''; $s->get_setting('gateway_amazon_pay_version') == '0' ? $assetManager->register(amazon_pay_v2_4_Asset::class) : '';

Enable these Payment Gateways under Settings...Views...Online Payment

11th November 2022

Bug fix: Include Integration 18.066. Paginators working with external status by inserting status into urlArguments.

OffsetPagination::widget() ->menuClass('pagination justify-content-center') ->paginator($paginator) // No need to use page argument since built-in. Use status bar value passed from urlGenerator to quote/guest ->urlArguments(['status'=>$status]) ->render(), )

8th November 2022

Add tabs draft, sent, viewed, approved, canceled, rejected to client view quote

Add tabs draft, sent, viewed, paid to client view invoice

4th November 2022

Psalm level 7,6,5,4 testng - 0 errors

Bugfixing quotes and invoices

Moved views to resources.

25th October 2022

Invoice, Quote, Product, UserInv GridView adjusted for latest Gridview code adjustments. Product table can now be sorted.

All tables sort with descending ie. minus sign attached to Sort:: array's id ie. -id

$sort = Sort::only(['status_id','number','date_created','date_due','id','client_id']) // (@see vendor\yiisoft\data\src\Reader\Sort // - => 'desc' so -id => default descending on id // Show the latest quotes first => -id ->withOrderString($query_params['sort'] ?? '-id');

The email config params mentioned in 11th October, now have to be linked to the Email Sending Method on Setting...Email...Email Sending Method.

The following code added to the end of the latest yiisoft/demo composer.json ensures that rossaddison/yii-invoice

will work with psr-3. The dev-psr-3 branch will be picked up.

"rossaddison/mpdf": "*"

Psalm Level - 7,6,5,4 Testing - 0 errors

Include start date and end date on CompanyPrivate Entity

Archived pdf can now be sent automatically with singular email attachment using Setting...View...Email...Attach Quote/Invoice on email?

MailerHelper/yii_mailer_send function
$path_info = pathinfo($pdf_template_target_path); $path_info_file_name = $path_info['filename']; $email_attachments_with_pdf_template = $email->withAttached(File::fromPath(FileHelper::normalizePath($pdf_template_target_path), $path_info_file_name, 'application/pdf') );

11h October 2022

Psalm Level - 7,6,5,4 Testing - 0 errors

Setting...View...Email shows some config/params.php settings using SettingRepository config_params function.

public function config_params() : array { $config = ConfigFactory::create(new ConfigPaths(dirname(dirname(dirname(__DIR__))), 'config/'), null); $params = $config->get('params'); $config_array = [ 'esmtp_scheme' =>$params['symfony/mailer']['esmtpTransport']['scheme'], 'esmtp_host'=>$params['symfony/mailer']['esmtpTransport']['host'], 'esmtp_port'=>$params['symfony/mailer']['esmtpTransport']['port'], 'use_send_mail'=>$params['yiisoft/mailer']['useSendmail'] == 1 ? $this->trans('true') : $this->trans('false'), ]; return $config_array; }

Continue with auditing of settings

Bug fix with test data

4th October 2022

Psalm Level 4 Testing Complete - 150 errors removed.

1st October 2022

Files can be attached to invoices. Security measure is_uploaded_file php function using specifically a tmp file. See InvController/attachment_move_to function.

Add adjustments to Generator Templates

21st September 2022

Simplify accesschecker permissions to 4 basic permissions ie. editInv, and viewInv, and editPayment and viewPayment and editUser for all controllers.

Inclusion of Yii's php form code replacing Html code on forms mailer_quote and mailer_invoice.

Psalm Level 6 - 155 errors removed. Remaining errors are yii-demo related.

Psalm Level 5 - 47 errors removed. Remaining errors are yii-demo related.

YiiMailer (adaptation of Symfonymailer) replaces phpmailer utilizing the code provided in yii-demo.

Files can be attached to emails using Send Email under Dropdown Options menu on the Quote/Invoice View Yii. Setting up the email templates is optional.

Users with observer role can view the quotes or invoices, and then access the 'approve or reject section' by using the guest url on the quote or invoice and pasting it into the browser.

Inclusion of below code in config/params and adjustments to MailerHelper and TemplateHelper to facilitate emailing.

Email Templates are working through javascript and parsing of data to build the template is functional.

Note: Yii's php textbox, rather than preferably a textarea, is currently used to display the email template.

Emailing of quotes/invoices with adjustment to config.params. 'yiisoft/mailer' => [ 'messageBodyTemplate' => [ 'viewPath' => '@src/Contact/mail', ], 'fileMailer' => [ 'fileMailerStorage' => '@runtime/mail', ], 'useSendmail' => false, 'writeToFiles' => false, ], 'symfony/mailer' => [ 'esmtpTransport' => [ 'scheme' => 'smtp', // "smtps": using TLS, "smtp": without using TLS. 'host' => 'mail.btinternet.com', 'port' => 25, 'username' => '[email protected]', 'password' => 'yourpassword', 'options' => [], // See: https://symfony.com/doc/current/mailer.html#tls-peer-verification ], ],

Navbar on invoice layout includes an offcanvas Menu that works with the 'burger icon' menu button if NOT a full screen and moves in from the left.

Role: Observer included so customers can view their quotes, invoices, and payments online.

To assign the observer role to a client so they can view their invoices online.

Step 1: Sign up user using Yii-demo

Step 2: Signed in as Administrator, make sure this new user is a client ie. Client...View...New

Step 3: As administatrator, make sure this user has Guest (read/only) permissions under Settings...User Account

Step 4: Add signed up client / user to Settings...User Account table and use Assigned Clients 'burger' to add/associate this client to their user id.

Step 5: Use assignRole 'observer' and user id from User Account to assign observer permissions to this user/client.

C:\wamp64\www\yii-invoice>yii user/assignRole observer 3

Step 6: Create some invoices for this user/client signed in as Administrator and add payments.

Step 7: Login as user/client and view the invoices and associated payments that you as Administrator have created for them.

The yii logo is called up permanently in the navbar with the logo located in the public folder.

The login logo previously located under Settings ... General has been moved to Settings...Company Private Details.

Each Company Private Detail record can now have their own logo/icon

This is useful for a company logo that evolves with time, older invoices retaining their older logo.

Use Yii's Form::tag() ->post($urlGenerator->generate(...$action)) ->enctypeMultipartFormData() ->csrf($csrf) ->id('CompanyPrivateForm') ->open() on forms instead of Html form tag

C:\wamp64\www\yii-invoice>php ./vendor/bin/psalm --alter --issues=InvalidNullableReturnType, InvalidReturnType, MissingReturnType, LessSpecificReturnType, MismatchingDocblockParamType, MismatchingDocblockReturnType, MissingParamType --dry-run

20th August 2022

Menu font enlarged.

Psalm Level 7 testing using php ./vendor/bin/psalmat command prompt: 0 errors.

Upgraded index for Quote and Invoice - sortable headers

Include a three input box Start of tax year date under Settings..View..Taxes for Tax Reporting.

Include a Y-m-d H:i:s format for invoicing.

ReportsSales by Client, Sales by Date, Payment History, and Invoice Aging completed.

Move invoice/index schema code to Generator...Schema

Setting...UserAccount functional. Payment...Enter functional.

Invoices cannot be edited once paid. The read only flag is used on the invoice and buttons are disabled.

5th August 2022 - The Dashboard has been put up. Once Sumex is further developed it will be added to the dashboard. Accessible by menu: Dashboard

To avoid issues concerning psr3 and unvoided return types in mpdf/mpdf I have forked the latest mpdf/mpdf development repo and made adjustments to the relevant files.

The fork rossaddison/mpdf has been included in the composer.json file. Although at this stage it will run using version mpdf/mpdf 8.016, using psr 2, I have the reassurance that these errors concerning void will not show up in Yii

29th July 2022 - Psalm testing using 'php ./vendor/bin/psalm' at command prompt - static errors removed. Info issues reduced from 2800 to 2000.

The client view now includes client's details, quotes, invoices, notes, and custom fields tabs.

Relevant javascript has been added to client.js ... load_client_notes, and save_client_notes.

21st July 2022

Invoice/Layout/main.php has been moved to @views/layout/invoice.php. The cldr setting value is given the $session->get('_language') value by means of the locale dropdown.

The $s value is configured for the @views/layout/invoice.php. (different to the demo layout ie. views/layout/main.php) in config/params.php yii-soft/view Reference::to and NOT by means of the InvoiceController . The $s value is necessary in this layout to record the current locale in the cldr setting if it is selected BEFORE login. ie. $s->save_session_locale_to_cldr($session->get('_language') ?? ($s->get_setting('cldr') ? $s->get_setting('cldr') : 'en'));

jquery 1.13.2 which has just been released is now the default. jquery 1.13.0 has been removed.

In demo mode, the menu now includes the ability to test data with pre-setup clients, products, groups, tax rates. A deinstall feature of demo clients(2), products(2) is available.

Two additional settings under the Settings tab-index help with this eg. Install test data and Use test data. These work with Generator...Remove Test Data...Reset Test Data

Datepickers now change automatically according to the locale dropdown with eg. views/client/form.php javascript function at the bottom.

Individual datepickers have been removed, and only one datepicker is used on the @views/layout/invoice.php page. ...php $js11 = "$(function () {". '$(".form-control.input-sm.datepicker").datepicker({dateFormat:"'.$datehelper->datepicker_dateFormat() .'", firstDay:'.$datehelper->datepicker_firstDay() .', changeMonth: true' .', changeYear: true' .', yearRange: "-50:+10"' .', clickInput: true' .', constrainInput: false' .', highlightWeek: true' .' });'. '});'; echo Html::script($js11)->type('module');

Every setting under views/invoice/setting/views is being audited by a $s->where('number_format') which tooltips why and where the setting is used.

config/params.php : Uncommenting Synctables (Table structure relatively permanent now) and assigning READ_AND_WRITE parameter to below with significant performance improvement.

\Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::class => [ 'mode' => \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::MODE_READ_AND_WRITE, 'file' => 'runtime/schema.php', ],

Inclusion of all countries from https://en.wikipedia.org/wiki/ISO_4217

9th July 2022 - Psalm testing using ./vendor/bin/psalm at the command prompt is now complete. 155 static errors and redundant code removed.

Issue 439: BelongsTo relation not updating on edit of relation field eg. Product' relation field tax rate is not editing and updating. Absolute Clear Cache path is located under SettingsController clear function and it will have to be adjusted to your setup in debug mode. public function clear() $directory = "C:\wamp64\www\yii-invoice\public\assets";

The SettingsController clear cache function is functional without an absolute path now.

The LAMP administrator will have to add sufficient permission to the public assets folder using the sudo chown -R username folderpath command before assets can be deleted in debug mode.

Quote - The Quote is functional ie. can be pdf'd ~but the emailing aspect has to be developed.~and the emailing aspect has been tested with sendmail. Testing with SMTP is in progress.

Invoice - The Invoice is functional ie. can be pdf'd and archived but the emailing aspect has to be developed. and sendmail is functional.

Recurring invoices - Functional but not fully tested.

Payment - Can be recorded against an Invoice. The latest version in League/Omnipay v3.2 will be setup with a few of the major payment providers added to the composer.json

User Custom Fields - not started yet.

File Attachments - not started yet.

Settings...View(Debug mode ie. Red) - These are being used.

Settings...View(Non-Debug mode ie. Not Red) - Some are being used. Their functionality is currently being analysed in Invoiceplane.--

The userinv table is an extension of yii/demo's user table and contains all the critical user information.

Setting Up

The settings table builds up initially with a default array of settings via the InvoiceController if they do not exist ie. setting 'default_settings_exist' does not exist.

Generator

The code generator templates have been adapted according to the latest demo updates.

Annotations

The lengthy Entity annotations have been replaced with the more concise Attributes coding structure. eg. * @ORM\Column(type="string") replaced with #[ORM\Column(type: "string")]. However issue 439 is currently relevant here.

Demo Mode

A demo mode variable located in src\Invoice\Layout\main.php ie. $demo_mode can be set to false to remove performance settings and the clear cache tool. All areas in red will be removed.

Jquery

Jquery 3.6.0 (March 2nd 2021) version is being used for custom fields, and smaller modals. Temporarily, Invoiceplane's dependencies.js file is being used in AppAsset. The modals are dependent on it.

Html Tags on Views

Views can be improved with more Yii related tags ie. using Html::tag. Html::encode is mandatory or compulsory or always present.

Paginator

The length of the lists can be changed via setting/view: default_list_limit

Locales

The SettingRepository load_language_folder function accepts the dropdown locale through yiisoft/demo's $session->get('_language') function: this setting takes precedence over the database 'default_language' setting when set.

Client's language different to locale_derived_language or fallback settings 'default_language'

When printing occurs, the client's language ensures the documentation is printed out in his/her language using $session->get('print_language')

The session variable print_language is reset after printing.

Languages

Any words used not in the Invoiceplane folders, will be translated using Yii's translation methodology.

The above menu's language can be created in ...resources/messages for a specific language.

Language folders can be imported from Invoiceplane but the following code must be inserted in each file declare(strict_types=1);within that folder.

Steps to include a language

1. Include the language folder in src/Invoice/Language after including declare(strict_types) in each file.

2. Include the new language in SettingsRepository's locale_language_array

3. Adjust the config/params.php locales array.

4. Adjust the views/layout/main.php menu.

5. Adjust each of the resources/messages folders language array.

6. CJK (C(hinese) J(apanese) K(orean) Languages In order to view a file with non-embedded CJK (chinese-japanese-korean) fonts, you - and other users - need to download the Asian font pack for Adobe Reader for the languages: Chinese (Simplified), Chinese (Traditional), Korean, and Japanese For Windows For Mac

If spaces appear where the language should appear whilst viewing using eg. Chrome default PDF reader, add the extension - Chrome PDF Viewer 2.3.164.

7. When copying, and pasting the Chinese Simplified folder make sure that you remove the space between the Chinese and Simplified. ie. ChineseSimplified. This is camelcase.

Netbeans: How to include UTF-8 in Netbeans

Set encoding used in Netbeans globally to UTF-8. Added in netbeans.conf "-J-Dfile.encoding=UTF-8" to parameter "netbeans_default_options". This unfortunately has to be done everytime you edit a file with 'special letters'. So edit the file with the UTF-8 setting above, save it, and then remove the above setting from Netbeans.conf.

File Location: C:\Program Files\NetBeans-16\netbeans\etc\netbeans.conf open with notepad cntrl+F netbeans_default_options

Improved Features

A start tax year date eg. 06/04/2022 can be setup under view so that reports will use this by default as their start date.

The invoice aging report includes the invoice number(s) of the outstanding balance.

The Sales by Client report includes more specifics including the Sales without Tax, Item Tax, and Invoice Tax, and Sales Inclusive amount.

The Sales by Date (aka Sales by Year) report breaks each Sales per Client into quarters over the selected years.

Multiple products of quantity of 1 can be selected from the products lookup with the 'burger' or '3 horizontal lines' icon whilst in quote.

Multiple items can be deleted under the options button with 'Delete Item'.

Company details are divided into public and private. The profile table is intended for multiple profiles especially when email addresses, and mobile numbers change.

If a Tax -Rate is set to default, it will be used on all new quotes and invoices. ie. A Quote Tax Rate will be created from this Tax Rate automatically and will be created and used on all new quotes. The same will apply to all invoices.

If you want to create a quote or an invoice group, specific to a client, use the Setting...Group feature to setup a Group identifier eg. JOE for the JOE Ltd Company. The next id will be appended to JOE ie. JOE001.

Products and Tasks can be entered separately on an invoice and are mutually exclusive so if you enter a task you cannot enter a product at the same time.

Deprecated Original Features

Themes will be introduced at a later date.

It is not intended to deprecate any of the features currently in InvoicePlane.

Proposed Features

Upgrading the forms to include the demo's php or server based form structure.

An interlinked basic bookkeeping system to audit transactions and produce an audit trail of invoices and payments

Security

All Entity properties initialized before the construct should be private. The private property is accessed through a public getter method as built below the construct.

Reasons for using a simplified id as a primary key in all the tables

See {relationName}_{outerKey}, the outerKey being the primary key, structure. Eg. the field tax_rate_id in the Product table is a relation or a foreign key in the Product table equal and pointing to its parent table's Tax Rate's id so the relation name variable in Entity: Product must be $tax_rate and joined with the outerKey as $id you get $tax_rate_id which matches the foreign key $tax_rate_id in Entity: Product If the primary key in the Tax Rate table was named something like tax_rate_id and not id then the relation could not be given a name.

Future Work

Psalm static testing and removing of INFO suggestions.

Yiisoft's Mailer function incorporated using adminEmail as default config param for userinv->email.

A new feature of product custom fields has to be developed.

Client Custom Fields dependency on client_custom_fields.js will be removed as has been done for Payment Custom Fields.

Redundant functions generated by the Generator have to be deleted.

Work in progress

The client/view has been developed but the index under the Client View has to be rebuilt using the code similar to the new Invoice index.

The dashboard is being developed with Sumex still to be incorporated.

All the settings in the setting view, still have to be linked to their specific purpose by consulting with the Original Invoiceplane code. Progress on this has been made especially with the Email tab.

All forms have to be modified from Html to Yii3's php based form structure.

Email Template

User custom fields have to be developed.

Accessing a quote using the url_key in the browser is possible now by a customer. The url_key is retrieved at the bottom of the quote by admin and pasted into an email. Login as a user who has the observer role with user_id 7, (after the 6 dummy users in demo) to test the customer's login ability. The customer can be sent the url_key (instead of the actual quote) by email. The user can then accept or reject the quote online using this url_key. This quote can then be copied to an invoice by the administrator if accepted by the customer.