【发布时间】:2020-01-16 13:24:53
【问题描述】:
我想用我的网站到 Quick Books 桌面应用程序中的非库存项目创建发票。我正在使用以下 github 存储库: https://github.com/consolibyte/quickbooks-php
请帮帮我,我如何使用非库存物品创建发票?
我已添加示例代码来创建包含非库存项目的发票:
<?php
$primary_key_of_your_customer = 5;
require_once '../../QuickBooks.php';
$user = 'user';
$pass = 'pass';
$map = array(QUICKBOOKS_ADD_INVOICE => array( '_quickbooks_invoice_add_request', '_quickbooks_invoice_add_response' ));
$errmap = array(3070 => '_quickbooks_error_stringtoolong');
$hooks = array();
$log_level = QUICKBOOKS_LOG_DEBUG;
$soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;
$soap_options = array();
$handler_options = array( 'deny_concurrent_logins' => false,
'deny_reallyfast_logins' => false,
);
$driver_options = array();
$callback_options = array();
$dsn = 'mysqli://root:password@localhost/quickbooks';
$Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
$response = $Server->handle(true, true);
$Queue = new QuickBooks_WebConnector_Queue($dsn);
$Queue->enqueue(QUICKBOOKS_ADD_INVOICE, $primary_key_of_your_customer);
function _quickbooks_invoice_add_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq>
<InvoiceAdd defMacro="MACROTYPE">
<CustomerRef>
<ListID >80000257-1578565322</ListID>
<FullName >ConsoliBYTE, LLC (1001546518)</FullName>
</CustomerRef>
<RefNumber >STRTYPE</RefNumber>
<BillAddress>
<Addr1 >Addr1</Addr1>
<Addr2 >Addr2</Addr2>
<City >indore</City>
<State >TX</State>
<PostalCode >482201</PostalCode>
<Country >US</Country>
<Note >Notes</Note>
</BillAddress>
<ShipAddress>
<Addr1 >old palasia</Addr1>
<Addr2 >stree 123</Addr2>
<City >Katni</City>
<State >TX</State>
<PostalCode >48002</PostalCode>
<Country >US</Country>
<Note >Shipping</Note>
</ShipAddress>
<IsPending >true</IsPending>
<PONumber >PONumber</PONumber>
<ShipMethodRef>
<ListID ></ListID>
<FullName >Fedex</FullName>
</ShipMethodRef>
<Other >Other</Other>
<InvoiceLineAdd>
<ItemRef>
<FullName >item</FullName>
</ItemRef>
<Desc >item Desc</Desc>
<Quantity >1</Quantity>
<UnitOfMeasure >UnitOfMeasure</UnitOfMeasure>
<Rate >1.5</Rate>
<Amount >1.5</Amount>
<Other1 >Other1</Other1>
<Other2 >Other2</Other2>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
}
function _quickbooks_invoice_add_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
}
function _quickbooks_error_stringtoolong($requestID, $user, $action, $ID, $extra, &$err, $xml, $errnum, $errmsg)
{
}
【问题讨论】:
-
您好,欢迎来到 StackOverflow!您需要更具体地说明您需要什么帮助。
-
请发布您迄今为止尝试/编写的代码,以便我们提供帮助。
-
得到三种不同类型的错误: A.errorMsg="3040:在“金额”字段中转换金额“1.5”时出错。“你能告诉我,究竟是什么代码错误? /////////////////// B. 3140:发票中对 QuickBooks Ship Method "Fedex" 的引用无效。 QuickBooks 错误消息:参数无效。列表中不存在指定的记录。创建发票前是否需要创建运输方式?
-
C. 3140:发票行中对 QuickBooks 项目“项目”的引用无效。 QuickBooks 错误消息:参数无效。列表中不存在指定的记录。想要使用发票创建非库存项目,但根据错误消息,我认为我需要在 QB 上添加项目以传递他们的参考。是这样吗?
标签: php quickbooks