Monday, 15 February 2010

php - How do I set the sales tax for an invoice using QuickBooks IPP v3? -



php - How do I set the sales tax for an invoice using QuickBooks IPP v3? -

i'm creating invoice multiple lines. sales taxation set in quickbooks multiple provinces. i've read through https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/global_tax_model thought of how integrate, it's confusing. have follow international instructions because in canada.

what understand each salesitemlinedetail gets set taxcode have query for. how query specific gst rate? (currently set gst , hst on)

i need taxation exclusive. not find set this.

do need add together taxline, or automatically done me quickbooks?

current snippet of code looks this:

// set ipp version v3 $ipp->version(quickbooks_ipp_ids::version_3); $invoiceservice = new quickbooks_ipp_service_invoice(); $invoice = new quickbooks_ipp_object_invoice(); $invoice->setdocnumber("dvl-".$invoice_id); $invoice->settxndate($orderdate); $line = new quickbooks_ipp_object_line(); $line->setdetailtype('salesitemlinedetail'); $line->setdescription($service['name']); $line->setamount($service['price']); $ordertotal += $service['price']; $salesitemlinedetail = new quickbooks_ipp_object_salesitemlinedetail(); $salesitemlinedetail->setunitprice($service['price']); $salesitemlinedetail->setqty(1); //set sales taxation here? $line->addsalesitemlinedetail($salesitemlinedetail); $invoice->addline($line);

so figured out. @ least, have works.

$taxcodeservice = new quickbooks_ipp_service_taxcode(); if($property_details['province'] == "on" || $property_details['province'] == "ontario"){ $tax_name = "hst on"; } else { $tax_name = "gst"; } $taxcodes = $taxcodeservice->query($context, $realm, "select * taxcode name = '".$tax_name."'"); $this_tax_code = ""; foreach ($taxcodes $taxcode) { $this_tax_code = $taxcode->getid(); }

this gives me id of rate want, , when setting salesitemlinedetail simply:

$salesitemlinedetail->settaxcoderef($this_tax_code);

php quickbooks quickbooks-online

No comments:

Post a Comment