<!DOCTYPE openRPTDef>
<report>
 <title>Unposted G/L Transactions</title>
 <name>UnpostedGLTransactions</name>
 <description></description>
 <size>Letter</size>
 <landscape/>
 <topmargin>50</topmargin>
 <bottommargin>50</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>head</name>
  <sql>&lt;? if exists("period_id") ?>
SELECT formatDate(period_start, 'Earliest') AS startdate,
       formatDate(period_end, 'Latest') AS enddate,
       period_name
FROM period
WHERE (period_id=&lt;? value("period_id") ?>);
&lt;? else ?>
SELECT 'Earliest' AS startdate,
       'Latest' AS enddate,
       'All Periods' AS period_name;
&lt;? endif ?></sql>
 </querysource>
 <querysource>
  <name>detail</name>
  <sql>SELECT gltrans_id,
       formatDate(gltrans_date) AS transdate,
       gltrans_source,
       gltrans_doctype,
       gltrans_docnumber,
       invhist_docnumber,
       firstLine(gltrans_notes) AS transnotes,
       (formatGLAccount(accnt_id) || ' - ' || accnt_descrip) AS account,
-- Debits:
       CASE WHEN (gltrans_amount &lt; 0) THEN formatMoney(ABS(gltrans_amount))
            ELSE ''
       END AS f_debit,       
       CASE WHEN (gltrans_amount &lt; 0) THEN ABS(gltrans_amount)
            ELSE 0
       END AS debit_amt, 
--Credits:
       CASE WHEN (gltrans_amount > 0) THEN formatMoney(gltrans_amount)
            ELSE ''
       END AS f_credit,
       CASE WHEN (gltrans_amount > 0) THEN gltrans_amount
            ELSE 0
       END AS credit_amt,
--Balance:
       gltrans_amount * -1 as balance_amt
--
  FROM period, gltrans JOIN accnt ON (gltrans_accnt_id=accnt_id)
       LEFT OUTER JOIN invhist ON (gltrans_misc_id=invhist_id AND gltrans_docnumber='Misc.')
