intacct-sdk-php icon indicating copy to clipboard operation
intacct-sdk-php copied to clipboard

Purchasing Transaction Create (setExchangeRateValue)

Open brunoda6 opened this issue 1 year ago • 0 comments

Hi,

Im trying to create a po from a pr. This pr has Custom exchange rate Type ("Custom") so i set the setExchangeRateValue with the value in float but i get a error saying that is empty i printed the object before send it and the value it's there but i keep receiving the error saying that the exchange rate is empty.

heres a snippet of my code:

$pt = new PurchasingTransactionCreate(); $pt->setTransactionDate($transactionDate); $pt->setTransactionDefinition($entidade['e_transaction_definition']); $pt->setCreatedFrom($pr['DOCID']); $pt->setRecordNo($pt->getControlId()); //$pt->setDocumentNumber($pr['DOCNO']); $pt->setVendorId($pr['CUSTVENDID']??''); $pt->setVendorDocNumber($pr['VENDORDOCNO']); $pt->setOriginalDocumentDate(DateTime::createFromFormat('d/m/Y', $pr['WHENCREATED'])); $pt->setDueDate(DateTime::createFromFormat('d/m/Y', $pr['WHENDUE'])); $pt->setMessage($pr['MESSAGE']??''); $pt->setBaseCurrency($pr['BASECURR']); $pt->setTransactionCurrency($pr['CURRENCY']); $pt->setExchangeRateDate(DateTime::createFromFormat('d/m/Y', $pr['EXCHRATEDATE'])); $pt->setExchangeRateType($pr['EXCHRATETYPES.NAME']??''); if($pr['EXCHRATETYPES.NAME'] == "Custom"){ $pt->setExchangeRateValue((float)$pr["EXCHRATE"]); } $pt->setState('Pending'); $pt->setLines($objLines); $pt->setReturnToContactName($pr['SHIPTO.CONTACTNAME']??''); $pt->setPayToContactName($pr['CONTACT.CONTACTNAME']??''); $pt->setShippingMethod($pr['SHIPVIA']??''); $pt->setReferenceNumber($pr['PONUMBER']??''); $pt->setPaymentTerm($pr['TERM.NAME']??''); $clientEntity = $this->clientEntity($pr['MEGAENTITYID']);

        if($clientEntity){
            $response = $clientEntity->execute($pt);
        }

The error is: PL03000004 Exchange rate is empty.

Note: In the sandbox panel i can convert successfully Can someone tell me if the problem is on my end?

brunoda6 avatar Mar 31 '23 11:03 brunoda6