﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<StiSerializer version="1.02" type="Net" application="StiReport">
  <Dictionary Ref="1" type="Dictionary" isKey="true">
    <BusinessObjects isList="true" count="0" />
    <Databases isList="true" count="1">
      <MS_x0020_SQL Ref="2" type="Stimulsoft.Report.Dictionary.StiSqlDatabase" isKey="true">
        <Alias>MS SQL</Alias>
        <ConnectionStringEncrypted>w9BlCUZs04FsaKFcS9zpXoQqaSlma3vdelih8WEN6Gf8DJ/rX09p8Mdr4VDowOFe8gxpL15cUfDDGBWZTkzhL8PEd8NYXUN1/WG9hA==</ConnectionStringEncrypted>
        <Name>MS SQL</Name>
      </MS_x0020_SQL>
    </Databases>
    <DataSources isList="true" count="1">
      <DataSource1 Ref="3" type="Stimulsoft.Report.Dictionary.StiSqlSource" isKey="true">
        <Alias>DataSource1</Alias>
        <Columns isList="true" count="17">
          <value>gcifname,System.String</value>
          <value>ACTUAL_ACCOUNT_NUMBER,System.String</value>
          <value>GCIFNO,System.String</value>
          <value>CUSTOMER_VA_IDENTIFIER,System.String</value>
          <value>VIRTUAL_ACCOUNT_NUMBER,System.String</value>
          <value>VIRTUAL_ACCOUNT_NAME,System.String</value>
          <value>HIERARCHY_LEVEL,System.Decimal</value>
          <value>HIERARCHY_NAME,System.String</value>
          <value>CREATED_BY,System.String</value>
          <value>CREATED_ON,System.String</value>
          <value>Authorized_By_x002F_Rejected_By,System.String</value>
          <value>Authorized_On_x002F_Rejected_On,System.String</value>
          <value>REJECTREASON,System.String</value>
          <value>STATUS,System.String</value>
          <value>hierarchytype,System.String</value>
          <value>VACUSTTYPE,System.String</value>
          <value>payerid,System.String</value>
        </Columns>
        <CommandTimeout>30</CommandTimeout>
        <Dictionary isRef="1" />
        <Key>89479c37457744418e5dfec081c93442</Key>
        <Name>DataSource1</Name>
        <NameInSource>MS SQL</NameInSource>
        <Parameters isList="true" count="0" />
        <SqlCommand>SELECT    
	cust.custname as gcifname,
	acc.accno AS ACTUAL_ACCOUNT_NUMBER,
	vaa.gcifno AS GCIFNO,
	vaa.vacustidnt + ' - ' + vaa.entityname AS CUSTOMER_VA_IDENTIFIER,
	vacc.vaiban AS VIRTUAL_ACCOUNT_NUMBER,
	vacc.vaaccname AS VIRTUAL_ACCOUNT_NAME,
	vacc.hierarchylvl AS HIERARCHY_LEVEL,
	vacc.hierarchyname AS HIERARCHY_NAME,
	isnull(req.LOGINID,req1.loginid) AS CREATED_BY,
	convert(varchar,vacc.crtdate,103) AS CREATED_ON,
	isnull(app.LOGINID,app1.loginid) as "Authorized_By/Rejected_By",
	convert(varchar,vacc.appdate,103) as  "Authorized_On/Rejected_On",
	'' AS REJECTREASON,
	vacc.VACHNACTSTATUSDESC AS STATUS,
	case when vacc.hierarchytype = 'P' then 'Parent' else 'Child' end as hierarchytype,
( CASE WHEN vacc.vacusttype = 'P' THEN 'Payment' WHEN vacc.vacusttype = 'B' THEN 'Payment and Collection'
WHEN vacc.vacusttype = 'C' THEN 'Collection' END ) AS VACUSTTYPE,
vacc.payerid
FROM
    vtsmvaacc vaa
    INNER JOIN vtcmcustacc acc ON vaa.accid = acc.accid
    INNER JOIN vtcmcustacccif cif ON cif.accid = acc.accid
    INNER JOIN vtcmcust cust ON cust.custid = cif.custid
    inner JOIN vtsmvaccounts vacc ON vacc.vaaccid = vaa.vaaccid
    left outer JOIN vtamuser req ON req.userid = vacc.crtby
    left outer JOIN vtamuser app ON app.userid = vacc.appby
left outer join vtampcuser req1 on req1.userid = vacc.crtby
left outer join vtampcuser app1 on app1.userid = vacc.appby
left outer join VTSMVACHNMAP vm on vacc.VAIBANID = vm.VAIBANID

    WHERE
