EBoekhouden_Export - Version 4.1.26

Version Notes

Fixed issue with VAT calculations when 'all inclusive' VAT setting was used.

Download this release

Release Info

Developer Ronald Kas
Extension EBoekhouden_Export
Version 4.1.26
Comparing to
See all releases


Code changes from version 4.1.25 to 4.1.26

app/code/community/Eboekhouden/Export/Model/Export/Sales.php CHANGED
@@ -386,7 +386,7 @@ class Eboekhouden_Export_Model_Export_Sales
386
  && 0 < $oContainer->getBaseDiscountAmount()
387
  && $fDiscountLeft >= 0.01 )
388
  {
389
- // There is discount applied on the order but not on the sipping cost
390
  // and there is discount left. That discount must be for the shipping, so let's add it.
391
  $oShippingItem->setBaseDiscountAmount($fDiscountLeft);
392
  }
@@ -608,8 +608,18 @@ class Eboekhouden_Export_Model_Export_Sales
608
  if ( $this->_oTaxConfig->applyTaxAfterDiscount() )
609
  {
610
  // Apply Tax after Discount
611
- $fPriceIn = ( $oItem->getBaseRowTotal() - $fDiscountAmount ) * $fVatFactor;
612
- $sComment .= ' ['.$fPriceIn.' = ('.$oItem->getBaseRowTotal().' - '.$fDiscountAmount.') * '.$fVatFactor.'] ';
 
 
 
 
 
 
 
 
 
 
613
  }
614
  else
615
  {
@@ -632,7 +642,7 @@ class Eboekhouden_Export_Model_Export_Sales
632
  $iGbRekening = false;
633
  $iCostcenter = false;
634
  $sProductId = $oItem->getProductId();
635
-
636
  if (!empty($sProductId))
637
  {
638
  if ( preg_match( '|^weee_(.+)$|', $sProductId, $aMatch ) )
@@ -644,7 +654,7 @@ class Eboekhouden_Export_Model_Export_Sales
644
  {
645
  $sComment .= $oItem->getTitle().': ';
646
  }
647
-
648
  if ('shipping' == $sProductId)
649
  {
650
  $iGbRekening = $aSettings['sShipLedgerAcc'];
@@ -718,17 +728,29 @@ class Eboekhouden_Export_Model_Export_Sales
718
  $iResult = false;
719
  $iStoreId = $oOrder->getStoreId();
720
  $iCustomerId = $oOrder->getCustomerId();
721
- // Set default group id first
722
- $iCustomerGroupId = Mage::getStoreConfig('customer/create_account/default_group', $iStoreId);
723
- if (!empty($iCustomerId))
724
  {
725
  $oCustomer = Mage::getModel('customer/customer')->load($iCustomerId);
726
- /* @var $oCustomer Mage_Customer_Model_Customer */
727
- $iCustomerGroupId = $oCustomer->getGroupId();
728
  }
729
- $oCustomerGroup = Mage::getModel('customer/group')->load($iCustomerGroupId);
730
- /* @var $oCustomerGroup Mage_Customer_Model_Group */
731
- $iResult = $oCustomerGroup->getTaxClassId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  return $iResult;
733
  }
734
 
@@ -768,11 +790,23 @@ class Eboekhouden_Export_Model_Export_Sales
768
  $fVatPercent = 0;
769
  if ( !empty($fTempPriceEx)
770
  && is_numeric($fTempPriceEx)
771
- && 0 != 1 * $fTempPriceEx
772
- ) // prevent division by zero
773
  {
774
  $fVatPercent = 100 * $fTempTaxAmount / $fTempPriceEx;
775
  }
 
 
 
 
 
 
 
 
 
 
 
 
776
  }
777
  $fVatPercent = floatval($fVatPercent);
778
  $fVatPercent = $this->_vatPercRound($fVatPercent);
@@ -889,10 +923,14 @@ class Eboekhouden_Export_Model_Export_Sales
889
  {
890
  $sVatCode = 'LAAG_VERK';
891
  }
892
- else
893
  {
894
  $sVatCode = 'HOOG_VERK';
895
  }
 
 
 
 
896
  }
897
 
898
  return $sVatCode;
386
  && 0 < $oContainer->getBaseDiscountAmount()
387
  && $fDiscountLeft >= 0.01 )
388
  {
389
+ // There is discount applied on the order but not on the shipping cost
390
  // and there is discount left. That discount must be for the shipping, so let's add it.
391
  $oShippingItem->setBaseDiscountAmount($fDiscountLeft);
392
  }
608
  if ( $this->_oTaxConfig->applyTaxAfterDiscount() )
