This commit is contained in:
2025-04-13 07:12:03 -07:00
17 changed files with 594 additions and 1446 deletions

View File

@@ -128,7 +128,7 @@ font-size: 12px;
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" Width="100%" EmptyDataText="No se encontraron datos con los filtros especificados" <asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" Width="100%" EmptyDataText="No se encontraron datos con los filtros especificados"
DataKeyNames="CvePrecioVentaManifiesto,CveEmbarqueManifiesto,CveCultivo,CveCultivoVariedad,Referencia,LdDate,InvDate,PDDate,CantidadVendida,PUVenta,Observaciones" DataKeyNames="CvePrecioVentaManifiesto,CveEmbarqueManifiesto,CveCultivo,CveCultivoVariedad,Referencia,LdDate,InvDate,PDDate,CantidadVendida,PUVenta,Observaciones,Diferencia"
ToolTip="" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbt" data-sort="true" GridLines="None"> ToolTip="" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbt" data-sort="true" GridLines="None">
<Columns> <Columns>
<asp:BoundField HeaderText="Manifiesto" DataField="NoEmbarque" /> <asp:BoundField HeaderText="Manifiesto" DataField="NoEmbarque" />
@@ -139,12 +139,11 @@ font-size: 12px;
<asp:BoundField HeaderText="Referencia" DataField="Referencia" /> <asp:BoundField HeaderText="Referencia" DataField="Referencia" />
<asp:BoundField HeaderText="Fecha Vta" DataField="InvDate" ItemStyle-Width="110px" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="False" /> <asp:BoundField HeaderText="Fecha Vta" DataField="InvDate" ItemStyle-Width="110px" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="False" />
<asp:BoundField HeaderText="Cantidad" DataField="CantidadVendida" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" /> <asp:BoundField HeaderText="Cantidad" DataField="CantidadVendida" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:BoundField HeaderText="Total Venta" DataField="PUVentaOriginal" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:BoundField HeaderText="Precio venta (Grow)" DataField="PUVenta" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" /> <asp:BoundField HeaderText="Precio venta (Grow)" DataField="PUVenta" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:BoundField HeaderText="Precio del día" DataField="PrecioVenta" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" /> <asp:BoundField HeaderText="Precio del día" DataField="PrecioVenta" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:BoundField HeaderText="Diferencia" DataField="Diferencia" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" /> <asp:BoundField HeaderText="Dif." DataField="Diferencia" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" ItemStyle-Width="50px" />
<asp:BoundField HeaderText="% de diferencia" DataField="Porcentaje" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}%" /> <asp:BoundField HeaderText="% Dif." DataField="Porcentaje" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}%" ItemStyle-Width="50px" />
<asp:BoundField HeaderText="Fecha Ing." DataField="FechaIng" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" HtmlEncode="False" />
<asp:BoundField HeaderText="Usuario" DataField="Usuario" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>

View File

@@ -25,10 +25,10 @@ Partial Class Agrupecuaria_RepPreciosVentaManifiesto
If Not IsPostBack Then If Not IsPostBack Then
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx")
txtFechaI.Text = $"01/{Now.Month.ToString("0#")}/{Now.Year}" txtFechaI.Text = Now.AddDays(-1).ToString("dd/MM/yyyy")
txtFechaF.Text = Now.ToString("dd/MM/yyyy") txtFechaF.Text = Now.ToString("dd/MM/yyyy")
TxtModalFechaInicio.Text = $"01/{Now.Month.ToString("0#")}/{Now.Year}" TxtModalFechaInicio.Text = Now.AddDays(-1).ToString("dd/MM/yyyy")
TxtModalFechaFin.Text = Now.ToString("dd/MM/yyyy") TxtModalFechaFin.Text = Now.ToString("dd/MM/yyyy")
CargaCombos() CargaCombos()
@@ -120,6 +120,13 @@ Partial Class Agrupecuaria_RepPreciosVentaManifiesto
#Region " GV DATOS - ROW DATABOUND " #Region " GV DATOS - ROW DATABOUND "
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Dif As Decimal = e.Row.DataKey("Diferencia").ToDecimal
If Dif < 0 Then
e.Row.Cells(11).ForeColor = Drawing.Color.Red
e.Row.Cells(12).ForeColor = Drawing.Color.Red
End If
End If
End Sub End Sub
#End Region #End Region

View File

@@ -481,15 +481,16 @@ Public Class ClsOP
Return Retorno Return Retorno
End Function End Function
Public Function GetEstatusOP(CveEmpresa As Integer, Optional CveEstatusOP As Integer = -1, Optional TipoEstatus As Integer = -1, Optional Estatus As Integer = -1) As Boolean Public Function GetEstatusOP(CveEmpresa As Integer, Optional CveEstatusOP As Integer = -1, Optional TipoEstatus As Integer = -1, Optional Estatus As Integer = -1, Optional CveUsuario As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OP_EstatusOPGet") DataAdapter("PA_OP_EstatusOPGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@cveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveEstatusOP", SqlDbType.Int).Value = CveEstatusOP .Add("@cveEstatusOP", SqlDbType.Int).Value = CveEstatusOP
.Add("@TipoEstatus", SqlDbType.Int).Value = TipoEstatus .Add("@tipoEstatus", SqlDbType.Int).Value = TipoEstatus
.Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@estatus", SqlDbType.Int).Value = Estatus
.Add("@cveUsuario", SqlDbType.Int).Value = CveUsuario
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -6224,6 +6224,7 @@ Public Class ClsPaginas
Dim ConfATR2 As String = "" Dim ConfATR2 As String = ""
Dim ObjInv As New ClsGenerales Dim ObjInv As New ClsGenerales
Dim TelDestino As String = "" Dim TelDestino As String = ""
Dim NombreUsuario As String = "" 'Persona que timbro
If ObjInv.GetGralTimbre(CveTimbre, "-1", MinFecha, MaxFecha, -1, UsuarioActual.CveEmpresa, -1) Then If ObjInv.GetGralTimbre(CveTimbre, "-1", MinFecha, MaxFecha, -1, UsuarioActual.CveEmpresa, -1) Then
If ObjInv.DtResultados.Rows.Count > 0 Then If ObjInv.DtResultados.Rows.Count > 0 Then
@@ -6233,6 +6234,7 @@ Public Class ClsPaginas
Telefono = Dr("FiguraTelefono").ToString Telefono = Dr("FiguraTelefono").ToString
TipoDocto = Dr("TipoDocto").ToString TipoDocto = Dr("TipoDocto").ToString
TelDestino = Dr("TelDestino").ToString TelDestino = Dr("TelDestino").ToString
NombreUsuario = Dr("NombreUsuario").ToString
If UsuarioActual.CveEmpresa = 13 Then If UsuarioActual.CveEmpresa = 13 Then
PermisoSCTR1 = Dr("PermisoSCTR1").ToString PermisoSCTR1 = Dr("PermisoSCTR1").ToString
@@ -6629,6 +6631,7 @@ Public Class ClsPaginas
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
params.Add(New ReportParameter("DomicilioFiscal", $"{UsuarioActual.Empresa.Direccion}, {UsuarioActual.Empresa.Colonia}, {UsuarioActual.Empresa.Localidad}, {UsuarioActual.Empresa.Estado}, Tel. {Telefono}")) params.Add(New ReportParameter("DomicilioFiscal", $"{UsuarioActual.Empresa.Direccion}, {UsuarioActual.Empresa.Colonia}, {UsuarioActual.Empresa.Localidad}, {UsuarioActual.Empresa.Estado}, Tel. {Telefono}"))
params.Add(New ReportParameter("SerieFolio", SerieFolio)) params.Add(New ReportParameter("SerieFolio", SerieFolio))
params.Add(New ReportParameter("NombreUsuario", NombreUsuario))
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC)) params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
params.Add(New ReportParameter("DomicilioExpedicion", LugarExpedicion)) params.Add(New ReportParameter("DomicilioExpedicion", LugarExpedicion))
'CLIENTE 'CLIENTE
@@ -11140,7 +11143,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1)
PaginaDict.Add("/Contabilidad/RepBalanceGeneralHorizontal.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/RepBalanceGeneralHorizontal.aspx".ToUpper(), -1)
PaginaDict.Add("/Agropecuaria/CierreCultivo.aspx".ToUpper(), 1326) PaginaDict.Add("/Agropecuaria/CierreCultivo.aspx".ToUpper(), 1326)
PaginaDict.Add("/Agropecuaria/RepPreciosVentaManifiesto.aspx".ToUpper(), -1) PaginaDict.Add("/Agropecuaria/RepPreciosVentaManifiesto.aspx".ToUpper(), 1353)
PaginaDict.Add("/Inventarios/RepRSCO.aspx".ToUpper(), 1328) PaginaDict.Add("/Inventarios/RepRSCO.aspx".ToUpper(), 1328)
PaginaDict.Add("/testApi.aspx".ToUpper(), -1) PaginaDict.Add("/testApi.aspx".ToUpper(), -1)

View File

