This commit is contained in:
2024-11-19 16:01:00 -07:00
19 changed files with 7048 additions and 5870 deletions

View File

@@ -6960,8 +6960,11 @@ Public Class ClsPaginas
End If
params.Add(New ReportParameter("CFDIVersion", Vta.Version))
If Vta.Cliente.CodigoRegimenFiscal.ToString.Length > 0 Then
params.Add(New ReportParameter("RegimenFiscalCodigo", $"{Vta.Cliente.CodigoRegimenFiscal}-{Vta.Cliente.RegimenFiscal}"))
If Vta.Cliente IsNot Nothing Then
If Vta.Cliente.CodigoRegimenFiscal.ToString.Length > 0 Then
params.Add(New ReportParameter("RegimenFiscalCodigo", $"{Vta.Cliente.CodigoRegimenFiscal}-{Vta.Cliente.RegimenFiscal}"))
End If
End If
'CLIENTE
@@ -9499,7 +9502,9 @@ Public Class ClsPaginas
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
@@ -9537,6 +9542,39 @@ Public Class ClsPaginas
End If
End If
If Pago.AplicaConceptoImpuestoPendiente Then
'si tiene iva y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
End If
'concepto pago
If Pago.TipoPago = "B" AndAlso Not ErrorMovtos AndAlso AplicarConceptoAplicacion Then ' B A N C O S
Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia)
@@ -9680,6 +9718,7 @@ Public Class ClsPaginas
Public Property CveClientePago As Integer = -1
Public Property ImporteFluctuacionAdicional As Decimal = 0
Public Property ValorMultiplicador As Decimal = 1
Public Property AplicaConceptoImpuestoPendiente As Boolean = False
End Class
Public Class Venta
@@ -10919,6 +10958,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/CatPSSubProyectosVendedores.aspx".ToUpper(), 787)
PaginaDict.Add("/Ventas/CatMotivosCancelacion.aspx".ToUpper(), 788)
PaginaDict.Add("/Ventas/CatSelectivas.aspx".ToUpper(), 897)
PaginaDict.Add("/Ventas/DashboardVentas.aspx".ToUpper(), 789)
#End Region
#Region "VIA"

View File

@@ -537,7 +537,21 @@ Public Class ClsProductosServicios
If Ex1.Message.Contains("Número: 2627;") Then
Alert("El Nuevo Producto o Servicio no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia)
ElseIf Ex1.Message.Contains("Número: 2601;") Then
Alert("El Nuevo Producto o Servicio tiene Codigo duplicado:" & Codigo, TipoMensaje.MsgAdvertencia)
If Ex1.Message.Contains("UK_ProductosServicios_Codigo_Empresa") Then
Alert("El Nuevo Producto o Servicio tiene Codigo duplicado:" & Codigo, TipoMensaje.MsgAdvertencia)
ElseIf Ex1.Message.Contains("UK_ProductosServicios_CveEmpresa_CodigoBarras") Then
Alert("El Nuevo Producto o Servicio tiene Codigo de barras duplicado:" & CodigoBarras, TipoMensaje.MsgAdvertencia)
ElseIf Ex1.Message.Contains("UK_ProductosServicios_CveEmpresa_NumeroParte") Then
Alert("El Nuevo Producto o Servicio tiene Numero de Parte duplicado:" & NumeroParte, TipoMensaje.MsgAdvertencia)
ElseIf Ex1.Message.Contains("UK_ProductosServicios_EmpresaNumeroParte") Then
Alert("El Nuevo Producto o Servicio tiene Numero de Parte duplicado:" & NumeroParte, TipoMensaje.MsgAdvertencia)
Else
Alert("El Nuevo Producto o Servicio tiene un valor duplicado(ND):" & NumeroParte, TipoMensaje.MsgAdvertencia)
End If
Else
Me.OnError("Ocurrió un error al guardar el nuevo Producto o Servicio.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If

View File

@@ -7464,6 +7464,26 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function GetDashboardVentasGet(CveEmpresa As Integer, CveSubProyecto As Integer, Agrupador As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_DashboardVentasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@Agrupador", SqlDbType.Int).Value = Agrupador
End With
Try
Dataset = New DataSet()
SqlAdapter.Fill(Dataset)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el dashboard de ventas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#Region "PRODUCTOS/SERVICIOS, SUBPROYECTOS Y VENDEDORES"
Public Function GetPSSubProyectosVendedores(CveEmpresa As Integer) As Boolean

View File

@@ -2886,6 +2886,13 @@ concep.DescripcionesEspecificas.NumeroSerie)
ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}\1\Certificados\EKU9003173C9.key"
ArchivoCertificado = $"{Extensiones.ModExtensiones.DirectorioEmpresas}\1\Certificados\EKU9003173C9.cer"
If Ventas.Timbre.Comprobante.TipoComprobante = "T" Then
Ventas.Timbre.Receptor.RFC = "EKU9003173C9"
Ventas.Timbre.Receptor.Nombre = "ESCUELA KEMPER URGATE"
Ventas.Timbre.Receptor.DomicilioFiscalReceptor = "42501"
Ventas.Timbre.Receptor.RegimenFiscalReceptor = "601"
End If
Clave = "12345678a"
TimbraProduccion = False
UsuarioServicio = "UserTest"
@@ -3124,6 +3131,13 @@ concep.DescripcionesEspecificas.NumeroSerie)
Clave = "12345678a"
TimbraProduccion = False
If Ventas.Timbre.Comprobante.TipoComprobante = "T" Then
Ventas.Timbre.Receptor.RFC = "EKU9003173C9"
Ventas.Timbre.Receptor.Nombre = "ESCUELA KEMPER URGATE"
Ventas.Timbre.Receptor.DomicilioFiscalReceptor = "42501"
Ventas.Timbre.Receptor.RegimenFiscalReceptor = "601"
End If
End If
#Region "Valida"

View File

@@ -395,6 +395,10 @@ Public Class Timbres
_MsgError.AppendLine("timbrado son detalle de productos")
End If
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
Timbre.Receptor.UsoCFDI = "CP01"
End If
End If
Else

View File