609
  {
610
  // Apply Tax after Discount
611
+ if ( $this->_oTaxConfig->discountTax() )
612
+ {
613
+ // Apply Discount On Prices: Including Tax
614
+ $fDiscountAmountEx = $fDiscountAmount / $fVatFactor;
615
+ }
616
+ else
617
+ {
618
+ // Apply Discount On Prices: Excluding Tax
619
+ $fDiscountAmountEx = $fDiscountAmount;
620
+ }
621
+ $fPriceIn = ( $oItem->getBaseRowTotal() - $fDiscountAmountEx ) * $fVatFactor;
622
+ $sComment .= ' ['.$fPriceIn.' = ('.$oItem->getBaseRowTotal().' - '.$fDiscountAmountEx.') * '.$fVatFactor.'] ';
623
  }
624
  else
625
  {
642
  $iGbRekening = false;
643
  $iCostcenter = false;
644
  $sProductId = $oItem->getProductId();
645
+
646
  if (!empty($sProductId))
647
  {
648
  if ( preg_match( '|^weee_(.+)$|', $sProductId, $aMatch ) )
654
  {
655
  $sComment .= $oItem->getTitle().': ';
656
  }
657
+
658
  if ('shipping' == $sProductId)
659
  {
660
  $iGbRekening = $aSettings['sShipLedgerAcc'];
728
  $iResult = false;
729
  $iStoreId = $oOrder->getStoreId();
730
  $iCustomerId = $oOrder->getCustomerId();
731
+
732
+ if ( !empty($iCustomerId) )
 
733
  {
734
  $oCustomer = Mage::getModel('customer/customer')->load($iCustomerId);
735
+ $iResult = $oCustomer->getTaxClassId();
 
736
  }
737
+
738
+ if ( empty($iResult) )
739
+ {
740
+ // We need to get the tax class id based on the customer group.
741
+ // Set default group id first
742
+ $iCustomerGroupId = Mage::getStoreConfig('customer/create_account/default_group', $iStoreId);
743
+ if (!empty($iCustomerId))
744
+ {
745
+ $oCustomer = Mage::getModel('customer/customer')->load($iCustomerId);
746
+ /* @var $oCustomer Mage_Customer_Model_Customer */
747
+ $iCustomerGroupId = $oCustomer->getGroupId();
748
+ }
749
+ $oCustomerGroup = Mage::getModel('customer/group')->load($iCustomerGroupId);
750
+ /* @var $oCustomerGroup Mage_Customer_Model_Group */
751
+ $iResult = $oCustomerGroup->getTaxClassId();
752
+ }
753
+
754
  return $iResult;
755
  }
756
 
790
  $fVatPercent = 0;
791
  if ( !empty($fTempPriceEx)
792
  && is_numeric($fTempPriceEx)
793
+ && 0 != 1 * $fTempPriceEx // prevent division by zero
794
+ )
795
  {
796
  $fVatPercent = 100 * $fTempTaxAmount / $fTempPriceEx;
797
  }
798
+
799
+ if ( 0 == $fVatPercent // No VAT precentage found yet
800
+ && $oItem->getBasePriceInclTax() != $oItem->getBasePrice() // Non-discount In and Ex price is not the same
801
+ && 0 < $oItem->getBaseHiddenTaxAmount() // - prevent division by zero
802
+ )
803
+ {
804
+ // In this case we calculate VAT based on the price before discount.
805
+ // It is important to find the right VAT percentage because it is used for several calculations
806
+ // even if the total row amount is 0.
807
+ $fOriginalVatAmount = $oItem->getBasePriceInclTax() - $oItem->getBasePrice();
808
+ $fVatPercent = 100 * $fOriginalVatAmount / $oItem->getBasePrice();
809
+ }
810
  }
811
  $fVatPercent = floatval($fVatPercent);
812
  $fVatPercent = $this->_vatPercRound($fVatPercent);
923
  {
924
  $sVatCode = 'LAAG_VERK';
925
  }
926
+ elseif (19 == $fVatPercent)
927
  {
928
  $sVatCode = 'HOOG_VERK';
929
  }
930
+ else
931
+ {
932
+ $sVatCode = 'HOOG_VERK_21';
933
+ }
934
  }
935
 
936
  return $sVatCode;
package.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EBoekhouden_Export</name>
4
- <version>4.1.25</version>
5
- <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT</license>
7
  <channel>community</channel>
8
  <extends/>
@@ -31,11 +31,11 @@ Meer informatie over deze koppeling met Magento kunt u terugvinden als u ingelog
31
  -----------------------------------------------------&#xD;
32
  Info about uninstalling can be found in &#xD;