@@ -3604,7 +3604,7 @@ Namespace Modelos
Exit Select Exit Select
End If End If
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso ValorMultiplicador = -1 Then If ObjFactura.TipoDocto.Contiene("Ing", "Egs") AndAlso ValorMultiplicador = -1 Then
For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows
If row2("CveConceptoContable").ToString().ToEntero = 11 Then If row2("CveConceptoContable").ToString().ToEntero = 11 Then
importeMovimiento = row2("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) importeMovimiento = row2("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
@@ -5732,8 +5732,15 @@ Namespace Modelos
Return Retorno Return Retorno
End If End If
If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then 'If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que el anticipo ha sido amortizado." ' Retorno.Mensaje = "La factura no se puede cancelar debido a que el anticipo ha sido amortizado."
' Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
' Return Retorno
'End If
If UsuarioActual.CveEmpresa <> 119 AndAlso ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAnticipo.RoundSQL(2) <> ObjFactura.SubTotal.RoundSQL(2) Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que el anticipo ha sido aplicado."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
Return Retorno Return Retorno

View File

@@ -209,17 +209,6 @@ Public Class E158 : Implements IHttpHandler, IReadOnlySessionState
ObjVentas.Dispose() ObjVentas.Dispose()
'For Each dRow As DataRow In DTresp.Rows
'Next
'Dim ObjVentas As New ClsVentas
'If ObjVentas.AddPreciosVentaManifiesto() Then
'End If
'ObjVentas.Dispose()
'DTresp.WriteXml("C:\temp\GrowerService\Sales.xml", XmlWriteMode.WriteSchema) 'DTresp.WriteXml("C:\temp\GrowerService\Sales.xml", XmlWriteMode.WriteSchema)

View File

@@ -1587,19 +1587,18 @@ Partial Class PopUpVerFactura
Dim CVEVENTA As Integer = UrlParametros("CVEVENTA").ToString.ToEntero Dim CVEVENTA As Integer = UrlParametros("CVEVENTA").ToString.ToEntero
Dim CVECLIENTE As Integer = UrlParametros("CVECLIENTE").ToString.ToEntero Dim CVECLIENTE As Integer = UrlParametros("CVECLIENTE").ToString.ToEntero
Dim MONTO As Decimal = UrlParametros("MONTO").ToString.ToDecimal Dim MONTO As Decimal = UrlParametros("MONTO").ToString.ToDecimal
Dim TIPO As String = UrlParametros("TIPO").ToString
If CVECLIENTE > 0 AndAlso (CVEIE > 0 Or CVEVENTA > 0) Then If CVECLIENTE > 0 AndAlso (CVEIE > 0 Or CVEVENTA > 0) Then
ImprimirSaldosAmortizacion(CVEVENTAAMORTIZADA, CVEIE, CVEVENTA, CVECLIENTE, MONTO) ImprimirSaldosAmortizacion(TIPO, CVEVENTAAMORTIZADA, CVEIE, CVEVENTA, CVECLIENTE, MONTO)
End If End If
End If End If
End Sub End Sub
Private Sub ImprimirSaldosAmortizacion(CveVentaAmortizada As Integer, CveIE As Integer, CveVenta As Integer, CveCliente As Integer, Monto As Decimal) Private Sub ImprimirSaldosAmortizacion(Tipo As String, CveVentaAmortizada As Integer, CveIE As Integer, CveVenta As Integer, CveCliente As Integer, Monto As Decimal)
Dim ObjMovtos As New ClsMovimientos()
Dim SaldoAntNCDev As Decimal = 0 Dim SaldoAntNCDev As Decimal = 0
Dim DatosSaldoAntNCDev As New DataTable Dim DatosSaldoAntNCDev As New DataTable
Dim TipoDocto As String = "" Dim TipoDocto As String = ""
@@ -1607,36 +1606,22 @@ Partial Class PopUpVerFactura
Dim Saldo As Decimal = 0D Dim Saldo As Decimal = 0D
Dim DTNCVinculadas As New DataTable Dim DTNCVinculadas As New DataTable
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados If Tipo.Contiene("NC", "Ant") Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados.FiltraParametros($"Tipo='{Tipo}' AND CveVenta={CveVenta}")
ElseIf Tipo.Contiene("IxC") Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados.FiltraParametros($"Tipo='{Tipo}' AND CveIE={CveIE}")
End If
End If End If
ObjMovtos.Dispose() ObjMovtos.Dispose()
If DatosSaldoAntNCDev IsNot Nothing AndAlso DatosSaldoAntNCDev.Rows.Count > 0 Then If DatosSaldoAntNCDev IsNot Nothing AndAlso DatosSaldoAntNCDev.Rows.Count > 0 Then
SaldoAntNCDev = If(CveVenta > 0, SaldoAntNCDev = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo").ToDecimal
DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveVenta={CveVenta}").ToDecimal, TipoDocto = DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo")
DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveIE={CveIE}").ToDecimal) Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo").ToDecimal
TipoDocto = If(CveVenta > 0,
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveVenta={CveVenta}"),
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveIE={CveIE}"))
If CveIE > 0 Then
CveVenta = DatosSaldoAntNCDev.FiltroPrimeroValor("CveVenta", $"CveIE={CveIE}").ToEntero
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveIE={CveIE}")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveIE={CveIE}").ToDecimal
Else
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveVenta={CveVenta}")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveVenta={CveVenta}").ToDecimal
End If
End If End If
@@ -1651,30 +1636,53 @@ Partial Class PopUpVerFactura
ObjVentas.Dispose() ObjVentas.Dispose()
End If End If
If TipoDocto.Contiene("IxC") Then
DTNCVinculadas = New DataTable()
DTNCVinculadas.Columns.Add(New DataColumn("SerieFolioEstatus", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("FechaAplicado", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("Moneda", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("TotalNC", GetType(String)))
Dim DtIxC As DataTable = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetRepAnticiposNCIXCDetalle(CveCliente, -1, MinFecha, MaxFecha, UsuarioActual.CveEmpresa, -1, 3, -1, MinFecha, MaxFecha, TipoCambio:=1, TCEspecifico:=-1) Then
DtIxC = ObjVentas.DtResultados.FiltraParametros($"CveIE={CveIE} AND TipoColumna ='Aplicación'")
End If
ObjVentas.Dispose()
If DtIxC IsNot Nothing Then
For Each RowIxC As DataRow In DtIxC.Rows
Dim Row As DataRow = DTNCVinculadas.NewRow
Row("SerieFolioEstatus") = RowIxC("SerieFolioAmortizacion")
Row("FechaAplicado") = RowIxC("FechaAmortizacion")
Row("Moneda") = RowIxC("MonedaAmortizacion")
Row("TotalNC") = RowIxC("ImporteAmortizacion")
DTNCVinculadas.Rows.Add(Row)
Next
End If
End If
If DTNCVinculadas IsNot Nothing Then If DTNCVinculadas IsNot Nothing Then
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("Tipo", Tipo))
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVentaAmortizada, UsuarioActual.CveEmpresa) Then If ObjVentas.GetVenta(CveVentaAmortizada, UsuarioActual.CveEmpresa) Then
Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
If DbRowVenta IsNot Nothing Then If DbRowVenta IsNot Nothing Then
params.Add(New ReportParameter("SerieFolio", DbRowVenta("SerieFolio").ToString)) params.Add(New ReportParameter("SerieFolio", Folio))
params.Add(New ReportParameter("Moneda", DbRowVenta("Moneda").ToString)) params.Add(New ReportParameter("Moneda", DbRowVenta("Moneda").ToString))
params.Add(New ReportParameter("Cliente", DbRowVenta("ClienteNombre").ToString)) params.Add(New ReportParameter("Cliente", DbRowVenta("ClienteNombre").ToString))
End If End If
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToString))

File diff suppressed because it is too large Load Diff

View File