WHERE (NOT gltrans_posted
  AND (NOT gltrans_deleted)
  AND  (gltrans_date BETWEEN period_start AND period_end)
&lt;? if exists("period_id") ?>
  AND  (period_id=&lt;? value("period_id") ?>)
&lt;? endif ?>
)
ORDER BY gltrans_created, gltrans_sequence, gltrans_amount;</sql>
 </querysource>
 <rpthead>
  <height>205</height>
  <label>
   <rect>
    <x>65</x>
    <y>185</y>
    <width>60</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Source</string>
  </label>
  <label>
   <rect>
    <x>0</x>
    <y>185</y>
    <width>40</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Date</string>
  </label>
  <label>
   <rect>
    <x>310</x>
    <y>185</y>
    <width>105</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Reference</string>
  </label>
  <field>
   <rect>
    <x>545</x>
    <y>70</y>
    <width>200</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>startdate</column>
   </data>
  </field>
  <label>
   <rect>
    <x>408</x>
    <y>70</y>
    <width>130</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Start Date:</string>
  </label>
  <field>
   <rect>
    <x>140</x>
    <y>70</y>
    <width>290</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>period_name</column>
   </data>
  </field>
  <label>
   <rect>
    <x>204</x>
    <y>185</y>
    <width>55</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. #</string>
  </label>
  <label>
   <rect>
    <x>125</x>
    <y>185</y>
    <width>55</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. Type</string>
  </label>
  <label>
   <rect>
    <x>605</x>
    <y>185</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Debit</string>
  </label>
  <label>
   <rect>
    <x>408</x>
    <y>90</y>
    <width>130</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>End Date:</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>70</y>
    <width>130</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Period:</string>
  </label>
  <label>
   <rect>
    <x>720</x>
    <y>185</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Credit</string>
  </label>
  <field>
   <rect>
    <x>545</x>
    <y>90</y>
    <width>200</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>enddate</column>
   </data>
  </field>
  <line>
   <xstart>0</xstart>
   <ystart>200</ystart>
   <xend>1000</xend>
   <yend>200</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>310</x>
    <y>170</y>
    <width>105</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Account</string>
  </label>
  <label>
   <rect>
    <x>535</x>
    <y>5</y>
    <width>465</width>
    <height>38</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Unposted G/L Transactions</string>
  </label>
 </rpthead>
 <pghead>
  <firstpage/>
  <height>5</height>
 </pghead>
 <pghead>
  <height>45</height>
  <label>
   <rect>
    <x>720</x>
    <y>25</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Credit</string>
  </label>
  <label>
   <rect>
    <x>310</x>
    <y>25</y>
    <width>105</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Reference</string>
  </label>
  <line>
   <xstart>0</xstart>
   <ystart>40</ystart>
   <xend>1000</xend>
   <yend>40</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>0</x>
    <y>25</y>
    <width>40</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Date</string>
  </label>
  <label>
   <rect>
    <x>65</x>
    <y>25</y>
    <width>60</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Source</string>
  </label>
  <label>
   <rect>
    <x>204</x>
    <y>25</y>
    <width>55</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. #</string>
  </label>
  <label>
   <rect>
    <x>310</x>
    <y>10</y>
    <width>105</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Account</string>
  </label>
  <label>
   <rect>
    <x>125</x>
    <y>25</y>
    <width>55</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. Type</string>
  </label>
  <label>
   <rect>
    <x>605</x>
    <y>25</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Debit</string>
  </label>
 </pghead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>31</height>
   <field>
    <rect>
     <x>310</x>
     <y>0</y>
     <width>270</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>account</column>
    </data>
   </field>
   <field>
    <rect>
     <x>12500</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>gltrans_doctype</column>
    </data>
   </field>
   <field>
    <rect>
     <x>208</x>
     <y>15</y>
     <width>95</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>invhist_docnumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>0</x>
     <y>0</y>
     <width>60</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>transdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>125</x>
     <y>0</y>
     <width>100</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>gltrans_doctype</column>
    </data>
   </field>
   <field>
    <rect>
     <x>204</x>
     <y>0</y>
     <width>100</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>gltrans_docnumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>310</x>
     <y>15</y>
     <width>265</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>transnotes</column>
    </data>
   </field>
   <field>
    <rect>
     <x>720</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_credit</column>
    </data>
   </field>
   <field>
    <rect>
     <x>65</x>
     <y>0</y>
     <width>60</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>gltrans_source</column>
    </data>
   </field>
   <field>
    <rect>
     <x>605</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_debit</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <lastpage/>
  <height>75</height>
  <field>
   <rect>
    <x>835</x>
    <y>25</y>
    <width>105</width>
    <height>14</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <top/>
   <data>
    <query>detail</query>
    <column>balance_amt</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
  <label>
   <rect>
    <x>835</x>
    <y>10</y>
    <width>55</width>
    <height>14</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <top/>
   <string>Balance:</string>
  </label>
  <label>
   <rect>
    <x>580</x>
    <y>10</y>
    <width>55</width>
    <height>14</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <top/>
   <string>Total:</string>
  </label>
  <line>
   <xstart>605</xstart>
   <ystart>5</ystart>
   <xend>1015</xend>
   <yend>5</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>0</x>
    <y>60</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Report Date:</string>
  </label>
  <field>
   <rect>
    <x>960</x>
    <y>60</y>
    <width>40</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>page_number</column>
   </data>
  </field>
  <field>
   <rect>
    <x>90</x>
    <y>60</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>report_date</column>
   </data>
  </field>
  <field>
   <rect>
    <x>720</x>
    <y>25</y>
    <width>105</width>
    <height>14</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <top/>
   <data>
    <query>detail</query>
    <column>credit_amt</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
  <label>
   <rect>
    <x>868</x>
    <y>60</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Page:</string>
  </label>
  <field>
   <rect>
    <x>605</x>
    <y>25</y>
    <width>105</width>
    <height>14</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <top/>
   <data>
    <query>detail</query>
    <column>debit_amt</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
 </pgfoot>
 <pgfoot>
  <height>15</height>
  <label>
   <rect>
    <x>868</x>
    <y>0</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Page:</string>
  </label>
  <field>
   <rect>
    <x>960</x>
    <y>0</y>
    <width>40</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>page_number</column>
   </data>
  </field>
  <label>
   <rect>
    <x>0</x>
    <y>0</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Report Date:</string>
  </label>
  <field>
   <rect>
    <x>90</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>report_date</column>
   </data>
  </field>
 </pgfoot>
</report>
