10 namespace sage.ew.serie
16 public static class ExtensionesSerie
19 #region Extensiones DocVentaTPV 27 if (toLinea._UsaSeries && toLinea._Unidades != 0.0M)
34 loLinVenDetSer.
_Load();
36 bool llLineaFacturable = Math.Abs(toLinea._Unidades) == loLinVenDetSer.
_lisCodigos.Count(ele => !
string.IsNullOrEmpty(ele._Codigo));
37 toLinea._LineaFacturable = llLineaFacturable;
38 if (llLineaFacturable)
39 toLinea._Evaluar_Documento_Facturable();
52 string lcSql =
string.Empty;
54 DataTable ldtSeries =
new DataTable();
55 lcSql =
"SELECT COUNT(EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"COMSER") +
56 " WHERE EMPRESA =" + DB.SQLString(toDocLinea._Empresa) +
" AND " +
57 " ALBARAN =" + DB.SQLString(toDocLinea._Numero) +
" AND " +
58 " PROVEEDOR =" + DB.SQLString(toDocLinea._Proveedor);
59 llOk = DB.SQLExec(lcSql, ref ldtSeries);
61 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
63 Serie loSerie =
new Serie();
64 string tcEmpresa = toDocLinea._Empresa;
65 string tcNumero = toDocLinea._Numero;
66 string tcLetra = toDocLinea._Letra;
67 int tnLinea = toDocLinea._LineaReal;
68 loSerie._Lineas = toDocLinea;
69 bool llOk2 = loSerie._ConsultarComser(tcEmpresa, tcNumero, tcLetra, tnLinea, ref toComser);
70 if (llOk2 && toComser.Rows.Count > 0)
84 string lcSql =
string.Empty;
86 DataTable ldtSeries =
new DataTable();
87 lcSql =
"SELECT COUNT(EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"VENSER") +
88 " WHERE EMPRESA =" + DB.SQLString(toDocVentaTPV._Empresa) +
" AND " +
89 " ALBARAN =" + DB.SQLString(toDocVentaTPV._Numero) +
" AND " +
90 " LETRA =" + DB.SQLString(toDocVentaTPV._Letra);
91 llOk = DB.SQLExec(lcSql, ref ldtSeries);
93 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
return true;
104 DataTable toVenser =
new DataTable();
105 return toDocVentaLinTPV.__Contiene_Series(ref toVenser);
117 Serie loSerie =
new Serie();
118 string tcEmpresa = toDocVentaLinTPV._Empresa;
119 string tcNumero = toDocVentaLinTPV._Numero;
120 string tcLetra = toDocVentaLinTPV._Letra;
121 int tnLinea = toDocVentaLinTPV._LineaReal;
122 bool llOk = loSerie._ConsultarVenser(tcEmpresa, tcNumero, tcLetra, tnLinea, ref toVenser);
123 if (llOk && toVenser.Rows.Count > 0)
137 string tcEmpresa = toLin._Empresa;
138 string tcNumero = toLin._Numero;
139 string tcLetra = toLin._Letra;
140 int tnLinea = toLin._LineaReal;
141 bool llOk = loMontaje._ConsultarMontajesPresupuesto(tcEmpresa, tcNumero, tcLetra, tnLinea, ref toVenser);
142 if (llOk && toVenser.Rows.Count > 0)
154 string lcSql =
string.Empty;
156 DataTable ldtSeries =
new DataTable();
158 lcSql =
"SELECT COUNT(C.EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"VENSER") +
" V " +
159 "INNER JOIN " + DB.SQLDatabase(
"GESTION",
"C_ALBVEN") +
" C ON V.EMPRESA = C.EMPRESA AND V.ALBARAN = C.NUMERO AND V.LETRA=C.LETRA " +
160 " WHERE C.EMPRESA =" + DB.SQLString(toDocVentaFRA._Empresa) +
" AND " +
161 " C.FACTURA = " + DB.SQLString(toDocVentaFRA._Letra + toDocVentaFRA._Numero);
163 llOk = DB.SQLExec(lcSql, ref ldtSeries);
165 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
180 bool llFacturarSinSerie = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_facturaser"));
181 if (llFacturarSinSerie)
return toDocVentaTPV._Cabecera._Facturable;
184 Serie loSerie =
new Serie();
185 return (loSerie._Documento_Facturable(toDocVentaTPV));
197 public static bool __Cambio_Series_Documento_Venta(
this docventatpv.ewDocVentaTPV toDocOrigen,
string tcNuevaEmpresa =
"",
string tcNuevoNumero =
"",
string tcNuevaLetra =
"")
202 if (toDocOrigen == null || toDocOrigen._Lineas == null || toDocOrigen._Lineas.Count == 0)
return llOk;
204 if (
string.IsNullOrWhiteSpace(tcNuevaEmpresa) ||
string.IsNullOrWhiteSpace(tcNuevoNumero))
return llOk;
206 Serie loSerie =
new Serie();
207 return (loSerie._Cambio_Documento_Venta(toDocOrigen, tcNuevaEmpresa, tcNuevoNumero, tcNuevaLetra));
217 public static bool __Modificar_Reserva_Series(
this docventatpv.ewDocVentaTPV toDocOrigen,
string tcNumero,
string tcNumero2)
222 if (toDocOrigen == null || toDocOrigen._Lineas == null || toDocOrigen._Lineas.Count == 0)
return llOk;
225 if (
string.IsNullOrWhiteSpace(tcNumero) ||
string.IsNullOrWhiteSpace(tcNumero2))
return llOk;
227 Serie loSerie =
new Serie();
228 return (loSerie._Modificar_Reserva_Venta(toDocOrigen, tcNumero, tcNumero2));
231 #endregion Extensiones DocVentaTPV 233 #region Extensiones DocVentaLinTPV 243 bool llFacturarSinSerie = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_facturaser"));
244 if (llFacturarSinSerie)
return toDocVentaLinTPV.DocVenta._Cabecera._Facturable;
247 Serie loSerie =
new Serie();
248 return (loSerie._Documento_Facturable(toDocVentaLinTPV.DocVenta));
259 Serie loSerie =
new Serie(tcSerie, toDocVentaLinTPV);
262 if (toDocVentaLinTPV._Unidades > 0) llOk = loSerie._Vender_Serie(toDocVentaLinTPV);
263 else llOk = loSerie._Abonar_Serie(toDocVentaLinTPV);
268 #endregion Extensiones DocVentaLinTPV 278 public static bool __Contiene_Series_Deposito(
this ewDocVentaLinDEPOSITO toDocVentaLinDeposito, ref DataTable toVenser)
283 bool llModelo =
false;
285 llModelo = toDocVentaLinDeposito.
_oArticulo._EsMontaje;
290 Serie loSerie =
new Serie();
291 llOk = loSerie._ConsultarDepser(toDocVentaLinDeposito, ref toVenser);
297 llOk = loMontaje._ConsultarDepser(toDocVentaLinDeposito, ref toVenser);
300 if (llOk && toVenser.Rows.Count > 0)
312 string lcSql =
string.Empty;
314 DataTable ldtSeries =
new DataTable();
315 lcSql =
"SELECT COUNT(EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"DEPSER") +
316 " WHERE EMPRESA =" + DB.SQLString(toDocDeposito.
_Empresa) +
" AND " +
317 " DEPOSITO =" + DB.SQLString(toDocDeposito.
_Numero) +
" AND " +
318 " LETRA =" + DB.SQLString(toDocDeposito.
_Letra);
319 llOk = DB.SQLExec(lcSql, ref ldtSeries);
321 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
return true;
330 public static bool __Comprobaciones_Borrado_Series_DepoVen(
this ewDocVentaDEPOSITO toDocDeposito)
339 #region Extensiones DocCompra 348 string lcSql =
string.Empty;
350 DataTable ldtSeries =
new DataTable();
351 lcSql =
"SELECT COUNT(EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"COMSER") +
352 " WHERE EMPRESA =" + DB.SQLString(toDocCompra._Empresa) +
" AND " +
353 " ALBARAN =" + DB.SQLString(toDocCompra._Numero) +
" AND " +
354 " PROVEEDOR =" + DB.SQLString(toDocCompra._Cabecera._Proveedor);
355 llOk = DB.SQLExec(lcSql, ref ldtSeries);
357 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
return true;
368 string lcSql =
string.Empty;
370 DataTable ldtSeries =
new DataTable();
371 lcSql =
"SELECT COUNT(EMPRESA) AS TOTAL FROM" + DB.SQLDatabase(
"GESTION",
"DEPCSER") +
372 " WHERE EMPRESA =" + DB.SQLString(toDocCompra._Empresa) +
" AND " +
373 " ALBARAN =" + DB.SQLString(toDocCompra._Numero);
374 llOk = DB.SQLExec(lcSql, ref ldtSeries);
376 if (llOk && Convert.ToInt32(ldtSeries.Rows[0][
"TOTAL"]) > 0)
return true;
386 public static bool __Comprobaciones_Borrado_Series(
this ewDocCompraDEPOSITO toDocCompra, ref
string tcMensaje)
388 return SerieDocCompraDeposito._Comprobaciones_Borrado_Series(toDocCompra, ref tcMensaje);
397 public static bool __Comprobaciones_Borrado_Series(
this ewDocCompraALBARAN toDocCompra, ref
string tcMensaje)
399 return SerieDocCompra._Comprobaciones_Borrado_Series(toDocCompra, ref tcMensaje);
402 #endregion Extensiones DocCompra 404 #region Extensiones Clientes 413 public static DataTable __Series_Vendidas(
this sage.
ew.
cliente.
Cliente toCliente, String tcFamilia =
"")
415 Serie loSerie =
new Serie();
416 return loSerie._Series_Vendidas(toCliente._Codigo, tcFamilia);
426 public static DataTable __Series_Vendidas_con_Depositos(
this sage.
ew.
cliente.
Cliente toCliente, String tcFamilia =
"")
428 Serie loSerie =
new Serie();
429 return loSerie._Series_Vendidas_con_Depositos(toCliente._Codigo, tcFamilia);
439 public static DataTable __Series_Vendidas_Familia(
this sage.
ew.
cliente.
Cliente toCliente, String tcFamilia =
"")
441 Serie loSerie =
new Serie();
442 return loSerie._Series_Vendidas_Familia(toCliente._Codigo, tcFamilia);
446 #endregion Extensiones Clientes 448 #region Extensiones String 456 public static string __ToConcatenableQuery(
this string tcQuery)
459 if (
string.IsNullOrWhiteSpace(tcQuery))
463 tcQuery = tcQuery.TrimEnd();
466 if (!tcQuery.TrimEnd().EndsWith(
";"))
472 private static string __ToBDString(
this string tcCampo)
474 return DB.SQLString(tcCampo);
477 #endregion Extensiones String
virtual string _Numero
Número del document
Clase linea del presupuesto
string _Empresa
Codi d'emrpesa
bool _Load()
Cargará todas las series/lotes asignadas a una linea del documento de venta
Clase documento de DEPOSITO DE COMPRA
Clase documento de venta TPV
Classe documento Factura de venta
virtual string _Letra
Lletra
virtual Articulo _oArticulo
Objeto Articulo
Clase linea de documento de venta TPV
Clase documento de ALBARANES DE COMPRA
Linies de documents de compra
BindingList< T > _lisCodigos
Códigos de series/lotes asignados a una linea del documento de venta
Classe base dels documents de compra
Clase de documentos DEPOSITO
Clase que gestiona las series/lotes asignados a una linea de un documento de venta ...