@@ -1305,9 +1305,11 @@
<asp:UpdatePanel ID="UpInv" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
<asp:GridView ID="GvInv" runat="server" DataKeyNames="Total,PU,Cantidad,CvePS,Descuento,UUIDRow" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no hay registros."
ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall mysmallbtn" Visible="false">
<Columns>
<%--0--%>
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
Aplica<br />
@@ -1318,6 +1320,7 @@
<asp:CheckBox ID="cbInv" runat="server" Checked="false" Enabled="false" AutoPostBack="true" OnCheckedChanged="CambiaTotalDevengar" />
</ItemTemplate>
</asp:TemplateField>
<%--1--%>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox ID="TbCantidad" runat="server" Width="50px" Mask="999,999.99" Text='<%# Eval("CantidadF", "{0:N2}")%>'></asp:TextBox>
@@ -1329,9 +1332,20 @@
</ItemTemplate>
<HeaderStyle CssClass="Titulos" />
</asp:TemplateField>
<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="5%" />
<%--2--%>
<asp:TemplateField>
<HeaderTemplate>
Unidad
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LtlUnidadMedida" runat="server" Text='<%# Eval("UM") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--3--%>
<asp:BoundField ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left" HeaderText=" Servicio" DataField="PS" />
<%--4--%>
<asp:BoundField ItemStyle-Width="7.5%" HeaderText="P.U." DataField="PU" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" />
<%--5--%>
<asp:TemplateField ItemStyle-Width="10%">
<ItemTemplate>
<asp:DropDownList ID="ddlEAlmacen" Enabled="false" runat="server" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="CambiaTotalDevengar"></asp:DropDownList>
@@ -1341,6 +1355,7 @@
<asp:DropDownList ID="ddlAlmacen" Enabled="True" runat="server" DataTextField="Almacen" OnSelectedIndexChanged="ddlAlmacen_SelectedIndexChanged" AppendDataBoundItems="true" AutoPostBack="true" CssClass="form-control input-sm select2me" DataValueField="CveAlmacen" Width="100%"></asp:DropDownList>
</HeaderTemplate>
</asp:TemplateField>
<%--6--%>
<asp:TemplateField ItemStyle-Width="10%" HeaderText="Recibir" Visible="false">
<ItemTemplate>
<asp:DropDownList ID="DdlRecibirInv" Enabled="false" runat="server" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="CambiaTotalDevengar" CssClass="form-control input-sm select2me">
@@ -1349,11 +1364,31 @@
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="10%">
<ItemTemplate>
<asp:ImageButton ID="btnImgDestino" runat="server" AlternateText="+" />
</ItemTemplate>
</asp:TemplateField>--%>
<%--7--%>
<asp:TemplateField HeaderText="Lote" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" Visible="false">
<ItemTemplate>
<asp:TextBox ID="TxtLote" CssClass="form-control input-sm" onblur="clickBtnInvActualizaLoteCaducidad();" runat="server" Visible="false" Text='<%# Eval("Lote") %>' Width="100px" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<%--8--%>
<asp:TemplateField HeaderText="Fecha Caducidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" Visible="false">
<ItemTemplate>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;" runat="server" visible="false" id="DvFechaCaducidad" >
<asp:TextBox ID="TxtCaducidad" Text='<%# Eval("FechaCaducidad") %>' CssClass="form-control input-sm ADSMaskDate" onblur="clickBtnInvActualizaLoteCaducidad();" Style="width: 87px" runat="server" ></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="LnkCaducidad" class="btn default" Visible="false" > <i class="fa fa-calendar"></i> </asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEECaducidad" runat="server" TargetControlID="TxtCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CECaducidad" TargetControlID="TxtCaducidad" PopupButtonID="LnkCaducidad" PopupPosition="TopLeft" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVCaducidad" runat="server" ControlToValidate="TxtCaducidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Caducidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCECaducidad" runat="server" HighlightCssClass="vco" TargetControlID="RFVCaducidad"></ajax:ValidatorCalloutExtender>
</div>
</ItemTemplate>
</asp:TemplateField>
<%--9--%>
<asp:TemplateField ItemStyle-Width="10%" Visible="false">
<HeaderTemplate>
Almacén Consignación<br />
@@ -1362,7 +1397,8 @@
<ItemTemplate>
<asp:DropDownList ID="ddlAlmacenConsignacion" Enabled="False" runat="server" Width="100px" DataTextField="Almacen" DataValueField="CveAlmacen" AutoPostBack="true" CssClass="form-control input-sm select2me" OnSelectedIndexChanged="ddlAlmacenConsignacion_SelectedIndexChanged"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<%--10--%>
<asp:TemplateField ItemStyle-Width="15%" HeaderText="Consignación" Visible="false">
<ItemTemplate>
<asp:DropDownList runat="server" ID="DdlVinculaConsignacion" Enabled="false" OnSelectedIndexChanged="DdlVinculaConsignacion_SelectedIndexChanged" CssClass="form-control input-sm select2me" AutoPostBack="true" DataTextField="Detalle" DataValueField="No" Width="280px"></asp:DropDownList>
@@ -1375,11 +1411,7 @@
<asp:HiddenField runat="server" ID="HdnCveAlmacen" Value="-1" />
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Nuevo Producto o servicio" Visible="false">
<ItemTemplate>
<asp:DropDownList runat="server" ID="Ddlnewps" DataTextField="PSCodigo" DataValueField="CvePS" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
@@ -1472,7 +1504,7 @@
</div>
<br />
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,PS,CveTipoPS" ShowFooter="true" GridLines="None" AutoGenerateColumns="false" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" CssClass="table table-striped table-hover Widthall">
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,PS,CveTipoPS,PUExtranjero" ShowFooter="true" GridLines="None" AutoGenerateColumns="false" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px">
<ItemTemplate>
@@ -5630,7 +5662,6 @@
<div id="DVModalConfirmaVinculacionProntoPago" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
@@ -5667,7 +5698,13 @@
<div style="display:none">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnInvActualizaLoteCaducidad" runat="server" OnClick="BtnInvActualizaLoteCaducidad_Click" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
@@ -5729,10 +5766,38 @@
$("#TabActivosFijos_tab .ajax__tab_inner").click(function () {
$('#BtnCargarGVAF').click();
});
//$(".monitorLote").on("input", function () {
// var currentValue = $(this).val();
// console.log("Texto cambiado: " + currentValue);
// $("#BtnInvActualizaLoteCaducidad").click();
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
// // Esto requiere un ScriptManager en tu página
// //__doPostBack('txtExample', currentValue);
//});
//$(".monitorCaducidad").on("input", function () {
// var currentValue = $(this).val();
// console.log("Texto cambiado: " + currentValue);
// $("#BtnInvActualizaLoteCaducidad").click();
// // Por ejemplo, puedes actualizar un Label usando un postback parcial (AJAX)
// // Esto requiere un ScriptManager en tu página
// //__doPostBack('txtExample', currentValue);
//});
});
}
function clickBtnInvActualizaLoteCaducidad() {
$("#BtnInvActualizaLoteCaducidad").click();
}
function ClickDeudorChk(Chk, Obj, total, saldo,txtOtrIngEgs) {
debugger;
total = parseFloat(parseFloat(total).toFixed(2));

View File

@@ -1906,6 +1906,21 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
AddPS2(False)
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
@@ -2308,6 +2323,7 @@ Partial Class Compras_Compras
GvPS.DataSource = TmpDT
GvPS.DataBind()
UpPS.Update()
CargaGvInv()
End If
End If
Else
@@ -2938,13 +2954,9 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveContrato", GetType(Integer))
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
If Not TmpDT.Columns.Contains("CveContratoDetalle") Then
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
End If
If Not TmpDT.Columns.Contains("CveCultivoCuadroDetalle") Then
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
End If
@@ -2956,7 +2968,19 @@ Partial Class Compras_Compras
If Not TmpDT.Columns.Contains("ImporteSinImpuestos") Then
TmpDT.Columns.Add("ImporteSinImpuestos", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
@@ -4287,6 +4311,12 @@ Partial Class Compras_Compras
Exit Sub
End If
If Not validaFechaNumeroReembolso() Then
Exit Sub
End If
Dim TotalRealDevolucion As Decimal = 0
Dim EstatusCredito As Integer = 0
@@ -5587,8 +5617,10 @@ Partial Class Compras_Compras
For Each dr As DataRow In DtInv.Rows
If dr("cvealmacen").ToString.ToEntero = tcvealmacen Then
'hay que restarle descuento
Dim Lote As String = dr("Lote").ToString
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
importeconcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, dr("pu").ToString.ToDecimal, dr("pu").ToString.ToDecimal * TipoCambioGuardar) - (If(DdlMoneda.SelectedValue.ToEntero = 1, dr("descuento").ToString.ToDecimal, dr("descuento").ToString.ToDecimal * TipoCambioGuardar) / dr("cantidad").ToString.ToDecimal)
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
@@ -5605,7 +5637,9 @@ Partial Class Compras_Compras
Else
If ObjInventario.GetMovimientosDetalle(cvemovimientoentrada, UsuarioActual.CveEmpresa) Then
For Each dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
Dim Lote As String = dr("Lote").ToString
Dim FechaCaducidad As Date = If(dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, dr("FechaCaducidad").ToString.ToDate)
If Not ObjInventario.AddMovimientoDetalle(cvemovimientosalidagasto, dr("cantidad").ToString.ToDecimal, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, 0, dr("cveaf").ToString.ToEntero, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
@@ -5698,12 +5732,22 @@ Partial Class Compras_Compras
tDescuento = Dr("Descuento").ToString.ToDecimal / CantidadInv
CostoIndirecto = Dr("CostoIndirectoAlmacen").ToString.ToDecimal
Dim Lote As String = Dr("Lote").ToString
Dim FechaCaducidad As Date = If(Dr("FechaCaducidad").ToString.ToDate <= MinFecha, MinFecha, Dr("FechaCaducidad").ToString.ToDate)
Dim AplicaLote As Boolean = Boolean.Parse(Dr("AplicaLote").ToString)
Dim AplicaCaducidad As Boolean = Boolean.Parse(Dr("AplicaCaducidad").ToString)
Dim CodigoPS As String = Dr("CodigoPS").ToString
If Dr("CveMetodoInventario").ToString.ToEntero = 5 Then
'SI FUE POR SERIE LOTE
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("CvePS = {0}", Dr("CvePS")))
If DtDetalle.Rows.Count > 0 Then
For Each drr As DataRow In DtDetalle.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=drr("Serie").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CostoIndirecto:=Dr("CostoIndirectoAlmacen").ToString.ToDecimal, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
Dim fechaDetalle As Date = drr("FechaCaducidad").ToString.ToDate
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=drr("Serie").ToString, FechaCaducidad:=drr("FechaCaducidad").ToString.ToDate, CostoIndirecto:=Dr("CostoIndirectoAlmacen").ToString.ToDecimal, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, Lote:=Lote) Then
ErrorMovInv = True
Exit For
End If
@@ -5730,10 +5774,26 @@ Partial Class Compras_Compras
'si no es por serie lote
ImporteConcepto = If(UsuarioActual.Empresa.UsaAC, ImporteConcepto * IVA, ImporteConcepto)
If Dr("CveAlmacen").ToString.ToEntero = tCveAlmacen Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
If AplicaLote And Lote.Trim = "" Then
ErrorMovInv = True
Alert($"Porducto {CodigoPS} requiere Lote.")
Exit For
End If
If AplicaCaducidad And FechaCaducidad = MinFecha And Lote.Trim = "" Then
ErrorMovInv = True
Alert($"Porducto {CodigoPS} requiere fecha de caducidad.")
Exit For
End If
If Not ErrorMovInv Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, CantidadInv, CveUnidad, Dr("CvePS").ToString.ToEntero, ImporteConcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, Dr("PU").ToString.ToDecimal), CostoIndirecto:=CostoIndirecto, CveCompraDetalle:=Dr("CveCompraDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
ErrorMovInv = True
Exit For
End If
End If
End If
End If
i = i + 1
@@ -6780,7 +6840,10 @@ Partial Class Compras_Compras
End If
End If
Else
Dim DiferenciaDevolucion As Decimal = importeMovimiento - TotalRealDevolucion
Dim DiferenciaDevolucion As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, (importeMovimiento * TxtTC.Text.ToDecimal), importeMovimiento) - TotalRealDevolucion
If TotalRealDevolucion <> 0 Then
If Math.Abs(DiferenciaDevolucion) > 0 Then
@@ -6794,7 +6857,7 @@ Partial Class Compras_Compras
ErrorPrepoliza = True
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion.RoundSQL(), (TotalRealDevolucion * tipoCambioActual).RoundSQL(), ConceptoContabilizacionNC, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteME:=If(tipoCambioActual = 1, 0, TotalRealDevolucion).RoundSQL(), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion.RoundSQL(), (TotalRealDevolucion).RoundSQL(), ConceptoContabilizacionNC, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteME:=If(tipoCambioActual = 1, 0, TotalRealDevolucion).RoundSQL(), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
Else
@@ -7724,7 +7787,7 @@ Partial Class Compras_Compras
If Not ErrorPrepoliza AndAlso Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=4, AutoConta:=AutoConta) Then
TieneError = True
If ObjConta.ValorPolizaDescuadre > 0 AndAlso UsuarioActual.CveRol = 1 Then
If ObjConta.ValorPolizaDescuadre > 0 Then
Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError)
ErrorPrepolizaDescuadre = True
End If
@@ -9373,14 +9436,87 @@ Partial Class Compras_Compras
End Sub
Private Function validaFechaNumeroReembolso() As Boolean
Private Function validaNumeroReembolso(transaccionSql As SqlTransaction) As Boolean
Dim respuesta As Boolean = True
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
Dim FechaCompra As Date = TxtFecha.Text.ToDate
If RblRembolso.SelectedValue.ToEntero = 1 Then
'IMPORATNTE DdlPersonalReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoPersonal
CvePersonalVal = DdlPersonalReembolso.SelectedValue.ToEntero
Else
'IMPORATNTE DdlCuentaCajaChicaReembolso ES EL CONTROL QUE USA AL MOMENTO DE REGISTRAR PARA EDITAR ES DdlRembolsoCajaChica
CveCajaChicaVal = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
End If
Dim objCompras As New ClsCompras()
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
Dim FechaReembolso As Date = objCompras.DtResultados.Rows(0)("Fecha").ToString.ToDate
Dim MesReembolsoInt As Integer = FechaReembolso.Month
Dim AnioReembolsoInt As Integer = FechaReembolso.Year
Dim mesAnterior As Integer
Dim AnioValidoInt As Integer
If MesReembolsoInt = 1 Then
mesAnterior = 12
AnioValidoInt = AnioReembolsoInt - 1
Else
mesAnterior = MesReembolsoInt - 1
AnioValidoInt = AnioReembolsoInt
End If
If MesReembolsoInt = FechaCompra.Month Or (FechaCompra.Month = mesAnterior AndAlso FechaCompra.Year = AnioValidoInt) Then
respuesta = True 'Correcto Fecha de compra dentro del mes del reembolso o mes anterior
Else
respuesta = False 'La fecha de la compra esta por fuera de lo permitido mes actual o mes anterior
If FechaCompra.Month > MesReembolsoInt Then
Alert($"La fecha de la compra que se quiere registrar esta adelantada al mes de la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
Else
Alert($"La fecha de la compra que se quiere registrar es anterior al mes permitido por la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia)
End If
End If
Else
respuesta = True ' No existe numero reembolso por lo que se considera Verdadero
End If
Else
respuesta = False ' al no poder consultar no se puede validar la fecha por lo que por default se considera como fecha no valida para el reembolso
End If
End If
objCompras.Dispose()
Return respuesta
End Function
Private Function validaNumeroReembolso(ByRef transaccionSql As SqlTransaction) As Boolean
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
If RblRembolso.SelectedValue.ToEntero = 1 Then
CvePersonalVal = DdlRembolsoPersonal.SelectedValue.ToEntero
Else
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
End If
Dim objCompras As New ClsCompras(transaccionSql)
Dim objConta As New ClsContabilidad(transaccionSql)
Dim tienePagoContabilizado As Boolean = False
Dim ErrorProceso As Boolean = False
@@ -9389,15 +9525,6 @@ Partial Class Compras_Compras
If TxtRembolsoNumero.Text.Trim.Length > 0 Then
Dim CvePersonalVal As Integer = -1
Dim CveCajaChicaVal As Integer = -1
If RblRembolso.SelectedValue.ToEntero = 1 Then
CvePersonalVal = DdlRembolsoPersonal.SelectedValue.ToEntero
Else
CveCajaChicaVal = DdlRembolsoCajaChica.SelectedValue.ToEntero
End If
If objCompras.GetComprobacion(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados.Rows.Count > 0 Then
@@ -9418,10 +9545,8 @@ Partial Class Compras_Compras
End If
End If
If NumeroReembolsoOriginal = "" And TxtRembolsoNumero.Text.Trim.Length > 0 Then
If objCompras.GetComprobacionPagosContabilizados(CvePersonalVal, CveCajaChicaVal, TxtRembolsoNumero.Text.Trim, UsuarioActual.CveEmpresa) Then
If objCompras.DtResultados IsNot Nothing AndAlso objCompras.DtResultados.Rows.Count > 0 Then
@@ -10667,6 +10792,11 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
TmpDT.Columns.Add("TemporadaCuadro", GetType(String))
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDT.Columns.Add("Lote", GetType(String))
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
TmpDTOriginal = New DataTable
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
@@ -10777,7 +10907,10 @@ Partial Class Compras_Compras
TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double))
TmpDTOriginal.Columns.Add("TemporadaCuadro", GetType(String))
TmpDTOriginal.Columns.Add("AplicaLote", GetType(Boolean))
TmpDTOriginal.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDTOriginal.Columns.Add("Lote", GetType(String))
TmpDTOriginal.Columns.Add("FechaCaducidad", GetType(Date))
End Sub
@@ -10951,6 +11084,18 @@ Partial Class Compras_Compras
#Region " ALMACEN "
Private Sub CargaGvInv()
If Not TmpDT.Columns.Contains("UUIDRow") Then
TmpDT.Columns.Add("UUIDRow", GetType(String))
End If
For Each dRow As DataRow In TmpDT.Rows
If dRow("UUIDRow").ToString.Trim = "" Then
dRow("UUIDRow") = Guid.NewGuid().ToString()
End If
Next
TmpDT.AcceptChanges()
'SI ES CONSIGNACION NO LIMITA POR TIPO PS - PARA GLUYAS
If ChkConsignacion.Checked Then
DtInv = TmpDT.Copy
@@ -10958,6 +11103,18 @@ Partial Class Compras_Compras
DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy
End If
For Each dRow As DataRow In DtInv.Rows
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
Dim AplicaLote As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
Dim AplicaCaducidad As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
GvInv.Columns(7).Visible = AplicaLote
GvInv.Columns(8).Visible = AplicaCaducidad
Next
GvInv.DataSource = DtInv
GvInv.DataBind()
@@ -10971,6 +11128,35 @@ Partial Class Compras_Compras
End Sub
Protected Sub BtnInvActualizaLoteCaducidad_Click(sender As Object, e As EventArgs)
For Each gvRow As GridViewRow In GvInv.Rows
Dim TxtLote As TextBox = gvRow.FCTextBox("TxtLote")
Dim TxtFechaCaducidad As TextBox = gvRow.FCTextBox("TxtCaducidad")
Dim UUIDRow As String = gvRow.DataKey("UUIDRow")
Dim FechaCaducidad As Date = If(TxtFechaCaducidad.Text.ToDate <= MinFecha, MinFecha, TxtFechaCaducidad.Text.ToDate)
For Each dRow As DataRow In TmpDT.Rows
If dRow("UUIDRow").ToString = UUIDRow Then
dRow("Lote") = TxtLote.Text
dRow("FechaCaducidad") = FechaCaducidad
End If
Next
For Each dRow As DataRow In DtInv.Rows
If dRow("UUIDRow").ToString = UUIDRow Then
dRow("Lote") = TxtLote.Text
dRow("FechaCaducidad") = FechaCaducidad
End If
Next
Next
End Sub
Private Sub CargaFletesAgregados()
CreaDTServicios()
BtnFiltrar_Click(Nothing, Nothing)
@@ -10997,6 +11183,20 @@ Partial Class Compras_Compras
If e.Row.RowType = DataControlRowType.DataRow Then
Dim CvePS As Integer = e.Row.DataKey("CvePS").ToEntero
Dim AplicaLote As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
Dim AplicaCaducidad As Boolean = Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
If AplicaLote Then
e.Row.FCTextBox("TxtLote").Visible = True
End If
If AplicaCaducidad Then
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
DvFechaCaducidad.Visible = True
End If
If UsuarioActual.Empresa.UsaAC Then e.Row.FCCheckBox("cbInv").Enabled = False
Dim StrTipo As String = "CveTipoAlmacen IN (1,2,7,14,19)"
@@ -11117,6 +11317,48 @@ Partial Class Compras_Compras
End If
''VALIDA UNIDAD DE MEDIDA
'If e.Row.DBCampo("CvePS").ToString.ToEntero > 0 Then
' Dim DtEquivalencias As DataTable = GlobalDTProductosServiciosEquivalencias(e.Row.DBCampo("CvePS").ToString.ToEntero, e.Row.DBCampo("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa)
' 'SI UM NO ESTA REGISTRADA
' If e.Row.DBCampo("CveUM").ToString.ToEntero <= 0 Then
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("onclick", $"FncUMEquivalencias(1,'{e.Row.DBCampo("UM").Replace("'", "")}',{e.Row.RowIndex},'{DtEquivalencias.FiltroPrimeroValor("UnidadMedida", "UnidadBase = 1")}','{e.Row.DBCampo("CveUnidadMedidaSAT")}','{e.Row.DBCampo("SATClaveUnidadMedida")}')")
' e.Row.FCLabel("LtlUnidadMedida").CssClass = "label label-danger manita centrarUM"
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("data-toggle", "tooltip")
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("title", "Unidad de medida SIN registrar")
' End If
' 'If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then e.Row.FCHyperLink("HplPS").Text = e.Row.DBCampo("PSCodigo")
' 'EQUIVALENCIA
' If e.Row.DBCampo("CveUM").ToString.ToEntero > 0 And e.Row.DBCampo("CveTipoPS").ToString.ToEntero = 2 Then
' If DtEquivalencias.FiltraParametros($"CveUM = {e.Row.DBCampo("CveUM").ToString.ToEntero}").Rows.Count > 0 Then
' If Not DtEquivalencias.FiltraParametros($"CveUM = {e.Row.DBCampo("CveUM").ToString.ToEntero} AND UnidadBase = 1").Rows.Count > 0 Then
' 'UM NO BASE
' e.Row.FCLinkButton("LBAplicarEquivalencia").Visible = True
' 'e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("onclick", $"FncUMEquivalencias(2,'{e.Row.DBCampo("UM").Replace("'", "")}',{e.Row.RowIndex},'{DtEquivalencias.FiltroPrimeroValor("UnidadMedida", "UnidadBase = 1")}')")
' e.Row.FCLabel("LtlUnidadMedida").CssClass = "label label-danger centrarUM"
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("data-toggle", "tooltip")
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("title", "Unidad de medida NO medida base")
' End If
' Else
' 'SIN EQUIVALENCIA
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("onclick", $"FncUMEquivalencias(3,'{e.Row.DBCampo("UM").Replace("'", "")}',{e.Row.RowIndex},'{DtEquivalencias.FiltroPrimeroValor("UnidadMedida", "UnidadBase = 1")}','{e.Row.DBCampo("CveUnidadMedidaSAT")}','{e.Row.DBCampo("SATClaveUnidadMedida")}')")
' e.Row.FCLabel("LtlUnidadMedida").CssClass = "label label-danger manita centrarUM"
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("data-toggle", "tooltip")
' e.Row.FCLabel("LtlUnidadMedida").Attributes.Add("title", "Unidad de medida SIN equivalencia")
' End If
' DtEquivalencias.Dispose()
' End If
'End If
End If
'HEADER GvInv
@@ -13199,8 +13441,8 @@ Partial Class Compras_Compras
If ChkConsignacion.Checked Then
'LiConsignacion.Visible = True
GvInv.Columns(7).Visible = True
GvInv.Columns(8).Visible = True
GvInv.Columns(9).Visible = True
GvInv.Columns(10).Visible = True
CargaConsignaciones2()
CargaGvInv()
@@ -13213,8 +13455,8 @@ Partial Class Compras_Compras
BtnGuardar.Enabled = False
UpFacturar.Update()
Else
GvInv.Columns(7).Visible = False
GvInv.Columns(8).Visible = False
GvInv.Columns(9).Visible = False
GvInv.Columns(10).Visible = False
'LiConsignacion.Visible = False
CveConsignacion = -1
@@ -13486,7 +13728,8 @@ Partial Class Compras_Compras
Cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDecimal
If Cantidad > 0 Then
realizadevolucion = True
subtotaldevolucion += Dr.DataKey("PU").ToString.ToDecimal * Cantidad
Dim PU As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, Dr.DataKey("PUExtranjero").ToString.ToDecimal, Dr.DataKey("PU").ToString.ToDecimal)
subtotaldevolucion += PU * Cantidad
End If
Next
'si no esta vinculado a nc simplemente me lo brinco
@@ -13501,6 +13744,7 @@ Partial Class Compras_Compras
Else
Dim Acumulado As Decimal = 0
Dim PU As Decimal
Dim PUExtranjero As Decimal
Dim CantidadRenglones As Integer = 0
Dim ii As Integer = 0
For Each Dr As GridViewRow In GVDevolucion.Rows
@@ -13513,6 +13757,7 @@ Partial Class Compras_Compras
If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
Acumulado += (Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)
PU = Dr.DataKey("PU").ToString.ToDecimal
PUExtranjero = Dr.DataKey("PUExtranjero").ToString.ToDecimal
ii += 1
If CantidadRenglones = ii Then
Dim dif As Decimal = subtotal - Acumulado
@@ -13538,7 +13783,7 @@ Partial Class Compras_Compras
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr.FCTextBox("TxtCantidad").Text.ToDecimal, Dr.DataKey("CveUM").ToString.ToEntero, Dr.DataKey("CvePS").ToString.ToEntero, PU, -1, CveMovimientoDetalleEntrada:=Dr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr.FCTextBox("TxtCantidad").Text.ToDecimal, Dr.DataKey("CveUM").ToString.ToEntero, Dr.DataKey("CvePS").ToString.ToEntero, PU, -1, CveMovimientoDetalleEntrada:=Dr.DataKey("CveMovimientoDetalle").ToString.ToEntero, PUTC:=PUExtranjero) Then
ErrorMovInv = True
Exit For
End If
@@ -13555,7 +13800,10 @@ Partial Class Compras_Compras
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa, -1) Then
For Each drow As DataRow In ObjInventario.DtResultados.Rows
TotalSumaPU = TotalSumaPU + drow("Total").ToString.ToDecimal
Next
End If
@@ -13620,18 +13868,19 @@ Partial Class Compras_Compras
'End Sub
Protected Sub BtnVinculaDevolucion_Click(sender As Object, e As EventArgs)
Try
Dim subtotaldevolucion As Double = 0
Dim subtotaldevolucion As Decimal = 0
Dim realizadevolucion As Boolean = False
'Calculo los subtotales para comparar con la NC
Dim cantidad As Double = 0.0
Dim cantidad As Decimal = 0D
For Each Dr As GridViewRow In GVDevolucion.Rows
cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDouble
cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDecimal
If cantidad > 0 Then
realizadevolucion = True
subtotaldevolucion += Dr.DataKey("PU").ToString.ToDouble * cantidad
Dim PU As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, Dr.DataKey("PUExtranjero").ToString.ToDecimal, Dr.DataKey("PU").ToString.ToDecimal)
subtotaldevolucion += PU * cantidad
End If
Next
@@ -14111,6 +14360,20 @@ Partial Class Compras_Compras
End If
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
If ObjInventario.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
tbmovs = ObjInventario.DtResultados
@@ -21588,6 +21851,8 @@ Partial Class Compras_Compras
End Class
@@ -22112,6 +22377,21 @@ Public Class ClsCompraManagerCompras
If Not TmpDT.Columns.Contains("Amortizacion") Then
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows
@@ -22358,6 +22638,13 @@ Public Class ClsCompraManagerCompras
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDT.Columns.Add("Lote", GetType(String))
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
TmpDT.AcceptChanges()