@@ -1091,13 +1091,13 @@
<Width>2.54796cm</Width> <Width>2.54796cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>4.20919cm</Width> <Width>4.01711cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.24876cm</Width> <Width>2.73018cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>6.34152cm</Width> <Width>6.40233cm</Width>
</TablixColumn> </TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
@@ -1258,7 +1258,7 @@
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
<TextAlign>Left</TextAlign> <TextAlign>Center</TextAlign>
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
@@ -1538,7 +1538,7 @@
<TablixMember> <TablixMember>
<Group Name="GPO3" /> <Group Name="GPO3" />
<TablixHeader> <TablixHeader>
<Size>1.68927cm</Size> <Size>1.39994cm</Size>
<CellContents> <CellContents>
<Textbox Name="Cantidad3"> <Textbox Name="Cantidad3">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
@@ -1596,7 +1596,7 @@
<Top>10.58305cm</Top> <Top>10.58305cm</Top>
<Left>0.44227cm</Left> <Left>0.44227cm</Left>
<Height>1.12062cm</Height> <Height>1.12062cm</Height>
<Width>19.07303cm</Width> <Width>19.13385cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
<Style> <Style>
<Border> <Border>
@@ -5381,6 +5381,9 @@
</TablixMember> </TablixMember>
<TablixMember> <TablixMember>
<Group Name="Details" /> <Group Name="Details" />
<Visibility>
<Hidden>=IIF(Fields!MaterialPeligroso.Value = "No",True,False)</Hidden>
</Visibility>
</TablixMember> </TablixMember>
</TablixMembers> </TablixMembers>
</TablixRowHierarchy> </TablixRowHierarchy>
@@ -5992,7 +5995,7 @@ Se ha recibido el número arriba indicado de bultos/contenedores/remolques/autot
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Parameters!UsuarioImprimio.Value</Value> <Value>=Parameters!NombreUsuario.Value</Value>
<Style> <Style>
<FontFamily>Myriad Pro</FontFamily> <FontFamily>Myriad Pro</FontFamily>
<FontSize>7.5pt</FontSize> <FontSize>7.5pt</FontSize>
@@ -7528,6 +7531,9 @@ Se ha recibido el número arriba indicado de bultos/contenedores/remolques/autot
</TablixMember> </TablixMember>
<TablixMember> <TablixMember>
<Group Name="Details2" /> <Group Name="Details2" />
<Visibility>
<Hidden>=IIF(Fields!MaterialPeligroso.Value = "No",True,False)</Hidden>
</Visibility>
</TablixMember> </TablixMember>
</TablixMembers> </TablixMembers>
</TablixRowHierarchy> </TablixRowHierarchy>
@@ -7554,80 +7560,6 @@ Se ha recibido el número arriba indicado de bultos/contenedores/remolques/autot
</Border> </Border>
</Style> </Style>
</Rectangle> </Rectangle>
<Textbox Name="SerieFolio3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!SerieFolio.Value</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>SerieFolio</rd:DefaultName>
<Top>0.67478cm</Top>
<Left>15.20438cm</Left>
<Height>0.6cm</Height>
<Width>3.97474cm</Width>
<ZIndex>12</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="SerieFolio4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value xml:space="preserve"> </Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
<TextRun>
<Value>=Parameters!FechaCertificacion.Value</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>SerieFolio</rd:DefaultName>
<Top>1.45117cm</Top>
<Left>15.20438cm</Left>
<Height>0.6cm</Height>
<Width>3.97474cm</Width>
<ZIndex>13</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems> </ReportItems>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Top>47.03985cm</Top> <Top>47.03985cm</Top>
@@ -8183,6 +8115,12 @@ Se ha recibido el número arriba indicado de bultos/contenedores/remolques/autot
<AllowBlank>true</AllowBlank> <AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
<ReportParameter Name="NombreUsuario">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters> </ReportParameters>
<Code>Function PageNumber() As String <Code>Function PageNumber() As String
Return Me.Report.Globals!OverallPageNumber Return Me.Report.Globals!OverallPageNumber

View File

