Commit 1156ccab authored by ngadkari's avatar ngadkari

E-INVOICE irn generation process and irn cancel process added

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217036 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e70c0ce8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Sybase_eDataWindow>
<Sybase_eDataWindow>
<Release>9</Release>
<BaseDefinition>
<units>1</units>
<timer_interval>0</timer_interval>
<color>67108864</color>
<processing>0</processing>
<HTMLDW>no</HTMLDW>
<print>
<documentname></documentname>
<printername></printername>
<orientation>0</orientation>
<margin>
<left>24</left>
<right>24</right>
<top>24</top>
<bottom>24</bottom>
</margin>
<paper>
<source>0</source>
<size>0</size>
</paper>
<prompt>no</prompt>
<canusedefaultprinter>yes</canusedefaultprinter>
<buttons>no</buttons>
<preview.buttons>no</preview.buttons>
<cliptext>no</cliptext>
<overrideprintjob>no</overrideprintjob>
</print>
</BaseDefinition>
<Summary>
<height>0</height>
<color>536870912</color>
</Summary>
<Footer>
<height>0</height>
<color>536870912</color>
</Footer>
<Detail>
<height>171</height>
<color>536870912</color>
</Detail>
<TableDefinition>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>ref_no</name>
<dbname>ref_no</dbname>
</table_column>
<table_column>
<type size="20">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>user_name</name>
<dbname>user_name</dbname>
</table_column>
<table_column>
<type size="20">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>password</name>
<dbname>password</dbname>
</table_column>
</TableDefinition>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>Reference #:</text>
<border>0</border>
<color>33554432</color>
<x>110</x>
<y>58</y>
<height>15</height>
<width>73</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_no_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>E-Invoice User Name:</text>
<border>0</border>
<color>33554432</color>
<x>58</x>
<y>91</y>
<height>15</height>
<width>125</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>user_name_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>Password:</text>
<border>0</border>
<color>33554432</color>
<x>111</x>
<y>124</y>
<height>15</height>
<width>72</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>password_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<ColumnObject>
<band>Detail</band>
<id>1</id>
<alignment>0</alignment>
<tabsequence>10</tabsequence>
<border>5</border>
<color>33554432</color>
<x>191</x>
<y>58</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_no</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>10</limit>
<case>upper</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>2</id>
<alignment>0</alignment>
<tabsequence>20</tabsequence>
<border>5</border>
<color>33554432</color>
<x>191</x>
<y>91</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>user_name</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>20</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>3</id>
<alignment>0</alignment>
<tabsequence>30</tabsequence>
<border>5</border>
<color>33554432</color>
<x>191</x>
<y>124</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>password</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>20</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<HtmlTable>
<border>1</border>
</HtmlTable>
<HtmlGen>
<clientevents>1</clientevents>
<clientvalidation>1</clientvalidation>
<clientcomputedfields>1</clientcomputedfields>
<clientformatting>0</clientformatting>
<clientscriptable>0</clientscriptable>
<generatejavascript>1</generatejavascript>
<encodeselflinkargs>1</encodeselflinkargs>
<netscapelayers>0</netscapelayers>
</HtmlGen>
<Export.XML>
<headgroups>1</headgroups>
<includewhitespace>0</includewhitespace>
<metadatatype>0</metadatatype>
<savemetadata>0</savemetadata>
</Export.XML>
<Import.XML>
</Import.XML>
<Export.PDF>
<method>0</method>
<distill.custompostscript>0</distill.custompostscript>
<xslfop.print>0</xslfop.print>
</Export.PDF>
</Sybase_eDataWindow>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Sybase_eDataWindow>
<Sybase_eDataWindow>
<Release>9</Release>
<BaseDefinition>
<units>1</units>
<timer_interval>0</timer_interval>
<color>67108864</color>
<processing>0</processing>
<HTMLDW>no</HTMLDW>
<print>
<documentname></documentname>
<printername></printername>
<orientation>0</orientation>
<margin>
<left>24</left>
<right>24</right>
<top>24</top>
<bottom>24</bottom>
</margin>
<paper>
<source>0</source>
<size>0</size>
</paper>
<prompt>no</prompt>
<canusedefaultprinter>yes</canusedefaultprinter>
<buttons>no</buttons>
<preview.buttons>no</preview.buttons>
<cliptext>no</cliptext>
<overrideprintjob>no</overrideprintjob>
</print>
</BaseDefinition>
<Summary>
<height>0</height>
<color>536870912</color>
</Summary>
<Footer>
<height>0</height>
<color>536870912</color>
</Footer>
<Detail>
<height>273</height>
<color>536870912</color>
</Detail>
<TableDefinition>
<table_column>
<type size="5">char</type>
<updatewhereclause>no</updatewhereclause>
<name>site_code</name>
<dbname>site_code</dbname>
</table_column>
<table_column>
<type>date</type>
<updatewhereclause>no</updatewhereclause>
<name>from_date</name>
<dbname>from_date</dbname>
</table_column>
<table_column>
<type>date</type>
<updatewhereclause>no</updatewhereclause>
<name>to_date</name>
<dbname>to_date</dbname>
</table_column>
<table_column>
<type size="20">char</type>
<updatewhereclause>no</updatewhereclause>
<name>user_name</name>
<dbname>user_name</dbname>
</table_column>
<table_column>
<type size="20">char</type>
<updatewhereclause>no</updatewhereclause>
<name>password</name>
<dbname>password</dbname>
</table_column>
</TableDefinition>
<ColumnObject>
<band>Detail</band>
<id>1</id>
<alignment>0</alignment>
<tabsequence>10</tabsequence>
<border>5</border>
<color>33554432</color>
<x>225</x>
<y>77</y>
<height>18</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>site_code</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>5</limit>
<case>upper</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>2</id>
<alignment>0</alignment>
<tabsequence>20</tabsequence>
<border>5</border>
<color>33554432</color>
<x>225</x>
<y>110</y>
<height>18</height>
<width>82</width>
<format>dd/mm/yy</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>from_date</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<format>dd/mm/yy</format>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>Site Code:</text>
<border>0</border>
<color>33554432</color>
<x>152</x>
<y>77</y>
<height>15</height>
<width>65</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>site_code_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>From Date:</text>
<border>0</border>
<color>33554432</color>
<x>152</x>
<y>110</y>
<height>15</height>
<width>65</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>from_date_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<ColumnObject>
<band>Detail</band>
<id>3</id>
<alignment>0</alignment>
<tabsequence>30</tabsequence>
<border>5</border>
<color>33554432</color>
<x>225</x>
<y>143</y>
<height>18</height>
<width>82</width>
<format>dd/mm/yy</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>to_date</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<format>dd/mm/yy</format>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>4</id>
<alignment>0</alignment>
<tabsequence>40</tabsequence>
<border>5</border>
<color>33554432</color>
<x>225</x>
<y>169</y>
<height>16</height>
<width>82</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>user_name</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>20</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<required>yes</required>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Liberation Sans</face>
<height>-11</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>5</id>
<alignment>0</alignment>
<tabsequence>50</tabsequence>
<border>5</border>
<color>33554432</color>
<x>226</x>
<y>199</y>
<height>16</height>
<width>82</width>
<format>*********</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>password</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>20</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<password>yes</password>
<required>yes</required>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Liberation Sans</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>To Date:</text>
<border>0</border>
<color>33554432</color>
<x>152</x>
<y>143</y>
<height>15</height>
<width>65</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>to_date_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>E-Invoice User Name:</text>
<border>0</border>
<color>33554432</color>
<x>92</x>
<y>169</y>
<height>15</height>
<width>125</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>user_name_t</name>
<visible>1</visible>
<font>
<face>Liberation Sans</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>67108864</color>
</background>
</TextObject>
<TextObject>
<band>Detail</band>
<alignment>1</alignment>
<text>Password:</text>
<border>0</border>
<color>33554432</color>
<x>152</x>
<y>198</y>
<height>15</height>
<width>65</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>password_t</name>
<visible>1</visible>
<font>
<face>Liberation Sans</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>67108864</color>
</background>
</TextObject>
<HtmlTable>
<border>1</border>
</HtmlTable>
<HtmlGen>
<clientevents>1</clientevents>
<clientvalidation>1</clientvalidation>
<clientcomputedfields>1</clientcomputedfields>
<clientformatting>0</clientformatting>
<clientscriptable>0</clientscriptable>
<generatejavascript>1</generatejavascript>
<encodeselflinkargs>1</encodeselflinkargs>
<netscapelayers>0</netscapelayers>
</HtmlGen>
<Export.XML>
<headgroups>1</headgroups>
<includewhitespace>0</includewhitespace>
<metadatatype>0</metadatatype>
<savemetadata>0</savemetadata>
</Export.XML>
<Import.XML>
</Import.XML>
<Export.PDF>
<method>0</method>
<distill.custompostscript>0</distill.custompostscript>
<xslfop.print>0</xslfop.print>
</Export.PDF>
</Sybase_eDataWindow>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Sybase_eDataWindow>
<Sybase_eDataWindow>
<Release>9</Release>
<BaseDefinition>
<units>1</units>
<timer_interval>0</timer_interval>
<color>67108864</color>
<processing>1</processing>
<HTMLDW>no</HTMLDW>
<print>
<documentname></documentname>
<printername></printername>
<orientation>0</orientation>
<margin>
<left>24</left>
<right>24</right>
<top>24</top>
<bottom>24</bottom>
</margin>
<paper>
<source>0</source>
<size>0</size>
</paper>
<prompt>no</prompt>
<canusedefaultprinter>yes</canusedefaultprinter>
<buttons>no</buttons>
<preview.buttons>no</preview.buttons>
<cliptext>no</cliptext>
<overrideprintjob>no</overrideprintjob>
</print>
<grid.lines>0</grid.lines>
</BaseDefinition>
<Header>
<height>19</height>
<color>536870912</color>
</Header>
<Summary>
<height>0</height>
<color>536870912</color>
</Summary>
<Footer>
<height>0</height>
<color>536870912</color>
</Footer>
<Detail>
<height>22</height>
<color>536870912</color>
</Detail>
<TableDefinition>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>ref_no</name>
<dbname>ref_no</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>ref_ser</name>
<dbname>ref_ser</dbname>
</table_column>
<table_column>
<type>date</type>
<updatewhereclause>yes</updatewhereclause>
<name>ref_date</name>
<dbname>ref_date</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>cust_code</name>
<dbname>cust_code</dbname>
</table_column>
<table_column>
<type size="130">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>customer_name</name>
<dbname>customer_name</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>cust_code__bil</name>
<dbname>cust_code__bil</dbname>
</table_column>
<table_column>
<type size="120">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>customer_name_1</name>
<dbname>customer_name_1</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>tax_class</name>
<dbname>tax_class</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>tax_chap</name>
<dbname>tax_chap</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>tax_env</name>
<dbname>tax_env</dbname>
</table_column>
<table_column>
<type precision="3">decimal</type>
<updatewhereclause>yes</updatewhereclause>
<name>amount</name>
<dbname>amount</dbname>
</table_column>
<table_column>
<type precision="3">decimal</type>
<updatewhereclause>yes</updatewhereclause>
<name>net_amt</name>
<dbname>net_amt</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>curr_code</name>
<dbname>curr_code</dbname>
</table_column>
<table_column>
<type precision="3">decimal</type>
<updatewhereclause>yes</updatewhereclause>
<name>exch_rate</name>
<dbname>exch_rate</dbname>
</table_column>
<table_column>
<type size="10">char</type>
<updatewhereclause>yes</updatewhereclause>
<name>inv_type</name>
<dbname>inv_type</dbname>
</table_column>
</TableDefinition>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Reference #</text>
<border>6</border>
<color>33554432</color>
<x>2</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_no_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Reference Ser</text>
<border>6</border>
<color>33554432</color>
<x>84</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_ser_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Reference Date</text>
<border>6</border>
<color>33554432</color>
<x>166</x>
<y>2</y>
<height>15</height>
<width>64</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_date_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Customer Code</text>
<border>6</border>
<color>33554432</color>
<x>232</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>cust_code_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Customer Name</text>
<border>6</border>
<color>33554432</color>
<x>314</x>
<y>2</y>
<height>15</height>
<width>109</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>customer_name_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Customer Code Bill</text>
<border>6</border>
<color>33554432</color>
<x>425</x>
<y>2</y>
<height>15</height>
<width>87</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>cust_code__bil_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Customer Name</text>
<border>6</border>
<color>33554432</color>
<x>514</x>
<y>2</y>
<height>15</height>
<width>113</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>customer_name_1_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Tax Env</text>
<border>6</border>
<color>33554432</color>
<x>793</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_env_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Tax Chap</text>
<border>6</border>
<color>33554432</color>
<x>711</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_chap_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Tax Class</text>
<border>6</border>
<color>33554432</color>
<x>629</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_class_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>1</alignment>
<text>Amount</text>
<border>6</border>
<color>33554432</color>
<x>875</x>
<y>2</y>
<height>15</height>
<width>64</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>amount_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>1</alignment>
<text>Net Amount</text>
<border>6</border>
<color>33554432</color>
<x>941</x>
<y>2</y>
<height>15</height>
<width>64</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>net_amt_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>1</alignment>
<text>Exch Rate</text>
<border>6</border>
<color>33554432</color>
<x>1089</x>
<y>2</y>
<height>15</height>
<width>64</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>exch_rate_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Currency Code</text>
<border>6</border>
<color>33554432</color>
<x>1007</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>curr_code_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<TextObject>
<band>Header</band>
<alignment>0</alignment>
<text>Inv Type</text>
<border>6</border>
<color>33554432</color>
<x>1155</x>
<y>2</y>
<height>15</height>
<width>80</width>
<html>
<valueishtml>0</valueishtml>
</html>
<name>inv_type_t</name>
<visible>1</visible>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>1</mode>
<color>536870912</color>
</background>
</TextObject>
<ColumnObject>
<band>Detail</band>
<id>3</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>166</x>
<y>2</y>
<height>18</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_date</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>4</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>232</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>cust_code</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>5</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>314</x>
<y>2</y>
<height>18</height>
<width>109</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>customer_name</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>6</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>425</x>
<y>2</y>
<height>18</height>
<width>87</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>cust_code__bil</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>7</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>514</x>
<y>2</y>
<height>18</height>
<width>113</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>customer_name_1</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>8</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>629</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_class</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>9</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>711</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_chap</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>10</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>793</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>tax_env</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>11</id>
<alignment>1</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>875</x>
<y>2</y>
<height>18</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>amount</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>12</id>
<alignment>1</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>941</x>
<y>2</y>
<height>18</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>net_amt</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>13</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>1007</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>curr_code</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>14</id>
<alignment>1</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>1089</x>
<y>2</y>
<height>18</height>
<width>64</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>exch_rate</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>15</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>1155</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>inv_type</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>1</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>2</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_no</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<ColumnObject>
<band>Detail</band>
<id>2</id>
<alignment>0</alignment>
<tabsequence>32766</tabsequence>
<border>5</border>
<color>33554432</color>
<x>84</x>
<y>2</y>
<height>18</height>
<width>80</width>
<format>[general]</format>
<html>
<valueishtml>0</valueishtml>
</html>
<name>ref_ser</name>
<visible>1</visible>
<EditStyle style="edit">
<limit>0</limit>
<case>any</case>
<focusrectangle>no</focusrectangle>
<autoselect>yes</autoselect>
<autohscroll>yes</autohscroll>
<imemode>0</imemode>
</EditStyle>
<font>
<face>Arial</face>
<height>-10</height>
<weight>400</weight>
<family>2</family>
<pitch>2</pitch>
<charset>0</charset>
</font>
<background>
<mode>2</mode>
<color>1073741824</color>
</background>
</ColumnObject>
<HtmlTable>
<border>1</border>
</HtmlTable>
<HtmlGen>
<clientevents>1</clientevents>
<clientvalidation>1</clientvalidation>
<clientcomputedfields>1</clientcomputedfields>
<clientformatting>0</clientformatting>
<clientscriptable>0</clientscriptable>
<generatejavascript>1</generatejavascript>
<encodeselflinkargs>1</encodeselflinkargs>
<netscapelayers>0</netscapelayers>
</HtmlGen>
<Export.XML>
<headgroups>1</headgroups>
<includewhitespace>0</includewhitespace>
<metadatatype>0</metadatatype>
<savemetadata>0</savemetadata>
</Export.XML>
<Import.XML>
</Import.XML>
<Export.PDF>
<method>0</method>
<distill.custompostscript>0</distill.custompostscript>
<xslfop.print>0</xslfop.print>
</Export.PDF>
</Sybase_eDataWindow>
Insert into itm2menu (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY,DEFAULT_STATE,DEF_ACTION,MOB_DEPLY,ENT_TYPES)
values ('SCG',6,0,0,0,0,'-','E-Invoice','E-Invoice','SCG.6.0.0.0.0',null,null,null,'T',null,null,null,null,null,null,null,'0 ');
Insert into itm2menu (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY,DEFAULT_STATE,DEF_ACTION,MOB_DEPLY,ENT_TYPES)
values ('SCG',6,1,0,0,0,'w_einvoiceirngen_prc','E-Invoice IRN Gen','E-Invoice IRN Gen','SCG.6.1.0.0.0',null,null,null,'P',null,null,null,'B',null,null,null,'0 ');
Insert into OBJ_FORMS (WIN_NAME,TITLE,OBJ_BROW_NAME,OBJ_EDIT_NAME,CROSS_UPDATE_EXPR,EXPR_FLD_INFO,TARGET_FLD_INFO,EXPR_COMMENT,FORM_NO,SCR_FLAG,AUTO_ACCEPT_SCAN,SCAN_FLAG,SCAN_METADATA,PROPERTY_INFO,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY,DUPLICATE_ADD,DEFAULT_ROW_CNT,FREEZE_COL_POS,IS_MANDATORY,TRAN_ID_COL,SELECTION_OPT,KEY_INFO,THUMB_OBJ,THUMB_IMAGE_COL,THUMB_ALT_COL,FORM_NAME,FORM_ICON,FORM_VIEW_OPTS,X_COLUMN,Y_COLUMN,ACTION_ARG)
values ('w_einvoiceirngen_prc','E-Invoice',null,null,null,null,null,null,'1','F',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'A',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'DetailForm.png',null,null,null,null);
Insert into OBJ_FORMS (WIN_NAME,TITLE,OBJ_BROW_NAME,OBJ_EDIT_NAME,CROSS_UPDATE_EXPR,EXPR_FLD_INFO,TARGET_FLD_INFO,EXPR_COMMENT,FORM_NO,SCR_FLAG,AUTO_ACCEPT_SCAN,SCAN_FLAG,SCAN_METADATA,PROPERTY_INFO,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY,DUPLICATE_ADD,DEFAULT_ROW_CNT,FREEZE_COL_POS,IS_MANDATORY,TRAN_ID_COL,SELECTION_OPT,KEY_INFO,THUMB_OBJ,THUMB_IMAGE_COL,THUMB_ALT_COL,FORM_NAME,FORM_ICON,FORM_VIEW_OPTS,X_COLUMN,Y_COLUMN,ACTION_ARG)
values ('w_einvoiceirngen_prc','IRN Generation',null,null,null,null,null,null,'2','T',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'A',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'DetailForm.png',null,null,null,null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT)
values ('einvoiceirngen_prc','get_data','1','einvoiceirngen_gd',null,'0',to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','2','JB','ibase.webitm.ejb.gstclient.EInvoiceIRNGenPrc',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT)
values ('einvoiceirngen_prc','process','1','einvoiceirn_gen',null,'0',to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','2','JB','ibase.webitm.ejb.gstclient.EInvoiceIRNGenPrc',null);
Insert into system_events (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT)
values ('einvoiceirngen_prc','post_item_change','1','poic_default_ejb',null,'0',to_timestamp('22-08-18','DD-MM-RR HH12:MI:SSXFF AM'),'BASE ','BASE','2','JB','ibase.webitm.ejb.gstclient.EInvoiceIRNGenIC',null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('einvoiceirngen_gd','Action to get the Data','http://localhost:9090/axis/services/ProcessService','Base Information','getData','String','S',null,null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',1,'COMPONENT_TYPE','l',null,'C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI','JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',2,'COMPONENT_NAME','l','Component Name','C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','ibase.webitm.ejb.gstclient.EInvoiceIRNGenPrc');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',3,'XML_DATA_1','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',4,'XML_DATA__ALL','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',5,'OBJ_CONTEXT','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirngen_gd',6,'XTRA_PARAMS',null,null,null,null,to_date('26-11-19','DD-MM-RR'),null,null,null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('einvoiceirn_gen','Action to process the Data','http://localhost:9090/axis/services/ProcessService','Base Information','process','String','S',null,null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',1,'COMPONENT_TYPE','l',null,'C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI','JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',2,'COMPONENT_NAME','l','Component Name','C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','ibase.webitm.ejb.gstclient.EInvoiceIRNGenPrc');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',3,'XML_DATA_1','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',4,'XML_DATA__ALL','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',5,'OBJ_CONTEXT','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_gen',6,'XTRA_PARAMS',null,null,null,null,to_date('26-11-19','DD-MM-RR'),null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC) values ('einvoiceirngen_prc',17,null,'Action Button for getting the data','get_data','a','V','GetData','1','3',null,'U',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'4',null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC)
values ('einvoiceirngen_prc',11,null,'Process','process','a','P','Process','2',null,null,'S',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'2',null,null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('einvoiceirngen_prc','1','itm_default','Y');
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('irncancel_url','IRN Cancel url','/gstcore/api/invoice/Cancel','Base Information','EINVOICE_API_URL','String','S',null,null,to_date('15-06-17','DD-MM-RR'),'BASE ','BASE',null,null,null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('irngen_url','IRN Gen url','/gstcore/api/Invoice','Base Information','EINVOICE_API_URL','String','S',null,null,to_date('15-06-17','DD-MM-RR'),'BASE ','BASE',null,null,null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('auth_url','authentication url','/gstvital/api/auth','Base Information','EINVOICE_API_URL','String','S',null,null,to_date('04-06-17','DD-MM-RR'),'BASE ','BASE',null,null,null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('base_url','Base URL for E invoice api calls','https://yoda.api.vayanagsp.in/gus/irp/nic','Base Information','EINVOICE_API_URL','String','S',null,null,to_date('21-06-17','DD-MM-RR'),'BASE ','BASE',null,null,null);
Insert into itm2menu (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY,DEFAULT_STATE,DEF_ACTION,MOB_DEPLY,ENT_TYPES)
values ('SCG',6,2,0,0,0,'w_einvoiceirncancel_prc','IRN Cancel','IRN Cancel','SCG.6.2.0.0.0',null,null,null,'P',null,null,null,'B',null,null,null,'0 ');
Insert into OBJ_FORMS (WIN_NAME,TITLE,OBJ_BROW_NAME,OBJ_EDIT_NAME,CROSS_UPDATE_EXPR,EXPR_FLD_INFO,TARGET_FLD_INFO,EXPR_COMMENT,FORM_NO,SCR_FLAG,AUTO_ACCEPT_SCAN,SCAN_FLAG,SCAN_METADATA,PROPERTY_INFO,SCAN_DELIMITER,COLUMN_ON_SAVE,AFTER_SAVE,EXT_SETUP,EXT_METADATA,EXT_COM,AUTO_ACCEPT_WEIGHDATA,FORM_TYPE,DISP_METADATA,PARENT_KEY_COL,QTY_COL,RATE_COL,ASSISTED_MODE,STORAGE_KEY_METADATA,SELECTION_MODE,DEFAULT_VIEW,AUTO_ADDON_ENTRY,DUPLICATE_ADD,DEFAULT_ROW_CNT,FREEZE_COL_POS,IS_MANDATORY,TRAN_ID_COL,SELECTION_OPT,KEY_INFO,THUMB_OBJ,THUMB_IMAGE_COL,THUMB_ALT_COL,FORM_NAME,FORM_ICON,FORM_VIEW_OPTS,X_COLUMN,Y_COLUMN,ACTION_ARG)
values ('w_einvoiceirncancel_prc','IRN Cancel',null,null,null,null,null,null,'1','F',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'A',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'DetailForm.png',null,null,null,null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT)
values ('einvoiceirncancel_prc','process','1','einvoiceirn_can',null,'0',to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','2','JB','ibase.webitm.ejb.gstclient.EInvoiceIRNCancelPrc',null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION)
values ('einvoiceirn_can','Action to process the Data','http://localhost:9090/axis/services/ProcessService','Base Information','process','String','S',null,null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',1,'COMPONENT_TYPE','l',null,'C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI','JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',2,'COMPONENT_NAME','l','Component Name','C.String',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI','ibase.webitm.ejb.gstclient.EInvoiceIRNCancelPrc');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',3,'XML_DATA_1','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',4,'XML_DATA__ALL','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI ','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',5,'OBJ_CONTEXT','l',null,'S',null,to_date('26-11-19','DD-MM-RR'),'NGADKARI','NGADKARI ',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('einvoiceirn_can',6,'XTRA_PARAMS',null,null,null,null,to_date('26-11-19','DD-MM-RR'),null,null,null);
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC)
values ('einvoiceirncancel_prc',11,null,'Process','process','a','P','Process','2',null,null,'S',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,'2',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VTAUTHERR ','Authentication error','Error while generating Authentication Token','E','Y',null,null,null,to_date('11-02-20','DD-MM-RR'),'BASE ','NGADKARI',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VTIRNNULL','GST IRN NOT FOUND','GST IRN not generated for this reference','E','Y',null,null,null,to_date('11-02-20','DD-MM-RR'),'BASE ','NGADKARI',null,null);
set define off
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VTEINVUPA','USERNAME PASSWORD IS MANDATORY','Please enter valid username and password','E','Y',null,null,null,to_date('11-02-20','DD-MM-RR'),'BASE ','NGADKARI',null,null);
alter table invoice add GST_IR_NO varchar2(120);
alter table DRCR_RCP add GST_IR_NO varchar2(120);
Insert into FINPARM (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,CHG_DATE,CHG_USER,CHG_TERM,DESCR,VAR_SUBS,ADDL_VALUE) values ('999999','GSP_TKN_TIMSTMP_FRMT','S','yyyyMMddHHmmssZ',to_date('02-10-17','DD-MM-RR'),'BASE ','BASE ','Timestamp format for GSP token string.',null,null);
Insert into FINPARM (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,CHG_DATE,CHG_USER,CHG_TERM,DESCR,VAR_SUBS,ADDL_VALUE)
values ('999999','GST_CLIENT_ID','S','l7xx1ea61d494798473aab193c4360cbdbd6',to_date('14-05-17','DD-MM-RR'),'BASE ','99SYSTEM4 ','Client ID to be used for GST API calling',null,null);
Insert into FINPARM (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,CHG_DATE,CHG_USER,CHG_TERM,DESCR,VAR_SUBS,ADDL_VALUE) values ('999999','GST_CLIENT_SECRET ','S','999b7433d472451eb3f7c20541b7725a',to_date('14-05-17','DD-MM-RR'),'BASE ','99SYSTEM4 ','Client secret to be used for GST API calling',null,null);
Insert into FINPARM (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,CHG_DATE,CHG_USER,CHG_TERM,DESCR,VAR_SUBS,ADDL_VALUE)
values ('999999','GSTN_PUB_KEY_NAME ','S','einv_sandbox',to_date('02-01-20','DD-MM-RR'),'BASE ','BASE ','GSTN public key name',null,null);
Insert into FINPARM (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,CHG_DATE,CHG_USER,CHG_TERM,DESCR,VAR_SUBS,ADDL_VALUE)
values ('999999','GSP_PRI_KEY_NAME ','S','GSP_Private_Prod_Key',to_date('02-01-20','DD-MM-RR'),'BASE ','BASE ','GSP private key name',null,null);
Insert into finparm (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,DESCR,VAR_SUBS,CHG_DATE,CHG_USER,CHG_TERM)
values ('999999','EINVOICE_LOG_PATH','S','EDI/einvoice_log','E-Invoice Log Path',0,to_date('01-02-20','DD-MM-RR'),'BASE ','base');
Insert into MAIL_FORMAT (FORMAT_CODE,FORMAT_TYPE,SEND_TO,COPY_TO,BLIND_COPY,SUBJECT,BODY_TEXT,BODY_COMP,PRIORITY,DELIVERY_REPORT,RETURN_RECEIPT,MAIL_APPLICATION,MAIL_SERVER,MAIL_BOX,MAIL_ID,ATTACH_TYPE,ATTACH_TEXT,WINNAME,WIN_NAME,MAIL_GENERATION,MAIL_DESCR,FN_NAME,COND_METHOD,EMAIL_EXPR,ATTACH_OBJECT,TEMPLATE_PURPOSE,STATUS,USER_ID__OWN)
values ('EINVOICE','T','<Detail1.email_addr>',null,null,'E-INVOICE LOG','Please find attached E-Invoice IRN generation process log',1,1,1,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
$PBExportHeader$d_einvoiceirncancel_prc11.srd
release 9;
datawindow(units=1 timer_interval=0 color=67108864 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 24 print.margin.right = 24 print.margin.top = 24 print.margin.bottom = 24 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=171 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=ref_no dbname="ref_no" )
column=(type=char(20) updatewhereclause=yes name=user_name dbname="user_name" )
column=(type=char(20) updatewhereclause=yes name=password dbname="password" )
)
text(band=detail alignment="1" text="Reference #:" border="0" color="33554432" x="110" y="58" height="15" width="73" html.valueishtml="0" name=ref_no_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=detail alignment="1" text="E-Invoice User Name:" border="0" color="33554432" x="58" y="91" height="15" width="125" html.valueishtml="0" name=user_name_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=detail alignment="1" text="Password:" border="0" color="33554432" x="111" y="124" height="15" width="72" html.valueishtml="0" name=password_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=1 alignment="0" tabsequence=10 border="5" color="33554432" x="191" y="58" height="18" width="80" format="[general]" html.valueishtml="0" name=ref_no visible="1" edit.limit=10 edit.case=upper edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=2 alignment="0" tabsequence=20 border="5" color="33554432" x="191" y="91" height="18" width="80" format="[general]" html.valueishtml="0" name=user_name visible="1" edit.limit=20 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=3 alignment="0" tabsequence=30 border="5" color="33554432" x="191" y="124" height="18" width="80" format="[general]" html.valueishtml="0" name=password visible="1" edit.limit=20 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
\ No newline at end of file
$PBExportHeader$d_einvoiceirngen_prc11.srd
release 9;
datawindow(units=1 timer_interval=0 color=67108864 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 24 print.margin.right = 24 print.margin.top = 24 print.margin.bottom = 24 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=273 color="536870912" )
table(column=(type=char(5) updatewhereclause=no name=site_code dbname="site_code" )
column=(type=date updatewhereclause=no name=from_date dbname="from_date" )
column=(type=date updatewhereclause=no name=to_date dbname="to_date" )
column=(type=char(20) updatewhereclause=no name=user_name dbname="user_name" )
column=(type=char(20) updatewhereclause=no name=password dbname="password" )
)
column(band=detail id=1 alignment="0" tabsequence=10 border="5" color="33554432" x="225" y="77" height="18" width="82" format="[general]" html.valueishtml="0" name=site_code visible="1" edit.limit=5 edit.case=upper edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=2 alignment="0" tabsequence=20 border="5" color="33554432" x="225" y="110" height="18" width="82" format="dd/mm/yy" html.valueishtml="0" name=from_date visible="1" edit.limit=0 edit.case=any edit.format="dd/mm/yy" edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
text(band=detail alignment="1" text="Site Code:" border="0" color="33554432" x="152" y="77" height="15" width="65" html.valueishtml="0" name=site_code_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=detail alignment="1" text="From Date:" border="0" color="33554432" x="152" y="110" height="15" width="65" html.valueishtml="0" name=from_date_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=3 alignment="0" tabsequence=30 border="5" color="33554432" x="225" y="143" height="18" width="82" format="dd/mm/yy" html.valueishtml="0" name=to_date visible="1" edit.limit=0 edit.case=any edit.format="dd/mm/yy" edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=4 alignment="0" tabsequence=40 border="5" color="33554432" x="225" y="169" height="16" width="82" format="[general]" html.valueishtml="0" name=user_name visible="1" edit.limit=20 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.required=yes edit.autohscroll=yes edit.imemode=0 font.face="Liberation Sans" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=5 alignment="0" tabsequence=50 border="5" color="33554432" x="226" y="199" height="16" width="82" format="*********" html.valueishtml="0" name=password visible="1" edit.limit=20 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.password=yes edit.required=yes edit.imemode=0 font.face="Liberation Sans" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
text(band=detail alignment="1" text="To Date:" border="0" color="33554432" x="152" y="143" height="15" width="65" html.valueishtml="0" name=to_date_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=detail alignment="1" text="E-Invoice User Name:" border="0" color="33554432" x="92" y="169" height="15" width="125" html.valueishtml="0" name=user_name_t visible="1" font.face="Liberation Sans" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" )
text(band=detail alignment="1" text="Password:" border="0" color="33554432" x="152" y="198" height="15" width="65" html.valueishtml="0" name=password_t visible="1" font.face="Liberation Sans" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
\ No newline at end of file
$PBExportHeader$d_einvoiceirngen_prc12.srd
release 9;
datawindow(units=1 timer_interval=0 color=67108864 processing=1 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 24 print.margin.right = 24 print.margin.top = 24 print.margin.bottom = 24 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no grid.lines=0 )
header(height=19 color="536870912" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=22 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=ref_no dbname="ref_no" )
column=(type=char(10) updatewhereclause=yes name=ref_ser dbname="ref_ser" )
column=(type=date updatewhereclause=yes name=ref_date dbname="ref_date" )
column=(type=char(10) updatewhereclause=yes name=cust_code dbname="cust_code" )
column=(type=char(130) updatewhereclause=yes name=customer_name dbname="customer_name" )
column=(type=char(10) updatewhereclause=yes name=cust_code__bil dbname="cust_code__bil" )
column=(type=char(120) updatewhereclause=yes name=customer_name_1 dbname="customer_name_1" )
column=(type=char(10) updatewhereclause=yes name=tax_class dbname="tax_class" )
column=(type=char(10) updatewhereclause=yes name=tax_chap dbname="tax_chap" )
column=(type=char(10) updatewhereclause=yes name=tax_env dbname="tax_env" )
column=(type=decimal(3) updatewhereclause=yes name=amount dbname="amount" )
column=(type=decimal(3) updatewhereclause=yes name=net_amt dbname="net_amt" )
column=(type=char(10) updatewhereclause=yes name=curr_code dbname="curr_code" )
column=(type=decimal(3) updatewhereclause=yes name=exch_rate dbname="exch_rate" )
column=(type=char(10) updatewhereclause=yes name=inv_type dbname="inv_type" )
)
text(band=header alignment="0" text="Reference #" border="6" color="33554432" x="2" y="2" height="15" width="80" html.valueishtml="0" name=ref_no_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Reference Ser" border="6" color="33554432" x="84" y="2" height="15" width="80" html.valueishtml="0" name=ref_ser_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Reference Date" border="6" color="33554432" x="166" y="2" height="15" width="64" html.valueishtml="0" name=ref_date_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Customer Code" border="6" color="33554432" x="232" y="2" height="15" width="80" html.valueishtml="0" name=cust_code_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Customer Name" border="6" color="33554432" x="314" y="2" height="15" width="109" html.valueishtml="0" name=customer_name_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Customer Code Bill" border="6" color="33554432" x="425" y="2" height="15" width="87" html.valueishtml="0" name=cust_code__bil_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Customer Name" border="6" color="33554432" x="514" y="2" height="15" width="113" html.valueishtml="0" name=customer_name_1_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Tax Env" border="6" color="33554432" x="793" y="2" height="15" width="80" html.valueishtml="0" name=tax_env_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Tax Chap" border="6" color="33554432" x="711" y="2" height="15" width="80" html.valueishtml="0" name=tax_chap_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Tax Class" border="6" color="33554432" x="629" y="2" height="15" width="80" html.valueishtml="0" name=tax_class_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="1" text="Amount" border="6" color="33554432" x="875" y="2" height="15" width="64" html.valueishtml="0" name=amount_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="1" text="Net Amount" border="6" color="33554432" x="941" y="2" height="15" width="64" html.valueishtml="0" name=net_amt_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="1" text="Exch Rate" border="6" color="33554432" x="1089" y="2" height="15" width="64" html.valueishtml="0" name=exch_rate_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Currency Code" border="6" color="33554432" x="1007" y="2" height="15" width="80" html.valueishtml="0" name=curr_code_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Inv Type" border="6" color="33554432" x="1155" y="2" height="15" width="80" html.valueishtml="0" name=inv_type_t visible="1" font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=3 alignment="0" tabsequence=32766 border="5" color="33554432" x="166" y="2" height="18" width="64" format="[general]" html.valueishtml="0" name=ref_date visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=4 alignment="0" tabsequence=32766 border="5" color="33554432" x="232" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=cust_code visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=5 alignment="0" tabsequence=32766 border="5" color="33554432" x="314" y="2" height="18" width="109" format="[general]" html.valueishtml="0" name=customer_name visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=6 alignment="0" tabsequence=32766 border="5" color="33554432" x="425" y="2" height="18" width="87" format="[general]" html.valueishtml="0" name=cust_code__bil visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=7 alignment="0" tabsequence=32766 border="5" color="33554432" x="514" y="2" height="18" width="113" format="[general]" html.valueishtml="0" name=customer_name_1 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=8 alignment="0" tabsequence=32766 border="5" color="33554432" x="629" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=tax_class visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=9 alignment="0" tabsequence=32766 border="5" color="33554432" x="711" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=tax_chap visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=10 alignment="0" tabsequence=32766 border="5" color="33554432" x="793" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=tax_env visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=11 alignment="1" tabsequence=32766 border="5" color="33554432" x="875" y="2" height="18" width="64" format="[general]" html.valueishtml="0" name=amount visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=12 alignment="1" tabsequence=32766 border="5" color="33554432" x="941" y="2" height="18" width="64" format="[general]" html.valueishtml="0" name=net_amt visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=13 alignment="0" tabsequence=32766 border="5" color="33554432" x="1007" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=curr_code visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=14 alignment="1" tabsequence=32766 border="5" color="33554432" x="1089" y="2" height="18" width="64" format="[general]" html.valueishtml="0" name=exch_rate visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=15 alignment="0" tabsequence=32766 border="5" color="33554432" x="1155" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=inv_type visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=1 alignment="0" tabsequence=32766 border="5" color="33554432" x="2" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=ref_no visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
column(band=detail id=2 alignment="0" tabsequence=32766 border="5" color="33554432" x="84" y="2" height="18" width="80" format="[general]" html.valueishtml="0" name=ref_ser visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
\ No newline at end of file
package ibase.webitm.ejb.gstclient;
import java.security.PrivateKey;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.UUID;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.json.JsonValue;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.json.JSONArray;
import org.json.JSONObject;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonValue;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import org.w3c.dom.NodeList;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.utility.MailInfo;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.ejb.mfg.MfgCommon;
import ibase.webitm.util.gst.AESEncryption;
import ibase.webitm.util.gst.GSPSignature;
import ibase.webitm.util.gst.GSTCommonUtil;
import ibase.webitm.util.gst.PubKeyEncryption;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.sys.UtilMethods;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.http.HttpResponse;
@javax.ejb.Stateless
public class EInvoiceIRNCancelPrc extends ProcessEJB {
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
DBAccessEJB dbAccess = new DBAccessEJB();
FinCommon finCommon = new FinCommon();
String logPath="",siteCodes="",fileName="",siteGstin="";
public String process(String xmlString, String xmlString2, String objContext, String xtraParams)
throws ITMException {
String retStr = "";
Document detailDom = null;
Document headerDom = null;
try {
System.out.println("xmlString [" + xmlString + "]");
System.out.println("xmlString2 [" + xmlString2 + "]");
System.out.println("objContext [" + objContext + "]");
System.out.println("xtraParams [" + xtraParams + "]");
if (xmlString != null && xmlString.trim().length() != 0) {
headerDom = e12GenericUtility.parseString(xmlString);
}
if (xmlString2 != null && xmlString2.length() != 0) {
detailDom = e12GenericUtility.parseString(xmlString2);
}
retStr = process(headerDom, detailDom, objContext, xtraParams);
} catch (Exception e) {
System.out.println("EInvoiceIRNCancelPrc.process()[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
}
return retStr;
}
public String process(Document headerDom, Document detailDom, String objContext, String xtraParams)
throws ITMException {
String errString = "";
String BASE_API_URL = "";
String AUTH_TOKEN_URL = "";
String GSTR_RETSTAT_URL = "";
String IRN_CANCEL_URL = "";
String IRN_GEN_URL = "";
String errMsg = "";
String errorDet = "";
String respJsoninBase64 = "";
String gstrIRNdata = "";
final String APPLICATION_JSON = "application/json";
String appKey = "";
String encryptedPayload = "";
byte[] appKeyInBytes = null,pass=null;
String appKeyEncryptedAndCoded = "";
String clientId = "";
String clientSecret = "";
String userName = "", gstin = "", encrPassword = "", authToken = "";
byte[] authSEK = null;
String fileDownloadDir = "";
String saveFilePath = "";
String gstDateFormat = "";
String gspTokenTimeStampFormat = "";
String pubkeypath="",password="",gstnPublicKeyName="",gspPrivateKeyName="";
AESEncryption aesEncryption = null;
PubKeyEncryption pubKeyEncryption = null;
Connection conn = null;
GSPSignature gspSignature;
PrivateKey aspPrivateKey = null;
SimpleDateFormat gspTokenTimeFormatter = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
boolean isError = false;
String sek="" ,gspAuthString = "", gspAuthSignature = "",invoiceID="",sql="",siteCode="", timeStamp="",status="",irn="";
Node currDetail = null;
int noOfDetails = 0;
NodeList detailList = null;
NodeList detailNodeList = null;
Node detailNode = null;
int lltrue = 0,lineNo=0;
int nodeListLength=0,cnt=0;
PreparedStatement pstmt = null,pstmt1 = null;
UtilMethods utilMethods = null;
ResultSet rs = null,rs1 = null;
HashMap detailMap=null;
String refNo="",refSer="",custCode="",custGstin="",itemCode="",itemDesc="",unit="";
long stcd=0,pin=0,ph=0;
JSONObject jsonObjIRNCan=null,tempObj1=null, errorJSON=null,gstIRNObj=null,object=null,objectData=null,reqBody=null,authTokenReqObj=null,authTokenReqObjData=null;
Date tranDate=null,expDate=null,mfgDate=null;
JSONArray itemDetails=null,arrObj=null,jdonArrIRNCan=null;
double invAmt=0,igst=0,cgst=0,sgst=0,cess=0,assAmt=0,othAmt=0,totAmt=0,discAmt=0,totItemVal=0,rate=0,quantity=0;
List unitList=null;
byte[] respJsonInBytes=null;
try {
conn = getConnection();
FinCommon finCommon = new FinCommon();
utilMethods = new UtilMethods();
userName = e12GenericUtility.getColumnValue("user_name",headerDom);
password = e12GenericUtility.getColumnValue("password",headerDom);
refNo = checkNullandTrim(e12GenericUtility.getColumnValue("ref_no",headerDom));
sql="SELECT count(*) from invoice where invoice_id=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(cnt == 0)
{
sql="SELECT count(*) from drcr_rcp where tran_id=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(cnt > 0)
{
refSer="DRCR";
}
else
{
errString = itmDBAccessEJB.getErrorString("","VTMISCREF","","",conn);
return errString;
}
}
else
{
refSer="S-INV";
}
if("S-INV".equalsIgnoreCase(refSer))
{
sql="SELECT site_code,gst_ir_no from invoice where invoice_id=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode = rs.getString(1);
irn = rs.getString(2);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
if("DRCR".equalsIgnoreCase(refSer))
{
sql="SELECT site_code,gst_ir_no from drcr_rcp where tran_id=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if(rs.next())
{
siteCode = rs.getString(1);
irn = rs.getString(2);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
if(irn==null || irn.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VTIRNNULL","","",conn);
return errString;
}
sql="SELECT REG_NO FROM SITEREGNO WHERE SITE_CODE= ? AND ref_code='GSTIN_NO' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
gstin = rs.getString("REG_NO");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(gstin == null || gstin.trim().length() == 0 )
{
errString = itmDBAccessEJB.getErrorString("","VTNLGSTIN","","",conn);
return errString;
}
if(userName==null || userName.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VTEINVUPA","","",conn);
return errString;
}
if(password==null || password.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VTEINVUPA","","",conn);
return errString;
}
gstnPublicKeyName = finCommon.getFinparams("999999", "GSTN_PUB_KEY_NAME", conn);
gspPrivateKeyName = finCommon.getFinparams("999999", "GSP_PRI_KEY_NAME", conn);
if("NULLFOUND".equalsIgnoreCase(gstnPublicKeyName))
{
gstnPublicKeyName = "einv_sandbox";
}
if("NULLFOUND".equalsIgnoreCase(gspPrivateKeyName))
{
gspPrivateKeyName = "GSP_Private_Sandbox_Key";
}
clientId = finCommon.getFinparams("999999", "GST_CLIENT_ID", conn);
clientSecret = finCommon.getFinparams("999999", "GST_CLIENT_SECRET", conn);
fileDownloadDir = finCommon.getFinparams("999999", "GST_DOWNLOAD_DIR", conn);
gspTokenTimeStampFormat = finCommon.getFinparams("999999", "GSP_TKN_TIMSTMP_FRMT", conn);
sql = "SELECT SERVICE_CODE, SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE METHOD_NAME = 'EINVOICE_API_URL'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
switch(rs.getString("SERVICE_CODE"))
{
case "base_url" :
{
BASE_API_URL = rs.getString("SERVICE_URI");
}
break;
case "irncancel_url" :
{
IRN_CANCEL_URL = rs.getString("SERVICE_URI");
}
break;
case "irngen_url" :
{
IRN_GEN_URL = rs.getString("SERVICE_URI");
}
break;
case "auth_url" :
{
AUTH_TOKEN_URL = rs.getString("SERVICE_URI");
}
break;
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
//gstin = "27AAAPI3182M002";
/*gstin : 24AAAPI3182M002
username: test_24_001
password: Trial63$value*/
pubkeypath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator
+ "default/deploy/ibase.ear/ibase.war/webitm/resource/gst" + File.separator + gstnPublicKeyName
+ ".cer";
System.out.println("pubkeypath:" + pubkeypath);
InputStream pubKeyInpStream = new FileInputStream(pubkeypath);
gspTokenTimeFormatter = new SimpleDateFormat(gspTokenTimeStampFormat);
aesEncryption = new AESEncryption();
pubKeyEncryption = new PubKeyEncryption(pubKeyInpStream);
gspSignature = new GSPSignature();
String privateKeyPath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator
+ "default/deploy/ibase.ear/ibase.war/webitm/resource/gst" + File.separator + gspPrivateKeyName + ".pem";
aspPrivateKey = gspSignature.loadPrivateKey(new FileInputStream(privateKeyPath));
timeStamp = gspTokenTimeFormatter.format(new Date());
appKey = UUID.randomUUID().toString().replaceAll("-", "");
appKey = appKey.substring(appKey.length() - 32, appKey.length());
appKeyInBytes = aesEncryption.decodeBase64StringTOByte(appKey);
// appKeyInBytes=aesEncryption.createAESKey();
appKeyEncryptedAndCoded = pubKeyEncryption.encrypt(appKeyInBytes);
//password = "test@30Fgbn";
// pass = aesEncryption.decodeBase64StringTOByte(password);
pass = (password.getBytes("utf-8"));
// pass = aesEncryption.decodeBase64StringTOByte("abcdefg");
encrPassword = pubKeyEncryption.encrypt(pass);
gspAuthString = "v2.0::" + clientId + ":" + appKey + ":" + timeStamp + ":" + gstin + ":"+ "AUTHTOKEN";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
authTokenReqObj = new JSONObject();
authTokenReqObj.put("UserName",userName);//test_27_003
authTokenReqObj.put("Password", encrPassword);
authTokenReqObj.put("AppKey", appKeyEncryptedAndCoded);
authTokenReqObj.put("ForceRefreshAccessToken", true);
authTokenReqObjData = new JSONObject();
authTokenReqObjData.put("data", authTokenReqObj);
HttpRequest authTokenReq = Unirest.post(BASE_API_URL+AUTH_TOKEN_URL)
.header("Content-Type", "application/json")
.header("X-Asp-Auth-Token", gspAuthString).header("X-Asp-Auth-Signature", gspAuthSignature)
.body(new JsonNode(authTokenReqObjData.toString())).getHttpRequest();
System.out.println("authtoken url[" + authTokenReq.getUrl() + "]");
System.out.println("authtoken method[" + authTokenReq.getHttpMethod() + "]");
System.out.println("authtoken request header[" + authTokenReq.getHeaders() + "]");
System.out.println("authtoken request payload["
+ IOUtils.toString(authTokenReq.getBody().getEntity().getContent()) + "]");
HttpResponse<JsonNode> authTokenResp = authTokenReq.asJson();
System.out.println(String.format("authTokenResp Request : Status[%s] Response[%s]",
authTokenResp.getStatus(), authTokenResp.getBody()));
if (authTokenResp.getStatus() == 200) {
object = authTokenResp.getBody().getObject();
objectData = object.getJSONObject("Data");
System.out.println("Inside getStatus" + object);
System.out.println("" + objectData.has("AuthToken"));
System.out.println("status:" + object.getString("Status"));
if (objectData.has("AuthToken") && objectData.has("Sek") && objectData.has("UserName")
&& Objects.equals(object.getString("Status"), "1")) {
System.out.println("Inside");
authToken = objectData.getString("AuthToken");
sek = objectData.getString("Sek");
authSEK = aesEncryption.decrypt(sek, appKeyInBytes);
System.out.println("authSEK = " + aesEncryption.encodeBase64String(authSEK));
}
else
{
objectData = object.getJSONObject("ErrorDetails");
errMsg = "Message : "+objectData.toString();
System.out.println("errMsg objectData"+errMsg);
errString = utilMethods.getMsg(errMsg, "VTAUTHERR", conn);
return errString;
}
}
else
{
errorJSON = authTokenResp.getBody().getObject();
errMsg = "Message : "+errorJSON.getString("error");
System.out.println("errMsg"+errMsg);
errString = utilMethods.getMsg(errMsg, "VTAUTHERR", conn);
return errString;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
jsonObjIRNCan = new JSONObject();
jsonObjIRNCan.put("Irn", irn);
jsonObjIRNCan.put("CnlRsn", "1");
jsonObjIRNCan.put("CnlRem", "Wrong entry");
System.out.println("jsonObjInvoice [ "+jsonObjIRNCan.toString()+" ]");
encryptedPayload = aesEncryption.encryptBySymmetricKey(jsonObjIRNCan.toString(), aesEncryption.encodeBase64String(authSEK));
reqBody = new JSONObject();
reqBody.put("Data", encryptedPayload);
gspAuthString = "v2.0::" + clientId + ":" + refNo + ":" + timeStamp + ":" + gstin + ":";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest genIRNReq = Unirest.post(BASE_API_URL+IRN_CANCEL_URL)
.header("Content-Type", "application/json").header("Gstin", gstin)
.header("user_name", userName).header("AuthToken", authToken)
.header("X-Asp-Auth-Token", gspAuthString).header("X-Asp-Auth-Signature", gspAuthSignature)
.header("Accept-Encoding", "gzip").header("User-Agent", " Jetty/9.4.11.v20180605")
.body(new JsonNode(reqBody.toString())).getHttpRequest();
System.out.println("authtoken url[" + genIRNReq.getUrl() + "]");
System.out.println("authtoken method[" + genIRNReq.getHttpMethod() + "]");
System.out.println("authtoken request header[" + genIRNReq.getHeaders() + "]");
System.out.println("authtoken request payload["
+ IOUtils.toString(genIRNReq.getBody().getEntity().getContent()) + "]");
/* HttpResponse<String> genIRNRes12 = genIRNReq.asString();
HttpResponse<JsonNode> genIRNRes = null;
System.out.println("genIRNRes::::::"+genIRNRes12.getBody());*/
HttpResponse<JsonNode> genIRNRes = genIRNReq.asJson();
System.out.println(String.format("authTokenResp Request : Status[%s] Response[%s]", genIRNRes.getStatus(), genIRNRes.getBody()));
if (genIRNRes.getStatus() == 200) {
object = genIRNRes.getBody().getObject();
if (object.has("Data")) {
gstrIRNdata = object.getString("Data");
errorDet = object.getString("ErrorDetails");
status = object.getString("Status");
if("1".equalsIgnoreCase(status) )
{
respJsoninBase64 = aesEncryption.decrptyBySyymetricKey(gstrIRNdata, authSEK);
respJsonInBytes = aesEncryption.decodeBase64StringTOByte(respJsoninBase64);
gstIRNObj = new JSONObject(new String(respJsonInBytes));
System.out.println("IRNjson :" + gstIRNObj.toString());
irn=gstIRNObj.getString("Irn");
if("S-INV".equalsIgnoreCase(refSer))
{
sql = "update invoice set GST_IR_NO=? where invoice_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, irn);
pstmt.setString(2, refNo);
cnt= pstmt.executeUpdate();
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
else
{
sql = "update drcr_rcp set GST_IR_NO=? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, irn);
pstmt.setString(2, refNo);
cnt= pstmt.executeUpdate();
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else
{
arrObj = object.getJSONArray("ErrorDetails");
// System.out.println("ErrorDetails-------"+arrObj.toString());
errString = utilMethods.getMsg(arrObj.toString(), "VTPROUNSU9", conn);
return errString;
}
}
}
else
{
errorJSON = genIRNRes.getBody().getObject();
errMsg = "Message : "+errorJSON.getString("error");
errString = utilMethods.getMsg(errMsg, "VTPROUNSU9", conn);
return errString;
// System.out.println("errMsg"+errMsg);
}
} catch (Exception e) {
isError = true;
System.out.println("EINVOICEIRNGEN.process()[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
} finally {
System.out.println("Inside finally isError[" + isError + "]");
try {
if (isError) {
conn.rollback();
}
if ((errString == null || errString.trim().length() == 0) && !isError) {
System.out.println("inside commit");
conn.commit();
errString = itmDBAccessEJB.getErrorString("", "PRCSUCCESS", "", "", conn);
}
if (conn != null && !conn.isClosed()) {
conn.close();
conn = null;
}
} catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
}
}
System.out.println("Return String from process [" + errString + "]");
return errString;
}
public static byte[] createAESKey() {
byte[] appKey = null ;
try {
KeyGenerator gen = KeyGenerator.getInstance("AES");
gen.init(256);
SecretKey secret = gen.generateKey();
appKey = secret.getEncoded();
} catch (Exception e) {
e.printStackTrace();
}
return appKey;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
private String checkNullandTrim(String input) {
if (input == null)
{
input = "";
}
return input.trim();
}
}
package ibase.webitm.ejb.gstclient;
import ibase.webitm.ejb.*;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
//import ibase.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.w3c.dom.*;
@javax.ejb.Stateless
public class EInvoiceIRNGenIC extends ValidatorEJB
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String wfValData() throws RemoteException, ITMException
{
return "";
}
public String wfValData(String currXmlDataStr, String hdrXmlDataStr, String allXmlDataStr, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document currDom = null;
Document hdrDom = null;
Document allDom = null;
String errString = null;
try
{
System.out.println("Inside EInvoiceIRNGenIC wfValData");
if(currXmlDataStr != null && currXmlDataStr.trim().length()!=0)
{
currDom = genericUtility.parseString(currXmlDataStr);
}
if(hdrXmlDataStr != null && hdrXmlDataStr.trim().length()!=0)
{
hdrDom = genericUtility.parseString(hdrXmlDataStr);
}
if(allXmlDataStr != null && allXmlDataStr.trim().length()!=0)
{
allDom = genericUtility.parseString(allXmlDataStr);
}
errString = wfValData( currDom, hdrDom, allDom, objContext, editFlag, xtraParams );
}//end of try
catch(Exception e)
{
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}//end of catch
return errString ;
}//end of wfvalData() of xml string
public String wfValData(Document dom, Document dom1, Document allDom, String objContext, String editFlag,String xtraParams) throws RemoteException, ITMException
{
String errString = "",sql = "";
ResultSet rSet = null;
Connection conn = null;
PreparedStatement pstmt = null;
NodeList parentList = null;
NodeList childList = null;
int noOfChilds = 0;
String childNodeName = "";
Node childNode =null;
boolean isNumber = true;
String columnValue = "";
int currentFormNo = 0,count = 0;
ArrayList errList = new ArrayList();
ArrayList errFields = new ArrayList();
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String errorType = "",errCode="",userID="",siteCode="";
int cnt=0;
ResultSet rs = null;
try
{
conn = getConnection();
userID = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "LoginCode" );
if ( objContext != null && objContext.trim().length() > 0 )
{
currentFormNo = Integer.parseInt( objContext );
}
parentList = dom.getElementsByTagName("Detail" + 1 );
childList = parentList.item( 0 ).getChildNodes();
noOfChilds = childList.getLength();
for (int ctr = 0; ctr < noOfChilds; ctr++)
{
childNode = childList.item( ctr );
childNodeName = childNode.getNodeName();
System.out.println("childNodeName"+childNodeName);
if ( childNode != null && childNode.getFirstChild() != null )
{
columnValue = childNode.getFirstChild().getNodeValue();
}
if ( "site_code".equalsIgnoreCase( childNodeName ) )
{
siteCode = genericUtility.getColumnValue( childNodeName, dom );
sql = "Select Count(*) cnt from site where site_code = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( "cnt" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VMSITE1";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
int errListSize = errList.size();
cnt =0;
String errFldName = null;
if ( errList != null && errListSize > 0 )
{
for (cnt = 0; cnt < errListSize; cnt++ )
{
errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt);
System.out.println("errCode .........."+errCode);
errString = getErrorString( errFldName, errCode, userID );
errorType = errorType( conn , errCode );
if ( errString.length() > 0)
{
String bifurErrString = errString.substring( errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString =bifurErrString;//+"<trace>"+errMsg+"</trace>";
bifurErrString =bifurErrString+errString.substring( errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........."+errStringXml);
errString = "";
}
if ( errorType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors></Root>\r\n");
}
else
{
errStringXml = new StringBuffer( "" );
}
}
catch(Exception e)
{
System.out.println("Exception in EInvoiceIRNGenIC wfValData == >"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( rSet != null )
{
rSet.close();rSet = null;
}
if( pstmt != null )
{
pstmt.close();pstmt = null;
}
if( conn != null && ! conn.isClosed() )
{
conn.close();conn = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}//end of catch
} //end of finally
errString = errStringXml.toString();
return (errString);
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
try
{
System.out.println("Inside EInvoiceIRNGenIC itemChanged");
if (xmlString != null && xmlString.trim().length()!=0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length()!=0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length()!=0)
{
dom2 = genericUtility.parseString(xmlString2);
}
valueXmlString = itemChanged( dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams );
}
catch(Exception e)
{
throw new ITMException(e);
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
StringBuffer valueXmlString = new StringBuffer();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
int currentFormNo = 0 ;
String sql = "",currDateStr = "";
Timestamp monthDate = null;
Calendar calendar = new GregorianCalendar();
String loginSiteCode = "", fromDateStr = "", toDateStr = "";
Date fromDate = null, toDate = null;
try
{
conn = getConnection();
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
System.out.println("currentColumn["+currentColumn+"] && currentFormNo["+currentFormNo+"]");
switch(currentFormNo)
{
case 1 :
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
valueXmlString.append("<Detail1>\r\n");
if("itm_default".equalsIgnoreCase(currentColumn))
{
java.util.Date currDate1 = new java.util.Date();
currDateStr = sdf.format(currDate1);
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
valueXmlString.append("<site_code>").append("<![CDATA["+loginSiteCode+"]]>").append("</site_code>");
valueXmlString.append("<from_date>").append("<![CDATA["+currDateStr+"]]>").append("</from_date>");
valueXmlString.append("<to_date>").append("<![CDATA["+currDateStr+"]]>").append("</to_date>");
}
valueXmlString.append("</Detail1>");
}
break;
}
valueXmlString.append("</Root>");
}
catch(Exception e)
{
System.out.println("Exception inside EInvoiceIRNGenIC===>"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if(rs != null)
{
rs.close();rs = null;
}
if(conn != null)
{
conn.close();conn = null;
}
}
catch(Exception d)
{
d.printStackTrace();
}
}
return valueXmlString.toString();
}
private boolean checkNumeric( String noOfLabel ) throws Exception
{
char[] cArray = noOfLabel.toCharArray();
boolean isNumber = true;
for(int i = 0; i < cArray.length;i++)
{
if( !Character.isDigit(cArray[i]) )
{
isNumber = false;
}
}
return isNumber;
}
private String checkNull(String input)
{
if (input == null)
{
input="";
}
return input;
}
private String errorType( Connection conn , String errorCode )
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, checkNull(errorCode));
rs = pstmt.executeQuery();
while( rs.next() )
{
msgType = rs.getString("MSG_TYPE");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch ( Exception e )
{
e.printStackTrace();
}
}
return msgType;
}
}
package ibase.webitm.ejb.gstclient;
import java.security.PrivateKey;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.UUID;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.json.JsonValue;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.json.JSONArray;
import org.json.JSONObject;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonValue;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import org.w3c.dom.NodeList;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.utility.MailInfo;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.ejb.mfg.MfgCommon;
import ibase.webitm.util.gst.AESEncryption;
import ibase.webitm.util.gst.GSPSignature;
import ibase.webitm.util.gst.GSTCommonUtil;
import ibase.webitm.util.gst.PubKeyEncryption;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.sys.UtilMethods;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.http.HttpResponse;
@javax.ejb.Stateless
public class EInvoiceIRNGenPrc extends ProcessEJB {
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
DBAccessEJB dbAccess = new DBAccessEJB();
FinCommon finCommon = new FinCommon();
String logPath="",siteCodes="",fileName="",siteGstin="";
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws ITMException
{
String rtrStr = "";
Document headerDom = null;
Document detailDom = null;
try
{
if(xmlString != null && xmlString.trim().length()!=0 )
{
System.out.println("XML String *.....*:"+xmlString);
headerDom = e12GenericUtility.parseString(xmlString);
}
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
detailDom = e12GenericUtility.parseString(xmlString2);
}
rtrStr = getData(headerDom, detailDom, windowName, xtraParams);
}
catch (Exception e)
{
System.out.println("Exception :EInvoiceIRNGenPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
return rtrStr;
}
public String getData(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{
String errString = "",sql="",fromDateStr="",toDateStr="",siteCode="",tranDate="",taxDate="";
String preview = "",userName="",password="";
Connection conn = null;
StringBuffer xmlBuff = new StringBuffer("<?xml version = \"1.0\"?>");
xmlBuff.append("<DocumentRoot>");
xmlBuff.append("<description>").append("Datawindow Root").append("</description>");
xmlBuff.append("<group0>");
xmlBuff.append("<description>").append("Group0 description").append("</description>");
xmlBuff.append("<Header0>");
Timestamp fromDate=null,toDate=null;
int cnt=0;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
try
{
conn = getConnection();
SimpleDateFormat sdf = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
fromDateStr = e12GenericUtility.getColumnValue("from_date",headerDom);
toDateStr = e12GenericUtility.getColumnValue("to_date",headerDom);
siteCode = e12GenericUtility.getColumnValue("site_code",headerDom);
userName = e12GenericUtility.getColumnValue("user_name",headerDom);
password = e12GenericUtility.getColumnValue("password",headerDom);
sql = "Select Count(*) cnt from site where site_code = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( "cnt" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errString = itmDBAccessEJB.getErrorString("","VMSITE1","","",conn);
return errString;
}
if(userName==null || userName.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VTEINVUPA","","",conn);
return errString;
}
if(password==null || password.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VTEINVUPA","","",conn);
return errString;
}
cnt=0;
fromDate = Timestamp.valueOf(e12GenericUtility.getValidDateString(fromDateStr, e12GenericUtility.getApplDateFormat(), e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
toDate = Timestamp.valueOf(e12GenericUtility.getValidDateString(toDateStr, e12GenericUtility.getApplDateFormat(), e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "SELECT invoice.invoice_id, invoice.tran_date, invoice.cust_code, customer_a.cust_name as cust_name , invoice.cust_code__bil, customer_b.cust_name as cust_bil_name,"
+ "invoice.tax_class,invoice.tax_chap, invoice.tax_env,invoice.inv_amt,invoice.tax_amt, invoice.tax_date,invoice.disc_amt,"
+ "invoice.net_amt, invoice.curr_code, invoice.exch_rate, invoice.inv_type " +
" FROM invoice, customer customer_a, customer customer_b " +
" WHERE ( invoice.cust_code = customer_a.cust_code ) " +
" and ( invoice.cust_code__bil = customer_b.cust_code )" +
" and invoice.site_code= ? "+
" and invoice.tran_date >=? "+
" and invoice.tran_date <=? "+
" and invoice.gst_ir_no is null";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setTimestamp(2,fromDate);
pstmt.setTimestamp(3,toDate);
rs = pstmt.executeQuery();
while (rs.next())
{
if( rs.getTimestamp("tran_date") != null)
{
tranDate=sdf.format(rs.getTimestamp("tran_date"));
}
xmlBuff.append("<Detail2>");
xmlBuff.append("<ref_no>").append("<![CDATA[" + rs.getString("invoice_id") +"]]>").append("</ref_no>");
xmlBuff.append("<ref_ser>").append("<![CDATA[" +"S-INV" +"]]>").append("</ref_ser>");
xmlBuff.append("<ref_date>").append("<![CDATA[" + tranDate +"]]>").append("</ref_date>");
xmlBuff.append("<cust_code>").append("<![CDATA[" + rs.getString("cust_code") +"]]>").append("</cust_code>");
xmlBuff.append("<customer_name>").append("<![CDATA[" + rs.getString("cust_name") +"]]>").append("</customer_name>");
xmlBuff.append("<cust_code__bil>").append("<![CDATA[" + rs.getString("cust_code__bil") +"]]>").append("</cust_code__bil>");
xmlBuff.append("<customer_name_1>").append("<![CDATA[" + rs.getString("cust_bil_name") +"]]>").append("</customer_name_1>");
xmlBuff.append("<tax_class>").append("<![CDATA[" + rs.getString("tax_class") +"]]>").append("</tax_class>");
xmlBuff.append("<tax_chap>").append("<![CDATA[" + rs.getString("tax_chap") +"]]>").append("</tax_chap>");
xmlBuff.append("<tax_env>").append("<![CDATA[" + rs.getString("tax_env") +"]]>").append("</tax_env>");
xmlBuff.append("<amount>").append("<![CDATA[" + rs.getDouble("inv_amt") +"]]>").append("</amount>");
xmlBuff.append("<net_amt>").append("<![CDATA[" + rs.getDouble("net_amt") +"]]>").append("</net_amt>");
xmlBuff.append("<curr_code>").append("<![CDATA[" + rs.getString("curr_code") +"]]>").append("</curr_code>");
xmlBuff.append("<exch_rate>").append("<![CDATA[" + rs.getDouble("exch_rate") +"]]>").append("</exch_rate>");
xmlBuff.append("<inv_type>").append("<![CDATA[" + rs.getString("inv_type") +"]]>").append("</inv_type>");
xmlBuff.append("</Detail2>");
cnt++;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = " select drcr_rcp.tran_id, drcr_rcp.tran_ser,drcr_rcp.tran_date, drcr_rcp.cust_code, customer_a.cust_name as cust_name , "
+ " invoice.cust_code__bil, customer_b.cust_name as cust_bil_name,"
+ " invoice.tax_class,invoice.tax_chap, invoice.tax_env,drcr_rcp.amount,"
+ " drcr_rcp.amount__bc, drcr_rcp.curr_code, drcr_rcp.exch_rate, invoice.inv_type "
+ " from drcr_rcp,invoice, customer customer_a, customer customer_b "
+ " where ( drcr_rcp.invoice_id = invoice.invoice_id ) "
+ " and ( drcr_rcp.cust_code = customer_a.cust_code )"
+ " and ( invoice.cust_code__bil = customer_b.cust_code ) "
+ " and drcr_rcp.site_code= ?"
+ " and drcr_rcp.tran_date >=? "
+ " and drcr_rcp.tran_date <=? "
+ " and drcr_rcp.gst_ir_no is null";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setTimestamp(2,fromDate);
pstmt.setTimestamp(3,toDate);
rs = pstmt.executeQuery();
while (rs.next())
{
if( rs.getTimestamp("tran_date") != null)
{
tranDate=sdf.format(rs.getTimestamp("tran_date"));
}
xmlBuff.append("<Detail2>");
xmlBuff.append("<ref_no>").append("<![CDATA[" + rs.getString("tran_id") +"]]>").append("</ref_no>");
xmlBuff.append("<ref_ser>").append("<![CDATA[" +rs.getString("tran_ser") +"]]>").append("</ref_ser>");
xmlBuff.append("<ref_date>").append("<![CDATA[" + tranDate +"]]>").append("</ref_date>");
xmlBuff.append("<cust_code>").append("<![CDATA[" + rs.getString("cust_code") +"]]>").append("</cust_code>");
xmlBuff.append("<customer_name>").append("<![CDATA[" + rs.getString("cust_name") +"]]>").append("</customer_name>");
xmlBuff.append("<cust_code__bil>").append("<![CDATA[" + rs.getString("cust_code__bil") +"]]>").append("</cust_code__bil>");
xmlBuff.append("<customer_name_1>").append("<![CDATA[" + rs.getString("cust_bil_name") +"]]>").append("</customer_name_1>");
xmlBuff.append("<tax_class>").append("<![CDATA[" + rs.getString("tax_class") +"]]>").append("</tax_class>");
xmlBuff.append("<tax_chap>").append("<![CDATA[" + rs.getString("tax_chap") +"]]>").append("</tax_chap>");
xmlBuff.append("<tax_env>").append("<![CDATA[" + rs.getString("tax_env") +"]]>").append("</tax_env>");
xmlBuff.append("<amount>").append("<![CDATA[" + rs.getDouble("amount") +"]]>").append("</amount>");
xmlBuff.append("<net_amt>").append("<![CDATA[" + rs.getDouble("amount__bc") +"]]>").append("</net_amt>");
xmlBuff.append("<curr_code>").append("<![CDATA[" + rs.getString("curr_code") +"]]>").append("</curr_code>");
xmlBuff.append("<exch_rate>").append("<![CDATA[" + rs.getDouble("exch_rate") +"]]>").append("</exch_rate>");
xmlBuff.append("<inv_type>").append("<![CDATA[" + rs.getString("inv_type") +"]]>").append("</inv_type>");
xmlBuff.append("</Detail2>");
cnt++;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt==0)
{
errString = itmDBAccessEJB.getErrorString("","VTNOREC1","","",conn);
return errString;
}
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
errString= xmlBuff.toString();
}
catch (Exception e)
{
System.out.println("Exception :EInvoiceIRNGenPrc :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
}
catch(Exception e)
{
e.printStackTrace();
}
}
return errString;
}
public String process(String xmlString, String xmlString2, String objContext, String xtraParams)
throws ITMException {
String retStr = "";
Document detailDom = null;
Document headerDom = null;
try {
System.out.println("xmlString [" + xmlString + "]");
System.out.println("xmlString2 [" + xmlString2 + "]");
System.out.println("objContext [" + objContext + "]");
System.out.println("xtraParams [" + xtraParams + "]");
if (xmlString != null && xmlString.trim().length() != 0) {
headerDom = e12GenericUtility.parseString(xmlString);
}
if (xmlString2 != null && xmlString2.length() != 0) {
detailDom = e12GenericUtility.parseString(xmlString2);
}
retStr = process(headerDom, detailDom, objContext, xtraParams);
} catch (Exception e) {
System.out.println("GenerateGSTR3BPrc.process()[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
}
return retStr;
}
public String process(Document headerDom, Document detailDom, String objContext, String xtraParams)
throws ITMException {
String errString = "";
String BASE_API_URL = "";
String AUTH_TOKEN_URL = "";
String GSTR_RETSTAT_URL = "";
String IRN_CANCEL_URL = "";
String IRN_GEN_URL = "";
String errMsg = "";
String errorDet = "";
String respJsoninBase64 = "";
String gstrIRNdata = "";
final String APPLICATION_JSON = "application/json";
String appKey = "";
String encryptedPayload = "";
byte[] appKeyInBytes = null,pass=null;
String appKeyEncryptedAndCoded = "";
String clientId = "";
String clientSecret = "";
String userName = "", gstin = "", encrPassword = "", authToken = "";
byte[] authSEK = null;
String fileDownloadDir = "";
String status = "";
String gstDateFormat = "";
String gspTokenTimeStampFormat = "";
String pubkeypath="",password="",gstnPublicKeyName="",gspPrivateKeyName="";
AESEncryption aesEncryption = null;
PubKeyEncryption pubKeyEncryption = null;
Connection conn = null;
GSPSignature gspSignature;
PrivateKey aspPrivateKey = null;
SimpleDateFormat gspTokenTimeFormatter = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
boolean isError = false;
String sek="" ,gspAuthString = "", gspAuthSignature = "",invoiceID="",sql="",siteCode="", timeStamp="",sorder="",hsn="",lotNo="",lineType="",irn="";
Node currDetail = null;
int noOfDetails = 0;
NodeList detailList = null;
NodeList detailNodeList = null;
Node detailNode = null;
int lltrue = 0,lineNo=0;
int nodeListLength=0,cnt=0;
PreparedStatement pstmt = null,pstmt1 = null;
UtilMethods utilMethods = null;
ResultSet rs = null,rs1 = null;
HashMap detailMap=null;
String trdNm="",loc="",flNo="",dst="",em="",siteCodeShip="",custCodeDlv="",refNo="",refSer="",custCode="",custGstin="",itemCode="",itemDesc="",unit="";
long stcd=0,pin=0,ph=0;
JSONObject tempObj=null,jsonObjInvoice=null,tempObj1=null, errorJSON=null,gstIRNObj=null,object=null,objectData=null,reqBody=null,authTokenReqObj=null,authTokenReqObjData=null;
Date tranDate=null,expDate=null,mfgDate=null;
JSONArray itemDetails=null,arrObj=null;
double invAmt=0,igst=0,cgst=0,sgst=0,cess=0,assAmt=0,othAmt=0,totAmt=0,discAmt=0,totItemVal=0,rate=0,quantity=0;
List unitList=null;
byte[] respJsonInBytes=null;
try {
conn = getConnection();
FinCommon finCommon = new FinCommon();
utilMethods = new UtilMethods();
// gstnPublicKeyName = finCommon.getFinparams("999999", "EINVOICE_PASS",//
// conn);
siteCode = e12GenericUtility.getColumnValue("site_code",headerDom);
userName = e12GenericUtility.getColumnValue("user_name",headerDom);
password = e12GenericUtility.getColumnValue("password",headerDom);
siteCodes=siteCode;
gstnPublicKeyName = finCommon.getFinparams("999999", "GSTN_PUB_KEY_NAME", conn);
gspPrivateKeyName = finCommon.getFinparams("999999", "GSP_PRI_KEY_NAME", conn);
if("NULLFOUND".equalsIgnoreCase(gstnPublicKeyName))
{
gstnPublicKeyName = "einv_sandbox";
}
if("NULLFOUND".equalsIgnoreCase(gspPrivateKeyName))
{
gspPrivateKeyName = "GSP_Private_Sandbox_Key";
}
clientId = finCommon.getFinparams("999999", "GST_CLIENT_ID", conn);
clientSecret = finCommon.getFinparams("999999", "GST_CLIENT_SECRET", conn);
fileDownloadDir = finCommon.getFinparams("999999", "GST_DOWNLOAD_DIR", conn);
gspTokenTimeStampFormat = finCommon.getFinparams("999999", "GSP_TKN_TIMSTMP_FRMT", conn);
logPath = finCommon.getFinparams("999999", "EINVOICE_LOG_PATH", conn);
if("NULLFOUND".equalsIgnoreCase(logPath))
{
logPath = "EDI/einvoice_log";
}
sql = "SELECT SERVICE_CODE, SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE METHOD_NAME = 'EINVOICE_API_URL'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
switch(rs.getString("SERVICE_CODE"))
{
case "base_url" :
{
BASE_API_URL = rs.getString("SERVICE_URI");
}
break;
case "irncancel_url" :
{
IRN_CANCEL_URL = rs.getString("SERVICE_URI");
}
break;
case "irngen_url" :
{
IRN_GEN_URL = rs.getString("SERVICE_URI");
}
break;
case "auth_url" :
{
AUTH_TOKEN_URL = rs.getString("SERVICE_URI");
}
break;
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
sql="SELECT REG_NO FROM SITEREGNO WHERE SITE_CODE= ? AND ref_code='GSTIN_NO' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
gstin = rs.getString("REG_NO");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(gstin == null || gstin.trim().length() == 0 )
{
errString = itmDBAccessEJB.getErrorString("","VTNLGSTIN","","",conn);
return errString;
}
siteGstin=gstin;
//gstin = "27AAAPI3182M002";
/*gstin : 24AAAPI3182M002
username: test_24_001
password: Trial63$value*/
pubkeypath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator
+ "default/deploy/ibase.ear/ibase.war/webitm/resource/gst" + File.separator + gstnPublicKeyName
+ ".cer";
System.out.println("pubkeypath:" + pubkeypath);
InputStream pubKeyInpStream = new FileInputStream(pubkeypath);
gspTokenTimeFormatter = new SimpleDateFormat(gspTokenTimeStampFormat);
aesEncryption = new AESEncryption();
pubKeyEncryption = new PubKeyEncryption(pubKeyInpStream);
gspSignature = new GSPSignature();
String privateKeyPath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator
+ "default/deploy/ibase.ear/ibase.war/webitm/resource/gst" + File.separator + gspPrivateKeyName + ".pem";
aspPrivateKey = gspSignature.loadPrivateKey(new FileInputStream(privateKeyPath));
timeStamp = gspTokenTimeFormatter.format(new Date());
appKey = UUID.randomUUID().toString().replaceAll("-", "");
appKey = appKey.substring(appKey.length() - 32, appKey.length());
appKeyInBytes = aesEncryption.decodeBase64StringTOByte(appKey);
// appKeyInBytes=aesEncryption.createAESKey();
appKeyEncryptedAndCoded = pubKeyEncryption.encrypt(appKeyInBytes);
//password = "test@30Fgbn";
// pass = aesEncryption.decodeBase64StringTOByte(password);
pass = (password.getBytes("utf-8"));
// pass = aesEncryption.decodeBase64StringTOByte("abcdefg");
encrPassword = pubKeyEncryption.encrypt(pass);
gspAuthString = "v2.0::" + clientId + ":" + appKey + ":" + timeStamp + ":" + gstin + ":"+ "AUTHTOKEN";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
authTokenReqObj = new JSONObject();
authTokenReqObj.put("UserName",userName);//test_27_003
authTokenReqObj.put("Password", encrPassword);
authTokenReqObj.put("AppKey", appKeyEncryptedAndCoded);
authTokenReqObj.put("ForceRefreshAccessToken", true);
authTokenReqObjData = new JSONObject();
authTokenReqObjData.put("data", authTokenReqObj);
HttpRequest authTokenReq = Unirest.post(BASE_API_URL+AUTH_TOKEN_URL)
.header("Content-Type", "application/json")
.header("X-Asp-Auth-Token", gspAuthString).header("X-Asp-Auth-Signature", gspAuthSignature)
.body(new JsonNode(authTokenReqObjData.toString())).getHttpRequest();
System.out.println("authtoken url[" + authTokenReq.getUrl() + "]");
System.out.println("authtoken method[" + authTokenReq.getHttpMethod() + "]");
System.out.println("authtoken request header[" + authTokenReq.getHeaders() + "]");
System.out.println("authtoken request payload["
+ IOUtils.toString(authTokenReq.getBody().getEntity().getContent()) + "]");
HttpResponse<JsonNode> authTokenResp = authTokenReq.asJson();
System.out.println(String.format("authTokenResp Request : Status[%s] Response[%s]",
authTokenResp.getStatus(), authTokenResp.getBody()));
if (authTokenResp.getStatus() == 200) {
object = authTokenResp.getBody().getObject();
objectData = object.getJSONObject("Data");
System.out.println("Inside getStatus" + object);
System.out.println("" + objectData.has("AuthToken"));
System.out.println("status:" + object.getString("Status"));
if (objectData.has("AuthToken") && objectData.has("Sek") && objectData.has("UserName")
&& Objects.equals(object.getString("Status"), "1")) {
System.out.println("Inside");
authToken = objectData.getString("AuthToken");
sek = objectData.getString("Sek");
authSEK = aesEncryption.decrypt(sek, appKeyInBytes);
System.out.println("authSEK = " + aesEncryption.encodeBase64String(authSEK));
}
else
{
objectData = object.getJSONObject("ErrorDetails");
errMsg = "Message : "+objectData.toString();
System.out.println("errMsg objectData"+errMsg);
errString = utilMethods.getMsg(errMsg, "VTAUTHERR", conn);
return errString;
}
}
else
{
errorJSON = authTokenResp.getBody().getObject();
errMsg = "Message : "+errorJSON.getString("error");
System.out.println("errMsg"+errMsg);
errString = utilMethods.getMsg(errMsg, "VTAUTHERR", conn);
return errString;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
detailList = detailDom.getElementsByTagName("Detail2");
noOfDetails = detailList.getLength();
detailNodeList = detailDom.getElementsByTagName("Detail2");
nodeListLength = detailNodeList.getLength();
System.out.println("nodeListLength" + nodeListLength);
for (int n = 0; n < nodeListLength; n++)
{
detailNode = detailNodeList.item(n);
refNo =checkNullandTrim( e12GenericUtility.getColumnValueFromNode("ref_no", detailNode));
refSer = checkNullandTrim(e12GenericUtility.getColumnValueFromNode("ref_ser", detailNode));
jsonObjInvoice = new JSONObject();
jsonObjInvoice.put("TaxSch", "GST");
jsonObjInvoice.put("Version", "1.00");
jsonObjInvoice.put("Irn", "");
tempObj = new JSONObject();
{
tempObj.put("Catg", "B2B");
tempObj.put("RegRev", "RG");
tempObj.put("Typ", "REG");
tempObj.put("EcmTrn", "N");
tempObj.put("EcmGstin", "");
}
jsonObjInvoice.put("TranDtls", tempObj);
if("S-INV".equalsIgnoreCase(refSer))
{
sql = "SELECT TRAN_DATE,CUST_CODE,CUST_CODE__BIL,INV_AMT ,NET_AMT ,NET_AMT-TAX_AMT AS ASSESABLE_VALUE,DISC_AMT,SALE_ORDER,DISC_AMT,"
+
" nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0) as IGST_AMT,"
+ " nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0) as CGST_AMT,"
+
" nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0) as SGST_AMT,"
+
" nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0) as CESS_AMT,"
+
"nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and tax_code in (select tax_code from tax where tax_type ='C') and tax_perc > 0 and tax_amt > 0),0) as OTHCHAR_AMT"
+ " FROM INVOICE WHERE INVOICE_ID= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if (rs.next()) {
tranDate = rs.getDate("TRAN_DATE");
custCode = checkNullandTrim(rs.getString("CUST_CODE"));
invAmt = rs.getDouble("INV_AMT");
totAmt = rs.getDouble("NET_AMT");
assAmt = rs.getDouble("ASSESABLE_VALUE");
sorder = rs.getString("SALE_ORDER");
igst = rs.getDouble("IGST_AMT");
cgst = rs.getDouble("CGST_AMT");
sgst = rs.getDouble("SGST_AMT");
cess = rs.getDouble("CESS_AMT");
othAmt = rs.getDouble("OTHCHAR_AMT");
discAmt = rs.getDouble("DISC_AMT");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
sql = "SELECT CUST_CODE__DLV,SITE_CODE__SHIP FROM SORDER WHERE SALE_ORDER = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next()) {
custCodeDlv = checkNullandTrim(rs.getString("CUST_CODE__DLV"));
siteCodeShip = rs.getString("SITE_CODE__SHIP");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
tempObj = new JSONObject();
{
tempObj.put("Typ", "INV");
tempObj.put("No", refNo);
tempObj.put("Dt", tranDate);
}
jsonObjInvoice.put("DocDtls", tempObj);
detailMap = getSiteDetails(siteCode, conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
if( gstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Site Registration master for this site: "+siteCode,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Site description is blank "+siteCode,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Site address is not defined "+siteCode,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+siteCode,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this site: "+siteCode,"ERROR");
continue;
}
tempObj = new JSONObject();
{
tempObj.put("Gstin",gstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("SellerDtls", tempObj);
jsonObjInvoice.put("ShipDtls", tempObj);
detailMap=getCustomerDetails(custCode,conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
custGstin = (String) detailMap.get("GSTIN");
if( custGstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Customer master for this customer: "+custCode,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Customer description is blank "+custCode,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Customer address is not defined "+custCode,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+custCode,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this customer: "+custCode,"ERROR");
continue;
}
//System.out.println("CUSTCODE============= ");
tempObj = new JSONObject();
{
tempObj.put("Gstin",custGstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("BuyerDtls", tempObj);
if(custCode.equalsIgnoreCase(custCodeDlv))
{
jsonObjInvoice.put("DispDtls", tempObj);
}
else
{
detailMap=getCustomerDetails(custCodeDlv,conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
custGstin = (String) detailMap.get("GSTIN");
if( custGstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Customer master for this customer: "+custCodeDlv,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Customer description is blank "+custCodeDlv,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Customer address is not defined "+custCodeDlv,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+custCodeDlv,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this customer: "+custCodeDlv,"ERROR");
continue;
}
tempObj = new JSONObject();
{
tempObj.put("Gstin",custGstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("DispDtls", tempObj);
}
tempObj = new JSONObject();
{
tempObj.put("AssVal",assAmt);
tempObj.put("SgstVal", sgst);
tempObj.put("CgstVal", cgst);
tempObj.put("IgstVal",igst);
tempObj.put("CesVal", cess);
tempObj.put("StCesVal", 0);
tempObj.put("CesNonAdVal", 0);
tempObj.put("Disc", discAmt);
tempObj.put("OthChrg", othAmt);
tempObj.put("TotInvVal", totAmt);
}
jsonObjInvoice.put("ValDtls", tempObj);
unitList = new ArrayList<String>();
unitList= unitVal();
itemDetails=new JSONArray();
System.out.println("JSONArray ");
sql = "SELECT it.ITEM_CODE as ITEM_CODE ,it.line_no AS LINE_NO,"
+ " it.LINE_TYPE AS LINE_TYPE,"
+ " (it.quantity__stduom * it.RATE__STDUOM) as INV_AMT,"
+ " case when it.DISCOUNT > 0 then round((it.quantity__stduom * it.RATE__STDUOM) -((it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT),3) else round((it.quantity__stduom * it.RATE__STDUOM),3) END as ASS_AMT,"
+ " (it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT AS DISCOUNT," + " "
+ " nvl((select tax_amt from taxtran where tran_id=it.invoice_id"
+ " and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0) as IGST_AMT,"
+ " nvl((select tax_amt from taxtran where tran_id=it.invoice_id"
+ " and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0) as CGST_AMT,"
+ " nvl((select tax_amt from taxtran where tran_id=it.invoice_id"
+ " and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0) as SGST_AMT,"
+ " nvl((select tax_amt from taxtran where tran_id=it.invoice_id"
+ " and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0) as CESS_AMT,"
+ " nvl((select sum(tax_amt) from taxtran where tran_id=invoice_id"
+ " and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='C') and tax_perc > 0 and tax_amt > 0),0) as OTHCHAR_AMT,"
+ " (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END AS Unit FROM uom WHERE unit=it.unit ) AS UNIT,"
+ " (it.quantity__stduom) AS QUANTITY, it.RATE__STDUOM AS RATE,"
+ " item.hsn_no AS HSN_CODE,"
+ " item.DESCR as ITEM_DESC," + " it.LOT_NO as LOT_NO," + " it.EXP_DATE as EXP_DATE,"
+ " it.MFG_DATE as MFG_DATE," + " it.NET_AMT as TOT_ITEM_VAL "
+ " FROM invoice_trace it, item "
+ " WHERE item.item_code= it.item_code"
+ " AND it.invoice_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
cnt=0;
while (rs.next())
{
itemCode = rs.getString("ITEM_CODE");
itemDesc = rs.getString("ITEM_DESC");
lineType = rs.getString("LINE_TYPE");
hsn = rs.getString("HSN_CODE");
lotNo = rs.getString("LOT_NO");
lineNo = rs.getInt("LINE_NO");
totItemVal = rs.getDouble("TOT_ITEM_VAL");
assAmt = rs.getDouble("ASS_AMT");
unit = checkNullandTrim(rs.getString("UNIT"));
igst = rs.getDouble("IGST_AMT");
cgst = rs.getDouble("CGST_AMT");
sgst = rs.getDouble("SGST_AMT");
cess = rs.getDouble("CESS_AMT");
othAmt = rs.getDouble("OTHCHAR_AMT");
discAmt = rs.getDouble("DISCOUNT");
rate = rs.getDouble("RATE");
quantity = rs.getDouble("QUANTITY");
invAmt = rs.getDouble("INV_AMT");
expDate = rs.getDate("EXP_DATE");
mfgDate = rs.getDate("MFG_DATE");
if(hsn == null || hsn.trim().length() == 0)
{
printLog(refNo,refSer, "HSN number is not defined in item master for this item: "+itemCode,"ERROR");
cnt++;
break;
}
if(!unitList.contains(unit))
{
printLog(refNo,refSer, "Unit is not match with e-invoicing unit list " +unit,"ERROR");
cnt++;
break;
}
tempObj = new JSONObject();
{
tempObj.put("PrdNm",itemCode);
tempObj.put("PrdDesc", itemDesc);
tempObj.put("HsnCd", hsn);
tempObj.put("Barcde","");
tempObj.put("Qty", quantity);
tempObj.put("FreeQty", 0);
tempObj.put("Unit", unit);
tempObj.put("UnitPrice", rate);
tempObj.put("TotAmt", invAmt);
tempObj.put("Discount", discAmt);
tempObj.put("OthChrg", othAmt);
tempObj.put("AssAmt",assAmt);
tempObj.put("SgstRt", sgst);
tempObj.put("CgstRt", cgst);
tempObj.put("IgstRt", igst);
tempObj.put("CesRt", cess);
tempObj.put("CesNonAdval", 0);
tempObj.put("StateCes", 0);
tempObj.put("TotItemVal", totItemVal);
tempObj1 = new JSONObject();
{
tempObj1.put("Nm", lotNo);
tempObj1.put("ExpDt", expDate);
tempObj1.put("WrDt", mfgDate);
}
tempObj.put("BchDtls", tempObj1);
}
itemDetails.put(tempObj);
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if(cnt >0)
{
continue;
}
}
else
{
sql = "SELECT DRCR_RCP.TRAN_DATE AS TRAN_DATE, DRCR_RCP.CUST_CODE AS CUST_CODE, "
+ "NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE TRAN_ID=DRCR_RCP.TRAN_ID "
+ "AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='I') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS IGST_AMT, "
+ "NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE TRAN_ID=DRCR_RCP.TRAN_ID "
+ "AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='H') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS CGST_AMT, "
+ "NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE TRAN_ID=DRCR_RCP.TRAN_ID "
+ "AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='G') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS SGST_AMT,"
+ "NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE TRAN_ID=DRCR_RCP.TRAN_ID "
+ "AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='J')AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS CESS_AMT,"
+ "NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE TRAN_ID=DRCR_RCP.TRAN_ID "
+ "AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='C') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS OTHCHAR_AMT ,"
+ "(SELECT SUM(DRCR_AMT) FROM DRCR_RDET WHERE TRAN_ID=DRCR_RCP.TRAN_ID ) AS AMOUNT, "
+ "(SELECT SUM(NET_AMT) FROM DRCR_RDET WHERE TRAN_ID=DRCR_RCP.TRAN_ID ) AS NET_AMT, "
+ "(SELECT SUM (NET_AMT) -SUM(TAX_AMT) FROM DRCR_RDET WHERE TRAN_ID=DRCR_RCP.TRAN_ID ) AS ASSESABLE_VALUE, "
+ "INVOICE.SALE_ORDER ,DRCR_RCP.INVOICE_ID FROM DRCR_RCP,INVOICE WHERE ( DRCR_RCP.INVOICE_ID = INVOICE.INVOICE_ID ) "
+ "AND DRCR_RCP.TRAN_ID= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
if (rs.next()) {
tranDate = rs.getDate("TRAN_DATE");
custCode = checkNullandTrim(rs.getString("CUST_CODE"));
invAmt = rs.getDouble("AMOUNT");
totAmt = rs.getDouble("NET_AMT");
assAmt = rs.getDouble("ASSESABLE_VALUE");
sorder = rs.getString("SALE_ORDER");
igst = rs.getDouble("IGST_AMT");
cgst = rs.getDouble("CGST_AMT");
sgst = rs.getDouble("SGST_AMT");
cess = rs.getDouble("CESS_AMT");
othAmt = rs.getDouble("OTHCHAR_AMT");
invoiceID = rs.getString("INVOICE_ID");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
sql = "SELECT CUST_CODE__DLV,SITE_CODE__SHIP FROM SORDER WHERE SALE_ORDER = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next()) {
custCodeDlv = checkNullandTrim(rs.getString("CUST_CODE__DLV"));
siteCodeShip = rs.getString("SITE_CODE__SHIP");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
tempObj = new JSONObject();
{
if("DRNRCP".equalsIgnoreCase(refSer))
{
tempObj.put("Typ", "DBN");
}
if("CRNRCP".equalsIgnoreCase(refSer))
{
tempObj.put("Typ", "CRN");
}
tempObj.put("No", refNo);
tempObj.put("Dt", tranDate);
tempObj.put("OrgInvNo", invoiceID);
}
jsonObjInvoice.put("DocDtls", tempObj);
detailMap = getSiteDetails(siteCode, conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
if( gstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Site Registration master for this site: "+siteCode,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Site description is blank "+siteCode,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Site address is not defined "+siteCode,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+siteCode,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this site: "+siteCode,"ERROR");
continue;
}
tempObj = new JSONObject();
{
tempObj.put("Gstin",gstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("SellerDtls", tempObj);
jsonObjInvoice.put("ShipDtls", tempObj);
detailMap=getCustomerDetails(custCode,conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
custGstin = (String) detailMap.get("GSTIN");
if( custGstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Customer master for this customer: "+custCode,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Customer description is blank "+custCode,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Customer address is not defined "+custCode,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+custCode,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this customer: "+custCode,"ERROR");
continue;
}
tempObj = new JSONObject();
{
tempObj.put("Gstin",custGstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("BuyerDtls", tempObj);
if(custCode.equalsIgnoreCase(custCodeDlv))
{
jsonObjInvoice.put("DispDtls", tempObj);
}
else
{
detailMap=getCustomerDetails(custCodeDlv,conn);
trdNm = (String) detailMap.get("DESCR");
flNo = (String) detailMap.get("ADD2");
loc = (String) detailMap.get("ADD1");
dst = (String) detailMap.get("CITY");
pin = (long) detailMap.get("PIN");
stcd = (int) detailMap.get("STATE_CODE");
ph = (long) detailMap.get("TELE1");
em = (String) detailMap.get("EMAIL_ADDR");
custGstin = (String) detailMap.get("GSTIN");
if( custGstin.trim().length() == 0)
{
printLog(refNo,refSer, "GSTIN number not defined in Customer master for this customer: "+custCodeDlv,"ERROR");
continue;
}
if( trdNm.trim().length() == 0)
{
printLog(refNo,refSer, "Customer description is blank "+custCodeDlv,"ERROR");
continue;
}
if( loc.trim().length() == 0)
{
printLog(refNo,refSer, "Customer address is not defined "+custCodeDlv,"ERROR");
continue;
}
if(pin == 0)
{
printLog(refNo,refSer, "Pin code is not defined "+custCodeDlv,"ERROR");
continue;
}
if(stcd == 0)
{
printLog(refNo,refSer, "State code is not defined in State master for this customer: "+custCodeDlv,"ERROR");
continue;
}
tempObj = new JSONObject();
{
tempObj.put("Gstin",custGstin);
tempObj.put("TrdNm", trdNm);
tempObj.put("Bno", "");
tempObj.put("Bnm", "");
tempObj.put("Flno", flNo);
tempObj.put("Loc", loc);
tempObj.put("Dst", dst);
tempObj.put("Pin", pin);
tempObj.put("Stcd", stcd);
if(ph > 0)
{
tempObj.put("Ph", ph);
}
if(em.trim().length() > 0)
{
tempObj.put("Em", em);
}
}
jsonObjInvoice.put("DispDtls", tempObj);
}
tempObj = new JSONObject();
{
tempObj.put("AssVal",assAmt);
tempObj.put("SgstVal", sgst);
tempObj.put("CgstVal", cgst);
tempObj.put("IgstVal",igst);
tempObj.put("CesVal", cess);
tempObj.put("StCesVal", 0);
tempObj.put("CesNonAdVal", 0);
tempObj.put("Disc", 0);
tempObj.put("OthChrg", othAmt);
tempObj.put("TotInvVal", totAmt);
}
jsonObjInvoice.put("ValDtls", tempObj);
unitList = new ArrayList<String>();
unitList= unitVal();
itemDetails=new JSONArray();
//System.out.println("JSONArray ");
sql = "SELECT dt.ITEM_CODE as ITEM_CODE ,dt.line_no AS LINE_NO, (dt.QUANTITY * dt.RATE) as INV_AMT, "
+ "case when dt.DISCOUNT > 0 then round( (dt.QUANTITY * dt.RATE) -( (dt.QUANTITY * dt.RATE)/100 * dt.DISCOUNT),3) else round( (dt.QUANTITY * dt.RATE),3) END as ASS_AMT, "
+ " (dt.QUANTITY * dt.RATE)/100 * dt.DISCOUNT AS DISCOUNT, "
+ "nvl((select tax_amt from taxtran where tran_id=dt.TRAN_ID and trim(line_no)=trim(dt.line_no) "
+ "and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0) as IGST_AMT, "
+ "nvl((select tax_amt from taxtran where tran_id=dt.TRAN_ID and trim(line_no)=trim(dt.line_no) "
+ "and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0) as CGST_AMT, "
+ "nvl((select tax_amt from taxtran where tran_id=dt.TRAN_ID and trim(line_no)=trim(dt.line_no) "
+ "and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0) as SGST_AMT, "
+ "nvl((select tax_amt from taxtran where tran_id=dt.TRAN_ID and trim(line_no)=dt.line_no "
+ "and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0) as CESS_AMT, "
+ "nvl((select sum(tax_amt) from taxtran where tran_id=dt.TRAN_ID and trim(line_no)=dt.line_no "
+ "and tax_code in (select tax_code from tax where tax_type ='C') and tax_perc > 0 and tax_amt > 0),0) as OTHCHAR_AMT, "
+ "(SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END AS Unit FROM uom WHERE unit=INVOICE_TRACE.unit ) AS UNIT, "
+ "(dt.QUANTITY) AS QUANTITY, dt.RATE AS RATE, item.hsn_no AS HSN_CODE, item.DESCR as ITEM_DESC, "
+ "dt.LOT_NO as LOT_NO, INVOICE_TRACE.EXP_DATE as EXP_DATE, INVOICE_TRACE.MFG_DATE as MFG_DATE, dt.NET_AMT as TOT_ITEM_VAL "
+ "FROM DRCR_rDET dt, item ,INVOICE_TRACE "
+ "WHERE item.item_code= dt.item_code "
+ "and INVOICE_TRACE.invoice_id = DT.INVOICE_ID "
+ "and INVOICE_TRACE.LINE_NO = DT.LINE_NO__INVTRACE AND dt.TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
rs = pstmt.executeQuery();
cnt=0;
while (rs.next())
{
itemCode = rs.getString("ITEM_CODE");
itemDesc = rs.getString("ITEM_DESC");
hsn = rs.getString("HSN_CODE");
lotNo = rs.getString("LOT_NO");
lineNo = rs.getInt("LINE_NO");
totItemVal = rs.getDouble("TOT_ITEM_VAL");
assAmt = rs.getDouble("ASS_AMT");
unit = checkNullandTrim(rs.getString("UNIT"));
igst = rs.getDouble("IGST_AMT");
cgst = rs.getDouble("CGST_AMT");
sgst = rs.getDouble("SGST_AMT");
cess = rs.getDouble("CESS_AMT");
othAmt = rs.getDouble("OTHCHAR_AMT");
discAmt = rs.getDouble("DISCOUNT");
rate = rs.getDouble("RATE");
quantity = rs.getDouble("QUANTITY");
invAmt = rs.getDouble("INV_AMT");
expDate = rs.getDate("EXP_DATE");
mfgDate = rs.getDate("MFG_DATE");
if(hsn == null || hsn.trim().length() == 0)
{
printLog(refNo,refSer, "HSN number is not defined in item master for this item: "+itemCode,"ERROR");
cnt++;
break;
}
if(!unitList.contains(unit))
{
printLog(refNo,refSer, "Unit is not match with e-invoicing unit list " +unit,"ERROR");
cnt++;
break;
}
tempObj = new JSONObject();
{
tempObj.put("PrdNm",itemCode);
tempObj.put("PrdDesc", itemDesc);
tempObj.put("HsnCd", hsn);
tempObj.put("Barcde","");
tempObj.put("Qty", quantity);
tempObj.put("FreeQty", 0);
tempObj.put("Unit", unit);
tempObj.put("UnitPrice", rate);
tempObj.put("TotAmt", invAmt);
tempObj.put("Discount", discAmt);
tempObj.put("OthChrg", othAmt);
tempObj.put("AssAmt",assAmt);
tempObj.put("SgstRt", sgst);
tempObj.put("CgstRt", cgst);
tempObj.put("IgstRt", igst);
tempObj.put("CesRt", cess);
tempObj.put("CesNonAdval", 0);
tempObj.put("StateCes", 0);
tempObj.put("TotItemVal", totItemVal);
tempObj1 = new JSONObject();
{
tempObj1.put("Nm", lotNo);
tempObj1.put("ExpDt", expDate);
tempObj1.put("WrDt", mfgDate);
}
tempObj.put("BchDtls", tempObj1);
}
itemDetails.put(tempObj);
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs != null) {
rs.close();
rs = null;
}
if(cnt >0)
{
continue;
}
}
jsonObjInvoice.put("ItemList", itemDetails);
System.out.println("jsonObjInvoice [ "+jsonObjInvoice.toString()+" ]");
encryptedPayload = aesEncryption.encryptBySymmetricKey(jsonObjInvoice.toString(), aesEncryption.encodeBase64String(authSEK));
reqBody = new JSONObject();
reqBody.put("Data", encryptedPayload);
gspAuthString = "v2.0::" + clientId + ":" + refNo + ":" + timeStamp + ":" + siteGstin + ":";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest genIRNReq = Unirest.post(BASE_API_URL+IRN_GEN_URL)
.header("Content-Type", "application/json").header("Gstin", siteGstin)
.header("user_name", userName).header("AuthToken", authToken)
.header("X-Asp-Auth-Token", gspAuthString).header("X-Asp-Auth-Signature", gspAuthSignature)
.header("Accept-Encoding", "gzip").header("User-Agent", " Jetty/9.4.11.v20180605")
.body(new JsonNode(reqBody.toString())).getHttpRequest();
//System.out.println("authtoken url[" + genIRNReq.getUrl() + "]");
//System.out.println("authtoken method[" + genIRNReq.getHttpMethod() + "]");
//System.out.println("authtoken request header[" + genIRNReq.getHeaders() + "]");
/*System.out.println("authtoken request payload["
+ IOUtils.toString(genIRNReq.getBody().getEntity().getContent()) + "]");*/
HttpResponse<JsonNode> genIRNRes = genIRNReq.asJson();
System.out.println(String.format("authTokenResp Request : Status[%s] Response[%s]", genIRNRes.getStatus(), genIRNRes.getBody()));
if (genIRNRes.getStatus() == 200) {
object = genIRNRes.getBody().getObject();
if (object.has("Data")) {
gstrIRNdata = object.getString("Data");
errorDet = object.getString("ErrorDetails");
status = object.getString("Status");
//if(!"null".equalsIgnoreCase(gstrIRNdata) && "null".equalsIgnoreCase(errorDet) )
if("1".equalsIgnoreCase(status) )
{
respJsoninBase64 = aesEncryption.decrptyBySyymetricKey(gstrIRNdata, authSEK);
respJsonInBytes = aesEncryption.decodeBase64StringTOByte(respJsoninBase64);
gstIRNObj = new JSONObject(new String(respJsonInBytes));
System.out.println("IRNjson :" + gstIRNObj.toString());
irn=gstIRNObj.getString("Irn");
if("S-INV".equalsIgnoreCase(refSer))
{
sql = "update invoice set GST_IR_NO=? where invoice_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, irn);
pstmt.setString(2, refNo);
cnt= pstmt.executeUpdate();
if(cnt > 0)
{
printLog(refNo,refSer, "IRN successful for Invoice -"+refNo,"SUCCESS");
}
else
{
printLog(refNo,refSer, "Invoice ID not found in Database " ,"ERROR");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
else
{
sql = "update drcr_rcp set GST_IR_NO=? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, irn);
pstmt.setString(2, refNo);
cnt= pstmt.executeUpdate();
if(cnt > 0)
{
if("CRNRCP".equalsIgnoreCase(refSer))
{
printLog(refNo,refSer, "IRN successful for credit note -"+refNo,"SUCCESS");
}
else
{
printLog(refNo,refSer, "IRN successful for debit note -"+refNo,"SUCCESS");
}
}
else
{
printLog(refNo,refSer, "Tran ID not found in Database " ,"ERROR");
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else
{
arrObj = object.getJSONArray("ErrorDetails");
// System.out.println("ErrorDetails-------"+arrObj.toString());
printLog(refNo,refSer,"Response: "+ arrObj.toString() ,"ERROR");
}
}
}
else
{
errorJSON = genIRNRes.getBody().getObject();
errMsg = "Message : "+errorJSON.getString("error");
// System.out.println("errMsg"+errMsg);
printLog(refNo,refSer,"Response: "+ errMsg ,"ERROR");
}
}
sendMail(xtraParams,conn);
} catch (Exception e) {
isError = true;
System.out.println("EINVOICEIRNGEN.process()[" + e.getMessage() + "]");
e.printStackTrace();
throw new ITMException(e);
} finally {
System.out.println("Inside finally isError[" + isError + "]");
try {
if (isError) {
conn.rollback();
}
if ((errString == null || errString.trim().length() == 0) && !isError) {
System.out.println("inside commit");
conn.commit();
errString = itmDBAccessEJB.getErrorString("", "PRCSUCCESS", "", "", conn);
}
if (conn != null && !conn.isClosed()) {
conn.close();
conn = null;
}
} catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
}
}
System.out.println("Return String from process [" + errString + "]");
return errString;
}
public static byte[] createAESKey() {
byte[] appKey = null ;
try {
KeyGenerator gen = KeyGenerator.getInstance("AES");
gen.init(256);
SecretKey secret = gen.generateKey();
appKey = secret.getEncoded();
} catch (Exception e) {
e.printStackTrace();
}
return appKey;
}
public HashMap getSiteDetails(String siteCode , Connection conn) throws ITMException
{
PreparedStatement pstmt = null;
String sql = "";
ResultSet rs = null,rs1 = null;
HashMap paramMap=null;
try {
paramMap = new HashMap();
sql="SELECT DESCR,ADD1,ADD2,CITY,PIN,(SELECT GST_CODE FROM STATE WHERE STATE_CODE = SITE.STATE_CODE) AS STATE_CODE,"
+ " TELE1,EMAIL_ADDR FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paramMap.put("DESCR" ,checkNull(rs.getString("DESCR")));
paramMap.put("ADD1" ,checkNull(rs.getString("ADD1")));
paramMap.put("ADD2" ,checkNull(rs.getString("ADD2")));
paramMap.put("PIN" ,rs.getLong("PIN"));
paramMap.put("STATE_CODE" ,rs.getInt("STATE_CODE"));
paramMap.put("TELE1" ,rs.getLong("TELE1"));
paramMap.put("EMAIL_ADDR" ,checkNull(rs.getString("EMAIL_ADDR")));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
}
return paramMap;
}
public HashMap getCustomerDetails(String custCode , Connection conn) throws ITMException
{
PreparedStatement pstmt = null;
String sql = "";
ResultSet rs = null,rs1 = null;
HashMap paramMap=null;
try {
paramMap = new HashMap();
sql="SELECT TAX_REG_2,CUST_NAME,ADDR1,ADDR2,CITY,PIN,(SELECT GST_CODE FROM STATE WHERE STATE_CODE = CUSTOMER.STATE_CODE) AS STATE_CODE,"
+ "TELE1,EMAIL_ADDR FROM CUSTOMER WHERE CUST_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
paramMap.put("DESCR" ,checkNull(rs.getString("CUST_NAME")));
paramMap.put("ADD1" ,checkNull(rs.getString("ADDR1")));
paramMap.put("ADD2" ,checkNull(rs.getString("ADDR2")));
paramMap.put("PIN" ,rs.getLong("PIN"));
paramMap.put("STATE_CODE" ,rs.getInt("STATE_CODE"));
paramMap.put("TELE1" ,rs.getLong("TELE1"));
paramMap.put("EMAIL_ADDR" ,checkNull(rs.getString("EMAIL_ADDR")));
paramMap.put("GSTIN" ,checkNull(rs.getString("TAX_REG_2")));
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
}
catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
}
return paramMap;
}
public List unitVal() throws ITMException
{
List unitList = new ArrayList<String>();
try
{
String unit[] = { "BAG", "BAL", "BDL", "BKL", "BOU", "BOX", "BTL", "BUN", "CAN", "CBM", "CCM", "CMS", "CTN",
"DOZ", "DRM", "GGK", "GMS", "GRS", "GYD", "KGS", "KLR", "KME", "LTR", "MTR", "MLT", "MTS", "NOS",
"OTH", "PAC", "PCS", "PRS", "QTL", "ROL", "SET", "SQF", "SQM", "SQY", "TBS", "TGM", "THD", "TON",
"TUB", "UGS", "UNT", "YDS"};
unitList=Arrays.asList(unit);
}
catch (Exception ex) {
ex.printStackTrace();
throw new ITMException(ex);
}
return unitList;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
private String checkNullandTrim(String input) {
if (input == null)
{
input = "";
}
return input.trim();
}
private void printLog(String refNo,String refSer, String msg,String text)
{
String logFile = "";
String logDir = "";
File logFileDir = null;
FileWriter fileWriter = null;
DistCommon distCommon = new DistCommon();
try
{
text=checkNullandTrim(text);
refSer=checkNullandTrim(refSer);
String logFileName = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EINVOICE_"+siteCodes+"_"+sdf.format(new Date());
System.out.println("Inside the print log method");
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + "EINVOICE";
System.out.println("Log direction: "+logDir);
logFileDir = new File(logDir);
if (!logFileDir.exists())
{
logFileDir.mkdirs();
}
logFile = logDir + File.separator + logFileName + ".log";
System.out.println("logFile: "+logFile);
//fileName=logFile;
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
java.util.Date now = new java.util.Date();
String strDate = sdfDate.format(now);
fileWriter = new FileWriter(logFile, true);
fileWriter.write("\r\n");
if("SUCCESS".equalsIgnoreCase(text))
{
if("S-INV".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+msg);
}
if("CRNRCP".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+msg);
}
if("DRNRCP".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+msg);
}
}
if("ERROR".equalsIgnoreCase(text))
{
if("S-INV".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+"Invoice:"+refNo+"-"+" "+msg);
}
if("CRNRCP".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+"Credit note:"+refNo+"-"+" "+msg);
}
if("DRNRCP".equalsIgnoreCase(refSer))
{
fileWriter.write(strDate+" "+"["+text+"] "+"Debit note:"+refNo+"-"+" "+msg);
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if (fileWriter != null)
{
fileWriter.flush();
fileWriter.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
private void sendMail(String xtraParams,Connection conn)throws ITMException, SQLException
{
StringBuffer commInfo = new StringBuffer();
String loginUser = "", mailRetStr="",formatCode="",emailAddr="",userType="",logFileName="",logDir = "";
loginUser = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
formatCode="EINVOICE";// send mail only for 'To'.
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
logFileName = "EINVOICE_"+siteCodes+"_"+sdf.format(new Date());
logDir = CommonConstants.JBOSSHOME +File.separator+logPath + File.separator + "EINVOICE";
fileName = logDir + File.separator + logFileName + ".log";
emailAddr = getEmailId(loginUser, conn);
System.out.println("@@@@@ emailAddr["+emailAddr+"]");
commInfo.append("<ROOT>");
commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>");
commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>");
commInfo.append("<TO_ADD></TO_ADD>");
commInfo.append("<BCC_ADD></BCC_ADD>");
commInfo.append("<FORMAT_CODE>"+formatCode+"</FORMAT_CODE>");
commInfo.append("<ATTACHMENT><BODY></BODY><LOCATION></LOCATION></ATTACHMENT>");
commInfo.append("</MAIL>");
commInfo.append("<XML_DATA><ROOT><Detail1><emp_code>"+loginUser+"</emp_code>");
commInfo.append("<email_addr>"+emailAddr+"</email_addr><cc_to></cc_to></Detail1></ROOT></XML_DATA>");
commInfo.append("<EMAIL_TYPE>page</EMAIL_TYPE><XML_DATA_FILE_PATH>"+fileName+"</XML_DATA_FILE_PATH><ENTITY_CODE></ENTITY_CODE>");
commInfo.append("</ROOT>");
EMail email = new EMail();
UserInfoBean userInfom = dbAccess.createUserInfo(loginUser);
try{
mailRetStr=email.sendMail(commInfo.toString(), "ITM", userInfom);
System.out.println("@V@ Mail return String :- ["+mailRetStr+"]");
}catch(Exception e)
{
e.getMessage();
}
if(mailRetStr.contains("S"))
{
System.out.println("@V@ loginUser :- [" + loginUser + "] Email Addres :- [" + emailAddr + "]");
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String getEmailId(String chgUser,Connection conn) throws SQLException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "", emailId = "", empCode = "";
try {
sql = " select email_id,emp_code from users where code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, chgUser);
rs = pStmt.executeQuery();
if (rs.next()) {
emailId = checkNull(rs.getString("email_id"));
empCode = checkNull(rs.getString("emp_code"));
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
if (emailId == null || emailId.trim().length() == 0) {
sql = " select email_id_off from employee where emp_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, empCode);
rs = pStmt.executeQuery();
if (rs.next()) {
emailId = checkNull(rs.getString("email_id_off"));
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
else if (emailId == null || emailId.trim().length() == 0) {
UserInfoBean userInfoBean = getUserInfo();
String enterprise = userInfoBean.getEnterprise();
sql = " select email_id from enterprise where enterprise = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, enterprise);
rs = pStmt.executeQuery();
if (rs.next()) {
emailId = checkNull(rs.getString("email_id"));
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
} catch (Exception e) {
e.printStackTrace();
}
return emailId;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment