def findchildren(part,tab): if tab==-1: desc = namedata[part] timeformat = format = "%d-%m-%Y %H:%M:%S" timenow = datetime.datetime.today().strftime(timeformat) part_text = part + ' ' + str(desc) date_text = 'As of: ' + timenow f.write('<node STYLE="fork" TEXT="' + part_text + '\n' + date_text + '">\n') f.write('<edge WIDTH="thin"/>\n') if part in matdata: result = matdata[part] if tab != -1: f.write(' FOLDED="true" >\n') tab+=1 for row in result: material = str(row[0]) materialdesc = namedata[material] html = string.replace(str(materialdesc), '&' , '&') html2 = string.replace(html, '"' , '"') quant = str(pysyteline.clean_number(row[1], 3)) if quant == '999.999': quant = 'A/R' else: quant = quant + '-off' line = str(row[0]) + ' ' + html2 + ' ' + quant #print line f.write('<node POSITION="right" TEXT="' + line + '"') next = findchildren(material, tab) if next != 'nochild': f.write('</node>\n') else: f.write('/>\n') return 'nochild'
def findchildren(part,tab): if tab==-1: desc = namedata[part] timeformat = format = "%d-%m-%Y %H:%M:%S" timenow = datetime.datetime.today().strftime(timeformat) part_text = part + ' ' + str(desc) date_text = 'As of: ' + timenow f.write('<node STYLE="fork" TEXT="' + part_text + '\n' + date_text + '">\n') f.write('<edge WIDTH="thin"/>\n') if part in matdata: result = matdata[part] if tab != -1: f.write(' FOLDED="true" >\n') tab+=1 for row in result: material = str(row[0]) materialdesc = str(namedata[material]) html = materialdesc.replace('&' , '&').replace('"' , '"') quant = str(pysyteline.clean_number(row[1], 3)) if quant == '999.999': quant = 'A/R' else: quant = quant + '-off' line = material + ' ' + html + ' ' + quant #print line if drawingsdb.has_key(material): link = 'LINK="//Sheffield/SPD_Data/Temporary/TimBrowning/Drawings/' + drawingsdb[material] +'" ' else: link = '' f.write('<node ' + link + 'POSITION="right" TEXT="' + line + '"') next = findchildren(material, tab) if next != 'nochild': f.write('</node>\n') else: f.write('/>\n') return 'nochild'