@@ -3790,7 +3790,7 @@ Partial Class Inventarios_RecepcionAlmacen
End If End If
If CveTipoFechaVencimiento = 2 Then If CveTipoFechaVencimiento = 2 Then
If Not objCompras.UpdateFechaVencimientoCompra(CveCompra, TxtFecha.Text.ToDate, UsuarioActual.CveEmpresa) Then If Not objCompras.UpdateFechaVencimientoCompra(CveCompra, TxtFecha.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
ErrorProceso = True ErrorProceso = True
End If End If
End If End If

View File

@@ -5192,18 +5192,19 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
iniciotipe = column; iniciotipe = column;
int finPercepciones = iniciotipe; int finPercepciones = iniciotipe;
column++;
TitleRange(libro, "Incapacidad", filainicio + 2, column, filainicio + 2, column+2, false, false, PercborderColor);
TitleRange(libro, "Perm. Faltas", filainicio + 3, column, filainicio + 3, column, false, false, PercborderColor);
//column++;
//TitleRange(libro, "Permisos", filainicio + 3, column, filainicio + 3, column, false, false, colororangeblue);
column++; //column++;
TitleRange(libro, "Asistencias", filainicio + 2, column, filainicio + 2, column+2, false, false, colororangeblue); //TitleRange(libro, "Faltas", filainicio + 3, column, filainicio + 3, column, false, false, colororangeblue);
TitleRange(libro, "Incapacidad", filainicio + 3, column, filainicio + 3, column, false, false, colororangeblue); //column++;
column++; //Titlecell(libro, "", filainicio + 4, column, true, true, dedcborderColor);
TitleRange(libro, "Permisos", filainicio + 3, column, filainicio + 3, column, false, false, colororangeblue);
column++;
TitleRange(libro, "Faltas", filainicio + 3, column, filainicio + 3, column, false, false, colororangeblue);
column++;
Titlecell(libro, "", filainicio + 4, column, true, true, dedcborderColor);
libro.Column(column).Width = 15; libro.Column(column).Width = 15;
if (dtConceptos.FiltraParametros("Tipo ='D'").Rows.Count > 0) if (dtConceptos.FiltraParametros("Tipo ='D'").Rows.Count > 0)
{ {
@@ -5397,12 +5398,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
//column++;
//Titlecell(libro, erow["DiasIncapacidad"], Fila, column, false, false, dedcborderColor);
column++; column++;
Titlecell(libro, erow["DiasIncapacidad"], Fila, column, false, false, dedcborderColor); Titlecell(libro, "", Fila, column, false, false, PercborderColor);
column++; //column++;
Titlecell(libro, "0", Fila, column, false, false, dedcborderColor); //Titlecell(libro, erow["DiasFaltados"], Fila, column, false, false, dedcborderColor);
column++;
Titlecell(libro, erow["DiasFaltados"], Fila, column, false, false, dedcborderColor);
if (dtConceptos.FiltraParametros("Tipo ='D'").Rows.Count > 0) if (dtConceptos.FiltraParametros("Tipo ='D'").Rows.Count > 0)
{ {

View File

@@ -279,6 +279,36 @@
padding: 5px; padding: 5px;
margin-top: 10px; margin-top: 10px;
} }
.quantity-control {
position: relative;
display: flex;
align-items: center;
width: 120px;
}
.quantity-input {
width: 70px !important;
padding-right: 30px;
}
.quantity-buttons {
position: absolute;
right: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.btn-quantity {
padding: 0;
width: 22px;
height: 18px;
line-height: 1;
border: 1px solid #ddd;
background: #f8f9fa;
cursor: pointer;
}
</style> </style>
</asp:Content> </asp:Content>
@@ -466,7 +496,8 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="section-title">Productos</div> <div class="section-title">Productos</div>
<asp:GridView ID="GvProductos" runat="server" AutoGenerateColumns="False" <asp:GridView ID="GvProductos" runat="server" AutoGenerateColumns="False"
CssClass="table table-striped table-hover" GridLines="None" Width="100%"> CssClass="table table-striped table-hover" GridLines="None" Width="100%"
OnRowDataBound="GvProductos_RowDataBound">
<Columns> <Columns>
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" /> <asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
<asp:BoundField DataField="UnidadMedida" HeaderText="UM" /> <asp:BoundField DataField="UnidadMedida" HeaderText="UM" />
@@ -754,67 +785,115 @@
<h4 class="modal-title">Finalizar Orden de Producción #<%= LblFolio.Text %></h4> <h4 class="modal-title">Finalizar Orden de Producción #<%= LblFolio.Text %></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- Almacén de Materia Prima (Fijo) --> <!-- Sección de Almacenes -->
<div class="row"> <div class="row">
<div class="col-md-6 form-group"> <!-- Almacén Salida MP -->
<label>Almacén de Salida (Materia Prima):</label> <div class="col-md-4 form-group">
<label>Almacén Salida (MP):</label>
<asp:DropDownList ID="DdlAlmacenOrigenSalidaMP" runat="server" <asp:DropDownList ID="DdlAlmacenOrigenSalidaMP" runat="server"
DataTextField="Almacen" DataValueField="CveAlmacen" DataTextField="Almacen" DataValueField="CveAlmacen"
CssClass="form-control select2me" /> CssClass="form-control select2me" />
</div> </div>
<!-- Almacén de Producto Terminado (Dropdown) -->
<div class="col-md-6 form-group"> <!-- Almacén Entrada PT -->
<label>Almacén de Entrada (Producto Terminado):</label> <div class="col-md-4 form-group">
<label>Almacén Entrada (PT):</label>
<asp:DropDownList ID="DdlAlmacenTerminado" runat="server" <asp:DropDownList ID="DdlAlmacenTerminado" runat="server"
DataTextField="Almacen" DataValueField="CveAlmacen" DataTextField="Almacen" DataValueField="CveAlmacen"
CssClass="form-control select2me" /> CssClass="form-control select2me" />
</div> </div>
<!-- Almacén Devoluciones -->
<div class="col-md-4 form-group">
<label>Almacén Devoluciones:</label>
<asp:DropDownList ID="DdlAlmacenDevolucion" runat="server"
DataTextField="Almacen" DataValueField="CveAlmacen"
CssClass="form-control select2me" />
</div>
</div> </div>
<!-- GridViews -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="section-title">Producto Terminado</div> <div class="section-title">Producto Terminado</div>
<asp:GridView ID="GvProductoTerminado" runat="server" AutoGenerateColumns="False" <asp:GridView ID="GvProductoTerminado" runat="server" AutoGenerateColumns="False"
CssClass="table table-striped table-hover" GridLines="None" Width="100%"> CssClass="table table-striped table-hover" GridLines="None" Width="100%"
OnRowDataBound="GvProductoTerminado_RowDataBound">
<Columns> <Columns>
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" /> <asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
<asp:BoundField DataField="UnidadMedida" HeaderText="UM" /> <asp:BoundField DataField="UnidadMedida" HeaderText="UM" />
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" /> <asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidadPT" runat="server"
Text='<%# Bind("Cantidad") %>'
CssClass="form-control"
TextMode="Number"
min="0"
step="1"
data-original='<%# Eval("Cantidad") %>'
onchange="validarCantidad(this)" />
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
</div>
<div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="section-title">Materia Prima</div> <div class="section-title">Materia Prima</div>
<asp:GridView ID="GvMPUtilizada" runat="server" AutoGenerateColumns="False" <asp:GridView ID="GvMPUtilizada" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePSMateriaPrima, CveUMMateriaPrima"
CssClass="table table-striped table-hover" GridLines="None" Width="100%"> CssClass="table table-striped table-hover" GridLines="None" Width="100%">
<Columns> <Columns>
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" /> <asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" /> <asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" />
<asp:TemplateField HeaderText="Devolución">
<ItemTemplate>
<asp:TextBox ID="TxtDevolucionMP" runat="server"
Text="0"
CssClass="form-control"
TextMode="Number"
min="0"
step="1"
data-original='<%# Eval("Cantidad") %>'
onchange="validarCantidad(this)" />
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<%-- Botón Guardar --%> <asp:Button ID="BtnGuardarFinalizarOP" runat="server" Text="Guardar"
<asp:Button ID="BtnGuardarFinalizarOP" runat="server" Text="Guardar" CssClass="btn btn-primary" OnClick="BtnGuardarFinalizarOP_Click" />
CssClass="btn btn-primary" OnClick="BtnGuardarFinalizarOP_Click" /> <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<%-- Botón Cerrar --%> </div>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
</div> </div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script>
function validarCantidad(input) {
var valor = parseFloat(input.value) || 0;
var maximo = parseFloat(input.getAttribute('data-original')) || 0;
if (valor > maximo) {
input.value = maximo.toFixed(4);
alert("¡La cantidad no puede superar el valor original!");
}
}
</script>
</asp:Content> </asp:Content>

View File

@@ -41,7 +41,15 @@ Partial Class OP_OP
Private Property DtMO As DataTable Private Property DtMO As DataTable
Get Get
Return DirectCast(ViewState("DtMO"), DataTable) If ViewState("DtMO") Is Nothing Then
DtMO = New DataTable()
DtMO.Columns.Add("CvePS", GetType(Integer)) ' Producto asociado
DtMO.Columns.Add("CvePuesto", GetType(Integer))
DtMO.Columns.Add("Puesto", GetType(String))
DtMO.Columns.Add("CostoHora", GetType(Decimal))
DtMO.Columns.Add("Total", GetType(Decimal))
End If
Return CType(ViewState("DtMO"), DataTable)
End Get End Get
Set(value As DataTable) Set(value As DataTable)
ViewState("DtMO") = value ViewState("DtMO") = value
@@ -50,13 +58,31 @@ Partial Class OP_OP
Private Property DtCI As DataTable Private Property DtCI As DataTable
Get Get
Return DirectCast(ViewState("DtCI"), DataTable) If ViewState("DtCI") Is Nothing Then
DtCI = New DataTable()
DtCI.Columns.Add("CvePS", GetType(Integer)) ' Producto asociado
DtCI.Columns.Add("CvePSMateriaPrima", GetType(Integer))
DtCI.Columns.Add("productoMateriaPrima", GetType(String))
DtCI.Columns.Add("Cantidad", GetType(Decimal))
DtCI.Columns.Add("PU", GetType(Decimal))
DtCI.Columns.Add("Total", GetType(Decimal))
End If
Return CType(ViewState("DtCI"), DataTable)
End Get End Get
Set(value As DataTable) Set(value As DataTable)
ViewState("DtCI") = value ViewState("DtCI") = value
End Set End Set
End Property End Property
Private Property TipoEstatus As Integer
Get
Return ViewState("TipoEstatus").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("TipoEstatus") = value
End Set
End Property
Private Property DtMPAgregados As DataTable Private Property DtMPAgregados As DataTable
Get Get
If ViewState("DtMPAgregados") Is Nothing Then If ViewState("DtMPAgregados") Is Nothing Then
@@ -74,12 +100,27 @@ Partial Class OP_OP
End Set End Set
End Property End Property
Private Property DtDevoluciones As DataTable
Get
If ViewState("DtDevoluciones") Is Nothing Then
DtDevoluciones = New DataTable()
DtDevoluciones.Columns.Add("CvePS", GetType(Integer))
DtDevoluciones.Columns.Add("Devolucion", GetType(Decimal))
DtDevoluciones.Columns.Add("CveAlmacenDevolucion", GetType(Integer))
End If
Return CType(ViewState("DtDevoluciones"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDevoluciones") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
CveOP = If(Request("CveOP") <> "", Request("CveOP").ToString.ToEntero, "-1".ToEntero) CveOP = If(Request("CveOP") <> "", Request("CveOP").ToString.ToEntero, "-1".ToEntero)
TipoEstatus = -1
CreaPS() CreaPS()
SetValues() SetValues()
End If End If
@@ -106,6 +147,7 @@ Partial Class OP_OP
DtMP.Columns.Add("UnidadMedida", GetType(String)) DtMP.Columns.Add("UnidadMedida", GetType(String))
DtMP.Columns.Add("Cantidad", GetType(Decimal)) DtMP.Columns.Add("Cantidad", GetType(Decimal))
DtMP.Columns.Add("Surtido", GetType(Decimal)) DtMP.Columns.Add("Surtido", GetType(Decimal))
'DtMP.Columns.Add("CvePSProducto", GetType(Integer))
'DtMP.Columns.Add("CveAlmacenDestino", GetType(Integer)) 'DtMP.Columns.Add("CveAlmacenDestino", GetType(Integer))
DtMO = New DataTable() DtMO = New DataTable()
@@ -115,15 +157,17 @@ Partial Class OP_OP
DtMO.Columns.Add("CvePuesto", GetType(Integer)) DtMO.Columns.Add("CvePuesto", GetType(Integer))
DtMO.Columns.Add("Puesto", GetType(String)) DtMO.Columns.Add("Puesto", GetType(String))
DtMO.Columns.Add("Cantidad", GetType(Decimal)) DtMO.Columns.Add("Cantidad", GetType(Decimal))
DtMO.Columns.Add("CostoHora", GetType(Decimal))
DtMO.Columns.Add("Total", GetType(Decimal))
DtCI = New DataTable() DtCI = New DataTable()
DtCI.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI DtCI.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI
DtCI.Columns.Add("Clave", GetType(Integer)) DtCI.Columns.Add("Clave", GetType(Integer))
'DtCI.Columns.Add("CveUM", GetType(Integer))
'DtCI.Columns.Add("CvePSMateriaPrima", GetType(Integer))
'DtCI.Columns.Add("CveUMMateriaPrima", GetType(Integer))
DtCI.Columns.Add("productoMateriaPrima", GetType(String)) DtCI.Columns.Add("productoMateriaPrima", GetType(String))
DtCI.Columns.Add("Cantidad", GetType(Decimal)) DtCI.Columns.Add("Cantidad", GetType(Decimal))
DtCI.Columns.Add("PU", GetType(Decimal))
DtCI.Columns.Add("Total", GetType(Decimal))
End Sub End Sub
@@ -133,24 +177,65 @@ Partial Class OP_OP
CargarClientes() CargarClientes()
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1)
CargarProductos() CargarProductos()
CargaDatos()
If CveOP = -1 Then If TipoEstatus = 3 Then
DeshabilitarControles() ' Deshabilita todos los controles relevantes
DdlClientes.Enabled = True
DdlProyecto.Enabled = True
DdlSubProyecto.Enabled = True
DdlPS.Enabled = True
LnkSolicitarMP.Visible = False
BtnSimularMP.Visible = True
BtnFinalizarOP.Visible = False
Else Else
DdlClientes.Enabled = False If CveOP = -1 Then ' Nueva OP
DdlPS.Enabled = False DdlClientes.Enabled = True
LnkSolicitarMP.Visible = False DdlProyecto.Enabled = True
BtnSimularMP.Visible = False DdlSubProyecto.Enabled = True
BtnFinalizarOP.Visible = True DdlPS.Enabled = True
CargaDatos() TxtEstatus.Enabled = True ' Estatus no editable
LnkSolicitarMP.Visible = False
BtnSimularMP.Visible = True
BtnFinalizarOP.Visible = False
Else ' OP existente no finalizada
If TipoEstatus <> 3 Then
DdlClientes.Enabled = True
DdlProyecto.Enabled = True
DdlSubProyecto.Enabled = True
DdlPS.Enabled = True
TxtDescripcion.Enabled = True
Txtfecha.Enabled = True
TxtEstatus.Enabled = True ' Estatus no editable
BtnAgregarProducto.Enabled = True
BtnSimularMP.Visible = False
BtnGuardarOP.Enabled = True
BtnFinalizarOP.Visible = True
imgCalendarioF.Enabled = True
LnkSolicitarMP.Visible = True
End If
End If
End If End If
UpOP.Update()
UpGvDatosOP.Update()
End Sub
Private Sub DeshabilitarControles()
' Deshabilitar DropDownLists
DdlClientes.Enabled = False
DdlProyecto.Enabled = False
DdlSubProyecto.Enabled = False
DdlPS.Enabled = False
' Deshabilitar TextBox y Date
TxtDescripcion.Enabled = False
Txtfecha.Enabled = False
imgCalendarioF.Enabled = False
TxtEstatus.Enabled = False
' Ocultar Botones
BtnAgregarProducto.Visible = False
BtnSimularMP.Visible = False
BtnGuardarOP.Visible = False
BtnFinalizarOP.Visible = False
LnkSolicitarMP.Visible = False
UpOP.Update()
UpGvDatosOP.Update()
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
@@ -169,6 +254,7 @@ Partial Class OP_OP
DdlPS.txtValue.Value = dr("CvePS").ToString DdlPS.txtValue.Value = dr("CvePS").ToString
Txtfecha.Text = dr("Fecha").ToString Txtfecha.Text = dr("Fecha").ToString
TxtDescripcion.Text = dr("Descripcion").ToString TxtDescripcion.Text = dr("Descripcion").ToString
TipoEstatus = dr("TipoEstatus").ToString.ToEntero
If ObjOP.GetProductosOP(CveOP, UsuarioActual.CveEmpresa) Then If ObjOP.GetProductosOP(CveOP, UsuarioActual.CveEmpresa) Then
@@ -221,7 +307,7 @@ Partial Class OP_OP
Dim newRow As DataRow = DtCI.NewRow() Dim newRow As DataRow = DtCI.NewRow()
newRow("Tipo") = "CI" newRow("Tipo") = "CI"
newRow("productoMateriaPrima") = rowCI("producto").ToString newRow("productoMateriaPrima") = rowCI("producto").ToString
newRow("Cantidad") = rowCI("Cantidad").ToString.ToDecimal newRow("Costo") = rowCI("Costo").ToString.ToDecimal
DtCI.Rows.Add(newRow) DtCI.Rows.Add(newRow)
Next Next
@@ -292,6 +378,7 @@ Partial Class OP_OP
rowMP("PSCodigo") = drMP("productoMateriaPrima").ToString() rowMP("PSCodigo") = drMP("productoMateriaPrima").ToString()
rowMP("UnidadMedida") = drMP("UnidadMedidaMateriaPrima").ToString() rowMP("UnidadMedida") = drMP("UnidadMedidaMateriaPrima").ToString()
rowMP("Cantidad") = drMP("Cantidad").ToString().ToDecimal() rowMP("Cantidad") = drMP("Cantidad").ToString().ToDecimal()
'rowMP("CvePSProducto") = CvePS
rowMP("Surtido") = 0 rowMP("Surtido") = 0
DtMP.Rows.Add(rowMP) DtMP.Rows.Add(rowMP)
Next Next
@@ -306,6 +393,8 @@ Partial Class OP_OP
rowMO("Clave") = CvePS rowMO("Clave") = CvePS
rowMO("Puesto") = drMO("Puesto").ToString() rowMO("Puesto") = drMO("Puesto").ToString()
rowMO("Cantidad") = drMO("Cantidad").ToString().ToDecimal() rowMO("Cantidad") = drMO("Cantidad").ToString().ToDecimal()
rowMO("CostoHora") = drMO("precioHora").ToString.ToDecimal()
rowMO("Total") = drMO("Cantidad").ToString().ToDecimal() * drMO("precioHora").ToString().ToDecimal()
DtMO.Rows.Add(rowMO) DtMO.Rows.Add(rowMO)
Next Next
End If End If
@@ -321,6 +410,8 @@ Partial Class OP_OP
'rowCI("CvePSMateriaPrima") = drCI("CvePSMateriaPrima").ToString().ToEntero() 'rowCI("CvePSMateriaPrima") = drCI("CvePSMateriaPrima").ToString().ToEntero()
rowCI("productoMateriaPrima") = drCI("productoMateriaPrima").ToString() rowCI("productoMateriaPrima") = drCI("productoMateriaPrima").ToString()
rowCI("Cantidad") = drCI("Cantidad").ToString().ToDecimal() rowCI("Cantidad") = drCI("Cantidad").ToString().ToDecimal()
rowCI("PU") = drCI("ImporteCostoIndirecto").ToString().ToDecimal()
rowCI("Total") = rowCI("Cantidad").ToString().ToDecimal() * rowCI("PU").ToString().ToDecimal()
DtCI.Rows.Add(rowCI) DtCI.Rows.Add(rowCI)
Next Next
End If End If
@@ -329,6 +420,12 @@ Partial Class OP_OP
End Sub End Sub
Protected Sub BtnEliminarProducto_Click(sender As Object, e As EventArgs) Protected Sub BtnEliminarProducto_Click(sender As Object, e As EventArgs)
' Verificar si la OP está finalizada
If TxtEstatus.Text = "Finalizada" Then
Alert("No se pueden eliminar productos de una OP finalizada.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim btnEliminar As LinkButton = DirectCast(sender, LinkButton) Dim btnEliminar As LinkButton = DirectCast(sender, LinkButton)
Dim CveProducto As Integer = btnEliminar.CommandArgument.ToEntero() Dim CveProducto As Integer = btnEliminar.CommandArgument.ToEntero()
@@ -361,6 +458,13 @@ Partial Class OP_OP
Next Next
End Sub End Sub
Protected Sub GvProductos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProductos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim btnEliminar As LinkButton = DirectCast(e.Row.FindControl("BtnEliminar"), LinkButton)
btnEliminar.Visible = (TipoEstatus <> 3)
End If
End Sub
Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs) Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs)
' Cargar almacenes ' Cargar almacenes
DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1") DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
@@ -560,16 +664,16 @@ Partial Class OP_OP
Dim MensajeExistencia As New StringBuilder Dim MensajeExistencia As New StringBuilder
MensajeExistencia.Append("No hay la existencia suficiente de los siguientes productos:<br/>") MensajeExistencia.Append("No hay la existencia suficiente de los siguientes productos:<br/>")
'✅ 1. Validar existencias de MP
For Each row As GridViewRow In GvMPAgregados.Rows For Each row As GridViewRow In GvMPAgregados.Rows
'✅ Obtener claves CORRECTAS de la materia prima
Dim CveMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString().ToEntero() Dim CveMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString().ToEntero()
Dim CveUMMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString().ToEntero() Dim CveUMMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString().ToEntero()
Dim CantidadSolicitada As Decimal = DtMP.Rows(row.RowIndex)("Cantidad").ToString().ToDecimal() Dim CantidadSolicitada As Decimal = DtMP.Rows(row.RowIndex)("Cantidad").ToString().ToDecimal()
'DtMP.Rows(row.RowIndex)("CveAlmacenDestino") = DdlAlmacenDestinoMP.SelectedValue.ToEntero()
'✅ Verificar existencias
Dim Existencia As Decimal = ObjInventario.GetExistenciasPS( Dim Existencia As Decimal = ObjInventario.GetExistenciasPS(
CvePS:=CveMP, CvePS:=CveMP,
CveUnidadMedida:=CveUMMP, CveUnidadMedida:=CveUMMP,
@@ -596,7 +700,7 @@ Partial Class OP_OP
Exit Sub Exit Sub
End If End If
'✅ 2. Crear traspaso si todo está correcto
ObjInventario.IniciaTransacSQL() ObjInventario.IniciaTransacSQL()
Dim TieneError As Boolean = False Dim TieneError As Boolean = False
@@ -618,10 +722,10 @@ Partial Class OP_OP
TieneError = True TieneError = True
End If End If
'✅ 3. Agregar detalles del traspaso
If Not TieneError Then If Not TieneError Then
For Each row As GridViewRow In GvMPAgregados.Rows For Each row As GridViewRow In GvMPAgregados.Rows
'✅ Usar claves de MATERIA PRIMA (CvePSMateriaPrima y CveUMMateriaPrima)
Dim CveMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString().ToEntero() Dim CveMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString().ToEntero()
Dim CveUMMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString().ToEntero() Dim CveUMMP As Integer = GvMPAgregados.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString().ToEntero()
Dim Cantidad As Decimal = DtMP.Rows(row.RowIndex)("Cantidad").ToString().ToDecimal() Dim Cantidad As Decimal = DtMP.Rows(row.RowIndex)("Cantidad").ToString().ToDecimal()
@@ -629,8 +733,8 @@ Partial Class OP_OP
If Not ObjInventario.AddTrasladoSolicitudDetalle( If Not ObjInventario.AddTrasladoSolicitudDetalle(
CveTraspasoSolicitud, CveTraspasoSolicitud,
Cantidad, Cantidad,
CveUMMP, '✅ Unidad de medida de la MP CveUMMP,
CveMP, '✅ Clave de la MP CveMP,
0, "", -1, "-1", "-1", MinFecha 0, "", -1, "-1", "-1", MinFecha
) Then ) Then
TieneError = True TieneError = True
@@ -639,7 +743,7 @@ Partial Class OP_OP
Next Next
End If End If
'✅ 4. Confirmar o cancelar transacción
If Not TieneError Then If Not TieneError Then
ObjInventario.Commit() ObjInventario.Commit()
Alert($"Solicitud de Traspaso guardada. Folio: <b>{FolioSolicitud}</b>", TipoMensaje.MsgInformacion) Alert($"Solicitud de Traspaso guardada. Folio: <b>{FolioSolicitud}</b>", TipoMensaje.MsgInformacion)
@@ -786,18 +890,35 @@ Partial Class OP_OP
End Sub End Sub
Protected Sub DdlAlmacenOrigenMP_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlAlmacenOrigenMP_SelectedIndexChanged(sender As Object, e As EventArgs)
' ✅ Mantener siempre el almacén de producción (tipo 28) en destino
DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28") DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28")
DdlAlmacenDestinoMP.DataBind() DdlAlmacenDestinoMP.DataBind()
' ✅ Opcional: Seleccionar el primer almacén de producción por defecto
If DdlAlmacenDestinoMP.Items.Count > 0 Then If DdlAlmacenDestinoMP.Items.Count > 0 Then
DdlAlmacenDestinoMP.SelectedIndex = 0 DdlAlmacenDestinoMP.SelectedIndex = 0
End If End If
End Sub End Sub
#Region "Eventos de Botones" Protected Sub GvProductoTerminado_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim originalQty As Decimal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Cantidad"))
Dim txtCantidad As TextBox = DirectCast(e.Row.FindControl("TxtCantidadPT"), TextBox)
txtCantidad.Attributes("data-original") = originalQty.ToString("0")
End If
End Sub
Protected Sub GvMPUtilizada_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim originalQty As Decimal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Cantidad"))
Dim txtDevolucion As TextBox = DirectCast(e.Row.FindControl("TxtDevolucionMP"), TextBox)
txtDevolucion.Attributes("data-original") = originalQty.ToString("0")
End If
End Sub
#Region "Finalizar"
Protected Sub BtnFinalizarOP_Click(sender As Object, e As EventArgs) Protected Sub BtnFinalizarOP_Click(sender As Object, e As EventArgs)
If CveOP = -1 Then Exit Sub If CveOP = -1 Then Exit Sub
@@ -811,6 +932,11 @@ Partial Class OP_OP
DdlAlmacenTerminado.DataBind() DdlAlmacenTerminado.DataBind()
DdlAlmacenTerminado.Items.Insert(0, New ListItem("Seleccionar almacén", "-1")) DdlAlmacenTerminado.Items.Insert(0, New ListItem("Seleccionar almacén", "-1"))
' Almacén de Devoluciones (Tipo 1)
DdlAlmacenDevolucion.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
DdlAlmacenDevolucion.DataBind()
DdlAlmacenDevolucion.Items.Insert(0, New ListItem("Seleccionar almacén", "-1"))
' 3. Cargar GridViews ' 3. Cargar GridViews
GvProductoTerminado.DataSource = DtPS.FiltraParametros("Tipo = 'Producto'") GvProductoTerminado.DataSource = DtPS.FiltraParametros("Tipo = 'Producto'")
GvProductoTerminado.DataBind() GvProductoTerminado.DataBind()
@@ -823,15 +949,42 @@ Partial Class OP_OP
End Sub End Sub
Protected Sub BtnGuardarFinalizarOP_Click(sender As Object, e As EventArgs) Protected Sub BtnGuardarFinalizarOP_Click(sender As Object, e As EventArgs)
Dim EstatusFinalizar As String = GlobalDTOPEstatus(UsuarioActual.CveEmpresa).FiltroPrimeroValor("EstatusOP", "TipoEstatus=3")
Dim CveEstatusFinalizar As Integer = GlobalDTOPEstatus(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOP", "TipoEstatus=3").ToEntero()
If Not CveEstatusFinalizar > 0 Then
Alert("No se encontró el estatus de finalización de la OP.", TipoMensaje.MsgError)
Exit Sub
End If
If DdlAlmacenOrigenSalidaMP.SelectedValue = "-1" OrElse DdlAlmacenTerminado.SelectedValue = "-1" Then If DdlAlmacenOrigenSalidaMP.SelectedValue = "-1" OrElse DdlAlmacenTerminado.SelectedValue = "-1" Then
Alert("Selecciona ambos almacenes.", TipoMensaje.MsgAdvertencia) Alert("Selecciona ambos almacenes.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
' Dim TotalCantidad As Decimal = DtMovimientos.SUMD("Cantidad") For Each row As GridViewRow In GvProductoTerminado.Rows
'Inicia la transacción Dim txtCantidad As TextBox = DirectCast(row.FindControl("TxtCantidadPT"), TextBox)
Dim cantidadIngresada As Decimal = txtCantidad.Text.ToDecimal()
Dim cantidadOriginal As Decimal = txtCantidad.Attributes("data-original").ToDecimal()
Dim CveMovimientoSalida As Integer = 0 If cantidadIngresada > cantidadOriginal Then
Alert("La cantidad del producto terminado no puede superar lo solicitado.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
For Each row As GridViewRow In GvMPUtilizada.Rows
Dim txtDevolucion As TextBox = DirectCast(row.FindControl("TxtDevolucionMP"), TextBox)
Dim devolucionIngresada As Decimal = txtDevolucion.Text.ToDecimal()
Dim cantidadOriginal As Decimal = txtDevolucion.Attributes("data-original").ToDecimal()
If devolucionIngresada > cantidadOriginal Then
Alert("La devolución no puede superar la cantidad de materia prima solicitada.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
Dim CveMovimientoSalida As Integer = 1
Dim CveMovimientoEntrada As Integer = 0 Dim CveMovimientoEntrada As Integer = 0
Dim IDPoliza As Integer = 0 Dim IDPoliza As Integer = 0
Dim FolioSalida As Integer = 0 Dim FolioSalida As Integer = 0
@@ -844,8 +997,13 @@ Partial Class OP_OP
Dim ErrorMovInv As Boolean = False Dim ErrorMovInv As Boolean = False
Dim TextoError As String = "" Dim TextoError As String = ""
Dim TipoMovimientoSalida As Integer = 8 Dim TipoMovimientoSalida As Integer = 8
Dim TipoMovimientoDev As Integer = 33
Dim CveConceptoEntrada As Integer = 9 Dim CveConceptoEntrada As Integer = 9
Dim TotalCostoMP As Decimal = 0 Dim TotalCostoMP As Decimal = 0
'Dim TotalDevoluciones As Decimal = 0
Dim CveMovimientoDev As Integer = 0
Dim CostoDevoluciones As Decimal = 0
Dim ObjInventario As New ClsInventarios() Dim ObjInventario As New ClsInventarios()
@@ -855,16 +1013,102 @@ Partial Class OP_OP
Try Try
CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigenSalidaMP.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPSalida") CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigenSalidaMP.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPSalida")
FolioEntrada = ObjInventario.Folio
Dim DtMPAlmacen As DataTable = Nothing
If CveMovimientoSalida > 0 Then If CveMovimientoSalida > 0 Then
For Each rowMP As DataRow In DtMP.Select("Tipo = 'MP'")
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, rowMP("Cantidad").ToString.ToDecimal(), rowMP("CveUMMateriaPrima").ToString.ToEntero(), rowMP("CvePSMateriaPrima").ToString.ToEntero(), 1) Then For Each rowMP As DataRow In DtMP.Select("Tipo = 'MP'")
ErrorMovInv = True : TextoError = "x" : Exit For Dim CvePS As Integer = rowMP("CvePSMateriaPrima").ToString.ToEntero
Dim CveUM As Integer = rowMP("CveUMMateriaPrima").ToString.ToEntero
Dim Cantidad As Decimal = rowMP("Cantidad").ToString.ToDecimal
' Registrar detalle
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, 0) Then
ErrorMovInv = True
Exit For
End If End If
Next Next
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
TotalCostoMP = ObjInventario.DtResultados.SUMD("Total") If Not ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Throw New Exception("Error al cargar detalles del inventario")
End If
DtMPAlmacen = ObjInventario.DtResultados.Copy()
' 5. Calcular TotalCostoMP (ya está actualizado)
TotalCostoMP = ObjInventario.DtResultados.SUMD("Total")
Dim CostosPorProducto As New Dictionary(Of Integer, Decimal)
' 1. Recorrer cada Producto Terminado en la OP
For Each rowProducto As DataRow In DtPS.Select("Tipo = 'Producto'")
Dim CvePSProducto As Integer = rowProducto("Clave").ToString.ToEntero()
Dim CantidadProducto As Decimal = rowProducto("Cantidad").ToString.ToDecimal()
Dim TotalMPProducto As Decimal = 0
Dim TotalMOProducto As Decimal = 0
Dim TotalCIProducto As Decimal = 0
' 2. Calcular Costo de Materias Primas por Producto
For Each rowMP As DataRow In DtMP.Select($"Clave = {CvePSProducto}")
Dim CvePSMP As Integer = rowMP("CvePSMateriaPrima").ToString.ToEntero()
Dim CveUMMP As Integer = rowMP("CveUMMateriaPrima").ToString.ToEntero()
Dim PU As Decimal = DtMPAlmacen.FiltroPrimeroValor("PU", $"CvePS = {CvePSMP} AND CveUM = {CveUMMP}").ToDecimal()
TotalMPProducto += rowMP("Cantidad").ToString().ToDecimal() * PU
Next
' 3. Calcular Mano de Obra por Producto
For Each rowMO As DataRow In DtMO.Select($"Clave = {CvePSProducto}")
TotalMOProducto += rowMO("Total").ToString.ToDecimal()
Next
' 4. Calcular Costos Indirectos por Producto
For Each rowCI As DataRow In DtCI.Select($"Clave = {CvePSProducto}")
TotalCIProducto += rowCI("Total").ToString.ToDecimal()
Next
' 5. Sumar Total por Producto (MP + MO + CI)
Dim TotalProducto As Decimal = TotalMPProducto + TotalMOProducto + TotalCIProducto
CostosPorProducto.Add(CvePSProducto, TotalProducto)
Next
' 2. PROCESAR DEVOLUCIONES SI EXISTEN
If Not ErrorMovInv Then
Dim TotalDevoluciones As Decimal = GvMPUtilizada.Rows.Cast(Of GridViewRow)().Sum(Function(row) DirectCast(row.FindControl("TxtDevolucionMP"), TextBox).Text.ToDecimal())
If TotalDevoluciones > 0 Then
If DdlAlmacenDevolucion.SelectedValue = "-1" Then
Alert("Seleccione almacén para devoluciones", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
CveMovimientoDev = ObjInventario.AddMovimiento(DdlAlmacenDevolucion.SelectedValue.ToEntero(), TipoMovimientoDev, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=$"Devolución OP #{LblFolio.Text}", Modulo:="OP/Devoluciones", CveMovimientoRelacionado:=CveMovimientoSalida)
If CveMovimientoDev > 0 Then
For Each row As GridViewRow In GvMPUtilizada.Rows
Dim Devolucion As Decimal = row.FCTextBox("TxtDevolucionMP").Text.ToDecimal()
If Devolucion > 0 Then
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero 'GvMPUtilizada.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString.ToEntero()
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero 'GvMPUtilizada.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString.ToEntero()
Dim PU As Decimal = DtMPAlmacen.FiltroPrimeroValor("PU", $"CvePS = {CvePS} AND CveUM = {CveUM}").ToDecimal()
If Not ObjInventario.AddMovimientoDetalle(
CveMovimientoDev,
Devolucion,
CveUM,
CvePS,
PU
) Then
ErrorMovInv = True
End If
CostoDevoluciones += Devolucion * PU
End If
Next
End If
End If
End If End If
If Not ErrorMovInv Then If Not ErrorMovInv Then
@@ -872,8 +1116,9 @@ Partial Class OP_OP
End If End If
If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then
Dim CantidadPT As Decimal = DtPS.AsEnumerable().Sum(Function(row) Convert.ToDecimal(row("Cantidad"))) Dim CostoPTAjustado As Decimal = TotalCostoMP - CostoDevoluciones
Dim PU_PT As Decimal = If(CantidadPT > 0, TotalCostoMP / CantidadPT, 1) Dim CantidadPT As Decimal = DtPS.AsEnumerable().Sum(Function(r) r.Field(Of Decimal)("Cantidad"))
Dim PU_PT As Decimal = If(CantidadPT > 0, CostoPTAjustado / CantidadPT, 0)
For Each rowPT As DataRow In DtPS.Select("Tipo = 'Producto'") For Each rowPT As DataRow In DtPS.Select("Tipo = 'Producto'")
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, rowPT("Cantidad").ToString.ToDecimal(), rowPT("CveUM").ToString.ToEntero(), rowPT("Clave").ToString.ToEntero(), PU_PT) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, rowPT("Cantidad").ToString.ToDecimal(), rowPT("CveUM").ToString.ToEntero(), rowPT("Clave").ToString.ToEntero(), PU_PT) Then
@@ -889,24 +1134,24 @@ Partial Class OP_OP
ErrorMovInv = True ErrorMovInv = True
End If End If
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalCostoMP, TotalCostoMP, 68, "Producción PT OP #" & LblFolio.Text, "Producción PT OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovimientoEntrada) Then If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, CostoPTAjustado, CostoPTAjustado, 68, "Producción PT OP #" & LblFolio.Text, "Producción PT OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovimientoEntrada) Then
ErrorMovInv = True ErrorMovInv = True
End If End If
If Not ErrorMovInv Then
If Not ObjOP.UpdateEstatusOP(CveOP, 3, UsuarioActual.CveEmpresa) Then
ErrorMovInv = True : TextoError = "Error al actualizar estatus de la OP"
End If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, CostoDevoluciones, CostoDevoluciones, 95, "", $"OP #{LblFolio.Text}", CveMovimientoAlmacen:=CveMovimientoDev)
End If
'If Not ErrorMovInv Then 'If Not ErrorMovInv Then
' If Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then 'If Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then
' ErrorMovInv = True : TextoError = "Error en validación de póliza" 'ErrorMovInv = True : TextoError = "Error en validación de póliza"
' ElseIf ObjConta.ValorPolizaDescuadre > 0 Then 'ElseIf ObjConta.ValorPolizaDescuadre > 0 Then
' ErrorMovInv = True : TextoError = "Descuadre en póliza contable" ' ErrorMovInv = True : TextoError = "Descuadre en póliza contable"
' End If 'End If
'End If 'End If
End If End If
End If End If
@@ -914,16 +1159,32 @@ Partial Class OP_OP
If Not ErrorMovInv Then If Not ErrorMovInv Then
ObjInventario.Commit() If ObjOP.UpdateEstatusOP(CveOP, CveEstatusFinalizar, UsuarioActual.CveEmpresa) Then
Alert($"Orden de producción finalizada. ObjInventario.Commit()
<br/><a class='Texto' href='/Inventarios/EntradasSalidas.aspx?CveMovimiento= {CveMovimientoEntrada}'>{ObjInventario.Folio}</a> ", TipoMensaje.MsgInformacion) TxtEstatus.Text = EstatusFinalizar
DeshabilitarControles()
UpOP.Update()
UpGvDatosOP.Update()
Alert("Orden de producción finalizada.<br/>" & "<a class='Texto' href='/Inventarios/EntradasSalidas.aspx?CveMovimiento=" & CveMovimientoEntrada & "'>" & FolioEntrada & "</a>",
TipoMensaje.MsgInformacion)
RegistraScript("$('#DVModalFinalizarOP').modal('hide');")
Else
ObjInventario.RollBack()
Alert("Error al actualizar el estatus.", TipoMensaje.MsgError)
End If
Else Else
ObjInventario.RollBack() ObjInventario.RollBack()
Alert($"Error contable: {TextoError}", TipoMensaje.MsgError) Alert($"Error contable: {TextoError}", TipoMensaje.MsgError)
End If End If
RegistraScript("$('#DVModalFinalizarOP').modal('hide');")
CargaDatos()
Catch ex As Exception Catch ex As Exception
ObjInventario.RollBack() ObjInventario.RollBack()
@@ -933,7 +1194,6 @@ Partial Class OP_OP
ObjConta.Dispose() ObjConta.Dispose()
End Try End Try
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@@ -2601,16 +2601,27 @@ Partial Class Clientes
If tPagare = 0 Then InformacionCompleta = False If tPagare = 0 Then InformacionCompleta = False
End If End If
If TxtContacto.Text.Trim() = "" Then InformacionCompleta = False
If TxtTelefono.Text.Trim() = "" Then InformacionCompleta = False If TxtTelefono.Text.Trim() = "" Then InformacionCompleta = False
If TxtEmail.Text.Trim() = "" Then InformacionCompleta = False If TxtEmail.Text.Trim() = "" Then InformacionCompleta = False
If TxtRepresentanteLegal.Text.Trim() = "" Then InformacionCompleta = False
tPagare = 0 'valida que cuando menos tenga una cuenta 'SOLO VALIDA EN CLIENTES FRENCUENTE
For Each dRow As GridViewRow In GvBancosCuentas.Rows If DdlTipoCliente.SelectedValue = "1" Then
tPagare = 1 If TxtContacto.Text.Trim() = "" Then InformacionCompleta = False
Next If TxtRepresentanteLegal.Text.Trim() = "" Then InformacionCompleta = False
If tPagare = 0 Then InformacionCompleta = False 'si es el concepto de pagaré
Dim tPagare As Integer = 0
For Each dRow As GridViewRow In GvDocumentosCliente.Rows
Dim CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToEntero()
If CveDocumentacion = 265 Then tPagare = 1
Next
If tPagare = 0 Then InformacionCompleta = False
tPagare = 0 'valida que cuando menos tenga una cuenta
For Each dRow As GridViewRow In GvBancosCuentas.Rows
tPagare = 1
Next
If tPagare = 0 Then InformacionCompleta = False
End If
'If DivInfoCompleta.Visible Then 'If DivInfoCompleta.Visible Then
' InformacionCompleta = ChkInformacionCompleta.Checked ' InformacionCompleta = ChkInformacionCompleta.Checked

View File

@@ -706,7 +706,7 @@
<asp:CheckBox ID="ChkSobFaltante" runat="server" ClientIDMode="Static" /> <asp:CheckBox ID="ChkSobFaltante" runat="server" ClientIDMode="Static" />
<div class="input-icon" style="margin-left: 20px;"> <div class="input-icon" style="margin-left: 20px;">
<i style="margin: 0px;">$</i> <i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox> <asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm" onkeyup="ValidaSobranteFaltante()" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," /> <ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
</div> </div>
</div> </div>
@@ -1591,7 +1591,7 @@
} else { } else {
$get("TxtFaltante").value = FormatoNumero(cambio); $get("TxtFaltante").value = FormatoNumero(cambio);
$get("ChkSobFaltante").checked = true; $get("ChkSobFaltante").checked = true;
$get("TxtCambio").value = FormatoNumero(cambio); $get("TxtCambio").value = "";
} }
} else { } else {
@@ -1617,15 +1617,26 @@
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total)); $('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
} }
function ValidaSobranteFaltante() {
if (ToDouble($get("TxtFaltante").value) > 1) {
alert("El sobrante/faltante no debe ser mayor a 1");
$get("TxtFaltante").value = "";
$get("ChkSobFaltante").checked = false;
} else {
$get("ChkSobFaltante").checked = true;
}
}
function CargaSobranteFaltante() { function CargaSobranteFaltante() {
$('#ChkSobFaltante').change(function () { $('#ChkSobFaltante').change(function () {
if (this.checked == true) { if (this.checked == true) {
if (ToDouble($get("TxtCambio").value) > 1) { if (ToDouble($get("TxtCambio").value) > 1) {
alert("El sobrante/faltante no debe ser mayor a 1") alert("El sobrante/faltante no debe ser mayor a 1")
$get("ChkSobFaltante").checked = false;
} else { } else {
$get("TxtFaltante").value = $get("TxtCambio").value; $get("TxtFaltante").value = $get("TxtCambio").value;
} }
} }
else { else {
$get("TxtFaltante").value = ""; $get("TxtFaltante").value = "";

View File

@@ -607,6 +607,11 @@ Partial Class Ventas_PVCobranza
Alert("No hay importe para sobrante/faltante", TipoMensaje.MsgAdvertencia) Alert("No hay importe para sobrante/faltante", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Else
If TxtFaltante.Text.ToDecimal() <> 0 Then
Alert("No debe especificar sobrante/faltante", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If End If
'validaciones 'validaciones
@@ -1024,12 +1029,12 @@ Partial Class Ventas_PVCobranza
If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}", msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&TIPO={5}",
dr("CveIE").ToString, dr("CveIE").ToString,
dr("CveVenta").ToString, dr("CveVenta").ToString,
respFactura.Factura.CveCliente, respFactura.Factura.CveCliente,
respFactura.CveVenta, respFactura.CveVenta,
respFactura.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>") respFactura.Factura.Total, dr("Tipo")))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next Next
End If End If
@@ -1064,12 +1069,12 @@ Partial Class Ventas_PVCobranza
If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}", msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&Tipo={5}",
dr("CveIE").ToString, dr("CveIE").ToString,
dr("CveVenta").ToString, dr("CveVenta").ToString,
respNC.Factura.CveCliente, respNC.Factura.CveCliente,
respNC.CveVenta, respNC.CveVenta,
respNC.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>") respNC.Factura.Total, dr("Tipo")))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next Next
End If End If
@@ -1444,22 +1449,6 @@ Partial Class Ventas_PVCobranza
For Each msg In Retorno.Mensajes For Each msg In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", msg) SbAlert.AppendFormat("{0} <br/>", msg)
Next Next
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
For Each dr As DataRow In DtAnticipos.Rows
SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
Retorno.Factura.CveCliente,
Retorno.CveVenta,
Retorno.Factura.Total,
(Retorno.Factura.Total - Retorno.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>")
Next
SbAlert.Append(SBAmortizaciones.ToString)
Else Else
SbAlert.Append("Ocurrió un error al generar la factura") SbAlert.Append("Ocurrió un error al generar la factura")
End If End If
@@ -1601,7 +1590,6 @@ Partial Class Ventas_PVCobranza
Dim Importe = GvRowAnticipo.FCTextBox(String.Format("TxtAnticipo{0}", GvRowAnticipo.RowIndex)).Text.ToDecimal() Dim Importe = GvRowAnticipo.FCTextBox(String.Format("TxtAnticipo{0}", GvRowAnticipo.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRowAnticipo.DataKey("CveConceptoContable").ToEntero() Dim CveConceptoContable = GvRowAnticipo.DataKey("CveConceptoContable").ToEntero()
Dim FolioFiscal = GvRowAnticipo.DataKey("FolioFiscal") Dim FolioFiscal = GvRowAnticipo.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRowAnticipo.DataKey("Descuentos").ToDecimal() Dim Descuentos As Decimal = GvRowAnticipo.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRowAnticipo.DataKey("TotalAnticipo").ToDecimal() Dim TotalAnticipo As Decimal = GvRowAnticipo.DataKey("TotalAnticipo").ToDecimal()
@@ -1612,8 +1600,10 @@ Partial Class Ventas_PVCobranza
Dim Folio = GvRowAnticipo.DataKey("Folio") Dim Folio = GvRowAnticipo.DataKey("Folio")
Dim Tipo = GvRowAnticipo.DataKey("Tipo") Dim Tipo = GvRowAnticipo.DataKey("Tipo")
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo) DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
ObjNC.Observaciones = $"Folio: {GvRowAnticipo.DataKey("Folio")}"
End If End If
ObjNC.EsNCAmortizacion = True ObjNC.EsNCAmortizacion = True
@@ -1708,12 +1698,14 @@ Partial Class Ventas_PVCobranza
'METER LO QUE FALTA COMO GASTO 'METER LO QUE FALTA COMO GASTO
If (ImporteBancos.RoundSQL(2) + Math.Abs(SobranteFaltante)) = ImporteAbonoVenta.RoundSQL(2) Then If (ImporteBancos.RoundSQL(2) + Math.Abs(SobranteFaltante)) = ImporteAbonoVenta.RoundSQL(2) Then
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal() Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
'LIMPIAR SOBRANTE/FALTANTE
SobranteFaltante = 0
'SUMAR AL PAGO 'SUMAR AL PAGO
If ImporteBancos < ImporteAbonoVenta Then If ImporteBancos < ImporteAbonoVenta Then
ImporteBancos += Math.Abs(SobranteFaltante) ImporteBancos += Math.Abs(SobranteFaltante)
End If End If
'LIMPIAR SOBRANTE/FALTANTE
SobranteFaltante = 0
End If End If
End If End If
@@ -2469,9 +2461,9 @@ Partial Class Ventas_PVCobranza
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado")) Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
'If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
' AnticipoAutorizado = True AnticipoAutorizado = True
'End If End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then

View File

@@ -5255,7 +5255,7 @@ Partial Class Ventas
If TienePermiso <> "" Then ' si tiene acceso en el subproyecto If TienePermiso <> "" Then ' si tiene acceso en el subproyecto
'LkNotaCredito.Visible = UsuarioActual.TienePermisoProceso(175) 'LkNotaCredito.Visible = UsuarioActual.TienePermisoProceso(175)
If UsuarioActual.TienePermisoProceso(264) Then If UsuarioActual.TienePermisoProceso(264) Then
InicializaAplicaDevolucion(TmpDT) InicializaAplicaDevolucion(TmpDT, DbRowVenta("Fecha").ToString().ToDateTime())
End If End If
End If End If
@@ -32863,7 +32863,7 @@ Partial Class Ventas
#End Region #End Region
#Region " APLICA DEVOLUCION " #Region " APLICA DEVOLUCION "
Private Sub InicializaAplicaDevolucion(DtDetalle As DataTable) Private Sub InicializaAplicaDevolucion(DtDetalle As DataTable, FechaVenta As DateTime)
'If Not UsuarioActual.CveUsuario = 100 Then 'If Not UsuarioActual.CveUsuario = 100 Then
' If Not UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 140, 141, 146) Then ' If Not UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 140, 141, 146) Then
' Exit Sub ' Exit Sub
@@ -32875,7 +32875,17 @@ Partial Class Ventas
Exit Sub Exit Sub
End If End If
LBAplicaDevolucion.Visible = True If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If FechaVenta.ToShortDateString.ToDate < Now.ToShortDateString.ToDate Then
LBAplicaDevolucion.Visible = True
Else
LBAplicaDevolucion.Visible = False
End If
Else
LBAplicaDevolucion.Visible = True
End If
'SOLO APLICA DEVOLUCION SI TIENE MOVIMIENTOS DE ALMACEN 'SOLO APLICA DEVOLUCION SI TIENE MOVIMIENTOS DE ALMACEN
'If VentaSaldoAlmacen < 0 Then 'If VentaSaldoAlmacen < 0 Then