33
  app/code/community/Eboekhouden/Export/sql/HOWTO_UnInstall.sql</description>
34
- <notes>Fix for using ledger posts other than the default 8000.</notes>
35
  <authors><author><name>Ronald Kas</name><user>eboekhoudennl</user><email>info@e-boekhouden.nl</email></author></authors>
36
- <date>2012-10-08</date>
37
- <time>12:31:58</time>
38
- <contents><target name="magecommunity"><dir name="Eboekhouden"><dir name="Export"><dir name="Block"><dir name="Config"><dir name="Info"><file name="Version.php" hash="e8957685d4f906457d1eb45853702e1f"/></dir></dir><dir name="Sales"><dir name="Creditmemo"><file name="Grid.php" hash="5d323b6842ac429c346fc1a00d8b38ee"/></dir><dir name="Invoice"><file name="Grid.php" hash="264f95548e6d5dd501a4c613fb38b3a8"/></dir><dir name="Order"><file name="Grid.php" hash="a1a9fe52f445f7f40e553b4c7f6dce99"/></dir></dir><dir name="Tax"><dir name="Rate"><file name="Form.php" hash="ea36d8fde2272e24f5187c0bfd9deb76"/><dir name="Grid"><dir name="Renderer"><file name="Ebvatcode.php" hash="d34d2edd9593e4d2c23a20c8e0864c95"/></dir></dir><file name="Grid.php" hash="ca50f669ccd75b1365d5937d0390fe3e"/></dir></dir></dir><dir name="Helper"><file name="AccountNumber.php" hash="599c8af6b93e2206c631aa79e9ba5dd4"/><file name="Data.php" hash="649880c1071e2453ae8536e89349527c"/></dir><dir name="Model"><dir name="Config"><file name="Costcenter.php" hash="7f280ef51e003de0bf80f0ab2b9685f0"/><file name="Ledgeraccount.php" hash="318e87f5932d4bd898d1552d27c50bc7"/><file name="Taxcalculationrate.php" hash="9871b70f56e8fee7cd3364bc8b3de2c5"/></dir><dir name="Export"><file name="Sales.php" hash="623d5ff0e7029e316381db492aadf68e"/></dir><dir name="Import"><file name="Costcenter.php" hash="593b1a269583073098f5c1f52002058f"/><file name="Ebcode.php" hash="4127f3460ccb06e800f88baf86a58008"/><file name="Gbcodes.php" hash="d513db427803e3c079f6577b7b240219"/></dir><file name="Info.php" hash="c8dbbbaeead14393cb36c0eec5706882"/><dir name="Product"><dir name="Attribute"><file name="Costcenter.php" hash="3b1e02791a8ff9782d18f14afdc90221"/><file name="Ledgeraccount.php" hash="132f16b2407b579605cb24de6ea5b6ab"/></dir></dir><dir name="Tax"><dir name="Attribute"><file name="Ebtaxcode.php" hash="0b34f8d566896c3fbab02ddaabf55536"/></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="b19ff72404a75fcb1d89da436d3c68e9"/></dir><dir name="Export"><file name="SaleController.php" hash="c4f64b12685ad9558dff62f26ac7e6f2"/></dir><file name="MutatieController.php" hash="1634fcb7298ef44b369f9ac9fbdf87b4"/></dir><dir name="etc"><file name="config.xml" hash="ef4d19fe8edcaa22557fd95e25c7dea9"/><file name="system.xml" hash="8f9f3db645acf4e736d80e4f50510428"/></dir><dir name="sql"><file name="HOWTO_UnInstall.sql" hash="691131453816d890630a6d3a21b6c7bf"/><dir name="eboekhouden_setup"><dir name="includes"><file name="install-current.php" hash="ddb3ff7895f4ec22fc6b4866207c9575"/></dir><file name="mysql4-install-4.1.25.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.0.2-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.0.7-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.1.5-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.2.0-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.2.2-4.0.php" hash="e0ce8dbd2e1de28479e90505abbc6297"/><file name="mysql4-upgrade-1.2.6-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.3-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.4-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.5-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.6-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-2.0-4.0.php" hash="b1b333b3815368af7d599e5126eca26e"/><file name="mysql4-upgrade-3.0-4.0.php" hash="b1b333b3815368af7d599e5126eca26e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eboekhouden_Export.xml" hash="9ced450b54f7225a83049f6bff3adbae"/></dir></target></contents>
39
  <compatible/>
40
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
41
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EBoekhouden_Export</name>
4
+ <version>4.1.26</version>
5
+ <stability>alpha</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT</license>
7
  <channel>community</channel>
8
  <extends/>
31
  -----------------------------------------------------&#xD;
32
  Info about uninstalling can be found in &#xD;