cust.custid = 22
 and
 vacc.VACHNACTSTATUSDESC = (case when isnull('','')='' then isnull(null,vacc.VACHNACTSTATUSDESC)  else ''  end)
and
convert(date,vacc.crtdate,103) BETWEEN isnull( convert(date,'01-01-2020',103), vacc.crtdate) AND
isnull( convert(date,'10-04-2020',103), vacc.crtdate)
and
ACC.ACCID  in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( acc.ACCID as varchar)
FROM
vtcmcustacc acc
group by acc.accid
for xml path('')),1,1,'') )
else '' end,','))
and
VAA.VACUSTIDNT in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( vaa.vacustidnt as varchar)
FROM
vtsmvaacc vaa
group by vaa.vacustidnt
for xml path('')),1,1,'') )
else '' end,','))
AND vacc.CRTBY=(case when isnull('','')='' then isnull(null,vacc.CRTBY)  else ''  end)
AND vacc.APPBY=(case when isnull('','')='' then isnull(null,vacc.APPBY)  else ''  end)
 AND
vacc.vaiban in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( vacc.vaiban as varchar)
FROM
    vtsmvaccounts vacc
group by vacc.vaiban
for xml path('')),1,1,'') )
else '' end,','))

group by
    vaa.entityname,
    cust.custname ,
    acc.accno ,
    vaa.gcifno,
    vaa.vacustidnt,
    vacc.vaiban ,
    vacc.vaaccname,
    vacc.hierarchylvl,
    vacc.hierarchyname,
req.LOGINID,req1.loginid,
vacc.crtdate,
app.LOGINID,app1.loginid,
    vacc.appdate,
vacc.VACHNACTSTATUSDESC ,
vacc.hierarchytype,
vacc.vacusttype,
vacc.payerid

UNION


SELECT
	cust.custname as gcifname,
	ACC.ACCNO as ACTUAL_ACCOUNT_NUMBER,
	VAA.GCIFNO,
	VAA.VACUSTIDNT + ' - ' + vaa.entityname as CUSTOMER_VA_IDENTIFIER,
	pay.VAIBAN as VIRTUAL_ACCOUNT_NUMBER,
	pay.VANAME as VIRTUAL_ACCOUNT_NAME,
	pay.HIERARCHYLVL as HIERARCHY_LEVEL,
	pay.HIERARCHYNAME as HIERARCHY_NAME,
	ISNULL(req.loginid,REQ1.LOGINID) AS CREATED_BY,
	convert(varchar,pay.REQDATE ,103) as CREATED_ON,
	CASE WHEN TRN.WFSTATUSID=210 THEN NULL ELSE  ISNULL(REJ.LOGINID,REJ1.LOGINID) END as "Authorized_By/Rejected_By",
 CASE WHEN TRN.WFSTATUSID=210 THEN NULL ELSE  convert(varchar,TRN.CRTDATE ,103) END as  "Authorized_On/Rejected_On",
ENG.REJECTREASON AS REJECTREASON ,
ST.WFSTATUSDESC AS STATUS,
case when pay.hierarchytype = 'P' then 'Parent' else 'Child' end as hierarchytype,
( CASE WHEN pay.vacusttype = 'P' THEN 'Payment' WHEN pay.vacusttype = 'B' THEN 'Payment and Collection'
WHEN pay.vacusttype = 'C' THEN 'Collection' END ) AS VACUSTTYPE,
pay.payerid
    FROM WRK_VTSMPAYER pay
        INNER JOIN VTXMENGNE ENG ON ENG.WFID=pay.WFID
        INNER JOIN  VTXMSTATUS ST ON ST.WFSTATUSID=ENG.CURRWFSTATUSID
        inner JOIN VTXTENGNETRN TRN ON TRN.WFSTATUSID=ENG.CURRWFSTATUSID AND TRN.WFID=ENG.WFID
inner join vtsmvaacc vaa on vaa.VAACCID = pay.VAACCID
        INNER JOIN VTCMCUSTACC ACC ON VAA.ACCID=ACC.ACCID
        INNER JOIN VTCMCUSTACCCIF CIF ON CIF.ACCID=ACC.ACCID
        INNER JOIN VTCMCUST CUST ON CUST.CUSTID=CIF.CUSTID
        left JOIN VTAMUSER REQ ON REQ.USERID=PAY.REQBY
        left JOIN VTAMUSER REJ ON TRN.CRTBY=REJ.USERID  
LEFT JOIN VTAMPCUSER REQ1 ON REQ1.USERID = PAY.REQBY
LEFT JOIN VTAMPCUSER REJ1 ON TRN.CRTBY = REJ1.USERID
    WHERE
CUST.CUSTID = 22
 AND
