/** * @covers Intacct\Functions\AccountsReceivable\InvoiceCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <create_invoice> <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> <datedue> <year>2020</year> <month>09</month> <day>24</day> </datedue> <termname>N30</termname> <action>Submit</action> <batchkey>20323</batchkey> <invoiceno>234</invoiceno> <ponumber>234235</ponumber> <onhold>true</onhold> <description>Some description</description> <externalid>20394</externalid> <billto> <contactname>28952</contactname> </billto> <shipto> <contactname>289533</contactname> </shipto> <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> <supdocid>6942</supdocid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <invoiceitems> <lineitem> <glaccountno></glaccountno> <amount>76343.43</amount> </lineitem> </invoiceitems> </create_invoice> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $arInvoice = new InvoiceCreate('unittest'); $arInvoice->setCustomerId('CUSTOMER1'); $arInvoice->setTransactionDate(new DateType('2015-06-30')); $arInvoice->setGlPostingDate(new DateType('2015-06-30')); $arInvoice->setDueDate(new DateType('2020-09-24')); $arInvoice->setPaymentTerm('N30'); $arInvoice->setAction('Submit'); $arInvoice->setSummaryRecordNo('20323'); $arInvoice->setInvoiceNumber('234'); $arInvoice->setReferenceNumber('234235'); $arInvoice->setOnHold(true); $arInvoice->setDescription('Some description'); $arInvoice->setExternalId('20394'); $arInvoice->setBillToContactName('28952'); $arInvoice->setShipToContactName('289533'); $arInvoice->setBaseCurrency('USD'); $arInvoice->setTransactionCurrency('USD'); $arInvoice->setExchangeRateDate(new DateType('2015-06-30')); $arInvoice->setExchangeRateType('Intacct Daily Rate'); $arInvoice->setDoNotPostToGL(false); $arInvoice->setAttachmentsId('6942'); $arInvoice->setCustomFields(['customfield1' => 'customvalue1']); $line1 = new InvoiceLineCreate(); $line1->setTransactionAmount(76343.42999999999); $arInvoice->setLines([$line1]); $arInvoice->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * @covers Intacct\Functions\AccountsReceivable\InvoiceLineCreate::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> <revrectemplate>RevRec1</revrectemplate> <defrevaccount>2100</defrevaccount> <revrecstartdate> <year>2016</year> <month>06</month> <day>01</day> </revrecstartdate> <revrecenddate> <year>2017</year> <month>05</month> <day>31</day> </revrecenddate> <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 InvoiceLineCreate(); $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->setRevRecTemplateId('RevRec1'); $line->setDeferredRevGlAccountNo('2100'); $line->setRevRecStartDate(new DateType('2016-06-01')); $line->setRevRecEndDate(new DateType('2017-05-31')); $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()); }