/** * @covers Intacct\Functions\AccountsReceivable\ArAdjustmentLineCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <lineitem> <accountlabel>TestBill Account1</accountlabel> <offsetglaccountno>93590253</offsetglaccountno> <amount>76343.43</amount> <memo>Just another memo</memo> <locationid>Location1</locationid> <departmentid>Department1</departmentid> <key>Key1</key> <totalpaid>23484.93</totalpaid> <totaldue>0</totaldue> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <projectid>Project1</projectid> <customerid>Customer1</customerid> <vendorid>Vendor1</vendorid> <employeeid>Employee1</employeeid> <itemid>Item1</itemid> <classid>Class1</classid> <warehouseid>Warehouse1</warehouseid> </lineitem> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $line = new ArAdjustmentLineCreate(); $line->setAccountLabel('TestBill Account1'); $line->setOffsetGLAccountNumber('93590253'); $line->setTransactionAmount(76343.42999999999); $line->setMemo('Just another memo'); $line->setKey('Key1'); $line->setTotalPaid(23484.93); $line->setTotalDue(0.0); $line->setLocationId('Location1'); $line->setDepartmentId('Department1'); $line->setProjectId('Project1'); $line->setCustomerId('Customer1'); $line->setVendorId('Vendor1'); $line->setEmployeeId('Employee1'); $line->setItemId('Item1'); $line->setClassId('Class1'); $line->setWarehouseId('Warehouse1'); $line->setCustomFields(['customfield1' => 'customvalue1']); $line->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * @covers Intacct\Functions\AccountsReceivable\ArAdjustmentCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <create_aradjustment> <customerid>CUSTOMER1</customerid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <dateposted> <year>2015</year> <month>06</month> <day>30</day> </dateposted> <batchkey>20323</batchkey> <adjustmentno>234235</adjustmentno> <action>Submit</action> <invoiceno>234</invoiceno> <description>Some description</description> <externalid>20394</externalid> <basecurr>USD</basecurr> <currency>USD</currency> <exchratedate> <year>2015</year> <month>06</month> <day>30</day> </exchratedate> <exchratetype>Intacct Daily Rate</exchratetype> <nogl>false</nogl> <aradjustmentitems> <lineitem> <glaccountno></glaccountno> <amount>76343.43</amount> </lineitem> </aradjustmentitems> </create_aradjustment> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $arAdjustment = new ArAdjustmentCreate('unittest'); $arAdjustment->setCustomerId('CUSTOMER1'); $arAdjustment->setTransactionDate(new DateType('2015-06-30')); $arAdjustment->setGlPostingDate(new DateType('2015-06-30')); $arAdjustment->setSummaryRecordNo('20323'); $arAdjustment->setAdjustmentNumber('234235'); $arAdjustment->setAction('Submit'); $arAdjustment->setInvoiceNumber('234'); $arAdjustment->setDescription('Some description'); $arAdjustment->setExternalId('20394'); $arAdjustment->setBaseCurrency('USD'); $arAdjustment->setTransactionCurrency('USD'); $arAdjustment->setExchangeRateDate(new DateType('2015-06-30')); $arAdjustment->setExchangeRateType('Intacct Daily Rate'); $arAdjustment->setDoNotPostToGL(false); $line1 = new ArAdjustmentLineCreate(); $line1->setTransactionAmount(76343.42999999999); $arAdjustment->setLines([$line1]); $arAdjustment->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }