我一直在定制的quickbooks课程中处理创建发票功能。我的快速书工作完美,我只是创建发票功能。我面临的问题是,当我直接使用ID来推送发票时,它就可以正常使用:(int)$ _ GET [' id']它不起作用。任何可能的想法为什么这种变化会产生这样的结果?如果你们需要更多代码,请告诉我们
要求的附加代码。
传递身份:
if ($_GET['submit'] == 1) {
$q = new QBonline();
$q->create_invoice((int)$_GET['id']);
}
创建发票:
public function create_invoice($job) {
$job = DB::ex("SELECT * FROM jobs, job_types, companies WHERE job_id = $job AND job_type = type_id AND job_company = company_id");
if (!$job[0]['job_id'] || !$job[0]['company_qbid']) return false;
$price = DB::ex("SELECT ccp_price FROM company_category_prices WHERE ccp_company = "
.$job[0]['job_company']." AND ccp_category = ".$job[0]['job_type']);
$amount = number_format((float)$price[0]['ccp_price'], 2);
debug($price);
$parentcat = DB::ex("SELECT type_name FROM job_types WHERE type_id = ".$job[0]['type_parent']);
$description = $job[0]['job_case_num'];
if ($job[0]['job_year_make_model']) $description .= ', for '.$job[0]['job_year_make_model'];
else $description .= " Appraisal";
$xml = '<?xml version="1.0" encoding="utf-16"?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.intuit.com/sb/cdm/v2">
<ExternalRealmId></ExternalRealmId>
<Object xsi:type="Invoice">
<Header>
<DocNumber>AUTO_GENERATE</DocNumber>
<TxnDate>'.date("Y-m-d-H:i", time()).'</TxnDate>
<Currency>USD</Currency>
<CustomerId>'.$job[0]['company_qbid'].'</CustomerId>
<TotalAmt>'.$amount.'</TotalAmt>
<DueDate></DueDate>
<DiscountAmt>0</DiscountAmt>
</Header>
<Line>
<Desc>'.$description.'</Desc>
<ItemName>'.$description.'</ItemName>
<UnitPrice>'.$amount.'</UnitPrice>
<Qty>1</Qty>
</Line>
</Object>
</Add>';
$result = false;
$result = $this->push_data("https://qbo.intuit.com/qbo27/resource/invoice/v2/number", $xml, true);
if ($result) {
debug($result);
}
return $result;
}