Example #1
0
File: Tax.php Project: grlf/eyedock
    function _initSetupForm(Am_Form_Setup $form)
    {
        $gr = $form->addGroup('')->setLabel(___("Electronically Supplied Service\n" . 'Enable if ALL your products are electronic services.'));
        $gr->addAdvCheckbox('tax_digital');
        $gr->addHTML()->setHTML(<<<EOT
<div><a href="javascript:;" onclick="\$('#tax_digital_example').toggle()" class="local">Examples of Electronic Service</a></div>
<div id="tax_digital_example" style="display:none">
<ul class="list">
 <li>Website supply, web-hosting, distance maintenance of programmes  and equipment;</li>
 <li>Supply of software and updating thereof;</li>
 <li>Supply of images, text and information and making available of databases;</li>
 <li>Supply of music, films and games, including games of chance and gambling games, and of
political, cultural, artistic, sporting, scientific and entertainment broadcast and events;</li>
 <li>Supply of distance teaching.</li>
</ul>
</div>
EOT
);
        $fieldSet = $form->addFieldSet('maxmind', array('id' => 'maxmind'))->setLabel('Location Validation Settings');
        $fieldSet->addHTML(null, array('class' => 'no-label'))->setHTML(<<<EOT
<p>According to new EU VAT rules your are required to collect two pieces of non-conflicting evidence of customer's location country if you are selling Digital (Electronic Service) Products. These two pieces of evidence will be checked on each invoice which has Digital Product included:</p>
<ul class="list">
    <li>Address Contry (so make sure that you  have added Address info brick to signup form)</li>
    <li>IP Address Country</li>
</ul>
<p>In order to get country from customer's IP address, aMember uses MaxMind GeoIP2 service. Please signup <a href = "https://www.maxmind.com/en/geoip2-precision-country" target="_blank" class="link">here</a> in order to get MaxMind user ID and license key.</p>
           
EOT
);
        $fieldSet->addAdvCheckbox('tax_location_validation')->setLabel(___("Enable Location Validation\n" . 'aMember will require two peices of location evidence before an invoice is created. ' . 'Invoice that fials validation will be blocked and user will receive warning.'));
        $fieldSet->addAdvCheckbox('tax_location_validate_all')->setLabel(___("Validate Location even if Invoice has no VAT \n" . "Validate All New Invoices (even if invoice has no VAT)\n" . "If unchecked, location will be validated only when \n" . "user selects country inside EU and only if VAT should be applied to invoice.\n" . "Free invoices won't be validated still"));
        $fieldSet->addAdvCheckbox('tax_location_validate_self')->setLabel(___("Enable Self-Validation\n" . "If validation failed, user will be able to confirm current location manually\n"));
        $fieldSet->addText('tax_maxmind_user_id')->setLabel(___('MaxMind User ID'));
        $fieldSet->addText('tax_maxmind_license')->setLabel(___('MaxMind License'));
        $fieldSet = $form->addFieldSet('vat_id')->setLabel(___("Account Information"));
        $fieldSet->addSelect('my_country')->setLabel(___('My Country'))->loadOptions($this->countries)->addRule('required');
        $fieldSet->addText('my_id')->setLabel(___('VAT Id'))->addRule('required');
        $fieldSet = $form->addFieldSet('numbering')->setLabel(___('Invoice numbering'));
        $fieldSet->addAdvCheckbox("sequential")->setLabel(___("Sequential Receipt# Numbering\n" . "aMember still creates unique id for invoices, but it will\n" . "generate PDF receipts for each payment that will be\n" . "available in the member area for customers"));
        $form->setDefault('sequential', 1);
        $form->setDefault('tax_digital', 1);
        $fieldSet->addText('invoice_prefix')->setLabel(___("Receipt# Number Prefix\n" . 'If you change prefix numbers will start over from 1'))->setValue('INV-');
        $fieldSet->addText('initial_invoice_number')->setLabel(___('Initial Receipt# Number'))->setValue(1);
        $fieldSet->addText('invoice_refund_prefix')->setLabel(___("Refund Receipt# Prefix\n" . 'If you change prefix numbers will start over from 1'))->setValue('RFND-');
        $fieldSet->addText('initial_invoice_refund_number')->setLabel(___('Initial Receipt# Refund Number'))->setValue(1);
        $fs = $form->addFieldSet('rates')->setLabel(___('VAT Rates, %'));
        $rates = array_filter($this->getConfig('rates', array()));
        foreach ($this->rates as $c => $rate) {
            if (!isset($this->countries[$c])) {
                continue;
            }
            $r = $fs->addText('rate.' . $c, 'size=3')->setLabel($this->countries[$c]);
            $r->setValue(!empty($rate[$c]) ? $rate[$c] : $this->rates[$c]);
        }
    }