lv:procedures
Atšķirības
Norādītais vecais variants no patreizējās lapas atšķiras ar.
Abās pusēs iepriekšējo versijuIepriekšējā versijaNākamā versija | Iepriekšējā versija | ||
lv:procedures [2020/09/15 17:33] – marija | lv:procedures [2020/10/27 19:06] (patlaban) – ALG_rek_0610 marija | ||
---|---|---|---|
Rinda 1: | Rinda 1: | ||
- | < | + | < |
- | ALTER PROCEDURE [dbo].[xml_core_SISSE_webshop] AS | + | <?xml version=" |
- | DECLARE @klient_kood bigint, @kood bigint, @nimitmp nvarchar(255), | + | < |
- | declare @ladu nvarchar(32), @seeria nvarchar(32), @objekt nvarchar(32), @s1 int, @s2 int, @webid nvarchar(32), | + | xmlns: |
- | declare @number | + | xmlns: |
- | DECLARE @myyja nvarchar(32), @aeg datetime | + | xmlns: |
- | declare @key nvarchar(32), @appkey nvarchar(64), | + | xmlns: |
- | declare @result1 xml, @result2 nvarchar(max) | + | exclude-result-prefixes=" |
- | declare @artikkel nvarchar(32), @id_exist int | + | < |
- | declare @kl_kood nvarchar(32), @nimi nvarchar(255), @kustuta int | + | < |
- | declare @ag datetime | + | < |
- | declare @err nvarchar(32) | + | < |
- | select | + | < |
- | set @key=CONVERT(nvarchar, | + | < |
- | update in_webshop_tell_tellimused set x=@key where x is null | + | < |
- | update xml_in_imago_tellimused set x=@key where x is null | + | 1.42287181 |
- | set @koodid='' | + | </ |
- | + | < | |
- | select | + | 1.42287181 |
- | + | </ | |
- | create | + | < |
- | (number nvarchar(32), tyyp nvarchar(32), result int, descr nvarchar(255), | + | 0.702804 |
- | + | </ | |
- | + | < | |
- | + | < | |
- | --vastuvotmine, | + | </ |
- | --SELECT * FROM in_webshop_tell_tellimused WHERE number | + | </ |
- | -- DELETE FROM in_webshop_tell_tellimused WHERE number | + | </ |
- | -- UPDATE in_webshop_tell_tellimused SET x = null WHERE number = '2000117' | + | < |
- | -- EXEC [dbo].[xml_core_SISSE_webshop] | + | < |
- | + | < | |
- | --sales order from E-agent [LV software] | + | < |
- | declare tellimused cursor for select | + | < |
- | open tellimused | + | < |
- | FETCH NEXT FROM tellimused INTO @webid, @appkey | + | </ |
- | WHILE @@FETCH_STATUS | + | </ |
- | BEGIN | + | </ |
- | if ISNULL(@appkey,'' | + | < |
- | begin | + | < |
- | insert into #results values (@appkey, | + | < |
- | + | < | |
- | end | + | < |
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | if (document.getElementById(' | ||
+ | document.write('< | ||
+ | } else { | ||
+ | document.write('< | ||
+ | } | ||
+ | ]]></ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | <style type=" | ||
+ | body { | ||
+ | text-align: | ||
+ | font-family: | ||
+ | font-size: | ||
+ | } | ||
+ | |||
+ | .container { | ||
+ | display:table; | ||
+ | text-align: | ||
+ | width: | ||
+ | margin: | ||
+ | } | ||
+ | |||
+ | .main_table { | ||
+ | width: | ||
+ | border-collapse: | ||
+ | } | ||
+ | |||
+ | .main_table th { | ||
+ | font-size: | ||
+ | font-family: | ||
+ | font-weight: | ||
+ | text-align: | ||
+ | padding: | ||
+ | border:1px solid #B4B4B4; | ||
+ | } | ||
+ | |||
+ | .main_table td { | ||
+ | font-size: | ||
+ | font-family: | ||
+ | padding: | ||
+ | border:1px solid #B4B4B4; | ||
+ | } | ||
+ | |||
+ | .main_table td.nos, .main_table td.kods, .main_table th.nos, .main_table th.kods { | ||
+ | | ||
+ | } | ||
+ | |||
+ | .main_table tr.cont { | ||
+ | height: | ||
+ | } | ||
+ | |||
+ | .left { | ||
+ | | ||
+ | | ||
+ | font-size: | ||
+ | } | ||
+ | |||
+ | .right { | ||
+ | float: | ||
+ | text-align: | ||
+ | font-size: | ||
+ | } | ||
+ | .left2 { | ||
+ | float: | ||
+ | text-align: | ||
+ | font-size: | ||
+ | } | ||
+ | |||
+ | .right_small { | ||
+ | float: | ||
+ | text-align: | ||
+ | } | ||
+ | |||
+ | .spacer { | ||
+ | height: | ||
+ | clear: | ||
+ | } | ||
+ | |||
+ | .divider { | ||
+ | clear: | ||
+ | } | ||
+ | |||
+ | .pbreak { | ||
+ | page-break-after: | ||
+ | } | ||
+ | |||
+ | h4.pb { | ||
+ | display: | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | <IMG height=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <br /> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | </ | ||
+ | < | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | <xsl:if test=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <br /> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
- | else | + | <div class=" |
- | begin | + | < |
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | |||
+ | <table class=" | ||
+ | < | ||
+ | <th class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <th class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | <th> < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <th> < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <xsl:if test=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <td class=" | ||
+ | <td class=" | ||
+ | <td align=" | ||
+ | <td align=" | ||
+ | <xsl:if test=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <td align=" | ||
+ | <td align=" | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <td class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | |||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <th class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <th class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | <th> < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <th> < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <xsl:if test=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
- | select @id_exist=count(*) from tell_tellimused with(nolock) where number=@webid | + | <table class=" |
- | if @id_exist=0 | + | < |
- | BEGIN | + | </ |
- | set @number=@webid | + | |
- | + | ||
- | select | + | |
- | insert into tell_tellimused | + | <table class=" |
- | , kommentaar, valuuta, kurssbv1 | + | <tr style=" |
- | ,esindaja, telefon, aadress1, aadress2, aadress3 | + | <td style=" |
- | , | + | |
- | , | + | <div style=" |
- | , ts, cu, Field57, objekt | + | |
- | ,hinnakiri, lahetusaeg, lisa_field1 | + | < |
- | ) | + | <table width=" |
- | SELECT @number | + | < |
- | + | <td align=" | |
- | , | + | < |
- | , aeg | + | < |
- | , | + | < |
- | , isnull((select | + | < |
- | , isnull(tingimus, | + | < |
- | , isnull(ladu,'GAL') | + | < |
- | , isnull(klient_nimi, | + | < |
- | , isnull(tingimus, | + | </ |
- | , | + | </ |
- | , 'EUR', 1 | + | < |
- | , isnull(esindaja,(select TOP 1 kontakt from kliendid with(nolock) where kood=klient_kood)) | + | < |
- | , isnull(telefon,(select | + | < |
- | , isnull(aadress1,(select | + | < |
- | , isnull(aadress2,(select | + | </ |
- | , isnull(aadress3,(select | + | </ |
- | , isnull(lahaadress1,(select | + | </ |
- | , isnull(lahaadress2,(select | + | </ |
- | , isnull(lahaadress3,(select | + | < |
- | , isnull(klientnimi_lahetusel,(select | + | < |
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <td align=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | &# | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <table width=" | ||
+ | <xsl:if test=" | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <xsl:if test="/ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <xsl:if test="/ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <table width=" | ||
+ | <xsl:if test=" | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | <xsl:if test="/ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <xsl:if test="/ | ||
+ | < | ||
+ | <td width=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <table width=" | ||
+ | < | ||
+ | < | ||
+ | <td style=" | ||
+ | &# | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td style=" | ||
+ | &# | ||
+ | </ | ||
+ | <td style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | &# | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td style=" | ||
+ | &# | ||
+ | </ | ||
+ | <td style=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | Neapmaksāto rēķinu kopsumma: < | ||
+ | Neapmaksāto rēķinu kopsumma: < | ||
+ | </ | ||
+ | < | ||
+ | Neapmaksāto rēķinu kopsumma: < | ||
+ | Neapmaksāto rēķinu kopsumma: < | ||
+ | </ | ||
+ | </ | ||
+ | Neapmaksāto rēķinu kopsumma: < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | Unpaid invoices total:< | ||
+ | </ | ||
+ | < | ||
+ | Unpaid invoices total:< | ||
+ | Unpaid invoices total:< | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | <div style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td style=" | ||
+ | <img SRC=" | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td style=" | ||
+ | |||
+ | |||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | var cipariEng=['',' | ||
+ | var padsmitiEng=[' | ||
+ | var desmitiEng=['','',' | ||
- | , GETDATE(), 'XML' | + | |
- | , isnull(email,(select TOP 1 email from kliendid with(nolock) where kood=klient_kood)) | + | res='' |
- | , isnull(objekt,(select TOP 1 objekt from kliendid with(nolock) where kood=klient_kood)) | + | |
- | ,(select TOP 1 hinnakiri from kliendid with(nolock) where kood=klient_kood) | + | // pirmais cipars no labaas |
- | , lahetusaeg | + | |
- | , isnull(lisa_field1, | + | res=padsmitiEng[parseInt(str.charAt(2))]; |
- | FROM in_webshop_tell_tellimused with(nolock) where number=@number | + | else res=cipariEng[parseInt(str.charAt(2))]; |
+ | |||
+ | // otrais cipars no labaas | ||
+ | if (str.charAt(0)==' | ||
+ | res=' | ||
+ | else if (str.charAt(0)!='0') // ja treshais cipars no labaas nav 1 vai 0 tad jaaraksta simti | ||
+ | res='hundred | ||
+ | else // ja nav simtu | ||
+ | | ||
+ | |||
+ | // treshais cipars no labaas | ||
+ | res=cipariEng[parseInt(str.charAt(0))]+res; | ||
+ | return res; | ||
+ | } | ||
- | -- UPDATE in_tell_tellimused_read SET artikkel = ISNULL((select artikkel from artiklid_hankija_artiklid with(nolock) where hankija_artikkel = in_tell_tellimused_read.artikkel),artikkel) WHERE NOT EXISTS(SELECT top 1 kood FROM artiklid WITH(nolock) WHERE kood = in_tell_tellimused_read.artikkel) | + | |
- | + | fullStr=' | |
- | insert into tell_tellimused_read | + | |
- | (number, | + | |
- | select @number | + | |
- | , | + | minus='' |
- | , artikkel | + | |
- | , | + | |
- | , isnull((select konto_myyk from artiklid where kood=in_webshop_tell_tellimused_read.artikkel),(select TOP 1 myyk_eestis from artikliklassid with(nolock) where kood=(select TOP 1 klass from artiklid where kood=artikkel))) | + | if (punkts==-1) { |
- | , kogus | + | pirmspStr=skaitlis; |
- | , case | + | aizpStr='0'; |
- | when EXISTS (select top 1 ale from mr_hinnavalemid_read with(nolock) where mida='8' | + | } else { |
- | then | + | |
- | ('0') | + | |
- | + | } | |
- | | + | |
- | + | if (pirmspStr.charAt(0)=='-') { // ja ar miinus ziimi | |
- | then (select top 1 ale from mr_hinnavalemid_read where mr_hinnavalemid_read.artikkel | + | |
- | + | minus='minus '; | |
- | when ((select top 1 ale from mr_hinnavalemid_read where mr_hinnavalemid_read.artikkel =in_webshop_tell_tellimused_read.artikkel and mida=' | + | } |
- | + | ||
- | then | + | 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); | |
- | --when | + | } |
- | --and (select top 1 ale from mr_hinnavalemid_read where mr_hinnavalemid_read.artikkel =in_webshop_tell_tellimused_read.artikkel and mida='0' | + | |
- | + | if (fullStr.length> | |
- | --then (select top 1 ale from mr_hinnavalemid_read where mr_hinnavalemid_read.artikkel =in_webshop_tell_tellimused_read.artikkel and mida='0' | + | |
- | + | if (nauda=='EUR' | |
- | when | + | |
- | | + | else if (parseInt(fullStr,10)!=0) resStr+=' |
- | inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | else resStr+='Null euros'; |
- | inner join tell_tellimused ON tell_tellimused.number=@number | + | } else if (parseInt(fullStr,10)!=0) { |
- | where mr_hinnavalemid_read.klass=artiklid.klass and mida='0' | + | resStr+=nauda; |
- | and mr_hinnavalemid_read.kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | } else resStr+='Null '+nauda; |
- | and | + | |
- | ((tell_tellimused.aeg) between mr_hinnavalemid_read.aeg1 and mr_hinnavalemid_read.aeg2 | + | |
- | + | tempStr=fullStr.substring(7); | |
- | then (select top 1 ale from mr_hinnavalemid_read | + | tempRes=simtiEng(tempStr); |
- | inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | |
- | inner join tell_tellimused ON tell_tellimused.number=@number | + | } |
- | where mr_hinnavalemid_read.klass=artiklid.klass and mida=' | + | |
- | and mr_hinnavalemid_read.kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | if (parseInt(fullStr.substring(4, |
- | and | + | tempStr=fullStr.substring(4, |
- | | + | tempRes=simtiEng(tempStr); |
- | + | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!=' | |
- | when ((select top 1 ale from mr_hinnavalemid_read | + | else if (parseInt(tempStr,10)!=0) tempRes+=' |
- | inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | resStr=tempRes+resStr; |
- | inner join tell_tellimused ON tell_tellimused.number=@number | + | |
- | where mr_hinnavalemid_read.klass=artiklid.klass and mida=' | + | |
- | and mr_hinnavalemid_read.kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | |
- | | + | |
- | | + | tempRes=simtiEng(tempStr); |
- | inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | if ((tempStr.charAt(2)=='1' |
- | inner join tell_tellimused ON tell_tellimused.number=@number | + | else if (parseInt(tempStr,10)!=0) tempRes+='million |
- | where mr_hinnavalemid_read.klass=artiklid.klass and mida='0' | + | resStr=tempRes+resStr; |
- | and mr_hinnavalemid_read.kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | } |
- | and | + | |
- | | + | if (fullStr.charAt(0)!=' |
- | then (select top 1 ale from mr_hinnavalemid_read | + | |
- | inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | else resStr=cipariEng[parseInt(fullStr.charAt(0),10)]+' |
- | inner join tell_tellimused ON tell_tellimused.number=@number | + | } |
- | where mr_hinnavalemid_read.klass=artiklid.klass and mida='0' | + | |
- | and mr_hinnavalemid_read.kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | if (resStr!='' |
- | and | + | |
- | (mr_hinnavalemid_read.aeg1 is null and mr_hinnavalemid_read.aeg2 is null )) END | + | } |
- | -- when | + | |
- | | + | |
- | -- inner join artiklid ON artiklid.kood=in_webshop_tell_tellimused_read.artikkel | + | if (santimi>0) { |
- | | + | resStr+=' '+santimi; |
- | | + | |
- | | + | |
- | | + | } else { |
- | -- ,case when EXISTS | + | |
- | -- then | + | } |
- | | + | } else { |
- | -- ELSE | + | resStr+=' |
- | + | } | |
- | -- isnull((select top 1 ale from mr_hinnavalemid_read with(nolock) where mida=' | + | |
- | -- isnull((select top 1 ale from mr_hinnavalemid_read with(nolock) where mida='0' | + | return |
- | | + | |
- | -- , isnull((select top 1 ale from mr_hinnavalemid_read where mida=' | + | |
- | -- , isnull(hind, | + | |
- | ,case when EXISTS (select top 1 ale from mr_hinnavalemid_read with(nolock) where mida='8' | + | |
- | and kood=(select top 1 hinnakiri from tell_tellimused with(nolock) where number=@number) | + | |
- | | + | |
- | and in_webshop_tell_tellimused_read.artikkel=artikkel | + | |
- | or mida='8' | + | |
- | then | + | |
- | (select dbo.get_hind6(artikkel, | + | |
- | + | ||
- | + | } | |
- | ELSE | + | var cipari=['',' |
- | + | var padsmiti=['desmit | |
- | (select top 1 baashind from artiklid where kood=in_webshop_tell_tellimused_read.artikkel) | + | var desmiti=['','',' |
- | END | + | |
- | , kogus*isnull(hind, | + | |
- | , dbo.kesk_hind(artikkel, | + | |
- | , isnull(nimetus, | + | |
- | , isnull((select top 1 kmkood from artiklid with(nolock) where kood=artikkel), | + | |
- | , | + | |
- | FROM in_webshop_tell_tellimused_read with(nolock) where number=@number | + | |
- | + | ||
- | + | ||
- | update tell_tellimused_read | + | |
- | set kmkood=ISNULL((select top 1 KMkood from artiklid with(nolock) where kood=tell_tellimused_read.artikkel), | + | |
- | where number=@number and kmkood is null | + | |
- | UPDATE tell_tellimused_read set tkkm = dbo.summaKM (yhikuhind, | + | |
- | + | ||
- | update tell_tellimused_read | + | |
- | set konto=ISNULL((select top 1 konto_myyk from artiklid with(nolock) where kood=tell_tellimused_read.artikkel), | + | |
- | where number=@number and konto is null | + | |
- | + | ||
- | --EXEC dbo.tell_tellimused_renum @number | + | |
- | EXEC dbo.arvuta_tellimus @number | + | |
- | update tell_tellimused_read set rv=rn where number=@number | + | |
- | exec hooldus_vaba | + | |
- | + | ||
- | set @koodid=@koodid+convert(nvarchar, | + | |
- | + | ||
- | insert into kliendid (kood, nimi, aadress1, aadress2, aadress3, nimi_lahetusel, | + | |
- | , kontakt, email, telefon | + | |
- | , | + | |
- | , | + | |
- | select top 1 | + | |
- | klient_kood, | + | |
- | , esindaja, | + | |
- | , | + | |
- | ,'XML', | + | |
- | FROM in_webshop_tell_tellimused with(nolock) where number=@number | + | |
- | and ISNULL(klient_kood,'' | + | |
- | and klient_kood not in (select kood from kliendid with(nolock)) | + | |
- | + | ||
- | insert into #results values (@webid, 'ORDER', 0, 'OK',' | + | |
- | end | + | |
- | ELSE | + | |
- | BEGIN | + | |
- | insert into #results values (@webid, 'ORDER', 2, 'Duplicate',' | + | |
- | END | + | |
- | + | ||
- | + | ||
- | set @x=@x+1 | + | |
- | end | + | |
- | FETCH NEXT FROM tellimused INTO @webid, @appkey | + | |
- | if @@FETCH_STATUS = 0 set @koodid=@koodid+';' | + | |
- | END | + | |
- | CLOSE tellimused | + | |
- | DEALLOCATE tellimused | + | |
- | + | ||
- | + | ||
- | --cleanup | + | |
- | --delete from in_webshop_tell_tellimused_klient where number in (select number from in_webshop_tell_tellimused where x=@key) | + | |
- | + | ||
- | delete from in_webshop_tell_tellimused_read where number in (select number from in_webshop_tell_tellimused where x=@key) | + | |
- | delete from in_webshop_tell_tellimused where x=@key | + | |
- | + | ||
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | |
- | --sales orders from imago [EE software] | + | |
- | + | ||
- | --vastuvotmine, | + | |
- | declare tellimused cursor for select number, appkey from xml_in_imago_tellimused where x=@key | + | |
- | open tellimused | + | |
- | FETCH NEXT FROM tellimused INTO @webid, @appkey | + | |
- | WHILE @@FETCH_STATUS = 0 | + | |
- | BEGIN | + | |
- | if ISNULL(@appkey, | + | |
- | begin | + | |
- | insert into #results values (@appkey, 'ORDER', 1, 'Incorrect key',' | + | |
- | + | ||
- | end | + | |
- | + | ||
- | else | + | |
- | begin | + | |
- | + | ||
- | select @id_exist=count(*) from tell_tellimused where kliendi_tellimus=convert(nvarchar(max),@webid) | + | |
- | if @id_exist=0 | + | |
- | BEGIN | + | |
- | --set @number=@webid | + | |
- | + | ||
- | EXEC dbo.get_dok_number @moodul='tellimus',@seeria='DOC',@NUMBER = NULL, @cu='xmlcore', | + | |
- | + | ||
- | update tell_tellimused set | + | |
- | myyja=iif(isnull(z.myyja,'' | + | |
- | aeg=z.aeg, | + | |
- | klient_kood=z.klient_kood, | + | |
- | arvetasub=z.arvetasub, | + | |
- | tingimus=isnull(z.tingimus, | + | |
- | ladu=isnull(z.ladu, | + | |
- | klient_nimi=isnull(z.klient_nimi, | + | |
- | lahetusviis=isnull(z.tingimus, | + | |
- | kommentaar=z.kommentaar, | + | |
- | valuuta='EUR', | + | |
- | kurssbv1=1, | + | |
- | esindaja=isnull(z.esindaja, | + | |
- | telefon=isnull(z.telefon, | + | |
- | aadress1=isnull(z.aadress1, | + | |
- | aadress2=isnull(z.aadress2, | + | |
- | aadress3=isnull(z.aadress3, | + | |
- | lahetusaadress1=isnull(z.lahaadress1, | + | |
- | lahetusaadress2=isnull(z.lahaadress2, | + | |
- | lahetusaadress3=isnull(z.lahaadress3, | + | |
- | klient_nimi_lahetusel=isnull(z.klientnimi_lahetusel, | + | |
- | ts=getdate(), | + | |
- | cu='XML', | + | |
- | Field57=isnull(z.email, | + | |
- | objekt=isnull(z.objekt, | + | |
- | hinnakiri=(select hinnakiri from kliendid where kood=z.klient_kood), | + | |
- | kliendi_tellimus=convert(nvarchar(max), | + | |
- | from (select * from xml_in_imago_tellimused where number=@webid)z | + | |
- | + | ||
- | where tell_tellimused.number=@number | + | |
- | + | ||
- | + | ||
- | select @maa=maa from kliendid where kood=(select klient_kood from xml_in_imago_tellimused where number=@number) | + | |
- | /* | + | |
- | insert into tell_tellimused (number, myyja, aeg, klient_kood, | + | |
- | , kommentaar, valuuta, kurssbv1 | + | |
- | ,esindaja, telefon, aadress1, aadress2, aadress3 | + | |
- | , | + | |
- | , | + | |
- | , ts, cu, Field57, objekt | + | |
- | , | + | |
- | ) | + | |
- | SELECT @number | + | |
- | + | ||
- | , | + | |
- | , aeg | + | |
- | , | + | |
- | , arvetasub | + | |
- | , isnull(tingimus, | + | |
- | , isnull(ladu,'' | + | |
- | , isnull(klient_nimi, | + | |
- | , isnull(tingimus, | + | |
- | , | + | |
- | , 'EUR', 1 | + | |
- | , isnull(esindaja, | + | |
- | , isnull(telefon, | + | |
- | , isnull(aadress1, | + | |
- | , isnull(aadress2, | + | |
- | , isnull(aadress3, | + | |
- | , isnull(lahaadress1, | + | |
- | , isnull(lahaadress2, | + | |
- | , isnull(lahaadress3, | + | |
- | , isnull(klientnimi_lahetusel, | + | |
- | + | ||
- | , GETDATE(), ' | + | |
- | , isnull(email, | + | |
- | , isnull(objekt, | + | |
- | , | + | |
- | FROM xml_in_imago_tellimused where number=@number | + | |
- | + | ||
- | */ | + | |
- | select * from in_xml_log order by rn desc | + | |
- | insert into tell_tellimused_read | + | |
- | (number, artikkel, variant, konto, kogus, field8, yhikuhind, summa, ostuhind, nimetus, kmkood, r_kommentaar, | + | |
- | select @number, artikkel, | + | |
- | , ale | + | |
- | , isnull(hind, | + | |
- | , kogus*isnull(hind, | + | |
- | , dbo.kesk_hind(artikkel, | + | |
- | , (select kmk_eesti from artikliklassid where kood=(select klass from artiklid where kood=artikkel)) | + | |
- | , | + | |
- | FROM xml_in_imago_tellimused_read where number=@webid | + | |
- | + | ||
- | + | ||
- | update tell_tellimused_read | + | |
- | set kmkood=ISNULL((select kmkood from artiklid where kood=tell_tellimused_read.artikkel), | + | |
- | where number=@number and kmkood is null | + | |
- | UPDATE tell_tellimused_read set tkkm = dbo.summaKM (yhikuhind, | + | |
- | + | ||
- | update tell_tellimused_read | + | |
- | set konto=ISNULL((select konto_myyk from artiklid where kood=tell_tellimused_read.artikkel), | + | |
- | where number=@number and konto is null | + | |
- | + | ||
- | EXEC dbo.tell_tellimused_renum @number | + | |
- | EXEC dbo.arvuta_tellimus @number | + | |
- | update tell_tellimused_read set rv=rn where number=@number | + | |
- | exec hooldus_vaba ' | + | |
- | + | ||
- | set @koodid=@koodid+convert(nvarchar, | + | |
- | + | ||
- | insert into kliendid (kood, nimi, aadress1, aadress2, aadress3, nimi_lahetusel, | + | |
- | , kontakt, email, telefon | + | |
- | , | + | |
- | , | + | |
- | select top 1 | + | |
- | klient_kood, | + | |
- | , esindaja, | + | |
- | , | + | |
- | ,' | + | |
- | FROM xml_in_imago_tellimused where number=@webid | + | |
- | and ISNULL(klient_kood,'' | + | |
- | and klient_kood not in (select kood from kliendid) | + | |
- | + | ||
- | insert into #results values (@webid, ' | + | |
- | end | + | |
- | ELSE | + | |
- | BEGIN | + | |
- | insert into #results values (@webid, ' | + | |
- | END | + | |
- | + | ||
- | + | ||
- | set @x=@x+1 | + | |
- | end | + | |
- | FETCH NEXT FROM tellimused INTO @webid, @appkey | + | |
- | if @@FETCH_STATUS = 0 set @koodid=@koodid+';' | + | |
- | END | + | |
- | CLOSE tellimused | + | |
- | DEALLOCATE tellimused | + | |
- | + | ||
- | + | ||
- | --cleanup | + | |
- | --delete from xml_in_imago_tellimused_klient where number in (select number from xml_in_imago_tellimused where x=@key) | + | |
- | delete from xml_in_imago_tellimused_read where number in (select number from xml_in_imago_tellimused where x=@key) | + | |
- | delete from xml_in_imago_tellimused where x=@key | + | |
- | + | ||
- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | + | |
- | --tulemused valja | + | |
- | + | ||
- | if (select COUNT(*) from # | + | |
- | insert into #results values (NULL, ' | + | |
- | + | ||
- | select @result1= | + | |
- | (select result as " | + | res=''; |
- | from #results for xml path ('Result')) | + | |
+ | // pirmais cipars no labaas | ||
+ | if (str.charAt(1)==' | ||
+ | res=padsmiti[parseInt(str.charAt(2))]; | ||
+ | else res=cipari[parseInt(str.charAt(2))]; | ||
+ | |||
+ | // otrais cipars no labaas | ||
+ | if (str.charAt(0)=='1' | ||
+ | | ||
+ | else if (str.charAt(0)!=' | ||
+ | | ||
+ | else // ja nav simtu | ||
+ | | ||
+ | |||
+ | // treshais cipars no labaas | ||
+ | res=cipari[parseInt(str.charAt(0))]+res; | ||
+ | return res; | ||
+ | } | ||
- | set @result2='<?xml version="1.0" encoding="UTF-8"?><results>'+CONVERT(nvarchar(max),@result1)+'</results>' | + | |
+ | fullStr='0000000000'; | ||
+ | tempStr=''; | ||
+ | tempRes=''; | ||
+ | resStr=''; | ||
+ | minus=''; | ||
+ | |||
+ | punkts=skaitlis.indexOf(' | ||
+ | if (punkts==-1) { | ||
+ | | ||
+ | | ||
+ | } else { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (pirmspStr.charAt(0)==' | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | for (i=pirmspStr.length-1, | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (fullStr.length>10) fullStr=fullStr.substring(fullStr.length-10); | ||
+ | |||
+ | if (parseInt(fullStr, | ||
+ | resStr+=nauda; | ||
+ | } else resStr+=' | ||
+ | |||
+ | if (parseInt(fullStr.substring(7),10)>0) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(4, | ||
+ | | ||
+ | | ||
+ | if ((tempStr.charAt(2)=='1') && (tempStr.charAt(1)!=' | ||
+ | else if (parseInt(tempStr, | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (parseInt(fullStr.substring(1, | ||
+ | | ||
+ | | ||
+ | if ((tempStr.charAt(2)==' | ||
+ | else if (parseInt(tempStr, | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (fullStr.charAt(0)!=' | ||
+ | if (fullStr.charAt(0)==' | ||
+ | else resStr=cipari[parseInt(fullStr.charAt(0), | ||
+ | } | ||
+ | |||
+ | if (resStr!='' | ||
+ | | ||
+ | } | ||
+ | |||
+ | santimi=parseInt(aizpStr, | ||
+ | if (santimi>0) { | ||
+ | | ||
+ | | ||
+ | if ((tmpSant.charAt(tmpSant.length-1)==' | ||
+ | resStr+=' | ||
+ | } else { | ||
+ | resStr+=' | ||
+ | } | ||
+ | } else { | ||
+ | resStr+=' | ||
+ | } | ||
+ | |||
+ | return (minus+resStr); | ||
+ | } | ||
- | select @result2 | + | |
- | drop table #results | + | |
- | delete from in_xml_log where datediff(day, | + | </ |
</ | </ |
lv/procedures.1600180391.txt.gz · Labota: 2020/09/15 17:33 , labojis marija