-- APLICA DEVOLUCIONES DESDE COMRPAS
-- AGREGADO DE APLICASERIE
This commit is contained in:
@@ -1496,8 +1496,22 @@
|
||||
</div>
|
||||
|
||||
<div class="tools">
|
||||
<table width="325px">
|
||||
<table width="525px">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="DivAlmacenDev" runat="server" visible="false" class="row">
|
||||
<div class="col-md-12">
|
||||
<table width="175px">
|
||||
<tr>
|
||||
<td width="50px">Almacen:</td>
|
||||
<td width="125px">
|
||||
<asp:DropDownList ID="DdlAlmacenDevolucion" Style="width: 100%" AutoPostBack="true" runat="server" CssClass="form-control input-sm select2me " DataTextField="Almacen" DataValueField="CveAlmacen"></asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td width="50px">Compra:</td>
|
||||
<td width="250px">
|
||||
<asp:DropDownList ID="DDLDevolucion" Style="width: 100%" AutoPostBack="true" runat="server" CssClass="form-control input-sm select2me " DataTextField="Compra" DataValueField="CveCompra"></asp:DropDownList>
|
||||
@@ -1509,31 +1523,17 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<div id="DivAlmacenDev" runat="server" visible="false" class="row">
|
||||
<div class="col-md-12">
|
||||
<table width="325px">
|
||||
<tr>
|
||||
<td width="50px">Almacen:</td>
|
||||
<td width="250px">
|
||||
<asp:DropDownList ID="DdlAlmacenDevolucion" Style="width: 100%" AutoPostBack="true" runat="server" CssClass="form-control input-sm select2me " DataTextField="Almacen" DataValueField="CveAlmacen"></asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<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">
|
||||
<div class="portlet-body">
|
||||
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,CodigoPS,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" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" Text='<%# Eval("Cantidad", "{0:#,##0.####}")%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="80px" />
|
||||
<asp:BoundField ItemStyle-Width="400px" HeaderText="Producto o Servicio" DataField="CodigoPS" />
|
||||
<asp:TemplateField ItemStyle-Width="80px" HeaderText="P.U." ItemStyle-HorizontalAlign="Right">
|
||||
<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="70px" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" />
|
||||
<asp:TemplateField ItemStyle-Width="85px" HeaderText="P.U." ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Label Text='<%# Eval("PU", "{0:#,##0.####}")%>' runat="server"></asp:Label>
|
||||
</ItemTemplate>
|
||||
@@ -1541,7 +1541,7 @@
|
||||
<label>Total</label>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="80px" HeaderText="Devolución">
|
||||
<asp:TemplateField ItemStyle-Width="85px" HeaderText="Devolución">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidad" Width="50" Mask="999,999.99" min="0" data-max='<%# Eval("Cantidad")%>' data-pu='<%# Eval("PU")%>' type="number" step="any" data-Devolucion="devrow" runat="server"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
@@ -1549,7 +1549,7 @@
|
||||
<asp:TextBox ID="TxtTotal" Width="50" runat="server" Mask="999,999.99" data-Devolucion="devtotal" disabled></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="80px" HeaderText="">
|
||||
<asp:TemplateField ItemStyle-Width="85px" HeaderText="">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtTotalDevolucion" CssClass="devTotal TextBoxAsLabel" runat="server" Text="" disabled></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -1688,10 +1688,8 @@ Partial Class Compras_Compras
|
||||
'End If
|
||||
End If
|
||||
|
||||
'SE OCUPAN AFUERA DEL POSTBACK ??
|
||||
cargaddlVinculacionServcios()
|
||||
'SE OCUPAN AFUERA DEL POSTBACK ??
|
||||
If UsuarioActual.TienePermisoProceso(117) Then
|
||||
|
||||
HplAddClasificacion.Visible = False
|
||||
ImgClasificacion.Visible = False
|
||||
End If
|
||||
@@ -2011,6 +2009,8 @@ Partial Class Compras_Compras
|
||||
SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL
|
||||
|
||||
If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaSerie") Then TmpDT.Columns.Add(New DataColumn("AplicaSerie", GetType(Boolean)) With {.DefaultValue = False})
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add(New DataColumn("AplicaLote", GetType(Boolean)) With {.DefaultValue = False})
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add(New DataColumn("AplicaCaducidad", GetType(Boolean)) With {.DefaultValue = False})
|
||||
If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
|
||||
@@ -3081,19 +3081,15 @@ 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("AplicaSerie") Then TmpDT.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
|
||||
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 Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
|
||||
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
@@ -4272,22 +4268,8 @@ Partial Class Compras_Compras
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Vinculacion De Servcios"
|
||||
Private Function isAdminObraGluyas() As Boolean
|
||||
Return (UsuarioActual.CveRol = 1047 And UsuarioActual.CveEmpresa = 66)
|
||||
End Function
|
||||
Private Sub cargaddlVinculacionServcios()
|
||||
If isAdminObraGluyas() Then
|
||||
TabVinculacionServicios.Visible = True
|
||||
'Dim productos As New ClsProductosServicios
|
||||
'If productos.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
' PSDTRemplazo = productos.DtResultados.FiltraParametros("CveTipoPS=2", "PS")
|
||||
'End If
|
||||
'productos.Dispose()
|
||||
GVVinculacionServicios.DataSource = TmpDT
|
||||
GVVinculacionServicios.DataBind()
|
||||
End If
|
||||
End Sub
|
||||
#Region "Vinculacion De Servicios"
|
||||
|
||||
Protected Sub GVVinculacionServicios_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVVinculacionServicios.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim dt As DataTable = Nothing
|
||||
@@ -4447,7 +4429,7 @@ Partial Class Compras_Compras
|
||||
Dim CapitalMiltiple As Decimal = GvRow.FCTextBox("TxtCapital").Text.ToDecimal
|
||||
Dim InteresMiltiple As Decimal = GvRow.FCTextBox("TxtInteres").Text.ToDecimal
|
||||
|
||||
Dim AmbosMiltiple As Decimal = GvRow.FCTextBox("TxtAmbos").Text.ToDecimal
|
||||
Dim AmbosMultiple As Decimal = GvRow.FCTextBox("TxtAmbos").Text.ToDecimal
|
||||
Dim MensualidadMultiple As Decimal = GvRow.DataKey("Mensualidad").ToDecimal
|
||||
|
||||
If CapitalMiltiple > 0 Or InteresMiltiple > 0 Then
|
||||
@@ -4456,9 +4438,9 @@ Partial Class Compras_Compras
|
||||
MensualidadMultipleTotal = MensualidadMultipleTotal + MensualidadMultiple
|
||||
'CveUltimoCreditoDetalleInterno = GvRow.DataKey("CveCreditoDetalle").ToEntero
|
||||
|
||||
ElseIf AmbosMiltiple > 0 Then
|
||||
ElseIf AmbosMultiple > 0 Then
|
||||
|
||||
TotalCreditos = TotalCreditos + AmbosMiltiple
|
||||
TotalCreditos = TotalCreditos + AmbosMultiple
|
||||
MensualidadMultipleTotal = MensualidadMultipleTotal + MensualidadMultiple
|
||||
'CveUltimoCreditoDetalleInterno = GvRow.DataKey("CveCreditoDetalle").ToEntero
|
||||
EstatusCredito = GvRow.DataKey("Estatus").ToEntero
|
||||
@@ -5623,275 +5605,278 @@ Partial Class Compras_Compras
|
||||
' If DdlMoneda.SelectedValue.ToEntero = 1 Or (DdlMoneda.SelectedValue.ToEntero > 1 AndAlso GlobalTipoCambio(TxtFecha.Text.ToDate) > 0) Then
|
||||
|
||||
''ALMACEN CONSIGNACION
|
||||
If CveConsignacion > 0 AndAlso CveCompraRefacturacion <= 0 Then
|
||||
If DdlTipoComprobante.SelectedValue = "Fac" Then
|
||||
|
||||
'actualizamos cvecompraconsignacion
|
||||
For Each gvr As GridViewRow In GvInv.Rows
|
||||
If gvr.FCCheckBox("cbinv").Checked AndAlso gvr.FCHiddenField("HdnCveConsignacion").Value.ToEntero > 0 Then
|
||||
If Not ObjInventario.UpdateConsignacionesCompra(CveCompra, gvr.FCHiddenField("HdnCveConsignacion").Value.ToEntero, gvr.FCHiddenField("HdnCveAlmacen").Value.ToEntero, gvr.FCHiddenField("HdnCvePS").Value.ToEntero, gvr.DataKey("Cantidad").ToDecimal, UsuarioActual.CveEmpresa) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
If CveConsignacion > 0 AndAlso CveCompraRefacturacion <= 0 Then
|
||||
|
||||
'actualizamos cvecompraconsignacion
|
||||
For Each gvr As GridViewRow In GvInv.Rows
|
||||
If gvr.FCCheckBox("cbinv").Checked AndAlso gvr.FCHiddenField("HdnCveConsignacion").Value.ToEntero > 0 Then
|
||||
If Not ObjInventario.UpdateConsignacionesCompra(CveCompra, gvr.FCHiddenField("HdnCveConsignacion").Value.ToEntero, gvr.FCHiddenField("HdnCveAlmacen").Value.ToEntero, gvr.FCHiddenField("HdnCvePS").Value.ToEntero, gvr.DataKey("Cantidad").ToDecimal, UsuarioActual.CveEmpresa) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
|
||||
Dim x As Integer = 0
|
||||
For Each dr As DataRow In DtInv.Rows
|
||||
If GvInv.Rows(x).FCCheckBox("cbInv").Checked And GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble > 0 Then
|
||||
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dr("Consec").ToString.ToEntero}")(0) 'Charlie
|
||||
TmpDr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero 'Charlie
|
||||
|
||||
dr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlealmacen").SelectedValue.ToEntero
|
||||
dr("Cantidad") = GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble
|
||||
Else
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dr("Consec").ToString.ToEntero}")(0) 'Charlie
|
||||
TmpDr("CveAlmacen") = 0 'Charlie
|
||||
|
||||
dr("CveAlmacen") = 0
|
||||
End If
|
||||
x = x + 1
|
||||
Next
|
||||
|
||||
Dim cvemovimientosalida As Integer = 0
|
||||
Dim cvemovimientoentrada As Integer = 0
|
||||
Dim cvemovimientosalidagasto As Integer = 0
|
||||
Dim folio As Integer = 0
|
||||
Dim fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim indice As Integer = 0
|
||||
Dim importeconcepto As Decimal = 0
|
||||
|
||||
Dim listalmacenes As List(Of Integer) = (From cvealmacen In DtInv.AsEnumerable() Where cvealmacen.Field(Of Integer)("cvealmacen") > 0 Select cvealmacen.Field(Of Integer)("cvealmacen")).Distinct().ToList
|
||||
|
||||
For Each tcvealmacen As Integer In listalmacenes
|
||||
|
||||
Dim ObsGDiaz As String = If(EsGrupoDiaz, TxtObsFact.Text, "")
|
||||
|
||||
If GvInv.Rows(indice).FCDropDownList("ddlrecibirinv").SelectedValue = "1" Then
|
||||
Continue For
|
||||
End If
|
||||
indice += 1
|
||||
|
||||
'agregamos la entrada
|
||||
If Not UsuarioActual.Empresa.UsaAC Then fecha = NowADS()
|
||||
|
||||
folio = ObjInventario.GetFolioSiguiente(2, UsuarioActual.CveEmpresa)
|
||||
cvemovimientoentrada = ObjInventario.AddMovimiento(tcvealmacen, 2, 1, fecha, folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), Modulo:="Comp/G4", Observaciones:=ObsGDiaz)
|
||||
If cvemovimientoentrada <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
Else
|
||||
CveMovimientoInventario = cvemovimientoentrada
|
||||
ListaMovimientosAlmacen.Add(CveMovimientoInventario)
|
||||
|
||||
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, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
'agregamos la salida
|
||||
folio = ObjInventario.GetFolioSiguiente(3, UsuarioActual.CveEmpresa)
|
||||
cvemovimientosalidagasto = ObjInventario.AddMovimiento(tcvealmacen, 3, DdlMoneda.SelectedValue.ToEntero, fecha.AddSeconds(1), folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G3", Observaciones:=ObsGDiaz)
|
||||
If cvemovimientosalidagasto <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
Else
|
||||
If ObjInventario.GetMovimientosDetalle(cvemovimientoentrada, UsuarioActual.CveEmpresa) Then
|
||||
For Each dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
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
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
''ALMACEN NORMAL
|
||||
Else
|
||||
|
||||
'OBTIENE ALMACENES
|
||||
Dim x As Integer = 0
|
||||
For Each dr As DataRow In DtInv.Rows
|
||||
If GvInv.Rows(x).FCCheckBox("cbInv").Checked And GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble > 0 Then
|
||||
For Each Dr As DataRow In DtInv.Rows
|
||||
If GvInv.Rows(x).FCCheckBox("cbInv").Checked And GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDecimal > 0 Then
|
||||
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dr("Consec").ToString.ToEntero}")(0) 'Charlie
|
||||
TmpDr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero 'Charlie
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {Dr("Consec").ToString.ToEntero}")(0)
|
||||
TmpDr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero
|
||||
|
||||
dr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlealmacen").SelectedValue.ToEntero
|
||||
dr("Cantidad") = GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble
|
||||
Else
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dr("Consec").ToString.ToEntero}")(0) 'Charlie
|
||||
TmpDr("CveAlmacen") = 0 'Charlie
|
||||
Dr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero
|
||||
Dr("Cantidad") = GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble
|
||||
|
||||
dr("CveAlmacen") = 0
|
||||
Else 'limpio el valor para que no truene en linq mas abajo
|
||||
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {Dr("Consec").ToString.ToEntero}")(0)
|
||||
TmpDr("CveAlmacen") = 0
|
||||
|
||||
Dr("CveAlmacen") = 0
|
||||
End If
|
||||
x = x + 1
|
||||
Next
|
||||
|
||||
Dim cvemovimientosalida As Integer = 0
|
||||
Dim cvemovimientoentrada As Integer = 0
|
||||
Dim cvemovimientosalidagasto As Integer = 0
|
||||
Dim folio As Integer = 0
|
||||
Dim fecha As Date = TxtFecha.Text.ToDate
|
||||
Dim i As Integer = 0
|
||||
Dim ListAlmacenes As List(Of Integer) = (From CveAlmacen In DtInv.AsEnumerable() Where CveAlmacen.Field(Of Integer)("CveAlmacen") > 0 Select CveAlmacen.Field(Of Integer)("CveAlmacen")).Distinct().ToList
|
||||
Dim indice As Integer = 0
|
||||
Dim importeconcepto As Decimal = 0
|
||||
Dim ImporteConcepto As Decimal = 0
|
||||
Dim tCveFolioGarantia As Integer = -1
|
||||
Dim tCveEntregaAlmacen As Integer = -1
|
||||
Dim CveConceptoMovimiento As Integer = 2
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then 'cuando es empresa acumuladora
|
||||
'apoyo logistico/garantia
|
||||
If DdlTipoCompra.SelectedValue = "12" Then 'garantía
|
||||
CveConceptoMovimiento = 13
|
||||
tCveFolioGarantia = DdlFolioGarantia.SelectedValue.ToEntero
|
||||
End If
|
||||
''recolección
|
||||
'If DdlTipoCompra.SelectedValue = "14" Then 'recolección
|
||||
' CveConceptoMovimiento = 42
|
||||
' tCveEntregaAlmacen = DdlRecoleccion.SelectedValue.ToEntero
|
||||
'End If
|
||||
End If
|
||||
|
||||
Dim listalmacenes As List(Of Integer) = (From cvealmacen In DtInv.AsEnumerable() Where cvealmacen.Field(Of Integer)("cvealmacen") > 0 Select cvealmacen.Field(Of Integer)("cvealmacen")).Distinct().ToList
|
||||
|
||||
For Each tcvealmacen As Integer In listalmacenes
|
||||
If (DdlTipoComprobante.SelectedValue = "Fac" AndAlso CveCompraRefacturacion <= 0) OrElse CveConceptoMovimiento = 13 Then
|
||||
|
||||
Dim ObsGDiaz As String = If(EsGrupoDiaz, TxtObsFact.Text, "")
|
||||
|
||||
If GvInv.Rows(indice).FCDropDownList("ddlrecibirinv").SelectedValue = "1" Then
|
||||
Continue For
|
||||
End If
|
||||
indice += 1
|
||||
For Each tCveAlmacen As Integer In ListAlmacenes
|
||||
If GvInv.Rows(indice).FCDropDownList("DdlRecibirInv").SelectedValue = "1" Then
|
||||
Continue For
|
||||
End If
|
||||
indice += 1
|
||||
|
||||
'agregamos la entrada
|
||||
If Not UsuarioActual.Empresa.UsaAC Then fecha = NowADS()
|
||||
Dim fecha As Date = TxtFecha.Text.ToDate
|
||||
If Not UsuarioActual.Empresa.UsaAC Then fecha = NowADS()
|
||||
|
||||
folio = ObjInventario.GetFolioSiguiente(2, UsuarioActual.CveEmpresa)
|
||||
cvemovimientoentrada = ObjInventario.AddMovimiento(tcvealmacen, 2, 1, fecha, folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), Modulo:="Comp/G4", Observaciones:=ObsGDiaz)
|
||||
If cvemovimientoentrada <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
Else
|
||||
CveMovimientoInventario = cvemovimientoentrada
|
||||
ListaMovimientosAlmacen.Add(CveMovimientoInventario)
|
||||
CveMovimientoInventario = ObjInventario.AddMovimiento(tCveAlmacen, CveConceptoMovimiento, 1, fecha, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), CveFolioGarantia:=tCveFolioGarantia, Modulo:="Comp/G2", CveEntregaAlmacen:=tCveEntregaAlmacen, Observaciones:=ObsGDiaz)
|
||||
|
||||
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, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
'agregamos la salida
|
||||
folio = ObjInventario.GetFolioSiguiente(3, UsuarioActual.CveEmpresa)
|
||||
cvemovimientosalidagasto = ObjInventario.AddMovimiento(tcvealmacen, 3, DdlMoneda.SelectedValue.ToEntero, fecha.AddSeconds(1), folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G3", Observaciones:=ObsGDiaz)
|
||||
If cvemovimientosalidagasto <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
Else
|
||||
If ObjInventario.GetMovimientosDetalle(cvemovimientoentrada, UsuarioActual.CveEmpresa) Then
|
||||
For Each dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
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
|
||||
If CveMovimientoInventario <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
|
||||
Dim DtDetalle As New DataTable
|
||||
Dim DtEquivalencias As DataTable
|
||||
Dim CveProducto As Integer
|
||||
Dim CantidadInv As Decimal
|
||||
Dim PUInv As Decimal
|
||||
Dim CveUnidad As Integer
|
||||
Dim CostoIndirecto As Decimal
|
||||
Dim tDescuento As Decimal = 0
|
||||
|
||||
ListaMovimientosAlmacen.Add(CveMovimientoInventario)
|
||||
|
||||
Dim contadorAlamcen As Integer = 0
|
||||
For Each Dr As DataRow In DtInv.Rows
|
||||
|
||||
CveProducto = Dr("CvePS").ToString.ToEntero
|
||||
CveUnidad = Dr("CveUM").ToString.ToEntero
|
||||
CantidadInv = Dr("Cantidad").ToString.ToDecimal
|
||||
PUInv = Dr("PU").ToString.ToDecimal
|
||||
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 = If(Dr("AplicaLote").ToString.Trim = "", False, Boolean.Parse(Dr("AplicaLote").ToString))
|
||||
Dim AplicaCaducidad As Boolean = If(Dr("AplicaCaducidad").ToString.Trim = "", False, 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
|
||||
|
||||
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) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
'UNIDAD BASE - EQUIVALENCIAS - INVENTARIO
|
||||
If UsuarioActual.CveEmpresa = 1 Then
|
||||
DtEquivalencias = New DataTable
|
||||
DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa)
|
||||
Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero
|
||||
Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'")
|
||||
|
||||
'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE)
|
||||
If CveUnidadBase <> CveUnidad Then
|
||||
' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA
|
||||
CantidadInv = Dr("Cantidad").ToString.ToDecimal * drUMBase("Cantidad").ToString.ToDecimal / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDecimal
|
||||
PUInv = PUInv * Dr("Cantidad").ToString.ToDecimal / CantidadInv
|
||||
CostoIndirecto = CostoIndirecto * Dr("Cantidad").ToString.ToDecimal / CantidadInv
|
||||
CveUnidad = CveUnidadBase
|
||||
End If
|
||||
End If
|
||||
ImporteConcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, PUInv, PUInv * TipoCambioGuardar) - If(DdlMoneda.SelectedValue.ToEntero = 1, tDescuento, tDescuento * TipoCambioGuardar)
|
||||
'si no es por serie lote
|
||||
ImporteConcepto = If(UsuarioActual.Empresa.UsaAC, ImporteConcepto * IVA, ImporteConcepto)
|
||||
If Dr("CveAlmacen").ToString.ToEntero = tCveAlmacen Then
|
||||
|
||||
If AplicaLote And Lote.Trim = "" Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere Lote.", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
If AplicaCaducidad And FechaCaducidad <= MinFecha Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere fecha de caducidad.", TipoMensaje.MsgAdvertencia)
|
||||
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
|
||||
contadorAlamcen = contadorAlamcen + 1
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
''ALMACEN NORMAL
|
||||
Else
|
||||
|
||||
'OBTIENE ALMACENES
|
||||
Dim x As Integer = 0
|
||||
For Each Dr As DataRow In DtInv.Rows
|
||||
If GvInv.Rows(x).FCCheckBox("cbInv").Checked And GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDecimal > 0 Then
|
||||
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {Dr("Consec").ToString.ToEntero}")(0)
|
||||
TmpDr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero
|
||||
|
||||
Dr("CveAlmacen") = GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero
|
||||
Dr("Cantidad") = GvInv.Rows(x).FCTextBox("TbCantidad").Text.ToDouble
|
||||
|
||||
Else 'limpio el valor para que no truene en linq mas abajo
|
||||
|
||||
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {Dr("Consec").ToString.ToEntero}")(0)
|
||||
TmpDr("CveAlmacen") = 0
|
||||
|
||||
Dr("CveAlmacen") = 0
|
||||
End If
|
||||
x = x + 1
|
||||
Next
|
||||
|
||||
Dim i As Integer = 0
|
||||
Dim ListAlmacenes As List(Of Integer) = (From CveAlmacen In DtInv.AsEnumerable() Where CveAlmacen.Field(Of Integer)("CveAlmacen") > 0 Select CveAlmacen.Field(Of Integer)("CveAlmacen")).Distinct().ToList
|
||||
Dim indice As Integer = 0
|
||||
Dim ImporteConcepto As Decimal = 0
|
||||
Dim tCveFolioGarantia As Integer = -1
|
||||
Dim tCveEntregaAlmacen As Integer = -1
|
||||
Dim CveConceptoMovimiento As Integer = 2
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then 'cuando es empresa acumuladora
|
||||
'apoyo logistico/garantia
|
||||
If DdlTipoCompra.SelectedValue = "12" Then 'garantía
|
||||
CveConceptoMovimiento = 13
|
||||
tCveFolioGarantia = DdlFolioGarantia.SelectedValue.ToEntero
|
||||
End If
|
||||
''recolección
|
||||
'If DdlTipoCompra.SelectedValue = "14" Then 'recolección
|
||||
' CveConceptoMovimiento = 42
|
||||
' tCveEntregaAlmacen = DdlRecoleccion.SelectedValue.ToEntero
|
||||
'End If
|
||||
End If
|
||||
|
||||
If (DdlTipoComprobante.SelectedValue = "Fac" AndAlso CveCompraRefacturacion <= 0) OrElse CveConceptoMovimiento = 13 Then
|
||||
|
||||
Dim ObsGDiaz As String = If(EsGrupoDiaz, TxtObsFact.Text, "")
|
||||
|
||||
For Each tCveAlmacen As Integer In ListAlmacenes
|
||||
If GvInv.Rows(indice).FCDropDownList("DdlRecibirInv").SelectedValue = "1" Then
|
||||
Continue For
|
||||
End If
|
||||
indice += 1
|
||||
|
||||
Dim fecha As Date = TxtFecha.Text.ToDate
|
||||
If Not UsuarioActual.Empresa.UsaAC Then fecha = NowADS()
|
||||
|
||||
CveMovimientoInventario = ObjInventario.AddMovimiento(tCveAlmacen, CveConceptoMovimiento, 1, fecha, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), CveFolioGarantia:=tCveFolioGarantia, Modulo:="Comp/G2", CveEntregaAlmacen:=tCveEntregaAlmacen, Observaciones:=ObsGDiaz)
|
||||
|
||||
If CveMovimientoInventario <= 0 Then
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
|
||||
Dim DtDetalle As New DataTable
|
||||
Dim DtEquivalencias As DataTable
|
||||
Dim CveProducto As Integer
|
||||
Dim CantidadInv As Decimal
|
||||
Dim PUInv As Decimal
|
||||
Dim CveUnidad As Integer
|
||||
Dim CostoIndirecto As Decimal
|
||||
Dim tDescuento As Decimal = 0
|
||||
|
||||
ListaMovimientosAlmacen.Add(CveMovimientoInventario)
|
||||
|
||||
Dim contadorAlamcen As Integer = 0
|
||||
For Each Dr As DataRow In DtInv.Rows
|
||||
|
||||
CveProducto = Dr("CvePS").ToString.ToEntero
|
||||
CveUnidad = Dr("CveUM").ToString.ToEntero
|
||||
CantidadInv = Dr("Cantidad").ToString.ToDecimal
|
||||
PUInv = Dr("PU").ToString.ToDecimal
|
||||
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 = If(Dr("AplicaLote").ToString.Trim = "", False, Boolean.Parse(Dr("AplicaLote").ToString))
|
||||
Dim AplicaCaducidad As Boolean = If(Dr("AplicaCaducidad").ToString.Trim = "", False, 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
|
||||
|
||||
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) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
'UNIDAD BASE - EQUIVALENCIAS - INVENTARIO
|
||||
If UsuarioActual.CveEmpresa = 1 Then
|
||||
DtEquivalencias = New DataTable
|
||||
DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa)
|
||||
Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero
|
||||
Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'")
|
||||
|
||||
'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE)
|
||||
If CveUnidadBase <> CveUnidad Then
|
||||
' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA
|
||||
CantidadInv = Dr("Cantidad").ToString.ToDecimal * drUMBase("Cantidad").ToString.ToDecimal / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDecimal
|
||||
PUInv = PUInv * Dr("Cantidad").ToString.ToDecimal / CantidadInv
|
||||
CostoIndirecto = CostoIndirecto * Dr("Cantidad").ToString.ToDecimal / CantidadInv
|
||||
CveUnidad = CveUnidadBase
|
||||
End If
|
||||
End If
|
||||
ImporteConcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, PUInv, PUInv * TipoCambioGuardar) - If(DdlMoneda.SelectedValue.ToEntero = 1, tDescuento, tDescuento * TipoCambioGuardar)
|
||||
'si no es por serie lote
|
||||
ImporteConcepto = If(UsuarioActual.Empresa.UsaAC, ImporteConcepto * IVA, ImporteConcepto)
|
||||
If Dr("CveAlmacen").ToString.ToEntero = tCveAlmacen Then
|
||||
|
||||
If AplicaLote And Lote.Trim = "" Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere Lote.", TipoMensaje.MsgAdvertencia)
|
||||
Exit For
|
||||
End If
|
||||
If AplicaCaducidad And FechaCaducidad <= MinFecha Then
|
||||
ErrorMovInv = True
|
||||
Alert($"Porducto {CodigoPS} requiere fecha de caducidad.", TipoMensaje.MsgAdvertencia)
|
||||
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
|
||||
|
||||
|
||||
''insertar en prepólizas
|
||||
If CveMovimientoAlmacen > 0 Then
|
||||
Dim tImporte As Decimal
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoAlmacen, UsuarioActual.CveEmpresa) Then
|
||||
tImporte = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, tImporte, tImporte, 68, ObjInventario.Folio.ToString, ObjInventario.Folio.ToString, CveMovimientoAlmacen:=CveMovimientoInventario)
|
||||
End If
|
||||
i = i + 1
|
||||
contadorAlamcen = contadorAlamcen + 1
|
||||
Next
|
||||
|
||||
''insertar en prepólizas
|
||||
If CveMovimientoAlmacen > 0 Then
|
||||
Dim tImporte As Decimal
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoAlmacen, UsuarioActual.CveEmpresa) Then
|
||||
tImporte = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, tImporte, tImporte, 68, ObjInventario.Folio.ToString, ObjInventario.Folio.ToString, CveMovimientoAlmacen:=CveMovimientoInventario)
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If AplicarCostoIndirecto(ObjInventario, ObjCompras) Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
If AplicarCostoIndirecto(ObjInventario, ObjCompras) Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
'*************************************************** P R I M E R A P A R T E C O M P R A S **************************************************************************************************************************************************************************************************************************************************************************************************
|
||||
@@ -6816,7 +6801,7 @@ Partial Class Compras_Compras
|
||||
Dim RegistroCuentaPuente As Boolean = False
|
||||
'NC CON PRODUCTOS - CUENTA PUENTE
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "NC" And DdlTipoCompra.SelectedValue.Contiene("9", "12") Then
|
||||
If DdlTipoComprobante.SelectedValue = "NC" AndAlso DdlTipoCompra.SelectedValue.Contiene("9", "12") Then
|
||||
RegistraConcepto225 = True
|
||||
End If
|
||||
|
||||
@@ -6835,15 +6820,14 @@ Partial Class Compras_Compras
|
||||
If Devolucion IsNot Nothing AndAlso Devolucion.DebeRealizarDevolucion AndAlso Devolucion.CveMovimiento > 0 Then
|
||||
ConceptoContabilizacionNC = 68
|
||||
CveMovimientoDevolucion = Devolucion.CveMovimiento
|
||||
importeMovimiento = TmpDT.SUM("Total")
|
||||
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
|
||||
End If
|
||||
'cuando es garantía.
|
||||
If DdlTipoCompra.SelectedValue.Contiene("12", "14") Then
|
||||
ConceptoContabilizacionNC = 259
|
||||
End If
|
||||
If DdlTipoCompra.SelectedValue.Contiene("12", "14") Then ConceptoContabilizacionNC = 259
|
||||
|
||||
Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}"
|
||||
|
||||
|
||||
If importeMovimiento > 0 Or TxtTotal.Text.ToDecimal = 0 Then
|
||||
RegistroCuentaPuente = True
|
||||
Dim ImporteTransito As Decimal = 0
|
||||
@@ -6861,8 +6845,6 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Dim importeMNTemp As Decimal = 0
|
||||
Dim CveCompraAmortizacion As Integer = -1
|
||||
|
||||
@@ -6881,19 +6863,15 @@ Partial Class Compras_Compras
|
||||
ImporteTransito += importeMNTemp
|
||||
CveCompraAmortizacion = Gvr.DataKey("CveCompra").ToEntero
|
||||
'se registra por cada compra relacionada
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
If importeMNTemp > 0 Then
|
||||
'importeMNTemp = importeMNTemp - TxtDescuento.Text.ToDecimal
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMNTemp, importeMNTemp, ConceptoContabilizacionNC, Referencia, Concepto, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraAmortizacion, CveProveedor:=CveProveedorConcepto, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'si se marca que no se va a recibir, falta validación
|
||||
If Not ErrorMovInv AndAlso Not ObjCompras.UpdateEstatusAlmacen(CveCompra, 1, UsuarioActual.CveUsuario) Then
|
||||
ErrorMovInv = True
|
||||
@@ -6914,8 +6892,6 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
|
||||
|
||||
Dim DiferenciaDevolucion As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, (importeMovimiento * TxtTC.Text.ToDecimal), importeMovimiento) - TotalRealDevolucion
|
||||
|
||||
If TotalRealDevolucion <> 0 Then
|
||||
@@ -10896,12 +10872,13 @@ Partial Class Compras_Compras
|
||||
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("TemporadaCuadro", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
TmpDT.Columns.Add("Serie", GetType(String))
|
||||
TmpDT.Columns.Add("Lote", GetType(String))
|
||||
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
|
||||
TmpDTOriginal = New DataTable
|
||||
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
|
||||
TmpDTOriginal.Columns.Add("Cantidad", GetType(Decimal))
|
||||
@@ -11011,8 +10988,10 @@ Partial Class Compras_Compras
|
||||
TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double))
|
||||
TmpDTOriginal.Columns.Add("TemporadaCuadro", GetType(String))
|
||||
|
||||
TmpDTOriginal.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
TmpDTOriginal.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDTOriginal.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
TmpDTOriginal.Columns.Add("Serie", GetType(String))
|
||||
TmpDTOriginal.Columns.Add("Lote", GetType(String))
|
||||
TmpDTOriginal.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
@@ -12164,8 +12143,6 @@ Partial Class Compras_Compras
|
||||
#Region " AJUSTA IMPORTES "
|
||||
Private Sub AjustaImporteUltimoConcepto(ImporteAjuste As Decimal, Optional EsCarga As Boolean = False)
|
||||
|
||||
|
||||
|
||||
If ImporteAjuste = 0 Then Exit Sub
|
||||
|
||||
Dim Amortizacion As Decimal = 0
|
||||
@@ -13849,8 +13826,14 @@ Partial Class Compras_Compras
|
||||
'si no esta vinculado a nc simplemente me lo brinco
|
||||
If realizadevolucion Then
|
||||
|
||||
'si el subtotal es iwal a la nc lo guardo si no marco error
|
||||
If subtotal > subtotaldevolucion - 1 AndAlso subtotal < subtotaldevolucion + 1 Then
|
||||
'si el subtotal es igual a la nc lo guardo si no marco error
|
||||
Dim tTolerancia As Decimal = 0
|
||||
Dim tAjustaUltimo As Boolean = True
|
||||
If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then
|
||||
tTolerancia = Math.Abs(TxtSubTotal2.Text.ToDecimal - subtotaldevolucion)
|
||||
tAjustaUltimo = False
|
||||
End If
|
||||
If Math.Abs(subtotal - subtotaldevolucion) <= tTolerancia Then
|
||||
|
||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 13, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G1")
|
||||
If CveMovimientoEntrada <= 0 Then
|
||||
@@ -13867,17 +13850,17 @@ Partial Class Compras_Compras
|
||||
PU = Dr.DataKey("PU").ToString.ToDecimal
|
||||
PUExtranjero = Dr.DataKey("PUExtranjero").ToString.ToDecimal
|
||||
ii += 1
|
||||
If CantidadRenglones = ii Then
|
||||
If CantidadRenglones = ii AndAlso tAjustaUltimo Then
|
||||
Dim dif As Decimal = subtotal - Acumulado
|
||||
PU = (((Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)) + dif) / Dr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
PU = (((Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToDecimal)) + dif) / Dr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
End If
|
||||
If ObjInventario.GetExistenciasProducto(Dr.DataKey("CvePS").ToString.ToEntero, Dr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen,
|
||||
FechaMovto:=TxtFecha.Text.ToDateTime.AddHours(NowADS().Hour).AddMinutes(NowADS().Minute).AddSeconds(NowADS().Second).ToString("yyyy/MM/dd HH:mm")) Then
|
||||
Dim tFechaExistencia As DateTime = TxtFecha.Text.ToDateTime.AddHours(NowADS().Hour).AddMinutes(NowADS().Minute).AddSeconds(NowADS().Second)
|
||||
If ObjInventario.GetExistenciasProducto(Dr.DataKey("CvePS").ToEntero, Dr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, CveAlmacen,
|
||||
FechaMovto:=tFechaExistencia.ToString("yyyy/MM/dd HH:mm")) Then
|
||||
|
||||
Dim Existencia As Decimal = ObjInventario.DtResultados.FiltroPrimeroValor("ExistenciaFinal", String.Format("CveAlmacen = {0}", CveAlmacen)).ToDecimal
|
||||
|
||||
If Dr.FCTextBox("TxtCantidad").Text.ToDouble > Existencia Then
|
||||
Alert($"No hay existencia suficiente del producto {Dr.DataKey("PS").ToString} en la fecha:{TxtFecha.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Alert($"No hay existencia suficiente del producto: <br/> - {Dr.DataKey("CodigoPS")} en la fecha: {tFechaExistencia.ToString("yyyy/MM/dd HH:mm")}", TipoMensaje.MsgAdvertencia)
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -13966,8 +13949,6 @@ Partial Class Compras_Compras
|
||||
Try
|
||||
Dim subtotaldevolucion As Decimal = 0
|
||||
Dim realizadevolucion As Boolean = False
|
||||
|
||||
|
||||
'Calculo los subtotales para comparar con la NC
|
||||
Dim cantidad As Decimal = 0D
|
||||
|
||||
@@ -13982,11 +13963,13 @@ Partial Class Compras_Compras
|
||||
|
||||
'si no esta vinculado a nc simplemente me lo brinco
|
||||
If realizadevolucion Then
|
||||
'si el subtotal es iwal a la nc lo guardo si no marco error
|
||||
If TxtSubTotal2.Text.ToDouble > subtotaldevolucion - 1 AndAlso TxtSubTotal2.Text.ToDouble < subtotaldevolucion + 1 Then
|
||||
|
||||
'si el subtotal es igual a la nc lo guardo si no marco error
|
||||
'si tiene FNC574, se ajustará la diferencia a un concepto como RNC
|
||||
Dim tTolerancia As Decimal = 1
|
||||
'si tiene la funcionalidad ajustará en un producto la diferencia
|
||||
If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then tTolerancia = Math.Abs(TxtSubTotal2.Text.ToDecimal - subtotaldevolucion)
|
||||
If Math.Abs(TxtSubTotal2.Text.ToDecimal - subtotaldevolucion) <= tTolerancia Then
|
||||
VinculaDevolucion()
|
||||
|
||||
Else
|
||||
Alert("El Total de la NC debe ser igual al total de la devolucion", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
@@ -14011,48 +13994,42 @@ Partial Class Compras_Compras
|
||||
Dim RetIVACompra As Decimal = TxtRetIVA.Text.ToDecimal()
|
||||
Dim RetISRCompra As Decimal = TxtRetISR.Text.ToDecimal()
|
||||
Dim Acumulado As Decimal = 0
|
||||
|
||||
'Dim TotalCalculable As Decimal = TotalCompra - IEPSCompra + RetIVACompra + RetISRCompra
|
||||
|
||||
Dim IVAPorcentajeCompra As Decimal = Math.Round((IVACompra / SubTotalCompra), 2)
|
||||
Dim Contador As Integer = 0
|
||||
Dim Consec As Integer = 0
|
||||
Dim tAjusteUltimo As Boolean = True
|
||||
|
||||
For Each gvr As GridViewRow In GVDevolucion.Rows
|
||||
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
|
||||
Contador += 1
|
||||
End If
|
||||
Next
|
||||
Dim CveSubProyectoContrato As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDevolucion.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto")
|
||||
Dim SubProyecto As String = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyectoContrato.ToEntero).FiltroPrimeroValor("SubProyecto")
|
||||
Dim Total As Decimal = 0
|
||||
Dim CveSubProyectoDev As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDevolucion.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto")
|
||||
Dim SubProyecto As String = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyectoDev.ToEntero).FiltroPrimeroValor("SubProyecto")
|
||||
'Iteramos el GridView de la OC
|
||||
If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then tAjusteUltimo = False
|
||||
For Each gvr As GridViewRow In GVDevolucion.Rows
|
||||
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
|
||||
|
||||
Dim CvePS As Integer = gvr.DataKey("CvePS").ToString.ToEntero
|
||||
'Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
|
||||
Dim Cantidad As Decimal = gvr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
Dim CveUM As Integer = gvr.DataKey("CveUM").ToString.ToEntero
|
||||
Dim UM As String = gvr.DataKey("UM").ToString
|
||||
Dim CveClasificacion As Integer = gvr.DataKey("CveClasificacion").ToString.ToEntero
|
||||
Dim Clasificacion As String = gvr.DataKey("Clasificacion").ToString
|
||||
Dim PS As String = gvr.DataKey("PS").ToString
|
||||
Dim PS As String = gvr.DataKey("CodigoPS").ToString
|
||||
Dim CveTipoPS As Integer = gvr.DataKey("CveTipoPS").ToString.ToEntero
|
||||
|
||||
Dim CveProyecto As String = "-1"
|
||||
|
||||
Dim Proyecto As String = "Seleccione"
|
||||
Dim Obs As String = ""
|
||||
Dim PU As Decimal = gvr.DataKey("PU").ToString.ToDecimal
|
||||
Dim Total As Decimal = gvr.FCTextBox("TxtTotalDevolucion").Text.ToDecimal
|
||||
Dim IVA As Decimal = IVAPorcentajeCompra 'Math.Round(Total * IVAPorcentajeCompra, 2)
|
||||
Total = gvr.FCTextBox("TxtTotalDevolucion").Text.ToDecimal
|
||||
Dim Descuento As Decimal = 0
|
||||
|
||||
Acumulado += (PU * Cantidad)
|
||||
Consec += 1
|
||||
|
||||
If Consec = Contador Then 'SubTotalCompra < Acumulado Then
|
||||
If Consec = Contador AndAlso tAjusteUltimo Then 'SubTotalCompra < Acumulado Then
|
||||
'ajusta el valor
|
||||
Dim dif As Decimal = SubTotalCompra - Acumulado
|
||||
If dif <> 0 Then
|
||||
@@ -14060,10 +14037,25 @@ Partial Class Compras_Compras
|
||||
Total = Cantidad * PU
|
||||
End If
|
||||
End If
|
||||
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, 0, 0, 0, 0, Descuento, -1, False)
|
||||
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoDev, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVAPorcentajeCompra, 0, 0, 0, 0, Descuento, -1, False, CveAlmacen:=DdlAlmacenDevolucion.SelectedValue.ToEntero)
|
||||
End If
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then
|
||||
Dim CvePS_RNC As Integer = UsuarioActual.Empresa.Funcionalidad(580).ToEntero
|
||||
If CvePS_RNC = 0 Then
|
||||
Alert("producto utilizado para diferencia no definido.")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim PSRow As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS_RNC).FiltroPrimero("")
|
||||
Dim PS As String = PSRow("PSCodigo").ToString
|
||||
Dim tDif As Decimal = TxtSubTotal2.Text.ToDecimal - Total
|
||||
|
||||
AddPS(1, PSRow("CveUnidadMedida").ToString.ToEntero, PSRow("UnidadMedida").ToString,
|
||||
PSRow("CveClasificacion").ToString.ToEntero, PSRow("Clasificacion").ToString, CvePS_RNC, PS, 1, CveSubProyectoDev.ToString, SubProyecto, "", "-1", "", tDif, tDif, IVAPorcentajeCompra, 0, 0, 0, 0, 0)
|
||||
|
||||
End If
|
||||
|
||||
AddPS2()
|
||||
|
||||
BtnGuardar.Enabled = True
|
||||
@@ -14079,7 +14071,7 @@ Partial Class Compras_Compras
|
||||
|
||||
ImgClasificacion.Visible = False
|
||||
LbAgregar.Visible = False
|
||||
UpPSS.Update()
|
||||
|
||||
|
||||
'CargaGvInv()
|
||||
|
||||
@@ -14101,7 +14093,6 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
GvOC1.DataBind()
|
||||
|
||||
' TmpDT = OrdenarTablas("CvePS", DTOCTemp, TmpDT)
|
||||
GvOC2.DataSource = TmpDT
|
||||
GvOC2.DataBind()
|
||||
|
||||
@@ -14455,19 +14446,13 @@ 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 Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
|
||||
|
||||
If Not TmpDT.Columns.Contains("FechaCaducidad") Then TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
|
||||
If ObjInventario.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
@@ -18124,7 +18109,7 @@ Partial Class Compras_Compras
|
||||
Case "A" 'ADD
|
||||
|
||||
Dim SATClavePS As Integer = -1
|
||||
Dim PSRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
Dim PSRow As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If PSRow IsNot Nothing Then
|
||||
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
|
||||
End If
|
||||
@@ -18213,13 +18198,10 @@ Partial Class Compras_Compras
|
||||
Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Decimal = 0,
|
||||
Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Decimal = 0,
|
||||
Optional PorcentajeIEPS As Decimal = 0, Optional PorcentajeRetIVA As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1,
|
||||
Optional CveSATPSActualizado As Boolean = False, Optional TemporadaCuadro As String = "", Optional CodigoPS As String = "") As Integer
|
||||
Optional CveSATPSActualizado As Boolean = False, Optional TemporadaCuadro As String = "", Optional CodigoPS As String = "", Optional CveAlmacen As Integer = -1) As Integer
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
|
||||
If Not TmpDT.Columns.Contains("CodigoPS") Then
|
||||
TmpDT.Columns.Add("CodigoPS")
|
||||
End If
|
||||
If Not TmpDT.Columns.Contains("CodigoPS") Then TmpDT.Columns.Add("CodigoPS")
|
||||
|
||||
Row = TmpDT.NewRow()
|
||||
Dim Retorno As Integer = 0
|
||||
@@ -18377,11 +18359,14 @@ Partial Class Compras_Compras
|
||||
|
||||
Row("CveTipoGasto") = CveTipoGasto
|
||||
Row("TipoGasto") = If(CveTipoGasto > 0, TipoGasto, "")
|
||||
|
||||
Row("CveContratoDetalle") = CveContratoDetalle
|
||||
Row("AplicaSerie") = DrPS("AplicaSerie")
|
||||
Row("AplicaLote") = DrPS("AplicaLote")
|
||||
Row("AplicaCaducidad") = DrPS("AplicaCaducidad")
|
||||
|
||||
Row("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
|
||||
Row("TemporadaCuadro") = TemporadaCuadro
|
||||
If CveAlmacen > 0 Then Row("CveAlmacen") = CveAlmacen
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
Row("CveProgramaOperativo") = DdlACGeneral1.SelectedValue.ToEntero
|
||||
@@ -18391,7 +18376,6 @@ Partial Class Compras_Compras
|
||||
Row("CveClasificacionOG") = DdlACGeneral5.SelectedValue.ToEntero
|
||||
End If
|
||||
|
||||
|
||||
'Esta parte es para validar cuando la factura tenga ieps en o se asignara el ieps como una partida ya no se considere
|
||||
If (CveFactura > 0 Or CveCompra > 0) And TxtIEPS.Text.ToDecimal = 0 Then
|
||||
Row("IEPSPS") = 0
|
||||
@@ -23176,6 +23160,7 @@ Public Class ClsCompraManagerCompras
|
||||
If Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
If Not TmpDT.Columns.Contains("AplicaSerie") Then TmpDT.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
|
||||
If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
|
||||
|
||||
@@ -23426,7 +23411,7 @@ Public Class ClsCompraManagerCompras
|
||||
TmpDT.Columns.Add("TemporadaCuadro", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user