ENG.CURRWFSTATUSID IN (210,260)

 AND cast(ENG.CURRWFSTATUSID as varchar)=(case when isnull('','')='' then isnull(null,CAST(ENG.CURRWFSTATUSID AS VARCHAR))  else '' end)

and convert(date,pay.REQDATE,103) BETWEEN isnull( convert(date,'01-01-2020',103), pay.REQDATE) AND
isnull( convert(date,'10-04-2020',103), pay.REQDATE)

and ACC.ACCID  in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( acc.ACCID as varchar)
FROM  VTCMCUSTACC ACC
group by acc.accid
for xml path('')),1,1,'') )
else '' end,','))
and
VAA.VACUSTIDNT in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( vaa.vacustidnt as varchar)
FROM WRK_VTSMVAACC VAA
group by vaa.vacustidnt
for xml path('')),1,1,'') )
else '' end,','))
AND pay.reqby=(case when isnull('','')='' then isnull(null,pay.reqby)  else ''  end)
and TRN.CRTBY=(case when isnull('','')='' then isnull(null,TRN.CRTBY)  else ''  end)
AND
pay.vaiban in  (SELECT VALUE  FROM FN_SPLIT(case when isnull('','') = '' then
( select  stuff((SELECT ','+ cast( pay.vaiban as varchar)
FROM
    wrk_vtsmpayer pay
group by pay.vaiban
for xml path('')),1,1,'') )
else '' end,','))

group by
VAA.entityname,
 cust.custname,
 ACC.ACCNO ,
VAA.GCIFNO,
VAA.VACUSTIDNT,
pay.VAIBAN ,
pay.VANAME ,
pay.HIERARCHYLVL,
pay.HIERARCHYNAME,
req.loginid,REQ1.LOGINID,
pay.REQDATE ,
REJ.LOGINID,REJ1.LOGINID,
 TRN.CRTDATE,