View File

@@ -2449,18 +2449,25 @@ Partial Class PopUpVerFactura
Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, Parametros("EXT").ToString, Parametros("TIPODOCTO").ToString, Parametros("FOLIO").ToString, Exten)
Dim Archivo As New System.IO.FileInfo(Path)
Dim cvetimbre As Integer = IfNull(Parametros("CVETIMBRE"), "0").ToString.ToEntero
Dim CveMovimiento As Integer = IfNull(Parametros("CVEMOVIMIENTO"), "0").ToString.ToEntero
If Archivo.Exists Then
DescargarArchivoPDFTraslado(Archivo, Path)
Else
If Exten = "pdf" Then
Dim ObjTimbres As New Timbres(Parametros("TIPODOCTO").ToString, cvetimbre, UsuarioActual)
GeneraPDFFactura(ObjTimbres.ObjFactura)
Archivo = New System.IO.FileInfo(Path)
If Archivo.Exists Then
DescargarArchivoPDFTraslado(Archivo, Path)
If ObjTimbres IsNot Nothing AndAlso ObjTimbres.ObjFactura IsNot Nothing Then
'OBTENER LA INFORMACION DEL MOVIMIENTO DE ALMACEN
ObjTimbres.ObjFactura.Inv_CveMovimiento = CveMovimiento
GeneraPDFFactura(ObjTimbres.ObjFactura)
Archivo = New System.IO.FileInfo(Path)
If Archivo.Exists Then
DescargarArchivoPDFTraslado(Archivo, Path)
End If
End If
End If
End If
Archivo = Nothing
@@ -3712,6 +3719,7 @@ Partial Class PopUpVerFactura
End If
If CveContrato > 0 Then
Contrato = GlobalDTContratos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DescripcionContrato", $"CveContrato={CveContrato} AND CveEmpresa = {UsuarioActual.CveEmpresa}")
NumContrato = GlobalDTContratos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("NumeroContrato", $"CveContrato={CveContrato} AND CveEmpresa = {UsuarioActual.CveEmpresa}")

