Sign up
Login
New
Trending
Archive
English
English
Sign up
Login
New Paste
Add Image
select concat('update tbl_notas_faturamento_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 41 , ', @cd_lancamento = ', a.cd_lancamento , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_notas_faturamento_itens a join tbl_notas_faturamento b on a.cd_lancamento = b.cd_lancamento where cd_almoxarifado is null union all select concat('update tbl_notas_emitidas_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 2 , ', @cd_lancamento = ', a.cd_nota , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_notas_emitidas_itens a join tbl_notas_emitidas b on a.cd_nota = b.cd_nota join tbl_tipo_documentos t on b.cd_tipodocumento = t.cd_tipodocumento where t.cd_operacao = 1 and cd_almoxarifado is null union all select concat('update tbl_notas_emitidas_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' where cd_id = ', cd_id, ';' , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 43 , ', @cd_lancamento = ', a.cd_nota , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_notas_emitidas_itens a join tbl_notas_emitidas b on a.cd_nota = b.cd_nota join tbl_tipo_documentos t on b.cd_tipodocumento = t.cd_tipodocumento where t.cd_operacao = 2 and cd_almoxarifado is null union all select concat('update tbl_compras_notafiscal_entrada_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 1 , ', @cd_lancamento = ', a.cd_entrada , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_compras_notafiscal_entrada_itens a join tbl_compras_notafiscal_entrada b on a.cd_entrada = b.cd_entrada where cd_almoxarifado is null union all select concat('update tbl_requisicao_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 42 , ', @cd_lancamento = ', a.cd_requisicao , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_requisicao_itens a join tbl_requisicao b on a.cd_requisicao = b.cd_requisicao where b.cd_operacao = 1 and cd_almoxarifado is null union all select concat('update tbl_requisicao_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 50 , ', @cd_lancamento = ', a.cd_requisicao , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_emissao, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_requisicao_itens a join tbl_requisicao b on a.cd_requisicao = b.cd_requisicao where b.cd_operacao = 2 and cd_almoxarifado is null union all select concat('update tbl_materiais_contagem_estoque_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 100 , ', @cd_lancamento = ', a.cd_lancamento , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_lancamento, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_materiais_contagem_estoque_itens a join tbl_materiais_contagem_estoque b on a.cd_lancamento = b.cd_lancamento where cd_almoxarifado is null union all select concat('update tbl_orcamentos_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' where cd_id = ', cd_id, '; -- ', cd_filial) script from tbl_orcamentos_itens a join tbl_orcamentos b on a.cd_orcamento = b.cd_orcamento where cd_almoxarifado is null union all select concat('update tbl_ordem_servico_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' where cd_id = ', cd_id, '; -- ', cd_filial) script from tbl_ordem_servico_itens a join tbl_ordem_servico b on a.cd_ordem = b.cd_ordem where cd_almoxarifado is null union all select concat('update tbl_pedidos_itens set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' where cd_id = ', cd_id, '; -- ', cd_filial) script from tbl_pedidos_itens a join tbl_pedidos b on a.cd_pedido = b.cd_pedido where cd_almoxarifado is null union all select concat('update tbl_ordem_producao_consumo set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 46 , ', @cd_lancamento = ', a.cd_entrada , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_entrada, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_ordem_producao_consumo a join tbl_ordem_producao b on a.cd_entrada = b.cd_entrada where cd_almoxarifado is null union all select concat('update tbl_ordem_producao_produto_produzido set cd_almoxarifado = ', case when cd_filial = 1 then 1 when cd_filial = 4 then 3 else 1 end , ' exec procedure_calcula_estoque @cd_empresa = ', b.cd_empresa , ', @cd_filial = ', cd_filial , ', @cd_origem = ', 4 , ', @cd_lancamento = ', a.cd_entrada , ', @cd_id = ', cd_id , ', @cd_material = ', cd_material , ', @dt_kardex = ', '''', format(dt_entrada, 'yyyyMMdd'), '''' , ', @x_estoque_almoxarifado = 1' , '; -- ', cd_filial ) script from tbl_ordem_producao_produto_produzido a join tbl_ordem_producao b on a.cd_entrada = b.cd_entrada where cd_almoxarifado is null
Settings
Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English