#!/usr/bin/perl #This script will generate a QuickBooks 2001 iif formatted invoice # that may be imported one at a time, or if you modify this script # as a subroutine, as a batch of invoices #First the header of the .iif file print "!TRNS\tTRNSID\tTRNSTYPE\tDATE\tACCNT\tNAME\tCLASS\tAMOUNT\tDOCNUM\tMEMO"; print "\tCLEAR\tTOPRINT\tNAMEISTAXABLE\tADDR1\tADDR2\tADDR3\tADDR4\tDUEDATE\tTERMS\tOTHER1\n"; print "!SPL\tSPLID\tTRNSTYPE\tDATE\tACCNT\tNAME\tCLASS\tAMOUNT\tDOCNUM\tMEMO"; print "\tCLEAR\tQNTY\tPRICE\tINVITEM\tPAYMETH\tTAXABLE\tVALADJ\tSERVICEDATE\tOTHER2\tEXTRA\n"; print "!ENDTRNS\n"; #And the invoice totals for this transaction $TRNSID=''; #leave blank $TRNSTYPE='INVOICE'; $DATE = '07/02/02'; #Format the date this way #Examine an invoice you created prior and place the Account here, #also may be found under your Chart of Accounts and as a rule should be #an Accounts Recievable $ACCNT = 'A-R:Retail Domestic'; #Customer Name, look under your Customer List $NAME = 'Last_Name, First_Name'; $CLASS = ''; $AMOUNT = '1076.42'; #The invoice total + sales tax $AMOUNT = sprintf("%.2f", $AMOUNT); #format this value 00.00 $DOCNUM = '13131313'; #Invoice Number $MEMO = ''; $CLEAR = 'N'; $TOPRINT = 'Y'; #This will set the Invoice To be printed, place N if you do not need this $NAMEISTAXABLE = 'Y'; $ADDR1='First_Name Last_Name'; $ADDR2='Street Address'; $ADDR3='City, State Zip'; $ADDR4=''; $DUEDATE=''; $TERMS = ''; $OTHER=''; #Generate the transaction header print "TRNS\t$TRNSID\t$TRNSTYPE\t$DATE\t$ACCNT\t$NAME\t$CLASS\t$AMOUNT\t$DOCNUM\t$MEMO"; print "\t$CLEAR\t$TOPRINT\t$NAMEISTAXABLE\t$ADDR1\t$ADDR2\t$ADDR3\t$ADDR4\t$DUEDATE\t$TERMS\t$OTHER1\n"; ########################### #Transaction details: split #for several items create a loop and place this part into it $SPLID=''; #leave blank $TRNSTYPE='INVOICE'; #This is the income account, examine an item under Item List, and place the #Income Account assosiated with this item here $ACCNT = 'SALES:Main'; $NAME = 'Invoice with Sales Tax'; $CLASS = ''; #The sale price of this item should go here, notice that the value should be negative $AMOUNT = '-999'; $AMOUNT = sprintf("%.2f", $AMOUNT); #format this value 00.00 $DOCNUM = ''; #leave blank $MEMO = 'Your items short description goes here'; $QNTY = '1'; #quantity $PRICE = '999'; #now this value is positive $PRICE = sprintf("%.2f", $PRICE); #format this value 00.00 #Now, gather information from your item list and format the line this way #Subitem of:Item Name/Number #if no Subitem of exists then just the Item Name/Number $INVITEM = 'Systems:CPU'; $PAYMETH = ''; #leave blank $TAXABLE = 'Y'; #everything is taxable $VALADJ = ''; $SERVICEDATE = ''; $OTHER =''; $EXTRA = ''; print "SPL\t$SPLID\t$TRNSTYPE\t$DATE\t$ACCNT\t$NAME\t$CLASS\t$AMOUNT\t$DOCNUM\t$MEMO"; print "\t$CLEAR\t$QNTY\t$PRICE\t$INVITEM\t$PAYMETH\t$TAXABLE\t$VALADJ\t$SERVICEDATE\t$OTHER2\t$EXTRA\n"; #now, the sales tax $SPLID=''; $TRNSTYPE='INVOICE'; $ACCNT = 'Sales Tax Payable'; $NAME = 'State Board of Equalization'; $CLASS = ''; #Negative amount of the sales tax $AMOUNT = '-77.42'; $AMOUNT = sprintf("%.2f", $AMOUNT); #format this value 00.00 $DOCNUM = ''; $MEMO = 'CA Sales Tax'; $QNTY = '1'; #its usually always 1 $PRICE = '7.75%'; #your sales tax in % $INVITEM = ''; $PAYMETH = ''; $TAXABLE = 'Y'; $VALADJ = ''; $SERVICEDATE = ''; $OTHER =''; $EXTRA = 'AUTOSTAX'; #wierd extra field print "SPL\t$SPLID\t$TRNSTYPE\t$DATE\t$ACCNT\t$NAME\t$CLASS\t$AMOUNT\t$DOCNUM\t$MEMO"; print "\t$CLEAR\t$QNTY\t$PRICE\t$INVITEM\t$PAYMETH\t$TAXABLE\t$VALADJ\t$SERVICEDATE\t$OTHER2\t$EXTRA\n"; print "ENDTRNS\n";