Commit inicial Ventas Productivo
This commit is contained in:
156
Acarreos/AcarreosPreEstimacion.aspx.vb
Normal file
156
Acarreos/AcarreosPreEstimacion.aspx.vb
Normal file
@@ -0,0 +1,156 @@
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Acarreos_AcarreosPreEstimacion
|
||||
Inherits ClsPaginas
|
||||
#Region " PROPIEDADES"
|
||||
Property _CvePreEstimacion As Integer
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
DdlTransportista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlTransportista.DataBind()
|
||||
DdlMaterial.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlMaterial.DataBind()
|
||||
TxtFechaPreEstimacion.Text = Now.AddDays(0).ToShortDateString
|
||||
BtnAgregarPreEstimacion.Text = "Pre-Estimar"
|
||||
CargaDdlNumContrato()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarPreEstimacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarPreEstimacion.Click
|
||||
If DdlNumContrato.SelectedValue = "-1" Then
|
||||
Alert("Tiene que seleccionar un contrato", TipoMensaje.MsgAdvertencia)
|
||||
ElseIf DdlTransportista.SelectedValue = "-1" Then
|
||||
Alert("Tiene que seleccionar un transportista", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Dim ObjAcar As New ClsAcarreos()
|
||||
Dim ErrorAdd As Boolean = False
|
||||
ObjAcar.IniciaTransacSQL()
|
||||
For Each Gvr As GridViewRow In GvPreEstimacion.Rows
|
||||
If CType(Gvr.FindControl("ChkRow"), System.Web.UI.WebControls.CheckBox).Checked = True Then
|
||||
If Not ObjAcar.AddPreEstimacion(DdlNumContrato.SelectedValue, DdlTransportista.SelectedValue, TxtNumPreEstimacion.Text, TxtFechaPreEstimacion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorAdd = True
|
||||
Exit For
|
||||
End If
|
||||
_CvePreEstimacion = ObjAcar._CvePreEstimacion
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If _CvePreEstimacion <> Nothing Then
|
||||
For Each Gvr As GridViewRow In GvPreEstimacion.Rows
|
||||
If CType(Gvr.FindControl("ChkRow"), System.Web.UI.WebControls.CheckBox).Checked = True Then
|
||||
If Not ObjAcar.AddPreEstimacionDetalle(_CvePreEstimacion, Gvr.DataKey("CveAcarreoConcluido").ToEntero) Then
|
||||
ErrorAdd = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
If ErrorAdd = True Then
|
||||
ObjAcar.RollBack()
|
||||
Alert("Ocurrio un error al momento de agregar.", TipoMensaje.MsgError)
|
||||
Else
|
||||
ObjAcar.Commit()
|
||||
If _CvePreEstimacion <> Nothing Then
|
||||
Alert("Agregado(s) Correctamente.", TipoMensaje.MsgInformacion)
|
||||
DdlTransportista.Items.Clear()
|
||||
DdlNumContrato.Items.Clear()
|
||||
DdlMaterial.Items.Clear()
|
||||
DdlTransportista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlTransportista.DataBind()
|
||||
DdlMaterial.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlMaterial.DataBind()
|
||||
CargaDdlNumContrato()
|
||||
TxtNumPreEstimacion.Text = ""
|
||||
TxtFechaPreEstimacion.Text = Now.AddDays(0).ToShortDateString
|
||||
GvPreEstimacion.DataSource = Nothing
|
||||
GvPreEstimacion.DataBind()
|
||||
Else
|
||||
Alert("No selecciono ningun acarreo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDdlNumContrato()
|
||||
Dim ObjAcar As New ClsAcarreos
|
||||
If ObjAcar.GetAcarreosProyectos(-1, UsuarioActual.CveEmpresa, -1, -1) Then
|
||||
DdlNumContrato.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlNumContrato.DataSource = ObjAcar.DtResultados
|
||||
DdlNumContrato.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub DdlMaterial_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMaterial.SelectedIndexChanged
|
||||
GvPreEstimacion.DataSource = Nothing
|
||||
GvPreEstimacion.DataBind()
|
||||
If Not DdlTransportista.SelectedValue = "-1" Then
|
||||
Dim ObjAcar As New ClsAcarreos
|
||||
If ObjAcar.GetAcarreosConcluidos(DdlTransportista.SelectedValue, UsuarioActual.CveEmpresa, DdlNumContrato.SelectedValue, 0, DdlMaterial.SelectedValue) Then
|
||||
GvPreEstimacion.DataSource = ObjAcar.DtResultados
|
||||
GvPreEstimacion.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DdlNumContrato_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlNumContrato.SelectedIndexChanged
|
||||
DdlTransportista.Items.Clear()
|
||||
DdlTransportista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlTransportista.DataBind()
|
||||
DdlMaterial.Items.Clear()
|
||||
DdlMaterial.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlMaterial.DataBind()
|
||||
If Not DdlNumContrato.SelectedValue = "-1" Then
|
||||
DdlTransportista.Items.Clear()
|
||||
Dim ObjAcar As New ClsAcarreos
|
||||
If ObjAcar.GetTransportista(-1, UsuarioActual.CveEmpresa, 1, DdlNumContrato.SelectedValue) Then
|
||||
DdlTransportista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlTransportista.DataSource = ObjAcar.DtResultados
|
||||
DdlTransportista.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
Else
|
||||
GvPreEstimacion.DataSource = Nothing
|
||||
GvPreEstimacion.DataBind()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DdlTransportista_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTransportista.SelectedIndexChanged
|
||||
DdlMaterial.Items.Clear()
|
||||
DdlMaterial.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlMaterial.DataBind()
|
||||
Dim ObjAcar As New ClsAcarreos
|
||||
If ObjAcar.GetAcarreosMaterialVolumen(DdlNumContrato.SelectedValue, UsuarioActual.CveEmpresa, -1) Then
|
||||
DdlMaterial.DataSource = ObjAcar.DtResultados
|
||||
DdlMaterial.DataBind()
|
||||
End If
|
||||
ObjAcar.Dispose()
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GvPreEstimacion_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPreEstimacion.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim Css As String = "Texto"
|
||||
Dim Liga As String = $"/Acarreos/RegistroAcarreo.aspx?&CveAcarreo={e.Row.DataKey("CveAcarreo")}"
|
||||
e.Row.FCLiteral("LtlFolio").Text = "<a class=""" & Css & """ href=""" & Liga & """>" & e.Row.FCLiteral("LtlFolio").Text & "</a>"
|
||||
If e.Row.FCLiteral("LtlImporte").Text = "" Then
|
||||
e.Row.FCLiteral("LtlImporte").Text = "Error"
|
||||
e.Row.Cells(8).BackColor = Drawing.Color.Red
|
||||
e.Row.Cells(8).ForeColor = Drawing.Color.White
|
||||
e.Row.FCCheckBox("ChkRow").Enabled = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user