diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index 531702304..5c4f6f4bc 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -241,10 +241,10 @@ - -
+ +
@@ -311,7 +311,7 @@ <%--5--%> - Días
Vencidos
+ Días
Vencidos
@@ -332,13 +332,13 @@
<%--8--%> - Monto
Compra
+ Monto
Venta
 
<%--9--%> - +   @@ -352,7 +352,7 @@ <%--11--%> - + Saldo   @@ -362,7 +362,7 @@ Abonar - + @@ -388,82 +388,80 @@ - - - <%--16--%> + <%--16--%> - Col. 1 - + + - <%--17--%> - - Col. 2 + + <%--17--%> + - + <%--18--%> - Col. 3 - + <%--19--%> - Col. 4 - + <%--20--%> - Col. 5 - + <%--21--%> - Col. 6 - + <%--22--%> - Col. 7 - + <%--23--%> - - Total
Liquidación
+ - + + + + <%--24--%> + + + + + + <%--25--%> + + + - <%--24--%> - + <%--26--%> + Auxiliar - - <%--25--%> - - CveVenta - - - - - <%--26--%> + + + <%--27--%> - Complemento
Pago
+ Comp
Pago
diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 4ed6c3790..c83c43171 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -292,8 +292,25 @@ Partial Class Ventas_ClientesAbonar RVTxtFechaDocumento.MaximumValue = Now.ToString("dd/MM/yyyy") - If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then + + 'Dim CveClasificacionCol1 As Integer = 21514 + 'Dim CveClasificacionCol2 As Integer = 21916 + 'Dim CveClasificacionCol3 As Integer = 21520 + 'Dim CveClasificacionCol4 As Integer = 21519 + 'Dim CveClasificacionCol5 As Integer = 21547 + 'Dim CveClasificacionCol6 As Integer = 21572 + 'Dim CveClasificacionCol7 As Integer = 21571 + + GvCxC.Columns(17).HeaderText = "Comisión
Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10) + GvCxC.Columns(18).HeaderText = "Gastos
Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(19).HeaderText = "Servicio
Inspección" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol3).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(20).HeaderText = "Seguro" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol4).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(21).HeaderText = "Aduana
Mex" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol5).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(23).HeaderText = "Aduana
USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + 'GvCxC.Columns(24).HeaderText = "Material
Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + DvLiquidacion1.Visible = True DvLiquidacion2.Visible = True End If @@ -393,10 +410,12 @@ Partial Class Ventas_ClientesAbonar SumDescuentoProntoPago = TmpCxCAux.SUM("DescuentoProntoPago") GvCxC.DataSource = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio") - GvCxC.DataBind() + CveMoneda = pCveMoneda End If + Mov.Dispose() + GvCxC.DataBind() TxtImporte.Text = "" TxtObservaciones.Text = "" @@ -407,7 +426,6 @@ Partial Class Ventas_ClientesAbonar End If End If - Mov.Dispose() UPVentas.Update() End Sub @@ -507,25 +525,24 @@ Partial Class Ventas_ClientesAbonar If e.Row.RowType = DataControlRowType.DataRow Then Dim moneda As Integer = 0 If e.Row.RowIndex = 0 Then - e.Row.Cells(0).ColumnSpan = 5 - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(1).Visible = False - e.Row.Cells(2).Visible = False - e.Row.Cells(3).Visible = False - e.Row.Cells(4).Visible = False + ' e.Row.Cells(0).ColumnSpan = 5 + ' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right + ' e.Row.Cells(1).Visible = False + ' e.Row.Cells(2).Visible = False + ' e.Row.Cells(3).Visible = False + ' e.Row.Cells(4).Visible = False + e.Row.BackColor = Drawing.Color.LightGray - - e.Row.FCTextBox("TxtLiquidacionCol1").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol2").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol3").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol4").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol5").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol6").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol7").Visible = False - e.Row.FCTextBox("TxtLiquidacionCol8").Visible = False - - + e.Row.FCDropDownList("DdlTG").Visible = False + e.Row.FCTextBox("TxtLiqCol1").Visible = False + e.Row.FCTextBox("TxtLiqCol2").Visible = False + e.Row.FCTextBox("TxtLiqCol3").Visible = False + e.Row.FCTextBox("TxtLiqCol4").Visible = False + e.Row.FCTextBox("TxtLiqCol5").Visible = False + e.Row.FCTextBox("TxtLiqCol6").Visible = False + e.Row.FCTextBox("TxtLiqCol7").Visible = False + e.Row.FCTextBox("TxtLiqCol8").Visible = False End If If e.Row.RowIndex = 1 Then @@ -541,10 +558,6 @@ Partial Class Ventas_ClientesAbonar e.Row.Cells(11).Width = Unit.Pixel(60) End If - ' e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right - ' e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right - ' e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right e.Row.Cells(10).HorizontalAlign = HorizontalAlign.Right @@ -601,27 +614,31 @@ Partial Class Ventas_ClientesAbonar e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{5}); FnCambia({2},this,{1},0,{3},{4}); FnEditarImporte({2}, {0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda, e.Row.DBCampo("CveVenta"))) End If - e.Row.FCTextBox("TxtLiquidacionCol1").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol2").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol3").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol4").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol5").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol6").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol7").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") - e.Row.FCTextBox("TxtLiquidacionCol8").Attributes.Add("class", $"ClsSelLiquidacionVentaTotal{e.Row.DBCampo("CveVenta").ToEntero}") + If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then '' si es empresa agrícola - e.Row.FCTextBox("TxtLiquidacionCol1").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol2").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol3").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol4").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol5").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol6").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") - e.Row.FCTextBox("TxtLiquidacionCol7").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCDropDownList("DdlTG").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlTG").DataBind() + e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("class", $"ClsSelLiquidacion ClsSelLiquidacionVenta{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiquidacionVentaTotal{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol2").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol3").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol4").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiquidacion(this,{e.Row.DBCampo("CveVenta").ToString},{CveMonedaFiltro},{ moneda})") + End If Else @@ -713,7 +730,7 @@ Partial Class Ventas_ClientesAbonar End If 'valida que no exceda lo seleccionado. con el valor del ie - If (RblTipoPago.SelectedValue = "3" AndAlso HdnIngresoImporte.value.todecimal < txttotal.text.todecimal) Then + If (RblTipoPago.SelectedValue = "3" AndAlso HdnIngresoImporte.Value.ToDecimal < TxtTotal.Text.ToDecimal) Then Alert("Importe excedido para la aplicación", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -951,7 +968,7 @@ Partial Class Ventas_ClientesAbonar IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria) If ImporteMovimiento <> 0 Then importeMX = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -960,8 +977,8 @@ Partial Class Ventas_ClientesAbonar End If If EsAnticipoEspecial Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Referencia, 2, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Referencia, 95, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Referencia, 2, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Referencia, 95, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then MsgError = "No se pudo insertar la póliza" End If Else @@ -1311,8 +1328,6 @@ Partial Class Ventas_ClientesAbonar tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - - If CveMonedaVenta = 1 And CveMoneda <> 1 Then 'factura pesos, pago en dolares tImporteVenta = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL @@ -1356,77 +1371,12 @@ Partial Class Ventas_ClientesAbonar ImporteMovimiento = Math.Abs(Diferencia) importeMX = ImporteMovimiento - 'Dim Diferencia As Decimal = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioVentaValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta - 'Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - 'Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - 'Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - 'Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - 'Diferencia = Math.Round(Diferencia, 2) - '' se considera, las diferencias, y no el tipo de cambio, por el caso de las fluctuaciones - - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - 'If Diferencia < 0 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = Math.Abs(Diferencia) - ' importeMX = ImporteMovimiento - 'End If - - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - 'If tipoCambioPago > tipoCambioVentaDiferenciaCambiaria AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If CveSubProyectoContabilizar = CveSubProyecto Else ImporteMovimiento = 0 End If - 'Case 65 'Perdida - ' If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then - ' IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - ' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - ' tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - ' Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - - ' Dim Diferencia As Decimal = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioVentaValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta - ' Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - ' Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - ' Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - ' Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - ' Diferencia = Math.Round(Diferencia, 2) - ' 'si la diferencia es negativa es pérdida, si es positiva es ganancia - ' If Diferencia > 0 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = Math.Abs(Diferencia) - ' importeMX = ImporteMovimiento - ' End If - - ' '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - ' 'If tipoCambioPago < tipoCambioVentaDiferenciaCambiaria AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioVentaDiferenciaCambiaria) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta - ' ' ImporteMovimiento -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - ' ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ' ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - ' ' ImporteMovimiento -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - ' ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' ' importeMX = ImporteMovimiento - ' ' 'ElseIf tipoCambioPago > tipoCambioVenta AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ' ' ' ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - (Math.Abs(Math.Round(gvr.FCTextBox("TxtAbonar").Text.ToDecimal / tipoCambioPago, 2)) * tipoCambioPago) - ' ' ' 'ImporteMovimiento -= Math.Abs(Math.Round(((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta))) 'Añadimos la diferencia de ganancia en el IVA - ' ' ' 'ImporteMovimiento += Math.Abs(Math.Round(((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta))) 'Añadimos la diferencia de ganancia en el RetIVA - ' ' ' 'ImporteMovimiento += Math.Abs(Math.Round(((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta))) 'Añadimos la diferencia de ganancia en el RetISR - ' ' ' 'ImporteMovimiento -= Math.Abs(Math.Round(((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta))) 'Añadimos la diferencia de ganancia en el IEPS - ' ' ' ImporteMovimiento = ImporteMovimiento - ' ' ' importeMX = ImporteMovimiento - ' 'End If - ' CveSubProyectoContabilizar = CveSubProyecto - ' Else - ' ImporteMovimiento = 0 - ' End If Case 78 'Otros Ingresos If ChkAjusteOI.Checked Then @@ -1465,42 +1415,7 @@ Partial Class Ventas_ClientesAbonar If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" End If - 'Case 92 - ' If RblTipoPago.SelectedValue = "3" Then ' cuando es ingreso por comprobar - ' ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ' importeMX = Math.Round(ImporteMovimiento * tipoCambioPago, 2) - ' CveSubProyectoContabilizar = CveSubProyecto - ' If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" - - ' 'si la factura es en dólares y trae complementaria, el importemn debe ser igual al importe - ' If gvr.DataKey("CveMoneda").ToEntero <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then - ' importeMX = ImporteMovimiento - ' IdCtaContable = IdCtaContMonedaExtranjera - ' Else - ' IdCtaContable = IdCuentaCliente - ' CveCuenta = CveCuentaCliente - ' End If - - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE:=DdlIngreso.SelectedValue.ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteMX:=importeMX, CveSubProyecto:=CveSubProyectoContabilizar) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - - ' If gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' IdCtaContable = IdCtaContComplementaria - ' CveCuenta = CveCuentaComplementaria - ' If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 227, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE:=DdlIngreso.SelectedValue.ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteMX:=ImporteMovimiento * tipoCambioPago - ImporteMovimiento, , ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioPago) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - ' importeMX = ImporteMovimiento - ' IdCtaContable = IdCtaContMonedaExtranjera - ' CveCuenta = CveCuentaMonedaExtranjera - ' End If - ' End If - - ' End If - ' ImporteMovimiento = 0 Case 134 'Pago Intermediario If RblTipoPago.SelectedValue = "2" Then ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal @@ -1509,7 +1424,7 @@ Partial Class Ventas_ClientesAbonar If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ConceptoMovimiento, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero, ImporteMX:=importeMX) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ConceptoMovimiento, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero, ImporteMX:=importeMX) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -1520,6 +1435,10 @@ Partial Class Ventas_ClientesAbonar ImporteMovimiento = 0 End Select + If MsgError <> "" Then + Exit For + End If + If ImporteMovimiento <> 0 AndAlso MsgError = "" Then 'Conta ContPAQ If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then @@ -1527,7 +1446,7 @@ Partial Class Ventas_ClientesAbonar idCuentaContabilizacion = 0 End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" Exit For End If @@ -1536,91 +1455,96 @@ Partial Class Ventas_ClientesAbonar Next + If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola - Dim ImporteLiquidacion1 As Decimal = gvr.FCTextBox("TxtLiquidacionCol1").Text.ToDecimal - Dim ImporteLiquidacion2 As Decimal = gvr.FCTextBox("TxtLiquidacionCol2").Text.ToDecimal - Dim ImporteLiquidacion3 As Decimal = gvr.FCTextBox("TxtLiquidacionCol3").Text.ToDecimal - Dim ImporteLiquidacion4 As Decimal = gvr.FCTextBox("TxtLiquidacionCol4").Text.ToDecimal - Dim ImporteLiquidacion5 As Decimal = gvr.FCTextBox("TxtLiquidacionCol5").Text.ToDecimal - Dim ImporteLiquidacion6 As Decimal = gvr.FCTextBox("TxtLiquidacionCol6").Text.ToDecimal - Dim ImporteLiquidacion7 As Decimal = gvr.FCTextBox("TxtLiquidacionCol7").Text.ToDecimal + Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal + Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal + Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal + Dim ImporteLiq4 As Decimal = gvr.FCTextBox("TxtLiqCol4").Text.ToDecimal + Dim ImporteLiq5 As Decimal = gvr.FCTextBox("TxtLiqCol5").Text.ToDecimal + Dim ImporteLiq6 As Decimal = gvr.FCTextBox("TxtLiqCol6").Text.ToDecimal + Dim ImporteLiq7 As Decimal = gvr.FCTextBox("TxtLiqCol7").Text.ToDecimal + Dim ImporteLiq8 As Decimal = gvr.FCTextBox("TxtLiqCol8").Text.ToDecimal - Dim CveClasificacionCol1 As Integer = 21267 - Dim CveClasificacionCol2 As Integer = 21229 - Dim CveClasificacionCol3 As Integer = 21520 - Dim CveClasificacionCol4 As Integer = 21519 - Dim CveClasificacionCol5 As Integer = 21547 - Dim CveClasificacionCol6 As Integer = 21572 - Dim CveClasificacionCol7 As Integer = 21571 + Dim CveClasificacionCol1 As Integer = 21514 'comisiones sobre venta + Dim CveClasificacionCol2 As Integer = 21916 ' manejo + Dim CveClasificacionCol3 As Integer = 21917 'servicios de inspección + Dim CveClasificacionCol4 As Integer = 21918 ' seguro liquidación + Dim CveClasificacionCol5 As Integer = 21561 ' gastos aduanales mex + Dim CveClasificacionCol6 As Integer = 21920 ' diveros + Dim CveClasificacionCol7 As Integer = 21919 'gastos aduanales usa + Dim CveClasificacionCol8 As Integer = 21211 'material Empaque - Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero + Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero + Dim CveConceptoLiquidacion As Integer = 51 + Dim ConceptoPartida As String = gvr.DataKey("SerieFolio") & " " & gvr.FCDropDownList("DdlTG").SelectedItem.Text - Dim CveConceptoLiquidacion As Integer = 51 - - If ImporteLiquidacion1 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion1, "Liquidacion Col 1", CveConceptoLiquidacion, "Liquidacion Col 1", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion1 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq1 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq1, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq1 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiq1, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - If ImporteLiquidacion2 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion2, "Liquidacion Col 2", CveConceptoLiquidacion, "Liquidacion Col 2", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion2 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq2 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq2, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq2 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiq2, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - If ImporteLiquidacion3 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion3, "Liquidacion Col 4", CveConceptoLiquidacion, "Liquidacion Col 3", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion3 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq3 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq3, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq3 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiq3, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - - If ImporteLiquidacion4 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion4, "Liquidacion Col 4", CveConceptoLiquidacion, "Liquidacion Col 4", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion4 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq4 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq4, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq4 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiq4, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - - - If ImporteLiquidacion5 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion5, "Liquidacion Col 5", CveConceptoLiquidacion, "Liquidacion Col 5", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion5 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq5 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq5, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq5 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiq5, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - If ImporteLiquidacion6 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion6, "Liquidacion Col 6", CveConceptoLiquidacion, "Liquidacion Col 6", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion6 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq6 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq6, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq6 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiq6, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If - End If - If ImporteLiquidacion7 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiquidacion7, "Liquidacion Col 7", CveConceptoLiquidacion, "Liquidacion Col 7", Now, -1, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiquidacion7 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiquidacion1, 0)) Then - MsgError = "No se pudo insertar la póliza" - Exit For + If ImporteLiq7 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq7, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq7 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiq7, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If End If + + 'If ImporteLiq8 <> 0 Then + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + ' MsgError = "No se pudo insertar la póliza" + ' Exit For + ' End If + 'End If + End If + If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then + ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() + ListaFacturasGenerarNC.Add(ObjFactura) End If - - - - End If - If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then - ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() - ListaFacturasGenerarNC.Add(ObjFactura) End If End If Next - If RblTipoPago.SelectedValue = "1" Then + If RblTipoPago.SelectedValue = "1" AndAlso MsgError = "" Then CveSubProyectoContabilizar = CveSubProyectoMaximo @@ -1639,17 +1563,7 @@ Partial Class Ventas_ClientesAbonar If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 204, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancariaComplementaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If - 'Else - ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - ' tipoCambioPago = TxtTCDolares.Text.ToDecimal - ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - ' End If - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, ObjIE.Folio, 30, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - 'End If Else If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES tipoCambioPago = TxtTCDolares.Text.ToDecimal @@ -1663,7 +1577,7 @@ Partial Class Ventas_ClientesAbonar End If End If - If RblTipoPago.SelectedValue = "3" Then + If RblTipoPago.SelectedValue = "3" AndAlso MsgError = "" Then If CveMonedaPago = 2 Then 'rmf faltan las cuentas If IdCtaContMonedaComplementariaAnticipo > 0 Then @@ -1739,7 +1653,7 @@ Partial Class Ventas_ClientesAbonar MsgError = "No se insertó el encabezado" End If - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso MsgError = "" Then If MsgError = "" Then If ListaFacturasGenerarNC.Count > 0 Then For Each Fac As Modelos.Factura In ListaFacturasGenerarNC @@ -1888,10 +1802,12 @@ Partial Class Ventas_ClientesAbonar If ObjConta IsNot Nothing Then ObjConta.Dispose() ObjEvento.Dispose() - LimpiaCampos() - UPVentas.Update() + If MsgError = "" Then + LimpiaCampos() + End If + End Sub #Region " N O T A - D E - C R E D I T O" @@ -3267,7 +3183,13 @@ Partial Class Ventas_ClientesAbonar If ChkLiquidacion.Checked Then - '16-23 + + GvCxC.Columns(4).Visible = False + GvCxC.Columns(5).Visible = False + GvCxC.Columns(6).Visible = False + GvCxC.Columns(7).Visible = False + + '16-24 GvCxC.Columns(16).Visible = True GvCxC.Columns(17).Visible = True GvCxC.Columns(18).Visible = True @@ -3276,10 +3198,18 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(21).Visible = True GvCxC.Columns(22).Visible = True GvCxC.Columns(23).Visible = True + GvCxC.Columns(24).Visible = True + 'GvCxC.Columns(25).Visible = True GvCxC.Columns(26).Visible = False + GvCxC.Columns(27).Visible = False Else + GvCxC.Columns(4).Visible = True + GvCxC.Columns(5).Visible = True + GvCxC.Columns(6).Visible = True + GvCxC.Columns(7).Visible = True + GvCxC.Columns(16).Visible = False GvCxC.Columns(17).Visible = False GvCxC.Columns(18).Visible = False @@ -3288,8 +3218,11 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(21).Visible = False GvCxC.Columns(22).Visible = False GvCxC.Columns(23).Visible = False + GvCxC.Columns(24).Visible = False + GvCxC.Columns(25).Visible = False GvCxC.Columns(26).Visible = True + GvCxC.Columns(27).Visible = True End If