ENG.REJECTREASON ,
ST.WFSTATUSDESC ,TRN.WFSTATUSID,
pay.hierarchytype,
pay.vacusttype,
pay.payerid
ORDER BY  CREATED_ON DESC</SqlCommand>
      </DataSource1>
    </DataSources>
    <Relations isList="true" count="0" />
    <Report isRef="0" />
    <Resources isList="true" count="0" />
    <Variables isList="true" count="0" />
  </Dictionary>
  <EngineVersion>EngineV2</EngineVersion>
  <GlobalizationStrings isList="true" count="0" />
  <Key>da2df571b0814475a421d20568d90c8d</Key>
  <MetaTags isList="true" count="0" />
  <Pages isList="true" count="1">
    <Page1 Ref="4" type="Page" isKey="true">
      <Border>None;Black;2;Solid;False;4;Black</Border>
      <Brush>Transparent</Brush>
      <Components isList="true" count="2">
        <ReportTitle Ref="5" type="ReportTitleBand" isKey="true">
          <Brush>Transparent</Brush>
          <ClientRectangle>0,0.2,7.72,0.5</ClientRectangle>
          <Components isList="true" count="1">
            <ReportTitleText Ref="6" type="Text" isKey="true">
              <Brush>Transparent</Brush>
              <ClientRectangle>0,0,7.72,0.5</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,20,Bold</Font>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>ReportTitleText</Name>
              <Page isRef="4" />
              <Parent isRef="5" />
              <Text>DataSource1</Text>
              <TextBrush>Black</TextBrush>
              <VertAlignment>Center</VertAlignment>
            </ReportTitleText>
          </Components>
          <Conditions isList="true" count="0" />
          <Name>ReportTitle</Name>
          <Page isRef="4" />
          <Parent isRef="4" />
        </ReportTitle>
        <Data Ref="7" type="Stimulsoft.Report.Components.Table.StiTable" isKey="true">
          <Brush>Transparent</Brush>
          <BusinessObjectGuid isNull="true" />
          <ClientRectangle>0,1.1,7.72,0.9</ClientRectangle>
          <ColumnCount>3</ColumnCount>
          <Components isList="true" count="9">
            <Data_Cell1 Ref="8" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>0,0,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,10,Bold</Font>
              <ID>0</ID>
              <JoinCells isList="true" count="0" />
              <Margins>1,1,1,1</Margins>
              <Name>Data_Cell1</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>ACTUAL_ACCOUNT_NUMBER</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell1>
            <Data_Cell2 Ref="9" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>2.6,0,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,10,Bold</Font>
              <ID>1</ID>
              <JoinCells isList="true" count="0" />
              <Margins>1,1,1,1</Margins>
              <Name>Data_Cell2</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>GCIFNO</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell2>
            <Data_Cell3 Ref="10" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>5.2,0,2.52,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,10,Bold</Font>
              <ID>2</ID>
              <JoinCells isList="true" count="0" />
              <Margins>1,1,1,1</Margins>
              <Name>Data_Cell3</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>CUSTOMER_VA_IDENTIFIER</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell3>
            <Data_Cell4 Ref="11" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <CanGrow>True</CanGrow>
              <ClientRectangle>0,0.3,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <GrowToHeight>True</GrowToHeight>
              <ID>3</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell4</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>{DataSource1.ACTUAL_ACCOUNT_NUMBER}</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell4>
            <Data_Cell5 Ref="12" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <CanGrow>True</CanGrow>
              <ClientRectangle>2.6,0.3,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <GrowToHeight>True</GrowToHeight>
              <ID>4</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell5</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>{DataSource1.GCIFNO}</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell5>
            <Data_Cell6 Ref="13" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <CanGrow>True</CanGrow>
              <ClientRectangle>5.2,0.3,2.52,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <GrowToHeight>True</GrowToHeight>
              <ID>5</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell6</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <Text>{DataSource1.CUSTOMER_VA_IDENTIFIER}</Text>
              <TextBrush>Black</TextBrush>
              <TextOptions>,,,,WordWrap=True,A=0</TextOptions>
              <VertAlignment>Center</VertAlignment>
            </Data_Cell6>
            <Data_Cell7 Ref="14" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>0,0.6,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <ID>6</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell7</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <TextBrush>Black</TextBrush>
            </Data_Cell7>
            <Data_Cell8 Ref="15" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>2.6,0.6,2.6,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <ID>7</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell8</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <TextBrush>Black</TextBrush>
            </Data_Cell8>
            <Data_Cell9 Ref="16" type="TableCell" isKey="true">
              <Brush>White</Brush>
              <ClientRectangle>5.2,0.6,2.52,0.3</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Arial,9</Font>
              <ID>8</ID>
              <JoinCells isList="true" count="0" />
              <Margins>0,0,0,0</Margins>
              <Name>Data_Cell9</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Restrictions>AllowMove, AllowSelect, AllowChange</Restrictions>
              <TextBrush>Black</TextBrush>
            </Data_Cell9>
          </Components>
          <Conditions isList="true" count="0" />
          <DataSourceName>DataSource1</DataSourceName>
          <Filters isList="true" count="0" />
          <FooterRowsCount>1</FooterRowsCount>
          <HeaderRowsCount>1</HeaderRowsCount>
          <Name>Data</Name>
          <NumberID>9</NumberID>
          <Page isRef="4" />
          <Parent isRef="4" />
          <RowCount>3</RowCount>
          <Sort isList="true" count="0" />
        </Data>
      </Components>
      <Conditions isList="true" count="0" />
      <Guid>0ea0b6e9e83547b78bf114f99d236f21</Guid>
      <Margins>0.39,0.39,0.39,0.39</Margins>
      <Name>Page1</Name>
      <PageHeight>11</PageHeight>
      <PageWidth>8.5</PageWidth>
      <PaperSize>Letter</PaperSize>
      <Report isRef="0" />
    </Page1>
  </Pages>
  <ReferencedAssemblies isList="true" count="8">
    <value>System.Dll</value>
    <value>System.Drawing.Dll</value>
    <value>System.Windows.Forms.Dll</value>
    <value>System.Data.Dll</value>
    <value>System.Xml.Dll</value>
    <value>Stimulsoft.Controls.Dll</value>
    <value>Stimulsoft.Base.Dll</value>
    <value>Stimulsoft.Report.Dll</value>
  </ReferencedAssemblies>
  <ReportAlias>Report</ReportAlias>
  <ReportChanged>4/16/2020 5:48:58 PM</ReportChanged>
  <ReportCreated>4/16/2020 5:48:30 PM</ReportCreated>
  <ReportFile>W:\MindGate\Stimulsoft\TableReport.mrt</ReportFile>
  <ReportGuid>0deccf0d6eb046e9b05907fb4238821d</ReportGuid>
  <ReportName>Report</ReportName>
  <ReportUnit>Inches</ReportUnit>
  <ReportVersion>2019.4.1.0</ReportVersion>
  <Script>using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;

namespace Reports
{
    public class Report : Stimulsoft.Report.StiReport
    {
        public Report()        {
            this.InitializeComponent();
        }

        #region StiReport Designer generated code - do not modify
		#endregion StiReport Designer generated code - do not modify
    }
}
</Script>
  <ScriptLanguage>CSharp</ScriptLanguage>
  <Styles isList="true" count="0" />
</StiSerializer>