/** * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_arpayment'); if (!$this->getCustomerId()) { throw new InvalidArgumentException('Customer ID is required for create'); } $xml->writeElement('customerid', $this->getCustomerId(), true); $xml->writeElement('paymentamount', $this->getTransactionPaymentAmount(), true); $xml->writeElement('translatedamount', $this->getBasePaymentAmount()); if ($this->getUndepositedFundsGlAccountNo()) { $xml->writeElement('undepfundsacct', $this->getUndepositedFundsGlAccountNo()); } elseif ($this->getBankAccountId()) { $xml->writeElement('bankaccountid', $this->getBankAccountId()); } $xml->writeElement('refid', $this->getReferenceNumber()); $xml->writeElement('overpaylocid', $this->getOverpaymentLocationId()); $xml->writeElement('overpaydeptid', $this->getOverpaymentDepartmentId()); if (!$this->getReceivedDate()) { throw new InvalidArgumentException('Received Date is required for create'); } $xml->startElement('datereceived'); $xml->writeDateSplitElements($this->getReceivedDate(), true); $xml->endElement(); //datereceived if (!$this->getPaymentMethod()) { throw new InvalidArgumentException('Payment Method is required for create'); } $xml->writeElement('paymentmethod', $this->getPaymentMethod(), true); $xml->writeElement('basecurr', $this->getBaseCurrency()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } if ($this->getExchangeRateType()) { $xml->writeElement('exchratetype', $this->getExchangeRateType()); } elseif ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getBaseCurrency() || $this->getTransactionCurrency()) { $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $xml->writeElement('cctype', $this->getCreditCardType()); $xml->writeElement('authcode', $this->getAuthorizationCode()); if (count($this->getApplyToTransactions()) > 0) { foreach ($this->getApplyToTransactions() as $applyToTransaction) { $applyToTransaction->writeXml($xml); } } //TODO online payment methods $xml->endElement(); //create_arpayment $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('record_otherreceipt'); $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getTransactionDate()); $xml->endElement(); //paymentdate $xml->writeElement('payee', $this->getPayer(), true); $xml->startElement('receiveddate'); $xml->writeDateSplitElements($this->getReceiptDate()); $xml->endElement(); //receiveddate $xml->writeElement('paymentmethod', $this->getPaymentMethod(), true); if ($this->getBankAccountId() || $this->getDepositDate()) { $xml->writeElement('bankaccountid', $this->getBankAccountId(), true); if ($this->getDepositDate()) { $xml->startElement('depositdate'); $xml->writeDateSplitElements($this->getDepositDate(), true); $xml->endElement(); //depositdate } } else { $xml->writeElement('undepglaccountno', $this->getUndepositedFundsGlAccountNo(), true); } $xml->writeElement('refid', $this->getTransactionNo()); $xml->writeElement('description', $this->getDescription()); $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getExchangeRateDate() || $this->getExchangeRateType()) { if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $this->writeXmlExplicitCustomFields($xml); $xml->startElement('receiptitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('CM Other Receipt must have at least 1 line'); } $xml->endElement(); //receiptitems $xml->endElement(); //record_otherreceipt $xml->endElement(); //function }
/** * Write the expense block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('expense'); if (!empty($this->getExpenseType())) { $xml->writeElement('expensetype', $this->getExpenseType(), true); } else { $xml->writeElement('glaccountno', $this->getGlAccountNumber(), true); } $xml->writeElement('amount', $this->getReimbursementAmount()); $xml->writeElement('currency', $this->getTransactionCurrency()); $xml->writeElement('trx_amount', $this->getTransactionAmount()); if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } if ($this->getExchangeRateType()) { $xml->writeElement('exchratetype', $this->getExchangeRateType()); } elseif ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getTransactionCurrency() || $this->getTransactionAmount()) { $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } if ($this->getExpenseDate()) { $xml->startElement('expensedate'); $xml->writeDateSplitElements($this->getExpenseDate(), true); $xml->endElement(); } $xml->writeElement('memo', $this->getPaidTo()); $xml->writeElement('form1099', $this->isForm1099()); $xml->writeElement('paidfor', $this->getPaidFor()); $xml->writeElement('locationid', $this->getLocationId()); $xml->writeElement('departmentid', $this->getDepartmentId()); $this->writeXmlExplicitCustomFields($xml); $xml->writeElement('projectid', $this->getProjectId()); $xml->writeElement('customerid', $this->getCustomerId()); $xml->writeElement('vendorid', $this->getVendorId()); $xml->writeElement('employeeid', $this->getEmployeeId()); $xml->writeElement('itemid', $this->getItemId()); $xml->writeElement('classid', $this->getClassId()); $xml->writeElement('contractid', $this->getContractId()); $xml->writeElement('warehouseid', $this->getWarehouseId()); $xml->writeElement('billable', $this->isBillable()); $xml->writeElement('exppmttype', $this->getPaymentTypeName()); $xml->writeElement('quantity', $this->getQuantity()); $xml->writeElement('rate', $this->getUnitRate()); $xml->endElement(); //expense }
/** * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('apply_arpayment'); if (!$this->getRecordNo()) { throw new InvalidArgumentException('Record No is required for apply'); } $xml->writeElement('arpaymentkey', $this->getRecordNo(), true); if (!$this->getReceivedDate()) { throw new InvalidArgumentException('Received Date is required for apply'); } $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getReceivedDate(), true); $xml->endElement(); //paymentdate $xml->writeElement('batchkey', $this->getSummaryRecordNo()); $xml->writeElement('overpaylocid', $this->getOverpaymentLocationId()); $xml->writeElement('overpaydeptid', $this->getOverpaymentDepartmentId()); if (count($this->getApplyToTransactions()) > 0) { $xml->startElement('arpaymentitems'); foreach ($this->getApplyToTransactions() as $applyToTransaction) { $applyToTransaction->writeXml($xml); } $xml->endElement(); //arpaymentitems } $xml->endElement(); //apply_arpayment $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_arpaymentbatch'); if (!$this->getTitle()) { throw new InvalidArgumentException('Title is required for create'); } $xml->writeElement('batchtitle', $this->getTitle(), true); if ($this->getUndepositedFundsGlAccountNo()) { $xml->writeElement('undepfundsacct', $this->getUndepositedFundsGlAccountNo()); } elseif ($this->getBankAccountId()) { $xml->writeElement('bankaccountid', $this->getBankAccountId()); } if (!$this->getGlPostingDate()) { throw new InvalidArgumentException('GL Posting Date is required for create'); } $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //datecreated $xml->endElement(); //create_arpaymentbatch $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_aradjustmentbatch'); if (!$this->getTitle()) { throw new InvalidArgumentException('Title is required for create'); } $xml->writeElement('batchtitle', $this->getTitle(), true); if (!$this->getGlPostingDate()) { throw new InvalidArgumentException('GL Posting Date is required for create'); } $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //datecreated /*if (count($this->getApAdjustments()) > 0) { foreach ($this->getApAdjustments() as $apAdjustment) { $bill->writeXml($xml); } }*/ $xml->endElement(); //create_aradjustmentbatch $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('update_cctransaction'); if (!$this->getRecordNo()) { throw new InvalidArgumentException('Record No is required for update'); } $xml->writeAttribute('key', $this->getRecordNo()); if ($this->getTransactionDate()) { $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getTransactionDate()); $xml->endElement(); //paymentdate } $xml->writeElement('referenceno', $this->getReferenceNumber()); $xml->writeElement('payee', $this->getPayee()); $xml->writeElement('description', $this->getDescription()); $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getExchangeRateDate() || $this->getExchangeRateType()) { if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $this->writeXmlExplicitCustomFields($xml); if (count($this->getLines()) > 0) { $xml->startElement('updateccpayitems'); foreach ($this->getLines() as $line) { $line->writeXml($xml); } $xml->endElement(); //updateccpayitems } $xml->endElement(); //update_cctransaction $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('record_cctransaction'); $xml->writeElement('chargecardid', $this->getChargeCardId(), true); $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getTransactionDate()); $xml->endElement(); //paymentdate $xml->writeElement('referenceno', $this->getReferenceNumber()); $xml->writeElement('payee', $this->getPayee()); $xml->writeElement('description', $this->getDescription()); $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getExchangeRateDate() || $this->getExchangeRateType()) { if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $this->writeXmlExplicitCustomFields($xml); $xml->startElement('ccpayitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('CM Charge Card Transaction must have at least 1 line'); } $xml->endElement(); //ccpayitems $xml->endElement(); //record_cctransaction $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_expensereport'); $xml->writeElement('employeeid', $this->getEmployeeId(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate()); $xml->endElement(); //datecreated if ($this->getGlPostingDate()) { $xml->startElement('dateposted'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //dateposted } $xml->writeElement('batchkey', $this->getSummaryRecordNo()); $xml->writeElement('expensereportno', $this->getExpenseReportNumber()); $xml->writeElement('state', $this->getAction()); $xml->writeElement('description', $this->getReasonForExpense()); $xml->writeElement('memo', $this->getMemo()); $xml->writeElement('externalid', $this->getExternalId()); $xml->writeElement('basecurr', $this->getBaseCurrency()); $xml->writeElement('currency', $this->getReimbursementCurrency()); $this->writeXmlExplicitCustomFields($xml); $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->startElement('expenses'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('EE Report must have at least 1 line'); } $xml->endElement(); //expenses $xml->endElement(); //create_expensereport $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_apadjustment'); $xml->writeElement('vendorid', $this->getVendorId(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate(), true); $xml->endElement(); //datecreated if ($this->getGlPostingDate()) { $xml->startElement('dateposted'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //dateposted } $xml->writeElement('batchkey', $this->getSummaryRecordNo()); $xml->writeElement('adjustmentno', $this->getAdjustmentNumber()); $xml->writeElement('action', $this->getAction()); $xml->writeElement('billno', $this->getBillNumber()); $xml->writeElement('description', $this->getDescription()); $xml->writeElement('externalid', $this->getExternalId()); $this->writeXmlMultiCurrencySection($xml); $xml->writeElement('nogl', $this->isDoNotPostToGL()); $this->writeXmlExplicitCustomFields($xml); $xml->startElement('apadjustmentitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('AP Vendor Adjustment must have at least 1 line'); } $xml->endElement(); //apadjustmentitems $xml->endElement(); //create_apadjustment $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_paymentrequest'); if ($this->getChargeCardId()) { $xml->writeElement('chargecardid', $this->getChargeCardId(), true); } else { $xml->writeElement('bankaccountid', $this->getBankAccountId(), true); } if (!$this->getVendorId()) { throw new InvalidArgumentException('Vendor ID is required for create payment request'); } $xml->writeElement('vendorid', $this->getVendorId(), true); $xml->writeElement('memo', $this->getMemo()); if (!$this->getPaymentMethod()) { throw new InvalidArgumentException('Payment Method is required for create payment request'); } $xml->writeElement('paymentmethod', $this->getPaymentMethod(), true); $xml->writeElement('grouppayments', $this->isGroupPayments()); if (!$this->getPaymentDate()) { throw new InvalidArgumentException('Payment Date is required for create payment request'); } $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getPaymentDate(), true); $xml->endElement(); //paymentdate $xml->writeElement('paymentoption', $this->getMergeOption()); if (count($this->getApplyToTransactions()) > 0) { $xml->startElement('paymentrequestitems'); foreach ($this->getApplyToTransactions() as $applyToTransaction) { $applyToTransaction->writeXml($xml); } $xml->endElement(); //paymentrequestitems } else { throw new InvalidArgumentException('AP Payment Request must have at least 1 transaction to apply against'); } // TODO: what about paymentamount element? only in v3.0 schema - was removed from v2.1 schema $xml->writeElement('documentnumber', $this->getDocumentNo()); // TODO: review paymentdescription vs memo $xml->writeElement('paymentdescription', $this->getMemo()); $xml->writeElement('paymentcontact', $this->getNotificationContactName()); $xml->endElement(); //create_paymentrequest $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_reimbursementrequest'); if (!$this->getBankAccountId()) { throw new InvalidArgumentException('Bank Account ID is required for create reimbursement request'); } $xml->writeElement('bankaccountid', $this->getBankAccountId(), true); if (!$this->getEmployeeId()) { throw new InvalidArgumentException('Employee ID is required for create reimbursement request'); } $xml->writeElement('employeeid', $this->getEmployeeId(), true); $xml->writeElement('memo', $this->getMemo()); if (!$this->getPaymentMethod()) { throw new InvalidArgumentException('Payment Method is required for create reimbursement request'); } $xml->writeElement('paymentmethod', $this->getPaymentMethod(), true); if (!$this->getPaymentDate()) { throw new InvalidArgumentException('Payment Date is required for create reimbursement request'); } $xml->startElement('paymentdate'); $xml->writeDateSplitElements($this->getPaymentDate(), true); $xml->endElement(); //paymentdate $xml->writeElement('paymentoption', $this->getMergeOption()); if (count($this->getApplyToTransactions()) > 0) { $xml->startElement('eppaymentrequestitems'); foreach ($this->getApplyToTransactions() as $applyToTransaction) { $applyToTransaction->writeXml($xml); } $xml->endElement(); //eppaymentrequestitems } else { throw new InvalidArgumentException('EE Reimbursement Request must have at least 1 transaction to apply against'); } $xml->writeElement('documentnumber', $this->getDocumentNo()); $xml->writeElement('paymentdescription', $this->getMemo()); $xml->writeElement('paymentcontact', $this->getNotificationContactName()); $xml->endElement(); //create_reimbursementrequest $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_ictransaction'); $xml->writeElement('transactiontype', $this->getTransactionDefinition(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate(), true); $xml->endElement(); //datecreated $xml->writeElement('createdfrom', $this->getCreatedFrom()); $xml->writeElement('documentno', $this->getDocumentNumber()); $xml->writeElement('referenceno', $this->getReferenceNumber()); $xml->writeElement('message', $this->getMessage()); $xml->writeElement('externalid', $this->getExternalId()); $xml->writeElement('basecurr', $this->getBaseCurrency()); $this->writeXmlExplicitCustomFields($xml); $xml->writeElement('state', $this->getState()); $xml->startElement('ictransitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('IC Transaction must have at least 1 line'); } $xml->endElement(); //ictransitems if (count($this->getSubtotals()) > 0) { $xml->startElement('subtotals'); foreach ($this->getSubtotals() as $subtotal) { $subtotal->writeXml($xml); } $xml->endElement(); //subtotals } $xml->endElement(); //create_ictransaction $xml->endElement(); //function }
/** * Write the itemdetail block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('itemdetail'); $xml->writeElement('quantity', $this->getQuantity()); if ($this->getSerialNumber()) { $xml->writeElement('serialno', $this->getSerialNumber()); } elseif ($this->getLotNumber()) { $xml->writeElement('lotno', $this->getLotNumber()); } $xml->writeElement('aisle', $this->getAisle()); $xml->writeElement('row', $this->getRow()); $xml->writeElement('bin', $this->getBin()); if ($this->getItemExpiration()) { $xml->startElement('itemexpiration'); $xml->writeDateSplitElements($this->getItemExpiration()); $xml->endElement(); //itemexpiration } $xml->endElement(); //itemdetail }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('reverse_bill'); if (!$this->getRecordNo()) { throw new InvalidArgumentException('Record No is required for reverse'); } $xml->writeAttribute('key', $this->getRecordNo()); if (!$this->getReverseDate()) { throw new InvalidArgumentException('Reverse Date is required for reverse'); } $xml->startElement('datereversed'); $xml->writeDateSplitElements($this->getReverseDate()); $xml->endElement(); //datereversed $xml->writeElement('description', $this->getMemo()); $xml->endElement(); //reverse_bill $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('record_deposit'); if (!$this->getBankAccountId()) { throw new InvalidArgumentException('Bank Account ID is required for deposit'); } $xml->writeElement('bankaccountid', $this->getBankAccountId(), true); if (!$this->getDepositDate()) { throw new InvalidArgumentException('Deposit Date is required for deposit'); } $xml->startElement('depositdate'); $xml->writeDateSplitElements($this->getDepositDate(), true); $xml->endElement(); //depositdate if (!$this->getDepositSlipId()) { throw new InvalidArgumentException('Deposit Slip ID is required for deposit'); } $xml->writeElement('depositid', $this->getDepositSlipId(), true); $xml->startElement('receiptkeys'); if (count($this->getTransactionKeysToDeposit()) > 0) { foreach ($this->getTransactionKeysToDeposit() as $key) { $xml->writeElement('receiptkey', $key, true); } } else { throw new InvalidArgumentException('CM Deposit must have at least 1 transaction key to deposit'); } $xml->endElement(); //receiptkeys $xml->writeElement('description', $this->getDescription()); $xml->writeElement('supdocid', $this->getAttachmentsId()); $this->writeXmlExplicitCustomFields($xml); $xml->endElement(); //record_deposit $xml->endElement(); //function }
/** * @covers Intacct\Xml\XMLWriter::writeElement * @covers Intacct\Xml\XMLWriter::writeDateSplitElements */ public function testDateSplitElements() { $expected = <<<EOF <?xml version="1.0"?> <date> <year>2016</year> <month>03</month> <day>01</day> </date> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $date = new DateType("2016-03-01"); $xml->startElement("date"); $xml->writeDateSplitElements($date, true); $xml->endElement(); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * Write the function block XML * * @param XMLWriter $xml * @throw InvalidArgumentException */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_bill'); $xml->writeElement('vendorid', $this->getVendorId(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate()); $xml->endElement(); //datecreated if ($this->getGlPostingDate()) { $xml->startElement('dateposted'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //dateposted } if ($this->getDueDate()) { $xml->startElement('datedue'); $xml->writeDateSplitElements($this->getDueDate(), true); $xml->endElement(); // datedue $xml->writeElement('termname', $this->getPaymentTerm()); } else { $xml->writeElement('termname', $this->getPaymentTerm(), true); } $xml->writeElement('action', $this->getAction()); $xml->writeElement('batchkey', $this->getSummaryRecordNo()); $xml->writeElement('billno', $this->getBillNumber()); $xml->writeElement('ponumber', $this->getReferenceNumber()); $xml->writeElement('onhold', $this->isOnHold()); $xml->writeElement('description', $this->getDescription()); $xml->writeElement('externalid', $this->getExternalId()); if ($this->getPayToContactName()) { $xml->startElement('payto'); $xml->writeElement('contactname', $this->getPayToContactName()); $xml->endElement(); //payto } if ($this->getReturnToContactName()) { $xml->startElement('returnto'); $xml->writeElement('contactname', $this->getReturnToContactName()); $xml->endElement(); //returnto } $this->writeXmlMultiCurrencySection($xml); $xml->writeElement('nogl', $this->isDoNotPostToGL()); $xml->writeElement('supdocid', $this->getAttachmentsId()); $this->writeXmlExplicitCustomFields($xml); $xml->startElement('billitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('AP Bill must have at least 1 line'); } $xml->endElement(); //billitems $xml->endElement(); //create_bill $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_sotransaction'); $xml->writeElement('transactiontype', $this->getTransactionDefinition(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate(), true); $xml->endElement(); //datecreated if ($this->getGlPostingDate()) { $xml->startElement('dateposted'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //dateposted } $xml->writeElement('createdfrom', $this->getCreatedFrom()); $xml->writeElement('customerid', $this->getCustomerId(), true); $xml->writeElement('documentno', $this->getDocumentNumber()); if ($this->getOriginalDocumentDate()) { $xml->startElement('origdocdate'); $xml->writeDateSplitElements($this->getOriginalDocumentDate(), true); $xml->endElement(); //origdocdate } $xml->writeElement('referenceno', $this->getReferenceNumber()); $xml->writeElement('termname', $this->getPaymentTerm()); if ($this->getDueDate()) { $xml->startElement('datedue'); $xml->writeDateSplitElements($this->getDueDate(), true); $xml->endElement(); //datedue } $xml->writeElement('message', $this->getMessage()); $xml->writeElement('shippingmethod', $this->getShippingMethod()); if ($this->getShipToContactName()) { $xml->startElement('shipto'); $xml->writeElement('contactname', $this->getShipToContactName(), true); $xml->endElement(); } if ($this->getBillToContactName()) { $xml->startElement('billto'); $xml->writeElement('contactname', $this->getBillToContactName(), true); $xml->endElement(); } $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->writeElement('externalid', $this->getExternalId()); $xml->writeElement('basecurr', $this->getBaseCurrency()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } if ($this->getExchangeRateType()) { $xml->writeElement('exchratetype', $this->getExchangeRateType()); } elseif ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getBaseCurrency() || $this->getTransactionCurrency()) { $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $xml->writeElement('vsoepricelist', $this->getVsoePriceList()); $this->writeXmlExplicitCustomFields($xml); $xml->writeElement('state', $this->getState()); $xml->writeElement('projectid', $this->getProjectId()); $xml->startElement('sotransitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('OE Transaction must have at least 1 line'); } $xml->endElement(); //sotransitems if (count($this->getSubtotals()) > 0) { $xml->startElement('subtotals'); foreach ($this->getSubtotals() as $subtotal) { $subtotal->writeXml($xml); } $xml->endElement(); //subtotals } $xml->endElement(); //create_sotransaction $xml->endElement(); //function }
/** * Write the function block XML * * @param XMLWriter $xml */ public function writeXml(XMLWriter &$xml) { $xml->startElement('function'); $xml->writeAttribute('controlid', $this->getControlId()); $xml->startElement('create_potransaction'); $xml->writeElement('transactiontype', $this->getTransactionDefinition(), true); $xml->startElement('datecreated'); $xml->writeDateSplitElements($this->getTransactionDate(), true); $xml->endElement(); //datecreated if ($this->getGlPostingDate()) { $xml->startElement('dateposted'); $xml->writeDateSplitElements($this->getGlPostingDate(), true); $xml->endElement(); //dateposted } $xml->writeElement('createdfrom', $this->getCreatedFrom()); $xml->writeElement('vendorid', $this->getVendorId(), true); $xml->writeElement('documentno', $this->getDocumentNumber()); $xml->writeElement('referenceno', $this->getReferenceNumber()); $xml->writeElement('vendordocno', $this->getVendorDocNumber()); $xml->writeElement('termname', $this->getPaymentTerm()); if ($this->getDueDate()) { $xml->startElement('datedue'); $xml->writeDateSplitElements($this->getDueDate(), true); $xml->endElement(); //datedue } else { throw new InvalidArgumentException('Due Date is required for create'); } $xml->writeElement('message', $this->getMessage()); $xml->writeElement('shippingmethod', $this->getShippingMethod()); $xml->startElement('returnto'); $xml->writeElement('contactname', $this->getReturnToContactName(), true); $xml->endElement(); //returnto $xml->startElement('payto'); $xml->writeElement('contactname', $this->getPayToContactName(), true); $xml->endElement(); //payto $xml->writeElement('supdocid', $this->getAttachmentsId()); $xml->writeElement('externalid', $this->getExternalId()); $xml->writeElement('basecurr', $this->getBaseCurrency()); $xml->writeElement('currency', $this->getTransactionCurrency()); if ($this->getExchangeRateDate()) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->getExchangeRateDate(), true); $xml->endElement(); } if ($this->getExchangeRateType()) { $xml->writeElement('exchratetype', $this->getExchangeRateType()); } elseif ($this->getExchangeRateValue()) { $xml->writeElement('exchrate', $this->getExchangeRateValue()); } elseif ($this->getBaseCurrency() || $this->getTransactionCurrency()) { $xml->writeElement('exchratetype', $this->getExchangeRateType(), true); } $this->writeXmlExplicitCustomFields($xml); $xml->writeElement('state', $this->getState()); $xml->startElement('potransitems'); if (count($this->getLines()) > 0) { foreach ($this->getLines() as $line) { $line->writeXml($xml); } } else { throw new InvalidArgumentException('PO Transaction must have at least 1 line'); } $xml->endElement(); //potransitems if (count($this->getSubtotals()) > 0) { $xml->startElement('subtotals'); foreach ($this->getSubtotals() as $subtotal) { $subtotal->writeXml($xml); } $xml->endElement(); //subtotals } $xml->endElement(); //create_potransaction $xml->endElement(); //function }
/** * @param XMLWriter $xml */ protected function writeXmlMultiCurrencySection(XMLWriter &$xml) { $xml->writeElement('basecurr', $this->baseCurrency); $xml->writeElement('currency', $this->transactionCurrency); if ($this->exchangeRateDate) { $xml->startElement('exchratedate'); $xml->writeDateSplitElements($this->exchangeRateDate, true); $xml->endElement(); } if ($this->exchangeRateType) { $xml->writeElement('exchratetype', $this->exchangeRateType); } elseif ($this->exchangeRateValue) { $xml->writeElement('exchrate', $this->exchangeRateValue); } elseif ($this->baseCurrency || $this->transactionCurrency) { $xml->writeElement('exchratetype', $this->exchangeRateType, true); } }