This commit is contained in:
2020-02-06 20:00:45 -07:00
30 changed files with 2776 additions and 2081 deletions

View File

@@ -9197,12 +9197,17 @@ Partial Class Clientes
AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero,
DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA)
Dim Folio As Integer = 0
Dim Folio As Integer = -1
Dim Serie As String = ""
If FolioNotaCredito(Tipo) Then
Folio = FolioNotaAcumulador
Serie = SerieNotaAcumulador
'If FolioNotaCredito(Tipo) Then
' Folio = FolioNotaAcumulador
' Serie = SerieNotaAcumulador
'End If
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
ObjFactura = Nothing
End If
ObjFactura = New Modelos.Factura(UsuarioActual)

View File

@@ -346,7 +346,7 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Generar NC" Visible="false" >
<ItemTemplate>
<asp:CheckBox ID="ChkGenerarNC" CssClass="chkgv" runat="server" Visible="false"></asp:CheckBox>
<asp:CheckBox ID="ChkGenerarNC" CssClass="chkgv" runat="server" Visible="false" Enabled="false"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="300px">
@@ -501,7 +501,7 @@
var Ventas = '';
function FnSuma(t, txt, importe) {
debugger;
var chkPesosBancos = $get("ChkPagarPesos");
var chkDolaresBancos = $get("ChkPagarDolares");
@@ -526,7 +526,7 @@
}
function SumaValores(pagoMultiple, monedaPago) {
debugger;
var Importe = 0;
var Comision = 0.00;
var topLevelElem = document.getElementById("form1");
@@ -614,8 +614,6 @@
}
function FnCambia(chk, txt, saldo, op, pagoMultiple, monedaPago) {
debugger;
if (op == 1) {
if (txt.value != '') {
chk.checked = true;
@@ -650,9 +648,20 @@
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN';
}
}
function FnSeleccionaNC(chk, chkNC)
{
if (chk.checked) {
chkNC.disabled = false;
chkNC.click();
} else {
chkNC.disabled = true;
if (chkNC.checked) {
chkNC.click();
}
}
}
function FnLimites(chk, txt, limiteInferior, limiteSuperior) {
debugger;
if (ToDouble(txt.value) < limiteInferior) {
txt.value = limiteInferior;
alert("El Importe no debe de exceder a el saldo");
@@ -674,11 +683,8 @@
}
function CambiaPesosDolares() {
debugger;
$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);
$('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2))
debugger;
if ($("#LbImporteME").length) {
$get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' USD';
$get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTC').value), 2);
@@ -691,12 +697,12 @@
}
function CambiaDolaresPesos() {
debugger;
$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);
$('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2))
debugger;
if ($("#LbImporteMN").length) {
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' MXN';
$get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTCDolares').value), 2);
@@ -743,7 +749,7 @@
for (var i = 0; i < textBoxes.length; i++) {
if (textBoxes[i].type == "checkbox") {
debugger;
if (textBoxes[i].id == "ChkAll") {
check = !textBoxes[i].checked;

View File

@@ -615,9 +615,12 @@ Partial Class Ventas_ClientesAbonar
End Select
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda))
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID))
Else
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda))
End If
If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then
If e.Row.DBCampo("TipoDocto") = "Rem" Then
e.Row.FCCheckBox("Chk").Visible = False ' que no se pueda pagar si es remisión
@@ -1585,11 +1588,13 @@ Partial Class Ventas_ClientesAbonar
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If MsgError = "" Then
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC)
If Resp.CveVenta > 0 Then
NCGeneradas.Add(Resp)
Else
MsgError = "No se pudo generar la nota de credito"
If ListaFacturasGenerarNC.Count > 0 Then
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC)
If Resp.CveVenta > 0 Then
NCGeneradas.Add(Resp)
Else
MsgError = "No se pudo generar la nota de credito"
End If
End If
End If
End If
@@ -1911,7 +1916,7 @@ Partial Class Ventas_ClientesAbonar
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
ObjFacturaDevolucion.GenerarPDFFactura = True
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Trasac:=Trasac, ObjContPaqTransac:=ObjConta)
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=Trasac, ObjContPaqTransac:=ObjConta)
Return Resp
End Function

