Entrega por adelantado en BDH, Remisiones de NC en aplicaciones de NC

This commit is contained in:
2019-10-05 18:03:14 -07:00
parent a50cafde75
commit 6cc587a898
5 changed files with 236 additions and 4 deletions

View File

@@ -257,6 +257,14 @@ Partial Class Ventas
ViewState("RemisionesLista") = value
End Set
End Property
Private Property ListaRemisionesNC As List(Of Modelos.Factura)
Get
Return If(IsNothing(ViewState("ListaRemisionesNC")), Nothing, CType(ViewState("ListaRemisionesNC"), List(Of Modelos.Factura)))
End Get
Set(value As List(Of Modelos.Factura))
ViewState("ListaRemisionesNC") = value
End Set
End Property
Private Property Pedidos2Lista As List(Of Integer)
Get
Return If(IsNothing(ViewState("Pedidos2Lista")), Nothing, CType(ViewState("Pedidos2Lista"), List(Of Integer)))
@@ -1733,6 +1741,9 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(344).ToString = "1" Then
DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("NC de Remisión", "RNC"))
DivBtnRemNC.Visible = True
DivTxtRemNC.Visible = True
LtlTitleImportesRem.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(528) = "1" Then 'FUNCIONALIDAD. DE REGISTRO DE CUENTA PREDIAL.
@@ -4937,7 +4948,7 @@ Partial Class Ventas
Dim ObjCliente As New ClsClientes()
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
If UsuarioActual.CveEmpresa.Contiene(72, 119) AndAlso ObjCliente.DtResultados.Rows(0)("PermiteCredito").ToString = "False" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso ObjCliente.DtResultados.Rows(0)("PermiteCredito").ToString = "False" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -9303,7 +9314,7 @@ Partial Class Ventas
ViewState("SeGuardoPrePoliza") = True
End If
Case 277 'Remisión del cliente
Case 277 'Remisión de NC
If ObjFactura.TipoDocto = "RNC" Then
importeMovimiento = (ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador
@@ -9788,6 +9799,42 @@ Partial Class Ventas
Next
If UsuarioActual.Empresa.Funcionalidad(344) = "1" Then
If ListaRemisionesNC IsNot Nothing Then
For Each ObjRNC As Modelos.Factura In ListaRemisionesNC
If ObjRNC.TipoDocto = "RNC" Then
importeMovimiento = ObjRNC.TotalRemNCAplicado * -1
importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
CveSubProyectoContabilizar = CveSubProyectoVenta
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
If tipoCambio = 1 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
CveCuenta = ObjFactura.Cliente.CveCuentaClientes
Else
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera
End If
IdCtaContableCliente = IdCtaContable
CveCuentaCliente = CveCuenta
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
importeMovimiento = 0
End If
Next
End If
End If
If sumaAmorticaciones <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
@@ -20196,6 +20243,9 @@ Partial Class Ventas
End If
RVTxtNCImporte.MaximumValue = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble.ToString
'RVIRNC.MinimumValue = RVTxtNCImporte.MinimumValue
'RVIRNC.MaximumValue = RVTxtNCImporte.MaximumValue
UpAplicarNC.Update()
End Sub
@@ -20217,13 +20267,14 @@ Partial Class Ventas
'LkNotaCredito.Visible = False
DivGvCxC.Visible = True
CargaCxC()
CargaRNC()
TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNCMasivo();")
TxtNCImporte.Text = "0.00"
TxtNCImporte.Enabled = False
RVTxtNCImporte.Enabled = False
UpAplicarNC.Update()
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaCxC()
@@ -20235,6 +20286,14 @@ Partial Class Ventas
ObjMovtos.Dispose()
GvCxC.DataBind()
End Sub
Private Sub CargaRNC()
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then
GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
End If
ObjMovtos.Dispose()
GvRemisionesNC.DataBind()
End Sub
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -20258,6 +20317,14 @@ Partial Class Ventas
Protected Sub BtnAplicarNC_Click(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(344) = "1" Then
If TxtImportesRemisionesNC.Text.ToDecimal() <> TxtNCImporte.Text.ToDecimal() Then
Alert($"Los importes no coinciden", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPS.SelectedValue.ToEntero).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
@@ -22955,4 +23022,38 @@ Partial Class Ventas
#End Region
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
If ListaRemisionesNC Is Nothing Then
ListaRemisionesNC = New List(Of Modelos.Factura)
Else
ListaRemisionesNC.Clear()
End If
Dim TotalRemNCAplicado As Decimal = 0
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaRemisionesNC.Clear()
Exit Sub
End If
ListaRemisionesNC.Add(RemNC)
End If
End If
Next
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
UpModalRemisionesNC.Update()
UpAplicarNC.Update()
RegistraScript("CerrarModalRemNC();")
End Sub
End Class