/** * @covers Intacct\Functions\OrderEntry\OrderEntryTransactionUpdate::writeXml */ public function testEntriesSubtotals() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <update_sotransaction key="Sales Order-SO0001"> <updatesotransitems> <updatesotransitem line_num="1"> <itemid>02354032</itemid> <quantity>12</quantity> </updatesotransitem> <sotransitem> <itemid>02354032</itemid> <quantity>1200</quantity> </sotransitem> </updatesotransitems> <updatesubtotals> <updatesubtotal> <description>Subtotal Description</description> <total>1200</total> </updatesubtotal> </updatesubtotals> </update_sotransaction> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $transaction = new OrderEntryTransactionUpdate('unittest'); $transaction->setTransactionId('Sales Order-SO0001'); $line1 = new OrderEntryTransactionLineUpdate(); $line1->setLineNo(1); $line1->setItemId('02354032'); $line1->setQuantity(12); $line2 = new OrderEntryTransactionLineCreate(); $line2->setItemId('02354032'); $line2->setQuantity(1200); $transaction->setLines([$line1, $line2]); $subtotal1 = new TransactionSubtotalUpdate(); $subtotal1->setDescription('Subtotal Description'); $subtotal1->setTotal(1200); $transaction->setSubtotals([$subtotal1]); $transaction->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\OrderEntry\OrderEntryTransactionLineCreate::writeXml */ public function testParamsOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <sotransitem> <bundlenumber>092304</bundlenumber> <itemid>26323</itemid> <itemdesc>Item Description</itemdesc> <taxable>true</taxable> <warehouseid>93294</warehouseid> <quantity>2340</quantity> <unit>593</unit> <discountpercent>10</discountpercent> <price>32.35</price> <discsurchargememo>None</discsurchargememo> <locationid>SF</locationid> <departmentid>Receiving</departmentid> <memo>Memo</memo> <itemdetails> <itemdetail> <quantity>52</quantity> <lotno>3243</lotno> </itemdetail> </itemdetails> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <revrectemplate>template</revrectemplate> <revrecstartdate> <year>2015</year> <month>06</month> <day>30</day> </revrecstartdate> <revrecenddate> <year>2015</year> <month>07</month> <day>31</day> </revrecenddate> <renewalmacro>Quarterly</renewalmacro> <projectid>235</projectid> <customerid>23423434</customerid> <vendorid>797656</vendorid> <employeeid>90295</employeeid> <classid>243609</classid> <contractid>9062</contractid> <fulfillmentstatus>Complete</fulfillmentstatus> <taskno>9850</taskno> <billingtemplate>3525</billingtemplate> </sotransitem> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $entry = new OrderEntryTransactionLineCreate(); $entry->setBundleNumber('092304'); $entry->setItemId('26323'); $entry->setItemDescription('Item Description'); $entry->setTaxable(true); $entry->setWarehouseId('93294'); $entry->setQuantity(2340); $entry->setUnit('593'); $entry->setDiscountPercent(10.0); $entry->setPrice(32.35); $entry->setDiscountSurchargeMemo('None'); $entry->setMemo('Memo'); $entry->setRevRecTemplate('template'); $entry->setRevRecStartDate(new DateType('2015-06-30')); $entry->setRevRecEndDate(new DateType('2015-07-31')); $entry->setRenewalMacro('Quarterly'); $entry->setFulfillmentStatus('Complete'); $entry->setTaskNumber('9850'); $entry->setBillingTemplate('3525'); $entry->setLocationId('SF'); $entry->setDepartmentId('Receiving'); $entry->setProjectId('235'); $entry->setCustomerId('23423434'); $entry->setVendorId('797656'); $entry->setEmployeeId('90295'); $entry->setClassId('243609'); $entry->setContractId('9062'); $itemDetail1 = new TransactionItemDetail(); $itemDetail1->setQuantity(52); $itemDetail1->setLotNumber('3243'); $entry->setItemDetails([$itemDetail1]); $entry->setCustomFields(['customfield1' => 'customvalue1']); $entry->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }