From d5f7f974803ed8f91a6cf43602f8a90fc3d7d3ba Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Wed, 21 Apr 2021 00:29:46 -0700 Subject: [PATCH 01/11] --- Bancos/DepositosCaja.aspx.vb | 2 +- CRM/Acercamiento.aspx.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 1d7742e10..9274e79ab 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -163,7 +163,7 @@ Partial Class Bancos_DepositosCaja CveSubProyecto = DdlSubProyectoDeposito.SelectedValue.ToEntero CveClasificacion = DdlClasificacion.SelectedValue.ToEntero - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then OcurrioError = True End If End If diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index 30c7a064f..8a7c0fff3 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -1068,10 +1068,10 @@ public partial class CRM_Acercamiento : ClsPaginas ClsOIEventos ObjEventos = new ClsOIEventos(); DateTime FechaInicio = TxtFechaInicioAgenda.Text.ToDateTime(); int CveContactoAgendar = DdlContactoAgenda.SelectedValue.ToEntero(); - + int CveEmpresaCRM = DdlEmpresaCRM.SelectedValue.ToEntero(); int CveEtapa = HdfEtapaSeleccionada.Value.ToEntero() == -1 ? CveEtapaActual : HdfEtapaSeleccionada.Value.ToEntero(); - if (ObjEventos.AddEventoAgenda(DdlTipoAgenda.SelectedValue.ToEntero(), TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridadAgenda.SelectedValue.ToEntero(), FechaInicio, FechaInicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveContactoCRM: CveContactoAgendar, CveEtapaProcesoCRM: CveEtapa)) + if (ObjEventos.AddEventoAgenda(DdlTipoAgenda.SelectedValue.ToEntero(), TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridadAgenda.SelectedValue.ToEntero(), FechaInicio, FechaInicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveContactoCRM: CveContactoAgendar, CveEtapaProcesoCRM: CveEtapa, CveEmpresaCRM:CveEmpresaCRM)) { limpiarModalAgendar(); RegistraScript("$('#ModalAgenda').modal('hide')"); From 0e14753eeab616d814881f85bfcada0f6b8fe244 Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Wed, 21 Apr 2021 00:30:10 -0700 Subject: [PATCH 02/11] rotacion y balanceo --- Empresas/141/Formatos/Factura.rdlc | 16 +- Empresas/152/Formatos/Factura.rdlc | 520 +---------------------------- Ventas/Ventas.aspx | 13 + Ventas/Ventas.aspx.vb | 13 + 4 files changed, 57 insertions(+), 505 deletions(-) diff --git a/Empresas/141/Formatos/Factura.rdlc b/Empresas/141/Formatos/Factura.rdlc index 79a23d44f..fa20efdbd 100644 --- a/Empresas/141/Formatos/Factura.rdlc +++ b/Empresas/141/Formatos/Factura.rdlc @@ -1340,12 +1340,26 @@ Bold + + + + + + ="<b>Próxima Rotación y Balanceo: </b>" & FormatDateTime(CDate(Parameters!Fecha.Value).AddMonths(6), DateFormat.ShortDate) & " <b>Próxima Alineacion: </b>" & FormatDateTime(CDate(Parameters!Fecha.Value).AddMonths(6), DateFormat.ShortDate) + HTML + + + + + + + + ="<b>Próxima Rotación y Balanceo: </b>" & FormatDateTime(CDate(Parameters!Fecha.Value).AddMonths(6), DateFormat.ShortDate) & " <b>Próxima Alineacion: </b>" & FormatDateTime(CDate(Parameters!Fecha.Value).AddMonths(6), DateFormat.ShortDate) + HTML + + @@ -726,7 +730,7 @@ @@ -753,6 +757,7 @@ + @@ -773,6 +778,7 @@ + @@ -797,7 +803,6 @@
-
@@ -861,6 +866,9 @@ +
+ +
@@ -879,7 +887,6 @@
-
@@ -941,6 +948,9 @@ +
+ +
@@ -998,7 +1008,6 @@
-
-
@@ -1096,9 +1104,8 @@
-
- Agregar + Guardar Actualizar
@@ -1227,12 +1234,13 @@
+
+ Actualizar + Guardar +
+ -
- Actualizar - Agregar -
@@ -1257,6 +1265,11 @@
+
+
+ Agregar +
+
-
-
- Agregar -
-
@@ -1395,12 +1403,13 @@ Descripción
+
+ Actualizar + Guardar +
+
-
- Actualizar - Agregar -
@@ -1429,7 +1438,7 @@
diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index c545620da..ff91f38ce 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -317,6 +317,15 @@ Partial Class Inventarios_RecepcionUsados ViewState("DtPorcentajeMarcas") = value End Set End Property + + Private Property TmpDTPolizaVirtual As DataTable + Get + Return If(IsNothing(ViewState("TmpDTPolizaVirtual")), Nothing, CType(ViewState("TmpDTPolizaVirtual"), DataTable)) + End Get + Set(value As DataTable) + ViewState("TmpDTPolizaVirtual") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -1125,57 +1134,76 @@ Partial Class Inventarios_RecepcionUsados Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G") If CveMovimiento <= 0 Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Else - FolioInv = ObjInventario.Folio.ToString() + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Else + FolioInv = ObjInventario.Folio.ToString() - For Each Dr As DataRow In DtMovimientos.Rows + For Each Dr As DataRow In DtMovimientos.Rows - If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal - Else - ImporteConcepto = Dr("PU").ToString.ToDecimal - End If + If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then + ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + Else + ImporteConcepto = Dr("PU").ToString.ToDecimal + End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - Mensaje = "Error al guardar los movimientos" + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Exit For + End If + + If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then + Mensaje = "Error al actualizar el recibo de los usados" + ErrorMovInv = True + Exit For + End If + + 'si es selectedvalue = 42, es entrada ,3 -salida + Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) + + If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + + If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then + Mensaje = "Error al guardar Movimientos de distribuidor" ErrorMovInv = True Exit For End If - If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then - Mensaje = "Error al actualizar el recibo de los usados" - ErrorMovInv = True - Exit For - End If + End If + Next - 'si es selectedvalue = 42, es entrada ,3 -salida - Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) + 'ACTUALIZA LA POLIZA VIRTUAL DEL LA REMISION + 'If Not ErrorMovInv AndAlso ObjFactura.TipoDocto = "Rem" Then + ' If ObjAcum.GetPolizasVirtuales(ObjFactura.CveVenta) Then + ' Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy() + ' For Each RowPoliza As DataRow In DtPoliza.Rows + ' If Not ObjAcum.UpdatePolizaVirtual(RowPoliza("CvePolizaVirtual").ToString().ToEntero, DdlMarcaRem.SelectedValue.ToEntero(), TxtFechaVigencia.Text.ToDateTime()) Then + ' Mensaje = "Error al guardar la póliza virtual" + ' ErrorMovInv = True + ' Exit For + ' End If + ' Next - If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + ' DtPoliza.Dispose() + ' Else + ' Mensaje = "Error al obtener la póliza virtual" + ' ErrorMovInv = True + ' End If + 'End If - If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then - Mensaje = "Error al guardar Movimientos de distribuidor" - ErrorMovInv = True - Exit For - End If - - End If - Next - - 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC - 'If Not ErrorMovInv Then - ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) - 'End If - - End If + 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC + 'If Not ErrorMovInv Then + ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) + 'End If End If + End If - If Not ErrorMovInv Then + + If Not ErrorMovInv Then If Resp IsNot Nothing Then For Each mensaje2 As String In Resp.Mensajes Msg.AppendFormat("
{0}", mensaje2) @@ -1473,6 +1501,13 @@ Partial Class Inventarios_RecepcionUsados GvM.DataSource = DtTemp GvM.DataBind() + 'If TmpDTPolizaVirtual IsNot Nothing AndAlso RblUsadosAjuste.SelectedValue = "2" Then + ' TmpDTPolizaVirtual.Clear() + ' For Each Row As DataRow In DtTemp.Rows + ' AddPolizaVirtual(Row("CvePS").ToString().ToEntero()) + ' Next + 'End If + EscondeColumnasGVM(DtTemp) End Sub Private Sub EscondeColumnasGVM(DtTemp As DataTable) @@ -2076,6 +2111,14 @@ Partial Class Inventarios_RecepcionUsados DdlClientes.SelectedValueExist(CveCliente) End If + If Me.ObjFactura IsNot Nothing Then + Me.ObjFactura.Dispose() + Me.ObjFactura = Nothing + End If + + Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas) + + 'SI ES DISTRIBUIDOR VAMOS A GENERAR LA REMISION DE NOTA DE CREDITO If EsDistribuidor Then DivCliente.Visible = True @@ -2087,13 +2130,6 @@ Partial Class Inventarios_RecepcionUsados Me.ObjRemisionNC = Nothing End If - If Me.ObjFactura IsNot Nothing Then - Me.ObjFactura.Dispose() - Me.ObjFactura = Nothing - End If - - Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas) - If Me.ObjFactura IsNot Nothing Then 'CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda) DivTotal.Visible = True @@ -2102,12 +2138,17 @@ Partial Class Inventarios_RecepcionUsados 'DivCliente.Visible = False 'DivFactura.Visible = False End If + If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then DtUsados = ObjVentas.DtResultados.Copy() End If + ObjVentas.Dispose() If DtUsados IsNot Nothing Then + + 'DivRecepcionApartado.Visible = True + For Each RowUsado As DataRow In DtUsados.Rows Dim CvePS = RowUsado("CvePS").ToString().ToEntero() @@ -2271,6 +2312,10 @@ Partial Class Inventarios_RecepcionUsados Me.ObjRemisionNC.PedidoContrato = "" Me.ObjRemisionNC.ObservacionesAlmacen = "" + 'If TmpDTPolizaVirtual IsNot Nothing Then + ' Me.ObjRemisionNC.DtPolizasVirtuales = TmpDTPolizaVirtual + 'End If + End Sub Private Function AddPSRNC(ByRef TmpDT As DataTable, Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, @@ -3087,6 +3132,10 @@ Partial Class Inventarios_RecepcionUsados ObjPS.Dispose() GuardaAjuste() + + 'If TmpDTPolizaVirtual Is Nothing Then + ' CreaDTmpDTPolizaVirtual() + 'End If End Sub Protected Sub CargarDescuento() @@ -3251,15 +3300,126 @@ Partial Class Inventarios_RecepcionUsados Using ObjMarcas As New ClsProductosServicios If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados + DdlMarcaRem.DataSource = ObjMarcas.DtResultados End If End Using + DdlMarcaPSAjuste.DataBind() + DdlMarcaRem.DataBind() DdlMarcaPSAjuste.Items.Insert(0, New ListItem("Todas", "-1")) + DdlMarcaRem.Items.Insert(0, New ListItem("Todas", "-1")) UpAjuste.Update() End Sub +#Region "P O L I Z A - V I R T U A L" + Private Sub CreaDTmpDTPolizaVirtual() + TmpDTPolizaVirtual = New DataTable + TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal)) + TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal)) + TmpDTPolizaVirtual.Columns.Add("Descuento", GetType(Decimal)) + TmpDTPolizaVirtual.Columns.Add("Total", GetType(Decimal)) + TmpDTPolizaVirtual.Columns.Add("CveVentaDetalle", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("TipoServicio", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("TipoPoliza", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("CveModeloAuto", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("AnioVehiculo", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("TieneUsado", GetType(Boolean)) + TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime)) + TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer)) + TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer)) + End Sub + Private Function AddPolizaVirtual(CvePS As Integer) As Boolean + + Dim Retorno As Boolean = True + + 'If Modalidad = "U" Then + ' If TmpDTPolizaVirtual.Rows.Count > 0 Then + ' Dim Elimino As Boolean = False + ' For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows + ' If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then + ' RowPoliza.Delete() + ' Elimino = True + ' Exit For + ' End If + ' Next + ' If Elimino Then + ' TmpDTRecepcionUsados.AcceptChanges() + ' End If + ' End If + 'End If + + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + + If DrPS IsNot Nothing Then + 'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR + If Not DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then + Return Retorno + End If + Else + Retorno = False + Return Retorno + End If + + Dim Cantidad As Decimal = 1 + Dim PU As Decimal = txtPrecio.Text.ToDecimal() + Dim Descuento As Decimal = 0 + Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2) + + Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2) + Dim TipoServicio As Integer = -1 + Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime()) + Dim CveModeloAuto As Integer = -1 + Dim AnioVehiculo As Integer = 0 + Dim TipoPoliza As Integer = 1 'VENTA + + If Total = ImporteAjuste Then + TipoPoliza = 3 'GARANTIA + Else + TipoPoliza = 2 'AJUSTE + End If + + 'Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0) + Dim CvePSUsado As Integer = -1 + Dim CveBCIUsado As Integer = -1 + + 'If TieneUsado Then + ' For Each GvRow As GridViewRow In GvRecepcionUsados.Rows + ' If GvRow.RowType = DataControlRowType.DataRow Then + ' If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then + ' CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero() + ' CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero() + + ' Exit For + ' End If + ' End If + ' Next + 'End If + + Dim Row As DataRow = TmpDTPolizaVirtual.NewRow() + Row("CvePS") = CvePS + Row("Cantidad") = Cantidad + Row("PU") = PU + Row("Descuento") = Descuento + Row("Total") = Total + Row("CveVentaDetalle") = -1 + Row("TipoServicio") = TipoServicio + Row("TipoPoliza") = TipoPoliza + Row("CveModeloAuto") = CveModeloAuto + Row("AnioVehiculo") = AnioVehiculo + Row("TieneUsado") = 1 + Row("FechaUsado") = FechaUsado + Row("CvePSUsado") = CvePSUsado + Row("CveBCIUsado") = CveBCIUsado + + TmpDTPolizaVirtual.Rows.Add(Row) + + Return Retorno + End Function +#End Region + Partial Class MFolioGarantiaMensaje Public Property CvePS As Integer From 6c63ccc2992a02501cbe6fd72430c434efd6a40b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Apr 2021 18:05:42 -0700 Subject: [PATCH 05/11] Correciones en Ventas --- App_Code/ClsVentas.vb | 12 +- Ventas/Ventas.aspx | 88 ++++++- Ventas/Ventas.aspx.vb | 566 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 574 insertions(+), 92 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 79a6ab882..a4549c442 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1268,17 +1268,19 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Double, PU As Double, IEPS As Double, PorcentajeIEPS As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean + Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasDetalleRemisionUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVenta .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@Cantidad", SqlDbType.Float).Value = Cantidad - .Add("@PU", SqlDbType.Float).Value = PU - .Add("@IEPS", SqlDbType.Float).Value = IEPS - .Add("@PorcentajeIEPS", SqlDbType.Float).Value = PorcentajeIEPS + .Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad + .Add("@PU", SqlDbType.Decimal).Value = PU + .Add("@IEPS", SqlDbType.Decimal).Value = IEPS + .Add("@PorcentajeIEPS", SqlDbType.Decimal).Value = PorcentajeIEPS + .Add("@IVA", SqlDbType.Decimal).Value = IVA + .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 81aaae32d..4d4ed9df2 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1427,7 +1427,7 @@ - <%-- --%> + <%-- --%> @@ -2723,7 +2723,7 @@
- +
@@ -7097,6 +7097,7 @@ + @@ -7111,6 +7112,7 @@ + @@ -7427,6 +7429,66 @@ TxtImporte.value = ""; } } + function CalculaSaldoRNCChkDetalle(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) { + //ImportesRNCCargo + let Importe = 0; + if (Chk.checked) { + let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value) + let ImportesAsignados = 0; + + $('.ImportesRNCDetalle').each(function () { + + if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) { + let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked'); + + if (seleccionado) { + let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val()); + let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val()); + let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val()); + + let totalcalculableImpuestos = (cantidad * precio); + let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2)); + + ImportesAsignados += totalcalculableImpuestos + iva; + } + } + + }); + + Importe = SaldoMaximoUtilizable - ImportesAsignados; + + if (Importe > 0) { + + } else { + if (SaldoMaximoUtilizable > 0) { + Importe = 0; + Chk.checked = false; + } else { + Importe = 0; + } + } + + } else { + Importe = 0; + } + + Importe = ToDouble(Importe.toFixed(2)); + + if (Importe > 0) { + let pu = (ImporteTotal / CantidadPendiente); + + if (pu > 0) { + TxtCantidad.value = (Importe / pu).toString(); + } + + + }else { + TxtCantidad.value = "0"; + } + + + } + function LimitaSaldoRNCChk(TxtImporte, Saldo) { //var Importe = 0; @@ -8716,21 +8778,21 @@ if (TotalRem == TotalNC) { document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #04B431"; - document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431"; - document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = ""; - document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = ""; + document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431"; + document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = ""; + document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = ""; - } else { - document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000"; - document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000"; - document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000"; - document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000"; + } else { + document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000"; + document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000"; + document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000"; + document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000"; + } } } - } - function CerrarModalRemNC() { - if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') { + function CerrarModalRemNC() { + if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') { AplicarValidarRNC(true); CompararNC(); } diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 82cf85254..ee3560509 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2907,6 +2907,15 @@ Partial Class Ventas End If MostrarOpcionesPaqueteria() + 'If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then + + 'If Not AjustarTotalCotizacionFacturada(ViewState("CveCotizacion").ToString().ToEntero(), TxtTotal.Text.ToDecimal) Then + ' BtnEmitirImprimir.Visible = True + ' Alert("Ocurrió un error al ajustar el importe", TipoMensaje.MsgError) + 'End If + + 'End If + 'UNA VEZ CARGADA LAS CONDICIONES DE PAGO INICIALMENTE, NO VUELVE A SOBREESCRIBIR EL VALOR CveFormaPago33Cliente = -1 End Sub @@ -7006,17 +7015,15 @@ Partial Class Ventas End If Else + Dim DrPS As DataRow = Nothing + + DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") + If Not ClienteDesglosaIEPS Then - Dim DrPS As DataRow = Nothing - - 'DrPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Estatus:=-1).FiltroPrimero("") - - DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") - PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 - DrPS = Nothing + End If Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) @@ -7039,7 +7046,11 @@ Partial Class Ventas End If End If - + If DrPS("IVA").ToString().Contiene("-1", "") Then + TmpDT.Rows(e.RowIndex)("PorcentajeIVA") = PorcentajeIVA + Else + TmpDT.Rows(e.RowIndex)("PorcentajeIVA") = DrPS("IVA") + End If TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() TmpDT.Rows(e.RowIndex)("UM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedItem.Text @@ -7073,6 +7084,8 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("CveSubProyecto") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue End If + DrPS = Nothing + GvPS.EditIndex = -1 GvPS.DataSource = TmpDT DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") @@ -9714,7 +9727,7 @@ Partial Class Ventas ObjFactura.SetSubProyectoMatriz(Me) ObjFactura.SetSubProyecto(Me) ObjFactura.ClienteSucursal = New Modelos.SucursalModel() - If Not CveEmpresaCRM > 0 Then + If CveCliente > 0 Then If Me.ClienteSucursal IsNot Nothing Then ObjFactura.ClienteSucursal.RFC = Me.ClienteSucursal.RFC ObjFactura.ClienteSucursal.Nombre = Me.ClienteSucursal.Nombre @@ -9815,7 +9828,7 @@ Partial Class Ventas End If - If Not CveEmpresaCRM > 0 Then ObjFactura.Timbre = PreParaTimbre(ObjFactura) + If CveCliente > 0 Then ObjFactura.Timbre = PreParaTimbre(ObjFactura) 'SI SE ESTA EDITANDO ACTUALIZA LOS IMPORTES DEL DT If GvImpuestosLocales2.Visible AndAlso GvImpuestosLocales2.Enabled Then @@ -16151,7 +16164,7 @@ Partial Class Ventas 'End If End Sub - Private Sub CargaFormatoSucursal() + Private Sub CargaFormatoSucursal(Optional RecalcularIVA As Boolean = True) Dim dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue))) If dr IsNot Nothing Then ViewState("SucCalle") = dr("Calle") @@ -16182,7 +16195,7 @@ Partial Class Ventas If CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then DdlIVA.Visible = True End If - If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA() + If RecalcularIVA AndAlso TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA() 'ViewState("SubProyectoPorcentajeIVA") = dr("IVA") ViewState("TipoFormato") = dr("TipoFormato") 'ViewState("Serie") = dr("Serie") @@ -16534,7 +16547,7 @@ Partial Class Ventas If TipoAplicacion = 2 Then Descuento = 0 SeAjustoPU = True - PUModificado = PUPromocion + PUModificado = Math.Round(PUPromocion / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6) Else Descuento = Descuento + PU - TotalPromocion End If @@ -17050,11 +17063,17 @@ Partial Class Ventas DrPoliza("CveTipoPS") = DrPSAdicional("CveTipoPS") DrPoliza("CveTipoInvPS") = DrPSAdicional("Inv_CveMetodoInventario") DrPoliza("NoIdentificacion") = DrPSAdicional("Codigo") + If Modalidad = "U" Then DrPoliza("Consec") = Index Else - DrPoliza("Consec") = TmpDT.Rows.Count + 1 + Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() + If ConsecutivoActual < 0 Then + ConsecutivoActual = 0 + End If + DrPoliza("Consec") = ConsecutivoActual + 1 End If + Row("Orden") = TmpDT.Rows.Count + 1 DrPoliza("Cantidad") = If(Dr("Cantidad").ToString().ToDecimal > 0, Dr("Cantidad").ToString().ToDecimal, Cantidad) PU = 0 @@ -17128,6 +17147,249 @@ Partial Class Ventas Return Retorno End Function + 'Private Function AgregarProductoServicioCotizacion(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, + ' PU As Decimal, Descuento As Decimal, PorcentajeIVA As Decimal, ImporteIVA As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "", + ' Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, + ' Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", + ' Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False, + ' Optional ImporteProntoPago As Decimal = 0) As Boolean + + ' Dim Retorno As Boolean = False + ' Try + ' If Not CvePS > 0 Then + ' Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError) + ' Return False + ' End If + + ' Dim Row As DataRow = Nothing + ' Dim TotalCalculableImpuestos As Decimal = 0 + ' PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos + ' Descuento = Descuento.RoundSQL(NumeroDecimales) + + ' If Not TmpDT.Columns.Contains("RetIVA") Then + ' TmpDT.Columns.Add("RetIVA", GetType(Decimal)) + ' End If + + ' Row = TmpDT.NewRow() + ' Row("CveProyecto") = CveProyecto + ' Row("Proyecto") = Proyecto + ' Row("CveSubProyecto") = CveSubProyecto + ' Row("SubProyecto") = SubProyecto + ' Row("Serie") = Serie + ' Row("TiempoEntrega") = TiempoEntrega + ' If Modalidad = "U" Then + ' Row("Orden") = Index + ' Else + ' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() + ' If ConsecutivoActual < 0 Then + ' ConsecutivoActual = 0 + ' End If + ' Row("Orden") = ConsecutivoActual + 1 + ' End If + + ' Row("Cantidad") = Cantidad + ' Row("CveUM") = CveUM + ' Row("UM") = UM + ' Row("CveClasificacion") = CveClasificacion + ' Row("Clasificacion") = Clasificacion + ' Row("CvePS") = CvePS + ' Row("Obs") = Obs + + + ' Dim DrPS As DataRow = Nothing + + ' DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 + + ' If DrPS Is Nothing Then + ' Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError) + ' Return False + ' End If + + ' If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then + ' 'VALIDA CLAVESAT + ' If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA + ' If DrPS("SATClavePS").ToString() = "" Then + ' MensajeCveSAT.AppendFormat("{0}-{1}: Sin producto SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString()) + ' Return False + ' ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then + ' MensajeCveSAT.AppendFormat("{0}-{1}: Sin Unidad Medida SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString()) + ' Return False + ' End If + + ' 'If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then + ' ' MensajeCveSAT.AppendFormat("{0}-{1}: El producto/servicio no existe en el catálogo del SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString()) + ' ' Return False + ' 'End If + ' End If + ' Else + ' If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then + ' MensajeCveSAT.AppendFormat("{0}-{1}: El producto/servicio no existe en el catálogo del SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString()) + ' Return False + ' End If + ' End If + + ' 'verifica si tiene ventaminima + ' If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then + ' 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... + ' If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then + ' Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString())) + ' Return False + ' End If + ' End If + + ' 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS + ' Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS)) + + ' If Not ClienteDesglosaIEPS Then + ' If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then + ' PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) + ' VentaDesglosaIEPS = True + ' End If + ' DrPS("IEPSPorcentaje") = 0 + ' End If + ' 'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA + ' If FacturaDesglosoIEPS Then + ' VentaDesglosaIEPS = True + ' End If + + + ' TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento + + ' Row("PU") = PU + ' Row("Codigo") = DrPS("Codigo") + ' Row("NoIdentificacion") = DrPS("Codigo") + ' Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") + ' Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") + ' Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") + ' Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") + ' If Modalidad = "U" Then + ' Row("Consec") = Index + ' Else + ' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() + ' If ConsecutivoActual < 0 Then + ' ConsecutivoActual = 0 + ' End If + ' Row("Consec") = ConsecutivoActual + 1 + ' End If + + ' Row("PS") = DrPS("PS") + ' Row("CodigoPS") = DrPS("PSCodigo").ToString() + ' Row("CveTipoPS") = DrPS("CveTipoPS") + ' Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") + ' Row("CveTamaño") = DrPS("CveTamaño") + + ' If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") + ' If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") + + ' Row("PorcentajeIVA") = PorcentajeIVA + + ' Dim ClienteRetIVA = Me.ClienteRetIVA + + ' If ClienteRetIVA <= 0 Then + ' If CBool(DrPS("EsOutSourcing").ToString()) Then + ' ClienteRetIVA = 0.06D + ' DdlTipoRetencion.SelectedValueExist("4") + ' ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + ' ClienteRetIVA = 0.106667D + ' ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + ' ClienteRetIVA = 0.04D + ' End If + ' End If + + ' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero + ' TrRetIVA.Style.Add("display", "") + ' DdlTipoRetencion.Visible = True + + + ' Row("IVA") = PorcentajeIVA + ' Row("ImporteIVA") = (ImporteIVA).RoundSQL(NumeroDecimales) + ' Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + + + + ' Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + + ' Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + ' Row("PorcentajeRetIVA") = ClienteRetIVA + ' Row("PorcentajeRetISR") = ClienteRetISR + ' Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") + ' Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + ' Row("IEPS") = Row("ImporteIEPS") + ' Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales) + ' Row("TipoDescuento") = HdnTipoDescuento.Value + ' Row("CvePromocionDetalle") = CvePromocionDetalle + ' Row("Total") = (Cantidad * PU) + ' Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + + ' 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") + ' ' Row("IdCtaContVentas") = IdCtaContable + ' ' Row("AplicaParaConcepto") = AplicaParaConcepto + + ' Row("SATClaveProdServ") = DrPS("SATClavePS") + ' Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") + + ' If UsuarioActual.Empresa.UsaAC Then + ' Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue + ' End If + + ' Row("EntregaDirecta") = EntregaDirecta + ' 'Contratos + ' Row("CveContratoDetalle") = CveContratoDetalle + ' Row("CveVentaDetalle") = CveVentaDetalle + ' Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido + ' Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle + ' Row("CveVentaDetalleRemision") = CveVentaDetalleRemision + ' Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion + ' Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 + ' Row("CuentaPredial") = CuentaPredial + ' Row("EsOutSourcing") = DrPS("EsOutSourcing") + ' Row("EsCargo") = EsCargo + + ' If ImporteProntoPago > 0 Then + ' Row("ImporteProntoPago") = ImporteProntoPago + ' Row("TieneProntoPago") = "Si" + ' 'SOLO DEBE MOSTRASE SI EL PAGO ES DE CONTADO + ' If RBLPago.SelectedValue = "2" Then + ' GvPS.Columns(22).Visible = True + ' thProntoPago.Visible = True + ' thProntoPago2.Visible = True + ' End If + + ' End If + + ' If UsuarioActual.CveEmpresa = 119 Then + ' If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA + + ' 'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO + ' If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then + ' If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then + ' Alert($"La moneda base del producto: {DrPS("PSCodigo").ToString()} es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia) + ' Return False + ' End If + ' End If + + ' 'ACTIVA PRODUCTOS DE LA MISMA MONEDA + ' If TmpDT.Rows.Count = 0 And CveVenta < 0 Then + ' DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString()) + ' CambiaMoneda() + ' DdlMoneda.Enabled = False + ' End If + ' End If + ' End If + + ' 'RECARGAR GV + ' TmpDT.Rows.Add(Row) + + ' Retorno = True + ' Catch ex As Exception + ' Retorno = False + ' OnError("Ocurrió un error al agregar el producto/servicio", ex) + ' End Try + + + ' Return Retorno + 'End Function + #End Region #Region "D A T A - T A B L E S" @@ -17718,6 +17980,9 @@ Partial Class Ventas If TbDescuentosRNC.Visible AndAlso ListaNCDesc IsNot Nothing Then TotalRemNCAplicado = ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado) + If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then + TotalRemNCAplicado += ListaNCBonificacion.Sum(Function(RNC) RNC.TotalRemNCAplicado) + End If End If Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales) @@ -19692,7 +19957,7 @@ Partial Class Ventas For Each Row As DataRow In TmpDT.Rows Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If @@ -19753,6 +20018,12 @@ Partial Class Ventas End If End If + If Not OcurrioError Then + If RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then + OcurrioError = True + End If + End If + If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then If ObjConta.ValorPolizaDescuadre > 0 Then If ObjConta.ValorPolizaDescuadre = 2 Then @@ -19762,12 +20033,6 @@ Partial Class Ventas End If End If - If Not OcurrioError Then - If RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then - OcurrioError = True - End If - End If - Catch ex As Exception OcurrioError = True OnError("Ocurrió un error al actualizar la remisión", ex) @@ -25054,6 +25319,23 @@ Partial Class Ventas e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") End If End Sub + + Protected Sub GvDescNCCargosDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargosDetalle.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then + e.Row.CssClass = "Totales" + e.Row.FCCheckBox("ChkAplicar").Visible = False + e.Row.FCTextBox("TxtCantidadRNC").Visible = False + Else + e.Row.CssClass = "ImportesRNCDetalle" + e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChkDetalle({e.Row.FCTextBox("TxtCantidadRNC").ClientID},{e.Row.DBCampo("CantidadPendiente").ToDouble},{e.Row.DBCampo("Total").ToDouble}, this);") + 'e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") + + End If + End If + End Sub + Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") @@ -25083,15 +25365,6 @@ Partial Class Ventas End If End If End Sub - Protected Sub GvDescNCCargosDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargosDetalle.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then - e.Row.CssClass = "Totales" - e.Row.FCCheckBox("ChkAplicar").Visible = False - e.Row.FCTextBox("TxtCantidadRNC").Visible = False - End If - End If - End Sub Protected Sub GvRemisionesNCBon_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBon.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -27034,65 +27307,145 @@ Partial Class Ventas Dim OcurrioError = False Dim MensajeError = "" + Try + 'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS + If DdlMoneda.SelectedValue.ToEntero() <> 2 AndAlso ChkConvertirDolares.Checked Then - 'ACTUALIZA VENTA - If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), LblDescuentos.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtIVA.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtIEPS.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtTotal.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), + For Each Row As DataRow In TmpDT.Rows + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Next + + Dim ImpuestosLocales As Double = 0 + For Each gvr As GridViewRow In GvImpuestosLocales2.Rows + If gvr.RowType = DataControlRowType.DataRow Then + gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero + ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + End If + Next + + TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero + LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero + LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero + TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero + TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero + TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero + TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero + TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero + + TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal + Moneda = 2 + End If + + + 'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES + If DdlMoneda.SelectedValue.ToEntero() <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then + Dim Importe As Decimal + Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal + For Each Row As DataRow In TmpDT.Rows + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal * TCC, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal * TCC, NumeroDecimales) + Importe = Row("Total").ToString().ToDecimal - Row("Descuento").ToString().ToDecimal + Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString().ToDecimal, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString().ToDecimal, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString().ToDecimal, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString().ToDecimal, NumeroDecimales) + Next + + Dim ImpuestosLocales As Double = 0 + For Each gvr As GridViewRow In GvImpuestosLocales2.Rows + If gvr.RowType = DataControlRowType.DataRow Then + gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero + ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) + End If + Next + + TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero + LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero + LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero + TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero + TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero + TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero + TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero + TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero + + + TipoCambio = 1 + Moneda = 1 + End If + + + 'ACTUALIZA VENTA + If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDouble(), LblDescuentos.Text.ToDouble(), TxtIVA.Text.ToDouble(), TxtIEPS.Text.ToDouble(), TxtTotal.Text.ToDouble(), Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim, UsuarioActual.CveEmpresa, CveVenta, 0, 0, Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1), PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDouble, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero()) Then - MensajeError = "Ocurrió un error al actualizar la información de la cotización" - OcurrioError = True - End If - - 'ELIMINA DETALLES - If Not ObjVentas.RemoveVentasDetalle(CveVenta) Then - MensajeError = "Ocurrió un error al actualizar las partidas de la cotización" - OcurrioError = True - End If - - 'RE-INSERTA DETALLES - For Each Row As DataRow In TmpDT.Rows - If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), - Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), - Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), - PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(), - PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDecimal) Then - MensajeError = "Ocurrió un error al guardar las partidas de la cotización" + MensajeError = "Ocurrió un error al actualizar la información de la cotización" OcurrioError = True - Exit For End If - Next - For Each gvr As GridViewRow In GvImpuestosLocales2.Rows - If gvr.RowType = DataControlRowType.DataRow Then - If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then - MensajeError = "Ocurrió un error al actualizar los impuestos locales" + 'ELIMINA DETALLES + If Not ObjVentas.RemoveVentasDetalle(CveVenta) Then + MensajeError = "Ocurrió un error al actualizar las partidas de la cotización" + OcurrioError = True + End If + + 'RE-INSERTA DETALLES + For Each Row As DataRow In TmpDT.Rows + If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), + Row("PU").ToString().ToDouble(), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble() * (1 + Row("PorcentajeIVA").ToString().ToDouble())), 6), + Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), + PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(), + PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDecimal) Then + MensajeError = "Ocurrió un error al guardar las partidas de la cotización" OcurrioError = True + Exit For + End If + Next + + For Each gvr As GridViewRow In GvImpuestosLocales2.Rows + If gvr.RowType = DataControlRowType.DataRow Then + If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then + MensajeError = "Ocurrió un error al actualizar los impuestos locales" + OcurrioError = True + End If + End If + Next + + 'ORDEN PRODUCCION + If UsuarioActual.CveEmpresa.Contiene(126) Then + If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then + If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then + MensajeError = "Ocurrió un error al actualizar la orden de producción" + OcurrioError = True + End If End If End If - Next - 'ORDEN PRODUCCION - If UsuarioActual.CveEmpresa.Contiene(126) Then - If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then - If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then - MensajeError = "Ocurrió un error al actualizar la orden de producción" - OcurrioError = True - End If - End If - End If + 'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then + ' If ObjConta.ValorPolizaDescuadre > 0 Then + ' If ObjConta.ValorPolizaDescuadre = 2 Then + ' OcurrioError = True + ' MensajeError = ObjConta.MensajePolizaDescuadre + ' End If + ' End If + 'End If + Catch ex As Exception + OcurrioError = True + OnError("Ocurrió un error al guardar la cotización", ex) + End Try - 'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then - ' If ObjConta.ValorPolizaDescuadre > 0 Then - ' If ObjConta.ValorPolizaDescuadre = 2 Then - ' OcurrioError = True - ' MensajeError = ObjConta.MensajePolizaDescuadre - ' End If - ' End If - 'End If If OcurrioError Then ObjVentas.RollBack() @@ -27322,6 +27675,61 @@ Partial Class Ventas UpPS.Update() UpParametros.Update() End Sub + + Private Function AjustarTotalCotizacionFacturada(CveCotizacion As Integer, TotalAjustar As Decimal) As Boolean + Dim ErrorAjuste As Boolean = False + + Dim ObjCotizacion As New Modelos.Factura(UsuarioActual, CveCotizacion, UsuarioActual.CveEmpresa) + + If ObjCotizacion.CveMoneda = 1 Then + Dim TotalNuevoDocumento As Decimal = TotalAjustar + + Dim Diferencia As Decimal = (ObjCotizacion.Total - TotalNuevoDocumento) + + If Diferencia <> 0 Then + 'AJUSTAR EN EL IVA + For Each RowNuevoDocumento As DataRow In TmpDT.Rows + Dim CveVentaDetalleCotizacion As Integer = RowNuevoDocumento("CveVentaDetalleCotizacion").ToString().ToEntero() + + Dim ImporteIVANuevoDocumento As Decimal = RowNuevoDocumento("ImporteIVA").ToString().ToDecimal() + Dim ImporteIEPSNuevoDocumento As Decimal = RowNuevoDocumento("ImporteIEPS").ToString().ToDecimal() + + If CveVentaDetalleCotizacion > 0 Then + 'AJUSTAR IVA + If ImporteIVANuevoDocumento > 0 Then + Dim ImporteIVACotizacion As Decimal = ObjCotizacion.DtDetalle.FiltroPrimeroValor("ImporteIVA", $"CveVentaDetalle={CveVentaDetalleCotizacion}").ToDecimal + + If ImporteIVANuevoDocumento <> ImporteIVACotizacion Then + RowNuevoDocumento("ImporteIVA") = ImporteIVACotizacion + End If + End If + + 'AJUSTAR IEPS + If ImporteIEPSNuevoDocumento > 0 Then + Dim ImporteIEPSCotizacion As Decimal = ObjCotizacion.DtDetalle.FiltroPrimeroValor("ImporteIEPS", $"CveVentaDetalle={CveVentaDetalleCotizacion}").ToDecimal + + If ImporteIEPSNuevoDocumento <> ImporteIEPSCotizacion Then + RowNuevoDocumento("ImporteIEPS") = ImporteIEPSCotizacion + End If + End If + + + End If + Next + End If + + CalculaTotalesVenta(RecalculaImpuestosLocales:=False) + + If Math.Abs(ObjCotizacion.Total - TotalAjustar) > 0 OrElse Math.Abs(TxtTotal.Text.ToDecimal - TotalAjustar) > 0 Then + ErrorAjuste = True + End If + + End If + ObjCotizacion.Dispose() + + Return Not ErrorAjuste + End Function + Private Class MVentaDetalleCotizacion Public Property CveVentaDetalle As Integer Public Property Cantidad As Decimal @@ -27455,6 +27863,11 @@ Partial Class Ventas tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal End If + 'AgregarProductoServicioCotizacion(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + ' Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, + ' Dr("PorcentajeIVA").ToString().ToDecimal, Dr("IVA").ToString().ToDecimal, + ' Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + ' CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=Dr("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True) AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), @@ -28722,6 +29135,11 @@ Partial Class Ventas Exit Sub End If + 'If Not AjustarTotalCotizacionFacturada(Me.CveVenta) Then + ' Alert("Ocurrió un error al ajustar el importe", TipoMensaje.MsgError) + ' Exit Sub + 'End If + End If 'CARGA LO PENDIENTE POR FACTURAR DE REMISION From 69d3f5380859ea1291536f1c3234fa07e52e1dfc Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Apr 2021 18:05:59 -0700 Subject: [PATCH 06/11] Mostrar datos de venta sin validar --- Bancos/PopIEVentas.aspx.vb | 131 ++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 68 deletions(-) diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 9b6ae3795..84d152fbc 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -718,79 +718,76 @@ Partial Class Bancos_PopIEVentas Validada = True End If - - If Validada Then - - CveCliente = dr("CveCliente").ToString.ToEntero - CveClienteOriginal = dr("CveCliente").ToString.ToEntero - HdnCveCliente.Value = CveCliente.ToString - CargaCliente(CveCliente, "-1") - CveMoneda = dr("CveMoneda").ToString.ToEntero - CveMonedaVenta = dr("CveMoneda").ToString.ToEntero - CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero - NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente)) - SerieFolio = dr("SerieFolio").ToString - TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal - CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero - - LblMetodoPAgo.Text = $"{dr("ClaveMetodoPagoSATStr").ToString() }" + CveCliente = dr("CveCliente").ToString.ToEntero + CveClienteOriginal = dr("CveCliente").ToString.ToEntero + HdnCveCliente.Value = CveCliente.ToString + CargaCliente(CveCliente, "-1") + CveMoneda = dr("CveMoneda").ToString.ToEntero + CveMonedaVenta = dr("CveMoneda").ToString.ToEntero + CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero + NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente)) + SerieFolio = dr("SerieFolio").ToString + TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal + CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero + + LblMetodoPAgo.Text = $"{dr("ClaveMetodoPagoSATStr").ToString() }" + + 'Configuración de Modalidad Update + + 'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ") + + If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then + If dr("TipoDocto").ToString = "Rem" Then + Alert("Los documentos de tipo Remisión no se permite realizar el pago", TipoMensaje.MsgAdvertencia) + BtnGuardar.Visible = False + End If + End If - 'Configuración de Modalidad Update + MovimientoPagar = New IEMovimiento + MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal + MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal + MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal + MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal + MovimientoPagar.Total = dr("Total").ToString.ToDecimal + MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal + MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal + MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal - 'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ") + LtlTitulo.Text = "Cuentas por Cobrar" + LtlTipo2.Text = "Folio de la Venta" + LtlTipo3.Text = "Fecha de la Venta" + LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}") + LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString() + LtlFolio.Text = dr("SerieFolio").ToString + + TxtFolio.Enabled = True + TxtFechaDocumento.Enabled = True + Calendario.Enabled = True + TxtPagueseA.Enabled = False + TxtImporte.Enabled = True + + DdlCuenta.Enabled = True + + DdlTipoTransaccion.Enabled = True + TxtObservaciones.Enabled = True + + RVImporte.Enabled = True + RVImporte.MaximumValue = dr("Saldo").ToString.ToDouble.ToString.FormatoNumero + TxtImporte.Text = dr("Saldo").ToString.ToDouble.FormatoNumero + + FechaVenta = dr("Fecha").ToString.ToDate + SaldoVenta = dr("Saldo").ToString.ToDouble - If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then - If dr("TipoDocto").ToString = "Rem" Then - Alert("Los documentos de tipo Remisión no se permite realizar el pago", TipoMensaje.MsgAdvertencia) - BtnGuardar.Visible = False - End If - End If + 'Cortes de Caja + If UsuarioActual.TienePermisoProceso(160) Then + CargaCorteCaja() + End If - - - MovimientoPagar = New IEMovimiento - MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal - MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal - MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal - MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal - MovimientoPagar.Total = dr("Total").ToString.ToDecimal - MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal - MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal - MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal - - LtlTitulo.Text = "Cuentas por Cobrar" - LtlTipo2.Text = "Folio de la Venta" - LtlTipo3.Text = "Fecha de la Venta" - LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}") - LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString() - LtlFolio.Text = dr("SerieFolio").ToString - - TxtFolio.Enabled = True - TxtFechaDocumento.Enabled = True - Calendario.Enabled = True - TxtPagueseA.Enabled = False - TxtImporte.Enabled = True - - DdlCuenta.Enabled = True - - DdlTipoTransaccion.Enabled = True - TxtObservaciones.Enabled = True - - RVImporte.Enabled = True - RVImporte.MaximumValue = dr("Saldo").ToString.ToDouble.ToString.FormatoNumero - TxtImporte.Text = dr("Saldo").ToString.ToDouble.FormatoNumero - - FechaVenta = dr("Fecha").ToString.ToDate - SaldoVenta = dr("Saldo").ToString.ToDouble - - - 'Cortes de Caja - If UsuarioActual.TienePermisoProceso(160) Then - CargaCorteCaja() - End If + If Not Validada Then + BtnGuardar.Visible = False End If @@ -1388,8 +1385,6 @@ Partial Class Bancos_PopIEVentas #Region "G U A R D A R" Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click - - Dim FechaFactura As Date = FechaVenta Dim FechaDocumentoPago As Date = TxtFechaDocumento.Text.ToDate From b382016c444256e0949eaf3a45e0a16335710b0b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Apr 2021 18:06:10 -0700 Subject: [PATCH 07/11] Mostra json de productos --- Ashx/E141.ashx | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index fca4a8b19..4d52b8b02 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -392,22 +392,37 @@ Public Class E141 : Implements IHttpHandler Select Case Metodo Case "CrearActualizarProductos" respuesta = CrearActualizarProductos(If(FiltrarTodos = "1", True, False)) + If respuesta Then + retorno = "True" + Else + retorno = "False" + End If + Case "CrearActualizarProductosJson" + retorno = CrearActualizarProductosJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarPrecios" respuesta = ActualizarPrecios(If(FiltrarTodos = "1", True, False)) + If respuesta Then + retorno = "True" + Else + retorno = "False" + End If Case "ActualizarExistencias" respuesta = ActualizarExistencias() + If respuesta Then + retorno = "True" + Else + retorno = "False" + End If Case "ActualizarVendedores" respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False)) + If respuesta Then + retorno = "True" + Else + retorno = "False" + End If End Select - If respuesta Then - retorno = "True" - Else - retorno = "False" - End If End If - - End If context.Response.Write(retorno) @@ -1962,6 +1977,25 @@ Public Class E141 : Implements IHttpHandler Return Retorno End Function + Private Function CrearActualizarProductosJson(Todos As Boolean) As String + Dim payload = New JObject() + + Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + payload.Add(New JProperty("products", GenerarPayloadProductos(DtPS))) + End If + + Return payload.ToString() + End Function Private Function GenerarPayloadProductos(DtPS As DataTable) As JArray Dim ArrayPS As New JArray For Each RowPS As DataRow In DtPS.Rows From 5c6f77e0a79d7f6f3295f72b796d93606e4aea42 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Apr 2021 18:06:25 -0700 Subject: [PATCH 08/11] Cambios en los reportes --- GPS/Rastreo.aspx.vb | 24 +++++++++++++++++------- Inventarios/TraspasoAlmacen.aspx.vb | 2 +- OC/OC.aspx.vb | 22 +++++++++++++++++++--- Ventas/ActualizarPrecios.aspx.vb | 21 ++++++++++++++++++++- Ventas/Clientes.aspx | 3 +++ Ventas/Clientes.aspx.vb | 2 +- Ventas/PV.aspx.vb | 2 +- vwd.webinfo | 6 ++++++ 8 files changed, 68 insertions(+), 14 deletions(-) diff --git a/GPS/Rastreo.aspx.vb b/GPS/Rastreo.aspx.vb index 9200f00dd..c6c79fd7c 100644 --- a/GPS/Rastreo.aspx.vb +++ b/GPS/Rastreo.aspx.vb @@ -2091,6 +2091,8 @@ Partial Class GPS_Rastreo DtDatos.Columns.Add("Evento", GetType(String)) DtDatos.Columns.Add("LatLng", GetType(String)) + Dim KMRecorridos = DtPosiciones.SUM("KMRecorridos").ToString + Try Dim Direcciones As JArray = ConsultarDirecciones(DtPosiciones) For Each row As DataRow In DtPosiciones.Rows @@ -2107,6 +2109,12 @@ Partial Class GPS_Rastreo For Each Dir As JObject In Direcciones DtDatos.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() Next + + + DtDatos.Columns("Vehiculo").ColumnName = "Vehículo" + DtDatos.Columns("TiempoDetenido").ColumnName = "Tiempo Detenido" + DtDatos.Columns("Direccion").ColumnName = "Dirección" + Catch ex As Exception GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) End Try @@ -2159,15 +2167,17 @@ Partial Class GPS_Rastreo If FechaI.Length > 0 And FechaF.Length > 0 Then - Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) - RangoFechas.Merged = True - RangoFechas.Value = $"Fechas: {FechaI} a {FechaF}" - RangoFechas.Style.Font.Size = 15 * 20 - RangoFechas.Style.Font.Name = "Calibri Light" - RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + End If + Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) + RangoFechas.Merged = True + RangoFechas.Value = $"Distancia: {KMRecorridos:N2} KM {If(FechaI.Length > 0 And FechaF.Length > 0, $"Fechas: {FechaI} a {FechaF}", "")}" + RangoFechas.Style.Font.Size = 15 * 20 + RangoFechas.Style.Font.Name = "Calibri Light" + RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 7027576d3..17e5e4a07 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -3071,7 +3071,7 @@ Partial Class Inventarios_TraspasoAlmacen ElseIf DrAlmO("CveTipoAlmacen").ToString.ToEntero = 22 Then 'Recepcion de Usados - DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen IN (22) AND Estatus = 'Activo'") + DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen IN (21,22) AND Estatus = 'Activo'") DdlAlmacenDestino.DataBind() DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) Else diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 78a0390c4..cfc7a3a4c 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -5351,13 +5351,29 @@ Partial Class OC Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal Dim PU As Decimal = Row("Importe").ToString.ToDecimal() + (Row("Importe").ToString.ToDecimal() * PorcentajeGanancia) - Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal - Dim ImporteIEPS As Decimal = ((Cantidad * PU) * IEPSPS).RoundSQL(2) - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, "", UsuarioActual.CveUsuario) Then + + Dim TotalCalculableImpuestos = (Cantidad * (PU)) + Dim TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) + + Dim PorcentajeIEPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + + Dim PorcentajeIVA As Decimal = 0D + + If DrPS("IVA").ToString().Contiene("-1", "") Then + PorcentajeIVA = Row("IVAPorcentaje") + Else + PorcentajeIVA = DrPS("IVA") + End If + + Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * PorcentajeIEPS).RoundSQL(2) + Dim ImporteIVA As Decimal = (TotalCalculableImpuestosIVA * PorcentajeIVA).RoundSQL(2) + + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, PorcentajeIEPS, ImporteIVA, PorcentajeIVA, "", UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If + Next Catch ex As Exception OcurrioError = True diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index 03e1642c5..b26f69ee9 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -316,7 +316,26 @@ Partial Class Ventas_ActualizarPrecios Exit Sub End If - DtExcel.TableName = DdlPrecioLista.SelectedItem.Text + + If DdlPrecioLista.SelectedItem IsNot Nothing Then + Dim worksheetName As String = DdlPrecioLista.SelectedItem.Text + + Const invalidCharsRegex As String = "[/\\*'?[\]:]+" + Const maxLength As Integer = 31 + Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim() + + If String.IsNullOrEmpty(safeName) Then + safeName = "Precios" ' cannot be empty + ElseIf safeName.Length > maxLength Then + safeName = safeName.Substring(0, maxLength) + End If + + DtExcel.TableName = safeName + Else + DtExcel.TableName = "Precios" + End If + + DtExcel.Columns("Codigo").ColumnName = "Código" DtExcel.Columns("PS").ColumnName = "Producto / Servicio" SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index faf56b64c..1cbd418f1 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -5037,6 +5037,9 @@
+ + + diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 2097ade7e..444381642 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1763,7 +1763,7 @@ Partial Class Clientes DivPortletSucursales.Visible = False DivPortletDireccionEnvio.Visible = False DivPortletAsignaciones.Visible = False - DivPortletBitacora.Visible = False + 'DivPortletBitacora.Visible = False BtnEliminar.Visible = False DivProtletRegistrar.Visible = True diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index e481299ef..d03fdcbe8 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -1867,7 +1867,7 @@ Partial Class PV For Each Row As DataRow In TmpDT.FiltraParametros("EliminarDB = False").Rows Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString.ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If diff --git a/vwd.webinfo b/vwd.webinfo index 67035e8a8..f85b08e11 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -214,6 +214,12 @@ + + + + + + From aeeb6babbd3d17ec7168612e33ca5697d61d4271 Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Thu, 22 Apr 2021 12:51:23 -0700 Subject: [PATCH 09/11] fACTURA AGROPECURIA --- Empresas/158/Formatos/Factura.rdlc | 6015 ++++++++++++++++++++++++++++ 1 file changed, 6015 insertions(+) create mode 100644 Empresas/158/Formatos/Factura.rdlc diff --git a/Empresas/158/Formatos/Factura.rdlc b/Empresas/158/Formatos/Factura.rdlc new file mode 100644 index 000000000..12ee27d56 --- /dev/null +++ b/Empresas/158/Formatos/Factura.rdlc @@ -0,0 +1,6015 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 06ae5329-8ff5-42b5-b7f4-6d68e5186420 + + + + System.Data.DataSet + /* Local Connection */ + + 3fde81d4-b9ca-4175-9160-5293ca8b9aa9 + + + + System.Data.DataSet + /* Local Connection */ + + c220a38d-e45b-4e04-917e-7dfd9cc3345f + + + + System.Data.DataSet + /* Local Connection */ + + c220a38d-e45b-4e04-917e-7dfd9cc3345f + + + + System.Data.DataSet + /* Local Connection */ + + c220a38d-e45b-4e04-917e-7dfd9cc3345f + + + + System.Data.DataSet + /* Local Connection */ + + c220a38d-e45b-4e04-917e-7dfd9cc3345f + + + + + + DsOC + /* Local Query */ + + + + ImporteIEPS + System.Decimal + + + ImporteIVA + System.Decimal + + + PorcentajeIEPS + System.Decimal + + + PorcentajeIVA + System.Decimal + + + Cantidad + System.Double + + + CveUnidadMedida + System.Int64 + + + Abreviatura + System.String + + + PS + System.String + + + CveClasificacion + System.Int64 + + + Clasificacion + System.String + + + CveActivoFijo + System.Int64 + + + Codigo + System.String + + + TipoDato + System.Int64 + + + CodigoAF + System.String + + + CodigoPS + System.String + + + UnidadMedida + System.String + + + Importe + System.Decimal + + + Total + System.Decimal + + + UM + System.String + + + Obs + System.String + + + SubProyecto + System.String + + + PU + System.String + + + Descuento + System.String + + + Marca + System.String + + + SATClaveProdServ + System.String + + + + DsOC + C:\Users\Orlando Bojorquez\Documents\Visual Studio 2013\WebSites\WebSite1\App_Code\DsOC.xsd + DtOCDetalle + + + + + + + + DataSet2 + /* Local Query */ + + + + ImpuestoLocal + System.String + + + Importe + System.Double + + + Nombre + System.String + + + ImporteT + System.String + + + Orden + System.String + + + + DataSet2 + C:\Users\jesus\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DataSet2.xsd + DataTable1 + + + + + + + + DsFirmas + /* Local Query */ + + + + Titulo + System.String + + + Nombre + System.String + + + Puesto + System.String + + + Lado + System.String + + + + DsFirmas + C:\Users\Jesus Murua\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DsFirmas.xsd + DataTable1 + + + + + + + + DsDesgloseImpuestos + /* Local Query */ + + + + Impuesto + System.String + + + tasa + System.String + + + Importe + System.String + + + Orden + System.String + + + + DsDesgloseImpuestos + C:\Users\Jesus Murua\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DsFirmas.xsd + DataTable1 + + + + + + + + DsDesgloseImpuestos + /* Local Query */ + + + + SerieFolio + System.String + + + Fecha + System.String + + + Importe + System.String + + + FolioFiscal + System.String + + + + DsDocumentosRelacionados + C:\Users\Jesus Murua\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DsFirmas.xsd + DataTable1 + + + + + + + + DsDesgloseImpuestos + /* Local Query */ + + + + SerieFolio + System.String + + + Fecha + System.String + + + SubTotal + System.String + + + Importe + System.String + + + Moneda + System.String + + + + DsNCVinculadas + C:\Users\Jesus Murua\Documents\Visual Studio 2015\WebSites\WebSite2\App_Code\DsFirmas.xsd + DataTable1 + + + + + + + + + + + + + + true + true + + + + + Serie: + + + + + + + + =Parameters!Serie.Value + + + + + + + + Folio: + + + + =Parameters!Folio.Value + + + + + + + Textbox81 + 0.36804in + 5.50529in + 0.18682in + 2.05349in + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Cliente: + + + + =Parameters!ClienteCodigo.Value + + + + - + + + + =Parameters!ClienteNombre.Value + + + + + + + + + Domicilio: + + + + =Parameters!ClienteDireccion.Value + + + + , + + + + =Parameters!ClienteCiudad.Value + + + + , + + + + =Parameters!ClienteEstado.Value + + + + + + + Textbox36 + 1.83775cm + 4.3204cm + 0.96667cm + 14.87889cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + 3.08165cm + 0.635cm + 0cm + 18.56429cm + 2 + + + + + + true + true + + + + + + + + + POR ESTE PAGARE ME(NO) OBLIGO(AMOS) INCONDICIONALMENTE A PAGAR A LA ORDEN DE + + + + AGROPECUARIA JAM, S.A. DE C.V. + + + + AL VENCIMIENTO ABAJO INDICADO. EN LA CIUDAD DE HERMOSILLO, SONORA O EN CUALQUIER OTRO LUGAR QUE SE ME REQUIERA DE PAGO, RENUNCIANDO EXPRESAMENTE AL FUERO DE MI DOMICILIO. LA CANTIDAD DE + + + + $ + + + + =Parameters!Total.Value + + + + + + + =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + + + + LA SUMA ANTERIOR SI NO FUERA CUBIERTA A SU VENCIMIENTO, CAUSARA INTERES MORATORIO A RAZON DEL + + + + 3.00% MENSUAL + + + + Y EN CASO DEL COBRO JUDICIAL SE CARGARAN LOS GASTOS QUE ESTOS GENEREN. + + + + + + + true + true + + + + + a + + + + =cdate(Parameters!Fecha.Value) + + + + + + + + + Vencimiento el + + + + =Parameters!Vencimiento.Value + + + + + + + Textbox38 + 8.17569cm + 3.93558cm + 1.07625cm + 5.19875cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 10.25697cm + 3.93558cm + 0cm + 5.19875cm + 5 + + + + + + true + true + + + + + S U S C R I P T O R + + + + + + + Textbox39 + 10.43336cm + 3.93558cm + 0.6cm + 5.19875cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + 10.25697cm + 11.9387cm + 0cm + 5.19875cm + 7 + + + + + + true + true + + + + + NOMBRE Y FIRMA DEL AVAL + + + + + + + Textbox39 + 10.43336cm + 11.9387cm + 0.6cm + 5.19875cm + 8 + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + logo + FitProportional + 0cm + 2.54331cm + 4.05375cm + 9 + + + + + + + Start + + true + 7.78895in + 0.18226in + 4.422in + 7.87128in + + =iif(Parameters!AplicaPagare.Value="0",True,False) + + + + + + + true + true + + + + + Facturado a: + + + + + + + + + Cliente: + + + + =Parameters!ClienteNombre.Value + + + + + + + + + RFC: + + + + =Parameters!ClienteRFC.Value + + + + + + + + + Calle: + + + + + + + + =Parameters!ClienteCalle.Value & IIF(Parameters!ClienteNoExt.Value <> "", " No.Ext: " & Parameters!ClienteNoExt.Value & iif(Parameters!ClienteNoInt.Value <> ""," No.Int: " & Parameters!ClienteNoInt.Value,""),iif(Parameters!ClienteNoInt.Value <> ""," No.Int: " & Parameters!ClienteNoInt.Value,"")) + + + + + + + + + Colonia: + + + + + + + + =Parameters!ClienteColonia.Value + + + + + + + + + Ciudad: + + + + =Parameters!ClienteCiudad.Value + + + + + + + + Estado: + + + + + + + + =Parameters!ClienteEstado.Value + + + + + + + + + Municipio y/o Delegación: + + + + =Parameters!ClienteMunicipio.Value + + + + + + + + + + + + + Pais: + + + + =Parameters!ClientePais.Value + + + + + + + + CP: + + + + + + + + =Parameters!ClienteCP.Value + + + + + + + + + Pedido/Contrato: + + + + =Parameters!PedidoContrato.Value + + + + + + + + + Orden Compra: + + + + =Parameters!OrdenCompra.Value + + + + + + + Textbox2 + 0.05159in + 4.31439cm + 1.62208in + 3.20861in + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + true + true + + + + + "Este documento es una representación impresa de un CFDI" + + + + + + + + + Folio fiscal: + + + + =Parameters!FolioFiscal.Value + + + + + + + =Parameters!FechaCertificacion.Value + + + + Número de serie del Certificado de Sello Digital: + + + + =Parameters!CertificadoContribuyente.Value + + + + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + + + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + External + =Parameters!QR.Value + FitProportional + 0.0444in + 6.56374in + 1.13974in + 1.53682in + 1 + + + + + + true + 3.57076in + 0.02339in + 1.21305in + 8.22763in + 2 + + + + + + true + true + + + + + Domicilio fiscal: + + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + TIPO DE DOCUMENTO: + + + + =Parameters!Tipo.Value + + + + + + + + + + + + + Serie: + + + + =Parameters!Serie.Value + + + + Folio: + + + + =Parameters!Folio.Value + + + + + + + + + Fecha: + + + + + + + + = Parameters!Fecha.Value + + + + + + + + + Moneda: + + + + + + + + =Parameters!MonedaAbreviatura.Value + + + + + + + + + + + + + =iif(Parameters!TipoCambio.Value <= 1, "", "Tipo Cambio: " & Parameters!TipoCambio.Value) + + + + + + + + + Forma de pago: + + + + =Parameters!FormaPago.Value + + + + + + + + + Método de pago: + + + + =Parameters!MetodoPago.Value + + + + + + + + + Uso CFDI: + + + + =Parameters!UsoCFDI.Value + + + + + + + + + Régimen fiscal: + + + + Regimen General de Ley Personas Morales + + + + + + + + + + + Textbox4 + 0.05022in + 4.90719in + 1.62345in + 3.35633in + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Expedido en + + + + : + + + + + + + + + =Parameters!DomicilioSucursal.Value + + + + + + + + + AJA850608L7A + + + + + + + + + + + + + + + + + + Vendedor: + + + + =Parameters!VendedorNombre.Value + + + + + + + Textbox40 + 4.25cm + 13.26812cm + 1.42163cm + 7.72123cm + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 0.54927in + + + 0.58129in + + + 0.8527in + + + 3.02234in + + + 0.57354in + + + 0.59047in + + + 0.61967in + + + 0.64182in + + + 0.79194in + + + + + 0.19645in + + + + + true + true + + + + + CANT + + + + + + + Textbox22 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + UNIDAD + + + + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + CLAVE SAT + + + + + + + Textbox29 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + DESCRIPCIÓN + + + + + + + Textbox17 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + PU + + + + + + + Textbox3 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + DESC. + + + + + + + Textbox8 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + IVA + + + + + + + Textbox2 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + IEPS + + + + + + + Textbox4 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + TOTAL + + + + + + + Textbox1 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.14436in + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!UM.Value + + + + + + + UM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SATClaveProdServ.Value + + + + + + + SATClaveProdServ + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PS.Value & " " & Fields!Obs.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PU.Value + + + + + + + PU + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =iif(cdbl(Fields!ImporteIVA.Value) > 0, Fields!ImporteIVA.Value & "(" & cdbl(Fields!PorcentajeIVA.Value) * 100 & "%)","") + + + + + + + ImporteIVA + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =iif(cdbl(Fields!PorcentajeIEPS.Value) > 0, Fields!ImporteIEPS.Value & "(" & Round(cdbl(Fields!PorcentajeIEPS.Value) * 100,0) & "%)","") + + + + + + + ImporteIEPS + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Cantidad.Value * Fields!PU.Value + + + + + + + TiempoEntrega + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsOC + 2.25503in + 0.04048in + 0.34081in + 8.22304in + 6 + + + + + + true + true + + + + + + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + + Textbox5 + 7.54968cm + 15.05252cm + 0.14316cm + 5.93682cm + 8 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =UCase(Parameters!ImporteLetra.Value) + + + + + + + ImporteLetra + 3.07034in + 2.02374in + 0.18861in + 6.23978in + 9 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.99824cm + + + + + 0.48004cm + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + =Fields!ImpuestoLocal.Value + + + + 2.93858cm + + + true + true + + + + + =IIF(Fields!ImpuestoLocal.Value = "Total",UCase(Fields!ImpuestoLocal.Value),Fields!ImpuestoLocal.Value) + + + + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + DataSet1 + 6.99203cm + 15.05252cm + 0.48004cm + 5.93682cm + 13 + + + + + + + + true + true + + + + + CFDI Relacionados + + + + + + + Textbox5 + 0.14926cm + 0.07193cm + 0.54004cm + 20.7077cm + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo Relación: + + + + + + + Textbox29 + 0.83025cm + 4.78817cm + 0.41981cm + 5.31841cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoRelacionTexto.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.42456cm + + + 2.05585cm + + + 3.03631cm + + + 7.7847cm + + + + + 0.44125cm + + + + + true + true + + + + + Folio + + + + + + + Textbox10 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Fecha + + + + + + + Textbox12 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox21 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Folio Fiscal + + + + + + + Textbox11 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!SerieFolio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Fecha.Value + + + + + + + Fecha + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!FolioFiscal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSet4 + 1.39643cm + 3.28643cm + 0.85604cm + 15.30142cm + 3 + + + + + + true + true + + + + + VERSION 3.3 + + + + + + + Textbox5 + 2.32303cm + 17.39754cm + 0.6cm + 3.32021cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + 14.85441cm + 0.10282cm + 2.97096cm + 20.89818cm + 14 + + =Microsoft.VisualBasic.Interaction.IIF(First(Fields!SerieFolio.Value, "DataSet4") <> "", False, True) + + + + + + + true + true + + + + + "REVISAR SU FACTURA Y SUS PRODUCTOS AL MOMENTO DE RECIBIRLAS, YA QUE NO SE REALIZARAN CAMBIOS EN FACTURA NI SE ACEPTARAN DEVOLUCIONES DE MERCANCIA DESPUES DE + + + + + + + + + 72 HORAS + + + + POSTERIORES A LA FECHA DE ELABORACIÓN" + + + + + + + Textbox1 + 8.5629cm + 0.10282cm + 0.34219cm + 20.85477cm + 15 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 1.83852cm + + + 1.21168cm + + + 1.69623cm + + + + + 0.44125cm + + + + + true + true + + + + + IMPUESTO + + + + + + + Textbox10 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + TASA + + + + + + + Textbox12 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + IMPORTE + + + + + + + Textbox21 + + + #008204 + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!Impuesto.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!tasa.Value + + + + + + + tasa + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe2 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSet3 + 7.0273cm + 0.10282cm + 0.85604cm + 4.74643cm + 16 + + =IIf(Fields!Importe.Value = 0, True,False) + + + + + + + true + true + + + + + Nombre Comercial: + + + + + + + + + Beneficiario: + + + + + + + + + + + + + Banco: + + + + + + + + + + + + + Clabe: + + + + + + + + + Cuenta: + + + + + + + + + + + Textbox1 + 12.64506cm + 0.10282cm + 2.03296cm + 3.74249cm + 17 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + AGROPECUARIA JAM SA DE CV + + + + + + + + + AGROPECUARIA JAM SA DE CV + + + + + + + + + BBVA BANCOMER, MONEDA NACIONAL + + + + + + + + + 012760004508391082 + + + + + + + + + 0450839108 + + + + + + + Textbox1 + 12.64506cm + 3.84531cm + 2.03295cm + 5.75197cm + 18 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre Comercial: + + + + + + + + + Beneficiario: + + + + + + + + + + + + + Banco: + + + + + + + + + + + + + Clabe: + + + + + + + + + Cuenta: + + + + + + + + + + + Textbox1 + 12.64506cm + 9.70311cm + 2.03295cm + 4.17266cm + 19 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + AGROPECUARIA JAM SA DE CV + + + + + + + + + AGROPECUARIA JAM SA DE CV + + + + + + + + + BBVA BANCOMER, MONEDA DOLARES + + + + + + + + + 012760004508391163 + + + + + + + + + 0450839116 + + + + + + + Textbox1 + 12.64506cm + 13.87577cm + 2.03294cm + 6.94061cm + 20 + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + logo + FitProportional + 0.12756cm + 0.08425cm + 2.54331cm + 4.05375cm + 21 + + + + + + 31.01581cm + + + + + 21.12144cm + + + 0.63499cm + true + true + + + true + true + + + + + Fecha Impresión: + + + + =Parameters!FechaImpresion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox35 + 0.11289cm + 18.37079cm + 0.41981cm + 2.5cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 27.94cm + 21.59cm + 0cm + 0cm + 0.5cm + 0.5cm + 1.27cm +