This commit is contained in:
@@ -952,15 +952,18 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<asp:GridView ID="GvSeccionAlmacen" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePSAlmacenSeccion,CvePS,CveAlmacen,CveAlmacenSeccion" EmptyDataText="No se encontraron Productos/Servicios Adicionales" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
|
||||
<asp:GridView ID="GvSeccionAlmacen" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CvePSAlmacenSeccion,CveAlmacen,CveAlmacenSeccion"
|
||||
EmptyDataText="No se encontraron Productos/Servicios Adicionales"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None" OnRowDataBound="GvSeccionAlmacen_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Almacen" HeaderText="Almacen" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="AlmacenSeccion" HeaderText="Sección Almacen" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Editar">
|
||||
<%-- <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Editar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkEditarSeccionAlmacen" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="LnkEditarSeccionAlmacen_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>--%>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Eliminar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkRemoveSeccionAlmacen" runat="server" AlternateText="Eliminar" CausesValidation="False" OnClick="LnkRemoveSeccionAlmacen_Click" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
|
||||
@@ -2034,25 +2037,25 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlAlmacen" Width="50%" runat="server" CssClass="form-control select2me" DataValueField="CveAlmacen" DataTextField="Almacen"></asp:DropDownList>
|
||||
<asp:DropDownList ID="DdlAlmacen" Width="50%" runat="server" CssClass="form-control select2me" DataValueField="CveAlmacen" DataTextField="Almacen" AppendDataBoundItems="true"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RfvAlmacen" runat="server" ControlToValidate="DdlAlmacen" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacen''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpModalSeccionAlmacen"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VceAlmacen" runat="server" HighlightCssClass="vco" TargetControlID="RfvAlmacen"></ajax:ValidatorCalloutExtender>
|
||||
<label for="<%= DdlAlmacen.ClientID.ToString()%>">Almacen:</label>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlSeccionAlmacen" Width="50%" runat="server" CssClass="form-control select2me" DataValueField="CveSeccion" DataTextField="Seccion"></asp:DropDownList>
|
||||
<asp:DropDownList ID="DdlSeccionAlmacen" Width="50%" runat="server" CssClass="form-control select2me" DataValueField="CveSeccion" DataTextField="Seccion" AppendDataBoundItems="true"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RfvSeccionAlmacen" runat="server" ControlToValidate="DdlSeccionAlmacen" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sección Almacen''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpModalSeccionAlmacen"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VceSeccionAlmacen" runat="server" HighlightCssClass="vco" TargetControlID="RfvSeccionAlmacen"></ajax:ValidatorCalloutExtender>
|
||||
<label for="<%= DdlSeccionAlmacen.ClientID.ToString()%>">Sección Almacen:</label>
|
||||
</div>
|
||||
<div class="modal-footer" style="display: block">
|
||||
<asp:UpdatePanel ID="UpFooterSeccionAlmacen" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAddSeccionAlmacen" runat="server" OnClick="BtnAddSeccionAlmacen_Click" CssClass="btn btn-success" Text="Agregar" ValidationGroup="GrpModalSeccionAlmacen"></asp:Button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="display: block">
|
||||
<asp:UpdatePanel ID="UpFooterSeccionAlmacen" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAddSeccionAlmacen" runat="server" OnClick="BtnAddSeccionAlmacen_Click" CssClass="btn btn-success" Text="Agregar" ValidationGroup="GrpModalSeccionAlmacen"></asp:Button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
@@ -287,7 +287,6 @@ Partial Class ProductosyServicios
|
||||
|
||||
CargaCombosSeccionAlmacen()
|
||||
DivSeccionAlmacen.Visible = UsuarioActual.Empresa.Funcionalidad(563).ToString = "1"
|
||||
|
||||
CreaDtSeccionAlmacen()
|
||||
|
||||
If UsuarioActual.Empresa.UsaContabilidad Then
|
||||
@@ -1134,7 +1133,8 @@ Partial Class ProductosyServicios
|
||||
End If
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
ObjProductosServicios.IniciaTransacSQL()
|
||||
Dim ObjInv As New ClsInventarios(ObjProductosServicios.IniciaTransacSQL())
|
||||
|
||||
Dim TieneError = False
|
||||
Dim AccionJS = ""
|
||||
Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1)
|
||||
@@ -1171,6 +1171,18 @@ Partial Class ProductosyServicios
|
||||
Next
|
||||
'Alert("El Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href= "" / ProductosServicios.aspx?CvePS=" & ObjProductosServcios.CvePS.ToString & """;")
|
||||
AccionJS = "document.location.href=""/Ventas/CatPS.aspx"";"
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
For Each Dr As DataRow In DtSeccionAlmacen.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
Alert("Ocurrió un Error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
@@ -1216,6 +1228,22 @@ Partial Class ProductosyServicios
|
||||
AccionJS = If(Ret = "Comp", "ircompras();", "document.location.href=""/Ventas/CatPS.aspx"";")
|
||||
'UpDatos.Update()
|
||||
'Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, AccionJS)
|
||||
|
||||
If Not TieneError Then
|
||||
For Each Dr As DataRow In DtSeccionAlmacen.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Not Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ElseIf Not Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.RemoveProductosServiciosAlmacenSeccion(Dr("CvePSAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
Alert("Ocurrió un Error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
@@ -2479,7 +2507,6 @@ Partial Class ProductosyServicios
|
||||
Private Sub CreaDtSeccionAlmacen()
|
||||
DtSeccionAlmacen = New DataTable
|
||||
DtSeccionAlmacen.Columns.Add("CvePSAlmacenSeccion", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("CveAlmacen", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("Almacen", GetType(String))
|
||||
DtSeccionAlmacen.Columns.Add("CveAlmacenSeccion", GetType(Integer))
|
||||
@@ -2498,14 +2525,15 @@ Partial Class ProductosyServicios
|
||||
|
||||
|
||||
Private Sub CargaCombosSeccionAlmacen()
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveAlmacen)
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.Items.Add(New ListItem("Seleccione", "-1"))
|
||||
DdlAlmacen.DataBind()
|
||||
|
||||
DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveAlmacen)
|
||||
DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlSeccionAlmacen.Items.Add(New ListItem("Seleccione", "-1"))
|
||||
DdlSeccionAlmacen.DataBind()
|
||||
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkSeccionAlmacenAdd_Click(sender As Object, e As EventArgs)
|
||||
@@ -2514,30 +2542,58 @@ Partial Class ProductosyServicios
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen"))
|
||||
DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion"))
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
'Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
' DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen"))
|
||||
' DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion"))
|
||||
' RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
' UpModalSeccionAlmacen.Update()
|
||||
'End Sub
|
||||
Protected Sub LnkRemoveSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
If gvRow.DataKey("CvePSAlmacenSeccion").ToEntero > 0 Then
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex)("CvePS") = -1
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex)("CveAlmacen") = -1
|
||||
Else
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex.ToEntero).Delete()
|
||||
End If
|
||||
DtSeccionAlmacen.AcceptChanges()
|
||||
GvSeccionAlmacen.DataSource = DtSeccionAlmacen
|
||||
GvSeccionAlmacen.DataBind()
|
||||
UpSeccionAlmacen.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAddSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
If DtSeccionAlmacen.FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then
|
||||
Alert("No se puede especificar el mismo almacen en dos secciones", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = DtSeccionAlmacen.NewRow
|
||||
Row("CvePSAlmacenSeccion") = -1
|
||||
Row("CveAlmacen") = DdlAlmacen.SelectedValue.ToEntero
|
||||
Row("Almacen") = DdlAlmacen.SelectedItem.Text
|
||||
Row("CveAlmacenSeccion") = DdlSeccionAlmacen.SelectedValue.ToEntero
|
||||
Row("AlmacenSeccion") = DdlSeccionAlmacen.SelectedItem.Text
|
||||
DtSeccionAlmacen.Rows.Add(Row)
|
||||
DtSeccionAlmacen.AcceptChanges()
|
||||
GvSeccionAlmacen.DataSource = DtSeccionAlmacen
|
||||
GvSeccionAlmacen.DataBind()
|
||||
UpSeccionAlmacen.Update()
|
||||
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal('hide');")
|
||||
End Sub
|
||||
|
||||
Protected Sub GvSeccionAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If Not e.Row.DBCampo("CveAlmacen").ToEntero > 0 Then
|
||||
e.Row.Visible = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -50,7 +50,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
}
|
||||
ObjVentas.Dispose();
|
||||
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0");
|
||||
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion = 1");
|
||||
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
|
||||
if (DtRefacturar.Rows.Count > 0)
|
||||
{
|
||||
DivRefacturar.Visible = true;
|
||||
@@ -132,7 +132,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
||||
}
|
||||
|
||||
// var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||
|
||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
@@ -170,188 +170,187 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
//private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion)
|
||||
//{
|
||||
// //var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
||||
// //var retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||
// return retorno;
|
||||
//}
|
||||
|
||||
private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
|
||||
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion)
|
||||
{
|
||||
int CtaCliente = 0;
|
||||
int OrdenPago = 0;
|
||||
string NombreCliente = "";
|
||||
|
||||
var ObjClientes = new ClsClientes();
|
||||
if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CtaCliente = ObjClientes.IdCtaContClientes;
|
||||
NombreCliente = ObjClientes.NombreComercial;
|
||||
}
|
||||
ObjClientes.Dispose();
|
||||
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
if (ObjVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
|
||||
}
|
||||
}
|
||||
|
||||
int Retorno = 0;
|
||||
int IDPoliza = 0;
|
||||
bool ErrorAC = false;
|
||||
string Concepto = string.Format("GD {0}", NombreCliente);
|
||||
int Paridad = 1;
|
||||
bool TipoMovto = false;
|
||||
if (CancelacionIngreso)
|
||||
{
|
||||
Concepto = string.Format("Cancelación GD {0}", NombreCliente);
|
||||
Paridad = -1;
|
||||
TipoMovto = true;
|
||||
}
|
||||
var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
|
||||
DataRow dr = null;
|
||||
int CtaISSSTESON = 643;
|
||||
int CtaISPT = 1745;
|
||||
var AC = new ClsAC();
|
||||
|
||||
//var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
|
||||
//ObjAC.IniciaTransacSQL();
|
||||
|
||||
IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
|
||||
|
||||
if (IDPoliza > 0)
|
||||
{
|
||||
if (TipoComprobante == "OP")
|
||||
{
|
||||
//Orden de PAGO
|
||||
if (OrdenPago == 1)
|
||||
{
|
||||
//ISSSTESON
|
||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ISPT
|
||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//NORMAL
|
||||
DataTable Detalles = null;
|
||||
DataTable DTPresupuestoIngresos = null;
|
||||
if (ObjVentas.GetVentaDetalle(CveVenta))
|
||||
{
|
||||
Detalles = ObjVentas.DtResultados.Copy();
|
||||
}
|
||||
if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DTPresupuestoIngresos = AC.DtResultados.Copy();
|
||||
}
|
||||
|
||||
if (Detalles != null && DTPresupuestoIngresos != null)
|
||||
{
|
||||
var query = from gvr in Detalles.AsEnumerable()
|
||||
group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
|
||||
select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
|
||||
|
||||
foreach (var item in query)
|
||||
{
|
||||
dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
|
||||
if (dr != null)
|
||||
{
|
||||
Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
|
||||
if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
// CARGO la deuda del cliente
|
||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
// abono,
|
||||
if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
{
|
||||
ErrorAC = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorAC = true;
|
||||
}
|
||||
|
||||
if (!ErrorAC)
|
||||
{
|
||||
ObjAC.AjustaPoliza(IDPoliza);
|
||||
Retorno = IDPoliza;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
|
||||
}
|
||||
AC.Dispose();
|
||||
ObjVentas.Dispose();
|
||||
|
||||
return Retorno;
|
||||
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
||||
var retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||
return retorno;
|
||||
}
|
||||
|
||||
//private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
|
||||
//{
|
||||
// int CtaCliente = 0;
|
||||
// int OrdenPago = 0;
|
||||
// string NombreCliente = "";
|
||||
|
||||
// var ObjClientes = new ClsClientes();
|
||||
// if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// CtaCliente = ObjClientes.IdCtaContClientes;
|
||||
// NombreCliente = ObjClientes.NombreComercial;
|
||||
// }
|
||||
// ObjClientes.Dispose();
|
||||
|
||||
// var ObjVentas = new ClsVentas();
|
||||
// if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// if (ObjVentas.DtResultados.Rows.Count > 0)
|
||||
// {
|
||||
// OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
|
||||
// }
|
||||
// }
|
||||
|
||||
// int Retorno = 0;
|
||||
// int IDPoliza = 0;
|
||||
// bool ErrorAC = false;
|
||||
// string Concepto = string.Format("GD {0}", NombreCliente);
|
||||
// int Paridad = 1;
|
||||
// bool TipoMovto = false;
|
||||
// if (CancelacionIngreso)
|
||||
// {
|
||||
// Concepto = string.Format("Cancelación GD {0}", NombreCliente);
|
||||
// Paridad = -1;
|
||||
// TipoMovto = true;
|
||||
// }
|
||||
// var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
|
||||
// DataRow dr = null;
|
||||
// int CtaISSSTESON = 643;
|
||||
// int CtaISPT = 1745;
|
||||
// var AC = new ClsAC();
|
||||
|
||||
// //var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
|
||||
// //ObjAC.IniciaTransacSQL();
|
||||
|
||||
// IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
|
||||
|
||||
// if (IDPoliza > 0)
|
||||
// {
|
||||
// if (TipoComprobante == "OP")
|
||||
// {
|
||||
// //Orden de PAGO
|
||||
// if (OrdenPago == 1)
|
||||
// {
|
||||
// //ISSSTESON
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //ISPT
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //NORMAL
|
||||
// DataTable Detalles = null;
|
||||
// DataTable DTPresupuestoIngresos = null;
|
||||
// if (ObjVentas.GetVentaDetalle(CveVenta))
|
||||
// {
|
||||
// Detalles = ObjVentas.DtResultados.Copy();
|
||||
// }
|
||||
// if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// DTPresupuestoIngresos = AC.DtResultados.Copy();
|
||||
// }
|
||||
|
||||
// if (Detalles != null && DTPresupuestoIngresos != null)
|
||||
// {
|
||||
// var query = from gvr in Detalles.AsEnumerable()
|
||||
// group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
|
||||
// select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
|
||||
|
||||
// foreach (var item in query)
|
||||
// {
|
||||
// dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
|
||||
// if (dr != null)
|
||||
// {
|
||||
// Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// // CARGO la deuda del cliente
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// // abono,
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
|
||||
// if (!ErrorAC)
|
||||
// {
|
||||
// ObjAC.AjustaPoliza(IDPoliza);
|
||||
// Retorno = IDPoliza;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
|
||||
// }
|
||||
// AC.Dispose();
|
||||
// ObjVentas.Dispose();
|
||||
|
||||
// return Retorno;
|
||||
//}
|
||||
private string DecodeBase64(string strXMLCodificado)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -6572,7 +6572,7 @@ Partial Class Ventas
|
||||
'ContPAQ El movimiento 1 es el de Venta
|
||||
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "NC") Then
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
|
||||
AutoConta = False
|
||||
End If
|
||||
|
||||
@@ -7285,6 +7285,8 @@ Partial Class Ventas
|
||||
ObjFactura.Moneda = DdlMoneda.SelectedItem.Text
|
||||
ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}")
|
||||
ObjFactura.TipoDocto = If(IfNull(ViewState("CveRemision"), 0).ToString.ToEntero > 0, "Ing", DdlTipoComprobante.SelectedValue)
|
||||
|
||||
|
||||
'ObjFactura.RefDocto = TxtDocto.Text.Trim
|
||||
ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero, -1)
|
||||
'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1)
|
||||
@@ -8971,7 +8973,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
If ErrorList.Count = 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
'Agregamos las remisiones a la tabla
|
||||
If DtRemisionesPS IsNot Nothing AndAlso DtRemisionesPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then
|
||||
Dim CveVentaDetalle As Integer = 0
|
||||
@@ -10196,7 +10198,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora
|
||||
If RemisionesLista.Count > 0 Then
|
||||
If RemisionesLista.Count > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
|
||||
'se verifica que el documento que se está generando sea "Ing", "Ant"
|
||||
If Not ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
@@ -11197,6 +11199,7 @@ Partial Class Ventas
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
Dim ObjVenta As New ClsVentas(ObjConta.IniciaTransacSQL())
|
||||
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
||||
Dim ObjCliente As New ClsClientes(ObjConta.IniciaTransacSQL())
|
||||
Dim ObjContpaq As ClsContPAQi = Nothing
|
||||
|
||||
Dim CvePrepoliza As Integer
|
||||
@@ -11567,15 +11570,40 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'Agregamos el 92
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
IdCtaContable = IdCtaContAnticipos
|
||||
CveCuenta = CveCuentaAnticipos
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago) Then
|
||||
|
||||
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContAnticipos
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
||||
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContClientes
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
importeMovimiento = 0
|
||||
@@ -11669,7 +11697,9 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ObjConta.Dispose()
|
||||
ObjVenta.Dispose()
|
||||
ObjIE.Dispose()
|
||||
ObjCliente.Dispose()
|
||||
|
||||
Else
|
||||
|
||||
@@ -15501,7 +15531,7 @@ Partial Class Ventas
|
||||
CancelarDocumento(True)
|
||||
End Sub
|
||||
Private Sub BtnRefacturacionConfirmarAceptacion_Click(sender As Object, e As System.EventArgs) Handles BtnRefacturacionConfirmarAceptacion.Click
|
||||
Response.Redirect(String.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta))
|
||||
CancelarDocumento(True)
|
||||
End Sub
|
||||
Private Sub BtnContabilizar_Click(sender As Object, e As System.EventArgs) Handles BtnContabilizar.Click
|
||||
'Dim ObjMov As New ClsContabilidad
|
||||
@@ -19898,7 +19928,7 @@ Partial Class Ventas
|
||||
|
||||
Private Sub CargaCxC()
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then
|
||||
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", DdlMoneda.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then
|
||||
Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
|
||||
GvCxC.DataSource = DtTemporal
|
||||
End If
|
||||
@@ -21562,6 +21592,7 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.Items.Insert(1, New ListItem("Anticipos", "Ant"))
|
||||
DdlTipoComprobante.SelectedIndex = 0
|
||||
DdlTipoComprobante.SelectedValueExist(CveTipoDocto)
|
||||
|
||||
CambiaTipoComprobante()
|
||||
|
||||
Dim MensajeRemisiones As New StringBuilder
|
||||
@@ -21611,6 +21642,8 @@ Partial Class Ventas
|
||||
UPEstimaciones.Update()
|
||||
UPCondicionesPago.Update()
|
||||
HuboCambioRemi = Not HuboCambioRemi
|
||||
|
||||
|
||||
RegistraScript("$('#DivRemisiones').modal('hide');", "DivRemisionesHide")
|
||||
End Sub
|
||||
Private Sub VerificaRemisiones(ByRef dt As DataTable)
|
||||
|
||||
Reference in New Issue
Block a user