View File

@@ -2333,7 +2333,6 @@
<div id="DivNumeroCPCliente" runat="server" visible="false" class="row" style="padding-left: 16px;">
<div class="form-group form-md-line-input input-iconright col-xs-4">
<asp:TextBox ID="TxtCPCliente" CssClass="form-control " runat="server" MaxLength="5" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="TxtCPCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Código Postal''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator>
<label for="<%= TxtCPCliente.ClientID.ToString()%>">Código Postal:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-4">
@@ -2354,7 +2353,6 @@
</div>
<div class="form-group form-md-line-input input-iconright col-xs-6">
<asp:TextBox ID="TxtTelefonoCliente" CssClass="form-control " runat="server" MaxLength="10" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTelefonoCliente" runat="server" ControlToValidate="TxtTelefonoCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Teléfono''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator>
<label for="<%= TxtTelefonoCliente.ClientID.ToString()%>">Teléfono:</label>
</div>
</div>
@@ -2385,8 +2383,6 @@
<div id="DivCorreoCuentaCliente" runat="server" visible="false" class="row" style="padding-left: 16px;">
<div class="form-group form-md-line-input input-iconright col-xs-6">
<asp:TextBox ID="TxtCorreoCliente" CssClass="form-control" runat="server" MaxLength="300" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" CssClass="help-block errorimput" ValidationExpression="(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)(\s*;\s*|\s*$))*" ControlToValidate="TxtCorreoCliente" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Email''</b> no es válido, por favor ingrése uno correcto." ValidationGroup="GrpGuardarCliente"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TxtCorreoCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Correo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator>
<label for="<%= TxtCorreoCliente.ClientID.ToString()%>">Email: </label>
<i></i>
</div>

View File

@@ -5323,7 +5323,7 @@ Partial Class PV
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
'cuando no está registrada, no da ajuste

View File

