Calcular Precio Venta BARCO

Navigation:  KnowledgeBase Programación > Productos >

Calcular Precio Venta BARCO

Previous pageReturn to chapter overviewNext page

dim drPRoducto as datarow()
 
 
drProducto = ds.Tables("Productos").select(string.format("IDProducto='{0}'",nstring(dr("IDProducto"))),"")
 
if drProducto.Length = 0 then MessageBox.Show("No se encontró el producto"): exit sub
 
  dim diFind as datarow() = ds.Tables("InfoAdicional").select(string.format("IDCampo='300-002' and IDDocumento={0}", NDouble(dr("IDDocumento"))),"")
  if diFind.Length=0 then MessageBox.Show("No ha agregado la embarcación en el documento actual"): exit sub
  dim EmbarcacionID as string  = nstring(diFind(0).item("Valor1"))
 
 
  diFind = ds.Tables("Catalogos1").select(string.format("IDCatalogo1='{0}'", EmbarcacionID),"")  
  if diFind.Length=0 then MessageBox.Show("No se encontró la embarcación dentro del catálogo"): exit sub
   
  dim TRB as double=ndouble(diFind(0).item("NCampo1"))
  dim Eslora as double=ndouble(diFind(0).item("NCampo2"))
  dim Tarifa as double=0  
   
  dim drPrincipal as datarow = ds.Tables("Documentos").select(string.format("IDDocumento={0}",NDouble(dr("IDDocumento"))),"")(0)
  Tarifa = ndouble(drProducto(0).item(string.format("PPrecioVenta{0}",NDouble(drPrincipal("NumSuc")))))
  dr("NValor1") = Tarifa
  dr("Cantidad") = 1
  dr("Precio") = Tarifa * TRB
  dr("IVA") = (Tarifa * NDouble(dr("Cantidad")) * TRB) * NDouble(dr("TasaIVA"),1)
  dr("PrecioVenta") = dr("Precio")

 

 

 

 

 

 

-----------------------------

 

 

Dim drPRoducto As datarow()

 

 

drProducto = ds.Tables("Productos").select(string.format("IDProducto='{0}'",nstring(dr("IDProducto"))),"")

 

if drProducto.Length = 0 then MessageBox.Show("No se encontró el producto"): exit sub

 

dim drPrincipal as datarow = ds.Tables("Documentos").select(string.format("IDDocumento={0}",NDouble(dr("IDDocumento"))),"")(0)

Dim Tarifa As Double = 0

If msgbox("¿Es tarifa anterior (2016)?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

      Select Case NDouble(drPrincipal("NumSuc"))

      Case 1

          Tarifa = 3567.43

      Case 2

          Tarifa = 1422.1

      Case 3

          Tarifa = 7199.4

      Case Else

          Tarifa = 0

      End Select

     

  Else

     Tarifa = ndouble(drProducto(0).item(string.format("PPrecioVenta{0}",NDouble(drPrincipal("NumSuc")))))

  end if

 

  dr("NValor1") = Tarifa

  dr("Cantidad") = 1

  dr("Precio") = Tarifa

  dr("IVA") = (Tarifa * NDouble(dr("Cantidad"))) * NDouble(dr("TasaIVA"),1)

  dr("PrecioVenta") = dr("Precio")