<?xml version="1.0" encoding="utf-8" standalone="no"?>
<TfrxReport Version="6.9.2" DotMatrixReport="False" EngineOptions.SilentMode="True" EngineOptions.NewSilentMode="simSilent" IniFile="\Software\Fast Reports" PreviewOptions.Buttons="12287" PreviewOptions.Modal="False" PreviewOptions.Zoom="1" PrintOptions.Printer="Default" PrintOptions.PrintOnSheet="0" ReportOptions.CreateDate="41546.6611873611" ReportOptions.Description.Text="" ReportOptions.LastChange="43252.4712836458" ScriptLanguage="PascalScript" ScriptText.Text="&#13;&#10;procedure DialogPage1OnActivate(Sender: TfrxComponent);&#13;&#10;begin&#13;&#10;&#13;&#10;&#13;&#10;  qry_stock.close ;&#13;&#10;  qry_stock.open ;&#13;&#10;&#13;&#10;  date1.date:=now ;&#13;&#10;  date2.date:=now ;&#13;&#10;&#13;&#10;  cbb_stock.keyvalue:=&#60;MY_STOCK_CODE&#62; ;&#13;&#10;&#13;&#10;&#13;&#10;&#13;&#10;end;&#13;&#10;&#13;&#10;procedure DialogPage1OnShow(Sender: TfrxComponent);&#13;&#10;begin&#13;&#10;&#13;&#10;end;&#13;&#10;&#13;&#10;&#13;&#10;&#13;&#10;&#13;&#10;&#13;&#10;begin&#13;&#10;&#13;&#10;end." OnReportPrint="DialogPage1OnActivate">
  <Datasets>
    <item DataSet="qry_rp" DataSetName="rp"/>
    <item DataSet="qry_stock" DataSetName="stock"/>
  </Datasets>
  <Variables>
    <item Name="MY_STOCK_CODE"/>
    <item Name="MY_STOCK_NAME"/>
  </Variables>
  <TfrxDataPage Name="Data" HGuides.Text="" VGuides.Text="" Height="1000" Left="0" Top="0" Width="1000">
    <TfrxUniDACQuery Name="qry_rp" UserName="rp" CloseDataSource="True" FieldAliases.Text="" BCDToCurrency="False" IgnoreDupParams="False" SQL.Text="{select b.DEPT_NAME,a.TOTAL_VALUE,a.SUB_PO_NO    &#13;&#10;from sm_po a&#13;&#10;left outer join dept_id b on a.DEPT_ID=b.DEPT_ID&#13;&#10;where CONFIRM_DATE between :date3 and :date4       &#13;&#10;and a.STOCK_ID=:stock  &#13;&#10;and a.DEPT_ID in('BAK01','BAP01','BAR01','CON01','LAM01','NAR01','WEY01')&#13;&#10;group by b.DEPT_NAME&#13;&#10;order by b.DEPT_NAME }&#13;&#10;&#13;&#10; select d.DEPT_NAME,  c.DEPT_ID,&#13;&#10;/*COUNT(CASE when IS_ED(g.IS_ED)='ED' then c.TRADE_CODE else NULL end) as ED_ITEM,&#13;&#10;COUNT(CASE when IS_ED(g.IS_ED)&#60;&#62;'ED' then c.TRADE_CODE else NULL end) as NED_ITEM,  &#13;&#10;COUNT(c.TRADE_CODE) as ALL_ITEM,&#13;&#10;SUM(CASE when IS_ED(g.IS_ED)='ED' then  c.VALUE else NULL end)  as ED_AMT,&#13;&#10;SUM(CASE when IS_ED(g.IS_ED)&#60;&#62;'ED' then  c.VALUE else NULL end)   as NED_AMT,  */  &#13;&#10;SUM(c.VALUE) as TOTAL_VALUE  &#13;&#10;/*COUNT(DISTINCT c.R_S_NUMBER) as REQ */&#13;&#10;from&#13;&#10;(  &#13;&#10;select c1.DEPT_ID,c1.WORKING_CODE,c1.TRADE_CODE,CASE when c1.R_S_STATUS in ('T','S')  then c1.VALUE&#13;&#10;when (c1.R_S_STATUS='C') then c1.VALUE*-1 else NULL end as 'VALUE',c1.R_S_NUMBER                                 &#13;&#10;from CARD c1 &#13;&#10;where            &#13;&#10;c1.STOCK_ID=:stock&#13;&#10;and c1.R_S_DATE between :date3 and :date4&#13;&#10;and c1.R_S_STATUS in ( 'T','S','C')                                     &#13;&#10;)  &#13;&#10;as c &#13;&#10;left join DEPT_ID d  on (c.DEPT_ID = d.DEPT_ID)&#13;&#10;left join DRUG_GN g  on (c.WORKING_CODE=g.WORKING_CODE)&#13;&#10;where d.DEPT_ID in('BAK01','BAP01','BAR01','CON01','LAM01','NAR01','WEY01')&#13;&#10;and  d.DEPT_NAME is not null    &#13;&#10;group by d.DEPT_NAME ,c.DEPT_ID       &#13;&#10;order by d.DEPT_NAME    &#13;&#10;&#13;&#10;    " SpecificOptions.Text="" PropData="05704C65667403A0000470546F7002240A506172616D657465727301010654204E616D653D226461746533222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465312E64617465292200010654204E616D653D226461746534222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465322E64617465292200010641204E616D653D2273746F636B222044617461547970653D226674537472696E67222045787072657373696F6E3D226362625F73746F636B2E6B657976616C75652200010641204E616D653D2273746F636B222044617461547970653D226674537472696E67222045787072657373696F6E3D226362625F73746F636B2E6B657976616C75652200010654204E616D653D226461746533222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465312E64617465292200010654204E616D653D226461746534222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465322E6461746529220000"/>
    <TfrxUniDACQuery Name="qry_stock" UserName="stock" CloseDataSource="True" FieldAliases.Text="" BCDToCurrency="False" IgnoreDupParams="False" SQL.Text="{IF SQLSERVER}  &#13;&#10;select * from DEPT_ID (NOLOCK) where (HIDE='' or HIDE is null or HIDE='N' )&#13;&#10;and INV_TYPE='99'&#13;&#10;{ELSE} &#13;&#10;  select * from DEPT_ID  where (HIDE='' or HIDE is null or HIDE='N' )&#13;&#10;and INV_TYPE='99'&#13;&#10;order by dept_name             &#13;&#10;{ENDIF}    " SpecificOptions.Text="" PropData="05704C65667403A4000470546F700380000A506172616D65746572730100"/>
  </TfrxDataPage>
  <TfrxReportPage Name="Page1" HGuides.Text="" VGuides.Text="" PaperWidth="210" PaperHeight="297" PaperSize="9" LeftMargin="10" RightMargin="10" TopMargin="10" BottomMargin="10" ColumnWidth="0" ColumnPositions.Text="" Frame.Typ="0" MirrorMode="0">
    <TfrxPageFooter Name="PageFooter1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Frame.Typ="0" Height="30.23624" Left="0" Top="296" Width="718.1107">
      <TfrxMemoView Name="Memo1" AllowVectorExport="True" Left="647.5201" Top="1" Width="68.03154" Height="22.67718" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haRight" ParentFont="False" Text="[Page#]"/>
    </TfrxPageFooter>
    <TfrxMasterData Name="MasterData1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Frame.Typ="0" Height="30.23624" Left="0" Top="140" Width="718.1107" OnBeforePrint="MasterData1OnBeforePrint" ColumnWidth="0" ColumnGap="0" DataSet="qry_rp" DataSetName="rp" RowCount="0" Stretched="True">
      <TfrxMemoView Name="rpDEPT_NAME" AllowVectorExport="True" ShiftMode="smWhenOverlapped" Left="0" Top="1.55906" Width="332.59864" Height="26.45671" StretchMode="smActualHeight" DataSet="qry_rp" DataSetName="rp" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" ParentFont="False" Text="[Line#]. [IIF(TRIM(&#60;rp.&#34;DEPT_NAME&#34;&#62;)&#60;&#62;'',TRIM(&#60;rp.&#34;DEPT_NAME&#34;&#62;),TRIM(&#60;rp.&#34;DEPT_ID&#34;&#62;))]"/>
      <TfrxMemoView Name="rpNED_AMT" AllowVectorExport="True" Left="507.89796" Top="1.77953" Width="102.04731" Height="26.45671" DataSet="qry_rp" DataSetName="rp" DisplayFormat.FormatStr="%2.2n" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haRight" ParentFont="False" Text="[rp.&#34;TOTAL_VALUE&#34;]"/>
    </TfrxMasterData>
    <TfrxPageHeader Name="PageHeader1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Frame.Typ="0" Height="103.48825" Left="0" Top="16" Width="718.1107">
      <TfrxMemoView Name="Memo2" AllowVectorExport="True" Left="2" Top="0" Width="714.33117" Height="34.01577" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="1" Frame.Typ="0" HAlign="haCenter" ParentFont="False" Text="สรุปการเบิกวัสดุการแพทย์ทั่วไปแยกตามหน่วยเบิก"/>
      <TfrxLineView Name="Line1" AllowVectorExport="True" Left="3.77953" Top="71.47248" Width="710.55164" Height="0" Color="0" Frame.Color="12632256" Frame.Typ="0" Diagonal="True"/>
      <TfrxMemoView Name="Memo3" AllowVectorExport="True" Left="1.77953" Top="38.67718" Width="714.33117" Height="26.45671" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" ParentFont="False" Text="ตั้งแต่วันที่  [formatdatetime('d mmmm',date1.date)] [StrToInt(formatdatetime('YYYY',date1.date))+543]  ถึง  [formatdatetime('d mmmm',date2.date)] [StrToInt(formatdatetime('YYYY',date2.date))+543]   ">
        <Formats>
          <item/>
          <item/>
        </Formats>
      </TfrxMemoView>
      <TfrxLineView Name="Line2" AllowVectorExport="True" Left="3.77953" Top="101.94496" Width="710.55164" Height="0" Color="0" Frame.Color="12632256" Frame.Typ="0" Diagonal="True"/>
      <TfrxMemoView Name="Memo4" AllowVectorExport="True" Left="34.01577" Top="75.5906" Width="79.37013" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haCenter" ParentFont="False" Text="หน่วยเบิก"/>
      <TfrxMemoView Name="Memo7" AllowVectorExport="True" Left="506.45702" Top="71.81107" Width="132.28355" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haCenter" ParentFont="False" Text="มูลค่าที่เบิก(บาท)"/>
    </TfrxPageHeader>
    <TfrxReportSummary Name="ReportSummary1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Frame.Typ="0" Height="83.14966" Left="0" Top="192" Width="718.1107">
      <TfrxMemoView Name="Memo20" AllowVectorExport="True" Left="504.11843" Top="8.77953" Width="105.82684" Height="26.45671" DisplayFormat.FormatStr="%2.2n" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;rp.&#34;TOTAL_VALUE&#34;&#62;,MasterData1)]"/>
      <TfrxLineView Name="Line4" AllowVectorExport="True" Left="3.77953" Top="6.77953" Width="710.55164" Height="0" Color="0" Frame.Color="12632256" Frame.Typ="0" Diagonal="True"/>
      <TfrxMemoView Name="Memo22" AllowVectorExport="True" Left="63.5906" Top="9.55906" Width="60.47248" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" Frame.Typ="0" HAlign="haCenter" ParentFont="False" Text="รวม"/>
      <TfrxLineView Name="Line5" AllowVectorExport="True" Left="3.77953" Top="41.57483" Width="710.55164" Height="0" Color="0" Frame.Color="12632256" Frame.Typ="0" Diagonal="True"/>
    </TfrxReportSummary>
  </TfrxReportPage>
  <TfrxDialogPage Name="DialogPage1" Font.Charset="1" Font.Color="-16777208" Font.Height="-12" Font.Name="Arial" Font.Style="0" HGuides.Text="" VGuides.Text="" Caption="ข้อมูล" DoubleBuffered="False" Height="288" ClientHeight="256" Left="371" Top="208" Width="521" Scaled="True" ClientWidth="515" OnActivate="DialogPage1OnActivate">
    <TfrxDateEditControl Name="date1" Left="168" Top="65" Width="97" Height="25" ShowHint="True" Color="-16777211" Date="41559" Time="0.697135868096666" WeekNumbers="False"/>
    <TfrxDateEditControl Name="date2" Left="336" Top="65" Width="101" Height="25" ShowHint="True" Color="-16777211" Date="41559" Time="0.697135868096666" WeekNumbers="False"/>
    <TfrxBitBtnControl Name="" Left="216" Top="187" Width="87" Height="33" Font.Charset="0" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" ShowHint="True" Glyph.PropData="04446174610AE2010000DE010000424DDE01000000000000760000002800000024000000120000000100040000000000680100000000000000000000100000000000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF003333333333333333333333333333333333330000333333333333333333333333F3333333333300003333344333333333333333388F3333333333000033334224333333333333338338F3333333330000333422224333333333333833338F3333333300003342222224333333333383333338F3333333000034222A22224333333338F338F3338F33333300003222A3A2224333333338F3838F338F33333300003A2A333A222433333338F83338F338F33333000033A33333A222433333338333338F338F33330000333333333A222433333333333338F338F33300003333333333A222433333333333338F338F33000033333333333A222433333333333338F338F30000333333333333A222433333333333338F338F00003333333333333A224333333333333338F38F000033333333333333A223333333333333338F830000333333333333333A3333333333333333383300003333333333333333333333333333333333330000" Kind="bkOK" Caption="OK" ModalResult="1" NumGlyphs="2"/>
    <TfrxDBLookupComboBox Name="cbb_stock" Left="164" Top="115" Width="305" Height="37" Font.Charset="0" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" ShowHint="True" DataSet="qry_stock" DataSetName="stock" ListField="DEPT_NAME" KeyField="DEPT_ID" DropDownWidth="0" DropDownRows="7"/>
    <TfrxLabelControl Name="Label1" Left="128" Top="68" Width="26" Height="20" Font.Charset="1" Font.Color="-16777208" Font.Height="-17" Font.Name="MS Sans Serif" Font.Style="0" ParentFont="False" ShowHint="True" Caption="วันที่" Color="-16777201"/>
    <TfrxLabelControl Name="Label2" Left="284" Top="68" Width="16" Height="20" Font.Charset="1" Font.Color="-16777208" Font.Height="-17" Font.Name="MS Sans Serif" Font.Style="0" ParentFont="False" ShowHint="True" Caption="ถึง" Color="-16777201"/>
    <TfrxLabelControl Name="Label3" Left="128" Top="124" Width="31" Height="20" Font.Charset="1" Font.Color="-16777208" Font.Height="-17" Font.Name="MS Sans Serif" Font.Style="0" ParentFont="False" ShowHint="True" Caption="เลือก" Color="-16777201"/>
  </TfrxDialogPage>
</TfrxReport>
