Correciones al actualizar, facturar contizaciones con usados
This commit is contained in:
@@ -5459,7 +5459,9 @@ Partial Class Ventas
|
|||||||
DdlMetodoPago33.Enabled = True
|
DdlMetodoPago33.Enabled = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveVenta <= 0 Or EsCreaApartirDe Or NuevaFactura = 1 Then
|
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
|
||||||
|
|
||||||
|
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 Then
|
||||||
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
||||||
|
|
||||||
|
|
||||||
@@ -6241,7 +6243,9 @@ Partial Class Ventas
|
|||||||
ViewState("CliNoInt") = ObjCliente.NoInt
|
ViewState("CliNoInt") = ObjCliente.NoInt
|
||||||
PlazoCobranza = ObjCliente.PlazoCobranza
|
PlazoCobranza = ObjCliente.PlazoCobranza
|
||||||
|
|
||||||
If CveVenta <= 0 Then
|
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
|
||||||
|
|
||||||
|
If CveVenta <= 0 AndAlso CveCotizacion <= 0 Then
|
||||||
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
||||||
|
|
||||||
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
|
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
|
||||||
@@ -21405,7 +21409,7 @@ Partial Class Ventas
|
|||||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"})
|
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"})
|
||||||
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
|
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
|
||||||
ResultadoMail = 1
|
ResultadoMail = 1
|
||||||
Alert("El acuse de cancelación ha sido envíado correctamente.")
|
Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
Else
|
Else
|
||||||
ResultadoMail = 0
|
ResultadoMail = 0
|
||||||
End If
|
End If
|
||||||
@@ -26497,6 +26501,12 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub BtnEditarCotizacion_Click(sender As Object, e As EventArgs) Handles BtnEditarCotizacion.Click
|
Private Sub BtnEditarCotizacion_Click(sender As Object, e As EventArgs) Handles BtnEditarCotizacion.Click
|
||||||
|
Dim VaFacturarCotizacion As Boolean = False
|
||||||
|
'SI CARGA UNA COTIZACION DEBE GUARDAR TAMBIEN
|
||||||
|
If IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() > 0 Then
|
||||||
|
ViewState("CveVenta") = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
|
||||||
|
VaFacturarCotizacion = True
|
||||||
|
End If
|
||||||
|
|
||||||
If Not TmpDT.Rows.Count > 0 Then
|
If Not TmpDT.Rows.Count > 0 Then
|
||||||
Alert("Es necesario agregar al menos un producto o servicio a la factura.", TipoMensaje.MsgAdvertencia)
|
Alert("Es necesario agregar al menos un producto o servicio a la factura.", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -26567,14 +26577,14 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
|
'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
|
||||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
' If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||||
If ObjConta.ValorPolizaDescuadre = 2 Then
|
' If ObjConta.ValorPolizaDescuadre = 2 Then
|
||||||
OcurrioError = True
|
' OcurrioError = True
|
||||||
MensajeError = ObjConta.MensajePolizaDescuadre
|
' MensajeError = ObjConta.MensajePolizaDescuadre
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If OcurrioError Then
|
If OcurrioError Then
|
||||||
ObjVentas.RollBack()
|
ObjVentas.RollBack()
|
||||||
@@ -26590,7 +26600,12 @@ Partial Class Ventas
|
|||||||
'GENERA PDF NUEVO
|
'GENERA PDF NUEVO
|
||||||
GeneraPDFCotizacion(ChkEnviarFactura.Checked)
|
GeneraPDFCotizacion(ChkEnviarFactura.Checked)
|
||||||
|
|
||||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";")
|
If VaFacturarCotizacion Then
|
||||||
|
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveCotizacion=" & CveVenta & """;")
|
||||||
|
Else
|
||||||
|
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";")
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
@@ -26807,82 +26822,77 @@ Partial Class Ventas
|
|||||||
Private Function CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) As List(Of MVentaDetalleCotizacion)
|
Private Function CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) As List(Of MVentaDetalleCotizacion)
|
||||||
Dim Retorno As New List(Of MVentaDetalleCotizacion)
|
Dim Retorno As New List(Of MVentaDetalleCotizacion)
|
||||||
|
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||||
|
|
||||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||||
|
|
||||||
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
For Each Dr As DataRow In DTSeleccionadas.Rows
|
||||||
|
Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
||||||
|
Dr("Cantidad") = tCantidad
|
||||||
|
|
||||||
|
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad})
|
||||||
|
|
||||||
For Each Dr As DataRow In DTSeleccionadas.Rows
|
Next
|
||||||
Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
|
||||||
Dr("Cantidad") = tCantidad
|
|
||||||
|
|
||||||
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad})
|
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
||||||
|
|
||||||
Next
|
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||||
|
|
||||||
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
DTPSTemp.Columns.Add("CveVenta", GetType(Integer))
|
||||||
|
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||||
|
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||||
|
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||||
|
|
||||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
For Each DrowPartidas As DataRow In TmpDTCalculo
|
||||||
|
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero()
|
||||||
|
Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero()
|
||||||
|
|
||||||
DTPSTemp.Columns.Add("CveVenta", GetType(Integer))
|
If CveTamanioTemp > 0 Then
|
||||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
|
||||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
|
||||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
|
||||||
|
|
||||||
For Each DrowPartidas As DataRow In TmpDTCalculo
|
Dim DTTamanioTemp As New DataTable
|
||||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero()
|
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero()
|
||||||
Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero()
|
|
||||||
|
|
||||||
If CveTamanioTemp > 0 Then
|
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||||
|
|
||||||
Dim DTTamanioTemp As New DataTable
|
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||||
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero()
|
|
||||||
|
|
||||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||||
|
|
||||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then
|
||||||
|
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal
|
||||||
|
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo
|
||||||
|
dRowUpdate("CveVenta") = CveVenta
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
DTPSTemp.AcceptChanges()
|
||||||
|
|
||||||
If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then
|
Else
|
||||||
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal
|
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||||
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo
|
|
||||||
dRowUpdate("CveVenta") = CveVenta
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
|
|
||||||
DTPSTemp.AcceptChanges()
|
dRowNuevo("CvePS") = CvePsTemp
|
||||||
|
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal
|
||||||
Else
|
dRowNuevo("PU") = Cargo
|
||||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
dRowNuevo("CveVenta") = CveVenta
|
||||||
|
|
||||||
dRowNuevo("CvePS") = CvePsTemp
|
|
||||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal
|
|
||||||
dRowNuevo("PU") = Cargo
|
|
||||||
dRowNuevo("CveVenta") = CveVenta
|
|
||||||
|
|
||||||
DTPSTemp.Rows.Add(dRowNuevo)
|
|
||||||
DTPSTemp.AcceptChanges()
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
DTPSTemp.Rows.Add(dRowNuevo)
|
||||||
|
DTPSTemp.AcceptChanges()
|
||||||
End If
|
End If
|
||||||
Next
|
|
||||||
|
|
||||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
If drowPsTamaños("PU").ToString().ToDecimal > 0 Then
|
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||||
|
|
||||||
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
If drowPsTamaños("PU").ToString().ToDecimal > 0 Then
|
||||||
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
|
||||||
|
|
||||||
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()})
|
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
||||||
|
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
||||||
|
|
||||||
End If
|
Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()})
|
||||||
Next
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
Reference in New Issue
Block a user