View File

@@ -1707,7 +1707,12 @@ Partial Class Compras_eFacturas
If File.Exists(PDfDestino) Then
File.Delete(PDfDestino)
End If
File.Move(RutaPDF, PDfDestino)
Try
File.Move(RutaPDF, PDfDestino)
Catch ex As Exception
End Try
End If
End If

View File

@@ -1237,6 +1237,7 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
@@ -2787,12 +2788,6 @@
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
<ReportParameter Name="CEClavePedimento">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters>
<EmbeddedImages>
<EmbeddedImage Name="compuescuadron">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2775,9 +2775,10 @@ Partial Class Inventarios_TraspasoAlmacen
If ObjTimbres.Timbrar(CvePACEspecifico:=4) Then
Try
ObjTimbres.ObjFactura.Inv_CveMovimiento = CveMovimientoTimbrado
PdfFactura(ObjTimbres.ObjFactura)
Catch ex As Exception
OnError("Ocurrió un error al generar el pdf", ex)
End Try
MensajeAlert.Append("Emitido con éxito.")
@@ -2787,15 +2788,14 @@ Partial Class Inventarios_TraspasoAlmacen
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=DesXmlTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", CveMovimientoTimbrado, "XML", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto)))
End If
'PDF
'Dim ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjTimbres.ObjFactura.TipoDocto, ObjTimbres.ObjFactura.SerieFolio)
'If File.Exists(ArchivoPDF) Then
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=DesPdfTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", CveMovimientoTimbrado, "PDF", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto)))
'End If
If ChkEmitirCartaPorte.Checked Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Carta Porte</a></li></ul>", Encripta(String.Format("OP=CARPOTIMBRE&CVETIMBRE={0}", CveTimbre)))
Else
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Traslado</a></li></ul>", Encripta(String.Format("OP=CARPO&CVEMOV={0}", CveMovimientoTimbrado)))
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Traslado</a></li></ul>", Encripta(String.Format("OP=DesPdfTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}&CVETIMBRE={4}", CveMovimientoTimbrado, "PDF", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto, CveTimbre)))
Else
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Traslado</a></li></ul>", Encripta(String.Format("OP=CARPO&CVEMOV={0}", CveMovimientoTimbrado)))
End If
End If
Else

View File

@@ -4071,7 +4071,7 @@ Partial Class OC_OC
End If
If e.Row.DBCampo("Descuento").ToDecimal > 0 Then
Dim Desc As Decimal = e.Row.DBCampo("Descuento").ToDecimal
e.Row.FCLiteral("LtlDescuento").Text = String.Format("{0}<br/><p style ='font-style: italic; font-size: 10px;'>{1}%</p>", Desc.FormatoNumero, (Desc / (e.Row.DBCampo("Cantidad").ToDecimal * e.Row.DBCampo("PU").ToDecimal) * 100.0).FormatoNumero)
e.Row.FCLiteral("LtlDescuento").Text = String.Format("{0}<br/><p style ='font-style: italic; font-size: 10px;'>{1}%</p>", Desc.FormatoNumero, (Desc / (e.Row.DBCampo("Cantidad").ToDecimal * e.Row.DBCampo("Importe").ToDecimal) * 100.0).FormatoNumero)
End If
e.Row.Cells(0).ToolTip = e.Row.DBCampo("CvePresupuestoEgreso")

View File

