Version 2.1.13.0: cabecera de la NC en un solo metodo (CabeceraNotaCredito.Completar)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-19 16:52:23 -05:00
1 parent 2fb7509fc2
commit a65cd4d90a
5 files changed
+70 -64

No files matched your search

@@ -0,0 +1,53 @@
using Net.Business.Entities.ServicesLayer.CreditNotes;
using Net.Data.HelperData.Correlativo;
using System;
namespace Net.Data.ServicesLayer.CreditNotes
{
// Cabecera de la nota de credito (Picking DESPACHO, Picking PICKING estado 13 y Recibo Devolucion).
// Antes la serie, el correlativo y estos campos estaban copiados 3 veces.
public static class CabeceraNotaCredito
{
// Completa la cabecera de la NC con los datos del documento origen (la factura o, en Recibo sin factura,
// la solicitud de devolucion). Las lineas las arma cada llamador.
// tipoOrigen/serieOrigen/correlativoOrigen: U_SYP_MDTD / U_SYP_MDSD / U_SYP_MDCD del documento origen.
public static void Completar(BE_CreditNotesNotes nc, string docCurrency, string cardCode, string cardName, string paymentGroupCode,
string tipoOrigen, string serieOrigen, string correlativoOrigen, DateTime fechaOrigen, string motivo, string tipoMotivo)
{
// v2.1.7.0: la serie sale del TIPO del documento origen (03 = boleta -> BC10, otro -> FC10), no de su serie.
// En Recibo se comparaba la serie origen (p. ej. B005) con "03" y siempre salia FC10.
// Pendiente: validar con contabilidad la serie de boletas.
string serie = SerieNotaCredito(tipoOrigen);
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string correlativo = HelperCorrelativo.Get(serie);
nc.DocCurrency = docCurrency;
nc.CardCode = cardCode;
nc.CardName = cardName;
nc.PaymentGroupCode = paymentGroupCode;
nc.DocDate = DateTime.Now;
nc.DocDueDate = DateTime.Now;
// Documento origen (el que se devuelve)
nc.U_SYP_MDTO = tipoOrigen;
nc.U_SYP_MDCO = correlativoOrigen;
nc.U_SYP_MDSO = serieOrigen;
nc.U_SYP_FECHAREF = fechaOrigen.ToString("yyyy-MM-dd");
nc.U_SYP_MOTNC = motivo;
nc.U_SYP_TPONC = tipoMotivo;
// La NC misma: tipo 07, con la serie y el correlativo elegidos arriba
nc.U_SYP_MDTD = "07";
nc.U_SYP_MDSD = serie;
nc.U_SYP_MDCD = correlativo;
nc.NumAtCard = "07-" + serie + "-" + correlativo;
}
public static string SerieNotaCredito(string tipoOrigen)
{
return tipoOrigen == "03" ? "BC10" : "FC10";
}
}
}
+6 -41
View File
@@ -15,7 +15,6 @@ using Net.Business.Entities.WMS.ProcesoPicking;
using Net.Connection;
using Net.Connection.ServiceLayer;
using Net.CrossCotting;
using Net.Data.HelperData.Correlativo;
using Net.Data.HelperData.HelperProcesoPermitido;
using Net.Data.HelperData.Stock;
using Net.Data.ServicesLayer;
@@ -171,26 +170,9 @@ namespace Net.Data.WMS.Picking
}
}
// Serie de la NC segun el TIPO de documento de la factura (U_SYP_MDTD): 03 = boleta -> BC10, otro -> FC10.
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = _invoices.DocCurrency;
creditNotesNotes.CardCode = _invoices.CardCode;
creditNotesNotes.CardName = _invoices.CardName;
creditNotesNotes.PaymentGroupCode = _invoices.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.U_SYP_MDTO = _invoices.U_SYP_MDTD;
creditNotesNotes.U_SYP_MDCO = _invoices.U_SYP_MDCD;
creditNotesNotes.U_SYP_MDSO = _invoices.U_SYP_MDSD;
creditNotesNotes.U_SYP_MOTNC = DescripcionMotivo;
creditNotesNotes.U_SYP_TPONC = MotivoNotaCredito;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = _invoices.DocDate.ToString("yyyy-MM-dd");
creditNotesNotes.NumAtCard = ("07-" + Serie + "-" + Correlativo);
// Cabecera de la NC (serie BC10/FC10 por tipo de la factura, correlativo, documento origen)
CabeceraNotaCredito.Completar(creditNotesNotes, _invoices.DocCurrency, _invoices.CardCode, _invoices.CardName, _invoices.PaymentGroupCode,
_invoices.U_SYP_MDTD, _invoices.U_SYP_MDSD, _invoices.U_SYP_MDCD, _invoices.DocDate, DescripcionMotivo, MotivoNotaCredito);
entidad.Detalle.ForEach(x =>
{
@@ -437,26 +419,9 @@ namespace Net.Data.WMS.Picking
}
}
// Serie segun el tipo de documento de la factura (03 = boleta -> BC10, otro -> FC10)
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = _invoices.DocCurrency;
creditNotesNotes.CardCode = _invoices.CardCode;
creditNotesNotes.CardName = _invoices.CardName;
creditNotesNotes.PaymentGroupCode = _invoices.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.U_SYP_MDTO = _invoices.U_SYP_MDTD;
creditNotesNotes.U_SYP_MDCO = _invoices.U_SYP_MDCD;
creditNotesNotes.U_SYP_MDSO = _invoices.U_SYP_MDSD;
creditNotesNotes.U_SYP_MOTNC = DescripcionMotivo;
creditNotesNotes.U_SYP_TPONC = MotivoNotaCredito;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = _invoices.DocDate.ToString("yyyy-MM-dd");
creditNotesNotes.NumAtCard = ("07-" + Serie+ "-" + Correlativo);
// Cabecera de la NC (serie BC10/FC10 por tipo de la factura, correlativo, documento origen)
CabeceraNotaCredito.Completar(creditNotesNotes, _invoices.DocCurrency, _invoices.CardCode, _invoices.CardName, _invoices.PaymentGroupCode,
_invoices.U_SYP_MDTD, _invoices.U_SYP_MDSD, _invoices.U_SYP_MDCD, _invoices.DocDate, DescripcionMotivo, MotivoNotaCredito);
entidad.Detalle.ForEach(x =>
{
+4 -21
View File
@@ -13,7 +13,6 @@ using Net.Business.Entities.ServicesLayer.StockTransfer;
using Net.Business.Entities.WMS.Recibo;
using Net.Connection;
using Net.CrossCotting;
using Net.Data.HelperData.Correlativo;
using Net.Data.HelperData.Stock;
using Net.Data.ServicesLayer;
using Net.Data.ServicesLayer.CreditNotes;
@@ -402,26 +401,10 @@ namespace Net.Data.WMS.Recibo
}
#endregion
// Serie segun el TIPO de documento origen (03 = boleta), no segun su serie
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string Serie = U_SYP_MDTO == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = returnRequest.DocCurrency;
creditNotesNotes.CardCode = returnRequest.CardCode;
creditNotesNotes.CardName = returnRequest.CardName;
creditNotesNotes.PaymentGroupCode = returnRequest.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.NumAtCard = ("07-" + Serie +"-" + Correlativo);
creditNotesNotes.U_SYP_MDTO = U_SYP_MDTO;
creditNotesNotes.U_SYP_MDCO = U_SYP_MDCO;
creditNotesNotes.U_SYP_MDSO = U_SYP_MDSO;
creditNotesNotes.U_SYP_MOTNC = returnRequest.U_SYP_MOTNC;
creditNotesNotes.U_SYP_TPONC = returnRequest.U_SYP_TPONC;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = DocDate.ToString("yyyy-MM-dd");
// Cabecera de la NC: serie BC10/FC10 por el TIPO del documento origen (v2.1.7.0), correlativo y documento origen.
// El origen es la factura de la solicitud de devolucion o, si no hay, la propia solicitud
CabeceraNotaCredito.Completar(creditNotesNotes, returnRequest.DocCurrency, returnRequest.CardCode, returnRequest.CardName, returnRequest.PaymentGroupCode,
U_SYP_MDTO, U_SYP_MDSO, U_SYP_MDCO, DocDate, returnRequest.U_SYP_MOTNC, returnRequest.U_SYP_TPONC);
entidad.Detalle.ForEach(x =>
{
var Item = returnRequest.DocumentLines.ToList().FirstOrDefault(t => t.LineNum == x.Item);