public function test_convertIncVatToExVat()
 {
     $this->assertEquals(8.0, WebServiceRowFormatter::convertIncVatToExVat(10.0, 25));
     $this->assertEquals(69.98999999999999, WebServiceRowFormatter::convertIncVatToExVat(69.98999999999999 * 1.25, 25));
     $this->assertEquals(0, WebServiceRowFormatter::convertIncVatToExVat(0, 0));
     $this->assertEquals(1, WebServiceRowFormatter::convertIncVatToExVat(1, 0));
     $this->assertEquals(0, WebServiceRowFormatter::convertIncVatToExVat(0 * 1.25, 25));
     $this->assertEquals(100.0, WebServiceRowFormatter::convertIncVatToExVat(100.0 * 1.06, 6));
     $this->assertEquals(100.0, WebServiceRowFormatter::convertIncVatToExVat(100.0 * 1.0825, 8.25));
 }
 protected function getAdminSoapNumberedOrderRowsFromBuilderOrderRowsUsingVatFlag($builderOrderRows, $priceIncludingVat)
 {
     $amount = 0;
     $numberedOrderRows = array();
     foreach ($builderOrderRows as $orderRow) {
         if (isset($orderRow->vatPercent) && isset($orderRow->amountExVat)) {
             $amount = $priceIncludingVat ? \Svea\WebService\WebServiceRowFormatter::convertExVatToIncVat($orderRow->amountExVat, $orderRow->vatPercent) : $orderRow->amountExVat;
         } elseif (isset($orderRow->vatPercent) && isset($orderRow->amountIncVat)) {
             $amount = $priceIncludingVat ? $orderRow->amountIncVat : \Svea\WebService\WebServiceRowFormatter::convertIncVatToExVat($orderRow->amountIncVat, $orderRow->vatPercent);
         } else {
             $amount = $priceIncludingVat ? $orderRow->amountIncVat : $orderRow->amountExVat;
             $orderRow->vatPercent = \Svea\WebService\WebServiceRowFormatter::calculateVatPercentFromPriceExVatAndPriceIncVat($orderRow->amountIncVat, $orderRow->amountExVat);
         }
         $numberedOrderRows[] = new \SoapVar(new AdminSoap\NumberedOrderRow($orderRow->articleNumber, $this->formatRowNameAndDescription($orderRow), !isset($orderRow->discountPercent) ? 0 : $orderRow->discountPercent, $orderRow->quantity, $amount, $orderRow->unit, $orderRow->vatPercent, $orderRow->creditInvoiceId, $orderRow->invoiceId, $orderRow->rowNumber, $priceIncludingVat), SOAP_ENC_OBJECT, null, null, 'NumberedOrderRow', "http://schemas.datacontract.org/2004/07/DataObjects.Admin.Service");
     }
     return $numberedOrderRows;
 }