@@ -749,23 +749,17 @@
<asp:HiddenField runat="server" ID="HidRemisionSaldo" Value="-1" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidCveAF" Value="-1" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidCveAFDes" Value="-1" ClientIDMode="Static" />
<div style="display:none!important">
<asp:UpdatePanel runat="server" ID="UPCargaCalendario">
<ContentTemplate>
<asp:Button runat="server" ID="BtnCargaContratoCalendario" OnClick="BtnCargaContratoCalendario_Click" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<%--<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>--%>
<%--<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>--%>
<%--<script src="/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.js"></script>--%>
<%--<script src="/Transportes/Gant/dhtmlxgantt.js"></script>--%>
<!-- Essential JS 2 all material theme -->
<%--<link href="Gant/material.css" rel="stylesheet" type="text/css"/>
<!-- Essential JS 2 all script -->
<script src="Gant/ej2.min.js" type="text/javascript"></script>--%>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<!-- Librería principal de amCharts 4 -->
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
@@ -780,39 +774,7 @@
<script src="https://cdn.amcharts.com/lib/4/lang/es_ES.js"></script>
<script>
// Create root element
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
//var root = am5.Root.new("chartdiv");
var am5locales_es_ES = {
"Jan": "Enero",
"Feb": "Febrero",
"Mar": "Marzo",
"Apr": "Abril",
"May": "Mayo",
"Jun": "Junio",
"Jul": "Julio",
"Aug": "Agosto",
"Sep": "Septiembre",
"Oct": "Octubre",
"Nov": "Noviembre",
"Dec": "Diciembre",
"January": "Enero",
"February": "Febrero",
"March": "Marzo",
"April": "Abril",
"June": "Junio",
"July": "Julio",
"August": "Agosto",
"September": "Septiembre",
"October": "Octubre",
"November": "Noviembre",
"December": "Diciembre",
};
let dateAxis;
let yAxis;
var chartHeader;
var chartBody;
@@ -834,6 +796,7 @@
// Convertir valores a objetos Date
let minDate = new Date(fechaI.split("/").reverse().join("-"));
let maxDate = new Date(fechaF.split("/").reverse().join("-"));
maxDate.setDate(maxDate.getDate() + 1);
maxDate.setHours(23, 59, 59, 999);
// Crear instancia del gráfico del encabezado
@@ -856,14 +819,14 @@
// Crear eje X (DateAxis) para el encabezado
var xAxisHeader = chartHeader.xAxes.push(new am4charts.DateAxis());
//xAxisHeader.baseInterval = { timeUnit: "hour", count: 1 };
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 }; // Cambiado a "day"
xAxisHeader.minPeriod = "day"; // Añadido
xAxisHeader.baseInterval = { timeUnit: "day", count: 1 };
xAxisHeader.minPeriod = "day";
xAxisHeader.min = minDate.getTime();
xAxisHeader.max = maxDate.getTime();
xAxisHeader.renderer.opposite = false; // Cambiado a false
xAxisHeader.renderer.opposite = false;
xAxisHeader.renderer.minGridDistance = 1; // Ajusta según sea necesario para evitar superposición
xAxisHeader.renderer.minorGridEnabled = false;
xAxisHeader.markUnitChange = false;
xAxisHeader.markUnitChange = false;
// Configurar las líneas de cuadrícula
@@ -880,11 +843,26 @@
xAxisHeader.renderer.labels.template.fontWeight = "bold";
// Formatear las etiquetas de fecha
xAxisHeader.dateFormatter.dateFormat = "dd/MM";
//xAxisHeader.dateFormats.setKey("day", "dd/MM"); // Añadido
xAxisHeader.periodChangeDateFormats.setKey("day", "dd/MM"); // Asegurado
xAxisHeader.periodChangeDateFormats.setKey("month", "MMMM"); // Opcional, si deseas mostrar meses
xAxisHeader.dateFormatter.dateFormat = "dd";
xAxisHeader.markUnitChange = false;
xAxisHeader.periodChangeDateFormats.setKey("day", "dd");
xAxisHeader.periodChangeDateFormats.setKey("month", "dd");
xAxisHeader.periodChangeDateFormats.setKey("year", "dd");
// Personalizar las etiquetas del eje X
xAxisHeader.renderer.labels.template.adapter.add("text", function (text, target) {
if (target.dataItem && target.dataItem.date) {
var date = target.dataItem.date;
var numberFormatter = new am4core.NumberFormatter();
return numberFormatter.format(date.getDate(), "00");
} else {
return text;
}
});
// Desactivar marcas y rellenos de cambio de periodo
xAxisHeader.renderer.ticks.template.disabled = true;
xAxisHeader.renderer.axisFills.template.disabled = true;
// Crear eje Y (ValueAxis) para el encabezado (dummy)
@@ -893,18 +871,18 @@
yAxisHeader.renderer.grid.template.disabled = true;
// Asignar datos al gráfico del encabezado
// Creamos datos dummy con fechas mínimas y máximas
// Creamos datos con fechas mínimas y máximas
chartHeader.data = [
{ date: minDate, value: 0 },
{ date: maxDate, value: 0 }
];
// Añadir una serie dummy para que el eje X se renderice correctamente
// Añadir una serie para que el eje X se renderice correctamente
var seriesHeader = chartHeader.series.push(new am4charts.LineSeries());
seriesHeader.dataFields.dateX = "date";
seriesHeader.dataFields.valueY = "value";
seriesHeader.strokeOpacity = 0; // Hacemos la línea invisible
seriesHeader.fillOpacity = 0;
seriesHeader.strokeOpacity = 1; // Hacemos la línea invisible
seriesHeader.fillOpacity = 1;
// Crear instancia del gráfico principal (cuerpo)
chartBody = am4core.create("chart-body", am4charts.XYChart);
@@ -925,9 +903,9 @@
// Configurar el cursor para permitir interacción solo en el eje X
chartBody.cursor = new am4charts.XYCursor();
chartBody.cursor.behavior = "zoomX"; // O "panX" si solo deseas desplazamiento horizontal
chartBody.cursor.lineY.disabled = true; // Deshabilita la línea vertical del cursor
chartBody.cursor = new am4charts.XYCursor();
chartBody.cursor.behavior = "zoomX"; // O "panX" si solo deseas desplazamiento horizontal
chartBody.cursor.lineY.disabled = true; // Deshabilita la línea vertical del cursor
// Definir cellSize para el tamaño fijo de cada categoría en el eje Y
@@ -959,8 +937,9 @@
// Deshabilitar las etiquetas y grids del eje X en el gráfico principal
xAxisBody.renderer.labels.template.disabled = true;
xAxisBody.renderer.grid.template.disabled = true;
// visibilzar grid
xAxisBody.renderer.grid.template.disabled = false;
xAxisBody.renderer.labels.template.forceShow = true;
// Añadir la serie al gráfico principal
@@ -969,12 +948,13 @@
seriesBody.dataFields.dateX = "toDate";
seriesBody.dataFields.categoryY = "category";
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nDURACIÓN: {fromDate} - {toDate}";
seriesBody.columns.template.tooltipText = "UNIDAD: {category}-{unidad}\nCONTRATO: {contrato}\nCLIENTE: {cliente}\nDURACIÓN: {fromDate} - {toDate}";
seriesBody.columns.template.strokeOpacity = 0;
// Asignar colores a las columnas basado en el campo 'color' de los datos
seriesBody.columns.template.propertyFields.fill = "color";
seriesBody.columns.template.propertyFields.stroke = "color";
var labelBullet = seriesBody.bullets.push(new am4charts.LabelBullet());
labelBullet.label.text = "{contrato}";
@@ -1015,10 +995,23 @@
yAxisBody.zoom({ start: 0, end: 1 });
});
// Animaciones al cargar
seriesBody.appear();
chartBody.appear(1000, 100);
chartBody.events.on("datavalidated", function () {
//chartHeader.paddingLeft = yAxisBody.renderer.pixelWidth;
chartHeader.paddingLeft = 50;
//alert(chartBody.yAxes.getIndex(0).renderer.pixelWidth);
chartHeader.validateLayout();
});
}
function cargaDiagramaGrant(data, categorias, TipoVista) {
@@ -1244,195 +1237,6 @@
}
<%--function cargaDiagramaGrant(data, categorias, TipoVista) {
am5.ready(function () {
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
root.container.children.clear();
root.dateFormatter.setAll({
dateFormat: "dd/MM/yyyy HH:mm",
dateFields: ["valueX", "openValueX"]
});
root.locale = am5locales_es_ES;
// Set themes
// https://www.amcharts.com/docs/v5/concepts/themes/
root.setThemes([
am5themes_Animated.new(root)
]);
// Create chart
// https://www.amcharts.com/docs/v5/charts/xy-chart/
var chart = root.container.children.push(am5xy.XYChart.new(root, {
panX: false,
panY: false,
wheelX: "none",
wheelY: "none",
layout: root.verticalLayout,
paddingLeft: 0
}));
// Add legend
// https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/
var legend = chart.children.push(am5.Legend.new(root, {
centerX: am5.p50,
x: am5.p50
}))
var colors = chart.get("colors");
// Create axes
// https://www.amcharts.com/docs/v5/charts/xy-chart/axes/
var yAxis = chart.yAxes.push(
am5xy.CategoryAxis.new(root, {
categoryField: "category",
renderer: am5xy.AxisRendererY.new(root, {
inversed: true,
minorGridEnabled: true
}),
tooltip: am5.Tooltip.new(root, {
themeTags: ["axis"],
animationDuration: 200
})
})
);
yAxis.data.setAll(categorias);
// Obtener valores de las cajas de texto
var fechaI = document.getElementById('<%= txtFechaI.ClientID %>').value;
var fechaF = document.getElementById('<%= txtFechaF.ClientID %>').value;
// Convertir valores a objetos Date
var minDate = new Date(fechaI.split("/").reverse().join("-"));
var maxDate = new Date(fechaF.split("/").reverse().join("-"));
var xAxis = chart.xAxes.push(
am5xy.DateAxis.new(root, {
baseInterval: { timeUnit: "day", count: 1 },
renderer: am5xy.AxisRendererX.new(root, {
opposite: true,
minorGridEnabled: true,
minGridDistance: 30 // Ajusta según sea necesario
}),
min: minDate.getTime(),
max: maxDate.getTime(),
groupData: false,
markUnitChange: false
})
);
// Asegurar que todas las etiquetas se muestren
xAxis.get("renderer").labels.template.setAll({
forceHidden: false,
minPosition: 0.001,
maxPosition: 0.999,
location: 0.5 // Centra las etiquetas
});
// Formatear las etiquetas de fecha
xAxis.get("renderer").labels.template.adapters.add("text", function (text, target) {
var dataItem = target.dataItem;
if (dataItem) {
var value = dataItem.get('value');
var date = new Date(value);
var day = date.getDate().toString().padStart(2, '0');
var month = (date.getMonth() + 1).toString().padStart(2, '0');
return day + '/' + month;
} else {
return text; // O puedes devolver una cadena vacía: return '';
}
});
//chart.topAxesContainer.children.push(dateAxis);
// Add series
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
var series = chart.series.push(am5xy.ColumnSeries.new(root, {
xAxis: xAxis,
yAxis: yAxis,
openValueXField: "fromDate",
valueXField: "toDate",
categoryYField: "category",
sequencedInterpolation: true
}));
series.columns.template.setAll({
templateField: "columnSettings",
strokeOpacity: 0,
tooltipText: "UNIDAD: {category}-{unidad} \nCONTRATO: {contrato} \nDURACIÓN: {openValueX} - {valueX}"
});
series.data.processor = am5.DataProcessor.new(root, {
dateFields: ["fromDate", "toDate"],
dateFormat: "yyyy-MM-dd HH:mm"
});
series.data.setAll(data);
// Scrollbar X
var scrollbarX = am5.Scrollbar.new(root, {
orientation: "horizontal"
});
var scrollbarY = am5.Scrollbar.new(root, {
orientation: "vertical"
});
chart.set("scrollbarX", scrollbarX);
chart.bottomAxesContainer.children.push(scrollbarX);
chart.set("scrollbarY", scrollbarY);
//MOSTRAR MODAL DE CONTRATO AL HACER CLICK
series.columns.template.events.on("click", e => {
let cveContrato = e.target.dataItem.dataContext.cveContrato;
$('#<%=HdnCveContrato.ClientID%>').val(cveContrato);
let url = '/Ashx/CargaEventos.ashx?METODO=contrato_transportes';
let parametros = '&cveContrato=' + cveContrato + '&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E=' + '<%= UsuarioActual.CveEmpresa %>' + '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val(); + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
fetch(url + parametros).then(response => response.json()).then(json => {
updateEvent(json[0], null, false);
}).catch(err => console.log('Solicitud fallida', err));
});
series.events.on("datavalidated", function (ev) {
let cellSize = 45;
if (TipoVista == 1) {
cellSize = 60;
}
//let series = ev.target;
//let chart = series.chart;
let xAxis = chart.xAxes.getIndex(0);
// Calculate how we need to adjust chart height
let chartHeight = categorias.length * cellSize + xAxis.height() + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0);
// Set it on chart's container
chart.root.dom.style.height = chartHeight + "px";
// ev.target.get("xAxis").zoomToValues(new Date(2024,6,15).getTime(), new Date(2024,6,20).getTime());
});
// Make stuff animate on load
// https://www.amcharts.com/docs/v5/concepts/animations/
series.appear();
chart.appear(1000, 100);
}); // end am5.ready()
}--%>
var PrimeraCargaCalendario = true;
@@ -1459,73 +1263,10 @@
function updateEvent(event, element, esCalendario = true) {
$('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros);
$('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato);
$('#<%=TxtObservaciones.ClientID%>').val(event.Observaciones);
$('#<%=TxtDescripcion.ClientID%>').val(event.description);
$('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento);
if (esCalendario) {
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i));
} else {
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start));
}
$('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal));
$('#<%=DdlClientes.ClientID%>').val(event.CveCliente);
$('#<%=DdlChofer.ClientID%>').val(event.CvePersonal);
if (event.CvePersonal2 > 0) {
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', true);
setTimeout(function () { $('#<%=DdlChofer2.ClientID%>').val(event.CvePersonal2).change(); }, 500);;
;
} else {
$('#<%=chkSegundoChofer.ClientID%>').prop('checked', false);
$('#<%=DdlChofer2.ClientID%>').val(-1);
}
$('#<%=DdlEstatusContrato.ClientID%>').val(event.CveEventoEstatus);
$('#<%=TxtDolares.ClientID%>').val(event.Dolares);
$('#<%=TxtPesos.ClientID%>').val(event.Pesos);
$('#<%=TxtMoneda.ClientID%>').val(event.Moneda);
$('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo);
$('#<%=HdnCveContrato.ClientID%>').val(event.id);
$('#<%=DdlTipoAF.ClientID%>').val(event.CveTipoAF);
$('#<%=DdlSubProyectoModal.ClientID%>').val(event.CveSubProyecto);
$('#<%= HidCveTipoAF.ClientID%>').val($('#<%=TxtAnticipo.ClientID%>').val());
<%--$('#<%=BtnDdlTipoAF.ClientID%>').click();--%>
<%--$('#<%=DdlAF.ClientID%>').val(event.CveActivoFijo);--%>
$('#HidNumChoferes').val(event.NumChoferes);
$('#HidRemisionSerieFolio').val(event.RemisionSerieFolio);
$('#HidCveVentaRemision').val(event.CveVentaRemision);
$('#HidRemisionSaldo').val(event.RemisionSaldo);
$('#HdnNumContrato').val(event.NumeroContrato);
if (event.CveActivoFijo > 0) {
$('#HidCveAF').val(event.CveActivoFijo);
} else {
$('#HidCveAF').val('-1');
}
if (event.NombreComercial !== null) {
$('#HidModClienteNombre').val('');
} else {
$('#HidModClienteNombre').val(event.NombreComercial);
}
$('#HidModCveCliente').val(event.CveCliente);
$('#<%=HdnCveContrato.ClientID%>').click();
$('#<%=BtnModal.ClientID%>').click();
$('#BtnCargaContratoCalendario').click();
}

View File

@@ -245,7 +245,8 @@ Partial Class RepContratosCalendario
strData.AppendLine($"color: am4core.color('" & String.Format("#{0:X6}", random.Next(16777216)) & "'),")
strData.AppendLine($"cveContrato: {Row("CveContrato").ToString.ToEntero},")
strData.AppendLine($"contrato: '{Row("NumeroContrato").ToString}',")
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}'")
strData.AppendLine($"fechaFinalViaje: '{FF.ToString("yyyy-MM-dd HH:mm:ss")}',")
strData.AppendLine($"cliente: '{Row("NombreComercial").ToString.Replace("'", "")}'")
strData.AppendLine("},")
@@ -564,6 +565,82 @@ Partial Class RepContratosCalendario
End If
End Sub
Protected Sub BtnCargaContratoCalendario_Click(sender As Object, e As EventArgs)
Dim CveContratoConsulta As Integer = HdnCveContrato.Value.ToEntero
If CveContratoConsulta > 0 Then
Dim Objcontrato As New ClsContratos
If Objcontrato.GetContratos(CveContratoConsulta, UsuarioActual.CveEmpresa) AndAlso Objcontrato.DtResultados.Rows.Count > 0 Then
Dim DRow As DataRow
DRow = Objcontrato.DtResultados.Rows(0)
'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim NumChoferes As Integer = DRow("NumChoferes").ToString.ToEntero
TxtFolio.Text = DRow("NumeroContrato").ToString
TxtCantidadPasajeros.Text = DRow("CantidadPasajeros").ToString
DdlClientes.SelectedValue = DRow("CveCliente").ToString
DdlClientes.SelectedText = DRow("NombreComercial").ToString
TxtDescripcion.Text = DRow("DescripcionContrato").ToString
TxtObservaciones.Text = DRow("Observaciones").ToString
TxtUbicacion.Text = DRow("Ubicacion").ToString
TxtFechaSalida.Text = Convert.ToDateTime(DRow("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss")
TxtFechaRegreso.Text = Convert.ToDateTime(DRow("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ")
TxtMoneda.Text = DRow("Moneda").ToString
'Requeridos
DdlChofer.SelectedValueExist(DRow("CveChofer").ToString)
DdlChofer2.SelectedValueExist(DRow("CveChofer2").ToString)
chkSegundoChofer.Checked = If(NumChoferes = 2, True, False)
DdlEstatusContrato.SelectedValueExist(DRow("CveContratosEstatus").ToString)
DdlSubProyectoModal.SelectedValueExist(DRow("CveSubProyecto").ToString)
DdlTipoAF.SelectedValueExist(DRow("CveTipoAF").ToString)
DdlTipoAF_SelectedIndexChanged(Nothing, Nothing)
DdlAF.SelectedValueExist(DRow("CveAF").ToString)
HidCveAF.Value = "-1"
HidCveAFDes.Value = ""
If DRow("CveAF").ToString.ToEntero > 0 Then
HidCveAF.Value = DRow("CveAF").ToString.ToString
HidCveAFDes.Value = DdlAF.SelectedItem.Text
End If
TxtMotivoCambioUnidad.Text = ""
DVMotivoCambioAF.Visible = False
HypRemision.Text = DRow("RemisionSerieFolio").ToString
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={DRow("CveVentaRemision").ToString}"
If DRow("RemisionSaldo").ToString.ToDecimal > 0 Then
LblSaldo.Text = $"Saldo {DRow("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
Else
LblSaldo.Text = ""
End If
CveContrato = CveContratoConsulta
OcultarMostrarSegundoChofer()
UpCommando.Update()
UpModal.Update()
RegistraScript("$('#ModalActualizar').modal('show');")
End If
Objcontrato.Dispose()
Else
Alert("Contrato no especificado", TipoMensaje.MsgAdvertencia)
End If
End Sub
@@ -597,11 +674,11 @@ Partial Class RepContratosCalendario
End If
End If
If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
TieneError = True
End If
End If
'If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
' If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
' TieneError = True
' End If
'End If
If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero,
-1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34,
@@ -718,6 +795,7 @@ Partial Class RepContratosCalendario
UpModal.Update()
myModalLabel.InnerText = "Contrato: " & HdnNumContrato.Value
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub chkSegundoChofer_CheckedChanged(sender As Object, e As EventArgs)
@@ -857,4 +935,6 @@ Partial Class RepContratosCalendario
CargaCronograma(DdlTipoVistaCalendario.SelectedValue.ToEntero)
End Sub
End Class

471
Ventas/DashboardVentas.aspx Normal file
View File

@@ -0,0 +1,471 @@
<%@ Page Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="DashboardVentas.aspx.vb" Inherits="Ventas_DashboardVentas" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<style>
.dataTables_scrollHead {
background-color: #95A5A6;
color: white;
}
.container {
width: 100%;
overflow-x: auto;
white-space: nowrap;
}
#chartdiv {
width: 100%;
height: 500px;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Dashboard Ventas
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" OnClick="BtnConsultar_Click" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row">
<asp:Label ID="LblProyecto" runat="server" class="col-md-1 truncate">Proyecto:</asp:Label>
<div runat="server" id="DivProyecto" class="col-md-2">
<asp:DropDownList ID="DdlProyecto" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me"></asp:DropDownList>
</div>
<asp:Label ID="LblSubProyecto" runat="server" class="col-md-1 truncate">SubProyecto:</asp:Label>
<div runat="server" id="DivSubProyecto" class="col-md-2">
<asp:DropDownList ID="DdlSubProyecto" SelectionMode="Multiple" data-text="Todos" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server"></asp:DropDownList>
</div>
<label class="col-md-1 ">Agrupador:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlAgrupador" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
<asp:ListItem Text="Linea" Value="1"></asp:ListItem>
<asp:ListItem Text="Cliente" Value="2"></asp:ListItem>
<asp:ListItem Text="Marca" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="portlet-body" style="display: none">
<div class="row">
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6">
<asp:GridView ID="GvVentas" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Mes" HeaderText="Mes" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="TotalAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAno3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAno3Presupuesto" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="CumplimientaRealVSPPTO" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PorcentajeUtilidad" HeaderText="% DE UTILIDAD" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PorcentajeContado" HeaderText="% CONTADO" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PorcentajeCredito" HeaderText="% CRÉDITO" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
<div class="col-md-6">
<asp:GridView ID="GvVentasAcumulado" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Mes" HeaderText="Mes" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Ano3xAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Ano3xAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Ano3xPPTO" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
</div>
<div class="row" id="DvGraficas" visible="true" runat="server">
<div id="DvGraVentas" runat="server" class="col-md-6 col-sm-6" style="width: 100%">
<!-- BEGIN REGIONAL STATS PORTLET-->
<div class="portlet light ">
<div class="portlet-title">
<div class="caption">
<i class="icon-graph font-red-sunglo"></i>
<span class="caption-subject font-red-sunglo bold uppercase">Grafica</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="reload" data-original-title="" title=""></a>
<a href="javascript:;" class="remove" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body">
<div id="chartdiv" style="text-align: center; height: 600px!important">
</div>
<div id="div_ventas" runat="server" style="text-align: center;">
<%--<img src="/Metronic/assets/admin/layout/img/loading.gif" alt="loading" />--%>
</div>
</div>
</div>
<!-- END REGIONAL STATS PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:GridView ID="GvVentasClasificacion" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Agrupador" HeaderText="Linea" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="TotalAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PorcentajeVenta" HeaderText="% / T. VENTA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAno2Presupuesto" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Ano2xAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Ano2xPPTO" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
<div class="col-md-6">
<div class="container">
<%--<table class="table Widthall">
<tr>
<td style="width: 200px;"></td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Enero</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Febrero</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Marzo</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Abril</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Mayo</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Junio</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Julio</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Agosto</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Septiembre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Octubre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Noviembre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 160px; border-right: 3px solid white;">Diciembre</td>
</tr>
</table>--%>
<asp:GridView ID="GvVentasClasificacionxMes" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Agrupador" HeaderText="Linea" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="TotalEneAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalEneAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalFebAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalFebAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalMarAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalMarAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAbrAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAbrAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalMayAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalMayAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalJunAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalJunAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalJulAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalJulAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAgoAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalAgoAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalSepAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalSepAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalOctAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalOctAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalNovAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalNovAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalDicAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TotalDicAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
<%-- <div class="row">
<div class="col-md-12">
<div class="container">
<table class="table Widthall">
<tr>
<td style="width: 360px;"></td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Enero</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Febrero</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Marzo</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Abril</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Mayo</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Junio</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Julio</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Agosto</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Septiembre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Octubre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Noviembre</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 300px; border-right: 3px solid white;">Diciembre</td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Clasificacion" HeaderText="Linea" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="360px" />
<asp:BoundField DataField="TotalEneAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="360px" />
<asp:BoundField DataField="TotalEneAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalFebAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalFebAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalMarAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalMarAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalAbrAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalAbrAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalMayAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalMayAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalJunAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalJunAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalJulAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalJulAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalAgoAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalAgoAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalSepAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px"/>
<asp:BoundField DataField="TotalSepAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalOctAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalOctAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalNovAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalNovAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalDicAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField DataField="TotalDicAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
</Columns>
</asp:GridView>
</div>
</div>--%>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<%-- <script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/pie.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script>
function CargaGrafica(data) {
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"dataLoader": {
"url": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-160/SO-58530378.json",
"format": "json",
"complete": function (chart) {
//get potential valueFields after filtering out the categoryField
var valueFields = Object.keys(chart.dataProvider[0]).filter(function (value) {
return value !== chart.categoryField;
})
//create the graphs
valueFields.forEach(function (valueField) {
chart.graphs.push({
"valueField": valueField,
"title": valueField,
"type": "line",
"balloonText": "[[category]]: <b>[[value]]</b>",
"lineAlphas": 0.2
})
});
}
},
"valueAxes": [{
"gridColor": "#FFFFFF",
"gridAlpha": 0.2,
"dashLength": 0
}],
"gridAboveGraphs": true,
"startDuration": 1,
"graphs": [],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "Mes",
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0
},
"legend": {},
"export": {
"enabled": true
},
"menu": [{
"class": "export-main",
"menu": ["PNG", "JPG", "CSV"]
}]
});
//var chart = AmCharts.makeChart("chartdiv", {
// "type": "serial",
// "theme": "light",
// "dataProvider": data,
// "startDuration": 2,
// "valueAxes": [{
// "position": "left",
// "title": "Ventas"
// }],
// "graphs": [{
// "balloonText": "[[category]]: <b>[[value]]</b>",
// "colorField": "Color",
// "fillAlphas": 1,
// "lineAlpha": 0.1,
// "type": "line",
// "valueField": "Valor"
// }],
// "depth3D": 20,
// "angle": 30,
// "chartCursor": {
// "categoryBalloonEnabled": false,
// "cursorAlpha": 0,
// "zoomable": false
// },
// "categoryField": "Texto",
// "categoryAxis": {
// "gridPosition": "start",
// "labelRotation": 90
// },
// "export": {
// "enabled": true
// }
//});
}--%>
<!--Librería principal de amCharts 4-->
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<!-- Módulo de gráficos de XYChart -->
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
<!-- Tema animado de amCharts 4 -->
<script src="https://cdn.amcharts.com/lib/4/themes/animated.js"></script>
<!-- Paquete de idioma español -->
<script src="https://cdn.amcharts.com/lib/4/lang/es_ES.js"></script>
<script>
// Función para crear series dinámicamente
function createSeries(field, name) {
var series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = field;
series.dataFields.categoryX = "mes";
series.name = name;
series.strokeWidth = 2;
// Añadir bullets a la serie
var bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 4;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.strokeWidth = 2;
// Configurar el tooltip para cada serie
series.tooltipText = "{name}: [bold]{valueY}[/]";
series.tooltip.pointerOrientation = "vertical";
series.tooltip.background.cornerRadius = 5;
series.tooltip.background.fillOpacity = 0.8;
series.tooltip.label.padding(10, 10, 10, 10);
// Asegurar que el label del tooltip sea visible
series.tooltip.label.fill = am4core.color("#000"); // Texto en negro
// Mostrar el tooltip solo al pasar el cursor sobre la serie
series.tooltip.showInViewport = false;
// Habilitar interacciones en la serie
series.interactionsEnabled = true;
}
function generaGrafico(dtGrafico, dtseries) {
// Importar las librerías de amCharts
am4core.useTheme(am4themes_animated);
// Crear el gráfico
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Ejemplo de datos dinámicos
chart.data = dtGrafico; //[
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "mes";
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.minGridDistance = 30;
// Configuración del eje Y (Importe)
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.title.text = "Importe";
for (var i = 0; i < dtseries.length; i++) {
var item = dtseries[i];
var key = Object.keys(item)[0];
var value = item[key];
var series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = key;
series.dataFields.categoryX = "mes";
series.name = value;
series.strokeWidth = 2;
// Añadir bullets a la serie
var bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 4;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.strokeWidth = 2;
// Configurar el tooltip para cada serie
series.tooltipText = "{name}: [bold]{valueY}[/]";// "{" + value + "}: [bold]{" + key +"}[/]";
series.tooltip.pointerOrientation = "vertical";
series.tooltip.background.cornerRadius = 5;
series.tooltip.background.fillOpacity = 0.8;
series.tooltip.label.padding(10, 10, 10, 10);
// Asegurar que el label del tooltip sea visible
series.tooltip.label.fill = am4core.color("#000"); // Texto en negro
// Mostrar el tooltip solo al pasar el cursor sobre la serie
series.tooltip.showInViewport = false;
// Habilitar interacciones en la serie
series.interactionsEnabled = true;
}
// Habilitar el cursor pero deshabilitar su tooltip
chart.cursor = new am4charts.XYCursor();
chart.cursor.behavior = "none"; // Deshabilitar pan o zoom
chart.cursor.lineX.disabled = true;
chart.cursor.lineY.disabled = true;
chart.cursor.tooltipEnabled = false; // Deshabilitar el tooltip del cursor
// Leyenda
chart.legend = new am4charts.Legend();
// Exportar el gráfico
chart.exporting.menu = new am4core.ExportMenu();
}
</script>
</asp:Content>

