|
|
|
|
@@ -18089,6 +18089,22 @@ Partial Class Compras_Compras
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim DtpsTemp As DataTable = Nothing
|
|
|
|
|
Dim CveContratoDetalle As Integer = -1
|
|
|
|
|
Dim CveContrato As Integer = GlobalDTContratos(UsuarioActual.CveEmpresa, -1, DdlSubProyecto.SelectedValue.ToString.ToEntero).FiltroPrimeroValor("CveContrato").ToEntero
|
|
|
|
|
If CveContrato > 0 Then
|
|
|
|
|
Dim dttemp As New DataTable
|
|
|
|
|
dttemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
|
|
|
|
dttemp.Columns.Add("CvePS", GetType(Integer))
|
|
|
|
|
Dim DrPS = dttemp.NewRow
|
|
|
|
|
DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero
|
|
|
|
|
DrPS("CvePS") = DdlPS.SelectedValue.ToString.ToEntero
|
|
|
|
|
dttemp.Rows.Add(DrPS)
|
|
|
|
|
DtpsTemp = GetPSContratoDetalle(CveContrato, dttemp)
|
|
|
|
|
If DtpsTemp IsNot Nothing AndAlso DtpsTemp.Rows.Count > 0 Then
|
|
|
|
|
CveContratoDetalle = DtpsTemp.FiltroPrimeroValor("CveContratoDetalle", String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString.ToEntero)).ToEntero
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
|
|
|
|
|
' Dim drContrato As DataRow = dttemp.Rows(0)
|
|
|
|
|
@@ -18123,8 +18139,6 @@ Partial Class Compras_Compras
|
|
|
|
|
' End If
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Select Case Modalidad
|
|
|
|
|
Case "A" 'ADD
|
|
|
|
|
|
|
|
|
|
@@ -18142,7 +18156,7 @@ Partial Class Compras_Compras
|
|
|
|
|
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
|
|
|
|
|
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
|
|
|
|
|
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
|
|
|
|
|
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
|
|
|
|
|
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS, CveContratoDetalle:=CveContratoDetalle)
|
|
|
|
|
|
|
|
|
|
AddPS2()
|
|
|
|
|
LimpiaAgregar()
|
|
|
|
|
@@ -18154,7 +18168,7 @@ Partial Class Compras_Compras
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Case "U" 'UPDATE
|
|
|
|
|
UpdatePS()
|
|
|
|
|
UpdatePS(CveContratoDetalle)
|
|
|
|
|
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
|
|
|
|
|
End Select
|
|
|
|
|
@@ -18353,7 +18367,7 @@ Partial Class Compras_Compras
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
Private Sub UpdatePS()
|
|
|
|
|
Private Sub UpdatePS(Optional CveContratoDetalle As Integer = -1)
|
|
|
|
|
Dim DrPS As DataRow = Nothing
|
|
|
|
|
Try
|
|
|
|
|
DrPS = TmpDT.Select($"Consec = {Index}")(0)
|
|
|
|
|
@@ -18376,6 +18390,7 @@ Partial Class Compras_Compras
|
|
|
|
|
DrPS("CveProyecto") = DdlProyecto.SelectedValue.ToEntero
|
|
|
|
|
DrPS("SubProyecto") = DdlSubProyecto.SelectedItem.Text
|
|
|
|
|
DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToEntero
|
|
|
|
|
DrPS("CveContratoDetalle") = CveContratoDetalle
|
|
|
|
|
|
|
|
|
|
'IMPORTES - [CANTIDAD Y PRECIO]
|
|
|
|
|
Dim Cantidad = DrPS("Cantidad").ToString.ToDouble
|
|
|
|
|
@@ -18616,13 +18631,26 @@ Partial Class Compras_Compras
|
|
|
|
|
CveProyecto = DdlAsignarProyecto.SelectedValue.ToEntero()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim CveContrato As Integer = GlobalDTContratos(UsuarioActual.CveEmpresa, -1, DdlAsignaSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("CveContrato").ToEntero
|
|
|
|
|
Dim DtpsTemp As DataTable = Nothing
|
|
|
|
|
If CveContrato > 0 Then
|
|
|
|
|
DtpsTemp = GetPSContratoDetalle(CveContrato, TmpDT.FiltraParametros("", "", {"CveSubProyecto", "CvePS"}))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
For Each Dr As DataRow In TmpDT.Rows
|
|
|
|
|
Dr("CveProyecto") = CveProyecto
|
|
|
|
|
Dr("Proyecto") = If(CveSubProyecto = -1, "SE", DdlAsignarProyecto.SelectedItem.Text)
|
|
|
|
|
Dr("CveSubProyecto") = CveSubProyecto
|
|
|
|
|
Dr("SubProyecto") = If(CveSubProyecto = -1, "SE", DdlAsignaSubProyecto.SelectedItem.Text)
|
|
|
|
|
|
|
|
|
|
If DtpsTemp IsNot Nothing AndAlso DtpsTemp.Rows.Count > 0 Then
|
|
|
|
|
Dr("CveContratoDetalle") = DtpsTemp.FiltroPrimeroValor("CveContratoDetalle", String.Format("CvePS = {0}", Dr("CvePS"))).ToEntero
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GvPS.DataSource = TmpDT.FiltraParametros("", "Consec")
|
|
|
|
|
GvPS.DataBind()
|
|
|
|
|
UpPS.Update()
|
|
|
|
|
@@ -18685,9 +18713,22 @@ Partial Class Compras_Compras
|
|
|
|
|
Dim PS As New ClsProductosServicios
|
|
|
|
|
Dim CvePS = -1
|
|
|
|
|
Dim tPS = ""
|
|
|
|
|
|
|
|
|
|
Dim CveSubProyecto As Integer = TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveSubProyecto").ToString.ToEntero
|
|
|
|
|
CvePS = DdlPSAlias2.SelectedValue.ToEntero
|
|
|
|
|
tPS = DdlPSAlias2.SelectedText
|
|
|
|
|
Dim DtpsTemp As DataTable = Nothing
|
|
|
|
|
Dim CveContrato As Integer = GlobalDTContratos(UsuarioActual.CveEmpresa, -1, CveSubProyecto).FiltroPrimeroValor("CveContrato").ToEntero
|
|
|
|
|
If CveContrato > 0 Then
|
|
|
|
|
Dim dttemp As New DataTable
|
|
|
|
|
dttemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
|
|
|
|
dttemp.Columns.Add("CvePS", GetType(Integer))
|
|
|
|
|
Dim DrPS = dttemp.NewRow
|
|
|
|
|
DrPS("CveSubProyecto") = CveSubProyecto
|
|
|
|
|
DrPS("CvePS") = CvePS
|
|
|
|
|
dttemp.Rows.Add(DrPS)
|
|
|
|
|
DtpsTemp = GetPSContratoDetalle(CveContrato, dttemp)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If PS.AddPSAlias(System.Web.HttpUtility.HtmlDecode(TxtPSAlias.Text.Trim), CvePS, UsuarioActual.CveUsuario) Then
|
|
|
|
|
GlobalDTProductosServiciosAlias(-1) = PS.DtResultados
|
|
|
|
|
@@ -18702,6 +18743,9 @@ Partial Class Compras_Compras
|
|
|
|
|
TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveSATPS") = HdnPSAliasCveSATPS.Value.ToEntero
|
|
|
|
|
TmpDT.Rows(HdnAliasInd.Value.ToEntero)("SATClaveProductoServicio") = HdnPSAliasSATClavePS.Value
|
|
|
|
|
TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveSATPSActualizado") = 0
|
|
|
|
|
If DtpsTemp IsNot Nothing AndAlso DtpsTemp.Rows.Count > 0 Then
|
|
|
|
|
TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveContratoDetalle") = DtpsTemp.FiltroPrimeroValor("CveContratoDetalle", String.Format("CvePS = {0}", CvePS)).ToEntero
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'busco si el producto está en otros renglones QUE NO LO TENGAN ASIGNADO, LO VINCULE
|
|
|
|
|
For Each drt As DataRow In TmpDT.Select($"PS ='{TxtPSAlias.Text.Trim}' and ISNULL(CvePS,0) = 0")
|
|
|
|
|
@@ -18715,7 +18759,9 @@ Partial Class Compras_Compras
|
|
|
|
|
drt("CveSATPS") = HdnPSAliasCveSATPS.Value.ToEntero
|
|
|
|
|
drt("SATClaveProductoServicio") = HdnPSAliasSATClavePS.Value
|
|
|
|
|
drt("CveSATPSActualizado") = 0
|
|
|
|
|
|
|
|
|
|
If DtpsTemp IsNot Nothing AndAlso DtpsTemp.Rows.Count > 0 Then
|
|
|
|
|
drt("CveContratoDetalle") = DtpsTemp.FiltroPrimeroValor("CveContratoDetalle", String.Format("CvePS = {0}", drt("CvePS"))).ToEntero
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Next
|
|
|
|
|
TmpDT.AcceptChanges()
|
|
|
|
|
@@ -20917,17 +20963,33 @@ Partial Class Compras_Compras
|
|
|
|
|
End If
|
|
|
|
|
objContratos.Dispose()
|
|
|
|
|
|
|
|
|
|
If MensajeProducto.Length <> 64 Then
|
|
|
|
|
If MensajeProducto.Length > 64 Then
|
|
|
|
|
Retorno = MensajeProducto
|
|
|
|
|
ElseIf MensajeCantidad.Length <> 84 Then
|
|
|
|
|
ElseIf MensajeCantidad.Length > 84 Then
|
|
|
|
|
Retorno = MensajeCantidad
|
|
|
|
|
ElseIf MensajeImporte.Length <> 86 Then
|
|
|
|
|
ElseIf MensajeImporte.Length > 86 Then
|
|
|
|
|
Retorno = MensajeImporte
|
|
|
|
|
Else
|
|
|
|
|
Retorno = ""
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Return Retorno
|
|
|
|
|
|
|
|
|
|
End Function
|
|
|
|
|
Private Function GetPSContratoDetalle(CveContrato As Integer, DtPS As DataTable) As DataTable
|
|
|
|
|
Dim ObjContratos As New ClsContratos
|
|
|
|
|
Dim DtpsTemp As DataTable = Nothing
|
|
|
|
|
|
|
|
|
|
If DtPS.MAX("CveSubProyecto", "CveSubProyecto IS NOT NULL").ToEntero > 0 AndAlso DtPS.MAX("CvePS", "CvePS IS NOT NULL").ToEntero > 0 Then
|
|
|
|
|
Dim TempPS As String = JsonConvert.SerializeObject(DtPS).ToString
|
|
|
|
|
If ObjContratos.GetPSContratoDetalle(CveContrato, TempPS) Then
|
|
|
|
|
DtpsTemp = ObjContratos.DtResultados
|
|
|
|
|
End If
|
|
|
|
|
ObjContratos.Dispose()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Return DtpsTemp
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
|