• Viernes 17 de Mayo de 2024, 05:27

Autor Tema:  Problema Con Stock De Almacenes  (Leído 757 veces)

dawn

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
Problema Con Stock De Almacenes
« en: Martes 18 de Septiembre de 2007, 03:02 »
0
Hola q tal soy nuevo en el foro y deseo q porfavor me ayuden en este problema q se me presento, estoy desarrollando un programa de regeneracion de stock esto me debe de arrojar el stock al dia q le he señalado pero me lansa un error, me sale solo en el producto 1 mas cantidades q en los demas, los demas productos si concuerda con mi stock y al evaluarlos no he encontrado aun el problema en el codigo ademas me tome la molestia de hacerlo todo manualmente y si me sale el stock en hojita pero en codigo solo de ese producto no me sale no se si me pueden apollar en eso aqui les pongo el codigo :


Private Sub Form_Load()
Me.DTPicker1.Value = Date

End Sub

Private Sub KewlButtons1_Click()
Dim FECHAS As Date
FECHAS = CDate(Me.Label2.Caption)
If CDate(Me.DTPicker1.Value) < FECHAS Then
MsgBox "NO se puede hacer la regeneracion de saldos ya que el almacen esta cerrado", vbCritical, "Almacen"
Me.DTPicker1.SetFocus
Else
With CmdConex
Set .ActiveConnection = DbConex
.CommandText = "update stock Set st_mov=0,stk_f=stk_i Where est='F'"
End With
CmdConex.Execute

Dim fth As String
fth = "update stock set stk_f=stk_i+ m9.movimientos from ( " & _
"select g6.totales as Movimientos ,g6.totales ,g6.id_prod from ( " & _
"select sum(det_compras.cantidad * productos.cant_uni) as totales,productos.codprod ,productos.id_prod from compras,productos,det_compras " & _
"where productos.id_prod=det_compras.id_producto and Compras.ID_Compras=Det_compras.Id_Compra and compras.fec_compra BETWEEN '" & CDate(FECHAS) & "' and '" & CDate(Me.DTPicker1.Value) & "'" & _
"GROUP BY productos.codprod ,productos.id_prod )g6 )m9 where stock.id_prod =m9.id_prod and est='F' "
'MsgBox (fth)
With CmdConex
Set .ActiveConnection = DbConex
.CommandTimeout = 5
.CommandText = fth
End With
CmdConex.Execute
With CmdConex
Set .ActiveConnection = DbConex
.CommandText = "update stock set stk_f=stk_f-m9.salida from ( " & _
"select b7.salida,b7.id_prod from ( " & _
"select sum(det_entregas_Liquidaciones.cant_entregada)-sum(det_entregas_Liquidaciones.cant_devuelta) as salida ,det_entregas_Liquidaciones.Id_Prod from Entrega_Liquidaciones,det_entregas_Liquidaciones " & _
"where Entrega_Liquidaciones.Id_En_Li=Det_Entregas_Liquidaciones.Id_En_Li and Entrega_Liquidaciones.Fec_Entrega BETWEEN '" & CDate(FECHAS) & "' and '" & CDate(Me.DTPicker1.Value) & "'" & _
"GROUP BY Det_Entregas_Liquidaciones.Id_Prod )b7 )m9 where stock.id_prod =m9.id_prod and est='F'"
End With
CmdConex.Execute

With CmdConex
Set .ActiveConnection = DbConex
.CommandTimeout = 5
.CommandText = "update stock set stk_f=stk_f+v7.c from ( " & _
"select sum(cant) as c,id_prod from obs where obs.Fecha BETWEEN '" & FECHAS & "' and '" & Me.DTPicker1.Value & "' GROUP BY id_prod )v7 where v7.id_prod=stock.id_prod and stock.est='F'"
End With
CmdConex.Execute

With CmdConex
Set .ActiveConnection = DbConex
.CommandTimeout = 5
.CommandText = "update stock set stk_f=stk_f-f7.v from ( " & _
"select id_prod,sum(cantidad) as v from Imprevistos where imprevistos.fecha BETWEEN '" & FECHAS & "' and '" & Me.DTPicker1.Value & "' GROUP BY id_prod )f7 where f7.id_prod=stock.id_prod and stock.est='F'"
.CommandTimeout = 3
End With
CmdConex.Execute
With CmdConex
Set .ActiveConnection = DbConex
.CommandText = "Update Stock set Fec_Stk='" & Me.DTPicker1.Value & "' where est='F'"
.CommandTimeout = 3
End With
CmdConex.Execute
With CmdConex
Set .ActiveConnection = DbConex
.CommandText = "Update Stock Set St_mov=abs(stk_i-stk_f)where est='F'"
.CommandTimeout = 3
End With
CmdConex.Execute
MsgBox "Se realizo la regeneracion de los saldos", vbInformation, "Regeneracion de Saldos"
If DteSistema.rsReg_Gas_Grouping.State = adStateOpen Then
DteSistema.rsReg_Gas_Grouping.Close
End If
DteSistema.Reg_Gas_Grouping Me.DTPicker1.Value
Report_Reg_Gastos.Show
End If
End Sub


espero puedan apollarme si alguno sabe la respuesta hacermelo saber porfavor

grasias de ante mano
xD