/** * @covers Intacct\Functions\InventoryControl\TransactionSubtotalCreate::writeXml */ public function testParamsOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <subtotal> <description>Subtotal Description</description> <total>4202</total> <percentval>9.2</percentval> <locationid>2355</locationid> <departmentid>RCVNG</departmentid> <projectid>FOW</projectid> <customerid>CUST5893</customerid> <vendorid>VEN53222</vendorid> <employeeid>EM5925</employeeid> <classid>CLS322</classid> <itemid>I5266235</itemid> <contractid>C23662</contractid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> </subtotal> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $subtotal = new TransactionSubtotalCreate(); $subtotal->setDescription('Subtotal Description'); $subtotal->setTotal(4202); $subtotal->setPercentageValue(9.199999999999999); $subtotal->setLocationId('2355'); $subtotal->setDepartmentId('RCVNG'); $subtotal->setProjectId('FOW'); $subtotal->setCustomerId('CUST5893'); $subtotal->setVendorId('VEN53222'); $subtotal->setEmployeeId('EM5925'); $subtotal->setClassId('CLS322'); $subtotal->setItemId('I5266235'); $subtotal->setContractId('C23662'); $subtotal->setCustomFields(['customfield1' => 'customvalue1']); $subtotal->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * @covers Intacct\Functions\OrderEntry\OrderEntryTransactionCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <create_sotransaction> <transactiontype>Sales Order</transactiontype> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <dateposted> <year>2015</year> <month>06</month> <day>30</day> </dateposted> <createdfrom>Sales Quote-Q1002</createdfrom> <customerid>23530</customerid> <documentno>23430</documentno> <origdocdate> <year>2015</year> <month>06</month> <day>15</day> </origdocdate> <referenceno>234235</referenceno> <termname>N30</termname> <datedue> <year>2020</year> <month>09</month> <day>24</day> </datedue> <message>Submit</message> <shippingmethod>USPS</shippingmethod> <shipto> <contactname>28952</contactname> </shipto> <billto> <contactname>289533</contactname> </billto> <supdocid>6942</supdocid> <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> <vsoepricelist>VSOEPricing</vsoepricelist> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <state>Pending</state> <projectid>P2904</projectid> <sotransitems> <sotransitem> <itemid>2390552</itemid> <quantity>223</quantity> </sotransitem> </sotransitems> <subtotals> <subtotal> <description>Subtotal description</description> <total>223</total> </subtotal> </subtotals> </create_sotransaction> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $transaction = new OrderEntryTransactionCreate('unittest'); $transaction->setTransactionDefinition('Sales Order'); $transaction->setTransactionDate(new DateType('2015-06-30')); $transaction->setGlPostingDate(new DateType('2015-06-30')); $transaction->setCreatedFrom('Sales Quote-Q1002'); $transaction->setCustomerId('23530'); $transaction->setDocumentNumber('23430'); $transaction->setOriginalDocumentDate(new DateType('2015-06-15')); $transaction->setReferenceNumber('234235'); $transaction->setPaymentTerm('N30'); $transaction->setDueDate(new DateType('2020-09-24')); $transaction->setMessage('Submit'); $transaction->setShippingMethod('USPS'); $transaction->setShipToContactName('28952'); $transaction->setBillToContactName('289533'); $transaction->setAttachmentsId('6942'); $transaction->setExternalId('20394'); $transaction->setBaseCurrency('USD'); $transaction->setTransactionCurrency('USD'); $transaction->setExchangeRateDate(new DateType('2015-06-30')); $transaction->setExchangeRateType('Intacct Daily Rate'); $transaction->setVsoePriceList('VSOEPricing'); $transaction->setCustomFields(['customfield1' => 'customvalue1']); $transaction->setState('Pending'); $transaction->setProjectId('P2904'); $line1 = new OrderEntryTransactionLineCreate(); $line1->setItemId('2390552'); $line1->setQuantity(223); $transaction->setLines([$line1]); $subtotal1 = new TransactionSubtotalCreate(); $subtotal1->setDescription('Subtotal description'); $subtotal1->setTotal(223); $transaction->setSubtotals([$subtotal1]); $transaction->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * @covers Intacct\Functions\InventoryControl\InventoryTransactionCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <create_ictransaction> <transactiontype>Inventory Shipper</transactiontype> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <createdfrom>Inventory Shipper-P1002</createdfrom> <documentno>23430</documentno> <referenceno>234235</referenceno> <message>Submit</message> <externalid>20394</externalid> <basecurr>USD</basecurr> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <state>Pending</state> <ictransitems> <ictransitem> <itemid>2390552</itemid> <warehouseid>W1234</warehouseid> <quantity>223</quantity> </ictransitem> </ictransitems> <subtotals> <subtotal> <description>Subtotal description</description> <total>223</total> </subtotal> </subtotals> </create_ictransaction> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $transaction = new InventoryTransactionCreate('unittest'); $transaction->setTransactionDefinition('Inventory Shipper'); $transaction->setTransactionDate(new DateType('2015-06-30')); $transaction->setCreatedFrom('Inventory Shipper-P1002'); $transaction->setDocumentNumber('23430'); $transaction->setReferenceNumber('234235'); $transaction->setMessage('Submit'); $transaction->setExternalId('20394'); $transaction->setBaseCurrency('USD'); $transaction->setState('Pending'); $transaction->setCustomFields(['customfield1' => 'customvalue1']); $line1 = new InventoryTransactionLineCreate(); $line1->setItemId('2390552'); $line1->setWarehouseId('W1234'); $line1->setQuantity(223); $transaction->setLines([$line1]); $subtotal1 = new TransactionSubtotalCreate(); $subtotal1->setDescription('Subtotal description'); $subtotal1->setTotal(223); $transaction->setSubtotals([$subtotal1]); $transaction->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }