457	Items	\N	<!DOCTYPE openRPTDef>\n<report>\n <title>Items</title>\n <name>Items</name>\n <description></description>\n <grid>\n  <snap/>\n  <show/>\n  <x>0.05</x>\n  <y>0.05</y>\n </grid>\n <size>Letter</size>\n <portrait/>\n <topmargin>50</topmargin>\n <bottommargin>50</bottommargin>\n <rightmargin>50</rightmargin>\n <leftmargin>50</leftmargin>\n <querysource>\n  <name>detail</name>\n  <sql>SELECT\n       &lt;? if exists("ListNumericItemNumbersFirst") ?>\n         DISTINCT ON ( toNumeric(item_number, 999999999999999), item_number )\n       &lt;? else ?>\n         DISTINCT ON ( item_number )\n       &lt;? endif ?>\n       item_number,\n       item_descrip1,\n       item_descrip2,\n       formatBoolYN(item_active) AS active,\n       CASE WHEN (item_type='M') THEN 'Manufactured'\n            WHEN (item_type='P') THEN 'Purchased'\n            WHEN (item_type='F') THEN 'Phantom'\n            WHEN (item_type='B') THEN 'Breeder'\n            WHEN (item_type='C') THEN 'Co-Product'\n            WHEN (item_type='Y') THEN 'By-Product'\n            WHEN (item_type='R') THEN 'Reference'\n            WHEN (item_type='T') THEN 'Tooling'\n            WHEN (item_type='O') THEN 'Outside Process'\n            WHEN (item_type='J') THEN 'Job'\n            WHEN (item_type='K') THEN 'Kit'\n            WHEN (item_type='L') THEN 'Planning'\n            ELSE item_type\n       END AS itemtype,\n       iuom.uom_name AS invuom,\n       itemcapuom(item_id) AS capuom,\n       itemaltcapuom(item_id) AS altcapuom,\n       puom.uom_name AS priceuom,\n       puom.uom_name AS shipuom,\n       formatRatio(itemcapinvrat(item_id)) AS capratio,\n       formatRatio(itemaltcapinvrat(item_id)) AS altcapratio,\n       formatRatio(iteminvpricerat(item_id)) AS shipratio,\n       formatRatio(iteminvpricerat(item_id)) AS priceratio,\n       formatBoolYN(item_sold) AS sold,\n       formatBoolYN(item_exclusive) AS exclusive,\n       formatBoolYN(item_picklist) AS picklist,\n       formatBoolYN(item_config) AS configured,\n       formatWeight(item_prodweight) AS prodweight,\n       formatWeight(item_packweight) AS packweight,\n       classcode_code\nFROM item\n  JOIN classcode ON (item_classcode_id=classcode_id)\n  JOIN prodcat ON (item_prodcat_id=prodcat_id)\n  JOIN uom iuom ON (item_inv_uom_id=iuom.uom_id)\n  JOIN uom puom ON (item_price_uom_id=puom.uom_id)\n&lt;? if exists("itemgrp_id") ?>\n  JOIN itemgrpitem ON (item_id=itemgrpitem_item_id)\n  JOIN itemgrp ON (itemgrp_id=itemgrpitem_itemgrp_id)\n&lt;? endif ?>\n&lt;? foreach("char_id_text_list") ?>\n  LEFT OUTER JOIN charass charass_alias&lt;? literal("char_id_text_list") ?> \n    ON ((charass_alias&lt;? literal("char_id_text_list") ?>.charass_target_type='I') \n    AND  (charass_alias&lt;? literal("char_id_text_list") ?>.charass_target_id=item_id)\n    AND  (charass_alias&lt;? literal("char_id_text_list") ?>.charass_char_id=&lt;? value("char_id_text_list") ?>))\n  LEFT OUTER JOIN char char_alias&lt;? literal("char_id_text_list") ?> \n    ON (charass_alias&lt;? literal("char_id_text_list") ?>.charass_char_id=char_alias&lt;? literal("char_id_text_list") ?>.char_id)\n&lt;? endforeach ?>\n&lt;? foreach("char_id_list_list") ?>\n  LEFT OUTER JOIN charass charass_alias&lt;? literal("char_id_list_list") ?> \n    ON ((charass_alias&lt;? literal("char_id_list_list") ?>.charass_target_type='I') \n    AND  (charass_alias&lt;? literal("char_id_list_list") ?>.charass_target_id=item_id)\n    AND  (charass_alias&lt;? literal("char_id_list_list") ?>.charass_char_id=&lt;? value("char_id_list_list") ?>))\n  LEFT OUTER JOIN char char_alias&lt;? literal("char_id_list_list") ?> \n    ON (charass_alias&lt;? literal("char_id_list_list") ?>.charass_char_id=char_alias&lt;? literal("char_id_list_list") ?>.char_id)\n&lt;? endforeach ?>\n&lt;? foreach("char_id_date_list") ?>\n  LEFT OUTER JOIN charass charass_alias&lt;? literal("char_id_date_list") ?> \n    ON ((charass_alias&lt;? literal("char_id_date_list") ?>.charass_target_type='I') \n    AND  (charass_alias&lt;? literal("char_id_date_list") ?>.charass_target_id=item_id)\n    AND  (charass_alias&lt;? literal("char_id_date_list") ?>.charass_char_id=&lt;? value("char_id_date_list") ?>))\n  LEFT OUTER JOIN char char_alias&lt;? literal("char_id_date_list") ?> \n    ON (charass_alias&lt;? literal("char_id_date_list") ?>.charass_char_id=char_alias&lt;? literal("char_id_date_list") ?>.char_id)\n&lt;? endforeach ?>\nWHERE ( true\n&lt;? if exists("search_pattern") ?>\n AND ( (item_number ~* &lt;? value("search_pattern") ?>)\n       OR  (item_descrip1 || item_descrip2 ~* &lt;? value("search_pattern") ?>) )\n&lt;? endif ?>\n&lt;? if exists("showPurchased") ?>\n AND (item_type IN ('P', 'O'))\n&lt;? elseif exists("showManufactured") ?>\n AND (item_type IN ('M', 'F', 'B','K'))\n&lt;? elseif exists("showSold") ?>\n AND (item_sold)\n&lt;? endif ?>\n&lt;? if exists("item_type") ?>\n AND (item_type=&lt;? value("item_type") ?>)\n&lt;? endif ?>\n&lt;? if not exists("showInactive") ?>\n AND (item_active)\n&lt;? endif ?>\n&lt;? if exists("classcode_id") ?>\n AND (item_classcode_id=&lt;? value("classcode_id") ?>)\n&lt;? endif ?>\n&lt;? if exists("prodcat_id") ?>\n AND (item_prodcat_id=&lt;? value("prodcat_id") ?>)\n&lt;? endif ?>\n&lt;? if exists("freightclass_id") ?>\n AND (item_freightclass_id=&lt;? value("freightclass_id") ?>)\n&lt;? endif ?>\n&lt;? if exists("itemgrp_id") ?>\n AND (itemgrp_id=&lt;? value("itemgrp_id") ?>)\n&lt;? endif ?>\n&lt;? if exists("item_number_pattern") ?>\n AND (item_number ~* &lt;? value("item_number_pattern") ?>)\n&lt;? endif ?>\n&lt;? if exists("item_descrip_pattern") ?>\n AND (item_descrip1 || item_descrip2 ~* &lt;? value("item_descrip_pattern") ?>)\n&lt;? endif ?>\n&lt;? if exists("classcode_pattern") ?>\n AND (classcode_code ~* &lt;? value("classcode_pattern") ?>)\n&lt;? endif ?>\n&lt;? if exists("prodcat_pattern") ?>\n AND (prodcat_code  ~* &lt;? value("prodcat_pattern") ?>)\n&lt;? endif ?>\n&lt;? if exists("freightclass_pattern") ?>\n AND (freightclass_code ~* &lt;? value("freightclass_pattern") ?>)\n&lt;? endif ?>\n&lt;? literal("charClause") ?>\n) ORDER BY\n&lt;? if exists("ListNumericItemNumbersFirst") ?>\n toNumeric(item_number, 999999999999999),\n&lt;? endif ?>\n item_number;</sql>\n </querysource>\n <rpthead>\n  <height>241</height>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>160</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item Number</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>205</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Configured</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>203</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item Type</string>\n  </label>\n  <label>\n   <rect>\n    <x>640</x>\n    <y>160</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Packaging Weight</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>160</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Sold</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>220</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Shipping UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>203</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Price UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>104</x>\n    <y>220</y>\n    <width>66</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Class Code</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>190</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Pick List</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>190</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Alt. Capacity/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>220</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Shipping/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>160</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Inventory UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>190</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description 2</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>190</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Alt. Capacity UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>175</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Capacity/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>175</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Capacity UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>175</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Exclusive</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>220</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Active</string>\n  </label>\n  <label>\n   <rect>\n    <x>640</x>\n    <y>175</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Product Weight</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>175</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description 1</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>203</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Price/Inventory Ratio</string>\n  </label>\n  <line>\n   <xstart>5</xstart>\n   <ystart>235</ystart>\n   <xend>745</xend>\n   <yend>235</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>385</x>\n    <y>5</y>\n    <width>356</width>\n    <height>37</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>18</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Items</string>\n  </label>\n  <text>\n   <rect>\n    <x>10</x>\n    <y>28</y>\n    <width>725</width>\n    <height>15</height>\n   </rect>\n   <bottompad>12</bottompad>\n   <font>\n    <face>Arial</face>\n    <size>10</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <top/>\n   <data>\n    <query>Parameter Query</query>\n    <column>filter</column>\n   </data>\n  </text>\n </rpthead>\n <pghead>\n  <firstpage/>\n  <height>6</height>\n </pghead>\n <pghead>\n  <height>81</height>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>45</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Configured</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>15</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description 1</string>\n  </label>\n  <line>\n   <xstart>5</xstart>\n   <ystart>75</ystart>\n   <xend>745</xend>\n   <yend>75</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>15</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Capacity/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>30</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description 2</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>0</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Inventory UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>45</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Price UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>60</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Active</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>15</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Capacity UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>0</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item Number</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>15</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Exclusive</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>45</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Price/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>30</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Alt. Capacity UOM</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>60</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Shipping/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>640</x>\n    <y>0</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Packaging Weight</string>\n  </label>\n  <label>\n   <rect>\n    <x>400</x>\n    <y>30</y>\n    <width>150</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Alt. Capacity/Inventory Ratio</string>\n  </label>\n  <label>\n   <rect>\n    <x>640</x>\n    <y>15</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Product Weight</string>\n  </label>\n  <label>\n   <rect>\n    <x>104</x>\n    <y>60</y>\n    <width>66</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Class Code</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>45</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item Type</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>30</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Pick List</string>\n  </label>\n  <label>\n   <rect>\n    <x>565</x>\n    <y>0</y>\n    <width>60</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Sold</string>\n  </label>\n  <label>\n   <rect>\n    <x>275</x>\n    <y>60</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Shipping UOM</string>\n  </label>\n </pghead>\n <section>\n  <name>unnamed</name>\n  <detail>\n   <key>\n    <query>detail</query>\n   </key>\n   <height>81</height>\n   <field>\n    <rect>\n     <x>565</x>\n     <y>30</y>\n     <width>60</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>picklist</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>15</y>\n     <width>250</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>item_descrip1</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>565</x>\n     <y>15</y>\n     <width>60</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>exclusive</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>433</x>\n     <y>45</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>priceratio</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>45</y>\n     <width>250</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>itemtype</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>640</x>\n     <y>0</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>packweight</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>30</y>\n     <width>250</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>item_descrip2</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>433</x>\n     <y>30</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>altcapratio</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>275</x>\n     <y>60</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>shipuom</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>0</y>\n     <width>250</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>normal</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>item_number</column>\n    </data>\n   </field>\n   <line>\n    <xstart>5</xstart>\n    <ystart>75</ystart>\n    <xend>745</xend>\n    <yend>75</yend>\n    <weight>0</weight>\n   </line>\n   <field>\n    <rect>\n     <x>565</x>\n     <y>0</y>\n     <width>60</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>sold</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>565</x>\n     <y>45</y>\n     <width>60</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>configured</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>275</x>\n     <y>45</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>priceuom</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>275</x>\n     <y>0</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>invuom</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>60</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>active</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>433</x>\n     <y>15</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>capratio</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>104</x>\n     <y>60</y>\n     <width>66</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>classcode_code</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>275</x>\n     <y>30</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>altcapuom</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>275</x>\n     <y>15</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>capuom</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>640</x>\n     <y>15</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>prodweight</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>433</x>\n     <y>60</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>40</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>shipratio</column>\n    </data>\n   </field>\n  </detail>\n </section>\n <pgfoot>\n  <height>16</height>\n  <label>\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Report Date:</string>\n  </label>\n  <label>\n   <rect>\n    <x>635</x>\n    <y>0</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Page:</string>\n  </label>\n  <field>\n   <rect>\n    <x>80</x>\n    <y>0</y>\n    <width>140</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>report_date</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>715</x>\n    <y>0</y>\n    <width>30</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>page_number</column>\n   </data>\n  </field>\n </pgfoot>\n</report>\n		0	2015-10-01 17:14:33.361434
\.


--
-- Name: report_report_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('report_report_id_seq', 484, true);


--
-- Data for Name: rjctcode; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY rjctcode (rjctcode_id, rjctcode_code, rjctcode_descrip) FROM stdin;
\.


--
-- Name: rjctcode_rjctcode_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('rjctcode_rjctcode_id_seq', 16, true);


--
-- Data for Name: rsncode; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY rsncode (rsncode_id, rsncode_code, rsncode_descrip, rsncode_doctype) FROM stdin;
\.


--
-- Name: rsncode_rsncode_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('rsncode_rsncode_id_seq', 1, false);


--
-- Data for Name: sale; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY sale (sale_id, sale_name, sale_descrip, sale_ipshead_id, sale_startdate, sale_enddate) FROM stdin;
\.


--
-- Name: sale_sale_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('sale_sale_id_seq', 12, true);


--
-- Data for Name: salesaccnt; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY salesaccnt (salesaccnt_id, salesaccnt_custtype_id, salesaccnt_prodcat_id, salesaccnt_warehous_id, salesaccnt_sales_accnt_id, salesaccnt_credit_accnt_id, salesaccnt_cos_accnt_id, salesaccnt_custtype, salesaccnt_prodcat, salesaccnt_returns_accnt_id, salesaccnt_cor_accnt_id, salesaccnt_cow_accnt_id, salesaccnt_saletype_id, salesaccnt_shipzone_id) FROM stdin;
\.


--
-- Name: salesaccnt_salesaccnt_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('salesaccnt_salesaccnt_id_seq', 30, true);


--
-- Data for Name: salescat; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY salescat (salescat_id, salescat_active, salescat_name, salescat_descrip, salescat_sales_accnt_id, salescat_prepaid_accnt_id, salescat_ar_accnt_id) FROM stdin;
\.


--
-- Name: salescat_salescat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('salescat_salescat_id_seq', 1, false);


--
-- Data for Name: salesrep; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY salesrep (salesrep_id, salesrep_active, salesrep_number, salesrep_name, salesrep_commission, salesrep_method, salesrep_emp_id) FROM stdin;
\.


--
-- Name: salesrep_salesrep_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('salesrep_salesrep_id_seq', 28, true);


--
-- Data for Name: saletype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY saletype (saletype_id, saletype_code, saletype_descr, saletype_active, saletype_default) FROM stdin;
1	CUST	Customer	t	f
2	INT	Internet	t	f
3	REP	Sales Rep	t	f
\.


--
-- Name: saletype_saletype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('saletype_saletype_id_seq', 3, true);


--
-- Data for Name: schemaord; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY schemaord (schemaord_id, schemaord_name, schemaord_order) FROM stdin;
\.


--
-- Name: schemaord_schemaord_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('schemaord_schemaord_id_seq', 1, false);


--
-- Data for Name: script; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY script (script_id, script_name, script_order, script_enabled, script_source, script_notes) FROM stdin;
1	storedProcErrorLookup	0	t	/*\n * This file is part of the xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2009 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\n/* This simplified version of xtuple/common/storedProcErrorLookup.cpp takes\n   an error structure, allowing packages to define their own errors.\n*/\nfunction storedProcErrorLookup(procName, returnVal, errorStruct)\n{\n  var message;\n\n  if (null != errorStruct)\n  {\n    if (procName in errorStruct &&\n      returnVal in errorStruct[procName])\n      message =  errorStruct[procName][returnVal];\n    else\n    {\n      procName = procName.toLowerCase();\n      for (var tmpProcName in errorStruct)\n        if (procName == tmpProcName.toLowerCase())\n        {\n          message = errorStruct[tmpProcName][returnVal];\n          break;\n        }\n    }\n\n    if (message != null)\n      return "<p>" + message\n           + qsTr("<br>(%1, %2)<br>").arg(procName).arg(returnVal);\n  }\n\n  return toolbox.storedProcErrorLookup(procName, returnVal);\n}\n	this scripted version of the error lookup routine allows packages to define their own messages
\.


--
-- Name: script_script_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('script_script_id_seq', 136, true);


--
-- Data for Name: sequence; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY sequence (sequence_value) FROM stdin;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\.


--
-- Data for Name: shift; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shift (shift_id, shift_number, shift_name) FROM stdin;
\.


--
-- Name: shift_shift_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shift_shift_id_seq', 1, false);


--
-- Data for Name: shipchrg; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipchrg (shipchrg_id, shipchrg_name, shipchrg_descrip, shipchrg_custfreight, shipchrg_handling) FROM stdin;
\.


--
-- Name: shipchrg_shipchrg_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipchrg_shipchrg_id_seq', 2, true);


--
-- Data for Name: shipdata; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipdata (shipdata_cohead_number, shipdata_cosmisc_tracknum, shipdata_cosmisc_packnum_tracknum, shipdata_weight, shipdata_base_freight, shipdata_total_freight, shipdata_shipper, shipdata_billing_option, shipdata_package_type, shipdata_void_ind, shipdata_lastupdated, shipdata_shiphead_number, shipdata_base_freight_curr_id, shipdata_total_freight_curr_id) FROM stdin;
\.


--
-- Data for Name: shipdatasum; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipdatasum (shipdatasum_cohead_number, shipdatasum_cosmisc_tracknum, shipdatasum_cosmisc_packnum_tracknum, shipdatasum_weight, shipdatasum_base_freight, shipdatasum_total_freight, shipdatasum_shipper, shipdatasum_billing_option, shipdatasum_package_type, shipdatasum_lastupdated, shipdatasum_shipped, shipdatasum_shiphead_number, shipdatasum_base_freight_curr_id, shipdatasum_total_freight_curr_id) FROM stdin;
\.


--
-- Data for Name: shipform; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipform (shipform_id, shipform_name, shipform_report_id, shipform_report_name) FROM stdin;
\.


--
-- Name: shipform_shipform_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipform_shipform_id_seq', 11, true);


--
-- Data for Name: shiphead; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shiphead (shiphead_id, shiphead_order_id, shiphead_order_type, shiphead_number, shiphead_shipvia, shiphead_freight, shiphead_freight_curr_id, shiphead_notes, shiphead_shipped, shiphead_shipdate, shiphead_shipchrg_id, shiphead_shipform_id, shiphead_sfstatus, shiphead_tracknum) FROM stdin;
\.


--
-- Name: shiphead_shiphead_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shiphead_shiphead_id_seq', 1, false);


--
-- Data for Name: shipitem; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipitem (shipitem_id, shipitem_orderitem_id, shipitem_shiphead_id, shipitem_qty, shipitem_shipped, shipitem_shipdate, shipitem_transdate, shipitem_trans_username, shipitem_invoiced, shipitem_invcitem_id, shipitem_value, shipitem_invhist_id) FROM stdin;
\.


--
-- Name: shipitem_shipitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipitem_shipitem_id_seq', 1, false);


--
-- Name: shipment_number_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipment_number_seq', 1, true);


--
-- Name: shipto_shipto_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipto_shipto_id_seq', 30, true);


--
-- Data for Name: shiptoinfo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shiptoinfo (shipto_id, shipto_cust_id, shipto_name, shipto_salesrep_id, shipto_comments, shipto_shipcomments, shipto_shipzone_id, shipto_shipvia, shipto_commission, shipto_shipform_id, shipto_shipchrg_id, shipto_active, shipto_default, shipto_num, shipto_ediprofile_id, shipto_cntct_id, shipto_addr_id, shipto_taxzone_id, shipto_preferred_warehous_id) FROM stdin;
\.


--
-- Data for Name: shipvia; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipvia (shipvia_id, shipvia_code, shipvia_descrip) FROM stdin;
\.


--
-- Name: shipvia_shipvia_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipvia_shipvia_id_seq', 12, true);


--
-- Data for Name: shipzone; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY shipzone (shipzone_id, shipzone_name, shipzone_descrip) FROM stdin;
\.


--
-- Name: shipzone_shipzone_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('shipzone_shipzone_id_seq', 34, true);


--
-- Data for Name: sitetype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY sitetype (sitetype_id, sitetype_name, sitetype_descrip) FROM stdin;
1	WHSE	Warehouse
\.


--
-- Name: sitetype_sitetype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('sitetype_sitetype_id_seq', 1, true);


--
-- Data for Name: sltrans; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY sltrans (sltrans_id, sltrans_created, sltrans_date, sltrans_sequence, sltrans_accnt_id, sltrans_source, sltrans_docnumber, sltrans_misc_id, sltrans_amount, sltrans_notes, sltrans_journalnumber, sltrans_posted, sltrans_doctype, sltrans_username, sltrans_gltrans_journalnumber, sltrans_rec) FROM stdin;
\.


--
-- Data for Name: sltrans_backup; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY sltrans_backup (sltrans_old_id, sltrans_new_id) FROM stdin;
\.


--
-- Name: sopack_sopack_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('sopack_sopack_id_seq', 60, true);


--
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY source (source_id, source_module, source_name, source_descrip, source_docass_num, source_docass, source_charass, source_table, source_key_field, source_number_field, source_name_field, source_desc_field, source_widget, source_joins, source_key_param, source_uiform_name, source_create_priv, source_created, source_last_modified) FROM stdin;
1	CRM	ADDR	Address	1	ADDR	ADDR	addr	addr_id	addr_number	addr_line1	addr_line2			addr_id			2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
2	Products	BBH	Breeder BOM Head	2	BBH		bbomhead	bbomhead_id	bbomhead_docnum	item_number	firstline(item_descrip1)		join item on bomhead_item_id = item_id	bomhead_id	bom		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
3	Products	BBI	Breeder BOM Item	3	BBI		bbomitem	bbomitem_id	bbomitem_seqnumber::text	item_number	firstline(item_descrip1)		join item on bbomitem_item_id = item_id	bbomitem_id	bbom		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
4	Products	BMH	BOM Head	4	BMH		bomhead	bomhead_id	bomhead_docnum	item_number	firstline(item_descrip1)		join item on bomhead_item_id = item_id	bomhead_id	bom		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
5	Products	BMI	BOM Item	5	BMI		bomitem	bomitem_id	p.item_number	c.item_number	firstline(c.item_descrip1)		join item p on bomitem_parent_item_id = p.item_id join item c on bomitem_item_id = c.item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
9	CRM	T	Contact	9	T	CNTCT	cntct	cntct_id	cntct_number	cntct_name	cntct_title	core		cntct_id	contact		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
6	Products	BOH	Routing Head	6	BOH		boohead	boohead_id	boohead_docnum	item_number	firstline(item_descrip1)		join item on boohead_item_id = item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
7	Products	BOI	Routing Item	7	BOI		booitem	booitem_id	booitem_seqnumber::text	item_number	firstline(item_descrip1)		join item on booitem_item_id = item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
8	CRM	CRMA	Account	8	CRMA	CRMACCT	crmacct	crmacct_id	crmacct_number	crmacct_name	firstline(crmacct_notes)	core		crmacct_id	crmaccount		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
39	System	CNTR	Contract	10	CNTR		cntrct	cntrct_id	cntrct_number	vend_name	cntrct_descrip		join vendinfo on cntrct_vend_id = vendid	cntrct_id	contrct		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
40	Sales	CM	Return	11	CM		cmhead	cmhead_id	cmhead_number	cust_name	firstline(cmhead_comments)		join custinfo on cmhead_cust_id = cust_id	cmhead_id	creditMemo		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
41	Sales	CMI	Return Item	12	CMI		cmitem	cmitem_id	cmhead_number	cust_name	item_number		join cmhead on cmitem_cmhead_id=cmhead_id join custinfo on cmhead_cust_id=cust_id join itemsite on cmitem_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
10	Sales	C	Customer	13	C	C	custinfo	cust_id	cust_number	cust_name	firstline(cust_comments)	core		cust_id	customer		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
11	System	EMP	Employee	14	EMP	EMP	emp	emp_id	emp_number	cntct_name	cntct_title	core	left outer join cntct on emp_cntct_id = cntct_id	emp_id	employee		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
12	CRM	INCDT	Incident	15	INCDT	INCDT	incdt	incdt_id	incdt_number::text	incdt_summary	firstline(incdt_descrip)	core		incdt_id	incident	MaintainPersonalIncidents MaintainAllIncidents	2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
42	Sales	INV	Invoice	16	INV	INV	invchead	invchead_id	invchead_invcnumber	cust_name	firstline(invchead_notes)	core	join custinfo on invchead_cust_id = cust_id	invchead_id	invoice		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
43	Sales	INVI	Invoice Item	17	INVI	INVI	invcitem	invcitem_id	invchead_invcnumber	cust_name	item_number		join invchead on invcitem_invchead_id = invchead_id join custinfo on invchead_cust_id = cust_id join item on invcitem_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
13	Products	I	Item	18	I	I	item	item_id	item_number	firstline(item_descrip1)	firstline(item_descrip2)	core		item_id	item		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
14	Inventory	IS	Item Site	19	IS		itemsite	itemsite_id	item_number	warehous_code	firstline(item_descrip1)		join item on itemsite_item_id = item_id join whsinfo on itemsite_item_id = warehous_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
15	Purchase	IR	Item Source	20	IR		itemsrc	itemsrc_id	item_number	vend_name	firstline(item_descrip1)		join item on itemsrc_item_id = item_id join vendinfo on itemsrc_vend_id = vend_id	itemsrc_id	itemSource		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
16	Inventory	L	Location	21	L		location	location_id	location_formatname	warehous_code	NULL		join whsinfo on location_warehous_id = warehous_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
17	Inventory	LS	Lot/Serial	22	LS	LS	ls	ls_id	ls_number	item_number	firstline(ls_notes)		join item on ls_item_id = item_id	ls_id	lotSerial		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
18	CRM	OPP	Opportunity	23	OPP	OPP	ophead	ophead_id	ophead_id::text	ophead_name	firstline(ophead_notes)	core		ophead_id	opportunity	MaintainPersonalOpportunities MaintainAllOpportunities	2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
19	CRM	J	Project	24	J	PROJ	prj	prj_id	prj_number	prj_name	firstline(prj_descrip)	core		prj_id	project	MaintainPersonalProjects MaintainAllProjects	2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
20	Purchase	P	Purchase Order	25	P	PO	pohead	pohead_id	pohead_number	vend_name	firstline(pohead_comments)	core	join vendinfo on pohead_vend_id = vend_id	pohead_id	purchaseOrder		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
21	Purchase	PI	Purchase Order Item	26	PI	PI	poitem	poitem_id	pohead_number	vend_name	item_number		join pohead on poitem_pohead_id=pohead_id join vendinfo on pohead_vend_id=vend_id join itemsite on poitem_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
22	Sales	RA	Return Authorization	27	RA		rahead	rahead_id	rahead_number	cust_name	firstline(rahead_notes)		join custinfo on rahead_cust_id = cust_id	rahead_id	purchaseOrder		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
23	Sales	RI	Return Authorization Item	28	RI		raitem	raitem_id	rahead_number	cust_name	item_number		join rahead on raitem_rahead_id=rahead_id join custinfo on rahead_cust_id=cust_id join itemsite on raitem_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
24	Sales	Q	Quote	29	Q	QU	quhead	quhead_id	quhead_number	cust_name	firstline(quhead_ordercomments)		join custinfo on quhead_cust_id = cust_id	quhead_id	salesOrder		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
25	Sales	QI	Quote Item	30	QI	QI	quitem	quitem_id	quhead_number	cust_name	item_number		join quhead on quitem_quhead_id=quhead_id join custinfo on quhead_cust_id=cust_id join itemsite on quitem_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
26	Sales	S	Sales Order	31	S	SO	cohead	cohead_id	cohead_number	cust_name	firstline(cohead_ordercomments)	core	join custinfo on cohead_cust_id = cust_id	sohead_id	salesOrder		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
27	Sales	SI	Sales Order Item	32	SI	SI	coitem	coitem_id	cohead_number	cust_name	item_number		join cohead on coitem_cohead_id=cohead_id join custinfo on cohead_cust_id=cust_id join itemsite on coitem_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
44	Sales	SHP	Ship To	33	SHP		shipto	shipto_id	shipto_num	cust_name	shipto_name		join custinfo on shipto_cust_id=cust_id	shipto_id	shipTo		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
45	TE	TE	Time Expense	34	TE		tehead	tehead_id	tehead_number	emp_number	formatDate(tehead_weekending)		join emp on tehead_emp_id = emp_id	tehead_id	timeExpenseSheet		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
33	CRM	TD	To-Do	35	TODO		todoitem	todoitem_id	todoitem_id::text	todoitem_name	firstline(todoitem_description)			todoitem_id	todoItem	MaintainPersonalToDoItems MaintainAllToDoItems	2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
28	Inventory	TO	Transfer Order	36	TO		tohead	tohead_id	tohead_number	s.warehous_code	d.warehous_code		join whsinfo s on tohead_src_warehous_id = s.warehous_id join whsinfo d on tohead_dest_warehous_id = d.warehous_id	tohead_id	transferOrder		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
29	Inventory	TI	Transfer Order Item	37	TI		toitem	toitem_id	tohead_number	item_number	warehous_code		join tohead on toitem_tohead_id=tohead_id join whsinfo on tohead_dest_warehous_id=warehous_id join item on toitem_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
30	Purchase	V	Vendor	38	V	V	vendinfo	vend_id	vend_number	vend_name	firstline(vend_comments)	core		vend_id	vendor		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
46	Purchase	VCH	Voucher	39	VCH	VCH	vohead	vohead_id	vohead_number	vend_name	firstline(vohead_notes)		join vendinfo on vohead_vend_id=vend_id	vohead_id			2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
31	Inventory	WH	Site	40	WH		whsinfo	warehous_id	warehous_code	warehous_descrip	NULL						2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
32	Manufacture	W	Work Order	41	W	W	wo	wo_id	formatWonumber(wo_id)	item_descrip1	item_descrip2	core	join itemsite on wo_itemsite_id=itemsite_id join item on itemsite_item_id=item_id				2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
34	CRM	TA	Project Task	42	TASK	TASK	prjtask	prjtask_id	prjtask_number	prjtask_name	firstline(prjtask_descrip)			prjtask_id	task		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
35	CRM	PSPCT	Prospect	43	PSPCT		prospect	prospect_id	prospect_number	prospect_name	firstline(prospect_comments)						2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
36	Sales	SR	Sales Rep	44	SR		salesrep	salesrep_id	salesrep_number	salesrep_name	NULL						2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
37	Accounting	TAXAUTH	Tax Authority	45	TAXAUTH		taxauth	taxauth_id	taxauth_code	taxauth_name	taxauth_extref						2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
38	System	USR	User	46	USR		usr	usr_id	usr_username	usr_propername	usr_email						2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
47	Sales	CT	Customer Type	47	CT	CT	custtype	custtype_id	custtype_code	custtype_code	custtype_descrip			custtype_id	customerType		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
48	Sales	LSR	Lot/Serial Registration	48	LSR		lsreg	lsreg_id	lsreg_number	crmacct_number	firstline(lsreg_notes)		left outer join crmacct on lsreg_crmacct_id=crmacct_id	lsreg_id	lotSerialRegistration		2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
49	Purchase	PR	Purchase Request	49		PR	pr	pr_id	pr_number::text	pr_subnumber::text	pr_releasenote			pr_id	purchaseRequest	MaintainPurchaseRequests ViewPurchaseRequests	2015-10-01 17:14:33.361434+00	2015-10-01 17:14:33.361434+00
\.


--
-- Name: source_source_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('source_source_id_seq', 49, true);


--
-- Data for Name: state; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY state (state_id, state_name, state_abbr, state_country_id) FROM stdin;
1	Alabama	AL	230
2	Alaska	AK	230
3	American Samoa	AS	230
4	Arizona	AZ	230
5	Arkansas	AR	230
6	California	CA	230
7	Colorado	CO	230
8	Connecticut	CT	230
9	Delaware	DE	230
10	District Of Columbia	DC	230
11	Federated States Of Micronesia	FM	230
12	Florida	FL	230
13	Georgia	GA	230
14	Guam	GU	230
15	Hawaii	HI	230
16	Idaho	ID	230
17	Illinois	IL	230
18	Indiana	IN	230
19	Iowa	IA	230
20	Kansas	KS	230
21	Kentucky	KY	230
22	Louisiana	LA	230
23	Maine	ME	230
24	Marshall Islands	MH	230
25	Maryland	MD	230
26	Massachusetts	MA	230
27	Michigan	MI	230
28	Minnesota	MN	230
29	Mississippi	MS	230
30	Missouri	MO	230
31	Montana	MT	230
32	Nebraska	NE	230
33	Nevada	NV	230
34	New Hampshire	NH	230
35	New Jersey	NJ	230
36	New Mexico	NM	230
37	New York	NY	230
38	North Carolina	NC	230
39	North Dakota	ND	230
40	Northern Mariana Islands	MP	230
41	Ohio	OH	230
42	Oklahoma	OK	230
43	Oregon	OR	230
44	Palau	PW	230
45	Pennsylvania	PA	230
46	Puerto Rico	PR	230
47	Rhode Island	RI	230
48	South Carolina	SC	230
49	South Dakota	SD	230
50	Tennessee	TN	230
51	Texas	TX	230
52	Utah	UT	230
53	Vermont	VT	230
54	Virgin Islands	VI	230
55	Virginia	VA	230
56	Washington	WA	230
57	West Virginia	WV	230
58	Wisconsin	WI	230
59	Wyoming	WY	230
60	Armed Forces Africa, Canada, Europe, Middle East	AE	230
61	Armed Forces Americas (except Canada)	AA	230
62	Armed Forces Pacific	AP	230
63	Alberta	AB	39
64	British Columbia	BC	39
65	Manitoba	MB	39
66	New Brunswick	NB	39
67	Newfoundland and Labrador	NL	39
68	Northwest Territories	NT	39
69	Nova Scotia	NS	39
70	Nunavut	NU	39
71	Ontario	ON	39
72	Prince Edward Island	PE	39
73	Quebec	QC	39
74	Saskatchewan	SK	39
75	Yukon	YT	39
76	Aguascalientes	AGS	140
77	Baja California	BC	140
78	Baja California Sur	BCS	140
79	Campeche	CAM	140
80	Coahuila	COAH	140
81	Colima	COL	140
82	Chiapas	CHIS	140
83	Chihuahua	CHIH	140
84	Distrito Federal	DF	140
85	Durango	DGO	140
86	Guanajuato	GTO	140
87	Guerrero	GRO	140
88	Hidalgo	HGO	140
89	Jalisco	JAL	140
90	Mexico	MEX	140
91	Michoacan	MICH	140
92	Morelos	MOR	140
93	Nayarit	NAY	140
94	Nuevo Leon	NL	140
95	Oaxaca	OAX	140
96	Puebla	PUE	140
97	Queretaro	QRO	140
98	Quintana Roo	Q ROO	140
99	San Luis Potosi	SLP	140
100	Sinaloa	SIN	140
101	Sonora	SON	140
102	Tabasco	TAB	140
103	Tamaulipas	TAMPS	140
104	Tlaxcala	TLAX	140
105	Veracruz	VER	140
106	Yucatan	YUC	140
107	Zacatecas	ZAC	140
108	Australian Capital Territory	ACT	13
109	New South Wales	NSW	13
110	Northern Territory	NT	13
111	Queensland	QLD	13
112	South Australia	SA	13
113	Tasmania	TAS	13
114	Victoria	VIC	13
115	Western Australia	WA	13
116	Schleswig-Holstein	SH	81
117	Mecklenburg-Vorpommern	MV	81
118	Hamburg	HH	81
119	Bremen	HB	81
120	Berlin	BE	81
121	Brandenburg	BB	81
122	Niedersachsen	NI	81
123	Nordrhein-Westfalen	NW	81
124	Sachsen-Anhalt	ST	81
125	Sachsen	SN	81
126	Hessen	HE	81
127	Thüringen	TH	81
128	Bayern	BY	81
129	Rheinland-Pfalz	RP	81
130	Saarland	SL	81
131	Baden-Württemberg	BW	81
132	Acre	AC	30
133	Alagoas	AL	30
134	Amapá	AP	30
135	Amazonas	AM	30
136	Bahia	VA	30
137	Ceará	CE	30
138	Distito Federal	DF	30
139	Espirito Santo	ES	30
140	Goiás	GO	30
141	Maranhão	MA	30
142	Mato Grosso	MT	30
143	Mato Grosso do Sul	MS	30
144	Minas Gerais	MG	30
145	Pará	PA	30
146	Paraiba	PB	30
147	Paraná	PR	30
148	Pernambuco	PE	30
149	Piaui	PI	30
150	Rio de Janeiro	RJ	30
151	Rio Grande do Norte	RN	30
152	Rio Grande do Sul	RS	30
153	Rondônia	RO	30
154	Roraima	RR	30
155	Santa Catarina	SC	30
156	São Paulo	SP	30
157	Sergipe	SE	30
158	Tocantins	TO	30
\.


--
-- Name: state_state_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('state_state_id_seq', 158, true);


--
-- Data for Name: status; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY status (status_id, status_type, status_code, status_name, status_seq, status_color) FROM stdin;
1	INCDT	N	New	0	white
2	INCDT	F	Feedback	1	white
3	INCDT	C	Confirmed	2	white
4	INCDT	A	Assigned	3	white
5	INCDT	R	Resolved	4	white
6	INCDT	L	Closed	5	white
\.


--
-- Name: status_status_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('status_status_id_seq', 6, true);


--
-- Data for Name: stdjrnl; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY stdjrnl (stdjrnl_id, stdjrnl_name, stdjrnl_descrip, stdjrnl_notes) FROM stdin;
\.


--
-- Name: stdjrnl_stdjrnl_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('stdjrnl_stdjrnl_id_seq', 30, true);


--
-- Data for Name: stdjrnlgrp; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY stdjrnlgrp (stdjrnlgrp_id, stdjrnlgrp_name, stdjrnlgrp_descrip) FROM stdin;
\.


--
-- Name: stdjrnlgrp_stdjrnlgrp_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('stdjrnlgrp_stdjrnlgrp_id_seq', 12, true);


--
-- Data for Name: stdjrnlgrpitem; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY stdjrnlgrpitem (stdjrnlgrpitem_id, stdjrnlgrpitem_stdjrnl_id, stdjrnlgrpitem_toapply, stdjrnlgrpitem_applied, stdjrnlgrpitem_effective, stdjrnlgrpitem_expires, stdjrnlgrpitem_stdjrnlgrp_id) FROM stdin;
\.


--
-- Name: stdjrnlgrpitem_stdjrnlgrpitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('stdjrnlgrpitem_stdjrnlgrpitem_id_seq', 18, true);


--
-- Data for Name: stdjrnlitem; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY stdjrnlitem (stdjrnlitem_id, stdjrnlitem_stdjrnl_id, stdjrnlitem_accnt_id, stdjrnlitem_amount, stdjrnlitem_notes) FROM stdin;
\.


--
-- Name: stdjrnlitem_stdjrnlitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('stdjrnlitem_stdjrnlitem_id_seq', 28, true);


--
-- Data for Name: subaccnt; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY subaccnt (subaccnt_id, subaccnt_number, subaccnt_descrip) FROM stdin;
\.


--
-- Name: subaccnt_subaccnt_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('subaccnt_subaccnt_id_seq', 1, false);


--
-- Data for Name: subaccnttype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY subaccnttype (subaccnttype_id, subaccnttype_accnt_type, subaccnttype_code, subaccnttype_descrip) FROM stdin;
1	A	CA	Cash Assets
2	A	AR	Accounts Receivable
3	A	IN	Inventory
4	A	CAS	Current Assets
5	A	FA	Fixed Assets
6	A	AD	Accumulated Depreciation
7	L	CL	Current Liabilities
8	L	AP	Accounts Payable
9	L	LTL	Long Term Liabilities
10	Q	EDC	Equity do not close
11	Q	ERE	Equity Retained Earnings
12	Q	EC	Equity close
13	R	SI	Sales Income
14	R	II	Interest Income
15	R	IV	Investment Income
16	R	RT	Returns
17	E	COGS	Cost of Goods Sold
18	E	EXP	Expenses
\.


--
-- Name: subaccnttype_subaccnttype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('subaccnttype_subaccnttype_id_seq', 18, true);


--
-- Data for Name: tax; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY tax (tax_id, tax_code, tax_descrip, tax_sales_accnt_id, tax_taxclass_id, tax_taxauth_id, tax_basis_tax_id, tax_dist_accnt_id) FROM stdin;
\.


--
-- Name: tax_tax_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('tax_tax_id_seq', 11, true);


--
-- Data for Name: taxass; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxass (taxass_id, taxass_taxzone_id, taxass_taxtype_id, taxass_tax_id) FROM stdin;
\.


--
-- Name: taxass_taxass_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxass_taxass_id_seq', 1, false);


--
-- Data for Name: taxauth; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxauth (taxauth_id, taxauth_code, taxauth_name, taxauth_extref, taxauth_addr_id, taxauth_curr_id, taxauth_county, taxauth_accnt_id) FROM stdin;
\.


--
-- Name: taxauth_taxauth_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxauth_taxauth_id_seq', 1, false);


--
-- Data for Name: taxclass; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxclass (taxclass_id, taxclass_code, taxclass_descrip, taxclass_sequence) FROM stdin;
1	1	Legacy Class 1	0
2	2	Legacy Class 2	0
3	3	Legacy Class 3	0
\.


--
-- Name: taxclass_taxclass_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxclass_taxclass_id_seq', 3, true);


--
-- Data for Name: taxhist; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxhist (taxhist_id, taxhist_parent_id, taxhist_taxtype_id, taxhist_tax_id, taxhist_basis, taxhist_basis_tax_id, taxhist_sequence, taxhist_percent, taxhist_amount, taxhist_tax, taxhist_docdate, taxhist_distdate, taxhist_curr_id, taxhist_curr_rate, taxhist_journalnumber) FROM stdin;
\.


--
-- Name: taxhist_taxhist_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxhist_taxhist_id_seq', 1, false);


--
-- Data for Name: taxpay; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxpay (taxpay_id, taxpay_taxhist_id, taxpay_apply_id, taxpay_distdate, taxpay_tax) FROM stdin;
\.


--
-- Name: taxpay_taxpay_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxpay_taxpay_id_seq', 1, false);


--
-- Data for Name: taxrate; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxrate (taxrate_id, taxrate_tax_id, taxrate_percent, taxrate_curr_id, taxrate_amount, taxrate_effective, taxrate_expires) FROM stdin;
\.


--
-- Name: taxrate_taxrate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxrate_taxrate_id_seq', 1, false);


--
-- Data for Name: taxreg; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxreg (taxreg_id, taxreg_rel_id, taxreg_rel_type, taxreg_taxauth_id, taxreg_number, taxreg_taxzone_id, taxreg_effective, taxreg_expires, taxreg_notes) FROM stdin;
\.


--
-- Name: taxreg_taxreg_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxreg_taxreg_id_seq', 1, false);


--
-- Data for Name: taxtype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxtype (taxtype_id, taxtype_name, taxtype_descrip, taxtype_sys) FROM stdin;
1	Freight	System Defined Freight Tax Type. DO NOT CHANGE.	t
2	Adjustment	System Defined Adjustment Tax Type. DO NOT CHANGE.	t
\.


--
-- Name: taxtype_taxtype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxtype_taxtype_id_seq', 2, true);


--
-- Data for Name: taxzone; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY taxzone (taxzone_id, taxzone_code, taxzone_descrip) FROM stdin;
\.


--
-- Name: taxzone_taxzone_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('taxzone_taxzone_id_seq', 1, false);


--
-- Data for Name: terms; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY terms (terms_id, terms_code, terms_descrip, terms_type, terms_duedays, terms_discdays, terms_discprcnt, terms_cutoffday, terms_ap, terms_ar, terms_fincharg) FROM stdin;
\.


--
-- Name: terms_terms_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('terms_terms_id_seq', 41, true);


--
-- Data for Name: todoitem; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY todoitem (todoitem_id, todoitem_name, todoitem_description, todoitem_incdt_id, todoitem_creator_username, todoitem_status, todoitem_active, todoitem_start_date, todoitem_due_date, todoitem_assigned_date, todoitem_completed_date, todoitem_seq, todoitem_notes, todoitem_crmacct_id, todoitem_ophead_id, todoitem_owner_username, todoitem_priority_id, todoitem_username, todoitem_recurring_todoitem_id, todoitem_cntct_id) FROM stdin;
\.


--
-- Name: todoitem_todoitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('todoitem_todoitem_id_seq', 1, false);


--
-- Data for Name: trgthist; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY trgthist (trgthist_src_cntct_id, trgthist_trgt_cntct_id, trgthist_col, trgthist_value) FROM stdin;
\.


--
-- Data for Name: trialbal; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY trialbal (trialbal_id, trialbal_period_id, trialbal_accnt_id, trialbal_beginning, trialbal_ending, trialbal_credits, trialbal_debits, trialbal_dirty, trialbal_yearend) FROM stdin;
\.


--
-- Name: trialbal_trialbal_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('trialbal_trialbal_id_seq', 8157, true);


--
-- Data for Name: uiform; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY uiform (uiform_id, uiform_name, uiform_order, uiform_enabled, uiform_source, uiform_notes) FROM stdin;
\.


--
-- Name: uiform_uiform_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('uiform_uiform_id_seq', 65, true);


--
-- Data for Name: uom; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY uom (uom_id, uom_name, uom_descrip, uom_item_weight) FROM stdin;
\.


--
-- Name: uom_uom_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('uom_uom_id_seq', 3, true);


--
-- Data for Name: uomconv; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY uomconv (uomconv_id, uomconv_from_uom_id, uomconv_from_value, uomconv_to_uom_id, uomconv_to_value, uomconv_fractional) FROM stdin;
\.


--
-- Name: uomconv_uomconv_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('uomconv_uomconv_id_seq', 1, false);


--
-- Data for Name: uomtype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY uomtype (uomtype_id, uomtype_name, uomtype_descrip, uomtype_multiple) FROM stdin;
1	Selling	Selling a.k.a. Pricing and Shipping UOMs.	t
2	Capacity	Capacity UOMs.	f
3	AltCapacity	Alternate Capacity UOMs.	f
4	MaterialIssue	Material Issuing UOMs.	f
\.


--
-- Name: uomtype_uomtype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('uomtype_uomtype_id_seq', 4, true);


--
-- Data for Name: urlinfo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY urlinfo (url_id, url_title, url_url) FROM stdin;
\.


--
-- Name: urlinfo_url_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('urlinfo_url_id_seq', 1, false);


--
-- Data for Name: usr_bak; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY usr_bak (usr_id, usr_username, usr_propername, usr_passwd, usr_locale_id, usr_initials, usr_agent, usr_active, usr_email, usr_window) FROM stdin;
1	mfgadmin	OpenMFG Administrator	\N	3	ADMIN	t	t	admin@example.com	
2	admin	Administrator		3	ADMIN	t	t	admin@example.com	\N
\.


--
-- Name: usr_usr_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('usr_usr_id_seq', 9, true);


--
-- Data for Name: usrgrp; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY usrgrp (usrgrp_id, usrgrp_grp_id, usrgrp_username) FROM stdin;
\.


--
-- Name: usrgrp_usrgrp_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('usrgrp_usrgrp_id_seq', 1, false);


--
-- Data for Name: usrpref; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY usrpref (usrpref_id, usrpref_name, usrpref_value, usrpref_username) FROM stdin;
1	BackgroundImageid	14	mfgadmin
2	ShowIMMenu	t	mfgadmin
3	ShowPDMenu	t	mfgadmin
4	ShowMSMenu	t	mfgadmin
5	ShowCPMenu	t	mfgadmin
6	ShowWOMenu	t	mfgadmin
7	ShowPOMenu	t	mfgadmin
8	ShowSOMenu	t	mfgadmin
9	ShowSRMenu	t	mfgadmin
10	ShowSAMenu	t	mfgadmin
28	ShowGLMenu	t	mfgadmin
34	UseCustCache	f	mfgadmin
29	ShowAPMenu	t	mfgadmin
27	ShowARMenu	t	mfgadmin
48	ShowPDToolbar	t	mfgadmin
51	ShowMSToolbar	t	mfgadmin
52	ShowCPToolbar	t	mfgadmin
49	ShowWOToolbar	t	mfgadmin
30	ShowSOToolbar	t	mfgadmin
53	ShowSRToolbar	t	mfgadmin
73	UsedFixedWidthFonts	f	mfgadmin
47	ShowIMToolbar	t	mfgadmin
74	ShowSAToolbar	t	mfgadmin
50	ShowPOToolbar	t	mfgadmin
76	ShowGLToolbar	t	mfgadmin
108	ToolbarPositions	\n\n\nI/M Tools,P/D Tools,W/O Tools,P/O Tools,S/O Tools,\n[I/M Tools,0,0,-1,-1,1][P/D Tools,0,0,-1,-1,1][W/O Tools,0,0,-1,-1,1][P/O Tools,0,0,-1,-1,1][S/O Tools,0,0,-1,-1,1]\n\n\n\n\n\n\n	mfgadmin
109	ShowCRMMenu	t	mfgadmin
110	ShowPMMenu	t	mfgadmin
111	ShowCRMToolbar	t	mfgadmin
112	ShowPMToolbar	t	mfgadmin
75	ShowAPToolbar	t	mfgadmin
113	ShowARToolbar	t	mfgadmin
11	PreferredWarehouse	-1	mfgadmin
114	UseItemCache	f	mfgadmin
54	ShowRIWorkOrdersByDefault	f	mfgadmin
115	ListNumericItemNumbersFirst	f	mfgadmin
116	ShowSOItemAvailability	t	mfgadmin
117	IdleTimeout	0	mfgadmin
118	DefaultEllipsesAction	list	mfgadmin
119	InterfaceWindowOption	Workspace	mfgadmin
120	DisableExportContents	f	mfgadmin
121	UseEnhancedAuthentication	f	mfgadmin
122	BackgroundImageid	-1	admin
123	ShowIMMenu	t	admin
124	ShowPDMenu	t	admin
125	ShowMSMenu	t	admin
126	ShowCPMenu	t	admin
127	ShowWOMenu	t	admin
128	ShowPOMenu	t	admin
129	ShowSOMenu	t	admin
130	ShowSRMenu	t	admin
131	ShowSAMenu	t	admin
132	ShowGLMenu	t	admin
133	UseCustCache	f	admin
134	ShowAPMenu	t	admin
135	ShowARMenu	t	admin
136	ShowPDToolbar	t	admin
137	ShowMSToolbar	t	admin
138	ShowCPToolbar	t	admin
139	ShowWOToolbar	t	admin
140	ShowSOToolbar	t	admin
141	ShowSRToolbar	t	admin
142	UsedFixedWidthFonts	f	admin
143	ShowIMToolbar	t	admin
144	ShowSAToolbar	t	admin
145	ShowPOToolbar	t	admin
146	ShowGLToolbar	t	admin
147	ToolbarPositions	\n\n\nI/M Tools,P/D Tools,W/O Tools,P/O Tools,S/O Tools,\n[I/M Tools,0,0,-1,-1,1][P/D Tools,0,0,-1,-1,1][W/O Tools,0,0,-1,-1,1][P/O Tools,0,0,-1,-1,1][S/O Tools,0,0,-1,-1,1]\n\n\n\n\n\n\n	admin
148	ShowCRMMenu	t	admin
149	ShowPMMenu	t	admin
150	ShowCRMToolbar	t	admin
151	ShowPMToolbar	t	admin
152	ShowAPToolbar	t	admin
153	ShowARToolbar	t	admin
154	PreferredWarehouse	-1	admin
155	UseItemCache	f	admin
156	ShowRIWorkOrdersByDefault	f	admin
157	ListNumericItemNumbersFirst	f	admin
158	ShowSOItemAvailability	t	admin
159	IdleTimeout	0	admin
160	DefaultEllipsesAction	list	admin
164	propername	OpenMFG Administrator	mfgadmin
165	initials	ADMIN	mfgadmin
166	email	chris@openmfg.com	mfgadmin
167	locale_id	3	mfgadmin
168	agent	t	mfgadmin
169	active	t	mfgadmin
170	window		mfgadmin
177	window	\N	admin
178	locales/_locale/columnsShown	0,on|1,on|	admin
179	IngoreMissingTranslationFiles	f	admin
161	InterfaceWindowOption	TopLevel	admin
181	CopyListsPlainText	f	admin
182	EmailEvents	f	admin
183	AlarmEventDefault	f	admin
184	AlarmEmailDefault	f	admin
185	AlarmSysmsgDefault	f	admin
186	EnableScriptDebug	f	admin
187	userPreferences/_event/columnsShown	0,on|1,on|2,on|	admin
188	userPreferences/_warehouses/columnsShown	0,on|1,on|2,on|	admin
189	userPreferences/_hotkey/columnsShown	0,on|1,on|2,on|	admin
162	DisableExportContents	f	admin
163	UseEnhancedAuthentication	f	admin
190	selectedSites	f	admin
171	propername	Administrator	admin
173	email	admin@example.com	admin
172	initials	ADMIN	admin
174	locale_id	3	admin
175	agent	t	admin
176	active	t	admin
191	metasqls/_byPackage/checked	2	admin
192	reports/_byPackage/checked	0	admin
193	packages/_autoUpdate/checked	0	admin
\.


--
-- Name: usrpref_usrpref_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('usrpref_usrpref_id_seq', 193, true);


--
-- Data for Name: usrpriv; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY usrpriv (usrpriv_id, usrpriv_priv_id, usrpriv_username) FROM stdin;
1	3	mfgadmin
3	5	mfgadmin
11	45	mfgadmin
12	44	mfgadmin
13	100	mfgadmin
14	48	mfgadmin
15	49	mfgadmin
16	53	mfgadmin
17	54	mfgadmin
18	63	mfgadmin
19	64	mfgadmin
20	65	mfgadmin
21	73	mfgadmin
26	4	mfgadmin
28	17	mfgadmin
29	16	mfgadmin
30	91	mfgadmin
31	27	mfgadmin
33	11	mfgadmin
34	93	mfgadmin
35	12	mfgadmin
36	13	mfgadmin
37	26	mfgadmin
38	75	mfgadmin
39	76	mfgadmin
40	94	mfgadmin
41	121	mfgadmin
42	122	mfgadmin
43	101	mfgadmin
45	87	mfgadmin
46	103	mfgadmin
47	104	mfgadmin
48	105	mfgadmin
50	107	mfgadmin
51	1	mfgadmin
52	2	mfgadmin
60	123	mfgadmin
63	120	mfgadmin
65	124	mfgadmin
66	125	mfgadmin
75	134	mfgadmin
78	137	mfgadmin
80	140	mfgadmin
81	22	mfgadmin
82	23	mfgadmin
83	51	mfgadmin
84	55	mfgadmin
85	56	mfgadmin
86	57	mfgadmin
87	58	mfgadmin
88	61	mfgadmin
89	62	mfgadmin
90	59	mfgadmin
91	60	mfgadmin
92	50	mfgadmin
93	88	mfgadmin
94	89	mfgadmin
96	126	mfgadmin
97	127	mfgadmin
98	141	mfgadmin
99	142	mfgadmin
100	143	mfgadmin
101	144	mfgadmin
118	160	mfgadmin
119	31	mfgadmin
123	161	mfgadmin
124	162	mfgadmin
125	163	mfgadmin
127	68	mfgadmin
129	166	mfgadmin
130	167	mfgadmin
131	168	mfgadmin
132	169	mfgadmin
133	170	mfgadmin
135	173	mfgadmin
138	176	mfgadmin
139	177	mfgadmin
140	178	mfgadmin
142	180	mfgadmin
143	181	mfgadmin
144	182	mfgadmin
147	189	mfgadmin
148	190	mfgadmin
149	191	mfgadmin
150	192	mfgadmin
151	193	mfgadmin
152	194	mfgadmin
153	195	mfgadmin
154	196	mfgadmin
155	197	mfgadmin
156	198	mfgadmin
157	199	mfgadmin
158	200	mfgadmin
159	201	mfgadmin
160	202	mfgadmin
161	232	mfgadmin
162	203	mfgadmin
164	205	mfgadmin
165	233	mfgadmin
166	207	mfgadmin
167	208	mfgadmin
168	209	mfgadmin
170	234	mfgadmin
171	235	mfgadmin
172	211	mfgadmin
173	212	mfgadmin
174	213	mfgadmin
177	236	mfgadmin
188	228	mfgadmin
189	231	mfgadmin
194	239	mfgadmin
195	242	mfgadmin
391	246	mfgadmin
392	244	mfgadmin
393	245	mfgadmin
397	248	mfgadmin
401	249	mfgadmin
402	250	mfgadmin
410	253	mfgadmin
748	258	mfgadmin
749	257	mfgadmin
750	204	mfgadmin
809	187	mfgadmin
810	188	mfgadmin
811	259	mfgadmin
825	262	mfgadmin
827	263	mfgadmin
828	261	mfgadmin
829	269	mfgadmin
839	214	mfgadmin
840	274	mfgadmin
841	47	mfgadmin
842	46	mfgadmin
843	256	mfgadmin
844	255	mfgadmin
846	276	mfgadmin
847	275	mfgadmin
848	277	mfgadmin
849	278	mfgadmin
850	280	mfgadmin
851	215	mfgadmin
852	217	mfgadmin
853	218	mfgadmin
854	219	mfgadmin
855	220	mfgadmin
856	223	mfgadmin
857	224	mfgadmin
858	225	mfgadmin
859	216	mfgadmin
860	222	mfgadmin
861	221	mfgadmin
862	226	mfgadmin
863	227	mfgadmin
872	10	mfgadmin
873	30	mfgadmin
874	29	mfgadmin
875	37	mfgadmin
876	42	mfgadmin
877	84	mfgadmin
878	82	mfgadmin
879	83	mfgadmin
880	85	mfgadmin
881	86	mfgadmin
882	90	mfgadmin
883	116	mfgadmin
884	117	mfgadmin
885	118	mfgadmin
887	14	mfgadmin
888	15	mfgadmin
889	128	mfgadmin
890	129	mfgadmin
891	131	mfgadmin
892	130	mfgadmin
893	132	mfgadmin
894	133	mfgadmin
895	147	mfgadmin
896	81	mfgadmin
897	148	mfgadmin
898	19	mfgadmin
900	150	mfgadmin
901	151	mfgadmin
902	152	mfgadmin
903	154	mfgadmin
904	153	mfgadmin
905	35	mfgadmin
906	36	mfgadmin
907	164	mfgadmin
908	241	mfgadmin
909	238	mfgadmin
910	264	mfgadmin
911	265	mfgadmin
912	179	mfgadmin
913	251	mfgadmin
914	252	mfgadmin
915	254	mfgadmin
916	266	mfgadmin
917	267	mfgadmin
918	268	mfgadmin
919	271	mfgadmin
920	272	mfgadmin
1193	281	mfgadmin
1195	106	mfgadmin
1219	111	mfgadmin
1220	260	mfgadmin
1523	294	mfgadmin
1537	297	mfgadmin
1538	298	mfgadmin
1552	279	mfgadmin
1553	302	mfgadmin
1554	303	mfgadmin
1555	305	mfgadmin
1556	70	mfgadmin
1557	273	mfgadmin
1563	306	mfgadmin
1564	307	mfgadmin
2039	389	mfgadmin
1779	316	mfgadmin
1780	317	mfgadmin
2040	369	mfgadmin
2041	370	mfgadmin
2042	371	mfgadmin
2043	334	mfgadmin
2044	356	mfgadmin
2045	357	mfgadmin
2046	358	mfgadmin
2047	407	mfgadmin
2048	372	mfgadmin
2049	335	mfgadmin
2050	373	mfgadmin
2051	382	mfgadmin
2054	416	mfgadmin
2057	446	mfgadmin
2058	420	mfgadmin
2060	422	mfgadmin
2061	423	mfgadmin
2062	424	mfgadmin
2063	425	mfgadmin
2064	426	mfgadmin
2065	427	mfgadmin
2067	429	mfgadmin
2069	431	mfgadmin
2070	447	mfgadmin
2071	433	mfgadmin
2073	435	mfgadmin
2074	436	mfgadmin
2075	437	mfgadmin
2077	439	mfgadmin
2078	440	mfgadmin
2079	441	mfgadmin
2080	442	mfgadmin
2082	444	mfgadmin
2083	419	mfgadmin
2084	432	mfgadmin
2085	448	mfgadmin
2086	449	mfgadmin
2087	450	mfgadmin
2088	451	mfgadmin
2089	313	mfgadmin
2090	314	mfgadmin
2091	315	mfgadmin
2092	374	mfgadmin
2093	375	mfgadmin
2094	376	mfgadmin
2095	377	mfgadmin
2096	378	mfgadmin
2097	379	mfgadmin
2098	380	mfgadmin
2099	395	mfgadmin
2100	396	mfgadmin
2101	397	mfgadmin
2102	398	mfgadmin
2103	350	mfgadmin
2104	351	mfgadmin
2109	270	mfgadmin
2110	362	mfgadmin
2111	363	mfgadmin
2112	349	mfgadmin
2113	390	mfgadmin
2114	391	mfgadmin
2115	392	mfgadmin
2116	353	mfgadmin
2117	354	mfgadmin
2118	368	mfgadmin
2119	383	mfgadmin
2120	347	mfgadmin
2121	348	mfgadmin
2122	336	mfgadmin
2123	337	mfgadmin
2124	346	mfgadmin
2125	355	mfgadmin
2126	385	mfgadmin
2127	386	mfgadmin
2128	393	mfgadmin
2129	345	mfgadmin
2130	359	mfgadmin
2135	388	mfgadmin
2136	394	mfgadmin
2137	399	mfgadmin
2138	403	mfgadmin
2139	404	mfgadmin
2141	406	mfgadmin
2142	445	mfgadmin
2143	352	mfgadmin
2147	408	mfgadmin
2148	409	mfgadmin
2150	452	mfgadmin
2151	453	mfgadmin
2152	454	mfgadmin
2153	455	mfgadmin
2154	456	mfgadmin
2155	457	mfgadmin
2156	458	mfgadmin
2157	461	mfgadmin
2158	462	mfgadmin
2159	463	mfgadmin
2160	464	mfgadmin
2161	465	mfgadmin
2162	466	mfgadmin
2163	467	mfgadmin
2164	468	mfgadmin
2165	469	mfgadmin
2166	470	mfgadmin
2167	459	mfgadmin
2168	460	mfgadmin
2169	487	mfgadmin
2170	488	mfgadmin
2171	489	mfgadmin
2172	4	admin
2173	483	admin
2174	484	admin
2175	485	admin
2176	486	admin
2177	182	admin
2178	306	admin
2179	307	admin
2180	269	admin
2181	270	admin
2182	362	admin
2183	363	admin
2185	416	admin
2188	446	admin
2189	420	admin
2191	422	admin
2192	423	admin
2193	424	admin
2194	425	admin
2195	426	admin
2196	427	admin
2198	429	admin
2200	431	admin
2201	447	admin
2202	433	admin
2204	435	admin
2205	436	admin
2206	437	admin
2208	439	admin
2209	440	admin
2210	441	admin
2211	442	admin
2213	444	admin
2214	419	admin
2215	432	admin
2216	448	admin
2217	449	admin
2218	450	admin
2219	451	admin
2220	390	admin
2221	480	admin
2222	481	admin
2223	482	admin
2224	5	admin
2225	103	admin
2226	104	admin
2227	105	admin
2228	106	admin
2229	107	admin
2230	1	admin
2231	2	admin
2232	134	admin
2233	143	admin
2234	144	admin
2238	160	admin
2239	31	admin
2240	161	admin
2241	162	admin
2242	163	admin
2243	316	admin
2244	317	admin
2245	349	admin
2246	10	admin
2247	30	admin
2248	29	admin
2249	37	admin
2250	42	admin
2251	84	admin
2252	82	admin
2253	83	admin
2254	85	admin
2255	86	admin
2256	90	admin
2257	116	admin
2258	117	admin
2259	118	admin
2260	14	admin
2261	15	admin
2262	128	admin
2263	129	admin
2264	131	admin
2265	130	admin
2266	132	admin
2267	133	admin
2268	147	admin
2269	81	admin
2270	148	admin
2271	19	admin
2272	150	admin
2273	151	admin
2274	152	admin
2275	154	admin
2276	153	admin
2277	35	admin
2278	36	admin
2279	164	admin
2280	214	admin
2281	215	admin
2282	217	admin
2283	218	admin
2284	219	admin
2285	220	admin
2286	223	admin
2287	224	admin
2288	225	admin
2289	216	admin
2290	222	admin
2291	221	admin
2292	226	admin
2293	227	admin
2294	241	admin
2295	238	admin
2296	255	admin
2297	256	admin
2298	264	admin
2299	265	admin
2300	350	admin
2301	351	admin
2302	454	admin
2303	470	admin
2304	45	admin
2305	44	admin
2306	48	admin
2307	49	admin
2308	53	admin
2309	54	admin
2310	46	admin
2311	47	admin
2312	120	admin
2313	137	admin
2314	189	admin
2315	204	admin
2316	205	admin
2317	207	admin
2318	208	admin
2319	209	admin
2320	213	admin
2321	231	admin
2322	244	admin
2323	245	admin
2324	246	admin
2325	249	admin
2326	250	admin
2327	353	admin
2328	354	admin
2329	368	admin
2330	383	admin
2331	452	admin
2332	17	admin
2333	16	admin
2334	91	admin
2335	27	admin
2336	11	admin
2337	93	admin
2338	12	admin
2339	13	admin
2340	26	admin
2341	75	admin
2342	76	admin
2343	94	admin
2344	125	admin
2345	140	admin
2346	173	admin
2347	176	admin
2348	177	admin
2349	178	admin
2350	228	admin
2351	352	admin
2352	408	admin
2353	409	admin
2354	391	admin
2355	392	admin
2356	22	admin
2357	23	admin
2358	51	admin
2359	55	admin
2360	56	admin
2361	57	admin
2362	58	admin
2363	61	admin
2364	62	admin
2365	59	admin
2366	60	admin
2367	50	admin
2368	88	admin
2369	89	admin
2370	111	admin
2371	126	admin
2372	127	admin
2373	141	admin
2374	142	admin
2375	180	admin
2376	181	admin
2377	190	admin
2378	191	admin
2379	192	admin
2380	193	admin
2381	194	admin
2382	195	admin
2383	196	admin
2384	197	admin
2385	198	admin
2386	199	admin
2387	200	admin
2388	201	admin
2389	202	admin
2390	232	admin
2391	203	admin
2392	233	admin
2393	70	admin
2394	234	admin
2395	235	admin
2396	211	admin
2397	212	admin
2398	239	admin
2399	242	admin
2400	257	admin
2401	258	admin
2402	273	admin
2403	274	admin
2404	281	admin
2405	336	admin
2406	337	admin
2407	346	admin
2408	347	admin
2409	348	admin
2410	355	admin
2411	385	admin
2412	386	admin
2413	389	admin
2414	393	admin
2415	459	admin
2416	460	admin
2417	179	admin
2418	251	admin
2419	252	admin
2420	254	admin
2421	260	admin
2422	261	admin
2423	262	admin
2424	263	admin
2425	266	admin
2426	267	admin
2427	268	admin
2428	271	admin
2429	272	admin
2430	275	admin
2431	276	admin
2432	277	admin
2433	278	admin
2434	279	admin
2435	280	admin
2436	294	admin
2437	297	admin
2438	298	admin
2439	302	admin
2440	303	admin
2441	305	admin
2442	369	admin
2443	370	admin
2444	313	admin
2445	314	admin
2446	315	admin
2447	371	admin
2448	372	admin
2449	334	admin
2450	335	admin
2451	373	admin
2452	374	admin
2453	375	admin
2454	376	admin
2455	377	admin
2456	378	admin
2457	356	admin
2458	357	admin
2459	358	admin
2460	379	admin
2461	380	admin
2462	382	admin
2463	395	admin
2464	396	admin
2465	397	admin
2466	398	admin
2467	407	admin
2468	455	admin
2469	456	admin
2470	457	admin
2471	458	admin
2472	461	admin
2473	462	admin
2474	463	admin
2475	464	admin
2476	465	admin
2477	466	admin
2478	467	admin
2479	468	admin
2480	469	admin
2481	475	admin
2482	476	admin
2483	100	admin
2484	63	admin
2485	64	admin
2486	65	admin
2487	73	admin
2488	121	admin
2489	122	admin
2490	101	admin
2491	87	admin
2492	123	admin
2493	124	admin
2494	68	admin
2495	166	admin
2496	167	admin
2497	168	admin
2498	169	admin
2499	170	admin
2500	236	admin
2501	248	admin
2502	253	admin
2503	3	admin
2504	345	admin
2505	359	admin
2506	388	admin
2507	394	admin
2508	399	admin
2509	403	admin
2510	404	admin
2511	406	admin
2512	445	admin
2513	453	admin
2514	471	admin
2515	487	admin
2516	488	admin
2517	489	admin
2518	490	admin
2519	491	admin
2520	187	admin
2521	188	admin
2522	259	admin
2523	492	admin
2548	510	admin
2549	517	admin
2550	518	admin
2551	519	admin
2552	520	admin
2553	521	admin
2554	516	admin
2555	500	admin
2556	506	admin
2557	511	admin
2558	512	admin
2559	513	admin
2560	514	admin
2561	515	admin
2566	528	admin
2567	498	admin
2568	501	admin
2569	502	admin
2570	503	admin
2571	504	admin
2572	505	admin
2573	499	admin
2574	507	admin
2575	509	admin
2576	522	admin
2577	523	admin
2578	524	admin
2579	525	admin
2580	526	admin
2581	527	admin
2582	529	admin
2590	580	admin
2591	581	admin
2592	582	admin
2593	583	admin
2594	584	admin
2595	585	admin
2596	586	admin
2597	587	admin
2598	588	admin
2599	589	admin
2600	590	admin
2601	591	admin
2602	592	admin
2603	593	admin
2604	594	admin
2605	595	admin
2606	596	admin
2607	597	admin
2608	598	admin
2609	599	admin
2610	600	admin
2611	601	admin
2612	602	admin
2613	603	admin
2614	640	admin
2615	641	admin
2616	642	admin
2617	643	admin
2618	610	admin
2619	611	admin
2620	612	admin
2621	613	admin
2622	646	admin
2623	647	admin
2624	614	admin
2625	615	admin
2626	616	admin
2627	617	admin
2628	618	admin
2629	654	admin
\.


--
-- Name: usrpriv_usrpriv_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('usrpriv_usrpriv_id_seq', 2629, true);


--
-- Name: vend_vend_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('vend_vend_id_seq', 77, true);


--
-- Name: vendaddr_vendaddr_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('vendaddr_vendaddr_id_seq', 33, true);


--
-- Data for Name: vendaddrinfo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY vendaddrinfo (vendaddr_id, vendaddr_vend_id, vendaddr_code, vendaddr_name, vendaddr_comments, vendaddr_cntct_id, vendaddr_addr_id, vendaddr_taxzone_id) FROM stdin;
\.


--
-- Data for Name: vendinfo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY vendinfo (vend_id, vend_name, vend_lastpurchdate, vend_active, vend_po, vend_comments, vend_pocomments, vend_number, vend_1099, vend_exported, vend_fobsource, vend_fob, vend_terms_id, vend_shipvia, vend_vendtype_id, vend_qualified, vend_ediemail, vend_ediemailbody, vend_edisubject, vend_edifilename, vend_accntnum, vend_emailpodelivery, vend_restrictpurch, vend_edicc, vend_curr_id, vend_cntct1_id, vend_cntct2_id, vend_addr_id, vend_match, vend_ach_enabled, vend_ach_accnttype, vend_ach_use_vendinfo, vend_ach_indiv_number, vend_ach_indiv_name, vend_ediemailhtml, vend_ach_routingnumber, vend_ach_accntnumber, vend_taxzone_id, vend_accnt_id, vend_expcat_id, vend_tax_id) FROM stdin;
\.


--
-- Data for Name: vendtype; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY vendtype (vendtype_id, vendtype_code, vendtype_descrip) FROM stdin;
\.


--
-- Name: vendtype_vendtype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('vendtype_vendtype_id_seq', 17, true);


--
-- Data for Name: vodist; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY vodist (vodist_id, vodist_poitem_id, vodist_vohead_id, vodist_costelem_id, vodist_accnt_id, vodist_amount, vodist_qty, vodist_expcat_id, vodist_tax_id, vodist_discountable, vodist_notes) FROM stdin;
\.


--
-- Name: vodist_vodist_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('vodist_vodist_id_seq', 117, true);


--
-- Data for Name: vohead; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY vohead (vohead_id, vohead_number, vohead_pohead_id, vohead_posted, vohead_duedate, vohead_invcnumber, vohead_amount, vohead_docdate, vohead_1099, vohead_distdate, vohead_reference, vohead_terms_id, vohead_vend_id, vohead_curr_id, vohead_adjtaxtype_id, vohead_freighttaxtype_id, vohead_gldistdate, vohead_misc, vohead_taxzone_id, vohead_taxtype_id, vohead_notes, vohead_recurring_vohead_id) FROM stdin;
\.


--
-- Name: vohead_vohead_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('vohead_vohead_id_seq', 174, true);


--
-- Data for Name: voheadtax; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY voheadtax (taxhist_id, taxhist_parent_id, taxhist_taxtype_id, taxhist_tax_id, taxhist_basis, taxhist_basis_tax_id, taxhist_sequence, taxhist_percent, taxhist_amount, taxhist_tax, taxhist_docdate, taxhist_distdate, taxhist_curr_id, taxhist_curr_rate, taxhist_journalnumber) FROM stdin;
\.


--
-- Data for Name: voitem; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY voitem (voitem_id, voitem_vohead_id, voitem_poitem_id, voitem_close, voitem_qty, voitem_freight, voitem_taxtype_id) FROM stdin;
\.


--
-- Name: voitem_voitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('voitem_voitem_id_seq', 110, true);


--
-- Data for Name: voitemtax; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY voitemtax (taxhist_id, taxhist_parent_id, taxhist_taxtype_id, taxhist_tax_id, taxhist_basis, taxhist_basis_tax_id, taxhist_sequence, taxhist_percent, taxhist_amount, taxhist_tax, taxhist_docdate, taxhist_distdate, taxhist_curr_id, taxhist_curr_rate, taxhist_journalnumber) FROM stdin;
\.


--
-- Name: warehous_warehous_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('warehous_warehous_id_seq', 34, true);


--
-- Data for Name: whsezone; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY whsezone (whsezone_id, whsezone_warehous_id, whsezone_name, whsezone_descrip) FROM stdin;
\.


--
-- Name: whsezone_whsezone_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('whsezone_whsezone_id_seq', 6, true);


--
-- Data for Name: whsinfo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY whsinfo (warehous_id, warehous_code, warehous_descrip, warehous_fob, warehous_active, warehous_counttag_prefix, warehous_counttag_number, warehous_bol_prefix, warehous_bol_number, warehous_shipping, warehous_useslips, warehous_usezones, warehous_aislesize, warehous_aislealpha, warehous_racksize, warehous_rackalpha, warehous_binsize, warehous_binalpha, warehous_locationsize, warehous_locationalpha, warehous_enforcearbl, warehous_default_accnt_id, warehous_shipping_commission, warehous_cntct_id, warehous_addr_id, warehous_transit, warehous_shipform_id, warehous_shipvia_id, warehous_shipcomments, warehous_costcat_id, warehous_sitetype_id, warehous_taxzone_id, warehous_sequence) FROM stdin;
\.


--
-- Data for Name: wo; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY wo (wo_id, wo_number, wo_subnumber, wo_status, wo_itemsite_id, wo_startdate, wo_duedate, wo_ordtype, wo_ordid, wo_qtyord, wo_qtyrcv, wo_adhoc, wo_itemcfg_series, wo_imported, wo_wipvalue, wo_postedvalue, wo_prodnotes, wo_prj_id, wo_priority, wo_brdvalue, wo_bom_rev_id, wo_boo_rev_id, wo_cosmethod, wo_womatl_id, wo_username) FROM stdin;
\.


--
-- Name: wo_wo_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('wo_wo_id_seq', 445, true);


--
-- Data for Name: womatl; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY womatl (womatl_id, womatl_wo_id, womatl_itemsite_id, womatl_qtyper, womatl_scrap, womatl_qtyreq, womatl_qtyiss, womatl_qtywipscrap, womatl_lastissue, womatl_lastreturn, womatl_cost, womatl_picklist, womatl_status, womatl_imported, womatl_createwo, womatl_issuemethod, womatl_wooper_id, womatl_bomitem_id, womatl_duedate, womatl_schedatwooper, womatl_uom_id, womatl_notes, womatl_ref, womatl_scrapvalue, womatl_qtyfxd, womatl_issuewo, womatl_price) FROM stdin;
\.


--
-- Name: womatl_womatl_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('womatl_womatl_id_seq', 1292, true);


--
-- Data for Name: womatlpost; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY womatlpost (womatlpost_id, womatlpost_womatl_id, womatlpost_invhist_id) FROM stdin;
\.


--
-- Name: womatlpost_womatlpost_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('womatlpost_womatlpost_id_seq', 1, false);


--
-- Data for Name: womatlvar; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY womatlvar (womatlvar_id, womatlvar_number, womatlvar_subnumber, womatlvar_posted, womatlvar_parent_itemsite_id, womatlvar_component_itemsite_id, womatlvar_qtyord, womatlvar_qtyrcv, womatlvar_qtyiss, womatlvar_qtyper, womatlvar_scrap, womatlvar_wipscrap, womatlvar_bomitem_id, womatlvar_ref, womatlvar_notes, womatlvar_qtyfxd) FROM stdin;
\.


--
-- Name: womatlvar_womatlvar_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('womatlvar_womatlvar_id_seq', 44, true);


--
-- Name: xcalitem_xcalitem_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('xcalitem_xcalitem_id_seq', 134, true);


--
-- Data for Name: xsltmap; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY xsltmap (xsltmap_id, xsltmap_name, xsltmap_doctype, xsltmap_system, xsltmap_import, xsltmap_export) FROM stdin;
1	Yahoo	OrderList	http://store.yahoo.com/doc/dtd/OrderList2.dtd	yahoo_to_xtupleapi.xsl	
\.


--
-- Name: xsltmap_xsltmap_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('xsltmap_xsltmap_id_seq', 1, true);


--
-- Data for Name: yearperiod; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY yearperiod (yearperiod_id, yearperiod_start, yearperiod_end, yearperiod_closed) FROM stdin;
\.


--
-- Name: yearperiod_yearperiod_id_seq; Type: SEQUENCE SET; Schema: public; Owner: admin
--

SELECT pg_catalog.setval('yearperiod_yearperiod_id_seq', 1, false);



--
-- Data for Name: pkgcmd; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgcmd (cmd_id, cmd_module, cmd_title, cmd_descrip, cmd_privname, cmd_executable, cmd_name) FROM stdin;
\.


--
-- Data for Name: pkgcmdarg; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgcmdarg (cmdarg_id, cmdarg_cmd_id, cmdarg_order, cmdarg_arg) FROM stdin;
\.


--
-- Data for Name: pkgimage; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgimage (image_id, image_name, image_descrip, image_data) FROM stdin;
\.


--
-- Data for Name: pkgmetasql; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgmetasql (metasql_id, metasql_group, metasql_name, metasql_notes, metasql_query, metasql_lastuser, metasql_lastupdate, metasql_grade) FROM stdin;
416	projects	detailte		-- Group: projects\n-- Name:  detailte\n-- Notes: \nSELECT prj_id, prj_number, prj_name,\n  CASE WHEN(prj_status='P') THEN <? value("planning") ?>\n       WHEN(prj_status='O') THEN <? value("open") ?>\n       WHEN(prj_status='C') THEN <? value("complete") ?>\n       ELSE <? value("undefined") ?>\n END AS prj_status, \n prj_username, \n  COALESCE(SUM(prjtask_hours_budget), 0.0) AS budget_hrs,\n  COALESCE(SUM(prjtask_hours_actual), 0.0) AS actual_hrs,\n  COALESCE(SUM(prjtask_hours_budget - prjtask_hours_actual), 0.0) AS balance_hrs, \n CASE WHEN COALESCE(SUM(prjtask_hours_budget - prjtask_hours_actual), 0.0) < 0 THEN \n   'error' END AS balance_hrs_qtforegroundrole, \n   'qty' AS budget_hrs_xtnumericrole, \n   'qty' AS actual_hrs_xtnumericrole, \n   'qty' AS balance_hrs_xtnumericrole \nFROM prj\nLEFT OUTER JOIN prjtask ON (prj_id=prjtask_prj_id)\n<? if not exists("showComplete") ?>\nWHERE (prj_status <> 'C')\n<? endif ?>\nGROUP BY prj_id, prj_number, prj_name, prj_status, prj_username \n ORDER BY prj_number;	\N	\N	0
362	customer	deltecustrate	 Delete customer project defaults\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: customer\n-- Name:  deltecustrate\n-- Notes: Delete customer project defaults\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nDELETE FROM te.tecustrate\nWHERE (tecustrate_cust_id=<? value("cust_id") ?>);\n	\N	\N	0
363	customer	instecustrate	 Insert customer rate record\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: customer\n-- Name:  instecustrate\n-- Notes: Insert customer rate record\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.tecustrate (\n  tecustrate_cust_id,\n  tecustrate_rate,\n  tecustrate_curr_id )\nVALUES (\n  <? value("cust_id") ?>,\n  <? value("rate") ?>,\n  <? value("curr_id") ?> )\nRETURNING *;\n	\N	\N	0
364	customer	seltecustrate	 Select Default Customer Project Info\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: customer\n-- Name:  seltecustrate\n-- Notes: Select Default Customer Project Info\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT *\nFROM te.tecustrate\nWHERE (tecustrate_cust_id=<? value("cust_id") ?>);\n	\N	\N	0
365	customer	updtecustrate	 Update customer rate record\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: customer\n-- Name:  updtecustrate\n-- Notes: Update customer rate record\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tecustrate SET\n  tecustrate_cust_id=<? value("cust_id") ?>,\n  tecustrate_rate=<? value("rate") ?>,\n  tecustrate_curr_id=<? value("curr_id") ?>\nWHERE (tecustrate_id=<? value("tecustrate_id") ?>)\nRETURNING *;\n	\N	\N	0
366	employee	insteemp	 Insert employee time expense record\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: employee\n-- Name:  insteemp\n-- Notes: Insert employee time expense record\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.teemp (\n  teemp_emp_id,\n  teemp_contractor )\nVALUES (\n  <? value("emp_id") ?>,\n  <? value("contractor") ?>);\n	\N	\N	0
367	employee	selteemp	 Select Default Employee Time Expense Info\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: employee\n-- Name:  selteemp\n-- Notes: Select Default Employee Time Expense Info\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT *\nFROM te.teemp\nWHERE (teemp_emp_id=<? value("emp_id") ?>);\n	\N	\N	0
368	employee	updteemp	 Update employee time expense\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: employee\n-- Name:  updteemp\n-- Notes: Update employee time expense\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.teemp SET\n  teemp_contractor=<? value("contractor") ?>\nWHERE (teemp_id=<? value("teemp_id") ?>);\n	\N	\N	0
369	item	delteexp	 Delete Item Expense Settings\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: item\n-- Name:  delteexp\n-- Notes: Delete Item Expense Settings\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nDELETE FROM te.teexp\nWHERE (teexp_id=<? value("item_id") ?>);\n	\N	\N	0
370	item	insteexp	 Insert item expense settings\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: item\n-- Name:  insteexp\n-- Notes: Insert item expense settings\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.teexp (\n  teexp_id,\n  teexp_expcat_id,\n  teexp_accnt_id )\nVALUES (\n  <? value("item_id") ?>,\n  <? value("expcat_id") ?>,\n  <? value("accnt_id") ?>);\n	\N	\N	0
371	item	selteexp	 Select Item Expense Settings\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: item\n-- Name:  selteexp\n-- Notes: Select Item Expense Settings\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  teexp_expcat_id,\n  teexp_accnt_id\nFROM te.teexp\nWHERE (teexp_id=<? value("item_id") ?>);\n	\N	\N	0
372	item	updteexp	 Update item expense settings\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: item\n-- Name:  updteexp\n-- Notes: Update item expense settings\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.teexp SET\n  teexp_expcat_id=<? value("expcat_id") ?>,\n  teexp_accnt_id=<? value("accnt_id") ?>\nWHERE (teexp_id=<? value("item_id") ?>);\n	\N	\N	0
373	project	formatdates	 Formats Dates for jsGantt\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: project\n-- Name:  formatdates\n-- Notes: Formats Dates for jsGantt\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  EXTRACT('day' FROM start_date) || '/' || \n  EXTRACT('month' FROM start_date) || '/' || \n  EXTRACT('year' FROM start_date)  AS start_date,\n  EXTRACT('day' FROM due_date) || '/' || \n  EXTRACT('month' FROM due_date) || '/' || \n  EXTRACT('year' FROM due_date)  AS due_date\nFROM (\n  SELECT COALESCE(<? value("startDate") ?>,<? value("dueDate") ?>)::date AS start_date,\n  <? value("dueDate") ?>::date AS due_date\n) data\n	\N	\N	0
374	project	insteprj	 Insert project time expense record\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: project\n-- Name:  insteprj\n-- Notes: Insert project time expense record\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.teprj (\n  teprj_prj_id,\n  teprj_cust_id,\n  teprj_rate,\n  teprj_curr_id )\nVALUES (\n  <? value("prj_id") ?>,\n  <? value("cust_id") ?>,\n  <? value("rate") ?>,\n  <? value("curr_id") ?> );\n	\N	\N	0
375	project	selteprj	 Select Default Project Time Expense Info\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: project\n-- Name:  selteprj\n-- Notes: Select Default Project Time Expense Info\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT COALESCE(teprj_cust_id,-1) AS cust_id,\n  COALESCE(teprj_curr_id,-1) AS curr_id,\n  *\nFROM te.teprj\nWHERE (teprj_prj_id=<? value("prj_id") ?>);\n	\N	\N	0
376	project	updteprj	 Update project time expense\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: project\n-- Name:  updteprj\n-- Notes: Update project time expense\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.teprj SET\n  teprj_cust_id=<? value("cust_id") ?>,\n  teprj_rate=<? value("rate") ?>,\n  teprj_curr_id=<? value("curr_id") ?>\nWHERE (teprj_id=<? value("teprj_id") ?>);\n	\N	\N	0
377	projectGantt	getprj	 Fetch Project Info\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: projectGantt\n-- Name:  getprj\n-- Notes: Fetch Project Info\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT prj_id\nFROM prj\nWHERE (prj_number=<? value("prjNumber") ?>);\n	\N	\N	0
378	projectGantt	jsgantt	 Loads jsGantt script file\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: projectGantt\n-- Name:  jsgantt\n-- Notes: Loads jsGantt script file\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT script_source FROM script WHERE script_name = 'jsGantt';\n	\N	\N	0
379	projectGantt	jsganttcss	 Loads jsGantt CSS file\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: projectGantt\n-- Name:  jsganttcss\n-- Notes: Loads jsGantt CSS file\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT script_source FROM script WHERE script_name = 'jsGanttCSS';\n	\N	\N	0
380	projectGantt	tasks	 Load project tasks for jsGantt\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: projectGantt\n-- Name:  tasks\n-- Notes: Load project tasks for jsGantt\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  prjtask_id, \n  prjtask_name, \n  EXTRACT('day' FROM prjtask_start_date) || '/' || \n  EXTRACT('month' FROM prjtask_start_date) || '/' || \n  EXTRACT('year' FROM prjtask_start_date)  AS start_date,\n  EXTRACT('day' FROM prjtask_due_date) || '/' || \n  EXTRACT('month' FROM prjtask_due_date) || '/' || \n  EXTRACT('year' FROM prjtask_due_date)  AS due_date \nFROM (\n  SELECT \n    prjtask_id,\n    prjtask_name,\n    COALESCE(prjtask_start_date,prjtask_due_date) AS prjtask_start_date,\n    prjtask_due_date\n  FROM prjtask\n\n\n  WHERE (prjtask_prj_id = <? value("prj_id") ?>)\n) data;\n	\N	\N	0
381	task	insteprjtask	 Insert task time expense record\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: task\n-- Name:  insteprjtask\n-- Notes: Insert task time expense record\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.teprjtask (\n  teprjtask_prjtask_id,\n  teprjtask_cust_id,\n  teprjtask_rate,\n  teprjtask_curr_id,\n  teprjtask_item_id )\nVALUES (\n  <? value("prjtask_id") ?>,\n  <? value("cust_id") ?>,\n  <? value("rate") ?>,\n  <? value("curr_id") ?>,\n  <? value("item_id") ?> );\n	\N	\N	0
382	task	selteprjtask	 Select Default Task Time Expense Info\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: task\n-- Name:  selteprjtask\n-- Notes: Select Default Task Time Expense Info\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  COALESCE(teprjtask_cust_id,-1) AS cust_id,\n  COALESCE(teprjtask_curr_id,-1) AS curr_id,\n  COALESCE(teprjtask_item_id,-1) AS item_id,\n  *\nFROM te.teprjtask\nWHERE (teprjtask_prjtask_id=<? value("prjtask_id") ?>);\n	\N	\N	0
383	task	updteprjtask	 Update task time expense\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: task\n-- Name:  updteprjtask\n-- Notes: Update task time expense\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.teprjtask SET\n  teprjtask_cust_id=<? value("cust_id") ?>,\n  teprjtask_rate=<? value("rate") ?>,\n  teprjtask_curr_id=<? value("curr_id") ?>,\n  teprjtask_item_id=<? value("item_id") ?>\nWHERE (teprjtask_id=<? value("teprjtask_id") ?>);\n	\N	\N	0
384	timeexpensehistory	detail	 \n        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n        See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensehistory\n-- Name:  detail\n-- Notes: \n--        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n--        See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  teitem_id AS id, tehead_emp_id AS altid,\n  teitem.*,\n  item_number, item_descrip1,\n  cust_number, cust_name,\n  tehead.*, tehead_number || '-' || teitem_linenumber::text AS f_sheet_number,\n  emp_code,\n  prj_number, prj_name,\n  prjtask_number, prjtask_name,\n  CASE WHEN (tehead_status='O') THEN \n    <? value("open") ?> \n  WHEN (tehead_status='A') THEN\n    <? value("approved") ?> \n  ELSE <? value("closed") ?>\n  END AS tehead_status_qtdisplayrole,\n  CASE WHEN (teitem_type='T') THEN\n    <? value("time") ?>\n       WHEN (teitem_type='E') THEN\n    <? value("expense") ?>\n       ELSE\n    <? value("error") ?>\n  END AS teitem_type_qtdisplayrole,\n<? if exists("timeOnly") ?>\n  '0' AS teitem_qty_xttotalrole,\n<? endif ?>\n<? if exists("expenseOnly") ?>\n  '0' AS teitem_total_xttotalrole,\n<? endif ?>\n<? if exists("includeFormatted") ?>\n  formatQty(teitem_qty) AS f_qty,\n  formatSalesPrice(teitem_rate) AS f_rate,\n  formatBoolYN(teitem_billable) AS f_billable,\n  formatExtPrice(teitem_total) AS f_total,\n  formatDate(teitem_workdate) AS f_workdate,\n<? endif ?>\n  'qty' AS teitem_qty_xtnumericrole,\n  'salesprice' AS teitem_rate_xtnumericrole,\n  'extprice' AS teitem_total_xtnumericrole\nFROM te.tehead\n  JOIN te.teitem ON (tehead_id = teitem_tehead_id)\n  JOIN emp ON (tehead_emp_id= emp_id)\n  JOIN item ON (teitem_item_id = item_id)\n  JOIN classcode ON (item_classcode_id=classcode_id)\n  LEFT OUTER JOIN custinfo ON (teitem_cust_id=cust_id)\n<? if exists("custtype_pattern") ?>\n  JOIN custtype ON (cust_custtype_id=custtype_id)\n<? endif ?>\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\n<? if exists("custgrp_id") ?>\n  JOIN custgrpitem ON (custgrpitem_cust_id=cust_id)\n<? endif ?>\n<? if exists("empgrp_id") ?>\n  JOIN empgrpitem ON (empgrpitem_emp_id=emp_id)\n<? endif ?>\n<? if exists("itemgrp_id") ?>\n  JOIN itemgrpitem ON (itemgrpitem_item_id=item_id)\n<? endif ?>\nWHERE (true\n<? if exists("startDate") ?>\n  AND (teitem_workdate >= <? value("startDate") ?>)\n<? endif ?>\n<? if exists("endDate") ?>\n  AND (teitem_workdate <= <? value("endDate") ?>)\n<? endif ?>\n<? if exists("timeOnly") ?>\n  AND (teitem_type = 'T')\n<? endif ?>\n<? if exists("expenseOnly") ?>\n  AND (teitem_type = 'E')\n<? endif ?>\n<? if exists("prj_id") ?>\n  AND (prj_id = <? value("prj_id") ?>)\n<? endif ?>\n<? if exists("cust_id") ?>\n  AND (cust_id = <? value("cust_id") ?>)\n<? endif ?>\n<? if exists("custtype_id") ?>\n  AND (cust_custtype_id = <? value("custtype_id") ?>)\n<? endif ?>\n<? if exists("custtype_pattern") ?>\n  AND (custtype_code ~* <? value("custtype_pattern") ?>)\n<? endif ?>\n<? if exists("custgrp_id") ?>\n  AND   (custgrpitem_custgrp_id=<? value("custgrp_id") ?>)\n<? endif ?>\n<? if exists("emp_id") ?>\n  AND (emp_id = <? value("emp_id") ?>)\n<? endif ?>\n<? if exists("empgrp_id") ?>\n  AND   (empgrpitem_empgrp_id=<? value("empgrp_id") ?>)\n<? endif ?>\n<? if exists("item_id") ?>\n  AND (item_id = <? value("item_id") ?>)\n<? endif ?>\n<? if exists("itemgrp_id") ?>\n  AND   (itemgrpitem_itemgrp_id=<? value("itemgrp_id") ?>)\n<? endif ?>\n<? if exists("classcode_id") ?>\n  AND (classcode_id = <? value("classcode_id") ?>)\n<? endif ?>\n<? if exists("classcode_pattern") ?>\n  AND (classcode_code ~* <? value("classcode_pattern") ?>)\n<? endif ?>\n) \nORDER BY tehead_number, teitem_linenumber;\n	\N	\N	0
385	timeexpensesheet	deltehead	 Delete Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  deltehead\n-- Notes: Delete Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nDELETE FROM docass WHERE (docass_source_id=<? value("tehead_id") ?> AND docass_source_type='TE');\nDELETE FROM te.tehead WHERE (tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
386	timeexpensesheet	delteitem	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  delteitem\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nDELETE FROM te.teitem\nWHERE teitem_id=<? value("teitem_id") ?>\n	\N	\N	0
387	timeexpensesheet	detail	\n        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n        See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  detail\n-- Notes:\n--        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n--        See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  teitem.*,\n  CASE WHEN (teitem_type = 'T') THEN\n    teitem_qty\n  END AS hours,\n  CASE WHEN (teitem_type = 'E') THEN\n    teitem_total\n  END AS expense,\n  item_number, item_descrip1,\n  cust_number, cust_name,\n  tehead.*, emp_code,\n  prj_number, prj_name,\n  prjtask_number, prjtask_name,\n  CASE WHEN teitem_type='E' THEN 0\n       ELSE COALESCE(teitem_empcost, te.calcRate(emp_wage, emp_wage_period))\n       END AS teitem_hrlycost,\n  CASE WHEN teitem_type='E' THEN 0\n       ELSE COALESCE(teitem_empcost, te.calcRate(emp_wage, emp_wage_period))\n       * teitem_qty END AS teitem_totalcost,\n  CASE WHEN (teitem_type='T') THEN\n    <? value("time") ?>\n       WHEN (teitem_type='E') THEN\n    <? value("expense") ?>\n       ELSE\n    <? value("error") ?>\n  END AS teitem_type_qtdisplayrole,\n  'qty' AS teitem_qty_xtnumericrole,\n  'qty' AS hours_xtnumericrole,\n  'qty' AS teitem_qty_xtnumericrole,\n  'qty' AS hours_xtnumericrole,\n  'extprice' AS expense_xtnumericrole,\n  '--' AS hours_xtnullrole,\n  '--' AS expense_xtnullrole,\n  'salesprice' AS teitem_rate_xtnumericrole,\n  'extprice' AS teitem_total_xtnumericrole,\n  0 AS hours_xttotalrole,\n  0 AS expense_xttotalrole,\n  firstLine(teitem_notes) AS f_notes\nFROM te.tehead\n  JOIN te.teitem ON (tehead_id = teitem_tehead_id)\n  JOIN emp ON (tehead_emp_id= emp_id)\n  JOIN item ON (teitem_item_id = item_id)\n  LEFT OUTER JOIN custinfo ON (teitem_cust_id=cust_id)\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\nWHERE (tehead_id = <? value("tehead_id") ?>)\nORDER BY teitem_linenumber;\n	\N	\N	0
388	timeexpensesheet	header	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  header\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  tehead.*, emp_code\nFROM te.tehead\n  JOIN emp ON (tehead_emp_id= emp_id)\nWHERE (tehead_id = <? value("tehead_id") ?>);\n	\N	\N	0
389	timeexpensesheet	instehead	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  instehead\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.tehead(\n  tehead_emp_id,\n  tehead_warehous_id,\n  tehead_weekending,\n  tehead_notes) \nVALUES (\n  <? value("emp_id") ?>,\n  <? value("warehous_id") ?>,\n  <? value("weekending") ?>,\n  <? value("notes") ?>)\nRETURNING *;\n	\N	\N	0
390	timeexpensesheet	updtehead	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheet\n-- Name:  updtehead\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tehead SET \n  tehead_emp_id = <? value("emp_id") ?>,\n  tehead_warehous_id = <? value("warehous_id") ?>,\n  tehead_notes = <? value("notes") ?> \nWHERE tehead_id=<? value("tehead_id") ?>;\n	\N	\N	0
391	timeexpensesheetitem	detail	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  detail\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT *,\n (SELECT (COUNT(teitem_id) = 0)\n  FROM te.teitem maxte\n  WHERE ((maxte.teitem_tehead_id=tehead_id)\n   AND (maxte.teitem_linenumber > curr.teitem_linenumber))) AS ismax,\n COALESCE(curr.teitem_empcost, te.calcRate(emp_wage, emp_wage_period)) AS teitem_hrlycost\nFROM te.tehead\n  JOIN te.teitem curr ON (tehead_id = curr.teitem_tehead_id) \n  JOIN prjtask ON (prjtask_id=curr.teitem_prjtask_id)\n  JOIN prj ON (prj_id=prjtask_prj_id)\t\t\n  LEFT JOIN emp ON (tehead_emp_id = emp_id)\nWHERE (curr.teitem_id=<? value("teitem_id") ?>);\n	\N	\N	0
392	timeexpensesheetitem	emptotals	 Employee Hours Totals\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  emptotals\n-- Notes: Employee Hours Totals\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  formatqty(coalesce(sum(day_hours),0)  + coalesce(<? value("hours") ?>,0)) as day_hours,\n  formatqty(coalesce(sum(sheet_hours),0) + coalesce(<? value("hours") ?>,0)) as sheet_hours\nFROM (\n  SELECT teitem_qty AS day_hours, 0 AS sheet_hours\n  FROM te.teitem\n   JOIN te.tehead ON (teitem_tehead_id=tehead_id)\n  WHERE ((tehead_emp_id=<? value("emp_id") ?>)\n   AND (teitem_id != <? value("teitem_id") ?>)\n   AND (teitem_workdate = <? value("workDate") ?>)\n   AND (teitem_type = 'T'))\n  UNION ALL\n  SELECT 0 AS day_hours, teitem_qty AS sheet_hours\n  FROM te.teitem\n   JOIN te.tehead ON (teitem_tehead_id=tehead_id)\n  WHERE ((tehead_emp_id=<? value("emp_id") ?>)\n   AND (teitem_id != <? value("teitem_id") ?>)\n   AND (tehead_id = <? value("tehead_id") ?>)\n   AND (teitem_type = 'T')) \n) AS data;\n	\N	\N	0
393	timeexpensesheetitem	getcustinfo	 Get customer currency rate\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  getcustinfo\n-- Notes: Get customer currency rate\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT cust_curr_id \nFROM custinfo \nWHERE (cust_id=<? value("cust_id") ?>);\n	\N	\N	0
394	timeexpensesheetitem	gettask	 Get Project task list\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name: gettask\n-- Notes: Get Project task list\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  prjtask_id,\n  (prjtask_number || ' - ' || prjtask_name) AS name \nFROM prjtask \nWHERE (prjtask_prj_id = <? value("prj_id") ?>)\n<? if exists("active") ?>\n  AND (prjtask_status IN ('O','P'))\n<? endif ?>\nORDER by prjtask_number;\n	\N	\N	0
395	timeexpensesheetitem	getterate	 Get billing rate for Time Expense Item\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  getterate\n-- Notes: Get billing rate for Time Expense Item\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT COALESCE(rate,0) AS rate \nFROM (\n<? if exists("time") ?>\n-- Project Task Rate\nSELECT teprjtask_rate AS rate, \n  teprjtask_curr_id AS curr_id,\n  10 AS seq \nFROM te.teprjtask\nWHERE ((teprjtask_prjtask_id = <? value("task_id") ?>)\n  AND (teprjtask_curr_id IS NOT NULL))\nUNION\n\n-- Project Rate\nSELECT teprj_rate AS rate, \n  teprj_curr_id AS curr_id,\n  20 AS seq\nFROM te.teprj\nWHERE ((teprj_prj_id = <? value("prj_id") ?>)\n  AND (teprj_curr_id IS NOT NULL))\nUNION\n\n-- Employee Rate\nSELECT emp_extrate AS rate, \n  baseCurrId() AS curr_id,\n  30 AS seq\nFROM emp\nWHERE ((emp_id = <? value("emp_id") ?>)\n AND (emp_extrate > 0))\nUNION\n\n-- Customer Rate\nSELECT tecustrate_rate as rate, \n  tecustrate_curr_id,\n  40 AS seq\nFROM te.tecustrate\nWHERE ((tecustrate_cust_id = <? value("cust_id") ?>)\n  AND (tecustrate_curr_id IS NOT NULL))\nUNION\n<? endif ?>\n\n-- Item List Price\nSELECT item_listprice as rate, \n  baseCurrId(),\n  50 AS seq\nFROM item\nWHERE (item_id = <? value("item_id") ?>)\n) AS rates\nORDER BY seq\nLIMIT 1;\n	\N	\N	0
396	timeexpensesheetitem	instask	 Insert a default Project Task\n Copyright (c) 1999-2015 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  instask\n-- Notes: Insert a default Project Task\n-- Copyright (c) 1999-2015 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO prjtask\n ( prjtask_id,\n   prjtask_number,\n   prjtask_name,\n   prjtask_descrip,\n   prjtask_prj_id,\n   prjtask_anyuser,\n   prjtask_status,\n  prjtask_hours_budget,\n  prjtask_hours_actual,\n  prjtask_exp_budget,\n  prjtask_exp_actual,\n  prjtask_owner_username,\n  prjtask_start_date,\n  prjtask_due_date,\n  prjtask_assigned_date,\n  prjtask_completed_date,\n  prjtask_username )\nSELECT\n  nextval('prjtask_prjtask_id_seq'),\n  <? value("name") ?>,\n  <? value("name") ?>,\n  <? value("name") ?>,\n  <? value("prj_id") ?>,\n  null,\n  'O',\n  0,\n  0,\n  0,\n  0,\n  current_user,\n  <? value("startDate") ?>,\n  null,\n  <? value("startDate") ?>,\n  null,\n  current_user\nRETURNING prjtask_id;\n	\N	\N	0
397	timeexpensesheetitem	insteitem	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  insteitem\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nINSERT INTO te.teitem (\n  teitem_tehead_id,\n  teitem_linenumber,\n  teitem_type,\n  teitem_workdate,\n  teitem_cust_id,\n  teitem_po,\n  teitem_item_id,\n  teitem_uom_id,\n  teitem_qty,\n  teitem_rate,\n  teitem_total,\n  teitem_prjtask_id,\n  teitem_billable,\n  teitem_prepaid, \n  teitem_notes,\n  teitem_curr_id, \n  teitem_empcost )\nSELECT\n  <? value("teitem_tehead_id") ?>,\n  <? value("teitem_linenumber") ?>,\n  <? value("teitem_type") ?>,\n  <? value("teitem_workdate") ?>,\n  <? value("teitem_cust_id") ?>,\n  <? value("teitem_po") ?>,\n  <? value("teitem_item_id") ?>,\n  item_price_uom_id,\n  <? value("teitem_qty") ?>,\n  <? value("teitem_rate") ?>,\n  <? value("teitem_total") ?>,\n  <? value("teitem_prjtask_id") ?>,\n  <? value("teitem_billable") ?>,\n  <? value("teitem_prepaid") ?>,\n  <? value("teitem_notes") ?>,\n  <? value("teitem_curr_id") ?>,\n  <? value("teitem_empcost") ?>\nFROM item\nWHERE (item_id=<? value("teitem_item_id") ?>)\nRETURNING *;\n	\N	\N	0
398	timeexpensesheetitem	nextlinenum	 \n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  nextlinenum\n-- Notes: \n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT  COALESCE(MAX(teitem_linenumber),0) +1 AS linenumber\nFROM te.teitem\nWHERE (teitem_tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
399	timeexpensesheetitem	taskbudg	 Task Budget\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  taskbudg\n-- Notes: Task Budget\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  formatqty(prjtask_hours_budget) as budget_hours,\n  formatqty(prjtask_hours_actual) as actual_hours,\n  formatmoney(prjtask_exp_budget) as budget_cost,\n  formatmoney(prjtask_exp_actual) as actual_cost \nFROM prjtask \nWHERE (prjtask_id = <? value("task_id") ?>)\n	\N	\N	0
400	timeexpensesheetitem	taskdefaults	 Project Task default values\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  taskdefaults\n-- Notes: Project Task default values\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  COALESCE(teprj_cust_id,teprjtask_cust_id,-1) AS cust_id,\n  COALESCE(teprjtask_item_id,-1) AS item_id\nFROM prjtask\n  JOIN prj ON (prj_id=prjtask_prj_id)\n  LEFT OUTER JOIN te.teprj ON (teprj_prj_id=prj_id)\n  LEFT OUTER JOIN te.teprjtask ON (teprjtask_prjtask_id=prjtask_id)\nWHERE (prjtask_id=<? value("prjtask_id") ?>)\n	\N	\N	0
401	timeexpensesheetitem	taskrollup	 Total hours and expenses including unapproved sheets\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  taskrollup\n-- Notes: Total hours and expenses including unapproved sheets\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT \n  formatQty(SUM(total_hours)) AS total_hours,\n  formatMoney(SUM(total_expense)) AS total_expense\nFROM\n  (\n   SELECT \n     prjtask_hours_actual AS total_hours,\n     prjtask_exp_actual AS total_expense\n   FROM prjtask \n   WHERE prjtask_id = <? value("task_id") ?>\n   UNION\n   SELECT\n     SUM(teitem_qty) as total_hours,\n     0 as total_expense\n   FROM te.teitem \n     JOIN te.tehead ON (tehead_id=teitem_tehead_id)\n   WHERE teitem_prjtask_id = <? value("task_id") ?>\n    AND teitem_type = 'T' \n--    AND teitem_id != <? value("teitem_id") ?>\n    AND tehead_status = 'O'\n   UNION\n   SELECT \n     0 as total_hours,\n     SUM(teitem_total) AS total_expense\n   FROM te.teitem \n     JOIN te.tehead ON (tehead_id=teitem_tehead_id)\n   WHERE teitem_prjtask_id = <? value("task_id") ?>\n     AND teitem_type = 'E'\n--     AND teitem_id != <? value("teitem_id") ?>\n     AND tehead_status = 'O'\n) AS rollup;\n	\N	\N	0
402	timeexpensesheetitem	teitemnext	 Find Next Item\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  teitemnext\n-- Notes: Find Next Item\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT a.teitem_id\nFROM te.teitem AS a, te.teitem AS b\nWHERE ((a.teitem_tehead_id = b.teitem_tehead_id)\n  AND (a.teitem_linenumber > b.teitem_linenumber)\n  AND (b.teitem_id=<? value("teitem_id") ?>))\nORDER BY a.teitem_linenumber\nLIMIT 1;\n	\N	\N	0
403	timeexpensesheetitem	teitemprev	 Find previous item\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  teitemprev\n-- Notes: Find previous item\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\n<? if exists("teitem_id") ?>\nSELECT a.teitem_id\nFROM te.teitem AS a, te.teitem AS b\nWHERE ( (a.teitem_tehead_id = b.teitem_tehead_id)\n  AND   (a.teitem_linenumber < b.teitem_linenumber)\n  AND   (b.teitem_id=<? value("teitem_id") ?>) ) \nORDER BY a.teitem_linenumber DESC\nLIMIT 1;\n<? else ?>\nSELECT teitem_id\nFROM te.teitem\nWHERE (teitem_tehead_id=<? value("tehead_id") ?>)\nORDER BY teitem_linenumber DESC\nLIMIT 1;\n<? endif ?>\n	\N	\N	0
404	timeexpensesheetitem	updteitem	 Update Time Expense Item\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheetitem\n-- Name:  updteitem\n-- Notes: Update Time Expense Item\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.teitem SET \n  teitem_tehead_id=<? value("teitem_tehead_id") ?>,\n  teitem_linenumber=<? value("teitem_linenumber") ?>,\n  teitem_type=<? value("teitem_type") ?>,\n  teitem_workdate=<? value("teitem_workdate") ?>,\n  teitem_cust_id=<? value("teitem_cust_id") ?>,\n  teitem_po=<? value("teitem_po") ?>,\n  teitem_item_id=<? value("teitem_item_id") ?>,\n  teitem_uom_id=item_price_uom_id,\n  teitem_qty=<? value("teitem_qty") ?>,\n  teitem_rate=<? value("teitem_rate") ?>,\n  teitem_total=<? value("teitem_total") ?>,\n  teitem_prjtask_id=<? value("teitem_prjtask_id") ?>,\n  teitem_billable=<? value("teitem_billable") ?>,\n  teitem_prepaid=<? value("teitem_prepaid") ?>, \n  teitem_notes=<? value("teitem_notes") ?>,\n  teitem_curr_id=<? value("teitem_curr_id") ?>,\n  teitem_empcost=<? value("teitem_empcost") ?>\nFROM item\nWHERE ((teitem_id=<? value("teitem_id") ?>)\n AND (<? value("teitem_item_id") ?>=item_id))\nRETURNING *;\n	\N	\N	0
405	timeexpensesheets	approve	 Approve Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  approve\n-- Notes: Approve Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tehead SET \n  tehead_status = 'A' \nWHERE (tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
406	timeexpensesheets	close	 Close Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  close\n-- Notes: Close Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tehead SET \n  tehead_status = 'C' \nWHERE (tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
407	timeexpensesheets	detail	 Time Expense Sheet List\n        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n        See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  detail\n-- Notes: Time Expense Sheet List\n--        Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n--        See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT\n  tehead_id,\n  tehead_number,\n  tehead_weekending,\n  tehead_status,\n  emp_code,\n  invoiced,\n  vouchered,\n  posted,\n\n  SUM(tovoucher) AS total_e,\n  SUM(toinvoice) AS total_i,\n  \n  CASE WHEN (invoiced = 1) THEN <? value("yes") ?>\n       WHEN (invoiced = 0) THEN <? value("no") ?>\n       ELSE <? value("na") ?>\n  END AS invoiced_qtdisplayrole,\n  CASE WHEN (vouchered = 1) THEN <? value("yes") ?>\n       WHEN (vouchered = 0) THEN <? value("no") ?>\n       ELSE <? value("na") ?>\n  END AS vouchered_qtdisplayrole,\n  CASE WHEN (posted = 1) THEN <? value("yes") ?>\n       WHEN (posted = 0) THEN <? value("no") ?>\n       ELSE <? value("na") ?>\n  END AS posted_qtdisplayrole,\n  CASE WHEN (tehead_status='O') THEN\n       <? value("open") ?>\n  WHEN (tehead_status='A') THEN\n       <? value("approved") ?>\n  ELSE <? value("closed") ?>\n  END AS tehead_status_qtdisplayrole,\n  'curr' AS total_xtnumericrole,\n  CASE WHEN (invoiced = -1) THEN 'LightGray'\n       WHEN (invoiced = 0 AND tehead_status = 'A') THEN 'altemphasis'\n  END AS invoiced_qtforegroundrole,\n  CASE WHEN (vouchered = -1) THEN 'LightGray'\n       WHEN (vouchered = 0 AND tehead_status = 'A') THEN 'altemphasis'\n  END AS vouchered_qtforegroundrole,\n  CASE WHEN (posted = -1) THEN 'LightGray'\n       WHEN (posted = 0 AND tehead_status = 'A') THEN 'altemphasis'\n  END AS posted_qtforegroundrole,\n  CASE WHEN (tehead_status = 'O') THEN 'emphasis'\n       WHEN (tehead_status = 'A') THEN 'altemphasis'\n  END AS tehead_status_qtforegroundrole\n\n<? if exists("includeFormatted") ?> ,\n  formatMoney(SUM(toinvoice)) AS f_total,\n  formatDate(tehead_weekending) AS f_weekending\n<? endif ?>\n\nFROM (\n  SELECT\n    tehead_id,\n    tehead_number,\n    tehead_weekending,\n    tehead_status,\n    emp_code,  \n    CASE WHEN (teitem_type='E' AND teitem_prepaid = FALSE) \n            THEN teitem_total\n         WHEN (teitem_type='T' AND teemp_contractor = TRUE) \n            THEN COALESCE(teitem_empcost, te.calcRate(emp_wage, emp_wage_period))* teitem_qty\n         ELSE 0 \n    END as tovoucher,\n         \n    CASE WHEN (teitem_billable=TRUE) \n            THEN teitem_total\n         ELSE 0 \n    END AS toinvoice,\n\n    te.sheetstate(tehead_id, 'I') AS invoiced,\n    te.sheetstate(tehead_id, 'V') AS vouchered,\n    te.sheetstate(tehead_id, 'P') AS posted\n  FROM te.tehead\n    LEFT OUTER JOIN te.teitem ON (tehead_id=teitem_tehead_id)\n    JOIN emp ON (tehead_emp_id=emp_id)\n    LEFT OUTER JOIN te.teemp ON (tehead_emp_id=teemp_emp_id)\n  WHERE (\n        (tehead_weekending >= <? value("startDate") ?> )\n    AND (tehead_weekending <= <? value("endDate") ?> )\n    AND (tehead_status IN (<? literal("statusList") ?>))\n<? if exists("emp_id") ?>\n    AND \n        (tehead_emp_id=<? value("emp_id") ?>)\n<? endif ?>\n<? if exists("mgr_emp_id") ?>\n    AND \n        (emp_mgr_emp_id=<? value("mgr_emp_id") ?>)\n<? endif ?>\n)) AS data\nGROUP BY\n    tehead_id,\n    tehead_number,\n    tehead_weekending,\n    tehead_status,\n    emp_code,\n    invoiced,\n    vouchered,\n    posted\nORDER BY tehead_number;\n	\N	\N	0
408	timeexpensesheets	invoice	 Invoice Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  invoice\n-- Notes: Invoice Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT te.invoiceSheets(ARRAY[\n   <? foreach("tehead_ids") ?>\n     <? if not isfirst("tehead_ids") ?>\n      ,\n     <? endif ?>\n    <? value("tehead_ids") ?>\n   <? endforeach ?>\n],<? value("invchead_invcdate") ?>::DATE\n);\n	\N	\N	0
409	timeexpensesheets	post	 Post Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  post\n-- Notes: Post Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT te.postSheet(<? value("tehead_id") ?>, <? value("phrase1") ?>, <? value("phrase2") ?>);\n	\N	\N	0
493	timeexpensesheets	reopen	 Reopen Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  reopen\n-- Notes: Reopen Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tehead SET \n  tehead_status = 'O' \nWHERE (tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
410	timeexpensesheets	unapprove	 Unapprove Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  unapprove\n-- Notes: Unapprove Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nUPDATE te.tehead SET \n  tehead_status = 'O' \nWHERE (tehead_id=<? value("tehead_id") ?>);\n	\N	\N	0
411	timeexpensesheets	voucher	 Voucher Time Expense Sheet\n Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n See www.xtuple.com/CPAL for the full text of the software license.\n	-- Group: timeexpensesheets\n-- Name:  voucher\n-- Notes: Voucher Time Expense Sheet\n-- Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n-- See www.xtuple.com/CPAL for the full text of the software license.\n\nSELECT te.voucherSheet(<? value("tehead_id") ?>);\n	\N	\N	0
\.


--
-- Data for Name: pkgpriv; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgpriv (priv_id, priv_module, priv_name, priv_descrip, priv_seq) FROM stdin;
610	TE	MaintainTimeExpenseOthers	Allowed to Maintain Time/Exp Sheets for all users	\N
611	TE	MaintainTimeExpenseSelf	Allowed to Maintain Time/Exp Sheets	\N
612	TE	MaintainTimeExpense	Allowed to Maintain Time/Exp Sheets	\N
613	TE	CanViewRates	Allowed to view rates in the Time Entries	\N
646	TE	MaintainEmpCostAll	Allowed to maintain employee costs for all users	\N
647	TE	MaintainEmpCostSelf	Allowed to maintain own employee costs	\N
614	TE	CanApprove	Allowed to Approve Time/Exp Sheets	\N
615	TE	allowInvoicing	Allowed to Invoice Time/Exp Sheets	\N
616	TE	allowVouchering	Allowed to Voucher Time/Exp Sheets	\N
617	TE	PostTimeSheets	Allowed to Post Time Sheets	\N
618	TE	ViewTimeExpenseHistory	Allowed to view Time Expense Sheet history	\N
654	TE	ReopenTimeExpense	Allowed to Reopen Time/Exp Sheets	\N
\.


--
-- Data for Name: pkgreport; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgreport (report_id, report_name, report_sys, report_source, report_descrip, report_grade, report_loaddate) FROM stdin;
440	TimeExpenseHistory	\N	<!DOCTYPE openRPTDef>\n<report>\n <title>Worksheet History</title>\n <name>TimeExpenseHistory</name>\n <description></description>\n <grid>\n  <snap/>\n  <show/>\n  <x>0.05</x>\n  <y>0.05</y>\n </grid>\n <size>Letter</size>\n <portrait/>\n <topmargin>50</topmargin>\n <bottommargin>50</bottommargin>\n <rightmargin>50</rightmargin>\n <leftmargin>50</leftmargin>\n <querysource loadFromDb="true">\n  <name>detail</name>\n  <mqlgroup>timeexpensehistory</mqlgroup>\n  <mqlname>detail</mqlname>\n </querysource>\n <rpthead>\n  <height>95</height>\n  <label>\n   <rect>\n    <x>295</x>\n    <y>6.4</y>\n    <width>450</width>\n    <height>37</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>18</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Worksheet History</string>\n  </label>\n  <label>\n   <rect>\n    <x>547</x>\n    <y>58.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Quantity</string>\n  </label>\n  <label>\n   <rect>\n    <x>625.333</x>\n    <y>58.3333</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Billable</string>\n  </label>\n  <line>\n   <xstart>3.33333</xstart>\n   <ystart>89.3333</ystart>\n   <xend>743.333</xend>\n   <yend>89.3333</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>395.333</x>\n    <y>72.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item #</string>\n  </label>\n  <label>\n   <rect>\n    <x>204</x>\n    <y>58.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Project #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>393.333</x>\n    <y>58.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Task #</string>\n  </label>\n  <label>\n   <rect>\n    <x>25</x>\n    <y>72.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Work Date</string>\n  </label>\n  <label>\n   <rect>\n    <x>478.333</x>\n    <y>58.3333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>293.333</x>\n    <y>58.3333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>478.333</x>\n    <y>72.3333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description</string>\n  </label>\n  <label>\n   <rect>\n    <x>669.333</x>\n    <y>58.3</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Extended</string>\n  </label>\n  <label>\n   <rect>\n    <x>293.333</x>\n    <y>72.3333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>58.3333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Sheet #</string>\n  </label>\n  <label>\n   <rect>\n    <x>203.333</x>\n    <y>72.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Customer #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>112</x>\n    <y>72.3333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Employee #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>112</x>\n    <y>58.3</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Type</string>\n  </label>\n  <label>\n   <rect>\n    <x>625</x>\n    <y>72.3</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Status</string>\n  </label>\n </rpthead>\n <pghead>\n  <firstpage/>\n  <height>6</height>\n </pghead>\n <pghead>\n  <height>49</height>\n  <label>\n   <rect>\n    <x>294</x>\n    <y>9.33333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>204</x>\n    <y>9.33333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Project #</string>\n  </label>\n  <line>\n   <xstart>6.33333</xstart>\n   <ystart>41.3333</ystart>\n   <xend>746.333</xend>\n   <yend>41.3333</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>9.33333</y>\n    <width>95</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Sheet #</string>\n  </label>\n  <label>\n   <rect>\n    <x>481.333</x>\n    <y>24</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Description</string>\n  </label>\n  <label>\n   <rect>\n    <x>398.333</x>\n    <y>24</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Item #</string>\n  </label>\n  <label>\n   <rect>\n    <x>396.333</x>\n    <y>9.33333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Task #</string>\n  </label>\n  <label>\n   <rect>\n    <x>481.333</x>\n    <y>9.33333</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>203.333</x>\n    <y>24</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Customer #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>293.333</x>\n    <y>24</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Name</string>\n  </label>\n  <label>\n   <rect>\n    <x>25</x>\n    <y>24</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Work Date</string>\n  </label>\n  <label>\n   <rect>\n    <x>669.333</x>\n    <y>9.33</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Extended</string>\n  </label>\n  <label>\n   <rect>\n    <x>549</x>\n    <y>9.33333</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Quantity</string>\n  </label>\n  <label>\n   <rect>\n    <x>627.333</x>\n    <y>9.33333</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Billable</string>\n  </label>\n  <label>\n   <rect>\n    <x>112</x>\n    <y>24</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Employee #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>112</x>\n    <y>9.33</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Type</string>\n  </label>\n  <label>\n   <rect>\n    <x>628</x>\n    <y>24</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Status</string>\n  </label>\n </pghead>\n <section>\n  <name>detail</name>\n  <detail>\n   <key>\n    <query>detail</query>\n   </key>\n   <height>40</height>\n   <field>\n    <rect>\n     <x>394</x>\n     <y>19</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>item_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>480</x>\n     <y>19</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>item_descrip1</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>394</x>\n     <y>3.84333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>prjtask_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>479</x>\n     <y>3.84333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>prjtask_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>547</x>\n     <y>3.84333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_qty</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>626</x>\n     <y>3.84333</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_billable</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>204</x>\n     <y>19</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>cust_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>294</x>\n     <y>3.84333</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>prj_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>204</x>\n     <y>3.84333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>prj_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>294</x>\n     <y>19</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>cust_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>3.84333</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>tehead_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>669.333</x>\n     <y>3.84333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_total</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>25</x>\n     <y>19</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_workdate</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>111.667</x>\n     <y>4.33333</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>teitem_type_qtdisplayrole</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>111.667</x>\n     <y>19</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>emp_code</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>627</x>\n     <y>19</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>tehead_status_qtdisplayrole</column>\n    </data>\n   </field>\n  </detail>\n </section>\n <pgfoot>\n  <height>16</height>\n  <field>\n   <rect>\n    <x>90</x>\n    <y>0</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>report_date</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>615</x>\n    <y>0</y>\n    <width>85</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Page:</string>\n  </label>\n  <field>\n   <rect>\n    <x>705</x>\n    <y>0</y>\n    <width>40</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>page_number</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>85</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Report Date:</string>\n  </label>\n </pgfoot>\n <rptfoot>\n  <height>35</height>\n  <field>\n   <rect>\n    <x>549</x>\n    <y>4.33</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <data>\n    <query>detail</query>\n    <column>teitem_qty</column>\n   </data>\n   <format builtin="true">money</format>\n   <tracktotal subtotal="true"/>\n  </field>\n  <label>\n   <rect>\n    <x>369</x>\n    <y>4.33</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Total:</string>\n  </label>\n  <field>\n   <rect>\n    <x>668</x>\n    <y>4</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <data>\n    <query>detail</query>\n    <column>teitem_total</column>\n   </data>\n   <format>%0.2f</format>\n   <tracktotal subtotal="true"/>\n  </field>\n </rptfoot>\n</report>\n		0	2015-10-01 17:21:32.572357
441	TimeExpenseSheet	\N	<!DOCTYPE openRPTDef>\n<report>\n <title>Worksheet</title>\n <name>TimeExpenseSheet</name>\n <description></description>\n <parameter default="2000" active="true" listtype="dynamic" type="string" name="tehead_id">\n  <description></description>\n  <query>SELECT tehead_id, tehead_number || '-' || tehead_username FROM tehead ORDER By tehead_number DESC;</query>\n </parameter>\n <grid>\n  <snap/>\n  <show/>\n  <x>0.05</x>\n  <y>0.05</y>\n </grid>\n <size>Letter</size>\n <portrait/>\n <topmargin>50</topmargin>\n <bottommargin>50</bottommargin>\n <rightmargin>50</rightmargin>\n <leftmargin>50</leftmargin>\n <querysource>\n  <name>header</name>\n  <sql>SELECT \n  tehead_number,\n  formatDate(tehead_weekending) AS f_weekending,\n  warehous_code,\n  emp_code || ' - ' || COALESCE(cntct_name,'') AS f_employee,\n  CASE WHEN (tehead_status='O') THEN \n    &lt;? value("open") ?> \n  WHEN (tehead_status='A') THEN\n    &lt;? value("approved") ?> \n  ELSE &lt;? value("closed") ?>\n  END AS f_status,\n  tehead_notes\nFROM te.tehead\n JOIN emp ON (tehead_emp_id=emp_id)\n JOIN whsinfo ON (warehous_id=tehead_warehous_id)\n LEFT OUTER JOIN cntct ON (emp_cntct_id=cntct_id)\nWHERE (tehead_id=&lt;? value("tehead_id") ?>);\n</sql>\n </querysource>\n <querysource>\n  <name>time</name>\n  <sql>SELECT\n  teitem_tehead_id,\n  formatDate(teitem_workdate) AS f_workdate,\n  prj_number,\n  prj_name,\n  prjtask_number,\n  prjtask_name,\n  cust_number,\n  cust_name,\n  item_number,\n  item_descrip1,\n  formatQty(teitem_qty) AS f_hours,\n  teitem_qty,\n  CASE WHEN (teitem_billable) THEN\n    formatMoney(teitem_total)\n  ELSE ' -- ' END AS f_billing_total,\n  CASE WHEN (teitem_billable) THEN\n    teitem_total\n  ELSE 0 END AS billing_total,\n  formatBoolYN(teitem_billable) AS f_billable,\n  teitem_notes\nFROM te.teitem\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\n  JOIN item ON (item_id=teitem_item_id)\n  LEFT OUTER JOIN custinfo ON (cust_id=teitem_cust_id)\nWHERE ((teitem_tehead_id=&lt;? value("tehead_id") ?>)\n  AND (teitem_type='T'))\nORDER BY teitem_tehead_id, teitem_workdate, teitem_linenumber;</sql>\n </querysource>\n <querysource>\n  <name>expense</name>\n  <sql>SELECT\n  teitem_tehead_id,\n  formatDate(teitem_workdate) AS f_workdate,\n  prj_number,\n  prj_name,\n  prjtask_number,\n  prjtask_name,\n  cust_number,\n  cust_name,\n  item_number,\n  item_descrip1,\n  formatQty(teitem_qty) AS f_qty,\n  teitem_qty,\n  formatMoney(teitem_total) AS f_total,\n  teitem_total,\n  CASE WHEN (teitem_billable) THEN\n    formatMoney(teitem_total)\n  ELSE ' -- ' END AS f_billing_total,\n  CASE WHEN (teitem_type = 'E') THEN\n    teitem_total\n  ELSE 0 END AS expense_total,\n  CASE WHEN (teitem_billable) THEN\n    teitem_total\n  ELSE 0 END AS billing_total,\n  formatBoolYN(teitem_billable) AS f_billable,\n  teitem_notes\nFROM te.teitem\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\n  JOIN item ON (item_id=teitem_item_id)\n  LEFT OUTER JOIN custinfo ON (cust_id=teitem_cust_id)\nWHERE ((teitem_tehead_id=&lt;? value("tehead_id") ?>)\n  AND (teitem_type='E'))\nORDER BY teitem_workdate, teitem_linenumber;</sql>\n </querysource>\n <querysource>\n  <name>prjsum</name>\n  <sql>SELECT\n  teitem_tehead_id,\n  prj_number,\n  SUM(teitem_qty) AS total_hours,\n  SUM(teitem_total) AS billing_total,\nCASE WHEN (\n           (checkprivilege('MaintainEmpCostSelf')) \n          AND \n           (current_user = (SELECT tehead_username \n                            FROM te.tehead \n                            WHERE teitem_tehead_id = tehead_id)\n           )\n           )\n           THEN SUM(teitem_empcost * teitem_qty)\n           ELSE 0 END AS cost_total,\nCASE WHEN (\n           (checkprivilege('MaintainEmpCostSelf')) \n          AND \n           (current_user = (SELECT tehead_username \n                            FROM te.tehead \n                            WHERE teitem_tehead_id = tehead_id)\n           )\n           )\n           THEN 'Cost'\n           ELSE 'No Priv' END AS title\n\nFROM te.teitem\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\n  JOIN item ON (item_id=teitem_item_id)\n  LEFT OUTER JOIN custinfo ON (cust_id=teitem_cust_id)\nWHERE ((teitem_tehead_id=&lt;? value("tehead_id") ?>)\n  AND (teitem_type='T'))\nGROUP BY teitem_tehead_id, prj_number;</sql>\n </querysource>\n <querysource>\n  <name>prjexpsum</name>\n  <sql>SELECT\n  teitem_tehead_id,\n  prj_number,\n  SUM(teitem_total) AS total\nFROM te.teitem\n  JOIN prjtask ON (teitem_prjtask_id=prjtask_id)\n  JOIN prj ON (prjtask_prj_id=prj_id)\n  JOIN item ON (item_id=teitem_item_id)\n  LEFT OUTER JOIN custinfo ON (cust_id=teitem_cust_id)\nWHERE ((teitem_tehead_id=&lt;? value("tehead_id") ?>)\n  AND (teitem_type='E'))\nGROUP BY teitem_tehead_id, prj_number;</sql>\n </querysource>\n <rpthead>\n  <height>110</height>\n  <label>\n   <rect>\n    <x>295</x>\n    <y>5</y>\n    <width>450</width>\n    <height>37</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>18</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Worksheet</string>\n  </label>\n  <label>\n   <rect>\n    <x>35</x>\n    <y>50</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Week Of:</string>\n  </label>\n  <label>\n   <rect>\n    <x>35</x>\n    <y>65</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Site:</string>\n  </label>\n  <label>\n   <rect>\n    <x>35</x>\n    <y>80</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Employee:</string>\n  </label>\n  <label>\n   <rect>\n    <x>35</x>\n    <y>35</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Sheet #:</string>\n  </label>\n  <label>\n   <rect>\n    <x>260</x>\n    <y>80</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Status:</string>\n  </label>\n  <field>\n   <rect>\n    <x>135</x>\n    <y>35</y>\n    <width>175</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>header</query>\n    <column>tehead_number</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>135</x>\n    <y>50</y>\n    <width>175</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>header</query>\n    <column>f_weekending</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>135</x>\n    <y>65</y>\n    <width>175</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>header</query>\n    <column>warehous_code</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>135</x>\n    <y>80</y>\n    <width>175</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>header</query>\n    <column>f_employee</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>355</x>\n    <y>80</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>header</query>\n    <column>f_status</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>5</x>\n    <y>115</y>\n    <width>450</width>\n    <height>22</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>12</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Time</string>\n  </label>\n </rpthead>\n <pghead>\n  <firstpage/>\n  <height>6</height>\n </pghead>\n <pghead>\n  <height>14</height>\n </pghead>\n <section>\n  <name>time</name>\n  <group>\n   <name>timefoot</name>\n   <column>teitem_tehead_id</column>\n   <head>\n    <height>70</height>\n    <label>\n     <rect>\n      <x>108.667</x>\n      <y>45.3333</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Customer #:</string>\n    </label>\n    <label>\n     <rect>\n      <x>198.667</x>\n      <y>31.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>383.667</x>\n      <y>45.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Description</string>\n    </label>\n    <label>\n     <rect>\n      <x>198.667</x>\n      <y>45.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>9.33333</x>\n      <y>31.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Work Date</string>\n    </label>\n    <label>\n     <rect>\n      <x>480</x>\n      <y>31.3</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Hours</string>\n    </label>\n    <label>\n     <rect>\n      <x>625.333</x>\n      <y>31.3333</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <hcenter/>\n     <vcenter/>\n     <string>Billable</string>\n    </label>\n    <label>\n     <rect>\n      <x>300.667</x>\n      <y>45.3333</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Item #</string>\n    </label>\n    <label>\n     <rect>\n      <x>298.667</x>\n      <y>31.3333</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Task #</string>\n    </label>\n    <label>\n     <rect>\n      <x>383.667</x>\n      <y>30.6667</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>109.333</x>\n      <y>31.3333</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project #:</string>\n    </label>\n    <label>\n     <rect>\n      <x>655</x>\n      <y>31.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Billing Total</string>\n    </label>\n    <line>\n     <xstart>3.33333</xstart>\n     <ystart>61.333</ystart>\n     <xend>743.333</xend>\n     <yend>61.333</yend>\n     <weight>2</weight>\n    </line>\n   </head>\n   <foot>\n    <height>15</height>\n   </foot>\n  </group>\n  <detail>\n   <key>\n    <query>time</query>\n   </key>\n   <height>45</height>\n   <field>\n    <rect>\n     <x>625</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>f_billable</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>200</x>\n     <y>5</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>prj_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>385</x>\n     <y>5</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>prjtask_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>110</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>prj_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>670</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>f_billing_total</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>490</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>f_hours</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>5</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>f_workdate</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>300</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>prjtask_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>110</x>\n     <y>15</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>cust_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>200</x>\n     <y>15</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>cust_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>300</x>\n     <y>15</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>item_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>385</x>\n     <y>15</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>time</query>\n     <column>item_descrip1</column>\n    </data>\n   </field>\n   <text>\n    <rect>\n     <x>10</x>\n     <y>30</y>\n     <width>370</width>\n     <height>15</height>\n    </rect>\n    <bottompad>0</bottompad>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>normal</weight>\n    </font>\n    <left/>\n    <top/>\n    <data>\n     <query>time</query>\n     <column>teitem_notes</column>\n    </data>\n   </text>\n  </detail>\n </section>\n <section>\n  <name>projsum</name>\n  <pagebreak when="at end"/>\n  <group>\n   <name>prj_sum</name>\n   <column>teitem_tehead_id</column>\n   <pagebreak when="after foot"/>\n   <head>\n    <height>50</height>\n    <label>\n     <rect>\n      <x>5</x>\n      <y>10</y>\n      <width>190</width>\n      <height>22</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>12</size>\n      <weight>bold</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project Time Summary</string>\n    </label>\n    <label>\n     <rect>\n      <x>380</x>\n      <y>30</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project #</string>\n    </label>\n    <label>\n     <rect>\n      <x>465</x>\n      <y>30</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Total Hours</string>\n    </label>\n    <label>\n     <rect>\n      <x>685</x>\n      <y>30</y>\n      <width>60</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Billing Total</string>\n    </label>\n    <line>\n     <xstart>3.33333</xstart>\n     <ystart>46.333</ystart>\n     <xend>743.333</xend>\n     <yend>46.333</yend>\n     <weight>2</weight>\n    </line>\n    <field>\n     <rect>\n      <x>615</x>\n      <y>30</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>prjsum</query>\n      <column>title</column>\n     </data>\n    </field>\n   </head>\n   <foot>\n    <height>30</height>\n    <field>\n     <rect>\n      <x>695</x>\n      <y>5</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>prjsum</query>\n      <column>billing_total</column>\n     </data>\n     <format builtin="true">money</format>\n     <tracktotal subtotal="true"/>\n    </field>\n    <field>\n     <rect>\n      <x>505</x>\n      <y>5</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>prjsum</query>\n      <column>total_hours</column>\n     </data>\n     <format builtin="true">qty</format>\n     <tracktotal subtotal="true"/>\n    </field>\n    <line>\n     <xstart>360</xstart>\n     <ystart>5</ystart>\n     <xend>745</xend>\n     <yend>5</yend>\n     <weight>2</weight>\n    </line>\n    <line>\n     <xstart>420</xstart>\n     <ystart>5</ystart>\n     <xend>520</xend>\n     <yend>5</yend>\n     <weight>0</weight>\n    </line>\n    <field>\n     <rect>\n      <x>615</x>\n      <y>5</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>prjsum</query>\n      <column>cost_total</column>\n     </data>\n     <format builtin="true">money</format>\n     <tracktotal subtotal="true"/>\n    </field>\n   </foot>\n  </group>\n  <detail>\n   <key>\n    <query>prjsum</query>\n   </key>\n   <height>25</height>\n   <field>\n    <rect>\n     <x>695</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>prjsum</query>\n     <column>billing_total</column>\n    </data>\n    <format builtin="true">money</format>\n   </field>\n   <field>\n    <rect>\n     <x>615</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>prjsum</query>\n     <column>cost_total</column>\n    </data>\n    <format builtin="true">money</format>\n   </field>\n   <field>\n    <rect>\n     <x>380</x>\n     <y>5</y>\n     <width>115</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>prjsum</query>\n     <column>prj_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>505</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>prjsum</query>\n     <column>total_hours</column>\n    </data>\n    <format builtin="true">qty</format>\n   </field>\n  </detail>\n </section>\n <section>\n  <name>expense</name>\n  <group>\n   <name>expdetail</name>\n   <column>teitem_tehead_id</column>\n   <head>\n    <height>65</height>\n    <label>\n     <rect>\n      <x>109.333</x>\n      <y>44</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Customer #:</string>\n    </label>\n    <label>\n     <rect>\n      <x>199.333</x>\n      <y>30</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>384.333</x>\n      <y>44</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Description</string>\n    </label>\n    <label>\n     <rect>\n      <x>199.333</x>\n      <y>44</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>10</x>\n      <y>30</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Work Date</string>\n    </label>\n    <label>\n     <rect>\n      <x>5</x>\n      <y>5</y>\n      <width>450</width>\n      <height>22</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>12</size>\n      <weight>bold</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Expenses</string>\n    </label>\n    <label>\n     <rect>\n      <x>465</x>\n      <y>30</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Quantity</string>\n    </label>\n    <label>\n     <rect>\n      <x>625.333</x>\n      <y>30</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <hcenter/>\n     <vcenter/>\n     <string>Billable</string>\n    </label>\n    <label>\n     <rect>\n      <x>301.333</x>\n      <y>44</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Item #</string>\n    </label>\n    <label>\n     <rect>\n      <x>299.333</x>\n      <y>30</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Task #</string>\n    </label>\n    <label>\n     <rect>\n      <x>384.333</x>\n      <y>29.3333</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Name</string>\n    </label>\n    <label>\n     <rect>\n      <x>110</x>\n      <y>30</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project #:</string>\n    </label>\n    <label>\n     <rect>\n      <x>670</x>\n      <y>30</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Billing Total</string>\n    </label>\n    <label>\n     <rect>\n      <x>550</x>\n      <y>30</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Total</string>\n    </label>\n   </head>\n   <foot>\n    <height>35</height>\n    <field>\n     <rect>\n      <x>670</x>\n      <y>5</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>expense</query>\n      <column>billing_total</column>\n     </data>\n     <format builtin="true">money</format>\n     <tracktotal subtotal="true"/>\n    </field>\n    <label>\n     <rect>\n      <x>370</x>\n      <y>3.33</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Total Expenses:</string>\n    </label>\n    <field>\n     <rect>\n      <x>550</x>\n      <y>3.33</y>\n      <width>75</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>expense</query>\n      <column>expense_total</column>\n     </data>\n     <format builtin="true">money</format>\n     <tracktotal subtotal="true"/>\n    </field>\n   </foot>\n  </group>\n  <detail>\n   <key>\n    <query>expense</query>\n   </key>\n   <height>50</height>\n   <field>\n    <rect>\n     <x>300</x>\n     <y>20</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>item_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>385</x>\n     <y>20</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>item_descrip1</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>300</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>prjtask_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>385</x>\n     <y>5</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>prjtask_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>490</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>f_qty</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>625</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>f_billable</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>670</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>f_billing_total</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>110</x>\n     <y>20</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>cust_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>200</x>\n     <y>5</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>prj_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>110</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>prj_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>200</x>\n     <y>20</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>cust_name</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>10</x>\n     <y>5</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>f_workdate</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>550</x>\n     <y>5</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>expense</query>\n     <column>f_total</column>\n    </data>\n   </field>\n   <line>\n    <xstart>4.13052</xstart>\n    <ystart>-5.20281</ystart>\n    <xend>744.13</xend>\n    <yend>-5.20281</yend>\n    <weight>2</weight>\n   </line>\n   <text>\n    <rect>\n     <x>110</x>\n     <y>35</y>\n     <width>600</width>\n     <height>15</height>\n    </rect>\n    <bottompad>0</bottompad>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>normal</weight>\n    </font>\n    <left/>\n    <top/>\n    <data>\n     <query>expense</query>\n     <column>teitem_notes</column>\n    </data>\n   </text>\n  </detail>\n </section>\n <section>\n  <name>prjexpsum</name>\n  <group>\n   <name>prjexpsum</name>\n   <column>teitem_tehead_id</column>\n   <head>\n    <height>60</height>\n    <label>\n     <rect>\n      <x>5</x>\n      <y>5</y>\n      <width>230</width>\n      <height>22</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>12</size>\n      <weight>bold</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project Expense Summary</string>\n    </label>\n    <label>\n     <rect>\n      <x>685</x>\n      <y>35</y>\n      <width>60</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <string>Expenses</string>\n    </label>\n    <label>\n     <rect>\n      <x>370</x>\n      <y>35</y>\n      <width>90</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>normal</weight>\n     </font>\n     <left/>\n     <vcenter/>\n     <string>Project #</string>\n    </label>\n    <line>\n     <xstart>4.13052</xstart>\n     <ystart>53.1454</ystart>\n     <xend>744.13</xend>\n     <yend>53.1454</yend>\n     <weight>2</weight>\n    </line>\n   </head>\n   <foot>\n    <height>40</height>\n    <field>\n     <rect>\n      <x>695</x>\n      <y>5</y>\n      <width>50</width>\n      <height>15</height>\n     </rect>\n     <font>\n      <face>Arial</face>\n      <size>8</size>\n      <weight>bold</weight>\n     </font>\n     <right/>\n     <vcenter/>\n     <data>\n      <query>prjexpsum</query>\n      <column>total</column>\n     </data>\n     <format builtin="true">money</format>\n     <tracktotal subtotal="true"/>\n    </field>\n    <line>\n     <xstart>655</xstart>\n     <ystart>5</ystart>\n     <xend>745</xend>\n     <yend>5</yend>\n     <weight>2</weight>\n    </line>\n   </foot>\n  </group>\n  <detail>\n   <key>\n    <query>prjexpsum</query>\n   </key>\n   <height>25</height>\n   <field>\n    <rect>\n     <x>370</x>\n     <y>5</y>\n     <width>115</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>prjexpsum</query>\n     <column>prj_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>695</x>\n     <y>5</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>prjexpsum</query>\n     <column>total</column>\n    </data>\n    <format builtin="true">money</format>\n   </field>\n  </detail>\n </section>\n <pgfoot>\n  <height>25</height>\n  <field>\n   <rect>\n    <x>680</x>\n    <y>5</y>\n    <width>15</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>page_number</column>\n   </data>\n  </field>\n  <field>\n   <rect>\n    <x>90</x>\n    <y>5</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>report_date</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>0</x>\n    <y>5</y>\n    <width>85</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Report Date:</string>\n  </label>\n  <label>\n   <rect>\n    <x>630</x>\n    <y>5</y>\n    <width>45</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Page:</string>\n  </label>\n  <label>\n   <rect>\n    <x>690</x>\n    <y>5</y>\n    <width>15</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>of</string>\n  </label>\n  <field>\n   <rect>\n    <x>710</x>\n    <y>5</y>\n    <width>20</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>page_count</column>\n   </data>\n  </field>\n </pgfoot>\n <rptfoot>\n  <height>30</height>\n  <text>\n   <rect>\n    <x>110</x>\n    <y>5</y>\n    <width>600</width>\n    <height>15</height>\n   </rect>\n   <bottompad>0</bottompad>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <top/>\n   <data>\n    <query>header</query>\n    <column>tehead_notes</column>\n   </data>\n  </text>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>5</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Notes:</string>\n  </label>\n </rptfoot>\n</report>\n		0	2015-10-01 17:21:32.572357
442	TimeExpenseSheets	\N	<!DOCTYPE openRPTDef>\n<report>\n <title>Worksheets</title>\n <name>TimeExpenseSheets</name>\n <description></description>\n <grid>\n  <snap/>\n  <show/>\n  <x>0.05</x>\n  <y>0.05</y>\n </grid>\n <size>Letter</size>\n <portrait/>\n <topmargin>50</topmargin>\n <bottommargin>50</bottommargin>\n <rightmargin>50</rightmargin>\n <leftmargin>50</leftmargin>\n <querysource loadFromDb="true">\n  <name>detail</name>\n  <mqlgroup>timeexpensesheets</mqlgroup>\n  <mqlname>detail</mqlname>\n </querysource>\n <rpthead>\n  <height>131</height>\n  <label>\n   <rect>\n    <x>113</x>\n    <y>112</y>\n    <width>83</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Date</string>\n  </label>\n  <label>\n   <rect>\n    <x>225</x>\n    <y>112</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Employee</string>\n  </label>\n  <label>\n   <rect>\n    <x>550</x>\n    <y>112</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Invoiced</string>\n  </label>\n  <line>\n   <xstart>10</xstart>\n   <ystart>130</ystart>\n   <xend>750</xend>\n   <yend>130</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>625</x>\n    <y>112</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Vouchered</string>\n  </label>\n  <label>\n   <rect>\n    <x>350</x>\n    <y>112</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Status</string>\n  </label>\n  <label>\n   <rect>\n    <x>700</x>\n    <y>112</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Posted</string>\n  </label>\n  <label>\n   <rect>\n    <x>450</x>\n    <y>112</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Extended</string>\n  </label>\n  <label>\n   <rect>\n    <x>295</x>\n    <y>6.40117</y>\n    <width>450</width>\n    <height>37</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>18</size>\n    <weight>bold</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Worksheets</string>\n  </label>\n  <label>\n   <rect>\n    <x>10</x>\n    <y>112</y>\n    <width>95</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Sheet #</string>\n  </label>\n </rpthead>\n <pghead>\n  <firstpage/>\n  <height>6</height>\n </pghead>\n <pghead>\n  <height>36</height>\n  <label>\n   <rect>\n    <x>225</x>\n    <y>14.6</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Employee</string>\n  </label>\n  <label>\n   <rect>\n    <x>119</x>\n    <y>14.6</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Date</string>\n  </label>\n  <line>\n   <xstart>5</xstart>\n   <ystart>30</ystart>\n   <xend>745</xend>\n   <yend>30</yend>\n   <weight>2</weight>\n  </line>\n  <label>\n   <rect>\n    <x>450</x>\n    <y>14.6</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Extended</string>\n  </label>\n  <label>\n   <rect>\n    <x>698.599</x>\n    <y>14.5988</y>\n    <width>50</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Posted</string>\n  </label>\n  <label>\n   <rect>\n    <x>8.6</x>\n    <y>14.6</y>\n    <width>95</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <string>Sheet #</string>\n  </label>\n  <label>\n   <rect>\n    <x>625</x>\n    <y>14.6</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Vouchered</string>\n  </label>\n  <label>\n   <rect>\n    <x>350</x>\n    <y>14.6</y>\n    <width>90</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Status</string>\n  </label>\n  <label>\n   <rect>\n    <x>550</x>\n    <y>14.6</y>\n    <width>75</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <hcenter/>\n   <vcenter/>\n   <string>Invoiced</string>\n  </label>\n </pghead>\n <section>\n  <name>detail</name>\n  <detail>\n   <key>\n    <query>detail</query>\n   </key>\n   <height>22</height>\n   <field>\n    <rect>\n     <x>625</x>\n     <y>1.84</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>vouchered_qtdisplayrole</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>225</x>\n     <y>1.84</y>\n     <width>105</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>emp_code</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>550</x>\n     <y>1.84</y>\n     <width>75</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>invoiced_qtdisplayrole</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>110.599</x>\n     <y>1.84</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_weekending</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>700</x>\n     <y>1.84</y>\n     <width>50</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>posted_qtdisplayrole</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>450</x>\n     <y>1.84</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <right/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>f_total</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>8.59883</x>\n     <y>1.84</y>\n     <width>100</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <left/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>tehead_number</column>\n    </data>\n   </field>\n   <field>\n    <rect>\n     <x>350</x>\n     <y>1.84</y>\n     <width>90</width>\n     <height>15</height>\n    </rect>\n    <font>\n     <face>Arial</face>\n     <size>8</size>\n     <weight>bold</weight>\n    </font>\n    <hcenter/>\n    <vcenter/>\n    <data>\n     <query>detail</query>\n     <column>tehead_status_qtdisplayrole</column>\n    </data>\n   </field>\n  </detail>\n </section>\n <pgfoot>\n  <height>16</height>\n  <field>\n   <rect>\n    <x>90</x>\n    <y>0</y>\n    <width>100</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>report_date</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>615</x>\n    <y>0</y>\n    <width>85</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Page:</string>\n  </label>\n  <field>\n   <rect>\n    <x>705</x>\n    <y>0</y>\n    <width>40</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>bold</weight>\n   </font>\n   <left/>\n   <vcenter/>\n   <data>\n    <query>Context Query</query>\n    <column>page_number</column>\n   </data>\n  </field>\n  <label>\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>85</width>\n    <height>15</height>\n   </rect>\n   <font>\n    <face>Arial</face>\n    <size>8</size>\n    <weight>normal</weight>\n   </font>\n   <right/>\n   <vcenter/>\n   <string>Report Date:</string>\n  </label>\n </pgfoot>\n</report>\n		0	2015-10-01 17:21:32.572357
\.


--
-- Data for Name: pkgscript; Type: TABLE DATA; Schema: te; Owner: admin
--

COPY pkgscript (script_id, script_name, script_order, script_enabled, script_source, script_notes) FROM stdin;
109	dspTimeExpenseHistory	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.dspTimeExpenseHistory = new Object;\n\nvar _close           = mywindow.findChild("_close");\nvar _print           = mywindow.findChild("_print");\nvar _query           = mywindow.findChild("_query");\nvar _list            = mywindow.findChild("_list");\nvar _parameterWidget = mywindow.findChild("_parameterWidget");\n\n_list.addColumn(qsTr("Sheet #"),      XTreeWidget.orderColumn, Qt.AlignLeft,  true,  "f_sheet_number");\n_list.addColumn(qsTr("Employee #"),   XTreeWidget.orderColumn, Qt.AlignLeft,  true,  "emp_code");\n_list.addColumn(qsTr("Work Date"),    XTreeWidget.dateColumn,  Qt.AlignLeft,  true,  "teitem_workdate");\n_list.addColumn(qsTr("Type"),         XTreeWidget.dateColumn,  Qt.AlignLeft,  true,  "teitem_type");\n_list.addColumn(qsTr("Status"),       XTreeWidget.dateColumn,  Qt.AlignLeft,  true,  "tehead_status");\n_list.addColumn(qsTr("Project#"),     XTreeWidget.orderColumn, Qt.AlignLeft,  true,  "prj_number");\n_list.addColumn(qsTr("Project Name"), -1,                      Qt.AlignLeft,  false, "prj_name");\n_list.addColumn(qsTr("Task#"),        XTreeWidget.orderColumn, Qt.AlignLeft,  false, "prjtask_number");\n_list.addColumn(qsTr("Task Name"),    -1,                      Qt.AlignLeft,  false, "prjtask_name");\n_list.addColumn(qsTr("Cust.#"),       XTreeWidget.orderColumn, Qt.AlignLeft,  false, "cust_number");\n_list.addColumn(qsTr("Cust. Name"),   -1,                      Qt.AlignLeft,  false, "cust_name");\n_list.addColumn(qsTr("PO"),           XTreeWidget.orderColumn, Qt.AlignLeft,  false, "teitem_po");\n_list.addColumn(qsTr("Item"),         XTreeWidget.itemColumn,  Qt.AlignLeft,  true,  "item_number");\n_list.addColumn(qsTr("Description"),  -1,                      Qt.AlignLeft,  true,  "item_descrip1");\n_list.addColumn(qsTr("Qty"),          XTreeWidget.qtyColumn,   Qt.AlignRight, true,  "teitem_qty");\nif (privileges.check("CanViewRates"))\n{\n  _list.addColumn(qsTr("Billable"),   XTreeWidget.qtyColumn,   Qt.AlignRight, false, "teitem_billable");\n  _list.addColumn(qsTr("Ext."),       XTreeWidget.moneyColumn, Qt.AlignRight, true,  "teitem_total");\n}\n\nvar teSql = "SELECT 1,'" + qsTr("Time") + "','T' "\n          + "UNION "\n          + "SELECT 2,'" + qsTr("Expense") +  "','E';";\n\nvar empGrpSql = "SELECT empgrp_id, empgrp_name, empgrp_name "\n              + "FROM empgrp "\n              + "ORDER BY empgrp_name;";\n\n_parameterWidget.append(qsTr("Start Date"), "startDate", ParameterWidget.Date, mainwindow.dbDate());\n_parameterWidget.append(qsTr("End Date"), "endDate",   ParameterWidget.Date, mainwindow.dbDate());\n_parameterWidget.appendComboBox(qsTr("Type"), "typeEnum", teSql);\n_parameterWidget.append(qsTr("Employee"), "emp_id",   ParameterWidget.Employee);\n_parameterWidget.appendComboBox(qsTr("Employee Group"), "empgrp_id", empGrpSql);\n_parameterWidget.append(qsTr("Project"), "prj_id",   ParameterWidget.Project);\n_parameterWidget.append(qsTr("Customer"), "cust_id",   ParameterWidget.Customer);\n_parameterWidget.appendComboBox(qsTr("Customer Type"), "custtype_id", XComboBox.CustomerTypes - 0);\n_parameterWidget.append(qsTr("Customer Type Pattern"), "custtype_pattern", ParameterWidget.Text);\n_parameterWidget.appendComboBox(qsTr("Customer Group"), "custgrp_id", XComboBox.CustomerGroups - 0);\n_parameterWidget.append(qsTr("Item"), "item_id",   ParameterWidget.Item);\n_parameterWidget.appendComboBox(qsTr("Item Group"), "itemgrp_id", XComboBox.ItemGroups - 0);\n_parameterWidget.appendComboBox(qsTr("Class Code"), "classcode_id", XComboBox.ClassCodes - 0);\n_parameterWidget.append(qsTr("Class Code Pattern"), "classcode_pattern", ParameterWidget.Text);\n\n_parameterWidget.applyDefaultFilterSet();\n\nxtte.dspTimeExpenseHistory.populateMenu = function(pMenu, pItem, pCol)\n{\n  if(pMenu == null)\n    pMenu = _booitem.findChild("_menu");\n\n  if(pMenu != null)\n  {\n    var editAct = pMenu.addAction(qsTr("Edit..."));\n    editAct.triggered.connect(xtte.dspTimeExpenseHistory.editItem);\n    editAct.enabled = (privileges.check("MaintainTimeExpense") &&\n                       pItem.rawValue("tehead_status") == 'O');\n\n    var viewAct = pMenu.addAction(qsTr("View..."));\n    viewAct.triggered.connect(xtte.dspTimeExpenseHistory.viewItem);\n  }\n}\n\nxtte.dspTimeExpenseHistory.getParams = function()\n{\n  var params = _parameterWidget.parameters();\n  params.open = qsTr("Open");\n  params.approved = qsTr("Approved");\n  params.closed = qsTr("Closed");\n  params.time = qsTr("Time");\n  params.expense = qsTr("Expense");\n\n  if("typeEnum" in params)\n  {\n    if (params.typeEnum == 1)\n      params.timeOnly = true;\n    else\n      params.expenseOnly = true;\n  }\n\n  return params;\n}\n\nxtte.dspTimeExpenseHistory.print = function()\n{\n  var params = xtte.dspTimeExpenseHistory.getParams();\n  params.includeFormatted = true;\n\n  toolbox.printReport("TimeExpenseHistory", params);\n}\n\nxtte.dspTimeExpenseHistory.fillList = function()\n{\n  var qry = toolbox.executeDbQuery("timeexpensehistory", "detail",   xtte.dspTimeExpenseHistory.getParams());\n  _list.populate(qry, true)\n  if(!qry.first())\n    xtte.errorCheck(qry);\n}\n\nxtte.dspTimeExpenseHistory.editItem = function()\n{\n  xtte.dspTimeExpenseHistory.openItem(xtte.editMode);\n}\n\n\nxtte.dspTimeExpenseHistory.viewItem = function()\n{\n  xtte.dspTimeExpenseHistory.openItem(xtte.viewMode);\n}\n\n\nxtte.dspTimeExpenseHistory.openItem = function(mode)\n{  \n  var params   = new Object;\n  params.mode = mode;\n  params.teitem_id = _list.id();\n  params.emp_id = _list.altId();\n\n  var wnd = toolbox.openWindow("timeExpenseSheetItem", mywindow);\n  toolbox.lastWindow().set(params);\n  if (wnd.exec() > 0)\n    xtte.timeExpenseSheet.fillList();\n}\n\n// Connections\n_print.clicked.connect(xtte.dspTimeExpenseHistory.print);\n_query.clicked.connect(xtte.dspTimeExpenseHistory.fillList);\n_list["populateMenu(QMenu *, XTreeWidgetItem *, int)"].connect(xtte.dspTimeExpenseHistory.populateMenu)\n_close.clicked.connect(mywindow, "close");\n\n	
113	jsGantt	0	t	/* \n   _        ___            _   _     _   ____  \n  (_)___   / _ \\__ _ _ __ | |_| |_  / | |___ \\ \n  | / __| / /_\\/ _` | '_ \\| __| __| | |   __) |\n  | \\__ \\/ /_\\\\ (_| | | | | |_| |_  | |_ / __/ \n _/ |___/\\____/\\__,_|_| |_|\\__|\\__| |_(_)_____|\n|__/ \n\nCopyright (c) 2009, Shlomy Gantz BlueBrick Inc. All rights reserved.\n \n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n*     * Redistributions of source code must retain the above copyright\n*       notice, this list of conditions and the following disclaimer.\n*     * Redistributions in binary form must reproduce the above copyright\n*       notice, this list of conditions and the following disclaimer in the\n*       documentation and/or other materials provided with the distribution.\n*     * Neither the name of Shlomy Gantz or BlueBrick Inc. nor the\n*       names of its contributors may be used to endorse or promote products\n*       derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY SHLOMY GANTZ/BLUEBRICK INC. ''AS IS'' AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL SHLOMY GANTZ/BLUEBRICK INC. BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\nvar JSGantt; if (!JSGantt) JSGantt = {};\n\nvar vTimeout = 0;\nvar vBenchTime = new Date().getTime();\n\nJSGantt.isIE = function () {\n\t\n\tif(typeof document.all != 'undefined')\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\n\nJSGantt.TaskItem = function(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption)\n{\n\n      var vID    = pID;\n      var vName  = pName;\n      var vStart = new Date();\t\n      var vEnd   = new Date();\n      var vColor = pColor;\n      var vLink  = pLink;\n      var vMile  = pMile;\n      var vRes   = pRes;\n      var vComp  = pComp;\n      var vGroup = pGroup;\n      var vParent = pParent;\n      var vOpen   = pOpen;\n      var vDepend = pDepend;\n      var vCaption = pCaption;\n      var vDuration = '';\n      var vLevel = 0;\n      var vNumKid = 0;\n      var vVisible  = 1;\n      var x1, y1, x2, y2;\n\n      if (vGroup != 1)\n      {  \n         vStart = JSGantt.parseDateStr(pStart,g.getDateInputFormat());\n         vEnd   = JSGantt.parseDateStr(pEnd,g.getDateInputFormat());\n      }\n\n      this.getID       = function(){ return vID };\n      this.getName     = function(){ return vName };\n      this.getStart    = function(){ return vStart};\n      this.getEnd      = function(){ return vEnd  };\n      this.getColor    = function(){ return vColor};\n      this.getLink     = function(){ return vLink };\n      this.getMile     = function(){ return vMile };\n      this.getDepend   = function(){ if(vDepend) return vDepend; else return null };\n      this.getCaption  = function(){ if(vCaption) return vCaption; else return ''; };\n      this.getResource = function(){ if(vRes) return vRes; else return '&nbsp';  };\n      this.getCompVal  = function(){ if(vComp) return vComp; else return 0; };\n      this.getCompStr  = function(){ if(vComp) return vComp+'%'; else return ''; };\n\n      this.getDuration = function(vFormat){ \n         if (vMile) \n            vDuration = '-';\n            else if (vFormat=='hour')\n            {\n                tmpPer =  Math.ceil((this.getEnd() - this.getStart()) /  ( 60 * 60 * 1000) );\n                if(tmpPer == 1)  \n                    vDuration = '1 Hour';\n                else\n                    vDuration = tmpPer + ' Hours';\n            }\n            \n            else if (vFormat=='minute')\n            {\n                tmpPer =  Math.ceil((this.getEnd() - this.getStart()) /  ( 60 * 1000) );\n                if(tmpPer == 1)  \n                    vDuration = '1 Minute';\n                else\n                    vDuration = tmpPer + ' Minutes';\n            }\n            \n \t\t   else { //if(vFormat == 'day') {\n            tmpPer =  Math.ceil((this.getEnd() - this.getStart()) /  (24 * 60 * 60 * 1000) + 1);\n            if(tmpPer == 1)  vDuration = '1 Day';\n            else             vDuration = tmpPer + ' Days';\n         }\n\n         //else if(vFormat == 'week') {\n         //   tmpPer =  ((this.getEnd() - this.getStart()) /  (24 * 60 * 60 * 1000) + 1)/7;\n         //   if(tmpPer == 1)  vDuration = '1 Week';\n         //   else             vDuration = tmpPer + ' Weeks'; \n         //}\n\n         //else if(vFormat == 'month') {\n         //   tmpPer =  ((this.getEnd() - this.getStart()) /  (24 * 60 * 60 * 1000) + 1)/30;\n         //   if(tmpPer == 1) vDuration = '1 Month';\n         //   else            vDuration = tmpPer + ' Months'; \n         //}\n\n         //else if(vFormat == 'quater') {\n         //   tmpPer =  ((this.getEnd() - this.getStart()) /  (24 * 60 * 60 * 1000) + 1)/120;\n         //   if(tmpPer == 1) vDuration = '1 Qtr';\n         //   else            vDuration = tmpPer + ' Qtrs'; \n         //}\n         return( vDuration )\n      };\n\n      this.getParent   = function(){ return vParent };\n      this.getGroup    = function(){ return vGroup };\n      this.getOpen     = function(){ return vOpen };\n      this.getLevel    = function(){ return vLevel };\n      this.getNumKids  = function(){ return vNumKid };\n      this.getStartX   = function(){ return x1 };\n      this.getStartY   = function(){ return y1 };\n      this.getEndX     = function(){ return x2 };\n      this.getEndY     = function(){ return y2 };\n      this.getVisible  = function(){ return vVisible };\n\t  this.setDepend   = function(pDepend){ vDepend = pDepend;};\n      this.setStart    = function(pStart){ vStart = pStart;};\n      this.setEnd      = function(pEnd)  { vEnd   = pEnd;  };\n      this.setLevel    = function(pLevel){ vLevel = pLevel;};\n      this.setNumKid   = function(pNumKid){ vNumKid = pNumKid;};\n      this.setCompVal  = function(pCompVal){ vComp = pCompVal;};\n      this.setStartX   = function(pX) {x1 = pX; };\n      this.setStartY   = function(pY) {y1 = pY; };\n      this.setEndX     = function(pX) {x2 = pX; };\n      this.setEndY     = function(pY) {y2 = pY; };\n      this.setOpen     = function(pOpen) {vOpen = pOpen; };\n      this.setVisible  = function(pVisible) {vVisible = pVisible; };\n\n  }\n\n\t\n  // function that loads the main gantt chart properties and functions\n  // pDiv: (required) this is a DIV object created in HTML\n  // pStart: UNUSED - future use to force minimum chart date\n  // pEnd: UNUSED - future use to force maximum chart date\n  // pWidth: UNUSED - future use to force chart width and cause objects to scale to fit within that width\n  // pShowRes: UNUSED - future use to turn on/off display of resource names\n  // pShowDur: UNUSED - future use to turn on/off display of task durations\n  // pFormat: (required) - used to indicate whether chart should be drawn in "day", "week", "month", or "quarter" format\n  // pCationType - what type of Caption to show:  Caption, Resource, Duration, Complete\nJSGantt.GanttChart =  function(pGanttVar, pDiv, pFormat)\n{\n\n      var vGanttVar = pGanttVar;\n      var vDiv      = pDiv;\n      var vFormat   = pFormat;\n      var vShowRes  = 1;\n      var vShowDur  = 1;\n      var vShowComp = 1;\n      var vShowStartDate = 1;\n      var vShowEndDate = 1;\n      var vDateInputFormat = "mm/dd/yyyy";\n      var vDateDisplayFormat = "mm/dd/yy";\n\t  var vNumUnits  = 0;\n      var vCaptionType;\n      var vDepId = 1;\n      var vTaskList     = new Array();\t\n\t  var vFormatArr\t= new Array("day","week","month","quarter");\n      var vQuarterArr   = new Array(1,1,1,2,2,2,3,3,3,4,4,4);\n      var vMonthDaysArr = new Array(31,28,31,30,31,30,31,31,30,31,30,31);\n      var vMonthArr     = new Array("January","February","March","April","May","June","July","August","September","October","November","December");\n\t  this.setFormatArr = function() \t {\n\t\t\t\t\t\t\t\t\t\t  vFormatArr = new Array();\n\t\t\t\t\t\t\t\t\t\t  for(var i = 0; i < arguments.length; i++) {vFormatArr[i] = arguments[i];}\n\t\t\t\t\t\t\t\t\t\t  if(vFormatArr.length>4){vFormatArr.length=4;}\n\t\t\t\t\t\t\t\t\t\t };\n      this.setShowRes  = function(pShow) { vShowRes  = pShow; };\n      this.setShowDur  = function(pShow) { vShowDur  = pShow; };\n      this.setShowComp = function(pShow) { vShowComp = pShow; };\n      this.setShowStartDate = function(pShow) { vShowStartDate = pShow; };\n      this.setShowEndDate = function(pShow) { vShowEndDate = pShow; };\n      this.setDateInputFormat = function(pShow) { vDateInputFormat = pShow; };\n      this.setDateDisplayFormat = function(pShow) { vDateDisplayFormat = pShow; };\n      this.setCaptionType = function(pType) { vCaptionType = pType };\n      this.setFormat = function(pFormat){ \n         vFormat = pFormat; \n         this.Draw(); \n      };\n\n      this.getShowRes  = function(){ return vShowRes };\n      this.getShowDur  = function(){ return vShowDur };\n      this.getShowComp = function(){ return vShowComp };\n\t   this.getShowStartDate = function(){ return vShowStartDate };\n\t   this.getShowEndDate = function(){ return vShowEndDate };\n      this.getDateInputFormat = function() { return vDateInputFormat };\n      this.getDateDisplayFormat = function() { return vDateDisplayFormat };\n      this.getCaptionType = function() { return vCaptionType };\n      this.CalcTaskXY = function () \n      {\n         var vList = this.getList();\n         var vTaskDiv;\n         var vParDiv;\n         var vLeft, vTop, vHeight, vWidth;\n\n         for(i = 0; i < vList.length; i++)\n         {\n            vID = vList[i].getID();\n            vTaskDiv = document.getElementById("taskbar_"+vID);\n            vBarDiv  = document.getElementById("bardiv_"+vID);\n            vParDiv  = document.getElementById("childgrid_"+vID);\n\n            if(vBarDiv) {\n               vList[i].setStartX( vBarDiv.offsetLeft );\n               vList[i].setStartY( vParDiv.offsetTop+vBarDiv.offsetTop+6 );\n               vList[i].setEndX( vBarDiv.offsetLeft + vBarDiv.offsetWidth );\n               vList[i].setEndY( vParDiv.offsetTop+vBarDiv.offsetTop+6 );\n            }\n         }\n      }\n\n      this.AddTaskItem = function(value)\n      {\n         vTaskList.push(value);\n      }\n\n      this.getList   = function() { return vTaskList };\n\n      this.clearDependencies = function()\n      {\n         var parent = document.getElementById('rightside');\n         var depLine;\n         var vMaxId = vDepId;\n         for ( i=1; i<vMaxId; i++ ) {\n            depLine = document.getElementById("line"+i);\n            if (depLine) { parent.removeChild(depLine); }\n         }\n         vDepId = 1;\n      }\n\n\n      // sLine: Draw a straight line (colored one-pixel wide DIV), need to parameterize doc item\n      this.sLine = function(x1,y1,x2,y2) {\n\n         vLeft = Math.min(x1,x2);\n         vTop  = Math.min(y1,y2);\n         vWid  = Math.abs(x2-x1) + 1;\n         vHgt  = Math.abs(y2-y1) + 1;\n\n         vDoc = document.getElementById('rightside');\n\n\t // retrieve DIV\n\t var oDiv = document.createElement('div');\n\n\t oDiv.id = "line"+vDepId++;\n         oDiv.style.position = "absolute";\n\t oDiv.style.margin = "0px";\n\t oDiv.style.padding = "0px";\n\t oDiv.style.overflow = "hidden";\n\t oDiv.style.border = "0px";\n\n\t // set attributes\n\t oDiv.style.zIndex = 0;\n\t oDiv.style.backgroundColor = "red";\n\t\n\t oDiv.style.left = vLeft + "px";\n\t oDiv.style.top = vTop + "px";\n\t oDiv.style.width = vWid + "px";\n\t oDiv.style.height = vHgt + "px";\n\n\t oDiv.style.visibility = "visible";\n\t\n\t vDoc.appendChild(oDiv);\n\n      }\n\n\n      // dLine: Draw a diaganol line (calc line x,y paisrs and draw multiple one-by-one sLines)\n      this.dLine = function(x1,y1,x2,y2) {\n\n         var dx = x2 - x1;\n         var dy = y2 - y1;\n         var x = x1;\n         var y = y1;\n\n         var n = Math.max(Math.abs(dx),Math.abs(dy));\n         dx = dx / n;\n         dy = dy / n;\n         for ( i = 0; i <= n; i++ )\n         {\n            vx = Math.round(x); \n            vy = Math.round(y);\n            this.sLine(vx,vy,vx,vy);\n            x += dx;\n            y += dy;\n         }\n\n      }\n\n      this.drawDependency =function(x1,y1,x2,y2)\n      {\n         if(x1 + 10 < x2)\n         { \n            this.sLine(x1,y1,x1+4,y1);\n            this.sLine(x1+4,y1,x1+4,y2);\n            this.sLine(x1+4,y2,x2,y2);\n            this.dLine(x2,y2,x2-3,y2-3);\n            this.dLine(x2,y2,x2-3,y2+3);\n            this.dLine(x2-1,y2,x2-3,y2-2);\n            this.dLine(x2-1,y2,x2-3,y2+2);\n         }\n         else\n         {\n            this.sLine(x1,y1,x1+4,y1);\n            this.sLine(x1+4,y1,x1+4,y2-10);\n            this.sLine(x1+4,y2-10,x2-8,y2-10);\n            this.sLine(x2-8,y2-10,x2-8,y2);\n            this.sLine(x2-8,y2,x2,y2);\n            this.dLine(x2,y2,x2-3,y2-3);\n            this.dLine(x2,y2,x2-3,y2+3);\n            this.dLine(x2-1,y2,x2-3,y2-2);\n            this.dLine(x2-1,y2,x2-3,y2+2);\n         }\n      }\n\n      this.DrawDependencies = function () {\n\n         //First recalculate the x,y\n         this.CalcTaskXY();\n\n         this.clearDependencies();\n\n         var vList = this.getList();\n         for(var i = 0; i < vList.length; i++)\n         {\n\n            vDepend = vList[i].getDepend();\n            if(vDepend) {\n         \n               var vDependStr = vDepend + '';\n               var vDepList = vDependStr.split(',');\n               var n = vDepList.length;\n\n               for(var k=0;k<n;k++) {\n                  var vTask = this.getArrayLocationByID(vDepList[k]);\n\n                  if(vList[vTask].getVisible()==1)\n                     this.drawDependency(vList[vTask].getEndX(),vList[vTask].getEndY(),vList[i].getStartX()-1,vList[i].getStartY())\n               }\n  \t    }\n         }\n      }\n\n\n      this.getArrayLocationByID = function(pId)  {\n\n         var vList = this.getList();\n         for(var i = 0; i < vList.length; i++)\n         {\n            if(vList[i].getID()==pId)\n               return i;\n         }\n      }\n\n\n   this.Draw = function()\n   {\n      var vMaxDate = new Date();\n      var vMinDate = new Date();\t\n      var vTmpDate = new Date();\n      var vNxtDate = new Date();\n      var vCurrDate = new Date();\n      var vTaskLeft = 0;\n      var vTaskRight = 0;\n      var vNumCols = 0;\n      var vID = 0;\n      var vMainTable = "";\n      var vLeftTable = "";\n      var vRightTable = "";\n      var vDateRowStr = "";\n      var vItemRowStr = "";\n      var vColWidth = 0;\n      var vColUnit = 0;\n      var vChartWidth = 0;\n      var vNumDays = 0;\n      var vDayWidth = 0;\n      var vStr = "";\n      var vNameWidth = 220;\t\n      var vStatusWidth = 70;\n      var vLeftWidth = 15 + 220 + 70 + 70 + 70 + 70 + 70;\n\n      if(vTaskList.length > 0)\n      {\n        \n\t\t   // Process all tasks preset parent date and completion %\n         JSGantt.processRows(vTaskList, 0, -1, 1, 1);\n\n         // get overall min/max dates plus padding\n         vMinDate = JSGantt.getMinDate(vTaskList, vFormat);\n         vMaxDate = JSGantt.getMaxDate(vTaskList, vFormat);\n\n         // Calculate chart width variables.  vColWidth can be altered manually to change each column width\n         // May be smart to make this a parameter of GanttChart or set it based on existing pWidth parameter\n         if(vFormat == 'day') {\n            vColWidth = 18;\n            vColUnit = 1;\n         }\n         else if(vFormat == 'week') {\n            vColWidth = 37;\n            vColUnit = 7;\n         }\n         else if(vFormat == 'month') {\n            vColWidth = 37;\n            vColUnit = 30;\n         }\n         else if(vFormat == 'quarter') {\n            vColWidth = 60;\n            vColUnit = 90;\n         }\n         \n         else if(vFormat=='hour')\n         {\n            vColWidth = 18;\n            vColUnit = 1;\n         }\n         \n         else if(vFormat=='minute')\n         {\n            vColWidth = 18;\n            vColUnit = 1;\n         }\n         \n         vNumDays = (Date.parse(vMaxDate) - Date.parse(vMinDate)) / ( 24 * 60 * 60 * 1000);\n         vNumUnits = vNumDays / vColUnit;\n          \n         \n         vChartWidth = vNumUnits * vColWidth + 1;\n         vDayWidth = (vColWidth / vColUnit) + (1/vColUnit);\n\n         vMainTable =\n            '<TABLE id=theTable cellSpacing=0 cellPadding=0 border=0><TBODY><TR>' +\n            '<TD vAlign=top bgColor=#ffffff>';\n\n         if(vShowRes !=1) vNameWidth+=vStatusWidth;\n         if(vShowDur !=1) vNameWidth+=vStatusWidth;\n         if(vShowComp!=1) vNameWidth+=vStatusWidth;\n\t\t   if(vShowStartDate!=1) vNameWidth+=vStatusWidth;\n\t\t   if(vShowEndDate!=1) vNameWidth+=vStatusWidth;\n        \n\t\t   // DRAW the Left-side of the chart (names, resources, comp%)\n         vLeftTable =\n            '<DIV class=scroll id=leftside style="width:' + vLeftWidth + 'px"><TABLE cellSpacing=0 cellPadding=0 border=0><TBODY>' +\n            '<TR style="HEIGHT: 17px">' +\n            '  <TD style="WIDTH: 15px; HEIGHT: 17px"></TD>' +\n            '  <TD style="WIDTH: ' + vNameWidth + 'px; HEIGHT: 17px"><NOBR></NOBR></TD>'; \n\n         if(vShowRes ==1) vLeftTable += '  <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;\n         if(vShowDur ==1) vLeftTable += '  <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;\n         if(vShowComp==1) vLeftTable += '  <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;\n\t\t\tif(vShowStartDate==1) vLeftTable += '  <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;\n\t\t\tif(vShowEndDate==1) vLeftTable += '  <TD style="WIDTH: ' + vStatusWidth + 'px; HEIGHT: 17px"></TD>' ;\n\n         vLeftTable +=\n            '<TR style="HEIGHT: 20px">' +\n            '  <TD style="BORDER-TOP: #efefef 1px solid; WIDTH: 15px; HEIGHT: 20px"></TD>' +\n            '  <TD style="BORDER-TOP: #efefef 1px solid; WIDTH: ' + vNameWidth + 'px; HEIGHT: 20px"><NOBR></NOBR></TD>' ;\n\n         if(vShowRes ==1) vLeftTable += '  <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Resource</TD>' ;\n         if(vShowDur ==1) vLeftTable += '  <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Duration</TD>' ;\n         if(vShowComp==1) vLeftTable += '  <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>% Comp.</TD>' ;\n         if(vShowStartDate==1) vLeftTable += '  <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>Start Date</TD>' ;\n         if(vShowEndDate==1) vLeftTable += '  <TD style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 60px; HEIGHT: 20px" align=center nowrap>End Date</TD>' ;\n \n         vLeftTable += '</TR>';\n\n            for(i = 0; i < vTaskList.length; i++)\n            {\n               if( vTaskList[i].getGroup()) {\n                  vBGColor = "f3f3f3";\n                  vRowType = "group";\n               } else {\n                  vBGColor  = "ffffff";\n                  vRowType  = "row";\n               }\n               \n               vID = vTaskList[i].getID();\n\n  \t\t         if(vTaskList[i].getVisible() == 0) \n                  vLeftTable += '<TR id=child_' + vID + ' bgcolor=#' + vBGColor + ' style="display:none"  onMouseover=g.mouseOver(this,' + vID + ',"left","' + vRowType + '") onMouseout=g.mouseOut(this,' + vID + ',"left","' + vRowType + '")>' ;\n\t\t\t      else\n                 vLeftTable += '<TR id=child_' + vID + ' bgcolor=#' + vBGColor + ' onMouseover=g.mouseOver(this,' + vID + ',"left","' + vRowType + '") onMouseout=g.mouseOut(this,' + vID + ',"left","' + vRowType + '")>' ;\n\n\t\t\t      vLeftTable += \n                  '  <TD class=gdatehead style="WIDTH: 15px; HEIGHT: 20px; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;">&nbsp;</TD>' +\n                  '  <TD class=gname style="WIDTH: ' + vNameWidth + 'px; HEIGHT: 20px; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;" nowrap><NOBR><span style="color: #aaaaaa">';\n\n               for(j=1; j<vTaskList[i].getLevel(); j++) {\n                  vLeftTable += '&nbsp&nbsp&nbsp&nbsp';\n               }\n\n               vLeftTable += '</span>';\n\n               if( vTaskList[i].getGroup()) {\n                  if( vTaskList[i].getOpen() == 1) \n                     vLeftTable += '<SPAN id="group_' + vID + '" style="color:#000000; cursor:pointer; font-weight:bold; FONT-SIZE: 12px;" onclick="JSGantt.folder(' + vID + ','+vGanttVar+');'+vGanttVar+'.DrawDependencies();">&ndash;</span><span style="color:#000000">&nbsp</SPAN>' ;\n                  else\n                     vLeftTable += '<SPAN id="group_' + vID + '" style="color:#000000; cursor:pointer; font-weight:bold; FONT-SIZE: 12px;" onclick="JSGantt.folder(' + vID + ','+vGanttVar+');'+vGanttVar+'.DrawDependencies();">+</span><span style="color:#000000">&nbsp</SPAN>' ;\n\t\t\t\t \n               } else {\n\n                  vLeftTable += '<span style="color: #000000; font-weight:bold; FONT-SIZE: 12px;">&nbsp&nbsp&nbsp</span>';\n               }\n\n               vLeftTable += \n                  '<span onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200); style="cursor:pointer"> ' + vTaskList[i].getName() + '</span></NOBR></TD>' ;\n\n               if(vShowRes ==1) vLeftTable += '  <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getResource() + '</NOBR></TD>' ;\n               if(vShowDur ==1) vLeftTable += '  <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getDuration(vFormat) + '</NOBR></TD>' ;\n               if(vShowComp==1) vLeftTable += '  <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + vTaskList[i].getCompStr()  + '</NOBR></TD>' ;\n               if(vShowStartDate==1) vLeftTable += '  <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + JSGantt.formatDateStr( vTaskList[i].getStart(), vDateDisplayFormat) + '</NOBR></TD>' ;\n               if(vShowEndDate==1) vLeftTable += '  <TD class=gname style="WIDTH: 60px; HEIGHT: 20px; TEXT-ALIGN: center; BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid;" align=center><NOBR>' + JSGantt.formatDateStr( vTaskList[i].getEnd(), vDateDisplayFormat) + '</NOBR></TD>' ;\n\n               vLeftTable += '</TR>';\n\n            }\n\n            // DRAW the date format selector at bottom left.  Another potential GanttChart parameter to hide/show this selector\n            vLeftTable += '</TD></TR>' +\n              '<TR><TD border=1 colspan=5 align=left style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 11px; BORDER-LEFT: #efefef 1px solid; height=18px">&nbsp;&nbsp;Powered by <a href=http://www.jsgantt.com>jsGantt</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format:';\n\t\t\n\t\t\tif (vFormatArr.join().indexOf("minute")!=-1) { \n            if (vFormat=='minute') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="minute" checked>Minute';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("minute",'+vGanttVar+'); VALUE="minute">Minute';\n\t\t\t}\n\t\t\t\n\t\t\tif (vFormatArr.join().indexOf("hour")!=-1) { \n            if (vFormat=='hour') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="hour" checked>Hour';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("hour",'+vGanttVar+'); VALUE="hour">Hour';\n\t\t\t}\n\t\t\t\n\t\t\tif (vFormatArr.join().indexOf("day")!=-1) { \n            if (vFormat=='day') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="day" checked>Day';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("day",'+vGanttVar+'); VALUE="day">Day';\n\t\t\t}\n\t\t\t\n\t\t\tif (vFormatArr.join().indexOf("week")!=-1) { \n            if (vFormat=='week') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="week" checked>Week';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("week",'+vGanttVar+') VALUE="week">Week';\n\t\t\t}\n\t\t\t\n\t\t\tif (vFormatArr.join().indexOf("month")!=-1) { \n            if (vFormat=='month') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="month" checked>Month';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("month",'+vGanttVar+') VALUE="month">Month';\n\t\t\t}\n\t\t\t\n\t\t\tif (vFormatArr.join().indexOf("quarter")!=-1) { \n            if (vFormat=='quarter') vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" VALUE="quarter" checked>Quarter';\n            else                vLeftTable += '<INPUT TYPE=RADIO NAME="radFormat" onclick=JSGantt.changeFormat("quarter",'+vGanttVar+') VALUE="quarter">Quarter';\n\t\t\t}\n\t\t\t\n//            vLeftTable += '<INPUT TYPE=RADIO NAME="other" VALUE="other" style="display:none"> .';\n\n            vLeftTable += '</TD></TR></TBODY></TABLE></TD>';\n\n            vMainTable += vLeftTable;\n\n            // Draw the Chart Rows\n            vRightTable = \n            '<TD style="width: ' + vChartWidth + 'px;" vAlign=top bgColor=#ffffff>' +\n            '<DIV class=scroll2 id=rightside>' +\n            '<TABLE style="width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +\n            '<TBODY><TR style="HEIGHT: 18px">';\n\n            vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());\n            vTmpDate.setHours(0);\n            vTmpDate.setMinutes(0);\n\n         // Major Date Header\n         while(Date.parse(vTmpDate) <= Date.parse(vMaxDate))\n         {\t\n            vStr = vTmpDate.getFullYear() + '';\n            vStr = vStr.substring(2,4);\n            \n            \n            if(vFormat == 'minute')\n            {\n                vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=60>' ;\n                vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + ' ' + vTmpDate.getHours() + ':00 -' + vTmpDate.getHours() + ':59 </td>';\n                vTmpDate.setHours(vTmpDate.getHours()+1);\n            }\n            \n            if(vFormat == 'hour')\n            {\n                vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=24>' ;\n                vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + '</td>';\n                vTmpDate.setDate(vTmpDate.getDate()+1);\n            }\n            \n  \t         if(vFormat == 'day')\n            {\n\t\t\t      vRightTable += '<td class=gdatehead style="FONT-SIZE: 12px; HEIGHT: 19px;" align=center colspan=7>' +\n\t\t\t      JSGantt.formatDateStr(vTmpDate,vDateDisplayFormat.substring(0,5)) + ' - ';\n               vTmpDate.setDate(vTmpDate.getDate()+6);\n\t\t         vRightTable += JSGantt.formatDateStr(vTmpDate, vDateDisplayFormat) + '</td>';\n               vTmpDate.setDate(vTmpDate.getDate()+1);\n            }\n            else if(vFormat == 'week')\n            {\n  \t\t         vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';\n               vTmpDate.setDate(vTmpDate.getDate()+7);\n            }\n            else if(vFormat == 'month')\n            {\n\t            vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';\n               vTmpDate.setDate(vTmpDate.getDate() + 1);\n               while(vTmpDate.getDate() > 1)\n               {\n                 vTmpDate.setDate(vTmpDate.getDate() + 1);\n               }\n            }\n            else if(vFormat == 'quarter')\n            {\n\t            vRightTable += '<td class=gdatehead align=center style="FONT-SIZE: 12px; HEIGHT: 19px;" width='+vColWidth+'px>`'+ vStr + '</td>';\n               vTmpDate.setDate(vTmpDate.getDate() + 81);\n               while(vTmpDate.getDate() > 1)\n               {\n                 vTmpDate.setDate(vTmpDate.getDate() + 1);\n               }\n            }\n\n         }\n\n         vRightTable += '</TR><TR>';\n\n         // Minor Date header and Cell Rows\n         vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());\n         vNxtDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());\n         vNumCols = 0;\n \n         while(Date.parse(vTmpDate) <= Date.parse(vMaxDate))\n         {\t\n            if (vFormat == 'minute')\n            {\n\t\t\t\n\t\t\t  if( vTmpDate.getMinutes() ==0 ) \n                  vWeekdayColor = "ccccff";\n               else\n                  vWeekdayColor = "ffffff";\n\t\t\t\t  \n\t\t\t\t  \n                vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getMinutes() + '</div></td>';\n                vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                vTmpDate.setMinutes(vTmpDate.getMinutes() + 1);\n            }\n          \n            else if (vFormat == 'hour')\n            {\n\t\t\t\n\t\t\t   if(  vTmpDate.getHours() ==0  ) \n                  vWeekdayColor = "ccccff";\n               else\n                  vWeekdayColor = "ffffff";\n\t\t\t\t  \n\t\t\t\t  \n                vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getHours() + '</div></td>';\n                vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; cursor: default;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                vTmpDate.setHours(vTmpDate.getHours() + 1);\n            }\n\n\t        else if(vFormat == 'day' )\n             {\n               if( JSGantt.formatDateStr(vCurrDate,'mm/dd/yyyy') == JSGantt.formatDateStr(vTmpDate,'mm/dd/yyyy')) {\n                  vWeekdayColor  = "ccccff";\n                  vWeekendColor  = "9999ff";\n                  vWeekdayGColor  = "bbbbff";\n                  vWeekendGColor = "8888ff";\n               } else {\n                  vWeekdayColor = "ffffff";\n                  vWeekendColor = "cfcfcf";\n                  vWeekdayGColor = "f3f3f3";\n                  vWeekendGColor = "c3c3c3";\n               }\n               \n               if(vTmpDate.getDay() % 6 == 0) {\n                  vDateRowStr  += '<td class="gheadwkend" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekendColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getDate() + '</div></td>';\n                  vItemRowStr  += '<td class="gheadwkend" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;"  bgcolor=#' + vWeekendColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp</div></td>';\n               }\n               else {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">' + vTmpDate.getDate() + '</div></td>';\n                  if( JSGantt.formatDateStr(vCurrDate,'mm/dd/yyyy') == JSGantt.formatDateStr(vTmpDate,'mm/dd/yyyy')) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid; cursor: default;"  bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; cursor: default;"  align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n               }\n\n               vTmpDate.setDate(vTmpDate.getDate() + 1);\n\n            }\n\n\t         else if(vFormat == 'week')\n            {\n\n               vNxtDate.setDate(vNxtDate.getDate() + 7);\n\n               if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                  vWeekdayColor = "ccccff";\n               else\n                  vWeekdayColor = "ffffff";\n\n               if(vNxtDate <= vMaxDate) {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + (vTmpDate.getMonth()+1) + '/' + vTmpDate.getDate() + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" align=center><div style="width:'+ vColWidth +'px">&nbsp&nbsp</div></td>';\n\n               } else {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; bgcolor=#' + vWeekdayColor + ' BORDER-RIGHT: #efefef 1px solid;" align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + (vTmpDate.getMonth()+1) + '/' + vTmpDate.getDate() + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n\n               }\n\n               vTmpDate.setDate(vTmpDate.getDate() + 7);\n\n            }\n\n\t         else if(vFormat == 'month')\n            {\n\n               vNxtDate.setFullYear(vTmpDate.getFullYear(), vTmpDate.getMonth(), vMonthDaysArr[vTmpDate.getMonth()]);\n               if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                  vWeekdayColor = "ccccff";\n               else\n                  vWeekdayColor = "ffffff";\n\n               if(vNxtDate <= vMaxDate) {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + vMonthArr[vTmpDate.getMonth()].substr(0,3) + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n               } else {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">' + vMonthArr[vTmpDate.getMonth()].substr(0,3) + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n               }\n\n               vTmpDate.setDate(vTmpDate.getDate() + 1);\n\n               while(vTmpDate.getDate() > 1) \n               {\n                  vTmpDate.setDate(vTmpDate.getDate() + 1);\n               }\n\n            }\n\n\t         else if(vFormat == 'quarter')\n            {\n\n               vNxtDate.setDate(vNxtDate.getDate() + 122);\n               if( vTmpDate.getMonth()==0 || vTmpDate.getMonth()==1 || vTmpDate.getMonth()==2 )\n                  vNxtDate.setFullYear(vTmpDate.getFullYear(), 2, 31);\n               else if( vTmpDate.getMonth()==3 || vTmpDate.getMonth()==4 || vTmpDate.getMonth()==5 )\n                  vNxtDate.setFullYear(vTmpDate.getFullYear(), 5, 30);\n               else if( vTmpDate.getMonth()==6 || vTmpDate.getMonth()==7 || vTmpDate.getMonth()==8 )\n                  vNxtDate.setFullYear(vTmpDate.getFullYear(), 8, 30);\n               else if( vTmpDate.getMonth()==9 || vTmpDate.getMonth()==10 || vTmpDate.getMonth()==11 )\n                  vNxtDate.setFullYear(vTmpDate.getFullYear(), 11, 31);\n\n               if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                  vWeekdayColor = "ccccff";\n               else\n                  vWeekdayColor = "ffffff";\n\n               if(vNxtDate <= vMaxDate) {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">Qtr. ' + vQuarterArr[vTmpDate.getMonth()] + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else\n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px;HEIGHT: 20px; BORDER-LEFT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n               } else {\n                  vDateRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 19px; BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center width:'+vColWidth+'px><div style="width: '+vColWidth+'px">Qtr. ' + vQuarterArr[vTmpDate.getMonth()] + '</div></td>';\n                  if( vCurrDate >= vTmpDate && vCurrDate < vNxtDate ) \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" bgcolor=#' + vWeekdayColor + ' align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n                  else \n                     vItemRowStr += '<td class="ghead" style="BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; HEIGHT: 20px;BORDER-LEFT: #efefef 1px solid; BORDER-RIGHT: #efefef 1px solid;" align=center><div style="width: '+vColWidth+'px">&nbsp&nbsp</div></td>';\n               }\n\n               vTmpDate.setDate(vTmpDate.getDate() + 81);\n\n               while(vTmpDate.getDate() > 1) \n               {\n                  vTmpDate.setDate(vTmpDate.getDate() + 1);\n               }\n\n            }\n         }\n\n         vRightTable += vDateRowStr + '</TR>';\n         vRightTable += '</TBODY></TABLE>';\n\n         // Draw each row\n\n         for(i = 0; i < vTaskList.length; i++)\n\n         {\n\n            vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());\n            vTaskStart = vTaskList[i].getStart();\n            vTaskEnd   = vTaskList[i].getEnd();\n\n            vNumCols = 0;\n            vID = vTaskList[i].getID();\n\n           // vNumUnits = Math.ceil((vTaskList[i].getEnd() - vTaskList[i].getStart()) / (24 * 60 * 60 * 1000)) + 1;\n            vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / (24 * 60 * 60 * 1000) + 1;\n\t       if (vFormat=='hour')\n\t       {\n                vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / (  60 * 1000) + 1;\n\t       }\n\t       else if (vFormat=='minute')\n\t       {\n                vNumUnits = (vTaskList[i].getEnd() - vTaskList[i].getStart()) / (  60 * 1000) + 1;\n\t       }\n\t       \n\t         if(vTaskList[i].getVisible() == 0) \n               vRightTable += '<DIV id=childgrid_' + vID + ' style="position:relative; display:none;">';\n            else\n\t\t         vRightTable += '<DIV id=childgrid_' + vID + ' style="position:relative">';\n            \n            if( vTaskList[i].getMile()) {\n\n               vRightTable += '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +\n                  '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" onMouseover=g.mouseOver(this,' + vID + ',"right","mile") onMouseout=g.mouseOut(this,' + vID + ',"right","mile")>' + vItemRowStr + '</TR></TABLE></DIV>';\n\n               // Build date string for Title\n               vDateRowStr = JSGantt.formatDateStr(vTaskStart,vDateDisplayFormat);\n\n               vTaskLeft = (Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / (24 * 60 * 60 * 1000);\n               vTaskRight = 1\n\n  \t            vRightTable +=\n                  '<div id=bardiv_' + vID + ' style="position:absolute; top:0px; left:' + Math.ceil((vTaskLeft * (vDayWidth) + 1)) + 'px; height: 18px; width:160px; overflow:hidden;">' +\n                  '  <div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" style="height: 16px; width:12px; overflow:hidden; cursor: pointer;" onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200);>';\n\n               if(vTaskList[i].getCompVal() < 100)\n \t\t            vRightTable += '&loz;</div>' ;\n               else\n \t\t            vRightTable += '&diams;</div>' ;\n\n                        if( g.getCaptionType() ) {\n                           vCaptionStr = '';\n                           switch( g.getCaptionType() ) {           \n                              case 'Caption':    vCaptionStr = vTaskList[i].getCaption();  break;\n                              case 'Resource':   vCaptionStr = vTaskList[i].getResource();  break;\n                              case 'Duration':   vCaptionStr = vTaskList[i].getDuration(vFormat);  break;\n                              case 'Complete':   vCaptionStr = vTaskList[i].getCompStr();  break;\n\t\t                     }\n                           //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:1px;">' + vCaptionStr + '</div>';\n                           vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:2px; width:120px; left:12px">' + vCaptionStr + '</div>';\n\t                  }\n\n  \t            vRightTable += '</div>';\n\n\n            } else {\n\n               // Build date string for Title\n               vDateRowStr = JSGantt.formatDateStr(vTaskStart,vDateDisplayFormat) + ' - ' + JSGantt.formatDateStr(vTaskEnd,vDateDisplayFormat)\n\n                if (vFormat=='minute')\n                {\n                    vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / ( 60 * 1000) + 1/vColUnit;\n                    vTaskLeft = Math.ceil((Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / ( 60 * 1000));\n                }\n                else if (vFormat=='hour')\n                {\n                    vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / ( 60 * 60 * 1000) + 1/vColUnit;\n                    vTaskLeft = (Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / ( 60 * 60 * 1000);\n                }\n                else\n                {\n                    vTaskRight = (Date.parse(vTaskList[i].getEnd()) - Date.parse(vTaskList[i].getStart())) / (24 * 60 * 60 * 1000) + 1/vColUnit;\n                    vTaskLeft = Math.ceil((Date.parse(vTaskList[i].getStart()) - Date.parse(vMinDate)) / (24 * 60 * 60 * 1000));\n                    if (vFormat='day')\n                    {\n                        var tTime=new Date();\n                        tTime.setTime(Date.parse(vTaskList[i].getStart()));\n                        if (tTime.getMinutes() > 29)\n                            vTaskLeft+=.5\n                    }\n                }\n\n               // Draw Group Bar  which has outer div with inner group div and several small divs to left and right to create angled-end indicators\n               if( vTaskList[i].getGroup()) {\n                  vRightTable += '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +\n                     '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" bgColor=#f3f3f3 onMouseover=g.mouseOver(this,' + vID + ',"right","group") onMouseout=g.mouseOut(this,' + vID + ',"right","group")>' + vItemRowStr + '</TR></TABLE></DIV>';\n                  vRightTable +=\n                     '<div id=bardiv_' + vID + ' style="position:absolute; top:5px; left:' + Math.ceil(vTaskLeft * (vDayWidth) + 1) + 'px; height: 7px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px">' +\n                       '<div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" class=gtask style="background-color:#000000; height: 7px; width:' + Math.ceil((vTaskRight) * (vDayWidth) -1) + 'px;  cursor: pointer;opacity:0.9;">' +\n                         '<div style="Z-INDEX: -4; float:left; background-color:#666666; height:3px; overflow: hidden; margin-top:1px; ' +\n                               'margin-left:1px; margin-right:1px; filter: alpha(opacity=80); opacity:0.8; width:' + vTaskList[i].getCompStr() + '; ' + \n                               'cursor: pointer;" onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200);>' +\n                           '</div>' +\n                        '</div>' +\n                        '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:4px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:4px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:3px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:3px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:2px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:2px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:left; background-color:#000000; height:1px; overflow: hidden; width:1px;"></div>' +\n                        '<div style="Z-INDEX: -4; float:right; background-color:#000000; height:1px; overflow: hidden; width:1px;"></div>' ;\n\n                        if( g.getCaptionType() ) {\n                           vCaptionStr = '';\n                           switch( g.getCaptionType() ) {           \n                              case 'Caption':    vCaptionStr = vTaskList[i].getCaption();  break;\n                              case 'Resource':   vCaptionStr = vTaskList[i].getResource();  break;\n                              case 'Duration':   vCaptionStr = vTaskList[i].getDuration(vFormat);  break;\n                              case 'Complete':   vCaptionStr = vTaskList[i].getCompStr();  break;\n\t\t                     }\n                           //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:1px;">' + vCaptionStr + '</div>';\n                           vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:-3px; width:120px; left:' + (Math.ceil((vTaskRight) * (vDayWidth) - 1) + 6) + 'px">' + vCaptionStr + '</div>';\n\t                  }\n\n                  vRightTable += '</div>' ;\n\n               } else {\n\n                  vDivStr = '<DIV><TABLE style="position:relative; top:0px; width: ' + vChartWidth + 'px;" cellSpacing=0 cellPadding=0 border=0>' +\n                     '<TR id=childrow_' + vID + ' class=yesdisplay style="HEIGHT: 20px" bgColor=#ffffff onMouseover=g.mouseOver(this,' + vID + ',"right","row") onMouseout=g.mouseOut(this,' + vID + ',"right","row")>' + vItemRowStr + '</TR></TABLE></DIV>';\n                  vRightTable += vDivStr;\n                  \n                  // Draw Task Bar  which has outer DIV with enclosed colored bar div, and opaque completion div\n\t            vRightTable +=\n                     '<div id=bardiv_' + vID + ' style="position:absolute; top:4px; left:' + Math.ceil(vTaskLeft * (vDayWidth) + 1) + 'px; height:18px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px">' +\n                        '<div id=taskbar_' + vID + ' title="' + vTaskList[i].getName() + ': ' + vDateRowStr + '" class=gtask style="background-color:#' + vTaskList[i].getColor() +'; height: 13px; width:' + Math.ceil((vTaskRight) * (vDayWidth) - 1) + 'px; cursor: pointer;opacity:0.9;" ' +\n                           'onclick=JSGantt.taskLink("' + vTaskList[i].getLink() + '",300,200); >' +\n                           '<div class=gcomplete style="Z-INDEX: -4; float:left; background-color:black; height:5px; overflow: auto; margin-top:4px; filter: alpha(opacity=40); opacity:0.4; width:' + vTaskList[i].getCompStr() + '; overflow:hidden">' +\n                           '</div>' +\n                        '</div>';\n\n                        if( g.getCaptionType() ) {\n                           vCaptionStr = '';\n                           switch( g.getCaptionType() ) {           \n                              case 'Caption':    vCaptionStr = vTaskList[i].getCaption();  break;\n                              case 'Resource':   vCaptionStr = vTaskList[i].getResource();  break;\n                              case 'Duration':   vCaptionStr = vTaskList[i].getDuration(vFormat);  break;\n                              case 'Complete':   vCaptionStr = vTaskList[i].getCompStr();  break;\n\t\t                     }\n                           //vRightTable += '<div style="FONT-SIZE:12px; position:absolute; left: 6px; top:-3px;">' + vCaptionStr + '</div>';\n                           vRightTable += '<div style="FONT-SIZE:12px; position:absolute; top:-3px; width:120px; left:' + (Math.ceil((vTaskRight) * (vDayWidth) - 1) + 6) + 'px">' + vCaptionStr + '</div>';\n\t                  }\n                  vRightTable += '</div>' ;\n\n                  \n\n               }\n            }\n\n            vRightTable += '</DIV>';\n\n         }\n\n         vMainTable += vRightTable + '</DIV></TD></TR></TBODY></TABLE></BODY></HTML>';\n\n\t\t   vDiv.innerHTML = vMainTable;\n\n      }\n\n   } //this.draw\n\n   this.mouseOver = function( pObj, pID, pPos, pType ) {\n      if( pPos == 'right' )  vID = 'child_' + pID;\n      else vID = 'childrow_' + pID;\n      \n      pObj.bgColor = "#ffffaa";\n      vRowObj = JSGantt.findObj(vID);\n      if (vRowObj) vRowObj.bgColor = "#ffffaa";\n   }\n\n   this.mouseOut = function( pObj, pID, pPos, pType ) {\n      if( pPos == 'right' )  vID = 'child_' + pID;\n      else vID = 'childrow_' + pID;\n      \n      pObj.bgColor = "#ffffff";\n      vRowObj = JSGantt.findObj(vID);\n      if (vRowObj) {\n         if( pType == "group") {\n            pObj.bgColor = "#f3f3f3";\n            vRowObj.bgColor = "#f3f3f3";\n         } else {\n            pObj.bgColor = "#ffffff";\n            vRowObj.bgColor = "#ffffff";\n         }\n      }\n   }\n\n} //GanttChart\t\t\n\n// Recursively process task tree ... set min, max dates of parent tasks and identfy task level.\nJSGantt.processRows = function(pList, pID, pRow, pLevel, pOpen)\n{\n\n   var vMinDate = new Date();\n   var vMaxDate = new Date();\n   var vMinSet  = 0;\n   var vMaxSet  = 0;\n   var vList    = pList;\n   var vLevel   = pLevel;\n   var i        = 0;\n   var vNumKid  = 0;\n   var vCompSum = 0;\n   var vVisible = pOpen;\n   \n   for(i = 0; i < pList.length; i++)\n   {\n      if(pList[i].getParent() == pID) {\n\t\t vVisible = pOpen;\n         pList[i].setVisible(vVisible);\n         if(vVisible==1 && pList[i].getOpen() == 0) \n            vVisible = 0;\n            \n         pList[i].setLevel(vLevel);\n         vNumKid++;\n\n         if(pList[i].getGroup() == 1) {\n            JSGantt.processRows(vList, pList[i].getID(), i, vLevel+1, vVisible);\n         }\n\n         if( vMinSet==0 || pList[i].getStart() < vMinDate) {\n            vMinDate = pList[i].getStart();\n            vMinSet = 1;\n         }\n\n         if( vMaxSet==0 || pList[i].getEnd() > vMaxDate) {\n            vMaxDate = pList[i].getEnd();\n            vMaxSet = 1;\n         }\n\n         vCompSum += pList[i].getCompVal();\n\n      }\n   }\n\n   if(pRow >= 0) {\n      pList[pRow].setStart(vMinDate);\n      pList[pRow].setEnd(vMaxDate);\n      pList[pRow].setNumKid(vNumKid);\n      pList[pRow].setCompVal(Math.ceil(vCompSum/vNumKid));\n   }\n\n}\n\n\n// Used to determine the minimum date of all tasks and set lower bound based on format\nJSGantt.getMinDate = function getMinDate(pList, pFormat)  \n      {\n\n         var vDate = new Date();\n\n         vDate.setFullYear(pList[0].getStart().getFullYear(), pList[0].getStart().getMonth(), pList[0].getStart().getDate());\n\n         // Parse all Task End dates to find min\n         for(i = 0; i < pList.length; i++)\n         {\n            if(Date.parse(pList[i].getStart()) < Date.parse(vDate))\n               vDate.setFullYear(pList[i].getStart().getFullYear(), pList[i].getStart().getMonth(), pList[i].getStart().getDate());\n         }\n\n         if ( pFormat== 'minute')\n         {\n            vDate.setHours(0);\n            vDate.setMinutes(0);\n         }\n\t\t else if (pFormat == 'hour' )\n         {\n            vDate.setHours(0);\n            vDate.setMinutes(0);\n         }\n         // Adjust min date to specific format boundaries (first of week or first of month)\n         else if (pFormat=='day')\n         {\n            vDate.setDate(vDate.getDate() - 1);\n            while(vDate.getDay() % 7 > 0)\n            {\n                vDate.setDate(vDate.getDate() - 1);\n            }\n\n         }\n\n         else if (pFormat=='week')\n         {\n            vDate.setDate(vDate.getDate() - 7);\n            while(vDate.getDay() % 7 > 0)\n            {\n                vDate.setDate(vDate.getDate() - 1);\n            }\n\n         }\n\n         else if (pFormat=='month')\n         {\n            while(vDate.getDate() > 1)\n            {\n                vDate.setDate(vDate.getDate() - 1);\n            }\n         }\n\n         else if (pFormat=='quarter')\n         {\n            if( vDate.getMonth()==0 || vDate.getMonth()==1 || vDate.getMonth()==2 )\n               vDate.setFullYear(vDate.getFullYear(), 0, 1);\n            else if( vDate.getMonth()==3 || vDate.getMonth()==4 || vDate.getMonth()==5 )\n               vDate.setFullYear(vDate.getFullYear(), 3, 1);\n            else if( vDate.getMonth()==6 || vDate.getMonth()==7 || vDate.getMonth()==8 )\n               vDate.setFullYear(vDate.getFullYear(), 6, 1);\n            else if( vDate.getMonth()==9 || vDate.getMonth()==10 || vDate.getMonth()==11 )\n               vDate.setFullYear(vDate.getFullYear(), 9, 1);\n\n         }\n\n         return(vDate);\n\n      }\n\n\n\n\n\n\n\n      // Used to determine the minimum date of all tasks and set lower bound based on format\n\nJSGantt.getMaxDate = function (pList, pFormat)\n{\n   var vDate = new Date();\n\n         vDate.setFullYear(pList[0].getEnd().getFullYear(), pList[0].getEnd().getMonth(), pList[0].getEnd().getDate());\n         \n         \n                // Parse all Task End dates to find max\n         for(i = 0; i < pList.length; i++)\n         {\n            if(Date.parse(pList[i].getEnd()) > Date.parse(vDate))\n            {\n                 //vDate.setFullYear(pList[0].getEnd().getFullYear(), pList[0].getEnd().getMonth(), pList[0].getEnd().getDate());\n                 vDate.setTime(Date.parse(pList[i].getEnd()));\n\t\t\t}\t\n\t     }\n\t     \n\t     if (pFormat == 'minute')\n         {\n            vDate.setHours(vDate.getHours() + 1);\n            vDate.setMinutes(59);\n         }\t\n\t     \n         if (pFormat == 'hour')\n         {\n            vDate.setHours(vDate.getHours() + 2);\n         }\t\t\t\t\n\t\t\t\t\n         // Adjust max date to specific format boundaries (end of week or end of month)\n         if (pFormat=='day')\n         {\n            vDate.setDate(vDate.getDate() + 1);\n\n            while(vDate.getDay() % 6 > 0)\n            {\n                vDate.setDate(vDate.getDate() + 1);\n            }\n\n         }\n\n         if (pFormat=='week')\n         {\n            //For weeks, what is the last logical boundary?\n            vDate.setDate(vDate.getDate() + 11);\n\n            while(vDate.getDay() % 6 > 0)\n            {\n                vDate.setDate(vDate.getDate() + 1);\n            }\n\n         }\n\n         // Set to last day of current Month\n         if (pFormat=='month')\n         {\n            while(vDate.getDay() > 1)\n            {\n                vDate.setDate(vDate.getDate() + 1);\n            }\n\n            vDate.setDate(vDate.getDate() - 1);\n         }\n\n         // Set to last day of current Quarter\n         if (pFormat=='quarter')\n         {\n            if( vDate.getMonth()==0 || vDate.getMonth()==1 || vDate.getMonth()==2 )\n               vDate.setFullYear(vDate.getFullYear(), 2, 31);\n            else if( vDate.getMonth()==3 || vDate.getMonth()==4 || vDate.getMonth()==5 )\n               vDate.setFullYear(vDate.getFullYear(), 5, 30);\n            else if( vDate.getMonth()==6 || vDate.getMonth()==7 || vDate.getMonth()==8 )\n               vDate.setFullYear(vDate.getFullYear(), 8, 30);\n            else if( vDate.getMonth()==9 || vDate.getMonth()==10 || vDate.getMonth()==11 )\n               vDate.setFullYear(vDate.getFullYear(), 11, 31);\n\n         }\n\n         return(vDate);\n\n      }\n\n\n\n\n\n\n\n      // This function finds the document id of the specified object\n\nJSGantt.findObj = function (theObj, theDoc)\n\n      {\n\n         var p, i, foundObj;\n\n         if(!theDoc) theDoc = document;\n\n         if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){\n\n            theDoc = parent.frames[theObj.substring(p+1)].document;\n\n            theObj = theObj.substring(0,p);\n\n         }\n\n         if(!(foundObj = theDoc[theObj]) && theDoc.all) \n\n            foundObj = theDoc.all[theObj];\n\n\n\n         for (i=0; !foundObj && i < theDoc.forms.length; i++) \n\n            foundObj = theDoc.forms[i][theObj];\n\n\n\n         for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)\n\n            foundObj = JSGantt.findObj(theObj,theDoc.layers[i].document);\n\n\n\n         if(!foundObj && document.getElementById)\n\n            foundObj = document.getElementById(theObj);\n\n\n\n         return foundObj;\n\n      }\n\n\n\n\n\nJSGantt.changeFormat =      function(pFormat,ganttObj) {\n\n\n\n        if(ganttObj) \n\n\t\t{\n\n\t\tganttObj.setFormat(pFormat);\n\n\t\tganttObj.DrawDependencies();\n\n\t\t}\n\n        else\n\n           alert('Chart undefined');\n\n\n\n      }\n\n\n\n\n\n      // Function to open/close and hide/show children of specified task\n\nJSGantt.folder= function (pID,ganttObj) {\n\n   var vList = ganttObj.getList();\n\n   for(i = 0; i < vList.length; i++)\n   {\n      if(vList[i].getID() == pID) {\n\n         if( vList[i].getOpen() == 1 ) {\n            vList[i].setOpen(0);\n            JSGantt.hide(pID,ganttObj);\n\n            if (JSGantt.isIE()) \n               JSGantt.findObj('group_'+pID).innerText = '+';\n            else\n               JSGantt.findObj('group_'+pID).textContent = '+';\n\t\t\t\t\n         } else {\n\n            vList[i].setOpen(1);\n\n            JSGantt.show(pID, 1, ganttObj);\n\n               if (JSGantt.isIE()) \n                  JSGantt.findObj('group_'+pID).innerText = 'ñ';\n               else\n                  JSGantt.findObj('group_'+pID).textContent = 'ñ';\n\n         }\n\n      }\n   }\n}\n\nJSGantt.hide=     function (pID,ganttObj) {\n   var vList = ganttObj.getList();\n   var vID   = 0;\n\n   for(var i = 0; i < vList.length; i++)\n   {\n      if(vList[i].getParent() == pID) {\n         vID = vList[i].getID();\n         JSGantt.findObj('child_' + vID).style.display = "none";\n         JSGantt.findObj('childgrid_' + vID).style.display = "none";\n         vList[i].setVisible(0);\n         if(vList[i].getGroup() == 1) \n            JSGantt.hide(vID,ganttObj);\n      }\n\n   }\n}\n\n// Function to show children of specified task\nJSGantt.show =  function (pID, pTop, ganttObj) {\n   var vList = ganttObj.getList();\n   var vID   = 0;\n\n   for(var i = 0; i < vList.length; i++)\n   {\n      if(vList[i].getParent() == pID) {\n         vID = vList[i].getID();\n         if(pTop == 1) {\n            if (JSGantt.isIE()) { // IE;\n\n               if( JSGantt.findObj('group_'+pID).innerText == '+') {\n                  JSGantt.findObj('child_'+vID).style.display = "";\n                  JSGantt.findObj('childgrid_'+vID).style.display = "";\n                  vList[i].setVisible(1);\n               }\n\n            } else {\n \n               if( JSGantt.findObj('group_'+pID).textContent == '+') {\n                  JSGantt.findObj('child_'+vID).style.display = "";\n                  JSGantt.findObj('childgrid_'+vID).style.display = "";\n                  vList[i].setVisible(1);\n               }\n\n            }\n\n         } else {\n\n            if (JSGantt.isIE()) { // IE;\n               if( JSGantt.findObj('group_'+pID).innerText == 'ñ') {\n                  JSGantt.findObj('child_'+vID).style.display = "";\n                  JSGantt.findObj('childgrid_'+vID).style.display = "";\n                  vList[i].setVisible(1);\n               }\n\n            } else {\n\n               if( JSGantt.findObj('group_'+pID).textContent == 'ñ') {\n                  JSGantt.findObj('child_'+vID).style.display = "";\n                  JSGantt.findObj('childgrid_'+vID).style.display = "";\n                  vList[i].setVisible(1);\n               }\n            }\n         }\n\n         if(vList[i].getGroup() == 1) \n            JSGantt.show(vID, 0,ganttObj);\n\n      }\n   }\n}\n\n\n  \n\n\n  // function to open window to display task link\n\nJSGantt.taskLink = function(pRef,pWidth,pHeight) \n\n  {\n\n    if(pWidth)  vWidth =pWidth;  else vWidth =400;\n    if(pHeight) vHeight=pHeight; else vHeight=400;\n\n    var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); \n\n  }\n\nJSGantt.parseDateStr = function(pDateStr,pFormatStr) {\n   var vDate =new Date();\t\n   vDate.setTime( Date.parse(pDateStr));\n\n   switch(pFormatStr) \n   {\n\t  case 'mm/dd/yyyy':\n\t     var vDateParts = pDateStr.split('/');\n         vDate.setFullYear(parseInt(vDateParts[2], 10), parseInt(vDateParts[0], 10) - 1, parseInt(vDateParts[1], 10));\n         break;\n\t  case 'dd/mm/yyyy':\n\t     var vDateParts = pDateStr.split('/');\n         vDate.setFullYear(parseInt(vDateParts[2], 10), parseInt(vDateParts[1], 10) - 1, parseInt(vDateParts[0], 10));\n         break;\n\t  case 'yyyy-mm-dd':\n\t     var vDateParts = pDateStr.split('-');\n         vDate.setFullYear(parseInt(vDateParts[0], 10), parseInt(vDateParts[1], 10) - 1, parseInt(vDateParts[1], 10));\n         break;\n    }\n\n    return(vDate);\n    \n}\n\nJSGantt.formatDateStr = function(pDate,pFormatStr) {\n       vYear4Str = pDate.getFullYear() + '';\n \t   vYear2Str = vYear4Str.substring(2,4);\n       vMonthStr = (pDate.getMonth()+1) + '';\n       vDayStr   = pDate.getDate() + '';\n\n      var vDateStr = "";\t\n\n      switch(pFormatStr) {\n\t        case 'mm/dd/yyyy':\n               return( vMonthStr + '/' + vDayStr + '/' + vYear4Str );\n\t        case 'dd/mm/yyyy':\n               return( vDayStr + '/' + vMonthStr + '/' + vYear4Str );\n\t        case 'yyyy-mm-dd':\n               return( vYear4Str + '-' + vMonthStr + '-' + vDayStr );\n\t        case 'mm/dd/yy':\n               return( vMonthStr + '/' + vDayStr + '/' + vYear2Str );\n\t        case 'dd/mm/yy':\n               return( vDayStr + '/' + vMonthStr + '/' + vYear2Str );\n\t        case 'yy-mm-dd':\n               return( vYear2Str + '-' + vMonthStr + '-' + vDayStr );\n\t        case 'mm/dd':\n               return( vMonthStr + '/' + vDayStr );\n\t        case 'dd/mm':\n               return( vDayStr + '/' + vMonthStr );\n      }\t\t \n\t  \n}\n\nJSGantt.parseXML = function(ThisFile,pGanttVar){\n\tvar is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;   // Is this Chrome \n\t\n\ttry { //Internet Explorer  \n\t\txmlDoc=new ActiveXObject("Microsoft.XMLDOM");\n\t\t}\n\tcatch(e) {\n\t\ttry { //Firefox, Mozilla, Opera, Chrome etc. \n\t\t\tif (is_chrome==false) {  xmlDoc=document.implementation.createDocument("","",null); }\n\t\t}\n\t\tcatch(e) {\n\t\t\talert(e.message);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (is_chrome==false) { \t// can't use xmlDoc.load in chrome at the moment\n\t\txmlDoc.async=false;\n\t\txmlDoc.load(ThisFile);\t\t// we can use  loadxml\n\t\tJSGantt.AddXMLTask(pGanttVar)\n\t\txmlDoc=null;\t\t\t// a little tidying\n\t\tTask = null;\n\t}\n\telse {\n\t\tJSGantt.ChromeLoadXML(ThisFile,pGanttVar);\t\n\t\tta=null;\t// a little tidying\t\n\t}\n}\n\nJSGantt.AddXMLTask = function(pGanttVar){\n\n\tTask=xmlDoc.getElementsByTagName("task");\n\t\n\tvar n = xmlDoc.documentElement.childNodes.length;\t// the number of tasks. IE gets this right, but mozilla add extra ones (Whitespace)\n\t\n\tfor(var i=0;i<n;i++) {\n\t\n\t\t// optional parameters may not have an entry (Whitespace from mozilla also returns an error )\n\t\t// Task ID must NOT be zero other wise it will be skipped\n\t\ttry { pID = Task[i].getElementsByTagName("pID")[0].childNodes[0].nodeValue;\n\t\t} catch (error) {pID =0;}\n\t\tpID *= 1;\t// make sure that these are numbers rather than strings in order to make jsgantt.js behave as expected.\n\n\t\tif(pID!=0){\n\t \t\ttry { pName = Task[i].getElementsByTagName("pName")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pName ="No Task Name";}\t\t\t// If there is no corresponding entry in the XML file the set a default.\n\t\t\n\t\t\ttry { pColor = Task[i].getElementsByTagName("pColor")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pColor ="0000ff";}\n\t\t\t\n\t\t\ttry { pParent = Task[i].getElementsByTagName("pParent")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pParent =0;}\n\t\t\tpParent *= 1;\n\t\n\t\t\ttry { pStart = Task[i].getElementsByTagName("pStart")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pStart ="";}\n\n\t\t\ttry { pEnd = Task[i].getElementsByTagName("pEnd")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pEnd ="";}\n\n\t\t\ttry { pLink = Task[i].getElementsByTagName("pLink")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pLink ="";}\n\t\n\t\t\ttry { pMile = Task[i].getElementsByTagName("pMile")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pMile=0;}\n\t\t\tpMile *= 1;\n\n\t\t\ttry { pRes = Task[i].getElementsByTagName("pRes")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pRes ="";}\n\n\t\t\ttry { pComp = Task[i].getElementsByTagName("pComp")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pComp =0;}\n\t\t\tpComp *= 1;\n\n\t\t\ttry { pGroup = Task[i].getElementsByTagName("pGroup")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) {pGroup =0;}\n\t\t\tpGroup *= 1;\n\n\t\t\ttry { pOpen = Task[i].getElementsByTagName("pOpen")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pOpen =1;}\n\t\t\tpOpen *= 1;\n\n\t\t\ttry { pDepend = Task[i].getElementsByTagName("pDepend")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pDepend =0;}\n\t\t\t//pDepend *= 1;\n\t\t\tif (pDepend.length==0){pDepend=''} // need this to draw the dependency lines\n\t\t\t\n\t\t\ttry { pCaption = Task[i].getElementsByTagName("pCaption")[0].childNodes[0].nodeValue;\n\t\t\t} catch (error) { pCaption ="";}\n\t\t\t\n\t\t\t\n\t\t\t// Finally add the task\n\t\t\tpGanttVar.AddTaskItem(new JSGantt.TaskItem(pID , pName, pStart, pEnd, pColor,  pLink, pMile, pRes,  pComp, pGroup, pParent, pOpen, pDepend,pCaption));\n\t\t}\n\t}\n}\n\nJSGantt.ChromeLoadXML = function(ThisFile,pGanttVar){\n// Thanks to vodobas at mindlence,com for the initial pointers here.\n\tXMLLoader = new XMLHttpRequest();\n\tXMLLoader.onreadystatechange= function(){\n    JSGantt.ChromeXMLParse(pGanttVar);\n\t};\n\tXMLLoader.open("GET", ThisFile, false);\n\tXMLLoader.send(null);\n}\n\nJSGantt.ChromeXMLParse = function (pGanttVar){\n// Manually parse the file as it is loads quicker\n\tif (XMLLoader.readyState == 4) {\n\t\tvar ta=XMLLoader.responseText.split(/<task>/gi);\n\n\t\tvar n = ta.length;\t// the number of tasks. \n\t\tfor(var i=1;i<n;i++) {\n\t\t\tTask = ta[i].replace(/<[/]p/g, '<p');\t\n\t\t\tvar te = Task.split(/<pid>/i)\n\t\n\t\t\tif(te.length> 2){var pID=te[1];} else {var pID = 0;}\n\t\t\tpID *= 1;\n\t\n\t\t\tvar te = Task.split(/<pName>/i)\n\t\t\tif(te.length> 2){var pName=te[1];} else {var pName = "No Task Name";}\n\t\n\t\t\tvar te = Task.split(/<pstart>/i)\n\t\t\tif(te.length> 2){var pStart=te[1];} else {var pStart = "";}\n\t\n\t\t\tvar te = Task.split(/<pEnd>/i)\n\t\t\tif(te.length> 2){var pEnd=te[1];} else {var pEnd = "";}\n\t\n\t\t\tvar te = Task.split(/<pColor>/i)\n\t\t\tif(te.length> 2){var pColor=te[1];} else {var pColor = '0000ff';}\n\n\t\t\tvar te = Task.split(/<pLink>/i)\n\t\t\tif(te.length> 2){var pLink=te[1];} else {var pLink = "";}\n\t\n\t\t\tvar te = Task.split(/<pMile>/i)\n\t\t\tif(te.length> 2){var pMile=te[1];} else {var pMile = 0;}\n\t\t\tpMile  *= 1;\n\t\n\t\t\tvar te = Task.split(/<pRes>/i)\n\t\t\tif(te.length> 2){var pRes=te[1];} else {var pRes = "";}\t\n\t\n\t\t\tvar te = Task.split(/<pComp>/i)\n\t\t\tif(te.length> 2){var pComp=te[1];} else {var pComp = 0;}\t\n\t\t\tpComp  *= 1;\n\t\n\t\t\tvar te = Task.split(/<pGroup>/i)\n\t\t\tif(te.length> 2){var pGroup=te[1];} else {var pGroup = 0;}\t\n\t\t\tpGroup *= 1;\n\n\t\t\tvar te = Task.split(/<pParent>/i)\n\t\t\tif(te.length> 2){var pParent=te[1];} else {var pParent = 0;}\t\n\t\t\tpParent *= 1;\n\t\n\t\t\tvar te = Task.split(/<pOpen>/i)\n\t\t\tif(te.length> 2){var pOpen=te[1];} else {var pOpen = 1;}\n\t\t\tpOpen *= 1;\n\t\n\t\t\tvar te = Task.split(/<pDepend>/i)\n\t\t\tif(te.length> 2){var pDepend=te[1];} else {var pDepend = "";}\t\n\t\t\t//pDepend *= 1;\n\t\t\tif (pDepend.length==0){pDepend=''} // need this to draw the dependency lines\n\t\t\t\n\t\t\tvar te = Task.split(/<pCaption>/i)\n\t\t\tif(te.length> 2){var pCaption=te[1];} else {var pCaption = "";}\n\t\t\t\n\t\t\t// Finally add the task\n\t\t\tpGanttVar.AddTaskItem(new JSGantt.TaskItem(pID , pName, pStart, pEnd, pColor,  pLink, pMile, pRes,  pComp, pGroup, pParent, pOpen, pDepend,pCaption \t));\n\t\t}\n\t}\n}\n\nJSGantt.benchMark = function(pItem){\n   var vEndTime=new Date().getTime();\n   alert(pItem + ': Elapsed time: '+((vEndTime-vBenchTime)/1000)+' seconds.');\n   vBenchTime=new Date().getTime();\n}\n\n\n	
114	jsGanttCSS	0	t	..gantt { font-family:tahoma, arial, verdana; font-size:10px;}\n\n..gdatehead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; HEIGHT: 18px }\n\n..ghead { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px }\n\n..gname { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; WIDTH: 18px; HEIGHT: 18px }\n\n..ghead A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none }\n\n..gheadwkend A { FONT-SIZE: 10px; COLOR: #000000; TEXT-DECORATION: none }\n\n..gheadwkend { BORDER-TOP: #efefef 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #efefef 1px solid; WIDTH: 24px; HEIGHT: 20px; background-color: #cfcfcf }\n\n..gfiller { BORDER-TOP: #efefef 1px solid; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px }\n\n..gfillerwkend { BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px; BACKGROUND-COLOR: #cfcfcf }\n\n..gitem { BORDER-TOP: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px }\n\n..gitemwkend { BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px }\n\n..gmilestone {\tBORDER-TOP: #efefef 1px solid; FONT-SIZE: 14px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 18px; HEIGHT: 18px}\n\n..gmilestonewkend {\tBORDER-TOP: #efefef 1px solid; BORDER-LEFT: #cccccc 1px solid; WIDTH: 18px; HEIGHT: 18px}\n\n..btn { BORDER-RIGHT: #ffffff; BORDER-TOP: #ffffff; FONT-WEIGHT: bold; FONT-SIZE: 10px; BORDER-LEFT: #ffffff; WIDTH: 12px; COLOR: #cccccc; BORDER-BOTTOM: #ffffff; BACKGROUND-COLOR: #ffffff }\n\n..hrcomplete { BORDER-RIGHT: #000000 2px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000000 2px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; BORDER-LEFT: #000000 2px solid; WIDTH: 20px; COLOR: #000000; PADDING-TOP: 0px; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px }\n\n..hrhalfcomplete { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 2px solid; WIDTH: 9px; COLOR: #000000; BORDER-BOTTOM: #000000 2px solid; HEIGHT: 4px }\n\n..gweekend { font-family:tahoma, arial, verdana; font-size:11px; background-color:#EEEEEE; text-align:center; }\n\n..gtask { font-family:tahoma, arial, verdana; font-size:11px; background-color:#00FF00; text-align:center; }\n\n..gday { font-family:tahoma, arial, verdana; font-size:11px; text-align:center; }\n\n..gcomplete { background-color:black; height:5px; overflow: auto; margin-top:4px; }\n\nDIV.scroll { BORDER-RIGHT: #efefef 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #efefef 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; BORDER-LEFT: #efefef 1px solid; WIDTH: 420px; PADDING-TOP: 0px; BORDER-BOTTOM: #efefef 1px solid; BACKGROUND-COLOR: #ffffff }\n\nDIV.scroll2 { position:relative; PADDING-RIGHT: 0px; overflow:auto ;overflow-x:scroll;overflow-y:hidden; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 482px; PADDING-TOP: 0px; BACKGROUND-COLOR: #ffffff }\n\n	
116	project	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.project = new Object;\n\nvar _tab = mywindow.findChild("_tab"); \nvar _tebilling = toolbox.loadUi("tebilling", mywindow);\n_tab.insertTab(2, _tebilling, qsTr("Billing"));\n_tab.setEnabled(2, privileges.check("CanViewRates"));\n\nvar _buttonBox = mywindow.findChild("_buttonBox");\nvar _gantt = _buttonBox.addButton(qsTr("Gantt..."), QDialogButtonBox.ActionRole);\n\nvar _owner = mywindow.findChild("_owner");\nvar _assignedTo = mywindow.findChild("_assignedTo");\nvar _started = mywindow.findChild("_started");\nvar _due = mywindow.findChild("_due");\nvar _assigned = mywindow.findChild("_assigned");\nvar _completed = mywindow.findChild("_completed");\nvar _prjtask = mywindow.findChild("_prjtask");\nvar _newTask = mywindow.findChild("_newTask");\nvar _editTask = mywindow.findChild("_editTask");\nvar _viewTask = mywindow.findChild("_viewTask");\nvar _number = mywindow.findChild("_number");\nvar _name = mywindow.findChild("_name");\nvar _billingGroup = mywindow.findChild("_billingGroup");\nvar _itemGroup = _tebilling.findChild("_itemGroup");\nvar _useItem = _tebilling.findChild("_useItem");\nvar _cust = _tebilling.findChild("_cust");\nvar _rate = _tebilling.findChild("_rate");\nvar _mode = 'new';\nvar _teprjid = -1; \nvar _prjid = -1;\n\n//set = function(input)\nxtte.project.populated = function(input)\n{\n  if (_number.enabled)\n    _mode = "edit";\n  else\n    _mode = "view";\n\n  if (input.mode == "view")\n  {\n    _cust.enabled = false;\n    _billingGroup.enabled = false;\n  }\n\n  sql = "SELECT prj_id FROM prj WHERE prj_number=<? value('prj_number') ?>;";\n  var params = new Object;\n  params.prj_number = _number.text;\n \n  var data = toolbox.executeQuery(sql, params);\n  if (data.first())\n  {\n    _prjid = data.value("prj_id");\n    xtte.project.populate();\n  }\n}\n\nxtte.project.save = function(prjId)\n{\n  if (prjId <= 0)\n    return;\n\n  var params = new Object();\n  params.teprj_id\t= _teprjid;\n  params.prj_id\t= prjId;\n  if (_cust.isValid())\n    params.cust_id  \t= _cust.id();\n  if (_billingGroup.checked)\n  {\n    params.rate\t= _rate.localValue;\n    params.curr_id\t= _rate.id();\n  }\n\n  var query = "updteprj";\n  if (_teprjid == -1)\n    query = "insteprj";\n\n  var q = toolbox.executeDbQuery("project", query, params);\n  xtte.errorCheck(q);\n}\n\nxtte.project.populate = function()\n{\n  var params = new Object();\n  params.prj_id = _prjid;    \n\n  var q = toolbox.executeDbQuery("project", "selteprj", params);\n\n  if (q.first())\n  {\n    _teprjid = q.value("teprj_id");\n    _cust.setId(q.value("cust_id"));\n    if (q.value("curr_id") == -1)\n      _billingGroup.checked = false;\n    else\n    {\n      _billingGroup.checked = true;\n      _rate.setId(q.value("curr_id"));\n      _rate.localValue = q.value("teprj_rate");\n    }\n    return;\n  }\n  else\n    xtte.errorCheck(q);\n}\n\nxtte.project.newTask = function()\n{\n  if (_prjid == -1)\n  {\n    if (!mywindow.sSave(true))\n      return;\n    else\n    {\n      var params = new Object;\n      params.prjNumber = _number.text;\n\n      var q = toolbox.executeDbQuery("projectGantt", "getprj", params);\n      if (q.first())\n        _prjid = q.value("prj_id");\n      else\n        return;\n    }\n  }\n\n  xtte.project.openTask("new");\n}\n\nxtte.project.editTask = function()\n{\n  xtte.project.openTask("edit");\n}\n\nxtte.project.viewTask = function()\n{\n  xtte.project.openTask("view");\n}\n\nxtte.project.openTask = function(mode)\n{\n  params = new Object;\n  params.mode = mode;\n  if (mode == "new")\n  {\n  params.prj_id = _prjid;\n  params.prj_owner_username = _owner.username();\n  params.prj_username = _assignedTo.username();\n  params.prj_start_date = _started.date;\n  params.prj_due_date = _due.date;\n  params.prj_assigned_date = _assigned.date;\n  params.prj_completed_date = _completed.date;\n  }\n  else\n    params.prjtask_id = _prjtask.id();\n  if (_cust.isValid())\n    params.cust_id = _cust.id();\n\n  var win = toolbox.openWindow("task", mywindow, Qt.ApplicationModal);\n  toolbox.lastWindow().set(params);\n  var result = win.exec();\n  if(result != 0)\n    mywindow.populate();\n}\n\nxtte.project.gantt = function()\n{\n  if (!_due.isValid())\n  {\n    var msg = qsTr("You must enter a valid Due Date");\n    QMessageBox.critical(mywindow, qsTr("Invalid Date"), msg);\n    return;\n  }\n\n  var dparams = new Object;\n  dparams.startDate = _started.date;\n  dparams.dueDate = _due.date;\n\n  var qry = toolbox.executeDbQuery("project","formatdates",dparams);\n  if (qry.first())\n  {\n    var params = new Object;\n    params.prjNumber = _number.text;\n    params.prjName = _name.text;\n    params.startDate = qry.value("start_date");\n    params.dueDate = qry.value("due_date");\n\n    toolbox.openWindow("projectGantt", mywindow, Qt.ApplicationModal);\n    toolbox.lastWindow().set(params);\n  }\n}\n\n// Initialize\n_itemGroup.hide();\n_useItem.hide();\n\n// Connections\ntoolbox.coreDisconnect(_newTask, "clicked()", mywindow, "sNewTask()");\ntoolbox.coreDisconnect(_editTask, "clicked()", mywindow, "sEditTask()");\ntoolbox.coreDisconnect(_viewTask, "clicked()", mywindow, "sViewTask()");\n\nmywindow.populated.connect(xtte.project.populated);\n_newTask.clicked.connect(xtte.project.newTask);\n_editTask.clicked.connect(xtte.project.editTask);\n_viewTask.clicked.connect(xtte.project.viewTask);\n_gantt.clicked.connect(xtte.project.gantt);\nmydialog["finished(int)"].connect(xtte.project.save);\n\n	
115	projectGantt	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.projectGantt = new Object;\n\nvar _webView = new QWebView(mywindow);\nvar _toolBar = mywindow.findChild("_toolBar");\nvar _layout = toolbox.widgetGetLayout(_toolBar);\nvar _prjid;\nvar _prjNumber;\nvar _prjName;\nvar _startDate;\nvar _dueDate;\nvar _jsCode;\nvar _cssCode;\nvar _jsPath;\nvar _cssPath;\nvar _qry;\nvar _page;\nvar _gantt;\n\nset = function (input) \n{ \n  if ("startDate" in input)\n    _startDate = input.startDate;\n\n  if ("dueDate" in input)\n    _dueDate = input.dueDate;\n\n  if ("prjName" in input)\n    _prjName = input.prjName;\n\n  if ("prjNumber" in input)\n  {\n    _prjNumber = input.prjNumber;\n    qry = toolbox.executeDbQuery("projectGantt","getprj",input);\n    if (qry.first())\n      _prjid = qry.value("prj_id");\n\n    xtte.projectGantt.populate();\n  }\n}\n\nxtte.projectGantt.populate = function()\n{\n\n    _page = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';\n    _page = _page + '<html><head>';\n    _page = _page + '<link rel="stylesheet" type="text/css" href="file:///' + _cssPath + '"/>';\n    _page = _page + '<script language="javascript" src="file:///' + _jsPath + '"></script>';\n    _page = _page + '</head><body bgcolor="#F0F0F0"><div class="gantt" id="GanttChartDIV"></div></body></html>';\n\n    _gantt = "<script>";\n    _gantt = _gantt + "var g = new JSGantt.GanttChart('g', document.getElementById('GanttChartDIV'), 'day');";\n    _gantt = _gantt + "g.setShowRes(0);";\n    _gantt = _gantt + "g.setShowDur(0);";\n    _gantt = _gantt + "g.setShowComp(0);";\n    _gantt = _gantt + "g.setDateInputFormat('dd/mm/yyyy');";\n    _gantt = _gantt + "g.setCaptionType('Resource');";\n    _gantt = _gantt + "if (g) {";\n    _gantt = _gantt + "g.AddTaskItem(new JSGantt.TaskItem(" + _prjid + ", \\"" + _prjName + "\\", '" + _startDate + "', '" + _dueDate + "', '000000', '', 0, '', 0, 1, 0, 1));";\n\n    var j = 0;\n    \n    params = new Object;\n    params.prj_id = _prjid;\n    qryTask = toolbox.executeDbQuery("projectGantt","tasks",params);\n    while(qryTask.next()) \n    {\n      j = j + 1;\n      var barColor = "000000";\n      if (j == 1) barColor = "4F81BD";\n      if (j == 2) barColor = "C0504D";\n      if (j == 3) barColor = "9BBB59";\n      if (j == 4) barColor = "8064A2";\n      if (j == 5) barColor = "4BACC6";\n      if (j == 6) { barColor = "F79646"; j = 0;}\n\n      _gantt = _gantt + "g.AddTaskItem(new JSGantt.TaskItem(" + _prjid + qryTask.value("prjtask_id") + ", '" + qryTask.value("prjtask_name") + "', '" + qryTask.value("start_date") + "', '" + qryTask.value("due_date") + "', '" + barColor + "', '', 0, '', 0, 0, " + _prjid + ", 1));";\n    }\n\n    _gantt = _gantt + "g.Draw();";\n    _gantt = _gantt + "g.DrawDependencies();";\n    _gantt = _gantt + "}";\n    _gantt = _gantt + "else {";\n    _gantt = _gantt + ' alert("not defined");';\n    _gantt = _gantt + "  }";\n    _gantt = _gantt + "</script>";\n     \n    var html = _page + _gantt;\n    _webView.setHtml(html);\n    // This snippet should make the link open in a new browser, but nothing happens. Why?\n    //_webView.page().linkDelegationPolicy = QWebPage.DelegateAllLinks;\n}\n\n// Initialize\nmywindow.findChild("_close").triggered.connect(mywindow, "close");\n\n_layout.addWidget(_webView, 1, 0);\n\n// Create jsGantt files on local OS if they don't already exist\nvar tmpdir = QDir.tempPath();\n_jsPath = tmpdir + "/jsgantt.js";\n_cssPath = tmpdir + "/jscantt.css";\n\nif (!QFile.exists(_jsPath))\n{\n  // Create jsGantt script\n  qry = toolbox.executeDbQuery("projectGantt","jsgantt");\n  if (qry.first());\n    _jsCode = qry.value("script_source");\n\n  toolbox.textStreamWrite(_jsPath, _jsCode);\n\n  // Create jsGantt style sheet\n  qry = toolbox.executeDbQuery("projectGantt","jsganttcss");\n  if (qry.first());\n    _cssCode = qry.value("script_source");\n\n  toolbox.textStreamWrite(_cssPath, _cssCode);\n}\n	
119	timeExpenseSheet	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ndebugger;\nvar _debug = false;\ninclude("xtte");\n\ntry\n{\n  if (_debug)\n    print("xtte.timeExpenseSheet script entered");\n\n  // Define Variables\n  xtte.timeExpenseSheet = new Object;\n\n  var _all                = mywindow.findChild("_all");\n  var _buttonBox          = mywindow.findChild("_buttonBox");\n  var _edit               = mywindow.findChild("_edit");\n  var _new                = mywindow.findChild("_new");\n  var _delete             = mywindow.findChild("_delete");\n  var _view               = mywindow.findChild("_view");\n  var _print              = mywindow.findChild("_print");\n  var _printSheet         = mywindow.findChild("_printSheet");\n  var _lines              = mywindow.findChild("_lines");\n  var _selected           = mywindow.findChild("_selected");\n  var _weekending         = mywindow.findChild("_weekending");\n  var _employee           = mywindow.findChild("_employee");\n  var _sheetNumberExtra   = mywindow.findChild("_sheetNumberExtra");\n  var _site               = mywindow.findChild("_site");\n  var _orderComments      = mywindow.findChild("_orderComments");\n  var _documents          = mywindow.findChild("_documents");\n\n  var _sheet;\n  var _id = -1;\n  var _type;\n  var _admin;\n\n  _lines.addColumn(qsTr("Type"),\t\tXTreeWidget.docTypeColumn,Qt.AlignLeft,    false,  "teitem_type");\n\n  //add logic to determine the next Sunday date and populate both start and end with it\n  _lines.addColumn(qsTr("Line #"),        XTreeWidget.seqColumn,    Qt.AlignLeft,    true,   "teitem_linenumber");\n  _lines.addColumn(qsTr("Sheet Date"),    XTreeWidget.dateColumn,   Qt.AlignLeft,    false,  "tehead_weekending");\n  _lines.addColumn(qsTr("Work Date"),     XTreeWidget.dateColumn,   Qt.AlignLeft,    true,   "teitem_workdate");\n  _lines.addColumn(qsTr("Project#"),      XTreeWidget.orderColumn,  Qt.AlignLeft,    true,   "prj_number");\n  _lines.addColumn(qsTr("Project Name"),  -1,                       Qt.AlignLeft,    false,  "prj_name");\n  _lines.addColumn(qsTr("Task#"),         XTreeWidget.orderColumn,  Qt.AlignLeft,    true,   "prjtask_number");\n  _lines.addColumn(qsTr("Task Name"),     -1,                       Qt.AlignLeft,    false,  "prjtask_name");\n  _lines.addColumn(qsTr("Cust.#"),        XTreeWidget.orderColumn,  Qt.AlignLeft,    false,  "cust_number");\n  _lines.addColumn(qsTr("Cust. Name"),    -1,                       Qt.AlignLeft,    false,  "cust_name");\n  _lines.addColumn(qsTr("PO"),            XTreeWidget.orderColumn,  Qt.AlignLeft,    false,  "teitem_po");\n  _lines.addColumn(qsTr("Item"),          XTreeWidget.itemColumn,   Qt.AlignLeft,    true,   "item_number");\n  _lines.addColumn(qsTr("Description"),   -1,                       Qt.AlignLeft,    true,   "item_descrip1");\n  _lines.addColumn(qsTr("Hours"),         XTreeWidget.qtyColumn,    Qt.AlignRight,   true,   "hours");\n  _lines.addColumn(qsTr("Expense"),       XTreeWidget.qtyColumn,    Qt.AlignRight,   true,   "expense");\n  _lines.addColumn(qsTr("Notes"),         -1,    Qt.AlignLeft,    false,  "f_notes");\n\n\n  if (privileges.check("CanViewRates"))\n  {\n    _lines.addColumn(qsTr("Billable"),    XTreeWidget.ynColumn,     Qt.AlignLeft,    true,   "teitem_billable");\n    _lines.addColumn(qsTr("Rate"),        XTreeWidget.priceColumn,  Qt.AlignRight,   false,  "teitem_rate");\n    _lines.addColumn(qsTr("Extended"),    XTreeWidget.moneyColumn,  Qt.AlignRight,   false,  "teitem_total");\n  }\n\n}\n\ncatch (e)\n{\n  QMessageBox.critical(mywindow, "timeExpenseSheet",\n                       qsTr("timeExpenseSheet.js exception: ") + e);\n}\n\nset = function(input)\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.set entered");\n\n    if("emp_id" in input)\n      _employee.setId(input.emp_id); \n    \n    if("sheet" in input)  \n      _sheet = input.sheet;\n\n    if ("tehead_id" in input)\n    {\n      _id = input.tehead_id;\n      _documents.setId(_id);\n    }\n\n    if("mode" in input)\n    {\n      if (input.mode <= xtte.editMode)\n      {\n        _lines["valid(bool)"].connect(_edit["setEnabled(bool)"]);\n        _lines["valid(bool)"].connect(_delete["setEnabled(bool)"]);\n        _lines.itemSelected.connect(_edit, "animateClick");\n      }\n\n      if (input.mode == xtte.newMode)\n      {\n        _mode = "new";\n        _weekending.enabled = true;\n      }\n      else if (input.mode == xtte.editMode)\n      {\n        _mode = "edit";\n        _weekending.enabled = false;\n        _employee.enabled = false;\n        _site.enabled = false;\n        var shortcut = _buttonBox.button(QDialogButtonBox.Cancel).shortcut;\n        _buttonBox.removeButton(_buttonBox.button(QDialogButtonBox.Cancel));\n        _buttonBox.addButton(QDialogButtonBox.Close);\n        _buttonBox.button(QDialogButtonBox.Close).shortcut = shortcut;\n\n        xtte.timeExpenseSheet.populate();\n      }\n      else if (input.mode == xtte.viewMode)\n      {\n        _mode = "view";\n        _new.enabled = false;\n        _orderComments.enabled = false;\n        var shortcut = _buttonBox.button(QDialogButtonBox.Cancel).shortcut;\n        _buttonBox.clear();\n        _buttonBox.addButton(QDialogButtonBox.Close);\n        _buttonBox.button(QDialogButtonBox.Close).shortcut = shortcut;\n        _lines.itemSelected.connect(_view, "animateClick");\n        _printSheet.hide();\n\n        xtte.timeExpenseSheet.populate();\n      }\n    }\n    return mainwindow.NoError;\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("set exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.populateMenu = function(pMenu, pItem, pCol)\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.populateMenu entered");\n\n    var tmpact;\n\n    if(pMenu == null)\n      pMenu = _lines.findChild("_menu");\n\n    if(pMenu != null)\n    {\n      var currentItem  = _lines.currentItem();\n      if (currentItem != null)\n      {\n        tmpact = pMenu.addAction(qsTr("Edit..."));\n        tmpact.triggered.connect(xtte.timeExpenseSheet.editItem);\n        tmpact.enabled = (_mode != "view" && privileges.check("MaintainTimeExpense"));\n\n        tmpact = pMenu.addAction(qsTr("View..."));\n        tmpact.triggered.connect(xtte.timeExpenseSheet.viewItem);\n\n        tmpact = pMenu.addAction(qsTr("Delete..."));\n        tmpact.triggered.connect(xtte.timeExpenseSheet.deleteItem);\n        tmpact.enabled = (_mode != "view" && privileges.check("MaintainTimeExpense"));\n      }\n    }\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("populateMenu exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.deleteItem = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.deleteItem entered");\n\n    var msg = qsTr("Are you sure you want to delete this line?");\n    if (QMessageBox.question(mywindow, mywindow.windowTitle, msg,\n          QMessageBox.Yes | QMessageBox.Escape,\n          QMessageBox.No | QMessageBox.Default) == QMessageBox.Yes)\n    {\n      var params   = new Object();\n      params.teitem_id = _lines.id();\n\n      q = toolbox.executeDbQuery("timeexpensesheet","delteitem", params );\n      xtte.errorCheck(q);\n      xtte.timeExpenseSheet.fillList();\n    }\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("deleteItem exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.newItem = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.newItem entered");\n\n    if (!xtte.timeExpenseSheet.save())\n      return;\n\n    xtte.timeExpenseSheet.openItem(xtte.newMode);\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("newItem exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.editItem = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.editItem entered");\n\n    xtte.timeExpenseSheet.openItem(xtte.editMode);\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("editItem exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.viewItem = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.viewItem entered");\n\n    xtte.timeExpenseSheet.openItem(xtte.viewMode);\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("viewItem exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.openItem = function(mode)\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.openItem entered");\n\n    var params   = new Object;\n    params.tehead_id = _id;\n    params.site = _site.text;\n    params.weekending = _weekending.date;\n    params.emp_id = _employee.id();\n    params.mode = mode;\n    if (mode) // Not new\n      params.teitem_id = _lines.id();\n\n    var wnd = toolbox.openWindow("timeExpenseSheetItem", mywindow);\n    toolbox.lastWindow().set(params);\n    wnd.exec();\n\n    xtte.timeExpenseSheet.fillList();\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("openItem exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.accepted = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.accepted entered");\n\n    if (!xtte.timeExpenseSheet.save())\n      return;\n\n    if (_printSheet.checked)\n      xtte.timeExpenseSheet.printSheet();\n\n    mywindow.close();\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("accepted exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.save = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.save entered");\n\n    if (!_employee.isValid())\n      throw new Error(qsTr("Employee Required"));\n\n    if (_site.id() == -1)\n      throw new Error(qsTr("Site Required"));\n\n    if (!_weekending.isValid())\n      throw new Error(qsTr("Week Ending Date Required"));\n\n    var params   = new Object();\n    params.tehead_id = _id;\n    params.emp_id = _employee.id();\n    params.warehous_id = _site.id();\n    params.weekending = _weekending.date;\n    params.notes = _orderComments.plainText;\n\n    var query = "updtehead";\n    if (_id == -1)\n      query = "instehead";\n\n    q = toolbox.executeDbQuery("timeexpensesheet", query, params );\n    if (q.first())\n    {\n      _id = q.value("tehead_id");\n      _documents.setId(_id);\n      _sheetNumberExtra.text = q.value("tehead_number");\n    }\n    else if (!xtte.errorCheck(q))\n      return false;\n\n    _weekending.enabled = false;\n    _employee.enabled = false;\n    _site.enabled = false;\n\n    return true;\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, qsTr("Worksheet"), e.message);\n    return false;\n  }\n}\n\nxtte.timeExpenseSheet.handleNewButton = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.handleNewButton entered");\n\n    _new.enabled = (_weekending.isValid() &&\n                    _employee.isValid() &&\n                    _mode != "view");\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                        qsTr("handleNewButton exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.populate = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.populate entered");\n\n    var params = new Object;\n    params.type = _type;\n    params.emp = _employee.id();\n    params.tehead_id = _id;\n\n    q = toolbox.executeDbQuery("timeexpensesheet", "header", params);\n\n    if (q.first())\n    {\n      _weekending.date = q.value("tehead_weekending");\n      _sheetNumberExtra.text = q.value("tehead_number");\n      _employee.setId(q.value("tehead_emp_id"));\n      _site.setId(q.value("tehead_warehous_id"));\n      _orderComments.setPlainText(q.value("tehead_notes"));\n    }\n    else if (!xtte.errorCheck(q))\n      return;\n\n    if (_mode == "view")\n    {\n      _weekending.enabled = false;\n      _employee.enabled = false;\n      _site.enabled = false;\n    }\n\n    xtte.timeExpenseSheet.fillList();\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("populate exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.testCurrEmpId = function()\n{\n  var params = new Object;\n  params.emp_id = _employee.id();\n  qry = toolbox.executeQuery("SELECT crmacct_emp_id = <? value('emp_id') ?>::integer AS test "\n                     + "FROM  crmacct "\n                     + "WHERE crmacct_usr_username = getEffectiveXtUser();", params);\n  if (qry.first()) {\n    return qry.value("test");\n  }\n  else\n    QMessageBox.information(mywindow, "Database Error", qry.lastError().text);\n  return false;\n}\n\nxtte.timeExpenseSheet.fillList = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.fillList entered");\n\n    if ( ( privileges.check("MaintainEmpCostSelf") && xtte.timeExpenseSheet.testCurrEmpId()) || privileges.check("MaintainEmpCostAll") )\n    {\n      _lines.addColumn(qsTr("Hourly Cost"),   XTreeWidget.priceColumn,  Qt.AlignRight,   false,  "teitem_hrlycost");\n      _lines.addColumn(qsTr("Total Cost"),   XTreeWidget.priceColumn,  Qt.AlignRight,   false,  "teitem_totalcost");\n    }\n\n    var params = new Object;\n    params.tehead_id = _id;\n    params.time = qsTr("Time");\n    params.expense = qsTr("Expense");\n    params.error = qsTr("Error");\n\n    q = toolbox.executeDbQuery("timeexpensesheet", "detail", params);\n\n    _lines.populate(q);\n\n    xtte.errorCheck(q);\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("fillList exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.printSheet = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.printSheet entered");\n\n    var params = new Object;\n    params.tehead_id = _id;\n    params.approved  = qsTr("Approved");\n    params.closed    = qsTr("Closed");\n    params.open      = qsTr("Open");\n\n    toolbox.printReport("TimeExpenseSheet", params);\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("printSheet exception: ") + e);\n  }\n}\n\nxtte.timeExpenseSheet.close = function()\n{\n  try\n  {\n    if (_debug)\n      print("xtte.timeExpenseSheet.close entered");\n\n    if (_mode == "new" && _id != -1)\n    {\n      if (QMessageBox.question(mywindow,\n                         qsTr("Delete Worksheet"),\n                         qsTr("<p>Are you sure you want to cancel this "\n                         + "Worksheet and discard all your changes?"),\n                          QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes)\n      {\n        var params = new Object;\n        params.tehead_id = _id;\n\n        toolbox.executeDbQuery("timeexpensesheet", "deltehead", params);\n      }\n      else\n        return;\n    }\n\n    mywindow.close();\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, "timeExpenseSheet",\n                         qsTr("close exception: ") + e);\n  }\n}\n\n// Initialize\n_employee.enabled = privileges.check("MaintainTimeExpenseOthers");\n_new.enabled = false;\n\n// Make connections\n_employee.newId.connect(xtte.timeExpenseSheet.handleNewButton);\n_weekending.newDate.connect(xtte.timeExpenseSheet.handleNewButton);\n_lines["valid(bool)"].connect(_view["setEnabled(bool)"]);\n\n_buttonBox.accepted.connect(xtte.timeExpenseSheet.accepted);\n_buttonBox.rejected.connect(xtte.timeExpenseSheet.close);\n\n_new.clicked.connect(xtte.timeExpenseSheet.newItem);\n_edit.clicked.connect(xtte.timeExpenseSheet.editItem);\n_delete.clicked.connect(xtte.timeExpenseSheet.deleteItem);\n_view.clicked.connect(xtte.timeExpenseSheet.viewItem);\n\n_lines["populateMenu(QMenu *, XTreeWidgetItem *, int)"].connect(xtte.timeExpenseSheet.populateMenu);	
120	timeExpenseSheetItem	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\n\n// Define local variables\nxtte.timeExpenseSheetItem = new Object;\n\nvar _hours              = mywindow.findChild("_hours");\nvar _total              = mywindow.findChild("_total");\t\nvar _totalLit           = mywindow.findChild("_totalLit");\t\nvar _rate               = mywindow.findChild("_rate");\nvar _rateLit            = mywindow.findChild("_rateLit");\nvar _clients            = mywindow.findChild("_clients");\nvar _employee           = mywindow.findChild("_employee");\nvar _items              = mywindow.findChild("_items");\nvar _po                 = mywindow.findChild("_po");\nvar _project            = mywindow.findChild("_project");\nvar _task               = mywindow.findChild("_task");\nvar _linenumber         = mywindow.findChild("_linenumber");\nvar _sheet              = mywindow.findChild("_sheet");\nvar _buttonBox          = mywindow.findChild("_buttonBox");\nvar _weekending         = mywindow.findChild("_weekending");\nvar _workdate           = mywindow.findChild("_workdate");\nvar _type               = mywindow.findChild("_type");\nvar _qtyLabel           = mywindow.findChild("_qtyLabel");\nvar _billable           = mywindow.findChild("_billable");\nvar _prepaid            = mywindow.findChild("_prepaid");\nvar _actual             = mywindow.findChild("_actual");\nvar _budget             = mywindow.findChild("_budget");\nvar _actualCost         = mywindow.findChild("_actualCost");\nvar _budgetCost         = mywindow.findChild("_budgetCost");\nvar _notes              = mywindow.findChild("_notes");\nvar _sheetLit           = mywindow.findChild("_sheetLit");\nvar _dayHrs             = mywindow.findChild("_dayHrs");\nvar _weekHrs            = mywindow.findChild("_weekHrs");\n\nvar _empcostLit\t\t\t= mywindow.findChild("_empcostLit");\nvar _empcost\t\t\t= mywindow.findChild("_empcost");\nvar _totCostLit         = mywindow.findChild("_totCostLit");\nvar _totCost            = mywindow.findChild("_totCost");\n\nvar _cancel = _buttonBox.button(QDialogButtonBox.Cancel);\nvar _prev = _buttonBox.addButton(qsTr("Prev"), QDialogButtonBox.ActionRole);\nvar _next = _buttonBox.addButton(qsTr("Next"), QDialogButtonBox.ActionRole);\n\nvar _sheetnum;\nvar _linenum;\nvar _teitemid = -1;\nvar _headid = -1;\nvar _taskid = -1;\nvar _site;\nvar _mode = xtte.newMode;\nvar _modified = false;\nvar _populating = false;\nvar _last = true;\n\n\nset = function(input)\n{\n  if("emp_id" in input)\n    _employee.setId(input.emp_id);\n  \n  if("weekending" in input)\n    _weekending.date = input.weekending;\n\n  if ("tehead_id" in input)\n    _headid = input.tehead_id;\n\n  if ("site" in input)\n    _site = input.site;\n\n  if ("teitem_id" in input)\n    _teitemid = input.teitem_id;\n\n  if ("mode" in input)\n  {\n    _mode = input.mode;\n\n      if (input.mode == xtte.newMode)\n      {\n          xtte.timeExpenseSheetItem.clear();\n      }\n      else if (input.mode == xtte.viewMode)\n      {\n        var shortcut = _buttonBox.button(QDialogButtonBox.Cancel).shortcut;\n        _buttonBox.removeButton(_buttonBox.button(QDialogButtonBox.Cancel));\n        _buttonBox.removeButton(_buttonBox.button(QDialogButtonBox.Save));\n        _buttonBox.addButton(QDialogButtonBox.Close);\n        _buttonBox.button(QDialogButtonBox.Close).shortcut = shortcut;\n        _weekending.enabled = false;\n        _next.enabled = false;\n        _prepaid.enabled = false;\n        _type.enabled = false;\n        _weekending.enabled = false;\n        _workdate.enabled = false;\n        _hours.enabled = false;\n        _rate.enabled = false;\n        _items.enabled = false;\n        _employee.enabled = false;\n        _clients.enabled = false;\n        _po.enabled = false;\n        _project.enabled = false;\n        _task.enabled = false;\n        _notes.enabled = false;\n        _billable.enabled = false; \n        _empcost.enabled = false;\n      }\n      else if (input.mode == xtte.editMode)\n      {\n        _project.enabled = false;\n        _task.enabled = false;\n      }\n\n      xtte.timeExpenseSheetItem.populate();\n   }\n\n  \n  return mainwindow.NoError;\n}\n\nxtte.timeExpenseSheetItem.extension = function()\n{\n  _total.localValue = (_hours.toDouble() * _rate.localValue);\n  _totCost.localValue = (_hours.toDouble() * _empcost.localValue);\n  if (_type.code == 'T')\n    xtte.timeExpenseSheetItem.empTotals();\n  xtte.timeExpenseSheetItem.modified();\n}\n\nxtte.timeExpenseSheetItem.gettask = function()\n{\n  if (_project.isValid())\n  {\n    var params = new Object();\n    params.prj_id = _project.id();\n    params.name = qsTr("Default");\n    if (_mode == xtte.newMode)\n      params.active = true;\n    if (_workdate.isValid())\n      params.startDate = _workdate.date;\n\n    var qry = toolbox.executeDbQuery("timeexpensesheetitem", "gettask", params);\n    if(!xtte.errorCheck(qry))\n      return;\n\n    _task.populate(qry);\n\n    if(_taskid > 0)\n      _task.setId(_taskid);\n\n    if (!qry.first())\n    {\n      var msg = qsTr("No task found. A default task will be added");\n      QMessageBox.critical(mywindow, qsTr("task"), msg);\n      toolbox.executeDbQuery("timeexpensesheetitem","instask",params);\n\n      qry = toolbox.executeDbQuery("timeexpensesheetitem", "gettask", params);\n      _task.populate(qry);\n    }\n\n    xtte.timeExpenseSheetItem.getPrice();\n    xtte.timeExpenseSheetItem.budgTotals();\n    xtte.timeExpenseSheetItem.actTotals();\n  }\n}\n\nxtte.timeExpenseSheetItem.modified = function()\n{\n  if (_populating)\n    return;\n\n  _modified = true;\n}\n\nxtte.timeExpenseSheetItem.getPrice = function()\n{\n  if (_populating)\n    return;\n  var params = new Object();\n  params.emp_id = _employee.id();\n  if(_type.code == 'T')\n  {\n    var qry2 = toolbox.executeQuery("SELECT te.calcRate(emp_wage, emp_wage_period) as cost "\n                                + "FROM emp WHERE emp_id = <? value('emp_id') ?>", params);\n    if (qry2.first())\n    {\n      _empcost.setBaseValue(qry2.value("cost"));\n      _totCost.setBaseValue(qry2.value("cost") * _hours.toDouble());\n    }\n  else\n    xtte.errorCheck(qry2);\n  }\n  if (!_clients.isValid())\n    return;\n  if (_type.code == 'T' && !_billable.checked)\n  {\n    _rate.localValue = 0;\n    _rate.enabled = false;\n  }      \n  else if (_mode == xtte.editMode)\n  {\n    if (QMessageBox.question(mywindow,\n                       qsTr("Update Rate?"),\n                       qsTr("<p>Would you like to update the existing rate?"),\n                        QMessageBox.Ok, QMessageBox.Cancel) == QMessageBox.Cancel)\n    return;\n  }\n\n  params.item_id = _items.id();\n  params.task_id = _task.id();\n  params.prj_id = _project.id();\n  params.cust_id = _clients.id();\n  if (_type.code == "T")\n    params.time = true;\n  \n  if(_billable.checked)\n  {\n    var qry = toolbox.executeDbQuery("timeexpensesheetitem", "getterate", params);\n    if (qry.first())\n    {\n      _rate.setLocalValue(qry.value("rate"));\n      _rate.enabled = true;\n    }\n    else\n      xtte.errorCheck(qry);\n  }  \n  \n  xtte.timeExpenseSheetItem.modified();\n}\n\nxtte.timeExpenseSheetItem.populate = function()\n{\n  _modified = false;\n \n  // Edit or View mode\n  var params = new Object();\n  params.teitem_id = _teitemid;\n\n  var qry = toolbox.executeDbQuery("timeexpensesheetitem","detail", params);\n  if (qry.first())\n  {\n    if (_mode == xtte.newMode)\n      _mode = xtte.editMode;\n    _populating = true; \n\n    _headid = qry.value("teitem_tehead_id");\n    _sheet.text = (qry.value("tehead_number"));\n    _sheetnum = (qry.value("tehead_number"));\n    _employee.setId(qry.value("tehead_emp_id"));\n    _weekending.date = (qry.value("tehead_weekending"));\n\n    _linenumber.text = (qry.value("teitem_linenumber"));\n    _linenum = (qry.value("teitem_linenumber"));\n    _workdate.date = (qry.value("teitem_workdate"));\n    _type.code = qry.value("teitem_type");\n    _clients.setId(qry.value("teitem_cust_id"));\n    _po.text = (qry.value("teitem_po"));\n    _items.setId(qry.value("teitem_item_id"));\n    _hours.text = (qry.value("teitem_qty"));\n    _rate.setId(qry.value("teitem_curr_id") - 0);\n    _rate.localValue = (qry.value("teitem_rate"));\n    _total.localValue = (qry.value("teitem_total"));\n    _project.setId(qry.value("prj_id"));\n    _task.setId(qry.value("teitem_prjtask_id"));\n    _billable.checked = qry.value("teitem_billable");\n    _prepaid.checked = qry.value("teitem_prepaid")\n    _notes.plainText = qry.value("teitem_notes");\n    _empcost.localValue = qry.value("teitem_hrlycost");\n    _totCost.localValue = qry.value("teitem_hrlycost")*qry.value("teitem_qty");\n\n    _last = qry.value("ismax");\n    if (_last && _mode == xtte.editMode)\n      _next.text = qsTr("New");\n    else\n      _next.text = qsTr("Next");\n\n    _next.enabled = !(_last && _mode == xtte.viewMode);\n    _prev.enabled = (_linenum > 1);\n\n    _populating = false;\n    _modified = false;\n  }\n  else if (!xtte.errorCheck)\n    return;\n\n  xtte.timeExpenseSheetItem.empTotals();\n}\n\nxtte.timeExpenseSheetItem.accepted = function()\n{\n  if (xtte.timeExpenseSheetItem.save())\n  {\n    if (_mode == xtte.newMode)\n      xtte.timeExpenseSheetItem.clear();\n    else\n      mywindow.close();\n  }\n}\n\nxtte.timeExpenseSheetItem.save = function()\n{\n  try\n  {\n    if (!_workdate.isValid())\n      throw new Error(qsTr("Work Date Required"));\n    \n    if (!_project.isValid())\n      throw new Error(qsTr("Project Required"));\n \n    if (!_items.isValid())\n      throw new Error(qsTr("Item Required"));\n\n    if (_task.id == -1)\n      throw new Error(qsTr("Task Required"));\n\n    if (_hours.toDouble < 0 && _billable.checked)\n      throw new Error(qsTr("Billing of negative amounts is not supported"));\n  }\n  catch (e)\n  {\n    QMessageBox.critical(mywindow, qsTr("Processing Error"), e.message);\n    return false;\n  }\n\n  if ((_hours.toDouble() <= 0 || _total.localValue <= 0) && _type.code == 'E' && !_prepaid.checked)\n  {\n    var msg = qsTr("The system only supports vouchering positive expense quantities and amounts.  "\n            +      "Do you want to save anyway?")\n    if (QMessageBox.question( mywindow, mywindow.windowTitle, msg, \n        QMessageBox.Yes | QMessageBox.Escape, QMessageBox.No | QMessageBox.Default) == QMessageBox.No)\n      return false;\n  }\n\n\n  var params = new Object();\n  params.teitem_tehead_id      = _headid;\n  params.teitem_linenumber     = _linenum;\n  params.teitem_type \t       = _type.code;\n  params.teitem_workdate       = _workdate.date;\n  params.teitem_cust_id        = _clients.id();\n  params.teitem_po             = _po.text;\n  params.teitem_item_id        = _items.id();\n  params.teitem_qty            = _hours.toDouble();\n  params.teitem_rate           = _rate.localValue;\n  params.teitem_total          = _total.localValue;\n  params.teitem_prjtask_id     = _task.id();\n  params.teitem_billable       = _billable.checked;\n  params.teitem_prepaid        = _prepaid.checked;\n  params.teitem_notes          = _notes.plainText;\n  params.teitem_id             = _teitemid;\n  params.teitem_curr_id        = _rate.id();\n  params.teitem_empcost        = _empcost.localValue;\n\n  var query = "updteitem";\n  if (_teitemid < 0)\n    query = "insteitem";\n\n  var q = toolbox.executeDbQuery("timeexpensesheetitem", query, params);\n  if (q.first())\n    _teitemid = q.value("teitem_id");\n  else if (!xtte.errorCheck(q))\n    return;\n\n  _prev.enabled = true;\n\n  return true;\n}\n\n\nxtte.timeExpenseSheetItem.typeChanged = function()\n{\n  if (_type.code == "T")\n  {\n    _qtyLabel.text = qsTr("Hours:");\n    _rateLit.text = qsTr("Rate:");\n    _rate.enabled = _clients.isValid();\n    _billable.visible = true;\n    _prepaid.visible = false;\n    _prepaid.checked = false;\n    _empcost.enabled = true;\n  } \n  else\n  {\n    _qtyLabel.text = qsTr("Qty:");\n    _rateLit.text = qsTr("Unit Cost:");\n    _billable.visible = true;\n    _prepaid.visible = true;\n    _empcost.enabled = false;\n    _empcost.localValue = 0;\n    _rate.enabled = true;\n    _rate.localValue = 0;\n\n     var params = new Object();\n     params.emp_id = _employee.id();\n\n     var qry = toolbox.executeQuery("SELECT COALESCE (crmacct_vend_id,-1) AS crmacct_vend_id FROM crmacct WHERE crmacct_emp_id= <? value('emp_id')?>;",params);\n\n     if (qry.first())\n     {\n       var vend_id= qry.value("crmacct_vend_id");\n       if(vend_id ==-1)\n       {\n         var msg = qsTr("The Employee is not a Vendor, this expense cannot be vouchered.  "\n                   +      "Do you want to continue?")\n         if (QMessageBox.question( mywindow, mywindow.windowTitle, msg,\n               QMessageBox.Yes | QMessageBox.Escape, QMessageBox.No | QMessageBox.Default) == QMessageBox.No)\n         {\n           _type.code= "T";\n           return false;\n         }\n       }\n     }\n  }\n  xtte.timeExpenseSheetItem.getPrice();\n  xtte.timeExpenseSheetItem.empTotals();\n  xtte.timeExpenseSheetItem.modified();\n}\n\nxtte.timeExpenseSheetItem.customerChanged = function()\n{\n  _billable.enabled = _clients.isValid();\n  _rate.enabled = (_clients.isValid() || _type.code == 'E');\n\n  if (_populating)\n    return;\n\n  if (!_clients.isValid())\n  {\n    _po.clear();\n    _rate.localValue = 0;\n    _billable.checked = false;\n  }\n\n  var params = new Object;\n  params.cust_id = _clients.id();\n\n  q = toolbox.executeDbQuery("timeexpensesheetitem", "getcustinfo", params);\n  if (q.first())\n    _rate.setId(q.value("cust_curr_id") - 0);\n  else if (!xtte.errorCheck(q))\n    return;\n\n  xtte.timeExpenseSheetItem.getPrice();\n}\n\nxtte.timeExpenseSheetItem.projectChanged = function()\n{\n  //enable and reset the task fields\n  _task.enabled = (_project.isValid() && _mode == xtte.newMode);\n\n  xtte.timeExpenseSheetItem.gettask();\n  xtte.timeExpenseSheetItem.modified();\n  xtte.timeExpenseSheetItem.getPrice();\n}\n\n\nxtte.timeExpenseSheetItem.taskChanged = function()\n{  \n  var custid = -1;\n  var itemid = -1;\n  var params = new Object;\n  params.prjtask_id = _task.id();\n\n  q = toolbox.executeDbQuery("timeexpensesheetitem", "taskdefaults", params);\n  if (q.first())\n  {\n    custid = q.value("cust_id");\n    itemid = q.value("item_id")\n  }\n  else if (!xtte.errorCheck(q))\n    return;\n\n  if (_populating)\n  {\n    // Disable if customer matches default, otherwise default must have changed\n    // so allow for editing so user can decide what to do\n    _clients.enabled = !(_clients.isValid() && _clients.id() == custid)\n    _items.enabled = !(_items.isValid() && _items.id() == itemid)\n  }\n  else\n  {\n    if (custid > 0)\n    {\n      _clients.setId(custid);\n      _clients.enabled = false;\n    }\n    else\n      _clients.enabled = true;\n\n    if (itemid > 0)\n    {\n      _items.setId(itemid);\n      _items.enabled = false;\n    }\n    else\n      _items.setId(-1);\n      _items.enabled = true;\n  }\n\n  xtte.timeExpenseSheetItem.getPrice();\n  xtte.timeExpenseSheetItem.budgTotals();\n  xtte.timeExpenseSheetItem.actTotals();\n  xtte.timeExpenseSheetItem.modified();\n}\n\nxtte.timeExpenseSheetItem.budgTotals = function()\n{\n  var params = new Object;\n  params.prj_id = _project.id();\n  params.task_id = _task.id();\n \n  var q = toolbox.executeDbQuery("timeexpensesheetitem", "taskbudg",params);\n  if (q.first())\n  {\n    _budget.text = q.value("budget_hours");        \n    _actual.text = q.value("actual_hours");       \n    _budgetCost.text = q.value("budget_cost");        \n    _actualCost.text = q.value("actual_cost");        \n    \n  }\n  else \n    xtte.errorCheck(q);\n}\n\n\nxtte.timeExpenseSheetItem.actTotals = function()\n{\n  var params = new Object;\n  params.task_id = _task.id();\n  params.teitem_id = _teitemid;\n\n  var expense = 0;\n  var hours = 0;  \n\n  // get the task actuals then add the current\n  var q = toolbox.executeDbQuery("timeexpensesheetitem","taskrollup",params);\n\n  if (q.first())\n  {\n      _actual.text = q.value("total_hours");\n      _actualCost.text = q.value("total_expense");\n  } \n  else\n    xtte.errorCheck(q);\n}\n\nxtte.timeExpenseSheetItem.empTotals = function()\n{\n  if (_populating)\n    return;\n\n  var params = new Object;\n  params.teitem_id = _teitemid;\n  params.tehead_id = _headid;\n  params.emp_id = _employee.id();\n  params.workDate = _workdate.date;\n  if (_type.code == 'T')\n    params.hours = _hours.toDouble() - 0;\n\n  var q = toolbox.executeDbQuery("timeexpensesheetitem", "emptotals", params);\n\n  if (q.first())\n  {\n    _dayHrs.setText(q.value("day_hours"));\n    _weekHrs.setText(q.value("sheet_hours"));\n  } \n  else\n    xtte.errorCheck(q);\n}\n\nxtte.timeExpenseSheetItem.prev = function()\n{\n  if ( (_modified) && (_mode != xtte.viewMode) )\n  {\n    if (QMessageBox.question(mywindow,\n                       qsTr("Unsaved Changed"),\n                       qsTr("<p>You have made some changes "\n                       + "which have not yet been saved!</p><p>"\n                       + "Would you like to save them now?"),\n                        QMessageBox.Save, QMessageBox.No) == QMessageBox.Save)\n    {\n      if (!xtte.timeExpenseSheetItem.save())\n        return;\n    }\n  }\n\n  var params = new Object;\n  if (_teitemid > 0)\n    params.teitem_id = _teitemid;\n  else\n    params.tehead_id = _headid;\n\n  var q = toolbox.executeDbQuery("timeexpensesheetitem", "teitemprev", params);\n\n  if (q.first())\n  {\n    _teitemid = q.value("teitem_id");\n    _modified = false;\n\n    if (_mode == xtte.newMode)\n      _mode = xtte.editMode;\n\n    _next.enabled = true;\n    xtte.timeExpenseSheetItem.populate();\n  }\n  else\n    xtte.errorCheck(q);\n}\n\n\nxtte.timeExpenseSheetItem.next = function()\n{\n  if ( (_modified) && (_mode != xtte.viewMode) )\n  {\n\n    if (QMessageBox.question(mywindow,\n                       qsTr("Unsaved Changed"),\n                       qsTr("<p>You have made some changes "\n                       + "which have not yet been saved!\\n" \n                       + "Would you like to save them now?"),\n                        QMessageBox.Save, QMessageBox.Cancel) != QMessageBox.Save)\n      return;\n\n    if (!xtte.timeExpenseSheetItem.save())\n      return;\n  }\n\n  if (_last)\n    xtte.timeExpenseSheetItem.clear();\n  else\n  {\n    var params = new Object;\n    params.teitem_id = _teitemid;\n    var q = toolbox.executeDbQuery("timeexpensesheetitem","teitemnext",params);\n\n    if (q.first())\n    {\n      _modified = false;\n      _teitemid = q.value("teitem_id");\n      _prev.enabled = true;\n      xtte.timeExpenseSheetItem.populate();\n    }\n    else if (xtte.errorCheck(q))\n      xtte.timeExpenseSheetItem.clear();\n  }\n}\n\nxtte.timeExpenseSheetItem.clear = function()\n{\n  var params = new Object();\n  params.tehead_id = _headid;\n\n  var q = toolbox.executeDbQuery("timeexpensesheet","header",params);\n\n  if (q.first())\n  {\n    _weekending.date = (q.value("tehead_weekending"));      \n    _sheet.text = (q.value("tehead_number"));\n    _sheetnum = (q.value("tehead_number"));\n    _employee.setId(q.value("tehead_emp_id"));\n  }\n  else if (!xtte.errorCheck(q))\n    return;\n\n  q = toolbox.executeDbQuery("timeexpensesheetitem", "nextlinenum", params);\n  if (q.first())\n  {\n    _linenumber.setText(q.value("linenumber"));\n    _linenum = (q.value("linenumber"));\n  } \n  else \n    xtte.errorCheck(q);\n\n  _mode = xtte.newMode;\n  _teitemid = -1;\n  _prev.enabled = true;\n  _type.enabled = true;\n  _workdate.clear();\n  _workdate.enabled = true;\n  _workdate.setFocus();\n  _hours.text = "0.0";\n  _hours.enabled = true;\n  _rate.localValue = 0;\n  _empcost.enabled = true;\n  _empcost.localValue = 0;\n  _items.enabled = true;\n  _items.setId(-1);\n  _employee.enabled = false;\n  _clients.enabled = true;\n  _po.clear();\n  _po.enabled = true;\n  _project.enabled = true;\n  _task.enabled = true;\n  _notes.clear();\n  _notes.enabled = true;\n  _next.text = qsTr("New");\n  _next.enabled = false;\n\n  xtte.timeExpenseSheetItem.getPrice();\n\n  _modified = false;\n}\n\n\nxtte.timeExpenseSheetItem.setSecurity = function()\n{\n  if (privileges.check("CanViewRates"))\n  {\n    _rate.visible = true;\n    _total.visible = true;\n    _rateLit.visible = true;\n    _totalLit.visible = true;\n  }\n  else\n  {\n    _rate.visible = false;\n    _total.visible = false;\n    _rateLit.visible = false;\n    _totalLit.visible = false;\n  }\n  if ( ( privileges.check("MaintainEmpCostSelf") && xtte.timeExpenseSheetItem.testCurrEmpId()) || privileges.check("MaintainEmpCostAll") ) \n  {\n    _empcostLit.visible = true;\n    _empcost.visible = true;\n    _totCostLit.visible = true;\n    _totCost.visible = true;\n  }\n  else\n  {\n    _empcostLit.visible = false;\n    _empcost.visible = false;\n    _totCostLit.visible = false;\n    _totCost.visible = false;\n  }\t\n}\n\nxtte.timeExpenseSheetItem.testCurrEmpId = function()\n{\n  var params = new Object;\n  params.emp_id = _employee.id();\n  var qry = toolbox.executeQuery("SELECT crmacct_emp_id = <? value('emp_id') ?>::integer AS test "\n                     + "FROM  crmacct "\n                     + "WHERE crmacct_usr_username = getEffectiveXtUser();", params);\n  if (qry.first()) {\n    return qry.value("test");\n  }\n  else \n    QMessageBox.information(mywindow, "Database Error", qry.lastError().text);\n  return false;\n}\n\n// Initialize default states\n_hours.setValidator(mainwindow.transQtyVal());\n\n_prev.enabled = false;\n_next.enabled = false;\n_task.enabled = false;\n_weekending.enabled = false;\n_linenumber.enabled = true;\n_employee.enabled = false;\n_total.enabled = false;\n_total.readonly = true;\n_rate.enabled = false;\n_billable.visible = true;\n_billable.enabled = false;\n_prepaid.visible = false;\n_next.enabled = false;\n\n_type.append(1, qsTr("Time"), "T");\n_type.append(2, qsTr("Expense"), "E");\n\n//_items.setQuery(xtte.itemSql);\n_items.addExtraClause("(item_type='R') AND "\n                    + "(item_id IN (SELECT teexp_id FROM te.teexp))");\n\n_project.setAllowedStatuses(0x02); // In process\n\n// Define connections\n_buttonBox.accepted.connect(xtte.timeExpenseSheetItem.accepted);\n_buttonBox.rejected.connect(mydialog, "reject");\n_prev.clicked.connect(xtte.timeExpenseSheetItem.prev);\n_next.clicked.connect(xtte.timeExpenseSheetItem.next);\n\n_task.newID.connect(xtte.timeExpenseSheetItem.taskChanged);\n_rate.valueChanged.connect(xtte.timeExpenseSheetItem.extension);\n_workdate.newDate.connect(xtte.timeExpenseSheetItem.empTotals);\n_hours.textChanged.connect(xtte.timeExpenseSheetItem.extension);\n_empcost.valueChanged.connect(xtte.timeExpenseSheetItem.extension);\n_hours.editingFinished.connect(xtte.timeExpenseSheetItem.actTotals);\n_rate.valueChanged.connect(xtte.timeExpenseSheetItem.actTotals);\n_type.newID.connect(xtte.timeExpenseSheetItem.typeChanged);\n_items["newId(int)"].connect(xtte.timeExpenseSheetItem.getPrice);\n_clients["newId(int)"].connect(xtte.timeExpenseSheetItem.customerChanged);\n_project["newId(int)"].connect(xtte.timeExpenseSheetItem.projectChanged);\n_employee.newId.connect(xtte.timeExpenseSheetItem.modified);\n_po.textChanged.connect(xtte.timeExpenseSheetItem.modified);\n_workdate.newDate.connect(xtte.timeExpenseSheetItem.modified);\n_billable.toggled.connect(xtte.timeExpenseSheetItem.getPrice);\n_prepaid.toggled.connect(xtte.timeExpenseSheetItem.modified);\n_notes.textChanged.connect(xtte.timeExpenseSheetItem.modified);\n\nxtte.timeExpenseSheetItem.getPrice();\n_employee["newId(int)"].connect(xtte.timeExpenseSheetItem.setSecurity);\n	
118	tebilling	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\nvar _item\t\t= mywindow.findChild("_item");\n\n_item.populate("select item_id,item_number,item_descrip1,item_listprice from item where item_sold = true and item_active = true and item_type = 'R'");\n\n	
107	configureCRM	0	t	/*\n  This file is part of the xtprjaccnt Package for xTuple ERP,\n  and is Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.  It\n  is licensed to you under the xTuple End-User License Agreement ("the\n  EULA"), the full text of which is available at www.xtuple.com/EULA.\n  While the EULA gives you access to source code and encourages your\n  involvement in the development process, this Package is not free\n  software.  By using this software, you agree to be bound by the\n  terms of the EULA.\n*/\n\ninclude("xtte");\n\nxtte.configureCRM = new Object;\n\nvar _telayout = new QBoxLayout(mywindow);\nvar _tespcr = new QSpacerItem(10, 0, 1, 1 | 4);\nvar _laborAndOverheadLit = toolbox.createWidget("QLabel", mywindow, "_laborAndOverheadLit");\nvar _laborAndOverhead = toolbox.createWidget("GLCluster", mywindow, "_laborAndOverhead");\n_laborAndOverheadLit.text = qsTr("Project Labor And Overhead:");\n_laborAndOverheadLit.buddy= _laborAndOverhead;\n_laborAndOverhead.setType(0x02);  // Liability\n\n_telayout.addWidget(_laborAndOverheadLit);\n_telayout.addWidget(_laborAndOverhead);\n_telayout.addItem(_tespcr);\n\nvar _useProjects = mywindow.findChild("_useProjects")\nvar _layout = toolbox.widgetGetLayout(_useProjects);\n_layout.insertLayout(1, _telayout);\n\nxtte.configureCRM.save = function()\n{ \n  var id = -1;\n  if (_useProjects.checked)\n    id = _laborAndOverhead.id() \n    \n  metrics.set("PrjLaborAndOverhead", id);\n}\n// Initialize\n_laborAndOverhead.setEnabled(_useProjects.checked);\n_laborAndOverhead.setId(metrics.value("PrjLaborAndOverhead"));\n\n// Connections\nmywindow.saving.connect(xtte.configureCRM.save);\n_useProjects["toggled(bool)"].connect(_laborAndOverheadLit, "setEnabled(bool)");\n_useProjects["toggled(bool)"].connect(_laborAndOverhead, "setEnabled(bool)");\n\n	
108	customer	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.customer = new Object;\n\n\nif (privileges.check("CanViewRates"))\n{\n  var _custid = -1;\n  var _creditGroup = mywindow.findChild("_creditGroup");\n  var _layout = toolbox.widgetGetLayout(_creditGroup);\n  var _tecustomer = toolbox.loadUi("tecustomer", mywindow);\n  var groupBox_3 = mywindow.findChild("groupBox_3");\n  var groupBox_4 = mywindow.findChild("groupBox_4");\n  var _creditStatusGroup = mywindow.findChild("_creditStatusGroup");\n\n  _layout.addWidget(_tecustomer, 0, 0, 1, 3);\n  _layout.addWidget(groupBox_4, 1, 0, 1, 1);\n  _layout.addWidget(_creditStatusGroup, 1, 1, 1, 1);\n  _layout.addWidget(groupBox_3, 1, 2, 1, 1);\n  _layout.addWidget(_creditGroup, 2, 0, 1, 3);\n\n  var _number = mywindow.findChild("_number");\n  var _blanketPos = mywindow.findChild("_blanketPos");\n  var _billingGroup = mywindow.findChild("_billingGroup");\n  var _rate = _tecustomer.findChild("_rate");\n  var _tecustrateid = -1;\n  var _basecurrid = _rate.id();\n\n  xtte.customer.modeChanged = function(mode)\n  {\n    _billingGroup.enabled = (mode == mainwindow.cNew || mode == mainwindow.cEdit);\n  }\n\n  xtte.customer.save = function()\n  {\n\n    var params = new Object();\n    params.tecustrate_id = _tecustrateid;\n    params.cust_id       = _custid;\n    params.curr_id       = _rate.id();\n    params.rate          = _rate.localValue;\n\n    var query = "updtecustrate";\n    if (!_billingGroup.checked)\n      query = "deltecustrate";\n    else if (_tecustrateid == -1)\n      query = "instecustrate";\n\n    var q = toolbox.executeDbQuery("customer", query, params);\n    if (q.first())\n      _tecustrateid = q.value("tecustrate_id");\n    else\n      xtte.errorCheck(q);\n  }\n\n  xtte.customer.populate = function(custId)\n  {\n    if (_custid == custId)\n      return;\n\n    _custid = custId;\n\n    var params = new Object();\n    params.cust_id = _custid;\n\n    var q = toolbox.executeDbQuery("customer", "seltecustrate", params);\n\n    if (q.first())\n    {\n      _billingGroup.checked = true;\n      _tecustrateid = q.value("tecustrate_id");\n      _rate.setId(q.value("tecustrate_curr_id"));\n      _rate.localValue = q.value("tecustrate_rate");\n      return;\n    }\n    else\n      xtte.errorCheck(q);\n\n    _billingGroup.checked = false;\n    _tecustrateid = -1;\n    _rate.setId(_basecurrid);\n    _rate.localValue = 0;\n  }\n\n  // Initialize\n  QWidget.setTabOrder(_blanketPos, _rate);\n\n  mywindow["newId(int)"].connect(xtte.customer.populate);\n  mywindow["newMode(int)"].connect(xtte.customer.modeChanged);\n  mywindow["saved(int)"].connect(xtte.customer.save);\n\n  xtte.customer.populate();\n}\n	
110	employee	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.employee = new Object;\n\nvar _externalRate = mywindow.findChild("_externalRate"); \nvar _layout = toolbox.widgetGetLayout(_externalRate);\nvar _contractor = toolbox.createWidget("QCheckBox", mywindow, "_contractor");\n_contractor.text = qsTr("Contractor");\n\n_layout.addWidget(_contractor, 1, 4);\n\nvar _teempid = -1; \nvar _empid = -1;\n\nset = function(input)\n{\n  if("emp_id" in input)\n  {\n    _empid = input.emp_id;\n    xtte.employee.populate();\n  }\n\n  if("mode" in input)\n  {\n    if (input.mode == "view")\n      _contractor.enabled = false;\n  }\n\n  return mainwindow.NoError;\n}\n\nxtte.employee.save = function(empId)\n{\n  if (empId <= 0)\n    return;\n\n  var params = new Object();\n  params.teemp_id\t= _teempid;\n  params.emp_id\t= empId;\n  params.contractor\t= _contractor.checked;\n\n  var query = "updteemp";\n  if (_teempid == -1)\n    query = "insteemp";\n\n  var q = toolbox.executeDbQuery("employee", query, params);\n  xtte.errorCheck(q);\n}\n\nxtte.employee.populate = function()\n{\n  var params = new Object();\n  params.emp_id = _empid;    \n\n  var q = toolbox.executeDbQuery("employee", "selteemp", params);\n\n  if (q.first())\n  {\n    _teempid = q.value("teemp_id");\n    _contractor.checked = (q.value("teemp_contractor"));\n  }\n  else\n    xtte.errorCheck(q);\n}\n\nmydialog["finished(int)"].connect(xtte.employee.save);\n\n\n	
111	initMenu	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.initMenu = new Object;\n\n// Define menu and action variables\nvar crmMenu = mainwindow.findChild("menu.crm.projects");\ncrmMenu.addSeparator();\n\nvar tesheetAction = crmMenu.addAction(qsTr("Worksheets..."), mainwindow);\ntesheetAction.objectName = "pm.teSheets";\ntesheetAction.setData("MaintainTimeExpense");\ntesheetAction.enabled = privileges.value("MaintainTimeExpense");\n\nvar crmRptMenu = mainwindow.findChild("menu.crm.reports");\nvar orderActPrj = mainwindow.findChild("pm.dspOrderActivityByProject");\n\nvar historyAction = new QAction(qsTr("Worksheet History"), mainwindow);\nhistoryAction.objectName = "pm.teHistory";\nhistoryAction.setData("ViewTimeExpenseHistory");\nhistoryAction.enabled = privileges.value("ViewTimeExpenseHistory");\ncrmRptMenu.insertAction(orderActPrj, historyAction);\n\n// Define function(s)\nxtte.initMenu.openSheets = function()\n{\n  toolbox.openWindow("timeExpenseSheets");\n}\n\nxtte.initMenu.openHistory = function()\n{\n  toolbox.openWindow("dspTimeExpenseHistory");\n}\n\n// Connect Actions\ntesheetAction.triggered.connect(xtte.initMenu.openSheets);\nhistoryAction.triggered.connect(xtte.initMenu.openHistory);\n	
112	item	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.item = new Object;\n\nvar _tab = mywindow.findChild("_tab"); \nvar _expensePage = toolbox.loadUi("teexpense", mywindow);\n_tab.insertTab(2, _expensePage, "Project");\n\nvar _projectExpense = mywindow.findChild("_projectExpense");\nvar _itemtype = mywindow.findChild("_itemtype");\nvar _close = mywindow.findChild("_close");\nvar _description = mywindow.findChild("_description");\nvar _account = mywindow.findChild("_account");\nvar _expcat = mywindow.findChild("_expcat");\nvar _accountSelected = mywindow.findChild("_accountSelected");\nvar _expcatSelected = mywindow.findChild("_expcatSelected");\nvar _allowExpenseGroup = mywindow.findChild("_allowExpenseGroup");\nvar _inventoryUOM = mywindow.findChild("_inventoryUOM");\nvar _save = mywindow.findChild("_save");\n\nvar _saved = false;\nvar _isnew = true;\n\nxtte.item.clickswitch = function()\n{\n  if(_accountSelected.checked)\n  {\n    _account.enabled = true;\n    _expcat.enabled = false;\n    _expcat.setId(-1);\n  }\n  else\n  {\n    _account.enabled = false;\n    _expcat.enabled = true;\n    _account.setId(-1);\n  }\n}\n\nxtte.item.save = function(id)\n{\n  var params = new Object;\n  params.item_id = id;\n  params.expcat_id = _expcat.id();\n  params.accnt_id = _account.id();\n\n  var query = "updteexp";\n  if (!_projectExpense.checked)\n    query = "delteexp";\n  else if (_isnew)\n    query = "insteexp";\n\n  var q = toolbox.executeDbQuery("item", query, params);\n  xtte.errorCheck(q);\n}\n\nxtte.item.populate = function(itemId)\n{\n  var params = new Object;\n  params.item_id = itemId;\n\n  var q = toolbox.executeDbQuery("item", "selteexp", params);\n\n  if (q.first())\n  {\n    _projectExpense.checked = true;\n    _expcat.setId(q.value("teexp_expcat_id"));\n    _account.setId(q.value("teexp_accnt_id"));\n\n    if(_account.id() > 0)\n      _accountSelected.checked = true;\n    else\n      _expcatSelected.checked = true;\n\n    _isnew = false;\n  }\n  else if (!xtte.errorCheck(q))\n    return\n  else\n  {\n    _projectExpense.checked = false;\n    _isnew = true;\n  }\n\n  xtte.item.handleExpense();\n}\n\nxtte.item.handleExpense = function()\n{\n  _tab.setTabEnabled(_tab.indexOf(_expensePage), _itemtype.currentIndex == 3);\n}\n\nxtte.item.checkSave = function()\n{\n  if (_projectExpense.checked == true &&\n      !_expcat.isValid() && \n      !_account.isValid())\n  {\n    QMessageBox.critical(mywindow,\n                       qsTr("Can not save item"),\n                       qsTr("You must select a Ledger Account or an expense account for Project Expense Items."));\n  }\n  else\n    mywindow.sSave();\n}\n\n// Initialize\n_expcat.enabled = false;\n_account.setType(0x01 | 0x02 | 0x04); // Asset, Liability, Expense\n\n// Connections\ntoolbox.coreDisconnect(_save, "clicked()", mywindow, "sSave()"); \n_save.clicked.connect(xtte.item.checkSave);\nmywindow["saved(int)"].connect(xtte.item.save);\nmywindow["newId(int)"].connect(xtte.item.populate);\n_accountSelected.toggled.connect(xtte.item.clickswitch);\n_expcatSelected.toggled.connect(xtte.item.clickswitch);\n_itemtype['currentIndexChanged(QString)'].connect(xtte.item.handleExpense);\n_inventoryUOM.newID.connect(xtte.item.handleExpense);\n\n	
117	task	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ninclude("xtte");\nxtte.task = new Object;\n\nvar _tab = mywindow.findChild("_tab"); \nvar _tebilling = toolbox.loadUi("tebilling", mywindow);\n_tab.insertTab(2, _tebilling, qsTr("Billing"));\n_tab.setEnabled(2, privileges.check("CanViewRates"));\n\nvar _number = mywindow.findChild("_number");\nvar _actualHours = mywindow.findChild("_actualHours");\nvar _actualExp = mywindow.findChild("_actualExp");\nvar _billingGroup = _tebilling.findChild("_billingGroup");\nvar _itemGroup = _tebilling.findChild("_itemGroup");\nvar _cust = _tebilling.findChild("_cust");\nvar _rate = _tebilling.findChild("_rate");\nvar _item = _tebilling.findChild("_item");\nvar _useItem = _tebilling.findChild("_useItem");\nvar _teprjtaskid = -1; \nvar _prjtaskid = -1;\n\nset = function(input)\n{\n  if("prjtask_id" in input)\n  {\n    _prjtaskid = input.prjtask_id;\n    xtte.task.populate();\n  }\n\n  if("cust_id" in input)\n  {\n    _cust.setId(input.cust_id);\n    _cust.enabled = false;\n  }\n\n  if("mode" in input)\n  {\n    if (input.mode == "view")\n    {\n      _cust.enabled = false;\n      _billingGroup.enabled = false;\n      _itemGroup.enabled = false;\n    }\n  }\n\n  return mainwindow.NoError;\n}\n\nxtte.task.save = function(prjtaskId)\n{\n  if (prjtaskId <= 0)\n    return;\n\n  var params = new Object();\n  params.teprjtask_id\t= _teprjtaskid;\n  params.prjtask_id\t= prjtaskId;\n  if (_cust.isValid())\n    params.cust_id  \t= _cust.id();\n  if (_billingGroup.checked)\n  {\n    params.rate\t= _rate.localValue;\n    params.curr_id\t= _rate.id();\n  }\n  if (_useItem.checked && _item.isValid())\n    params.item_id\t= _item.id()\n\n  var query = "updteprjtask";\n  if (_teprjtaskid == -1)\n    query = "insteprjtask";\n\n  var q = toolbox.executeDbQuery("task", query, params);\n  xtte.errorCheck(q);\n}\n\nxtte.task.populate = function()\n{\n  var params = new Object();\n  params.prjtask_id = _prjtaskid;    \n\n  var q = toolbox.executeDbQuery("task", "selteprjtask", params);\n\n  if (q.first())\n  {\n    _teprjtaskid = q.value("teprjtask_id");\n\n    if (!_cust.isValid())\n      _cust.setId(q.value("cust_id"));\n\n    if (q.value("curr_id") == -1)\n      _billingGroup.checked = false;\n    else\n    {\n      _billingGroup.checked = true;\n      _rate.setId(q.value("curr_id"));\n      _rate.localValue = q.value("teprjtask_rate");\n    }\n\n    if (q.value("item_id") == -1)\n      _useItem.checked = false;\n    else\n    {\n      _useItem.checked = true;\n      _item.setId(q.value("item_id"));\n    }\n  }\n  else\n    xtte.errorCheck(q);\n}\n\n// Initialize\n_item.setQuery(xtte.itemSql);\n_useItem.checked = false;\n\n// Connections\nmydialog["finished(int)"].connect(xtte.task.save);\n\n	
121	timeExpenseSheets	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\ndebugger;\n\ninclude("xtte");\n\n// Define Variables\nxtte.timeExpenseSheets = new Object;\n\nvar _all               = mywindow.findChild("_all");\nvar _close             = mywindow.findChild("_close");\nvar _query             = mywindow.findChild("_query");\nvar _new               = mywindow.findChild("_new");\nvar _print             = mywindow.findChild("_print");\nvar _sheets            = mywindow.findChild("_sheets");\nvar _selected          = mywindow.findChild("_selected");\nvar _approve           = mywindow.findChild("_approve");\nvar _process           = mywindow.findChild("_process");\nvar _weekending        = mywindow.findChild("_weekending");\nvar _showAllEmployees  = mywindow.findChild("_showAllEmployees");\nvar _showDirectReports = mywindow.findChild("_showDirectReports");\nvar _employee          = mywindow.findChild("_employee");\nvar _manager           = mywindow.findChild("_manager");\nvar _selected          = mywindow.findChild("_selected");\nvar _open              = mywindow.findChild("_open");\nvar _approved          = mywindow.findChild("_approved");\nvar _closed            = mywindow.findChild("_closed");\nvar _invoice           = mywindow.findChild("_invoice");\nvar _voucher           = mywindow.findChild("_voucher");\nvar _post              = mywindow.findChild("_post");\n\n// Set up columns\n_sheets.addColumn(qsTr("Sheet#"), XTreeWidget.orderColumn, Qt.AlignLeft,    true, "tehead_number");\n_sheets.addColumn(qsTr("Date"),   XTreeWidget.dateColumn, Qt.AlignLeft,    true, "tehead_weekending");\n_sheets.addColumn(qsTr("Employee"),   -1, Qt.AlignLeft,    true, "emp_code");\n_sheets.addColumn(qsTr("Status"),     XTreeWidget.bigMoneyColumn, Qt.AlignCenter, true, "tehead_status");\nif (privileges.check("CanViewRates")) {\n  _sheets.addColumn(qsTr("To Invoice"),   XTreeWidget.bigMoneyColumn, Qt.AlignLeft,    true, "total_i");\n  _sheets.addColumn(qsTr("To Voucher"),   XTreeWidget.bigMoneyColumn, Qt.AlignLeft,    true, "total_e");\n}\n_sheets.addColumn(qsTr("Invoiced"), XTreeWidget.dateColumn, Qt.AlignLeft, true, "invoiced");\n_sheets.addColumn(qsTr("Vouchered"),XTreeWidget.dateColumn, Qt.AlignLeft, true, "vouchered");\n_sheets.addColumn(qsTr("Posted"),   XTreeWidget.dateColumn, Qt.AlignLeft, true, "posted");\n\nxtte.timeExpenseSheets.populateMenu = function(pMenu, pItem, pCol)\n{\n  var tmpact;\n\n  if(pMenu == null)\n    pMenu = _sheets.findChild("_menu");\n\n  if(pMenu != null)\n  {\n    var currentItem  = _sheets.currentItem();\n    var selected = _sheets.selectedItems();\n\n    if (currentItem != null)\n    {\n      if (selected.length == 1) // Can only handle editing for a single select\n      {\n        var status = currentItem.rawValue("tehead_status");\n\n        tmpact = pMenu.addAction(qsTr("Print"));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.printSheet);\n\n        pMenu.addSeparator();\n\n        tmpact = pMenu.addAction(qsTr("Edit..."));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.editSheet);\n        tmpact.enabled = (status == 'O' && privileges.check("MaintainTimeExpense"));\n \n        tmpact = pMenu.addAction(qsTr("View..."));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.viewSheet);\n  \n        tmpact = pMenu.addAction(qsTr("Delete"));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.deleteSheet);\n        tmpact.enabled = (status == 'O' && privileges.check("MaintainTimeExpense"));\n      }\n\n      if (xtte.timeExpenseSheets.canApprove(selected))\n      {\n        pMenu.addSeparator();\n        tmpact = pMenu.addAction(qsTr("Approve"));\n        tmpact.enabled = privileges.check("CanApprove");\n        tmpact.triggered.connect(xtte.timeExpenseSheets.approveSheets);\n      }\n      else if (xtte.timeExpenseSheets.canUnapprove(selected))\n      {\n        pMenu.addSeparator();\n        tmpact = pMenu.addAction(qsTr("Unapprove"));\n        tmpact.enabled = privileges.check("CanApprove");\n        tmpact.triggered.connect(xtte.timeExpenseSheets.unapproveSheets);\n      }\n\n      if (status == 'A' || status == 'O')\n      {\n        tmpact = pMenu.addAction(qsTr("Close"));\n        tmpact.enabled = privileges.check("MaintainTimeExpense");\n        tmpact.triggered.connect(xtte.timeExpenseSheets.closeSheet);\n      }\n\n      if (status == 'C')\n      {\n        tmpact = pMenu.addAction(qsTr("Reopen"));\n        tmpact.enabled = privileges.check("ReopenTimeExpense");\n        tmpact.triggered.connect(xtte.timeExpenseSheets.reopenSheet);\n      }\n\n      if ((xtte.timeExpenseSheets.canProcess("invoiced", selected)) ||\n          (xtte.timeExpenseSheets.canProcess("vouchered", selected)) ||\n          (xtte.timeExpenseSheets.canProcess("posted", selected)))\n        pMenu.addSeparator();\n\n      if (xtte.timeExpenseSheets.canProcess("invoiced", selected))\n      {\n        tmpact = pMenu.addAction(qsTr("Invoice"));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.invoiceSheets);\n        tmpact.enabled = privileges.check("allowInvoicing");\n      }\n\n      if (xtte.timeExpenseSheets.canProcess("vouchered", selected))\n      {\n        tmpact = pMenu.addAction(qsTr("Voucher"));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.voucherSheets);\n        tmpact.enabled = privileges.check("allowVouchering");\n      }\n\n      if (xtte.timeExpenseSheets.canProcess("posted", selected))\n      {\n        tmpact = pMenu.addAction(qsTr("Post Time"));\n        tmpact.triggered.connect(xtte.timeExpenseSheets.postSheets);\n        tmpact.enabled = privileges.check("PostTimeSheets");\n      }\n    }\n  }\n}\n\nxtte.timeExpenseSheets.canApprove = function(selected)\n{\n  for (var i = 0; i < selected.length; i++)\n  {\n     if (selected[i].rawValue("tehead_status") != 'O')\n       return false;\n  }\n  return true;\n}\n\nxtte.timeExpenseSheets.canUnapprove = function(selected)\n{\n  for (var i = 0; i < selected.length; i++)\n  {\n     if ((selected[i].rawValue("tehead_status") != 'A') ||\n         (selected[i].rawValue("posted") > 0) ||\n         (selected[i].rawValue("vouchered") > 0) ||\n         (selected[i].rawValue("invoiced") > 0))\n       return false;\n  }\n  return true;\n}\n\nxtte.timeExpenseSheets.canProcess = function(process, selected)\n{\n  for (var i = 0; i < selected.length; i++)\n  {\n     if ((selected[i].rawValue("tehead_status") != 'A') ||\n         (selected[i].rawValue(process) != 0))\n       return false;\n  }\n  return true;\n}\n\nxtte.timeExpenseSheets.approve = function()\n{\n  toolbox.executeBegin();\n  for (var i = 0; i < _sheets.topLevelItemCount; i++)\n  {\n    var item = _sheets.topLevelItem(i);\n    if (item.rawValue("tehead_status") == "O")\n    {\n      var params   = new Object();\n      params.tehead_id = item.id(); \n \n      q = toolbox.executeDbQuery("timeexpensesheets", "approve", params );\n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();\n        return;\n      }\n    } \n  }\n  toolbox.executeCommit();\n  xtte.timeExpenseSheets.fillList();\n}\n\nxtte.timeExpenseSheets.approveSheets = function()\n{\n  toolbox.executeBegin();\n  var selected = _sheets.selectedItems();\n  for (var i = 0; i < selected.length; i++)\n  {\n    var params   = new Object();\n    params.tehead_id = selected[i].id();    \n\n    q = toolbox.executeDbQuery("timeexpensesheets", "approve", params );        \n    if (!xtte.errorCheck(q))\n    {\n      toolbox.executeRollback();\n      return;\n    }\n  }\n  toolbox.executeCommit();\n  xtte.timeExpenseSheets.fillList(); \n}\n\nxtte.timeExpenseSheets.unapproveSheets = function()\n{\n  toolbox.executeBegin();\n  var selected = _sheets.selectedItems();\n  for (var i = 0; i < selected.length; i++)\n  {\n    var params   = new Object();\n    params.tehead_id = selected[i].id();    \n\n    q = toolbox.executeDbQuery("timeexpensesheets", "unapprove", params );      \n    if (!xtte.errorCheck(q))\n    {\n      toolbox.executeRollback();\n      return;\n    }\n  }\n  toolbox.executeCommit();\n  xtte.timeExpenseSheets.fillList(); \n}\n\n\nxtte.timeExpenseSheets.invoiceSheets = function()\n{\n  xtte.timeExpenseSheets.processSheets(_sheets.selectedItems(), true, false, false);\n} \n\nxtte.timeExpenseSheets.voucherSheets = function()\n{\n  xtte.timeExpenseSheets.processSheets(_sheets.selectedItems(), false, true, false);\n}\n\nxtte.timeExpenseSheets.postSheets = function()\n{    \n  xtte.timeExpenseSheets.processSheets(_sheets.selectedItems(), false, false, true);\n}\n\nxtte.timeExpenseSheets.process = function()\n{\n  toolbox.executeBegin();\n\n  // First loop through and invoice\n  if (_invoice.checked)\n  {\n    var ids = [];\n    for (var i = 0; i < _sheets.topLevelItemCount; i++)\n    {\n      var item = _sheets.topLevelItem(i);\n      if ((item.rawValue("tehead_status") == 'A') &&\n          (item.rawValue("invoiced") == 0)) \n        ids[i] = item.id();\n    }\n\n    if (ids.length)\n    {\n      var params   = new Object();\n      params.tehead_ids = ids;    \n\n      q = toolbox.executeDbQuery("timeexpensesheets", "invoice", params );      \n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();\n        return;\n      }\n    }\n  }\n\n  // Now loop through and do the others\n  for (var i = 0; i < _sheets.topLevelItemCount; i++)\n  {\n    var item = _sheets.topLevelItem(i);\n    var params   = new Object();\n    params.tehead_id = item.id();  \n\n    if ((_voucher.checked) && \n        (item.rawValue("tehead_status") == 'A') &&\n        (item.rawValue("vouchered") == 0))\n    {\n      q = toolbox.executeDbQuery("timeexpensesheets", "voucher", params );      \n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();\n        return;\n      }\n    }\n\n    if ((_post.checked) && \n        (item.rawValue("tehead_status") == 'A') &&\n        (item.rawValue("posted") == 0))\n    {\n      if (metrics.value("PrjLaborAndOverhead") - 0 <= 0)\n      {\n        QMessageBox.critical(mywindow, qsTr("Setup Error"),\n                         qsTr("No Labor and Overhead Account defined in CRM Setup."));\n        {\n          toolbox.executeRollback();\n          return;\n        }\n      }\n\n      params.phrase1 = qsTr("Post Time Sheet for ");\n      params.phrase2 = qsTr(" to Project");\n\n      q = toolbox.executeDbQuery("timeexpensesheets", "post", params );   \n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();\n        return;\n      }\n    } \n  }\n\n  toolbox.executeCommit();\n\n  if (_invoice.checked)\n    mainwindow.invoicesUpdated(1, true);\n\n  if (_voucher.checked)\n    mainwindow.vouchersUpdated();\n\n  if (_post.checked)\n    mainwindow.glSeriesUpdated();\n\n  xtte.timeExpenseSheets.fillList();\n}\n\nxtte.timeExpenseSheets.processSheets = function(selected, invoice, voucher, post)\n{\n  toolbox.executeBegin();\n  if (invoice)\n  { \n    // Prompt for invoice date\n    var invcdate = mainwindow.dbDate();\n    var params = new Object();\n    params.label = "Invoice Date";\n    var newdlg = toolbox.openWindow("XDateInputDialog", mywindow, Qt.ApplicationModal, Qt.Dialog);\n    toolbox.lastWindow().set(params);\n    var returnval = newdlg.exec();\n    if (returnval == 1)\n    {\n      var invcdate = newdlg.getDate();\n    }\n\n    // Create an array so invoices can be consolidated\n    var ids = [];\n    for (var i = 0; i < selected.length; i++)\n      ids[i] = selected[i].id();\n      \n    var params   = new Object();\n    params.tehead_ids = ids;\n    params.invchead_invcdate = invcdate;\n\n    q = toolbox.executeDbQuery("timeexpensesheets", "invoice", params );        \n    if (!xtte.errorCheck(q))\n    {\n      toolbox.executeRollback();\n      return false;\n    }\n  }\n\n  for (var i = 0; i < selected.length; i++)\n  {\n    var params   = new Object();\n    params.tehead_id = selected[i].id();  \n\n    if (voucher)\n    {\n      q = toolbox.executeDbQuery("timeexpensesheets", "voucher", params );      \n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();\n        return false;\n      }\n    }\n\n    if (post)\n    {\n      if (metrics.value("PrjLaborAndOverhead") - 0 <= 0)\n      {\n        QMessageBox.critical(mywindow, qsTr("Setup Error"),\n                         qsTr("No Labor and Overhead Account defined in CRM Setup."));\n        {\n          toolbox.executeRollback();\n          return false;\n        }\n      }\n\n      params.phrase1 = qsTr("Post Time Sheet for ");\n      params.phrase2 = qsTr(" to Project");\n\n      q = toolbox.executeDbQuery("timeexpensesheets", "post", params );   \n      if (!xtte.errorCheck(q))\n      {\n        toolbox.executeRollback();   \n        return false;\n      }\n    }\n  }\n   \n  toolbox.executeCommit();\n\n  if (invoice)\n    mainwindow.invoicesUpdated(1, true);\n\n  if (voucher)\n    mainwindow.vouchersUpdated();\n\n  if (post)\n    mainwindow.glSeriesUpdated();\n\n  xtte.timeExpenseSheets.fillList(); \n  \n  return true;\n}\n\nxtte.timeExpenseSheets.deleteSheet = function()\n{\n  var msg = qsTr("This action can not be undone.  Are you sure you want to delete this Worksheet?");\n  if (QMessageBox.question( mywindow, mywindow.windowTitle, msg, \n      QMessageBox.Yes | QMessageBox.Escape, QMessageBox.No | QMessageBox.Default) == QMessageBox.Yes)\n  {\n    var params   = new Object();\n    params.tehead_id = _sheets.id();    \n\n    toolbox.executeDbQuery("timeexpensesheet", "deltehead", params );\n\n    xtte.timeExpenseSheets.fillList();\n  }\n}\n\nxtte.timeExpenseSheets.closeSheet = function()\n{\n  var msg = qsTr("Are you sure you want to close this Worksheet?");\n  if (QMessageBox.question( mywindow, mywindow.windowTitle, msg, \n      QMessageBox.Yes | QMessageBox.Escape, QMessageBox.No | QMessageBox.Default) == QMessageBox.Yes)\n  {\n    var params   = new Object();\n    params.tehead_id = _sheets.id();    \n\n    q = toolbox.executeDbQuery("timeexpensesheets", "close", params );  \n    if (xtte.errorCheck(q))\n      xtte.timeExpenseSheets.fillList(); \n  }\n}\n\nxtte.timeExpenseSheets.reopenSheet = function()\n{\n  var msg = qsTr("Are you sure you want to reopen this Worksheet?");\n  if (QMessageBox.question( mywindow, mywindow.windowTitle, msg, \n      QMessageBox.Yes | QMessageBox.Escape, QMessageBox.No | QMessageBox.Default) == QMessageBox.Yes)\n  {\n    var params   = new Object();\n    params.tehead_id = _sheets.id();    \n\n    q = toolbox.executeDbQuery("timeexpensesheets", "reopen", params );  \n    if (xtte.errorCheck(q))\n      xtte.timeExpenseSheets.fillList(); \n  }\n}\n\nxtte.timeExpenseSheets.editSheet = function()\n{\n  if (_sheets.currentItem().rawValue("tehead_status") == 'O')\n    xtte.timeExpenseSheets.openSheet(xtte.editMode);\n  else\n    xtte.timeExpenseSheets.openSheet(xtte.viewMode);\n}\n\nxtte.timeExpenseSheets.newSheet = function()\n{\n  xtte.timeExpenseSheets.openSheet(xtte.newMode);\n}\n\nxtte.timeExpenseSheets.viewSheet = function()\n{\n  xtte.timeExpenseSheets.openSheet(xtte.viewMode);\n}\n\nxtte.timeExpenseSheets.openSheet = function(mode)\n{\n  var params   = new Object();\n  params.mode   = mode;\n  if (mode) // Not new\n    params.tehead_id = _sheets.id();\n  else // New\n  {\n    if (_selected)\n      params.emp_id = _employee.id();\n  }\n\n  var te = toolbox.openWindow("timeExpenseSheet", mywindow, Qt.ApplicationModal);\n  toolbox.lastWindow().set(params);\n  te.exec();\n  xtte.timeExpenseSheets.fillList();\n}\n\nxtte.timeExpenseSheets.getParams = function()\n{\n  params = new Object();\n\n  if (!_open.checked &&\n      !_approved.checked &&\n      !_closed.checked)\n  {\n    params.statusList = "";\n    return params;\n  }\n\n  params.startDate = _weekending.startDate;\n  params.endDate   = _weekending.endDate;\n  if (_selected.checked)\n    params.emp_id  = _employee.id();\n  if (_showDirectReports.checked)\n    params.mgr_emp_id  = _manager.id();\n\n  var statusList = [];\n  var num = 0;\n  \n  if (_open.checked)\n  {\n    statusList[num] = "'O'";\n    num = num + 1;\n  }\n  if (_approved.checked)\n  {\n    statusList[num] = "'A'";\n    num = num + 1;\n  }\n  if (_closed.checked)\n    statusList[num] = "'C'";\n  \n  params.statusList  = statusList.toString();\n  params.approved  = qsTr("Approved");\n  params.closed    = qsTr("Closed");\n  params.open      = qsTr("Open");\n  params.yes       = qsTr("Yes");\n  params.no        = qsTr("No");\n  params.na        = qsTr("N/A");\n\n  return params;\n}\n\n\nxtte.timeExpenseSheets.fillList = function()\n{ \n  var params = xtte.timeExpenseSheets.getParams();\n  if (!params.statusList.length)\n    return;\n\n  q = toolbox.executeDbQuery("timeexpensesheets","detail", params);\n\n  _sheets.populate(q);\n  if (!xtte.errorCheck(q))\n    return;\n}\n\nxtte.timeExpenseSheets.printSheet = function()\n{\n  params = xtte.timeExpenseSheets.getParams();\n  params.tehead_id = _sheets.id();\n  toolbox.printReport("TimeExpenseSheet",params);\n}\n\nxtte.timeExpenseSheets.printReport = function()\n{\n  var params = xtte.timeExpenseSheets.getParams();\n  params.includeFormatted = true;\n\n  toolbox.printReport("TimeExpenseSheets",params);\n}\n\nxtte.timeExpenseSheets.populateEmployees = function()\n{\n  // getEffectiveXtUser and crmacct_emp_id were created in the same release\n  var q = toolbox.executeQuery("SELECT crmacct_emp_id AS emp_id"\n                             + "  FROM crmacct "\n                             + " WHERE crmacct_usr_username = getEffectiveXtUser();");\n  // if they don't exist, try the older relationship maintained in the emp table\n  if (q.lastError().type != QSqlError.NoError)\n      q = toolbox.executeQuery("SELECT emp_id "\n                             + "  FROM emp "\n                             + " WHERE emp_username = CURRENT_USER;");\n\n  if (q.first())\n  {\n    _employee.setId(q.value("emp_id"));\n    _manager.setId(q.value("emp_id"));\n  }\n\n  if (privileges.check("MaintainTimeExpenseOthers"))\n  {\n    _showAllEmployees.visible = true;\n    _showDirectReports.visible = true;\n    _manager.visible = true;\n  }\n  else\n  {\n    _showAllEmployees.visible = false;\n    _showDirectReports.visible = false;\n    _manager.visible = false;\n    _employee.enabled = false;\n    if (privileges.check("MaintainTimeExpenseSelf"))\n    {\n      if (_employee.id() == -1)\n        QMessageBox.critical(mywindow, mywindow.windowTitle, \n                    qsTr("It appears that your current user isn't an active employee.") );                                            \n    }\n    else\n    {\n      QMessageBox.critical(mywindow, qsTr("Permissions Error"),\n                    qsTr("You do not have permissions to maintain Worksheet entries"));\n      if (mywindow.windowModality)\n        mydialog.reject();\n      else\n        mywindow.close();\n    }\n  }\n}\n\n// Initialize\n_weekending.setStartNull(qsTr("Earliest"), startOfTime, true);\n_weekending.setEndNull(qsTr("Latest"),     endOfTime,   true);\n\n_approve.enabled = privileges.check("CanApprove");\n_selected.checked = true;\n_showAllEmployees.visible = false;\n_showDirectReports.visible = false;\n_manager.visible = false;\n//_manager.enabled = false;\n\nif (!privileges.check("allowInvoicing"))\n{\n  _invoice.forgetful = true;\n  _invoice.checked = false;\n  _invoice.enabled = false;\n}\n\nif (!privileges.check("allowVouchering"))\n{\n  _voucher.forgetful = true;\n  _voucher.checked = false;\n  _voucher.enabled = false;\n}\n\nif (!privileges.check("PostTimeSheets"))\n{\n  _post.forgetful = true;\n  _post.checked = false;\n  _post.enabled = false;\n}\n\n// Make connections\n_new.triggered.connect(xtte.timeExpenseSheets.newSheet);\n_close.triggered.connect(mywindow, "close");\n_approve.triggered.connect(xtte.timeExpenseSheets.approve);\n_process.triggered.connect(xtte.timeExpenseSheets.process);\n_print.triggered.connect(xtte.timeExpenseSheets.printReport);\n_query.triggered.connect(xtte.timeExpenseSheets.fillList);\n\n_selected["toggled(bool)"].connect(_employee["setEnabled(bool)"]);\n_employee["newId(int)"].connect(xtte.timeExpenseSheets.fillList);\n\n_showDirectReports["toggled(bool)"].connect(_manager["setEnabled(bool)"]);\n_manager["newId(int)"].connect(xtte.timeExpenseSheets.fillList);\n\nmainwindow.invoicesUpdated.connect(xtte.timeExpenseSheets.fillList);\nmainwindow.vouchersUpdated.connect(xtte.timeExpenseSheets.fillList);\n\n_sheets["populateMenu(QMenu *, XTreeWidgetItem *, int)"].connect(xtte.timeExpenseSheets.populateMenu);\nif (privileges.check("MaintainTimeExpense"))\n  _sheets.itemSelected.connect(xtte.timeExpenseSheets.editSheet);\nelse\n{\n  _new.enabled = false;\n  _sheets.itemSelected.connect(xtte.timeExpenseSheets.viewSheet);\n}\n\nxtte.timeExpenseSheets.populateEmployees();\n	
122	xtte	0	t	/*\n * This file is part of the xtte package for xTuple ERP: PostBooks Edition, a free and\n * open source Enterprise Resource Planning software suite,\n * Copyright (c) 1999-2012 by OpenMFG LLC, d/b/a xTuple.\n * It is licensed to you under the Common Public Attribution License\n * version 1.0, the full text of which (including xTuple-specific Exhibits)\n * is available at www.xtuple.com/CPAL.  By using this software, you agree\n * to be bound by its terms.\n */\n\nvar xtte;\nif (!xtte)\n  xtte = new Object;\n\nxtte.itemSql = "SELECT item_id,item_number,item_descrip1,item_descrip2, "\n             + "       item_type,item_config,item_upccode, item_active,uom_name "\n             + "FROM item JOIN uom ON (uom_id=item_inv_uom_id) "\n             + "          JOIN te.teexp ON (teexp_id=item_id) "\n             + "WHERE item_type='R' "\n\nxtte.newMode \t= 0;\nxtte.editMode\t= 1;\nxtte.viewMode\t= 2;\n\nxtte.errorCheck = function (q)\n{\n  if (q.lastError().type != QSqlError.NoError)\n  {\n    QMessageBox.critical(mywindow,\n                        qsTr("Database Error"), q.lastError().text);\n    return false;\n  }\n\n  return true;\n}\n	
\.


--
