dave_mck Posted October 7, 2013 Posted October 7, 2013 (edited) Im trying to get the 'tax_class_id' so I can export it into a file for import into MYOB. I've modifyed the MYOB Export module for my purposes but can't seem to get this one value passed. <?php /* $Id: myob_sale.php,v 1.0BETA 04/08/2003 11:32:53 frankl Exp * Originally qb_iif_sale.php $Created by Steve K. of Cantexgroup * http://www.cantexgroup.ca/ email: [email protected] * Modified for Quickbooks 2001 and OSC 2.2 by Tom St.Croix of Better Than Nature * http://www.betterthannature.com/catalog/ * email: [email protected] * Modified again for MYOB by Frank L. * Modified again for MYOB v17 (NZ) by Charlie F. * Modified again for AccountEdge 2012 (CA) by Dave_mck. * Copyright (C) 2002 Steve K. Released under GPL and may be modified.*/ $salefile = $DOCUMENT_ROOT ."myob/myob_sale" . date(m) .date(d) .date(y) . "-" .date(H) .date(i) . date(s) . ".txt"; // Where will our transaction import file be located? $transaction_header ="LASTNAME\tORDERNUM\tITEMNO\tQTY\tPRICE\tTAXCODE\tCOMMENTS"; // some info we may need $customers_lastname = $order->customer['lastname']; $payment_method = $order->info['payment_method']; $shipvia = $order->info['shipping_method']; $comments = str_replace(array("\n", "\t", "\r"), ' ', $order->info['comments']); // Now we setup some of the info that we need to send to the file $ordernum = $insert_id; //this will be the order number // Open transaction import file for appending, create it if necessary. 1 line for each product. $fp = fopen($salefile,"a"); fputs($fp,"$transaction_header\r\n"); $lines=$ordernum; $lines++; for ($i=0; $i<sizeof($order->products); $i++) { $product_number = $order->products[$i]['model']; $qty = $order->products[$i]['qty']; $product_price = $order->products[$i]['price']; $product_price = number_format($product_price, 2, '.', ''); $taxcode = $order->products[$i]['tax_class_id']; if ($taxcode == "1") { $taxcode = "GST"; } elseif ($taxcode == "2") { $taxcode = "HST"; } elseif ($taxcode == "3") { $taxcode = "PST"; } elseif ($taxcode == "4") { $taxcode = "TX1"; } elseif ($taxcode == "5") { $taxcode = "TX2"; } ; $line ="$customers_lastname\t$ordernum\t$product_number\t$qty\t$product_price\t$taxcode\t$payment_method - $shipvia - $comments"; fputs($fp,"$line\r\n"); $lines++; } fclose($fp); ?> Edited October 7, 2013 by dave_mck Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.