bandera, de no validar cuando es registro por oc, al editar

This commit is contained in:
rrene
2019-10-30 12:51:34 -07:00
parent 5308ee71ed
commit 87c4bdf614

View File

@@ -1335,6 +1335,17 @@ Partial Class Ventas
ViewState("CveOC") = value ViewState("CveOC") = value
End Set End Set
End Property End Property
Private Property RegistroxOC As Boolean
Get
Return CBool(IfNull(ViewState("RegistroxOC"), False))
End Get
Set(value As Boolean)
ViewState("RegistroxOC") = value
End Set
End Property
Private Property EnviarCorreoCliente As Boolean Private Property EnviarCorreoCliente As Boolean
Get Get
Return CBool(ViewState("EnviarCorreoCliente").ToString) Return CBool(ViewState("EnviarCorreoCliente").ToString)
@@ -5662,7 +5673,7 @@ Partial Class Ventas
End If End If
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
'VALIDA EXISTENCIA 'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then
@@ -6550,8 +6561,12 @@ Partial Class Ventas
actualindex = actualindex + 1 actualindex = actualindex + 1
Next Next
End If End If
Dim EsNCAmortizacion As Boolean = False
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso ChkAplicaNCAnticipo.Checked Then
EsNCAmortizacion = True
End If
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes) GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
'SI ES REFACTURACION 'SI ES REFACTURACION
Dim ObjNC As List(Of Object) = Nothing Dim ObjNC As List(Of Object) = Nothing
@@ -6574,57 +6589,9 @@ Partial Class Ventas
End If End If
End If End If
''[IPP]
''DATATABLES A USAR
'Dim DtSites As New DataTable
'Dim DtExcel As New DataTable
''CARGAS EXCEL EN DATATABLE 'SI ES amortizacion 3.3
'DtExcel = TmpDT Dim Obj2 As New List(Of Object)
''CARGAS LOS SITES REGISTRADOS
'If ObjBancos.GetBancos() Then
' DtSites = ObjBancos.DtResultados
'End If
''PROCESAS EXCEL
'Dim CveSiteActual = -1
'For Each Row As DataRow In TmpDT.Rows
' 'VALIDA QUE EXISTA EL SITE
' If DtExcel.Select($"Site = {Row("SITE")}").Count = 0 Then 'SI NO EXISTE AGREGA EL SITE
' CveSiteActual = ObjBancos.AddComplementoPago(-1, -1, "", -1, -1, -1)
' 'VALIDAS QUE SE HALLA AGREGADO
' If CveSiteActual > 0 Then
' 'AGREGA NUEVO SITE AL DATATABLE TEMPORAL DE SITES
' Dim DrNuevoSite = DtExcel.NewRow
' DrNuevoSite("CVE") = CveSiteActual
' DrNuevoSite("SITE") = Row("SITE")
' Else
' Alert("ERROR AL AGREGAR EL SITE")
' Exit For
' End If
' ElseIf DtExcel.Select($"Site = {Row("SITE")}").Count = 1 Then 'SI EXISTE OBTIENES CVE
' CveSiteActual = DtExcel.Select($"Site = {Row("SITE")}")(0)("Cve").ToString.ToEntero
' Else
' Alert("ERROR SOLO DEBE DAR RESULTADO 0 ó 1")
' Exit For
' End If
' 'AGREGA A TABLA CON LA DE MAS INFORMACION
' If Not ObjBancos.AddBancos_EstatusIE(CveSiteActual, Row("CAMPOS").ToString, Row("CAMPOS_EXTRA").ToString.ToEntero) Then
' Alert("ERROR AL GUARDAR")
' Exit For
' End If
'Next
'SI ES amortizacion 3.3
Dim Obj2 As New List(Of Object)
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
' cambiar la condicion para saber si hay seleccionado ' cambiar la condicion para saber si hay seleccionado
@@ -8773,6 +8740,7 @@ Partial Class Ventas
If GVOC.Rows.Count > 0 Or GvOCPS.Rows.Count > 0 Then If GVOC.Rows.Count > 0 Or GvOCPS.Rows.Count > 0 Then
'Checa las facturas selecionadas 'Checa las facturas selecionadas
VerificaOrdenesCompra(DTOrdenesCompra) VerificaOrdenesCompra(DTOrdenesCompra)
RegistroxOC = False
Dim dtSeleccionadas As DataTable = DTOrdenesCompra.FiltraParametros("Aplicado = True") Dim dtSeleccionadas As DataTable = DTOrdenesCompra.FiltraParametros("Aplicado = True")
If GvPS.Rows.Count > 0 Then If GvPS.Rows.Count > 0 Then
@@ -8815,7 +8783,7 @@ Partial Class Ventas
sb.Remove(sb.Length - 1, 1) sb.Remove(sb.Length - 1, 1)
If ObjClientes.GetVentasOCTotales(CveCliente, sb.ToString, If(ChkPSOC.Checked, 2, 1)) Then If ObjClientes.GetVentasOCTotales(CveCliente, sb.ToString, If(ChkPSOC.Checked, 2, 1)) Then
DTOrdenesCompraPS = ObjClientes.DtResultados DTOrdenesCompraPS = ObjClientes.DtResultados
RegistroxOC = True
Dim tCantidad As Decimal = 0 Dim tCantidad As Decimal = 0
For Each Dr As DataRow In DTOrdenesCompraPS.Select() For Each Dr As DataRow In DTOrdenesCompraPS.Select()
tCantidad = If(ChkPSOC.Checked, GvOCPS.Rows(IndiceGVDataKey(GvOCPS, "CveOrdenCompraDetalle", $"{Dr("CveOrdenCompraDetalle")}")).FCTextBox("TxtCantidadOC").Text, Dr("Cantidad")).ToString.ToDecimal tCantidad = If(ChkPSOC.Checked, GvOCPS.Rows(IndiceGVDataKey(GvOCPS, "CveOrdenCompraDetalle", $"{Dr("CveOrdenCompraDetalle")}")).FCTextBox("TxtCantidadOC").Text, Dr("Cantidad")).ToString.ToDecimal
@@ -9252,7 +9220,7 @@ Partial Class Ventas
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
'prepoliza 'prepoliza
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos) GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion)
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
'inventarios 'inventarios
If Not EsNCAmortizacion Then If Not EsNCAmortizacion Then
@@ -9300,7 +9268,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" Then If DdlTipoComprobante.SelectedValue <> "Cot" Then
If factura.CvePrePoliza > 0 Then If factura.CvePrePoliza > 0 Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos) Then If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion) Then
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico") ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If End If
@@ -9558,9 +9526,8 @@ Partial Class Ventas
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If End If
If Not EsNCAmortizacion Then 'APLICA NC SALDOS DIRECTOS
'APLICA NC SALDOS DIRECTOS If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows For Each Dr As DataRow In DtVentasNC.Rows
@@ -9698,8 +9665,6 @@ Partial Class Ventas
Exit For Exit For
End If End If
End If End If
End If
'APLICA DEVOLUCION SALDOS DIRECTOS 'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then If AplicaDevolucion Then
@@ -10101,20 +10066,12 @@ Partial Class Ventas
importeMovimiento = 0 importeMovimiento = 0
Case 150 'Descuento sobre ventas Case 150 'Descuento sobre ventas
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
Dim ConceptoContableAplicar = 150 Dim ConceptoContableAplicar = 150
Dim CveVentaAplicar = ObjFactura.CveVenta Dim CveVentaAplicar = ObjFactura.CveVenta
Dim CveVentaAmortizacionAplicar = -1 Dim CveVentaAmortizacionAplicar = -1
'cuando es NC, por amortización de anticipo, no debe de registrar el concepto 11,
'pero cuando es NC y se aplicó anticipo, debe de restarle el importe
If ObjFactura.TipoDocto.Contiene("Egs") And CveAnticipo > 0 AndAlso (DdlTipoComprobante.SelectedValue = "Ing" Or (DdlTipoComprobante.SelectedValue = "Egs" AndAlso ChkAplicaNCAnticipo.Checked = True)) Then
ConceptoContableAplicar = 11
CveVentaAplicar = CveAnticipo
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
End If
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
'código fijo en base el porcentaje iva, que se afecten las clasificaciones 'código fijo en base el porcentaje iva, que se afecten las clasificaciones
@@ -10123,16 +10080,6 @@ Partial Class Ventas
'se excluyen las clasificaciones anteriores para que se asignen las de ingreso 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "18097") Then If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "18097") Then
'If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal > 0 Then
' If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal = 0.08 Then
' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8%
' Else
' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16%
' End If
'Else
' TmpDTDetalle(i)("CveClasificacion") = 19930 'clasif: ventas tasa 0%
'End If
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString
End If End If