@@ -117,6 +117,7 @@
<asp:BoundField HeaderText="Utilidad" DataField="Utilidad" DataFormatString="{0:N2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />--%>
<asp:BoundField HeaderText="Comisión $" DataField="ComisionGanancia" DataFormatString="{0:###,###,##0.00}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Importe Cobrado" DataField="Cobrado" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Comisión Cobrada $" DataField="ComisionCobrada" DataFormatString="{0:###,###,##0.00}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Pendiente x Cobrar" DataField="Pendiente" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total al Dia" DataField="PendienteXDia" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
</Columns>
@@ -191,11 +192,12 @@
<div class="modal-body">
<asp:UpdatePanel ID="UpPorcentajeComisiones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<%-- <div class="row">
<label class="col-md-2 truncate">Vendedor:</label>
<div class="col-md-5">
<asp:DropDownList ID="DdlVendedorPorcentaje" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DdlVendedorPorcentaje_SelectedIndexChanged" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
<asp:DropDownList ID="DdlVendedorPorcentaje" AutoPostBack="true" AppendDataBoundItems="true" runat="server" OnSelectedIndexChanged="DdlVendedorPorcentaje_SelectedIndexChanged" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Todos" Value="-2"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVPorcentajeVendedor" runat="server" ControlToValidate="DdlVendedorPorcentaje" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Vendedor''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpPorcentajeComision"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPorcentajeVendedor" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeVendedor" Width="350px"></ajax:ValidatorCalloutExtender>
@@ -208,11 +210,11 @@
<asp:RequiredFieldValidator ID="RFVPorcentajeComision" runat="server" ControlToValidate="TxtPorcentajeComision" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Porcentaje''</b> es necesario. Por favor seleccione uno." InitialValue="" ValidationGroup="GrpPorcentajeComision"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPorcentajeComision" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeComision" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>--%>
<div class="row">
<label class="col-md-2 truncate">Mes:</label>
<div class="col-md-5">
<asp:DropDownList ID="DdlMes" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlMes_SelectedIndexChanged" CssClass="select2me" Width="100%">
<asp:DropDownList ID="DdlMes" runat="server" CssClass="select2me" Width="100%">
<asp:ListItem Text="Enero" Value="1"></asp:ListItem>
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>

View File

@@ -24,8 +24,8 @@ Partial Class Ventas_RepComisiones
Private Sub InicializaValores()
txtFechaI.Text = FirstDayOfMonth(Now).ToShortDateString
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
TxtAnio.Text = Now.Year.ToString()
DdlMes.SelectedValueExist(Now.Month)
@@ -35,8 +35,8 @@ Partial Class Ventas_RepComisiones
DdlVendedorAjuste.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedorAjuste.DataBind()
DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedorPorcentaje.DataBind()
'DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
'DdlVendedorPorcentaje.DataBind()
End Sub
@@ -205,65 +205,59 @@ Partial Class Ventas_RepComisiones
#End Region
Protected Sub BtnGuardarPorcentajeComision_Click(sender As Object, e As EventArgs)
Dim CveVendedor As Integer = DdlVendedorPorcentaje.SelectedValue.ToEntero()
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
Dim Anio As Integer = TxtAnio.Text.ToEntero()
Dim Porcentaje As Decimal = TxtPorcentajeComision.Text.ToDecimal() / 100
Dim RowCierre As DataRow = Nothing
Dim TieneError As Boolean = False
Dim ObjVentas As New ClsVentas
Try
If ObjVentas.GetCierreComisionVendedor(CveVendedor, Mes, Anio, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
RowCierre = ObjVentas.DtResultados.Rows(0)
End If
ObjVentas.IniciaTransacSQL()
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
Dim Anio As Integer = TxtAnio.Text.ToEntero()
If RowCierre IsNot Nothing Then
If ObjVentas.UpdateCierreComisionVendedor(CveVendedor, Mes, Anio, Porcentaje) Then
Alert("El porcentaje de comisiones se guardo correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
For Each GvRow As GridViewRow In GvDatos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.DataKey("CveVendedor").ToEntero() > 0 Then
Dim Porcentaje As Decimal = GvRow.DataKey("Comision").ToDecimal() / 100
If ObjVentas.GetCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
RowCierre = ObjVentas.DtResultados.Rows(0)
End If
Else
TieneError = True
End If
If RowCierre IsNot Nothing Then
TieneError = Not ObjVentas.UpdateCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, Porcentaje)
Else
TieneError = Not ObjVentas.AddCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, Porcentaje)
End If
If TieneError Then
Exit For
End If
End If
RowCierre = Nothing
End If
Else
If ObjVentas.AddCierreComisionVendedor(CveVendedor, Mes, Anio, Porcentaje) Then
Alert("El porcentaje de comisiones se guardo correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
End If
End If
Next
Catch ex As Exception
TieneError = True
OnError("Ocurrió un error al asginar el porcentaje de la comisión", ex)
End Try
ObjVentas.Dispose()
UpPorcentajeComisiones.Update()
End Sub
Protected Sub DdlVendedorPorcentaje_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaPorcentajeComisiones()
End Sub
Protected Sub DdlMes_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaPorcentajeComisiones()
End Sub
Protected Sub CargaPorcentajeComisiones()
Dim CveVendedor As Integer = DdlVendedorPorcentaje.SelectedValue.ToEntero()
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
Dim Anio As Integer = TxtAnio.Text.ToEntero()
Dim RowCierre As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetCierreComisionVendedor(CveVendedor, Mes, Anio, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
RowCierre = ObjVentas.DtResultados.Rows(0)
End If
ObjVentas.Dispose()
If RowCierre IsNot Nothing Then
TxtPorcentajeComision.Text = (RowCierre("PorcentajeComision").ToString().ToDecimal() * 100).FormatoNumero(0)
If TieneError Then
ObjVentas.RollBack()
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
Else
TxtPorcentajeComision.Text = "0"
ObjVentas.Commit()
Alert("El porcentaje de comisiones se guardó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjVentas.Dispose()
CargaDatos()
UPDatos.Update()
UpPorcentajeComisiones.Update()
End Sub
End Class

View File

@@ -126,6 +126,9 @@
<asp:HyperLink ID="HLGanancia" Target="_blank" Text='<%# Eval("ComisionGanancia", "{0:N2}") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Porcentaje Pagado %" DataField="PorcentajePagado" DataFormatString="{0:N2}%" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Comision Cobrada %" DataField="PorcentajeComision" DataFormatString="{0:N2}%" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Comision Cobrada" DataField="ComisionCobrada" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
<%--<asp:BoundField HeaderText="Comision Ganancia" DataField="ComisionGanancia" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />--%>
</Columns>
</asp:GridView>

View File

@@ -1304,7 +1304,7 @@
<ContentTemplate>
<div class="col-md-12">
<asp:GridView ID="GvCodigosUnicos" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False"
DataKeyNames="CvePolizaVirtual,SerieLote,IdProductoPolizaVirtual,Total,Descuento,AnioVehiculo,FechaUsado,IdModeloAuto,IdMarcaAuto,IdBCI,TipoServicio,TipoPoliza,TieneUsado" ClientIDMode="Static" EmptyDataText="" GridLines="None">
DataKeyNames="CvePolizaVirtual,SerieLote,IdProductoPolizaVirtual,Total,Descuento,AnioVehiculo,FechaUsado,IdModeloAuto,IdMarcaAuto,IdBCI,TipoServicio,TipoPoliza,TieneUsado,IdMarcaUsado" ClientIDMode="Static" EmptyDataText="" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Código Único">
<ItemTemplate>

View File

@@ -9217,9 +9217,13 @@ Partial Class Ventas
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev") Or DtVentasNC IsNot Nothing Then
If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVenta) Then
ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico")
End If
End If
End If
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas.CveVenta) Then
@@ -17025,7 +17029,19 @@ Partial Class Ventas
Dim total As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal
DtPagos = Nothing
InicializaCondicionesPago()
DtPagos = New DataTable
DtPagos.Columns.Add("CveTipoMovimiento", GetType(String))
DtPagos.Columns.Add("TipoMovimiento", GetType(String))
DtPagos.Columns.Add("CveCuenta", GetType(String))
DtPagos.Columns.Add("Cuenta", GetType(String))
DtPagos.Columns.Add("Folio", GetType(String))
DtPagos.Columns.Add("Importe", GetType(Decimal))
DtPagos.Columns.Add("Observaciones", GetType(String))
DtPagos.Columns.Add("Tipo", GetType(String))
DtPagos.Columns.Add("CveMetodoPago", GetType(Integer))
DtPagos.Columns.Add("MesesSinIntereses", GetType(Integer))
If total <= 0 Then Alert("No se ha ingresado importe", TipoMensaje.MsgAdvertencia) : Exit Sub
@@ -21164,7 +21180,7 @@ Partial Class Ventas
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal),
ImporteIVA = x.Sum(Function(s) Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString.ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString.ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
@@ -21302,6 +21318,7 @@ Partial Class Ventas
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = ""
Dim importePuTemp As Decimal = 0
For Each Dr As DataRow In DtImpuestosLocal.Rows
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr))).ToDecimal
@@ -21320,6 +21337,8 @@ Partial Class Ventas
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
If Math.Abs(difTmp) >= 0.01 Then
@@ -24074,7 +24093,7 @@ Partial Class Ventas
If obj.used_product Then
Dim FechaUsado As DateTime = Row.DataKey("FechaUsado").ToString().ToDateTime()
obj.used_brand = Row.DataKey("IdModelo").ToString().Trim() 'MARCAR DEL USADO
obj.used_brand = Row.DataKey("IdMarcaUsado").ToString().Trim() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString().Trim() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year