View File

@@ -0,0 +1,243 @@

Imports System.Activities.Statements
Imports System.Data
Imports Extensiones
Imports Newtonsoft.Json.Linq
Partial Class Ventas_DashboardVentas
Inherits ClsPaginas
Private Property DtVentasClasificacion As DataTable
Get
Return CType(ViewState("DtVentasClasificacion"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentasClasificacion") = value
End Set
End Property
Private Property DtVentas As DataTable
Get
Return CType(ViewState("DtVentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentas") = value
End Set
End Property
Private Property DtVentasClasificacionxMes As DataTable
Get
Return CType(ViewState("DtVentasClasificacionxMes"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentasClasificacionxMes") = value
End Set
End Property
Private Property DtVentasGrafica As DataTable
Get
Return CType(ViewState("DtVentasGrafica"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentasGrafica") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
End If
End Sub
Private Sub CargaCombos()
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, AplicaTodos:="Seleccione")
DdlSubProyecto.Items(0).Text = "Seleccione"
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
UpDatos.Update()
End Sub
Protected Sub CargaDatos()
Dim ObjVentas As New ClsVentas
If ObjVentas.GetDashboardVentasGet(UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero) Then
Dim DsDatos = ObjVentas.DataSetResultados.Copy()
If DsDatos IsNot Nothing Then
'DESGLOSE
DtVentasClasificacion = DsDatos.Tables(0)
DtVentas = DsDatos.Tables(1)
DtVentasClasificacionxMes = DsDatos.Tables(2)
DtVentasGrafica = DsDatos.Tables(3)
DtVentasClasificacion.Columns.Add("PorcentajeVenta", GetType(Decimal))
DtVentasClasificacion.Columns.Add("Ano2xAno1", GetType(Decimal))
DtVentasClasificacion.Columns.Add("Ano2xPPTO", GetType(Decimal))
DtVentas.Columns.Add("Ano3xAno1", GetType(Decimal))
DtVentas.Columns.Add("Ano3xAno2", GetType(Decimal))
DtVentas.Columns.Add("CumplimientaRealVSPPTO", GetType(Decimal))
DtVentas.Columns.Add("Ano3xPPTO", GetType(Decimal))
Dim AcumuladoAno1 As Decimal = 0
Dim AcumuladoAno2 As Decimal = 0
Dim AcumuladoAno3 As Decimal = 0
Dim AcumuladoPPTO As Decimal = 0
For Each Row As DataRow In DtVentas.Rows
AcumuladoAno1 += Row("TotalAno1").ToString().ToDecimal()
AcumuladoAno2 += Row("TotalAno2").ToString().ToDecimal()
AcumuladoAno3 += Row("TotalAno3").ToString().ToDecimal()
AcumuladoPPTO += Row("TotalAno3Presupuesto").ToString().ToDecimal()
Row("Ano3xAno1") = (AcumuladoAno3 / AcumuladoAno1) - 1
Row("Ano3xAno2") = (AcumuladoAno3 / AcumuladoAno2) - 1
Row("CumplimientaRealVSPPTO") = (Row("TotalAno3").ToString().ToDecimal() * 100) / Row("TotalAno3Presupuesto").ToString().ToDecimal() / 100
Row("Ano3xPPTO") = (AcumuladoAno3 / AcumuladoPPTO) - 1
Next
For Each Row As DataRow In DtVentasClasificacion.Rows
Row("Ano2xAno1") = If(Row("TotalAno1").ToString().ToDecimal() = 0, 0, (Row("TotalAno2").ToString().ToDecimal() - Row("TotalAno1").ToString().ToDecimal()) / Row("TotalAno1").ToString().ToDecimal())
Row("Ano2xPPTO") = (Row("TotalAno2").ToString().ToDecimal() - Row("TotalAno2Presupuesto").ToString().ToDecimal()) / Row("TotalAno2Presupuesto").ToString().ToDecimal()
Row("PorcentajeVenta") = If(DtVentasClasificacion.SUMD("TotalAno2") = 0, 0, Row("TotalAno2").ToString().ToDecimal() / DtVentasClasificacion.SUMD("TotalAno2"))
Next
GvVentasClasificacion.DataSource = DtVentasClasificacion
GvVentas.DataSource = DtVentas
GvVentasClasificacionxMes.DataSource = DtVentasClasificacionxMes
GvVentasAcumulado.DataSource = DtVentas
End If
End If
ObjVentas.Dispose()
GvVentasClasificacion.Columns(1).HeaderText = Now.Year.ToString()
GvVentasClasificacion.Columns(2).HeaderText = (Now.Year - 1).ToString()
GvVentasClasificacion.Columns(4).HeaderText = $"PRESUPUESTO {Now.Year}"
GvVentasClasificacion.Columns(5).HeaderText = $"{Now.Year} VS {Now.Year - 1}"
GvVentasClasificacion.Columns(6).HeaderText = $"{Now.Year} VS PPTO"
GvVentasClasificacionxMes.Columns(1).HeaderText = $"{Now.Year}-Enero"
GvVentasClasificacionxMes.Columns(2).HeaderText = $"{(Now.Year - 1)}-Enero"
GvVentasClasificacionxMes.Columns(3).HeaderText = $"{Now.Year}-Febrero"
GvVentasClasificacionxMes.Columns(4).HeaderText = $"{(Now.Year - 1)}-Febrero"
GvVentasClasificacionxMes.Columns(5).HeaderText = $"{Now.Year}-Marzo"
GvVentasClasificacionxMes.Columns(6).HeaderText = $"{(Now.Year - 1)}-Marzo"
GvVentasClasificacionxMes.Columns(7).HeaderText = $"{Now.Year}-Abril"
GvVentasClasificacionxMes.Columns(8).HeaderText = $"{(Now.Year - 1)}-Abril"
GvVentasClasificacionxMes.Columns(9).HeaderText = $"{Now.Year}-Mayo"
GvVentasClasificacionxMes.Columns(10).HeaderText = $"{(Now.Year - 1)}-Mayo"
GvVentasClasificacionxMes.Columns(11).HeaderText = $"{Now.Year}-Junio"
GvVentasClasificacionxMes.Columns(12).HeaderText = $"{(Now.Year - 1)}-Junio"
GvVentasClasificacionxMes.Columns(13).HeaderText = $"{Now.Year}-Julio"
GvVentasClasificacionxMes.Columns(14).HeaderText = $"{(Now.Year - 1)}-Julio"
GvVentasClasificacionxMes.Columns(15).HeaderText = $"{Now.Year}-Agosto"
GvVentasClasificacionxMes.Columns(16).HeaderText = $"{(Now.Year - 1)}-Agosto"
GvVentasClasificacionxMes.Columns(17).HeaderText = $"{Now.Year}-Septiembre"
GvVentasClasificacionxMes.Columns(18).HeaderText = $"{(Now.Year - 1)}-Septiembre"
GvVentasClasificacionxMes.Columns(19).HeaderText = $"{Now.Year}-Octubre"
GvVentasClasificacionxMes.Columns(20).HeaderText = $"{(Now.Year - 1)}-Octubre"
GvVentasClasificacionxMes.Columns(21).HeaderText = $"{Now.Year}-Noviembre"
GvVentasClasificacionxMes.Columns(22).HeaderText = $"{(Now.Year - 1)}-Noviembre"
GvVentasClasificacionxMes.Columns(23).HeaderText = $"{Now.Year}-Diciembre"
GvVentasClasificacionxMes.Columns(24).HeaderText = $"{(Now.Year - 1)}-Diciembre"
'GvVentasClasificacionxMes.Columns(1).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(2).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(3).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(4).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(5).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(6).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(7).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(8).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(9).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(10).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(11).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(12).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(13).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(14).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(15).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(16).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(17).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(18).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(19).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(20).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(21).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(22).HeaderText = $"{(Now.Year - 1)}"
'GvVentasClasificacionxMes.Columns(23).HeaderText = $"{Now.Year}"
'GvVentasClasificacionxMes.Columns(24).HeaderText = $"{(Now.Year - 1)}"
GvVentas.Columns(1).HeaderText = (Now.Year - 2).ToString()
GvVentas.Columns(2).HeaderText = (Now.Year - 1).ToString()
GvVentas.Columns(3).HeaderText = Now.Year.ToString()
GvVentas.Columns(4).HeaderText = $"PRESUPUESTO {Now.Year}"
GvVentas.Columns(5).HeaderText = $"CUMPLIMIENTO REAL VS PPTO {Now.Year}"
GvVentasAcumulado.Columns(1).HeaderText = $"{Now.Year} VS {Now.Year - 2}"
GvVentasAcumulado.Columns(2).HeaderText = $"{Now.Year} VS {Now.Year - 1}"
GvVentasAcumulado.Columns(3).HeaderText = $"{Now.Year} VS PPTO"
GvVentasClasificacion.DataBind()
GvVentas.DataBind()
GvVentasClasificacionxMes.DataBind()
GvVentasAcumulado.DataBind()
CargaGraficaNEW(DtVentasGrafica)
'Dim Ano3 = DateTime.Now.Year.ToString()
'Dim Ano2 = (DateTime.Now.Year - 1).ToString()
'Dim Ano1 = (DateTime.Now.Year - 2).ToString()
'Dim Dt As New DataTable()
'Dt.Columns.Add("Mes")
'Dt.Columns.Add(DateTime.Now.Year.ToString())
'Dt.Columns.Add((DateTime.Now.Year - 1).ToString())
'Dt.Columns.Add((DateTime.Now.Year - 2).ToString())
'Dt.Columns.Add("Presupuesto")
'For Each Dr As DataRow In DtVentas.Rows
' Dim Row As DataRow = Dt.NewRow()
' Row("Mes") = Dr("Mes").ToString()
' Row(DateTime.Now.Year.ToString()) = Dr("TotalAno3").ToString().FormatoNumero
' Row((DateTime.Now.Year - 1).ToString()) = Dr("TotalAno2").ToString().FormatoNumero
' Row((DateTime.Now.Year - 2).ToString()) = Dr("TotalAno1").ToString().FormatoNumero
' Row("Presupuesto") = Dr("TotalAno3Presupuesto").ToString().FormatoNumero
' Dt.Rows.Add(Row)
'Next
'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(Dt)
'RegistraScript($"CargaGrafica({json});console.log({json})", "22")
End Sub
Private Sub CargaGraficaNEW(ByVal D_T_Datos As DataTable)
Dim jsonData As JArray = New JArray()
For x As Integer = 1 To 12
Dim Mes As String = D_T_Datos.Columns(x).ColumnName
Dim obj As JObject = New JObject()
obj.Add(New JProperty("mes", Mes))
For y As Integer = 0 To D_T_Datos.Rows.Count - 1
obj.Add(New JProperty(D_T_Datos.Rows(y)(0).ToString(), D_T_Datos.Rows(y)(x).ToString()))
Next
jsonData.Add(obj)
Next
Dim jsonSeries As JArray = New JArray()
For y As Integer = 0 To D_T_Datos.Rows.Count - 1
Dim obj As JObject = New JObject(New JProperty(D_T_Datos.Rows(y)(0).ToString(), D_T_Datos.Rows(y)(0).ToString()))
jsonSeries.Add(obj)
Next
Dim jsdatos As String = jsonData.ToString()
Dim jsseries As String = jsonSeries.ToString()
RegistraScript($"generaGrafico({jsdatos},{jsseries});")
End Sub
End Class

View File

@@ -17488,10 +17488,12 @@ Partial Class Ventas
Case "3", "295"
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
importeMN = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
If importeMovimiento <> 0 Then
Dim Pago As New VentaPago
Pago.ImportePagoVenta = importeMovimiento
Pago.ImportePagoVenta = importeMN
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
@@ -17501,6 +17503,7 @@ Partial Class Ventas
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
Pago.AplicaConceptoImpuestoPendiente = (Not gvr.DataKey("RegresarImpuesto") = "1") AndAlso (VentaActual.IVA > 0 OrElse VentaActual.IEPS > 0)
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
@@ -17622,7 +17625,7 @@ Partial Class Ventas
ObjConta.Commit()
BtnAceptarAnticipos.Enabled = False
Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
End If
ObjConta.Dispose()