Norādītais vecais variants no patreizējās lapas atšķiras ar:
Nākamā versija | Iepriekšējā versija | ||
lv:procedures [2020/07/23 14:22] marija izveidots |
lv:procedures [2020/10/27 19:06] marija ALG_rek_0610 |
||
---|---|---|---|
Rinda 1: | Rinda 1: | ||
- | Code versions test | + | <code> |
- | + | <?xml version="1.0" encoding="utf-8"?> | |
- | <code sql> | + | <xsl:stylesheet version="1.0" |
- | ALTER PROCEDURE [dbo].[xml_core_SISSE] AS | + | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
- | DECLARE @klient_kood bigint, @kood bigint, @nimitmp nvarchar(255),@addrtmp nvarchar(255),@konttmp nvarchar(255), @koodid varchar(1000) | + | xmlns:fo="http://www.w3.org/1999/XSL/Format" |
- | declare @ladu nvarchar(32), @seeria nvarchar(32), @objekt nvarchar(32), @s1 int, @s2 int, @webid nvarchar(32), @webtype nvarchar(32) | + | xmlns:msxsl="urn:schemas-microsoft-com:xslt" |
- | declare @number int, @maa int, @kmk nvarchar(32), @x int, @kinnitatud int | + | xmlns:js="urn:formulas" |
- | DECLARE @myyja nvarchar(32), @aeg datetime | + | exclude-result-prefixes="msxsl js fo"> |
- | declare @key nvarchar(32) | + | <xsl:output method="html"/> |
- | declare @web_kood nvarchar(32), @objkood nvarchar(32), @suletud nvarchar(32) | + | <xsl:decimal-format name="N" NaN="0" decimal-separator='.' grouping-separator=' ' /> |
- | declare @fintype nvarchar(32) | + | <xsl:template match="/"> |
- | declare @result1 xml, @result2 nvarchar(max) | + | <xsl:variable name="item_per_page">25</xsl:variable> |
- | declare @artikkel nvarchar(32), @id_exist int | + | <xsl:variable name="eiro"> |
- | declare @kl_kood nvarchar(32), @nimi nvarchar(255), @kustuta int, @appkey nvarchar(64), @appkey_event nvarchar(64),@ext_id nvarchar(32) | + | <xsl:choose> |
- | declare @sims_kood nvarchar(32), @projekt nvarchar(32), @event bigint, @event_id nvarchar(32) | + | <xsl:when test="/documents/document/valuuta='LVL'"> |
- | declare @koer nvarchar(max) | + | 1.42287181 |
- | declare @ag datetime | + | </xsl:when> |
- | declare @fcomment nvarchar(255) | + | <xsl:when test="/documents/document/valuuta=''"> |
- | declare @err nvarchar(32) | + | 1.42287181 |
- | set nocount on; | + | </xsl:when> |
- | set @key=CONVERT(nvarchar(max),getdate(),121) | + | <xsl:when test="/documents/document/valuuta='EUR'"> |
- | update in_kliendid2 set x=@key where x is null --customers in | + | 0.702804 |
- | update in_artiklid2 set x=@key where x is null --items in | + | </xsl:when> |
- | update in_tell_tellimused2 set x=@key where x is null --items in | + | <xsl:when test="/documents/document/valuuta!='EUR' and /documents/document/valuuta!='LVL'"> |
- | update in_mr_arved2 set x=@key where x is null --items in | + | <xsl:value-of select="/documents/document/kurssbv1"/> |
- | update in_ladu_sissetulekud set x=@key where x is null --items in | + | </xsl:when> |
- | + | </xsl:choose> | |
- | create TABLE #changes | + | </xsl:variable> |
- | ( | + | <xsl:variable name="nauda"> |
- | kood nvarchar(32), | + | <xsl:choose> |
- | field nvarchar(32), | + | <xsl:when test="/documents/document/valuuta='LVL'">LVL</xsl:when> |
- | enne nvarchar(255), | + | <xsl:when test="/documents/document/valuuta=''">LVL</xsl:when> |
- | nyyd nvarchar(255), | + | <xsl:when test="/documents/document/valuuta!='' and /documents/document!='LVL'"> |
- | cu nvarchar(32), | + | <xsl:value-of select="/documents/document/valuuta"/> |
- | aeg datetime | + | </xsl:when> |
- | + | </xsl:choose> | |
- | ) | + | </xsl:variable> |
- | create table #results | + | <xsl:variable name="nauda2"> |
- | (number nvarchar(32), tyyp nvarchar(32), result int, descr nvarchar(255), submittype nvarchar(32), ext_id nvarchar(32)) | + | <xsl:choose> |
- | + | <xsl:when test="/documents/document/valuuta='LVL'">EUR</xsl:when> | |
- | select @appkey=setting from settings with(nolock) where [id]='xmlcore_key' | + | <xsl:when test="/documents/document/valuuta=''">EUR</xsl:when> |
- | + | <xsl:when test="/documents/document/valuuta!='' and /documents/document!='LVL'">LVL</xsl:when> | |
- | + | </xsl:choose> | |
- | + | </xsl:variable> | |
- | declare customers cursor for select kood, appkey from in_kliendid2 where x=@key | + | <xsl:variable name="rekina_summa"> |
- | open customers | + | <xsl:choose> |
- | FETCH NEXT FROM customers INTO @webid, @appkey_event | + | <xsl:when test="$nauda='LVL'"> |
- | WHILE @@FETCH_STATUS = 0 | + | <xsl:value-of select="format-number((/documents/document/converted_tasuda div 100) * $eiro, '0.00')" /> |
- | BEGIN | + | </xsl:when> |
- | set @kl_kood=@webid | + | <xsl:when test="$nauda='EUR'"> |
- | if @appkey_event=@appkey | + | <xsl:value-of select="format-number(/documents/document/converted_tasuda div 100, '0.00')" /> |
- | begin | + | </xsl:when> |
- | if (select count(kood) from kliendid with(nolock) where kood=@webid)=0 | + | <xsl:when test="$nauda!='LVL' or $nauda!='EUR'"> |
- | begin | + | <xsl:value-of select="format-number(/documents/kontakt/saldo div /documents/document/kurssbv1, '0.00')"/> |
- | if (select count(kood) from pangad where kood=(select pank_swift from in_kliendid2 where kood=@webid and x=@key))=0 | + | </xsl:when> |
- | BEGIN | + | </xsl:choose> |
- | insert pangad (kood, nimi, swift) | + | </xsl:variable> |
- | select pank_swift, pank_nimi, pank_swift from in_kliendid2 where kood=@webid and x=@key | + | <xsl:variable name="saldo"> |
- | end | + | <xsl:choose> |
- | insert kliendid | + | <xsl:when test="$nauda='LVL' or $nauda='EUR'"> |
- | ( | + | <xsl:value-of select="format-number(/documents/kontakt/saldo, '0.00')"/> |
- | kood | + | </xsl:when> |
- | , nimi | + | <xsl:when test="$nauda!='LVL' or $nauda!='EUR'"> |
- | , kmregnr | + | <xsl:value-of select="format-number(/documents/kontakt/saldo div /documents/document/kurssbv1, '0.00')"/> |
- | , regnr | + | </xsl:when> |
- | , aadress1 | + | </xsl:choose> |
- | , aadress2 | + | |
- | , aadress3 | + | </xsl:variable> |
- | , lahaadress1 | + | <xsl:variable name="parads"> |
- | , lahaadress2 | + | <xsl:value-of select="format-number($saldo - $rekina_summa ,'0.00')"/> |
- | , lahaadress3 | + | </xsl:variable> |
- | , pank | + | <xsl:variable name="neapm_summa"> |
- | , arveldusarve | + | <xsl:choose> |
- | ) | + | <xsl:when test="/documents/document/valuuta!=''"> |
- | select | + | <xsl:value-of select="format-number($parads, '0.00')"/> |
- | kood | + | </xsl:when> |
- | , nimi | + | <xsl:when test="/documents/document/valuuta=''"> |
- | , kmregnr | + | <xsl:value-of select="$parads"/> |
- | , regnr | + | </xsl:when> |
- | , aadress1 | + | </xsl:choose> |
- | , aadress2 | + | </xsl:variable> |
- | , aadress3 | + | <xsl:variable name="atlaide"> |
- | , lahaadress1 | + | <xsl:choose><xsl:when test="sum(documents/document/rows/row[pross > 0]/pross) > 0">1</xsl:when> |
- | , lahaadress2 | + | <xsl:otherwise>0</xsl:otherwise> |
- | , lahaadress3 | + | </xsl:choose> |
- | , pank_swift | + | </xsl:variable> |
- | , pank_iban | + | <xsl:variable name="atlaides_summa"> |
- | from in_kliendid2 where kood=@webid | + | <xsl:for-each select="/documents/document/rows/row[pross > 0]"> |
- | + | <a_summa> | |
- | insert into #results values (@kl_kood, 'Customer', 0, 'CREATED','Customers',@webid) | + | <xsl:value-of select="format-number(hind*kogus*pross div 100, '0.0000')"/> |
- | END | + | </a_summa> |
- | ELSE | + | </xsl:for-each> |
- | BEGIN | + | </xsl:variable> |
- | if (select count(kood) from pangad where kood=(select pank_swift from in_kliendid2 where kood=@webid and x=@key))=0 | + | |
- | BEGIN | + | <script language="JavaScript" type="text/javascript"><![CDATA[ |
- | insert pangad (kood, nimi, swift) | + | if (document.getElementById('first')) { |
- | select pank_swift, pank_nimi, pank_swift from in_kliendid2 where kood=@webid and x=@key | + | document.write('<div class="pbreak"></div>'); |
- | end | + | } else { |
- | insert #changes | + | document.write('<div id="first"></div>'); |
- | select kood, 'aadress1', aadress1, (select aadress1 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | } |
- | union | + | ]]></script> |
- | select kood, 'aadress2', aadress2, (select aadress2 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | |
- | union | + | <html> |
- | select kood, 'aadress3', aadress3, (select aadress3 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | <head> |
- | union | + | <title><xsl:value-of select="/documents/language/arve_nr" /><!--Rēķins Nr.-->. <xsl:value-of select="/documents/document/number" /></title> |
- | select kood, 'nimi', nimi, (select nimi from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | |
- | union | + | <style type="text/css"> |
- | select kood, 'lahaadress1', lahaadress1, (select lahaadress1 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | body { |
- | union | + | text-align:center; |
- | select kood, 'lahaadress2', lahaadress2, (select lahaadress2 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | font-family:Century Gothic; |
- | union | + | font-size:10px; |
- | select kood, 'lahaadress3', lahaadress3, (select lahaadress3 from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | } |
- | union | + | |
- | select kood, 'pank', pank, (select pank_swift from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | .container { |
- | union | + | display:table; |
- | select kood, 'arveldusarve', arveldusarve, (select pank_iban from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | text-align:left; |
- | union | + | width:660px; |
- | select kood, 'regnr', regnr, (select regnr from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | margin:auto; |
- | union | + | } |
- | select kood, 'kmregnr', kmregnr, (select kmregnr from in_kliendid2 where kood=@webid and x=@key), 'xmlcore', getdate() from kliendid where kood=@webid | + | |
- | + | .main_table { | |
- | insert kliendid_ajalugu (kood, aeg, field, enne, nyyd, cu) | + | width:660px; |
- | select kood, aeg, field, enne, nyyd, cu from #changes where enne!=nyyd and kood=@webid | + | border-collapse:collapse; |
- | + | } | |
- | update kliendid | + | |
- | SET | + | .main_table th { |
- | nimi=z.nimi | + | font-size:14px; |
- | , aadress1=z.aadress1 | + | font-family:Century Gothic; |
- | , aadress2=z.aadress2 | + | font-weight:normal; |
- | , aadress3=z.aadress3 | + | text-align:right; |
- | , lahaadress1=z.lahaadress1 | + | padding:1px; |
- | , lahaadress2=z.lahaadress2 | + | border:1px solid #B4B4B4; |
- | , lahaadress3=z.lahaadress3 | + | } |
- | , pank=z.pank_swift | + | |
- | , arveldusarve=z.pank_iban | + | .main_table td { |
- | , regnr=z.regnr | + | font-size:10px; |
- | , kmregnr=z.kmregnr | + | font-family:Century Gothic; |
- | , cu='xmlcore' | + | padding:1px; |
- | , ts=getdate() | + | border:1px solid #B4B4B4; |
- | from | + | } |
- | (select * from in_kliendid2 where kood=@webid and x=@key) z | + | |
- | where kliendid.kood=@webid | + | .main_table td.nos, .main_table td.kods, .main_table th.nos, .main_table th.kods { |
- | + | text-align:left; | |
- | /* | + | } |
- | insert artiklid_ajalugu (kood, aeg, field, enne, nyyd, cu) | + | |
- | select kood, aeg, field, enne, nyyd, cu from #changes where enne!=nyyd | + | .main_table tr.cont { |
- | */ | + | height:16px; |
- | + | } | |
- | insert into #results values (@kl_kood, 'Customer', 1, 'UPDATED','Customers',@webid) | + | |
- | + | .left { | |
- | END | + | float:left; |
- | end | + | padding:30px 0px 0px 30px; |
- | else | + | font-size:14px; |
- | begin | + | } |
+ | |||
+ | .right { | ||
+ | float:right; | ||
+ | text-align:right; | ||
+ | font-size:14px; | ||
+ | } | ||
+ | .left2 { | ||
+ | float:left; | ||
+ | text-align:left; | ||
+ | font-size:14px; | ||
+ | } | ||
+ | |||
+ | .right_small { | ||
+ | float:right; | ||
+ | text-align:right; | ||
+ | } | ||
+ | |||
+ | .spacer { | ||
+ | height:20px; | ||
+ | clear:both; | ||
+ | } | ||
+ | |||
+ | .divider { | ||
+ | clear:both; | ||
+ | } | ||
+ | |||
+ | .pbreak { | ||
+ | page-break-after:always; | ||
+ | } | ||
+ | |||
+ | h4.pb { | ||
+ | display:none; | ||
+ | } | ||
+ | </style> | ||
+ | </head> | ||
+ | <body> | ||
+ | <div class="container"> | ||
+ | <div class="spacer" style="height:0px;"></div> | ||
+ | <div style="float:left;" class="left2" valign="bottom"> | ||
+ | <IMG height="90" alt="Logo"><xsl:attribute name="SRC" ><xsl:value-of select="/documents/footer/firma_logo"/></xsl:attribute></IMG> | ||
+ | </div> | ||
+ | <div class="right"> | ||
+ | <br /> | ||
+ | <xsl:choose><!--Rēķins Nr.--> | ||
+ | <xsl:when test="/documents/document/tingimus='K' and /documents/document/keel=''"><xsl:value-of select="/documents/document/maksetingimus_nimi" /> Nr. </xsl:when> | ||
+ | <xsl:when test="/documents/document/tingimus='K' and /documents/document/keel!=''">Credit note no. </xsl:when> | ||
+ | <xsl:when test="/documents/document/keel=''">Rēķins Nr. </xsl:when> | ||
+ | <xsl:otherwise><xsl:value-of select="/documents/language/arve_nr" />.</xsl:otherwise></xsl:choose><xsl:value-of select="/documents/document/number" /><br /> | ||
+ | <xsl:choose><!--Kreditē rēķinu Nr.--> | ||
+ | <xsl:when test="/documents/document/tingimus='K' and /documents/document/keel=''">Kreditē rēķinu Nr. <xsl:value-of select="/documents/document/kredarve" /><br /></xsl:when> | ||
+ | <xsl:when test="/documents/document/tingimus='K' and /documents/document/keel!=''">Credited invoice no. <xsl:value-of select="/documents/document/kredarve" /><br /></xsl:when> | ||
+ | </xsl:choose> | ||
+ | <xsl:choose><!--Datums--> | ||
+ | <xsl:when test="/documents/document/keel=''">Datums</xsl:when> | ||
+ | <xsl:otherwise><xsl:value-of select="/documents/language/aeg" /></xsl:otherwise></xsl:choose>:  | ||
+ | <xsl:variable name="day" select="substring(/documents/document/aeg_date,1,2)" /> | ||
+ | <xsl:variable name="month" select="substring(/documents/document/aeg_date,4,2)" /> | ||
+ | <xsl:variable name="year" select="substring(/documents/document/aeg_date,7,4)" /> | ||
+ | <xsl:variable name="menesis"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''"> | ||
+ | <xsl:if test="$month='01'">Janvāris</xsl:if> | ||
+ | <xsl:if test="$month='02'">Februāris</xsl:if> | ||
+ | <xsl:if test="$month='03'">Marts</xsl:if> | ||
+ | <xsl:if test="$month='04'">Aprīlis</xsl:if> | ||
+ | <xsl:if test="$month='05'">Maijs</xsl:if> | ||
+ | <xsl:if test="$month='06'">Jūnijs</xsl:if> | ||
+ | <xsl:if test="$month='07'">Jūlijs</xsl:if> | ||
+ | <xsl:if test="$month='08'">Augusts</xsl:if> | ||
+ | <xsl:if test="$month='09'">Septembris</xsl:if> | ||
+ | <xsl:if test="$month='10'">Oktobris</xsl:if> | ||
+ | <xsl:if test="$month='11'">Novembris</xsl:if> | ||
+ | <xsl:if test="$month='12'">Decembris</xsl:if> | ||
+ | </xsl:when> | ||
+ | <xsl:otherwise> | ||
+ | <xsl:if test="$month='01'">January</xsl:if> | ||
+ | <xsl:if test="$month='02'">February</xsl:if> | ||
+ | <xsl:if test="$month='03'">March</xsl:if> | ||
+ | <xsl:if test="$month='04'">April</xsl:if> | ||
+ | <xsl:if test="$month='05'">May</xsl:if> | ||
+ | <xsl:if test="$month='06'">June</xsl:if> | ||
+ | <xsl:if test="$month='07'">July</xsl:if> | ||
+ | <xsl:if test="$month='08'">August</xsl:if> | ||
+ | <xsl:if test="$month='09'">September</xsl:if> | ||
+ | <xsl:if test="$month='10'">October</xsl:if> | ||
+ | <xsl:if test="$month='11'">November</xsl:if> | ||
+ | <xsl:if test="$month='12'">December</xsl:if> | ||
+ | </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </xsl:variable> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''"><xsl:value-of select="concat($year,'. gada',' ',$day,'. ',$menesis)" /></xsl:when> | ||
+ | <xsl:otherwise><xsl:value-of select="concat($menesis,' ',$day,', ',$year)" /></xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | |||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/tellimusenr!=''"> | ||
+ | <br /> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Saskaņā ar priekšapmaksas rēķinu </xsl:when> | ||
+ | <xsl:otherwise>According to proforma invoice </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | <xsl:value-of select="/documents/document/tellimusenr" /> | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
- | insert into #results values (null, 'Customer', 2, 'Incorrect AppKey','Customers',@webid) | + | </div> |
- | end | + | |
- | + | <div class="spacer"></div> | |
- | set @x=@x+1 | + | |
- | FETCH NEXT FROM customers INTO @webid, @appkey_event | + | <div class="left2" valign="top"> |
- | END | + | <xsl:if test="/documents/kontakt/kontakt!=''"><xsl:value-of select="/documents/kontakt/kontakt" /><br /></xsl:if> |
- | CLOSE customers | + | <xsl:value-of select="/documents/document/klient_nimi" /><br /> |
- | DEALLOCATE customers | + | <xsl:if test="/documents/document/aadress1!=''"><xsl:value-of select="/documents/document/aadress1" /><br /></xsl:if> |
- | + | <xsl:if test="/documents/document/aadress2!=''"><xsl:value-of select="/documents/document/aadress2" /></xsl:if> | |
- | DECLARE items cursor for select kood, appkey from in_artiklid2 where x=@key | + | <xsl:if test="/documents/document/aadress3!=''"> <xsl:value-of select="/documents/document/aadress3" /><br /></xsl:if> |
- | open items | + | <xsl:choose> |
- | FETCH NEXT FROM items INTO @webid, @appkey_event | + | <xsl:when test="/documents/document/keel=''">Reģ. Nr.: </xsl:when> |
- | WHILE @@FETCH_STATUS = 0 | + | <xsl:otherwise>Reg. No.: </xsl:otherwise> |
- | BEGIN | + | </xsl:choose> |
- | set @kl_kood=@webid | + | <xsl:value-of select="/documents/kontakt/regnr" /><br /> |
- | if @appkey_event=@appkey | + | <xsl:choose> |
- | begin | + | <xsl:when test="/documents/document/keel=''">PVN Reģ. Nr.: </xsl:when> |
- | if (select count(kood) from artiklid where kood=@webid)=0 | + | <xsl:otherwise>VAT Reg. No.: </xsl:otherwise> |
- | BEGIN | + | </xsl:choose> |
- | insert artiklid ( | + | <xsl:value-of select="/documents/kontakt/kmregnr" /><br /> |
- | kood | + | <xsl:choose> |
- | , nimi | + | <xsl:when test="/documents/document/keel=''">Banka: </xsl:when> |
- | , klass | + | <xsl:otherwise>Bank: </xsl:otherwise> |
- | , baashind | + | </xsl:choose> |
- | , yhik | + | <xsl:value-of select="/documents/kontakt/pank" /><br /> |
- | , ts | + | <xsl:choose> |
- | , cu | + | <xsl:when test="/documents/document/keel=''">Konta Nr.: </xsl:when> |
- | ) | + | <xsl:otherwise>Account No.: </xsl:otherwise> |
- | select | + | </xsl:choose> |
- | kood | + | <xsl:value-of select="/documents/kontakt/arveldusarve" /><br /> |
- | , nimi | + | <xsl:choose> |
- | , klass | + | <xsl:when test="/documents/kontakt/lahaadress2!=''"> |
- | , convert(money,hind) | + | <xsl:choose> |
- | , yhik | + | <xsl:when test="/documents/document/keel=''">Piegādes adrese: </xsl:when> |
- | , getdate() | + | <xsl:otherwise>Delivery address: </xsl:otherwise> |
- | , 'xmlcore' | + | </xsl:choose> |
- | from in_artiklid2 where kood=@webid | + | <xsl:value-of select="/documents/kontakt/lahaadress2" /><br /> |
- | + | </xsl:when> | |
- | insert into #results values (@kl_kood, 'Item', 0, 'CREATED','Items',@webid) | + | </xsl:choose> |
- | end | + | </div> |
- | ELSE | + | |
- | BEGIN | + | <div class="right"> |
- | insert #changes | + | <xsl:value-of select="/documents/footer/firma_nimi" /><br /> |
- | select kood, 'nimi', nimi, (select nimi from in_artiklid2 where kood=@webid), 'xmlcore', getdate() from artiklid where kood=@webid | + | <xsl:if test="/documents/footer/firma_aadress!=''"><xsl:value-of select="/documents/footer/firma_aadress" /><br /></xsl:if> |
- | UNION | + | <xsl:if test="/documents/footer/firma_aadress2!=''"><xsl:value-of select="/documents/footer/firma_aadress2" /></xsl:if> |
- | select kood, 'klass', klass, (select klass from in_artiklid2 where kood=@webid), 'xmlcore', getdate() from artiklid where kood=@webid | + | <xsl:if test="/documents/footer/firma_aadress3!=''"> <xsl:value-of select="/documents/footer/firma_aadress3" /><br /></xsl:if> |
- | UNION | + | <xsl:choose> |
- | select kood, 'hind', convert(nvarchar(max),baashind), (select convert(nvarchar(max),hind) from in_artiklid2 where kood=@webid), 'xmlcore', getdate() from artiklid where kood=@webid | + | <xsl:when test="/documents/document/keel=''">Reģ. #: </xsl:when> |
- | UNION | + | <xsl:otherwise>Reg. #: </xsl:otherwise> |
- | select kood, 'yhik', yhik, (select yhik from in_artiklid2 where kood=@webid), 'xmlcore', getdate() from artiklid where kood=@webid | + | </xsl:choose><!--Reģ. Nr--><xsl:value-of select="/documents/footer/firma_regnr" /><br /> |
- | + | <xsl:choose> | |
- | + | <xsl:when test="/documents/document/keel=''">PVN Reģ. #: </xsl:when> | |
- | update artiklid | + | <xsl:otherwise>VAT Reg. #: </xsl:otherwise> |
- | set | + | </xsl:choose><!--PVN Reģ. Nr--><xsl:value-of select="/documents/footer/firma_kmnr" /><br /> |
- | nimi=z.nimi | + | </div> |
- | , klass=z.klass | + | |
- | , baashind=z.hind | + | <div class="spacer" style="height:60px;"></div> |
- | , yhik=z.yhik | + | |
- | from | + | <table class="main_table" height="380" cellspacing="0" cellpadding="0"> |
- | (select * from in_artiklid2 where kood=@webid) z | + | <tr class="cont"> |
- | where artiklid.kood=z.kood | + | <th class="kods" width="100"> |
- | + | <xsl:choose> | |
- | insert into #results values (@kl_kood, 'Item', 1, 'UPDATED','Items',@webid) | + | <xsl:when test="/documents/document/keel=''">Kods</xsl:when> |
- | + | <xsl:otherwise>Item</xsl:otherwise> | |
- | end | + | </xsl:choose><!--Kods--></th> |
- | END | + | <th class="nos" width="300"><!--Nosaukums--> |
- | else | + | <xsl:choose> |
- | BEGIN | + | <xsl:when test="/documents/document/keel=''">Nosaukums</xsl:when> |
- | insert into #results values (null, 'Item', 2, 'Incorrect AppKey','Items',@webid) | + | <xsl:otherwise>Description</xsl:otherwise> |
- | END | + | </xsl:choose> |
- | + | </th> | |
- | set @x=@x+1 | + | <th> <xsl:choose> |
- | FETCH NEXT FROM items INTO @webid, @appkey_event | + | <xsl:when test="/documents/document/keel=''">Mērv.</xsl:when> |
- | END | + | <xsl:otherwise>Unit</xsl:otherwise> |
- | CLOSE items | + | </xsl:choose><!--Mērvienība--></th> |
- | DEALLOCATE items | + | <th> <xsl:choose> |
- | + | <xsl:when test="/documents/document/keel=''">Daudz.</xsl:when> | |
- | + | <xsl:otherwise>Qty total</xsl:otherwise> | |
- | DECLARE orders cursor for select convert(nvarchar(max),number), appkey from in_tell_tellimused2 where x=@key | + | </xsl:choose><!--Daudz.--></th> |
- | open orders | + | <xsl:if test="$atlaide!=0"> |
- | FETCH NEXT FROM orders INTO @webid, @appkey_event | + | <th><xsl:choose> |
- | WHILE @@FETCH_STATUS = 0 | + | <xsl:when test="/documents/document/keel=''">Atlaide</xsl:when> |
- | BEGIN | + | <xsl:otherwise>Discount</xsl:otherwise> |
- | set @kl_kood=@webid | + | </xsl:choose><!--Atlaide--></th> |
- | if @appkey_event=@appkey | + | </xsl:if> |
- | begin | + | |
- | if (select count(number) from tell_tellimused where kliendi_tellimus=@webid)=0 | + | <th><xsl:choose> |
- | BEGIN | + | <xsl:when test="/documents/document/keel=''">Cena <xsl:value-of select="$nauda"/></xsl:when> |
- | EXEC dbo.get_dok_number @moodul='tellimus', @seeria='VEIKALIEMLV', @NUMBER = NULL, @cu='xmlcore', @aeg=@ag, @keel = 'default', @num =@number OUTPUT, @err = @err OUTPUT | + | <xsl:otherwise>Price <xsl:value-of select="$nauda"/></xsl:otherwise> |
- | + | </xsl:choose></th> | |
- | update tell_tellimused | + | <th><xsl:choose> |
- | set kliendi_tellimus=@webid | + | <xsl:when test="/documents/document/keel=''">Summa <xsl:value-of select="$nauda"/></xsl:when> |
- | ,klient_kood=z.klient_kood | + | <xsl:otherwise>Total <xsl:value-of select="$nauda"/></xsl:otherwise> |
- | ,klient_nimi=z.klient_nimi | + | </xsl:choose></th> |
- | ,arvetasub=z.arvetasub | + | </tr> |
- | ,lahetusaadress1=z.lahetusaadress1 | + | |
- | ,lahetusaadress2=z.lahetusaadress2 | + | <xsl:for-each select="/documents/document/rows/row"> |
- | ,lahetusaadress3=z.lahetusaadress3 | + | |
- | ,lisa_field1=case when (z.deal_type = '1') then N'Preču pārdošana' when (z.deal_type = '2') then N'Pakalpojuma sniegšana' else N'Preču piegāde' end | + | <tr class="cont"> |
- | ,aeg=z.aeg | + | <xsl:choose> |
- | ,tingimus=z.tingimus | + | <xsl:when test="artikkel!=''"> |
- | ,kommentaar=z.kommentaar | + | <td class="kods" width="100"><xsl:value-of select="artikkel" /></td> |
- | ,myyja=z.myyja | + | <td class="nos" width="250"><xsl:value-of disable-output-escaping="yes" select="keelne_seletus" /></td> |
- | ,summa=z.summa | + | <td align="center"><xsl:value-of select="yhik" /></td> |
- | ,kmkokku=z.kmkokku | + | <td align="center"><xsl:value-of select="kogus" /></td> |
- | ,summakokku=z.summakokku | + | <xsl:if test="$atlaide!=0"> |
- | ,tell_tyyp=z.deal_type | + | <td class="atl"> |
- | ,ettemaks=z.prepayment | + | <xsl:choose> |
- | from (select klient_kood,klient_nimi,arvetasub,lahetusaadress1,lahetusaadress2,lahetusaadress3,deal_type,aeg,tingimus,kommentaar,myyja,summa,kmkokku,summakokku,prepayment from in_tell_tellimused2 where number=@webid)z | + | <xsl:when test="pross!=''"><xsl:value-of select="pross" /> %</xsl:when> |
- | where tell_tellimused.number=@number | + | <xsl:otherwise> </xsl:otherwise> |
- | + | </xsl:choose> | |
- | select @maa = isnull(maa,0) from kliendid where kood=(select klient_kood from tell_tellimused where number=@number) | + | </td> |
- | + | </xsl:if> | |
- | insert tell_tellimused_read | + | <td align="right"><xsl:value-of select="format-number((converted_hind) div 100,'0.00')"/></td> |
- | ( | + | <td align="right"><xsl:value-of select="format-number((converted_summa) div 100,'0.00')" /></td> |
- | number | + | </xsl:when> |
- | ,rn | + | <xsl:otherwise> |
- | ,rv | + | <td> </td> |
- | ,artikkel | + | <td class="nos" width="250"><xsl:value-of disable-output-escaping="yes" select="keelne_seletus" /></td> |
- | ,nimetus | + | <td> </td> |
- | ,kogus | + | <td> </td> |
- | ,yhik | + | <td> </td> |
- | ,yhikuhind | + | <td> </td> |
- | ,rv_summa | + | <xsl:if test="$atlaide!=0"> |
- | ,summa | + | <td> </td> |
- | ,myygikate | + | </xsl:if> |
- | ,konto | + | </xsl:otherwise> |
- | ,kmkood | + | </xsl:choose> |
- | ) | + | </tr> |
- | select | + | |
- | @number | + | <xsl:if test="((position() mod $item_per_page)=0) and (position()!=last())"> |
- | ,rn | + | <tr><td colspan="6" style="border-width:0px;"> </td></tr> |
- | ,rn | + | <xsl:text disable-output-escaping="yes"></table></xsl:text> |
- | ,artikkel | + | <div style="text-align:right;"><!--Turpinājums-->...</div> |
- | ,nimetus | + | <div style="text-align:center; margin-left:10px; margin-top:215px; width:35px; height:29px; #height:37px; border:1px solid #000000; padding:8px 0px 0px 0px;"> |
- | ,kogus | + | <xsl:value-of select="floor((position()+1) div $item_per_page)" />  |
- | ,yhik | + | </div> |
- | ,yhikuhind | + | <xsl:text disable-output-escaping="yes"></div></xsl:text> |
- | ,rsum | + | |
- | ,rsum | + | <div class="pbreak"></div> |
- | ,rsum | + | |
- | + | <xsl:text disable-output-escaping="yes"><div class="container"></xsl:text> | |
- | ,case | + | <div style="text-align:right; padding-bottom:5px;"> |
- | when (@maa = 0) | + | <xsl:value-of select="floor((position()+1) div $item_per_page)+1" /> |
- | then | + | <xsl:text>/</xsl:text> |
- | isnull((select konto_myyk from artiklid where kood=artikkel),(select myyk_eestis from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <xsl:value-of select="ceiling(/documents/document/ridu div $item_per_page)" /> |
- | when (@maa = 1) | + | </div> |
- | then | + | <xsl:text disable-output-escaping="yes"><table class="main_table" height="740" cellspacing="0" cellpadding="0"></xsl:text> |
- | isnull((select konto_myyk_EU from artiklid where kood=artikkel),(select myyk_eu from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <tr class="cont"> |
- | end as konto | + | <th class="kods" width="100"> |
- | /*,iif( | + | <xsl:choose> |
- | isnull(kmkood,'')!='',kmkood,(case | + | <xsl:when test="/documents/document/keel=''">Kods</xsl:when> |
- | when (@maa = 0) | + | <xsl:otherwise>Item</xsl:otherwise> |
- | then | + | </xsl:choose><!--Kods--></th> |
- | isnull((select KMkood from artiklid where kood=artikkel),(select kmk_eesti from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <th class="nos" width="300"><!--Nosaukums--> |
- | when (@maa = 1) | + | <xsl:choose> |
- | then | + | <xsl:when test="/documents/document/keel=''">Nosaukums</xsl:when> |
- | isnull((select KMkood_EU from artiklid where kood=artikkel),(select kmk_eu from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <xsl:otherwise>Description</xsl:otherwise> |
- | end )) as kmkood*/ | + | </xsl:choose> |
- | ,iif(isnumeric(kmkood)=1,kmkood,(case | + | </th> |
- | when (@maa = 0) | + | <th> <xsl:choose> |
- | then | + | <xsl:when test="/documents/document/keel=''">Mērv.</xsl:when> |
- | isnull((select KMkood from artiklid where kood=artikkel),(select kmk_eesti from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <xsl:otherwise>Unit</xsl:otherwise> |
- | when (@maa = 1) | + | </xsl:choose><!--Mērvienība--></th> |
- | then | + | <th> <xsl:choose> |
- | isnull((select KMkood_EU from artiklid where kood=artikkel),(select kmk_eu from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | <xsl:when test="/documents/document/keel=''">Daudz.</xsl:when> |
- | end )) | + | <xsl:otherwise>Qty total</xsl:otherwise> |
- | from in_tell_tellimused_read2 where number=@webid | + | </xsl:choose><!--Daudz.--></th> |
- | + | <xsl:if test="$atlaide!=0"> | |
- | + | <th><xsl:choose> | |
- | + | <xsl:when test="/documents/document/keel=''">Atlaide</xsl:when> | |
- | --update tell_tellimused set saldo=(select sum(tkkm) from tell_tellimused_read where number=@number) where number=@number | + | <xsl:otherwise>Discount</xsl:otherwise> |
- | insert into #results values (@kl_kood, 'Order', 0, 'CREATED','Orders',@number) | + | </xsl:choose><!--Atlaide--></th> |
- | + | </xsl:if> | |
- | update tell_tellimused_read | + | |
- | set tkkm=( rv_summa * (select iif(ilmakm=0,0,((ilmakm) / 100)) from fin_kmkoodid where kood=tell_tellimused_read.kmkood)) where number=@number | + | <th><xsl:choose> |
- | + | <xsl:when test="/documents/document/keel=''">Cena <xsl:value-of select="$nauda"/></xsl:when> | |
- | update tell_tellimused_read | + | <xsl:otherwise>Price <xsl:value-of select="$nauda"/></xsl:otherwise> |
- | set rsum=rv_summa + tkkm where number=@number | + | </xsl:choose></th> |
- | + | <th><xsl:choose> | |
- | update tell_tellimused | + | <xsl:when test="/documents/document/keel=''">Summa <xsl:value-of select="$nauda"/></xsl:when> |
- | set summa = (select sum(summa) from tell_tellimused_read where number=@number), summakokku=(select sum(tkkm) + sum(summa) from tell_tellimused_read where number=@number), kmkokku=(select sum(tkkm) from tell_tellimused_read where number=@number) | + | <xsl:otherwise>Total <xsl:value-of select="$nauda"/></xsl:otherwise> |
- | where number=@number | + | </xsl:choose></th> |
- | end | + | </tr> |
- | else | + | </xsl:if> |
- | begin | + | |
- | insert into #results values (@kl_kood, 'Order', 3, 'DUPLICATE','Orders',@kl_kood) | + | <xsl:if test="position()=last()"> |
- | end | + | <tr><td colspan="6" style="border-width:0px;"> </td></tr> |
- | END | + | </xsl:if> |
- | else | + | |
- | BEGIN | + | </xsl:for-each> |
- | insert into #results values (null, 'Item', 2, 'Incorrect AppKey','Orders',@webid) | + | |
- | END | + | </table> |
- | + | ||
- | set @x=@x+1 | + | |
- | FETCH NEXT FROM orders INTO @webid, @appkey_event | + | |
- | END | + | |
- | CLOSE orders | + | |
- | DEALLOCATE orders | + | |
- | + | ||
- | DECLARE invoices cursor for select convert(nvarchar(max),number), appkey from in_mr_arved2 where x=@key | + | |
- | open invoices | + | |
- | FETCH NEXT FROM invoices INTO @webid, @appkey_event | + | |
- | WHILE @@FETCH_STATUS = 0 | + | |
- | BEGIN | + | |
- | set @kl_kood=@webid | + | |
- | if @appkey_event=@appkey | + | |
- | begin | + | |
- | if (select count(number) from mr_arved where klienditellimus=@webid)=0 | + | |
- | BEGIN | + | |
- | EXEC dbo.get_dok_number @moodul='arve', @seeria='VEIKALIEMLV', @NUMBER = NULL, @cu='xmlcore', @aeg=@ag, @keel = 'default', @num =@number OUTPUT, @err = @err OUTPUT | + | |
- | + | ||
- | update mr_arved | + | |
- | set aeg=z.aeg | + | |
- | ,aeg2=z.aeg2 | + | |
- | ,Field5='0' | + | |
- | ,klient_kood=z.klient_kood | + | |
- | ,klient_nimi=z.klient_nimi | + | |
- | ,klienditellimus=@webid | + | |
- | ,lahetusaadress1=z.lahetusaadress1 | + | |
- | ,lahetusaadress2=z.lahetusaadress2 | + | |
- | ,lahetusaadress3=z.lahetusaadress3 | + | |
- | ,lisa_field1=case when (z.deal_type = '1') then N'Preču pārdošana' when (z.deal_type = '2') then N'Pakalpojuma sniegšana' else N'Preču piegāde' end | + | |
- | ,lisa_field2=z.lisa_field2 | + | |
- | ,lisa_field3=z.lisa_field3 | + | |
- | ,lisa_field4=z.lisa_field4 | + | |
- | ,lisa_field5=z.lisa_field5 | + | |
- | ,lisa_field6=z.lisa_field6 | + | |
- | ,tasuda=z.summakokku | + | |
- | ,kokkumk=z.tasuda | + | |
- | ,kaibemaks=z.kokkukmk | + | |
- | ,kokku=z.tasuda | + | |
- | ,kommentaar=z.kommentaar | + | |
- | ,tyyp=z.deal_type | + | |
- | from (select * from in_mr_arved2 where number=@webid)z | + | |
- | where mr_arved.number=@number | + | |
- | + | ||
- | select @maa = isnull(maa,0) from kliendid where kood=(select klient_kood from mr_arved where number=@number) | + | |
- | + | ||
- | insert mr_arved_read | + | |
- | ( | + | |
- | number | + | |
- | ,rn | + | |
- | ,rv | + | |
- | ,artikkel | + | |
- | ,seletus | + | |
- | ,kogus | + | |
- | ,yhik | + | |
- | ,hind | + | |
- | ,rsum | + | |
- | ,tkkm | + | |
- | ,konto | + | |
- | ,kmk | + | |
- | ) | + | |
- | select | + | |
- | @number | + | |
- | ,rn | + | |
- | ,rn | + | |
- | ,artikkel | + | |
- | ,seletus | + | |
- | ,kogus | + | |
- | ,yhik | + | |
- | ,hind | + | |
- | ,rsum * kogus | + | |
- | ,tkkm * kogus | + | |
- | ,case | + | |
- | when (@maa = 0) | + | |
- | then | + | |
- | isnull((select konto_myyk from artiklid where kood=artikkel),(select myyk_eestis from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | |
- | when (@maa = 1) | + | |
- | then | + | |
- | isnull((select konto_myyk_EU from artiklid where kood=artikkel),(select myyk_eu from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | |
- | end | + | |
- | ,case | + | |
- | when (@maa = 0) | + | |
- | then | + | |
- | isnull((select KMkood from artiklid where kood=artikkel),(select kmk_eesti from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | |
- | when (@maa = 1) | + | |
- | then | + | |
- | isnull((select KMkood_EU from artiklid where kood=artikkel),(select kmk_eu from artikliklassid where kood=(select klass from artiklid where kood=artikkel))) | + | |
- | end | + | |
- | from in_mr_arved_read2 where number=@webid | + | |
- | + | ||
- | --update tell_tellimused set saldo=(select sum(tkkm) from tell_tellimused_read where number=@number) where number=@number | + | |
- | insert into #results values (@kl_kood, 'INVOICE', 0, 'CREATED','INVOICES',@number) | + | |
- | exec dbo.after_save_klient 'arve', @number, NULL, NULL, NULL | + | |
- | end | + | |
- | else | + | |
- | begin | + | |
- | insert into #results values (@kl_kood, 'INVOICE', 3, 'DUPLICATE','INVOICES',@kl_kood) | + | |
- | end | + | |
- | END | + | |
- | else | + | |
- | BEGIN | + | |
- | insert into #results values (null, 'INVOICE', 2, 'Incorrect AppKey','INVOICES',@webid) | + | |
- | END | + | |
- | + | ||
- | set @x=@x+1 | + | |
- | FETCH NEXT FROM invoices INTO @webid, @appkey_event | + | |
- | END | + | |
- | CLOSE invoices | + | |
- | DEALLOCATE invoices | + | |
- | + | ||
- | DECLARE sreceipts cursor for select convert(nvarchar(max),number), appkey from in_ladu_sissetulekud where x=@key | + | |
- | open sreceipts | + | |
- | FETCH NEXT FROM sreceipts INTO @webid, @appkey_event | + | |
- | WHILE @@FETCH_STATUS = 0 | + | |
- | BEGIN | + | |
- | set @kl_kood=@webid | + | |
- | if @appkey_event=@appkey | + | |
- | begin | + | |
- | if (select count(number) from ladu_sissetulekud where hankija_arve=@webid)=0 | + | |
- | BEGIN | + | |
- | EXEC dbo.get_dok_number @moodul='sissetulek', @seeria='VEIKALIEMLV', @NUMBER = NULL, @cu='xmlcore', @aeg=@ag, @keel = 'default', @num =@number OUTPUT, @err = @err OUTPUT | + | |
- | + | ||
- | update ladu_sissetulekud | + | |
- | set aeg=z.aeg | + | |
- | ,hankija_kood=z.hankija_kood | + | |
- | ,hankija_nimi=z.hankija_nimi | + | |
- | ,ladu=z.ladu | + | |
- | ,sisekommentaar=z.sisekommentaar | + | |
- | from (select * from in_ladu_sissetulekud where number=@webid)z | + | |
- | where ladu_sissetulekud.number=@number | + | |
- | + | ||
- | --select @maa = isnull(maa,0) from kliendid where kood=(select klient_kood from mr_arved where number=@number) | + | |
- | + | ||
- | insert ladu_sissetulekud_read | + | |
- | ( | + | |
- | number | + | |
- | ,rn | + | |
- | ,rv | + | |
- | ,artikkel | + | |
- | ,sisu | + | |
- | ,kogus | + | |
- | ,yhikuhind | + | |
- | + | ||
- | ) | + | |
- | select | + | |
- | @number | + | |
- | ,rn | + | |
- | ,rn | + | |
- | ,artikkel | + | |
- | ,sisu | + | |
- | ,kogus | + | |
- | ,yhikuhind | + | |
- | from in_ladu_sissetulekud_read where number=@webid | + | |
- | + | ||
- | --update tell_tellimused set saldo=(select sum(tkkm) from tell_tellimused_read where number=@number) where number=@number | + | |
- | insert into #results values (@kl_kood, 'STOCK RECEIPT', 0, 'CREATED','STOCK RECEIPTS',@number) | + | |
- | end | + | |
- | else | + | |
- | begin | + | |
- | insert into #results values (@kl_kood, 'STOCK RECEIPT', 3, 'DUPLICATE','STOCK RECEIPTS',@kl_kood) | + | |
- | end | + | |
- | END | + | |
- | else | + | |
- | BEGIN | + | |
- | insert into #results values (null, 'STOCK RECEIPT', 2, 'Incorrect AppKey','STOCK RECEIPTS',@webid) | + | |
- | END | + | |
- | + | ||
- | set @x=@x+1 | + | |
- | FETCH NEXT FROM sreceipts INTO @webid, @appkey_event | + | |
- | END | + | |
- | CLOSE sreceipts | + | |
- | DEALLOCATE sreceipts | + | |
+ | <table class="main_table" cellspacing="0" cellpadding="0"> | ||
+ | <tr><td style="text-align:left; border-width:0px;"><xsl:value-of select="documents/document/kommentaar"/></td></tr> | ||
+ | </table> | ||
- | select @result1= | + | <table class="main_table" height="260" cellspacing="0" cellpadding="0"> |
- | (select result as "@Type", descr as "@Desc", number as "@docid", ext_id as "@ext_id", tyyp as "@doctype", submittype as "@submit" | + | <tr style="height:220px;"> |
- | from #results for xml path ('Result')) | + | <td style="text-align:left; border-width:0px;"> |
+ | |||
+ | <div style="border:solid #B4B4B4; border-width:2px 0px 2px 0px; display:table; width:660px;"> | ||
+ | |||
+ | <div style="float:left; width:350px;" valign="top" align="left"> | ||
+ | <table width="100%" border="0" cellapdding="0" cellspacing="0" align="left"> | ||
+ | <tr> | ||
+ | <td align="left" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="$nauda='LVL' or $nauda='EUR'"> | ||
+ | <xsl:value-of select="js:numText(string(format-number((/documents/document/converted_tasuda div 100)-(/documents/document/ettemaks), '0.00', 'N')),string($nauda))" /></xsl:when> | ||
+ | </xsl:choose> | ||
+ | </xsl:when> | ||
+ | <xsl:otherwise> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="$nauda='LVL' or $nauda='EUR'"> | ||
+ | <xsl:value-of select="js:numText(string(format-number(/documents/document/converted_tasuda div 100, '0.00', 'N')),string($nauda))" /></xsl:when> | ||
+ | </xsl:choose> | ||
+ | </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </xsl:when> | ||
+ | <xsl:when test="/documents/document/keel!=''"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="$nauda='LVL' or $nauda='EUR'"> | ||
+ | <xsl:value-of select="js:numTextEng(string(format-number((/documents/document/converted_tasuda div 100)-(/documents/document/ettemaks), '0.00')),string($nauda))" /> | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
+ | </xsl:when> | ||
+ | <xsl:otherwise> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="$nauda='LVL' or $nauda='EUR'"> | ||
+ | <xsl:value-of select="js:numTextEng(string(format-number((/documents/document/converted_tasuda div 100), '0.00')),string($nauda))" /></xsl:when> | ||
+ | </xsl:choose> | ||
+ | </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <xsl:for-each select="/documents/kmkoodid/kmkood"> | ||
+ | <tr> | ||
+ | <td align="left" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="km='9'"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel!=''">Article 138 (1) of the EU VAT Directive (2006/112/EC)</xsl:when> | ||
+ | <xsl:otherwise>Direktīvas 2006/112/EK 138. panta 1. punkts</xsl:otherwise> | ||
+ | </xsl:choose><!--Summa--><br /> | ||
+ | </xsl:when> | ||
+ | <xsl:when test="km!='9'"> | ||
+ |   | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:for-each> | ||
+ | <tr> | ||
+ | <td align="left" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Izrakstīja:</xsl:when> | ||
+ | <xsl:otherwise>Salesman:</xsl:otherwise> | ||
+ | </xsl:choose><!--Izrakstīja--> <xsl:value-of select="/documents/document/myyja_nimi" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </div> | ||
+ | |||
+ | <div style="float:left; width:150px; text-align:right;"> | ||
+ | <table width="100%" border="0" cellapdding="0" cellspacing="0"> | ||
+ | <xsl:if test="$atlaide!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Atlaides summa:</xsl:when> | ||
+ | <xsl:otherwise>Discount total:</xsl:otherwise> | ||
+ | </xsl:choose><!--Kopējā summa--> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Summa bez PVN:</xsl:when> | ||
+ | <xsl:otherwise>Total:</xsl:otherwise> | ||
+ | </xsl:choose><!--Summa--> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <xsl:for-each select="/documents/kmkoodid/kmkood"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">PVN: <xsl:value-of select="ilmakm" />%:</xsl:when> | ||
+ | <xsl:otherwise>VAT <xsl:value-of select="ilmakm" />%:</xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:for-each> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Kopā ar PVN:</xsl:when> | ||
+ | <xsl:otherwise>Total with VAT:</xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <xsl:if test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Priekšapmaksa:<xsl:value-of select="format-number(/documents/document/ettemaks div (/documents/document/converted_tasuda div 10000), '0.00')" /> %:</xsl:when> | ||
+ | <xsl:otherwise>Prepayment:<xsl:value-of select="format-number(/documents/document/ettemaks div (/documents/document/converted_tasuda div 10000), '0.00')" /> %:</xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | <xsl:if test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Summa apmaksai:</xsl:when> | ||
+ | <xsl:otherwise>Sum To pay:</xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | </table> | ||
+ | </div> | ||
+ | |||
+ | <div class="right_small"> | ||
+ | <table width="100%" border="0" cellapdding="0" cellspacing="0"> | ||
+ | <xsl:if test="$atlaide!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number(sum(msxsl:node-set($atlaides_summa)/a_summa),'0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number(/documents/document/kokku,'0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <xsl:for-each select="/documents/kmkoodid/kmkood"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number(summakm div 100,'0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:for-each> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number(/documents/document/converted_tasuda div 100,'0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <xsl:if test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number(/documents/document/ettemaks, '0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | <xsl:if test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <tr> | ||
+ | <td width="50%" align="right" style="border-width: 0px 0px 0px 0px;"> | ||
+ | <xsl:value-of select="format-number((/documents/document/converted_tasuda div 100) - /documents/document/ettemaks, '0.00')" /> <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | </table> | ||
+ | </div> | ||
+ | |||
+ | <div class="spacer"></div> | ||
+ | |||
+ | <div style="float:left; width:350px;" > | ||
+ | <xsl:choose><xsl:when test="/documents/document/keel=''">Banka: </xsl:when><xsl:otherwise>Bank: </xsl:otherwise></xsl:choose><xsl:value-of select="/documents/footer/firma_pank" /><br /> | ||
+ | <xsl:choose><xsl:when test="/documents/document/keel=''">Bankas kods: </xsl:when><xsl:otherwise>Bank SWIFT: </xsl:otherwise></xsl:choose><xsl:value-of select="/documents/footer/firma_swift" /><br /> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Bankas konts:</xsl:when> | ||
+ | <xsl:otherwise>Bank account:</xsl:otherwise> | ||
+ | </xsl:choose><!--Konts--> <xsl:value-of select="/documents/footer/firma_aa" /> | ||
+ | </div> | ||
+ | |||
+ | <div style="float:left; width:150px; text-align:right;"> | ||
+ | <!--<div style="padding-top:3px;"> | ||
+ | <div style="padding-top:3px;"></div> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Kopā apmaksai:</xsl:when> | ||
+ | <xsl:otherwise>Total:</xsl:otherwise> | ||
+ | </xsl:choose></div>--> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Apmaksas termiņš:</xsl:when> | ||
+ | <xsl:otherwise>Due date:</xsl:otherwise> | ||
+ | </xsl:choose><!--Apmaksas termiņš--> | ||
+ | </div> | ||
+ | |||
+ | <div class="right_small" width="130px"> | ||
+ | <table width="100%" cellpadding="1" cellspacing="1"> | ||
+ | <!-- <xsl:if test="$saldo > $rekina_summa"> | ||
+ | <tr> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:0px solid #000000;" width="50%"> | ||
+ |   | ||
+ | </td> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:2px solid #000000;"> | ||
+ | <xsl:value-of select="$neapm_summa" />  | ||
+ | <xsl:value-of select="$nauda" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </xsl:if> | ||
+ | <tr> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:0px solid #000000;" width="50%"> | ||
+ |   | ||
+ | </td> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:2px solid #000000;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/ettemaks!='' and /documents/document/ettemaks!=0"> | ||
+ | <xsl:value-of select="format-number((/documents/document/converted_tasuda div 100)-(/documents/document/ettemaks), '0.00')" /> | ||
+ |   | ||
+ | <xsl:value-of select="$nauda" /> | ||
+ | </xsl:when> | ||
+ | <xsl:otherwise> | ||
+ | <xsl:value-of select="format-number((/documents/document/converted_tasuda div 100) + $parads, '0.00')" />  | ||
+ | <xsl:value-of select="$nauda" /> | ||
+ | </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </td> | ||
+ | </tr>--> | ||
+ | <tr> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:0px solid #000000;" width="50%"> | ||
+ |   | ||
+ | </td> | ||
+ | <td style="padding:2px; margin-bottom:5px; border:2px solid #000000;" align="right"> | ||
+ | <xsl:value-of select="/documents/document/aeg2_date" /> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | <!--<xsl:if test="$neapm_summa>$rekina_summa"> | ||
+ | <div style="clear:both; padding:5px 0px 0px 0px; font-size:12px; font-weight:bold;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/valuuta=''"> | ||
+ | Neapmaksāto rēķinu kopsumma: <xsl:value-of select="format-number(/documents/kontakt/saldo, '0.00')"/> <xsl:value-of select="$nauda"/><br /> | ||
+ | Neapmaksāto rēķinu kopsumma: <xsl:value-of select="format-number(/documents/kontakt/saldo div $eiro, '0.00')"/> <xsl:value-of select="$nauda2"/><br /> | ||
+ | </xsl:when> | ||
+ | <xsl:when test="/documents/document/valuuta!=''"> | ||
+ | Neapmaksāto rēķinu kopsumma: <xsl:value-of select="format-number(/documents/kontakt/saldo, '0.00')"/> <xsl:value-of select="$nauda2"/><br /> | ||
+ | Neapmaksāto rēķinu kopsumma: <xsl:value-of select="format-number(/documents/kontakt/saldo div $eiro, '0.00')"/> <xsl:value-of select="$nauda"/><br /> | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
+ | Neapmaksāto rēķinu kopsumma: <xsl:value-of select="format-number(/documents/kontakt/saldo, '0.00')"/> | ||
+ | </xsl:when> | ||
+ | <xsl:otherwise> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/valuuta=''"> | ||
+ | Unpaid invoices total:<xsl:value-of select="format-number(/documents/kontakt/saldo, '0.00')"/> <xsl:value-of select="$nauda"/><br /> | ||
+ | Unpaid invoices total:<xsl:value-of select="format-number(/documents/kontakt/saldo div $eiro, '0.00')"/> <xsl:value-of select="$nauda2"/><br /> | ||
+ | </xsl:when> | ||
+ | <xsl:when test="/documents/document/valuuta!=''"> | ||
+ | Unpaid invoices total:<xsl:value-of select="format-number(/documents/kontakt/saldo , '0.00')"/> <xsl:value-of select="$nauda2"/><br /> | ||
+ | Unpaid invoices total:<xsl:value-of select="format-number(/documents/kontakt/saldo div $eiro, '0.00')"/> <xsl:value-of select="$nauda"/><br /> | ||
+ | </xsl:when> | ||
+ | </xsl:choose> | ||
+ | </xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | <br /> | ||
+ | |||
+ | </div> | ||
+ | </xsl:if>--> | ||
+ | <div style="clear:both; padding:5px 0px 0px 0px; font-size:14px;"> | ||
+ | <xsl:choose> | ||
+ | <xsl:when test="/documents/document/keel=''">Dokuments ir sagatavots elektroniski un derīgs bez paraksta.</xsl:when> | ||
+ | <xsl:otherwise>The invoice is produced electronically and valid without signature.</xsl:otherwise> | ||
+ | </xsl:choose> | ||
+ | </div> | ||
+ | </td> | ||
+ | </tr> | ||
+ | <!--<tr> | ||
+ | <td style="height:0px; line-height:0px; border-width:0px; font-size:0px;"> | ||
+ | <img SRC="http://login.directo.ee/logos/files/nordcity_lv_3.png" width="660"/> | ||
+ | </td> | ||
+ | </tr>--> | ||
+ | <tr> | ||
+ | <td style="text-align:left; border-width:0px;"> | ||
+ | |||
+ | |||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | </div> <!-- Konteinera beigas --> | ||
+ | </body> | ||
+ | |||
+ | </html> | ||
+ | </xsl:template> | ||
+ | <msxsl:script language="JScript" implements-prefix="js"><![CDATA[ | ||
+ | var cipariEng=['','one ','two ','three ','four ','five ','six ','seven ','eight ','nine ']; | ||
+ | var padsmitiEng=['ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen ']; | ||
+ | var desmitiEng=['','','twenty ','thirty ','fourty ','fifty ','sixty ','seventy ','eighty ','ninety ']; | ||
- | set @result2='<?xml version="1.0" encoding="UTF-8"?><results>'+CONVERT(nvarchar(max),@result1)+'</results>' | + | function simtiEng(str) { |
+ | res=''; | ||
+ | |||
+ | // pirmais cipars no labaas | ||
+ | if (str.charAt(1)=='1') // chekojam pirmspeedeejo ciparu - ja viens tad vai nu desmit vai padsmit | ||
+ | res=padsmitiEng[parseInt(str.charAt(2))]; | ||
+ | else res=cipariEng[parseInt(str.charAt(2))]; | ||
+ | |||
+ | // otrais cipars no labaas | ||
+ | if (str.charAt(0)=='1') // ja treshais cipars no labaas ir 1 tad jaaraksta simts | ||
+ | res='hundred '+desmitiEng[parseInt(str.charAt(1))]+res; | ||
+ | else if (str.charAt(0)!='0') // ja treshais cipars no labaas nav 1 vai 0 tad jaaraksta simti | ||
+ | res='hundred '+desmitiEng[parseInt(str.charAt(1))]+res; | ||
+ | else // ja nav simtu | ||
+ | res=desmitiEng[parseInt(str.charAt(1))]+res; | ||
+ | |||
+ | // treshais cipars no labaas | ||
+ | res=cipariEng[parseInt(str.charAt(0))]+res; | ||
+ | return res; | ||
+ | } | ||
- | select @result1= | + | function numTextEng(skaitlis,nauda) { |
- | (select result as "@Type", descr as "@Desc", number as "@docid", ext_id as "@ext_id", tyyp as "@doctype", submittype as "@submit" | + | fullStr='0000000000'; |
- | from #results for xml path ('Result')) | + | tempStr=''; |
+ | tempRes=''; | ||
+ | resStr=''; | ||
+ | minus=''; | ||
+ | |||
+ | punkts=skaitlis.indexOf('.'); | ||
+ | if (punkts==-1) { | ||
+ | pirmspStr=skaitlis; | ||
+ | aizpStr='0'; | ||
+ | } else { | ||
+ | pirmspStr=skaitlis.substring(0,punkts); | ||
+ | aizpStr=skaitlis.substring(punkts+1); | ||
+ | } | ||
+ | |||
+ | if (pirmspStr.charAt(0)=='-') { // ja ar miinus ziimi | ||
+ | pirmspStr=pirmspStr.substring(1); | ||
+ | minus='minus '; | ||
+ | } | ||
+ | |||
+ | for (i=pirmspStr.length-1, j=9; i>=0; i--, j--) { // paarliekam uz fullstr, kas sastaav no desmit cipariem | ||
+ | fullStr=fullStr.substring(0,j) + pirmspStr.charAt(i) + fullStr.substring(j+1); | ||
+ | } | ||
+ | |||
+ | if (fullStr.length>10) fullStr=fullStr.substring(fullStr.length-10); // ja vairaak par 10 cipariem, tad trim | ||
+ | |||
+ | if (nauda=='EUR') { | ||
+ | if (parseInt(fullStr,10)==1) resStr+='euro'; // lats vai lati | ||
+ | else if (parseInt(fullStr,10)!=0) resStr+='euros'; | ||
+ | else resStr+='Null euros'; | ||
+ | } else if (parseInt(fullStr,10)!=0) { | ||
+ | resStr+=nauda; | ||
+ | } else resStr+='Null '+nauda; | ||
+ | |||
+ | if (parseInt(fullStr.substring(7),10)>0) { | ||
+ | tempStr=fullStr.substring(7); // simti | ||
+ | tempRes=simtiEng(tempStr); | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(4,7),10)>0) { | ||
+ | tempStr=fullStr.substring(4,7); // tūkstoši | ||
+ | tempRes=simtiEng(tempStr); | ||
+ | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!='1')) tempRes+='thousand '; | ||
+ | else if (parseInt(tempStr,10)!=0) tempRes+='thousand '; | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(1,4),10)>0) { | ||
+ | tempStr=fullStr.substring(1,4); // miljoni | ||
+ | tempRes=simtiEng(tempStr); | ||
+ | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!='1')) tempRes+='million '; | ||
+ | else if (parseInt(tempStr,10)!=0) tempRes+='million '; | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (fullStr.charAt(0)!='0') { // miljardi | ||
+ | if (fullStr.charAt(0)=='1') resStr='one billion '+resStr; | ||
+ | else resStr=cipariEng[parseInt(fullStr.charAt(0),10)]+'billion '+resStr; | ||
+ | } | ||
+ | |||
+ | if (resStr!='') { // pirmais burts lielais | ||
+ | resStr=resStr.charAt(0).toUpperCase()+resStr.substring(1); | ||
+ | } | ||
+ | |||
+ | santimi=parseInt(aizpStr,10); //santimi | ||
+ | if (santimi>0) { | ||
+ | resStr+=' '+santimi; | ||
+ | if (santimi==1) { | ||
+ | resStr+=' cent'; | ||
+ | } else { | ||
+ | resStr+=' cents'; | ||
+ | } | ||
+ | } else { | ||
+ | resStr+=' 00 cents'; | ||
+ | } | ||
+ | |||
+ | return (minus+resStr); | ||
+ | |||
+ | } | ||
+ | var cipari=['','viens ','divi ','trīs ','četri ','pieci ','seši ','septiņi ','astoņi ','deviņi ']; | ||
+ | var padsmiti=['desmit ','vienpadsmit ','divpadsmit ','trīspadsmit ','četrpadsmit ','piecpadsmit ','sešpadsmit ','septiņpadsmit ','astoņpadsmit ','deviņpadsmit ']; | ||
+ | var desmiti=['','','divdesmit ','trīsdesmit ','četrdesmit ','piecdesmit ','sešdesmit ','septiņdesmit ','astoņdesmit ','deviņdesmit ']; | ||
- | set @result2='<?xml version="1.0" encoding="UTF-8"?><results>'+CONVERT(nvarchar(max),@result1)+'</results>' | + | function simti(str) { |
+ | res=''; | ||
+ | |||
+ | // pirmais cipars no labaas | ||
+ | if (str.charAt(1)=='1') // chekojam pirmspeedeejo ciparu - ja viens tad vai nu desmit vai padsmit | ||
+ | res=padsmiti[parseInt(str.charAt(2))]; | ||
+ | else res=cipari[parseInt(str.charAt(2))]; | ||
+ | |||
+ | // otrais cipars no labaas | ||
+ | if (str.charAt(0)=='1') // ja treshais cipars no labaas ir 1 tad jaaraksta simts | ||
+ | res='simts '+desmiti[parseInt(str.charAt(1))]+res; | ||
+ | else if (str.charAt(0)!='0') // ja treshais cipars no labaas nav 1 vai 0 tad jaaraksta simti | ||
+ | res='simti '+desmiti[parseInt(str.charAt(1))]+res; | ||
+ | else // ja nav simtu | ||
+ | res=desmiti[parseInt(str.charAt(1))]+res; | ||
+ | |||
+ | // treshais cipars no labaas | ||
+ | res=cipari[parseInt(str.charAt(0))]+res; | ||
+ | return res; | ||
+ | } | ||
- | select @result2 | + | function numText(skaitlis,nauda) { |
- | drop table #results | + | fullStr='0000000000'; |
- | drop table #changes | + | tempStr=''; |
+ | tempRes=''; | ||
+ | resStr=''; | ||
+ | minus=''; | ||
+ | |||
+ | punkts=skaitlis.indexOf('.'); | ||
+ | if (punkts==-1) { | ||
+ | pirmspStr=skaitlis; | ||
+ | aizpStr='0'; | ||
+ | } else { | ||
+ | pirmspStr=skaitlis.substring(0,punkts); | ||
+ | aizpStr=skaitlis.substring(punkts+1); | ||
+ | } | ||
+ | |||
+ | if (pirmspStr.charAt(0)=='-') { // ja ar miinus ziimi | ||
+ | pirmspStr=pirmspStr.substring(1); | ||
+ | minus='mīnus '; | ||
+ | } | ||
+ | |||
+ | for (i=pirmspStr.length-1, j=9; i>=0; i--, j--) { // paarliekam uz fullstr, kas sastaav no desmit cipariem | ||
+ | fullStr=fullStr.substring(0,j) + pirmspStr.charAt(i) + fullStr.substring(j+1); | ||
+ | } | ||
+ | |||
+ | if (fullStr.length>10) fullStr=fullStr.substring(fullStr.length-10); // ja vairaak par 10 cipariem, tad trim | ||
+ | |||
+ | if (parseInt(fullStr,10)!=0) { | ||
+ | resStr+=nauda; | ||
+ | } else resStr+='Nulle '+nauda; | ||
+ | |||
+ | if (parseInt(fullStr.substring(7),10)>0) { | ||
+ | tempStr=fullStr.substring(7); // simti | ||
+ | tempRes=simti(tempStr); | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(4,7),10)>0) { | ||
+ | tempStr=fullStr.substring(4,7); // t�ksto�i | ||
+ | tempRes=simti(tempStr); | ||
+ | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!='1')) tempRes+='tūkstotis '; | ||
+ | else if (parseInt(tempStr,10)!=0) tempRes+='tūkstoši '; | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(1,4),10)>0) { | ||
+ | tempStr=fullStr.substring(1,4); // miljoni | ||
+ | tempRes=simti(tempStr); | ||
+ | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!='1')) tempRes+='miljons '; | ||
+ | else if (parseInt(tempStr,10)!=0) tempRes+='miljoni '; | ||
+ | resStr=tempRes+resStr; | ||
+ | } | ||
+ | |||
+ | if (fullStr.charAt(0)!='0') { // miljardi | ||
+ | if (fullStr.charAt(0)=='1') resStr='viens miljards '+resStr; | ||
+ | else resStr=cipari[parseInt(fullStr.charAt(0),10)]+'miljardi '+resStr; | ||
+ | } | ||
+ | |||
+ | if (resStr!='') { // pirmais burts lielais | ||
+ | resStr=resStr.charAt(0).toUpperCase()+resStr.substring(1); | ||
+ | } | ||
+ | |||
+ | santimi=parseInt(aizpStr,10); //santimi | ||
+ | if (santimi>0) { | ||
+ | resStr+=' '+santimi; | ||
+ | tmpSant=santimi.toString(); | ||
+ | if ((tmpSant.charAt(tmpSant.length-1)=='1') && (tmpSant.charAt(tmpSant.length-2)!='1')) { | ||
+ | resStr+=' cents'; | ||
+ | } else { | ||
+ | resStr+=' centi'; | ||
+ | } | ||
+ | } else { | ||
+ | resStr+=' 00 centi'; | ||
+ | } | ||
+ | |||
+ | return (minus+resStr); | ||
+ | } | ||
- | --cleanup | + | ]]></msxsl:script> |
- | --delete temp customers and put in log table | + | |
- | insert log_in_kliendid2 | + | |
- | select * from in_kliendid2 where x=@key | + | |
- | delete from in_kliendid2 where x=@key | + | |
- | --delete temp items and put in log table | + | |
- | insert log_in_artiklid2 | + | |
- | select * from in_artiklid2 where x=@key | + | |
- | delete from in_artiklid2 where x=@key | + | |
- | --delete temp items and put in log table | + | |
- | insert log_in_tell_tellimused2 | + | |
- | select * from in_tell_tellimused2 where x=@key | + | |
- | insert log_in_tell_tellimused_read2 | + | |
- | select * from in_tell_tellimused_read2 where number in (select number from in_tell_tellimused2 where x=@key) | + | |
- | delete from in_tell_tellimused_read2 where number in (select number from in_tell_tellimused2 where x=@key) | + | |
- | delete from in_tell_tellimused2 where x=@key | + | |
- | --delete temp items and put in log table | + | |
- | insert log_in_mr_arved2 | + | |
- | select * from in_mr_arved2 where x=@key | + | |
- | insert log_in_mr_arved_read2 | + | |
- | select * from in_mr_arved_read2 where number in (select number from in_mr_arved2 where x=@key) | + | |
- | delete from in_mr_arved_read2 where number in (select number from in_mr_arved2 where x=@key) | + | |
- | delete from in_mr_arved2 where x=@key | + | |
- | --delete temp items and put in log table | + | |
- | insert log_in_ladu_sissetulekud | + | |
- | select * from in_ladu_sissetulekud where x=@key | + | |
- | insert log_in_ladu_sissetulekud_read | + | |
- | select * from in_ladu_sissetulekud_read where number in (select number from in_ladu_sissetulekud where x=@key) | + | |
- | delete from in_ladu_sissetulekud_read where number in (select number from in_ladu_sissetulekud where x=@key) | + | |
- | delete from in_ladu_sissetulekud where x=@key | + | |
- | --08.06.2020 range change from 2019 to veikaliemlv, version from 01.10.2019 | + | </xsl:stylesheet> |
- | --17.07.2020 corrections in orders, lahetusaadress3=z.lahetusaadress1 to lahetusaadress3=z.lahetusaadress3 | + | |
</code> | </code> |