<?xml version="1.0" encoding="utf-8"?>
<TfrxReport Version="5.4.6" DotMatrixReport="False" IniFile="\Software\Fast Reports" PreviewOptions.Buttons="4095" PreviewOptions.Zoom="1" PrintOptions.Printer="Default" PrintOptions.PrintOnSheet="0" ReportOptions.CreateDate="41546.6611873611" ReportOptions.Description.Text="" ReportOptions.LastChange="43090.457587581" 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;&#13;&#10;procedure Label1OnClick(Sender: TfrxComponent);&#13;&#10;begin&#13;&#10;&#13;&#10;end;&#13;&#10;&#13;&#10;begin&#13;&#10;&#13;&#10;end.">
  <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" 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 T.DEPT_ID,T.DEPT_NAME,                              &#13;&#10;SUM(T.DIS_VALUE)  as XTOTAL,    &#13;&#10;SUM(CASE when T.NLEM='ED'   then T.DIS_VALUE else NULL end)  as XED_AMT,&#13;&#10;SUM(CASE when T.NLEM='NED'  then T.DIS_VALUE else NULL end)   as XNED_AMT  &#13;&#10;from (&#13;&#10;select e.NAME as  NLEM_DES, dbo.IS_ED(g.IS_ED) as NLEM,g.GROUP_CODE,Cx.DIS_QTY ,Cx.DIS_VALUE,cx.DEPT_ID,cx.DEPT_NAME                            &#13;&#10;from INV_MD  i (NOLOCK)       &#13;&#10;left join DRUG_GN g (NOLOCK) on (i.WORKING_CODE=g.WORKING_CODE)&#13;&#10;left join  (select c1.WORKING_CODE,c1.STOCK_ID,c1.DEPT_ID,x.HOSP_TYPE,x.DEPT_NAME,&#13;&#10;SUM(CASE when c1.R_S_STATUS in ('R','I','G','A','U') then c1.ACTIVE_QTY &#13;&#10;         when c1.R_S_STATUS in ('B') then c1.ACTIVE_QTY*-1 else NULL end&#13;&#10;) as RCV_QTY,          &#13;&#10;						SUM(CASE when c1.R_S_STATUS in ('T','S','D')  then c1.ACTIVE_QTY &#13;&#10;										 when (c1.R_S_STATUS='C') then c1.ACTIVE_QTY*-1 else NULL end) as DIS_QTY,&#13;&#10;						SUM(CASE when c1.R_S_STATUS in ('T','S','D')  then c1.[VALUE] &#13;&#10;										 when (c1.R_S_STATUS='C') then c1.[VALUE]*-1 else NULL end) as DIS_VALUE&#13;&#10;						from CARD c1  (NOLOCK)&#13;&#10;left join DEPT_ID x (NOLOCK) on (c1.DEPT_ID=x.DEPT_ID)	    &#13;&#10;            where  x.HOSP_TYPE='2'     and  x.DEPT_TYPE='3'  &#13;&#10;            and    c1.R_S_DATE between  :date1 and :date2&#13;&#10;           group by c1.WORKING_CODE,c1.STOCK_ID,c1.DEPT_ID,x.HOSP_TYPE,x.DEPT_NAME ) as Cx on (Cx.WORKING_CODE = i.WORKING_CODE  and Cx.STOCK_ID=i.DEPT_ID)&#13;&#10;left join ED_GROUP e (NOLOCK) on (g.GROUP_CODE=e.CODE)    &#13;&#10;where i.DEPT_ID=:stock  and  g.WORKING_CODE is not null            &#13;&#10;) as T&#13;&#10;WHERE   T.NLEM_DES='Penicillins' and T.NLEM_DES is not null                                                                  &#13;&#10;group BY T.DEPT_ID,T.DEPT_NAME              " SpecificOptions.Text="" PropData="05704C65667402380470546F70022C0A506172616D657465727301010C54000000204E616D653D226461746531222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465312E64617465292200010C54000000204E616D653D226461746532222044617461547970653D226674537472696E67222045787072657373696F6E3D22466F726D61744461746554696D652827595959596D6D6464272C64617465322E64617465292200010C41000000204E616D653D2273746F636B222044617461547970653D226674537472696E67222045787072657373696F6E3D226362625F73746F636B2E6B657976616C7565220000"/>
    <TfrxUniDACQuery Name="qry_stock" UserName="stock" CloseDataSource="True" FieldAliases.Text="" BCDToCurrency="False" IgnoreDupParams="False" SQL.Text="select * from DEPT_ID (NOLOCK) where DEPT_TYPE=2         &#13;&#10;  " SpecificOptions.Text="" PropData="05704C65667402380470546F700384000A506172616D65746572730100"/>
  </TfrxDataPage>
  <TfrxReportPage Name="Page1" PaperWidth="210" PaperHeight="297" PaperSize="9" LeftMargin="10" RightMargin="10" TopMargin="10" BottomMargin="10" ColumnWidth="0" ColumnPositions.Text="" HGuides.Text="" VGuides.Text="">
    <TfrxPageFooter Name="PageFooter1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="30.23624" Left="0" Top="256" Width="718.1107">
      <TfrxMemoView Name="Memo1" Left="647.5201" Top="2" Width="68.03154" Height="22.67718" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="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" Height="37.7953" Left="0" Top="136" Width="718.1107" ColumnWidth="0" ColumnGap="0" DataSet="qry_rp" DataSetName="rp" RowCount="0" Stretched="True">
      <TfrxMemoView Name="Memo33" Left="287.64761831" Top="2" Width="117.51783366" Height="26.45671" DataField="XED_AMT" DataSet="qry_rp" DataSetName="rp" DisplayFormat.FormatStr="%2.2n" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[rp.&#34;XED_AMT&#34;]"/>
      <TfrxMemoView Name="Memo34" Left="404.40944882" Top="2" Width="132.28355" Height="26.45671" DataField="XNED_AMT" DataSet="qry_rp" DataSetName="rp" DisplayFormat.FormatStr="%2.2n" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[rp.&#34;XNED_AMT&#34;]"/>
      <TfrxMemoView Name="rpdept_id" Left="1.88976378" Top="1" Width="102.04731" Height="26.45671" DataField="dept_id" DataSet="qry_rp" DataSetName="rp" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="0" ParentFont="False" Text="[rp.&#34;dept_id&#34;]"/>
      <TfrxMemoView Name="Memo6" Left="103.3859" Top="1.55906" Width="222.46832872" Height="26.45671" DataField="DEPT_NAME" DataSet="qry_rp" DataSetName="rp" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="0" ParentFont="False" Text="[rp.&#34;DEPT_NAME&#34;]"/>
      <TfrxMemoView Name="Memo8" Left="537.69326" Top="2" Width="177.63791" Height="26.45671" DataField="XTOTAL" 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" HAlign="haRight" ParentFont="False" Text="[rp.&#34;XTOTAL&#34;]"/>
    </TfrxMasterData>
    <TfrxPageHeader Name="PageHeader1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="98.26778" Left="0" Top="16" Width="718.1107">
      <TfrxMemoView Name="Memo2" Left="2" Top="2" Width="714.33117" Height="34.01577" AllowHTMLTags="True" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="1" HAlign="haCenter" ParentFont="False" Text="รายงานมูลค่าการจ่ายเวชภัณฑ์ยา กลุ่มยา Infections &#60;u&#62;หน่วยงาน รพ.สต.&#60;/u&#62;"/>
      <TfrxMemoView Name="Memo3" Left="1.88976378" Top="37.44094" Width="714.33117" Height="34.01574803" Font.Charset="1" Font.Color="0" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" Text="ตั้งแต่วันที่ [formatdatetime('dd/mm/YYYY',date1.date)] ถึงวันที่  [formatdatetime('dd/mm/YYYY',date2.date)]  ">
        <Formats>
          <item/>
          <item/>
        </Formats>
      </TfrxMemoView>
      <TfrxMemoView Name="Memo4" Left="1.88976378" Top="70.11812" Width="102.04731" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="รหัสหน่วย"/>
      <TfrxMemoView Name="Memo11" Left="254.02381" Top="70.7953" Width="151.1812" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" HAlign="haRight" ParentFont="False" Text="ED"/>
      <TfrxMemoView Name="Memo12" Left="404.42548" Top="70.7953" Width="132.28355" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" HAlign="haRight" ParentFont="False" Text="NED"/>
      <TfrxMemoView Name="Memo13" Left="538.03185" Top="70.7953" Width="177.63791" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" HAlign="haRight" ParentFont="False" Text="รวม"/>
      <TfrxMemoView Name="Memo5" Left="102.82684" Top="70.81107" Width="151.1812" Height="26.45671" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="หน่วยงาน"/>
    </TfrxPageHeader>
    <TfrxReportSummary Name="ReportSummary1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="42.57483" Left="0" Top="192" Width="718.1107">
      <TfrxMemoView Name="Memo9" Left="255.87401819" Top="8.55906" Width="151.1812" 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="Angsana New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;rp.&#34;XED_AMT&#34;&#62;,MasterData1)]"/>
      <TfrxMemoView Name="Memo10" Left="406.29921504" Top="8.55906" Width="132.28355" 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="Angsana New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;rp.&#34;XNED_AMT&#34;&#62;,MasterData1)]"/>
      <TfrxMemoView Name="Memo19" Left="3.77953" Top="7.55906" Width="102.04731" Height="26.45671" DataSet="qry_rp" DataSetName="rp" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="1" ParentFont="False" Text="รวม"/>
      <TfrxMemoView Name="Memo20" Left="105.27566622" Top="8.11812" Width="151.1812" Height="26.45671" DataSet="qry_rp" DataSetName="rp" Font.Charset="1" Font.Color="-16777208" Font.Height="-21" Font.Name="Angsana New" Font.Style="0" HAlign="haRight" ParentFont="False" Text=""/>
      <TfrxMemoView Name="Memo21" Left="539.58302622" Top="8.55906" Width="177.63791" 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="Angsana New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;rp.&#34;XNED_AMT&#34;&#62;+&#60;rp.&#34;XED_AMT&#34;&#62;,MasterData1)]"/>
    </TfrxReportSummary>
  </TfrxReportPage>
  <TfrxDialogPage Name="DialogPage1" Font.Charset="1" Font.Color="-16777208" Font.Height="-12" Font.Name="Arial" Font.Style="0" Caption="ÁÙŤèҡÒèèÒÂàǪÀѳ±ì¨ÓṡµÒÁ¡ÅØèÁÂÒ" Height="294" ClientHeight="256" Left="371" Top="208" Width="531" ClientWidth="515" OnActivate="DialogPage1OnActivate">
    <TfrxDateEditControl Name="date1" Left="168" Top="65" Width="97" Height="25" ShowHint="True" Color="-16777211" Date="41559.6971358681" Time="41559.6971358681" WeekNumbers="False"/>
    <TfrxDateEditControl Name="date2" Left="336" Top="65" Width="101" Height="25" ShowHint="True" Color="-16777211" Date="41559.6971358681" Time="41559.6971358681" 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"/>
    <TfrxLabelControl Name="Label1" Left="72" Top="64" Width="57" Height="29" Font.Charset="0" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" ShowHint="True" Caption="µÑé§áµèÇѹ·Õè" Color="16768462" OnClick="Label1OnClick"/>
    <TfrxLabelControl Name="Label2" Left="284" Top="63" Width="41" Height="29" Font.Charset="0" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" ShowHint="True" Caption="¶֧Çѹ·Õè" Color="16768462"/>
    <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="Label3" Left="72" Top="117" Width="79" Height="29" Font.Charset="0" Font.Color="-16777208" Font.Height="-21" Font.Name="AngsanaUPC" Font.Style="0" ParentFont="False" ShowHint="True" Caption="àÅ×͡¤Åѧã˭è" Color="16768462"/>
    <TfrxLabelControl Name="Label4" Left="210" Top="15" Width="145" Height="33" Font.Charset="1" Font.Color="16711680" Font.Height="-24" Font.Name="TH SarabunPSK" Font.Style="1" ParentFont="False" ShowHint="True" Caption="ÁÙŤèҨèÒÂÍ͡¨ҡ¤Åѧ" Color="15793151" OnClick="Label4OnClick"/>
  </TfrxDialogPage>
</TfrxReport>