33
  app/code/community/Eboekhouden/Export/sql/HOWTO_UnInstall.sql</description>
34
+ <notes>Fixed issue with VAT calculations when 'all inclusive' VAT setting was used.</notes>
35
  <authors><author><name>Ronald Kas</name><user>eboekhoudennl</user><email>info@e-boekhouden.nl</email></author></authors>
36
+ <date>2014-03-24</date>
37
+ <time>15:58:39</time>
38
+ <contents><target name="magecommunity"><dir name="Eboekhouden"><dir name="Export"><dir name="Block"><dir name="Config"><dir name="Info"><file name="Version.php" hash="e8957685d4f906457d1eb45853702e1f"/></dir></dir><dir name="Sales"><dir name="Creditmemo"><file name="Grid.php" hash="5d323b6842ac429c346fc1a00d8b38ee"/></dir><dir name="Invoice"><file name="Grid.php" hash="264f95548e6d5dd501a4c613fb38b3a8"/></dir><dir name="Order"><file name="Grid.php" hash="a1a9fe52f445f7f40e553b4c7f6dce99"/></dir></dir><dir name="Tax"><dir name="Rate"><file name="Form.php" hash="ea36d8fde2272e24f5187c0bfd9deb76"/><dir name="Grid"><dir name="Renderer"><file name="Ebvatcode.php" hash="d34d2edd9593e4d2c23a20c8e0864c95"/></dir></dir><file name="Grid.php" hash="ca50f669ccd75b1365d5937d0390fe3e"/></dir></dir></dir><dir name="Helper"><file name="AccountNumber.php" hash="599c8af6b93e2206c631aa79e9ba5dd4"/><file name="Data.php" hash="649880c1071e2453ae8536e89349527c"/></dir><dir name="Model"><dir name="Config"><file name="Costcenter.php" hash="7f280ef51e003de0bf80f0ab2b9685f0"/><file name="Ledgeraccount.php" hash="318e87f5932d4bd898d1552d27c50bc7"/><file name="Taxcalculationrate.php" hash="9871b70f56e8fee7cd3364bc8b3de2c5"/></dir><dir name="Export"><file name="Sales.php" hash="12f86eb53fdad3f20dd75e68d95b5cf7"/></dir><dir name="Import"><file name="Costcenter.php" hash="593b1a269583073098f5c1f52002058f"/><file name="Ebcode.php" hash="4127f3460ccb06e800f88baf86a58008"/><file name="Gbcodes.php" hash="d513db427803e3c079f6577b7b240219"/></dir><file name="Info.php" hash="c8dbbbaeead14393cb36c0eec5706882"/><dir name="Product"><dir name="Attribute"><file name="Costcenter.php" hash="3b1e02791a8ff9782d18f14afdc90221"/><file name="Ledgeraccount.php" hash="132f16b2407b579605cb24de6ea5b6ab"/></dir></dir><dir name="Tax"><dir name="Attribute"><file name="Ebtaxcode.php" hash="0b34f8d566896c3fbab02ddaabf55536"/></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="b19ff72404a75fcb1d89da436d3c68e9"/></dir><dir name="Export"><file name="SaleController.php" hash="c4f64b12685ad9558dff62f26ac7e6f2"/></dir><file name="MutatieController.php" hash="1634fcb7298ef44b369f9ac9fbdf87b4"/></dir><dir name="etc"><file name="config.xml" hash="ef4d19fe8edcaa22557fd95e25c7dea9"/><file name="system.xml" hash="8f9f3db645acf4e736d80e4f50510428"/></dir><dir name="sql"><file name="HOWTO_UnInstall.sql" hash="691131453816d890630a6d3a21b6c7bf"/><dir name="eboekhouden_setup"><dir name="includes"><file name="install-current.php" hash="ddb3ff7895f4ec22fc6b4866207c9575"/></dir><file name="mysql4-install-4.1.25.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.0.2-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.0.7-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.1.5-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.2.0-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.2.2-4.0.php" hash="e0ce8dbd2e1de28479e90505abbc6297"/><file name="mysql4-upgrade-1.2.6-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.3-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.4-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.5-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-1.6-4.0.php" hash="8febe17420f3a5a2e99eb86605ab3dd3"/><file name="mysql4-upgrade-2.0-4.0.php" hash="b1b333b3815368af7d599e5126eca26e"/><file name="mysql4-upgrade-3.0-4.0.php" hash="b1b333b3815368af7d599e5126eca26e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eboekhouden_Export.xml" hash="9ced450b54f7225a83049f6bff3adbae"/></dir></target></contents>
39
  <compatible/>
40
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
41
  </package>