Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- "Ped".patente,
- "CTE"."numero",
- "Ped".aduana,
- CASE "Ped"."tipo" when 1 THEN 'Importacion' when 2 THEN 'Exportacion' END,
- "Ped"."pedimento",
- "CTE"."nombre",
- "Ped"."fechadepago",
- "Ped"."esrectificacion",
- "Ped"."pedimentooriginal",
- "b"."pedimento" AS "Pedimento Original",
- --(select "Ped"."pedimento" from "vt_pedimentos" "Ped" inner join "vt_pedimentos" "b" ON ("b"."pedimentooriginal" = "Ped"."id")) AS "Pedimento Original",
- "Ped"."fechadepagor1",
- "Ped".fpdta,
- ( SELECT SUM( "Tot"."importe" ) FROM "vt_totales" "Tot" WHERE "Tot"."pedimento" = "Ped"."id" AND "Tot"."clavecontribucion" = 1 ) AS "DTA",
- (SELECT SUM("Tot"."importe") FROM "vt_totales" "Tot" WHERE "Tot"."pedimento" = "Ped"."id" AND "Tot"."clavecontribucion" = 15) AS "PREVALIDACION",
- "Ped"."tipodecambio",
- "Par"."valorcomercialdlls",
- "Ped"."valorcomercial"*"Ped"."tipodecambio" AS "Valor Pesos Pedimento",
- "Ped".pesobruto,
- ( SELECT SUM( "Pcnt"."monto" ) FROM "vt_partidacontrib" "Pcnt" WHERE "Pcnt"."contribucion" = 3 AND "Pcnt"."partida" = "Par"."id" AND "Pcnt"."fp" = 0 ) AS "IVA FP_0",
- ( SELECT SUM( "Pcnt"."monto" ) FROM "vt_partidacontrib" "Pcnt" WHERE "Pcnt"."contribucion" = 3 AND "Pcnt"."partida" = "Par"."id" AND "Pcnt"."fp" = 5 ) AS "IVA FP_5",
- ( SELECT SUM( "Pcnt"."monto" ) FROM "vt_partidacontrib" "Pcnt" WHERE "Pcnt"."contribucion" = 6 AND "Pcnt"."partida" = "Par"."id" AND "Pcnt"."fp" = 0 ) AS "IGI FP_0",
- ( SELECT SUM( "Pcnt"."monto" ) FROM "vt_partidacontrib" "Pcnt" WHERE "Pcnt"."contribucion" = 6 AND "Pcnt"."partida" = "Par"."id" AND "Pcnt"."fp" = 5 ) AS "IGI FP_5",
- "Factu"."numero" AS "Numero Factura",
- "Par"."descripcion" ,
- "Par"."cantidadcomercial",
- "Par"."cantidadtarifa",
- "Par"."unidadcomercial",
- "Par"."unidadtarifa",
- "Par"."paisdeorigen",
- "Par".paisvendcomp,
- "Pcnt"."tipodetasa",
- "Cs"."caso"
- FROM "vt_pedimentos" "Ped"
- INNER JOIN "vt_clientes" "CTE" ON ( "CTE"."id" = "Ped"."cliente" )
- INNER JOIN "vt_partidas" "Par" ON ( "Par"."pedimento" = "Ped"."id" )
- --inner join "vt_pedimentos" "b" ON ("Ped"."id" ="b"."pedimentooriginal" )
- LEFT JOIN "vt_casos" "Cs" ON ("Par"."id" = "Cs"."partida")
- INNER JOIN "vt_pedimentofacturas" "Factu" ON ( "Factu"."pedimento" = "Ped"."id" )
- INNER JOIN "vt_partidacontrib" "Pcnt" ON ("Pcnt"."partida" = "Par"."id")
- WHERE ( ( "Ped"."patente" = '3890')
- AND "Ped"."fechadepago" BETWEEN '2010-03-01' AND '2010-06-30'
- AND ( "CTE"."numero" = '1153' OR "CTE"."numero" = '336' )
- AND ( RTRIM( "Ped"."firmapedimento" ) <> ''
- AND RTRIM( "Ped"."firmabanco" ) <> '' ) )
- ORDER BY "Ped"."patente","Ped"."fechadeentrada","Ped". "clave", "Ped"."pedimento"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement