2 using System.Collections.Generic;
40 #endregion Constructores 47 bool _lSoloLectura =
false;
49 _lSoloLectura = _oDocLin.DocVenta._Solo_Lectura;
52 if (_oDocLin._Servidas != 0 && _oDocLin._Traspasar_Unidades == 0) _lSoloLectura =
true;
54 _ReadOnly = _ReadOnly || _lSoloLectura;
64 string lcSql =
string.Empty;
67 lcSql =
"SELECT EMPRESA,LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES, " +
68 " PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO, " +
69 " TALLA,COLOR,ASI, " +
70 " UNIDADES AS UNIASIG, 0.00000000000 AS UNI2, PESO AS PESASIG, 0.00000000000 AS PES2, " +
71 " cast(1 as bit) as SEL, cast(0 as bit) as AJENO, cast(0 as bit) as REGULA, space(80) as ORIGEN, 0.00000000000 AS COSTE " +
72 "FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
73 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
74 " AND EMPRESA = " + DB.SQLString(_oDocLin._Empresa) +
75 " AND NUMERO = " + DB.SQLString(_oDocLin._Numero) +
76 " AND LETRA = " + DB.SQLString(_oDocLin._Letra) +
77 " AND LINIA = " + DB.SQLString(_oDocLin._LineaReal);
79 if (_oDocLin._Unidades - _oDocLin._Servidas != 0)
81 lcSql +=
" AND TRASPAS = " + DB.SQLString(0);
84 DB.SQLExec(lcSql, ref _oDataTable);
92 if (_oRestricciones is IDictionary<string, string> && ((IDictionary<string, string>)_oRestricciones).Count == 4)
94 string lcSql =
string.Empty;
97 lcSql =
"SELECT *, " +
98 " 0.00000000000 AS UNIASIG, 0.00000000000 AS UNI2, 0.00000000000 AS PESASIG, 0.00000000000 AS PES2, space(20) as ASI, " +
99 " cast(0 as bit) as SEL, cast(0 as bit) as AJENO, cast(0 as bit) as REGULA, space(80) as ORIGEN, 0.00000000000 AS COSTE " +
100 "FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
101 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" ";
103 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Empresa"))
105 lcSql +=
" AND EMPRESA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Empresa"]);
108 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Numero"))
110 lcSql +=
" AND NUMERO = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Numero"]);
113 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Letra"))
115 lcSql +=
" AND LETRA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Letra"]);
118 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Linia"))
120 lcSql +=
" AND LINIA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Linia"]);
123 lcSql +=
" AND TRASPAS = " + DB.SQLString(0);
125 DB.SQLExec(lcSql, ref _oDataTable);
129 base._Nueva_Asignacion_Buscar_Stock();
139 string lcSql =
string.Empty;
141 string lcOn = EW_GLOBAL._Consolida(
"a.EMPRESA",
true,
false);
144 lcSql =
"SELECT a.LOTE, a.CADUCIDAD, a.UNIDADES, a.PESO, a.UBICA, a.TALLA, a.COLOR, " +
145 " 0.00000000000 AS UNIASIG,0.00000000000 AS PESASIG, 0.00000000000 AS UNI2, 0.00000000000 AS PES2, space(20) as ASI, " +
146 " cast(0 as bit) as SEL, cast(0 as bit) as AJENO, cast(0 as bit) as REGULA, space(80) as ORIGEN, 0.00000000000 AS COSTE " +
147 "FROM " + DB.SQLDatabase(
"LOTES",
"STOCKLOTES") +
" a " +
148 " LEFT JOIN " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" b " +
150 " AND a.ALMACEN = b.ALMACEN " +
151 " AND a.ARTICULO = b.ARTICULO " +
152 " AND a.LOTE = b.LOTE " +
153 " AND a.UBICA = b.UBICA " +
154 " AND a.TALLA = b.TALLA " +
155 " AND a.COLOR = b.COLOR " +
156 " AND b.NUMERO = " + DB.SQLString(_oDocLin._Numero) +
157 " AND b.LETRA = " + DB.SQLString(_oDocLin._Letra) +
158 " AND b.LINIA = " + DB.SQLString(_oDocLin._LineaReal) +
160 " AND a.TALLA = " + DB.SQLString(_oDocLin._Talla) +
161 " AND a.COLOR = " + DB.SQLString(_oDocLin._Color) +
162 " AND a.ARTICULO = " + DB.SQLString(_oDocLin._Articulo) +
163 " AND a.ALMACEN = " + DB.SQLString(_oDocLin._Almacen) +
165 " AND b.LOTE = null " +
166 " AND b.UBICA = null ";
168 DB.SQLExec(lcSql, ref tdtStockLote);
177 return _oLotesConfig._SinMov_Ltdepve;
186 return _oLotesConfig._Auto_Venta;
195 string lcSql =
" AND PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
196 " AND EMPRESA = " + DB.SQLString(_oDocLin._Empresa) +
" " +
197 " AND NUMERO = " + DB.SQLString(_oDocLin._Numero) +
198 " AND LETRA = " + DB.SQLString(_oDocLin._Letra) +
199 " AND LINIA = " + DB.SQLString(_oDocLin._LineaReal) +
" " +
200 " AND LOTE = " + DB.SQLString(toDetCodigo.
_Codigo) +
" " +
201 " AND UBICA = " + DB.SQLString(toDetCodigo.
_Ubicacion) +
" " +
202 " AND TALLA = " + DB.SQLString(_oDocLin._Talla) +
" " +
203 " AND COLOR = " + DB.SQLString(_oDocLin._Color) +
" ";
205 _dOldCreated = Convert.ToDateTime(DB.SQLValor(
"LTDEPVE",
"1=1 " + lcSql +
" AND '' ",
"",
"CREATED",
"LOTES"));
207 lcSql =
"DELETE FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" WHERE 1=1 " + lcSql;
218 string lcSql =
string.Empty;
220 if (_oRestricciones is IDictionary<string, string> && ((IDictionary<string, string>)_oRestricciones).Count == 4)
222 string lcSqlFiltro =
string.Empty;
223 string lcSet =
string.Empty;
224 string lcAsi =
string.Empty;
226 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Empresa"))
228 lcSqlFiltro +=
" AND EMPRESA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Empresa"]);
231 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Numero"))
233 lcSqlFiltro +=
" AND NUMERO = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Numero"]);
236 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Letra"))
238 lcSqlFiltro +=
" AND LETRA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Letra"]);
241 if (((IDictionary<string, string>)_oRestricciones).ContainsKey(
"Linia"))
243 lcSqlFiltro +=
" AND LINIA = " + DB.SQLString(((IDictionary<string, string>)_oRestricciones)[
"Linia"]);
247 DataTable ldtDatos =
new DataTable();
249 lcSql =
" SELECT * FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
250 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
252 " AND TALLA = " + DB.SQLString(_oDocLin._Talla) +
253 " AND COLOR = " + DB.SQLString(_oDocLin._Color) +
254 " AND LOTE = " + DB.SQLString(toDetCodigo.
_Codigo) +
255 " AND UBICA = " + DB.SQLString(toDetCodigo.
_Ubicacion);
257 DB.SQLExec(lcSql, ref ldtDatos);
259 int lnTraspas = ldtDatos.AsEnumerable().Max(lin => lin.Field<
int>(
"traspas"));
263 lcSql =
" SELECT * FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
264 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
266 " AND TALLA = " + DB.SQLString(_oDocLin._Talla) +
267 " AND COLOR = " + DB.SQLString(_oDocLin._Color) +
268 " AND LOTE = " + DB.SQLString(toDetCodigo.
_Codigo) +
269 " AND UBICA = " + DB.SQLString(toDetCodigo.
_Ubicacion) +
270 " AND TRASPAS = " + DB.SQLString(0);
271 DB.SQLExec(lcSql, ref ldtDatos);
273 decimal lnDocUnidades = ldtDatos.AsEnumerable().Sum(lin => lin.Field<decimal>(
"unidades"));
274 decimal lnDocPeso = ldtDatos.AsEnumerable().Sum(lin => lin.Field<decimal>(
"peso"));
276 if (ldtDatos.Rows.Count > 0)
278 foreach (DataRow ldr
in ldtDatos.Rows)
281 lcSet =
string.Empty;
283 lcAsi = FUNCTIONS._Random_Asi(20);
285 if (lnDocUnidades > Math.Abs(toDetCodigo.
_Unidades))
287 lcSet =
" ,unidades = " + DB.SQLString(Math.Abs(toDetCodigo.
_Unidades)) +
", peso = " + DB.SQLString(Math.Abs(toDetCodigo.
_Peso)) +
" ";
289 lcSet +=
" ,tfecha = null ";
292 lcSql =
" UPDATE " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
293 " SET TRASPAS = " + DB.SQLString(lnTraspas) +
294 " , ASI = " + DB.SQLString(lcAsi) +
296 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
298 " AND TALLA = " + DB.SQLString(toDetCodigo.
_Talla) +
299 " AND COLOR = " + DB.SQLString(toDetCodigo.
_Color) +
300 " AND LOTE = " + DB.SQLString(toDetCodigo.
_Codigo) +
301 " AND UBICA = " + DB.SQLString(toDetCodigo.
_Ubicacion) +
302 " AND TRASPAS = " + DB.SQLString(0);
307 if (lnDocUnidades > Math.Abs(toDetCodigo.
_Unidades))
309 ldr[
"unidades"] = lnDocUnidades - Math.Abs(toDetCodigo.
_Unidades);
310 ldr[
"peso"] = lnDocPeso - Math.Abs(toDetCodigo.
_Peso);
313 lcSql =
"INSERT INTO " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
314 "(EMPRESA,LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES,PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO,TALLA,COLOR,ASI) " +
316 DB.SQLString(ldr[
"Empresa"]) +
", " +
317 DB.SQLString(ldr[
"Letra"]) +
", " +
318 DB.SQLString(ldr[
"Numero"]) +
", " +
319 DB.SQLString(ldr[
"Fecha"]) +
", " +
320 DB.SQLString(ldr[
"Articulo"]) +
", " +
321 DB.SQLString(ldr[
"Linia"]) +
", " +
322 DB.SQLString(ldr[
"Lote"]) +
", " +
323 DB.SQLString(ldr[
"Unidades"]) +
", " +
324 DB.SQLString(ldr[
"Periodo"]) +
", " +
325 DB.SQLString(ldr[
"Almacen"]) +
", " +
326 DB.SQLString(ldr[
"Caducidad"]) +
", " +
327 DB.SQLString(ldr[
"Ubica"]) +
", " +
328 DB.SQLString(ldr[
"Fecha2"]) +
", " +
329 DB.SQLString(ldr[
"Peso"]) +
", " +
330 DB.SQLString(ldr[
"Talla"]) +
", " +
331 DB.SQLString(ldr[
"Color"]) +
", " +
332 DB.SQLString(
string.Empty) +
") ";
338 lcSql =
"INSERT INTO " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
339 "(EMPRESA,LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES,PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO,TALLA,COLOR,ASI,TRASPAS" +
340 (_dOldCreated == DateTime.MinValue ?
"" :
",CREATED") +
343 DB.SQLString(_oDocLin._Empresa) +
", " +
344 DB.SQLString(_oDocLin._Letra) +
", " +
345 DB.SQLString(_oDocLin._Numero) +
", " +
346 DB.SQLString(_oDocLin._Fecha) +
", " +
347 DB.SQLString(_oDocLin._Articulo) +
", " +
348 DB.SQLString(_oDocLin._LineaReal) +
", " +
349 DB.SQLString(toDetCodigo.
_Codigo) +
", " +
350 DB.SQLString(toDetCodigo.
_Unidades) +
", " +
351 DB.SQLString(_cPeriodo) +
", " +
352 DB.SQLString(_oDocLin._Almacen) +
", " +
355 DB.SQLString(DateTime.Now) +
", " +
356 DB.SQLString(toDetCodigo.
_Peso) +
", " +
357 DB.SQLString(_oDocLin._Talla) +
", " +
358 DB.SQLString(_oDocLin._Color) +
", " +
359 DB.SQLString(lcAsi) +
", " +
360 DB.SQLString(lnTraspas) +
" " +
361 (_dOldCreated == DateTime.MinValue ?
"" :
", " + DB.SQLString(_dOldCreated)) +
370 lcSql =
"INSERT INTO " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
371 "(EMPRESA,LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES,PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO,TALLA,COLOR,ASI" +
372 (_dOldCreated == DateTime.MinValue ?
"" :
",CREATED") +
375 DB.SQLString(_oDocLin._Empresa) +
", " +
376 DB.SQLString(_oDocLin._Letra) +
", " +
377 DB.SQLString(_oDocLin._Numero) +
", " +
378 DB.SQLString(_oDocLin._Fecha) +
", " +
379 DB.SQLString(_oDocLin._Articulo) +
", " +
380 DB.SQLString(_oDocLin._LineaReal) +
", " +
381 DB.SQLString(toDetCodigo.
_Codigo) +
", " +
382 DB.SQLString(toDetCodigo.
_Unidades) +
", " +
383 DB.SQLString(_cPeriodo) +
", " +
384 DB.SQLString(_oDocLin._Almacen) +
", " +
387 DB.SQLString(DateTime.Now) +
", " +
388 DB.SQLString(toDetCodigo.
_Peso) +
", " +
389 DB.SQLString(_oDocLin._Talla) +
", " +
390 DB.SQLString(_oDocLin._Color) +
", " +
391 DB.SQLString(toDetCodigo.
_Asi) +
" " +
392 (_dOldCreated == DateTime.MinValue ?
"" :
", " + DB.SQLString(_dOldCreated)) +
406 return _Es_Documento_Devolucion_Deposito();
415 return (_oDocLin._Unidades < 0);
424 return _oDocLin._Definicion;
434 return _oDocLin._Unidades - _oDocLin._Servidas;
443 if (_oDocLin._Servidas != 0 && (_oDocLin._Unidades - _oDocLin._Servidas) != 0)
444 return _oDocLin._Peso / (_oDocLin._Unidades - _oDocLin._Servidas);
446 return (_oDocLin._Peso);
450 #region IStockDocVenta 480 #endregion IStockDocVenta 488 DataTable ldtOldDades =
new DataTable();
489 string lcSql =
string.Empty;
491 _Delete_Linial_Revisar_Depositos(toDocumentoLin);
494 lcSql =
"SELECT DISTINCT ARTICULO, ALMACEN, TALLA, COLOR FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
495 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
496 " AND EMPRESA = " + DB.SQLString(toDocumentoLin._Empresa) +
" " +
497 " AND NUMERO = " + DB.SQLString(toDocumentoLin._Numero) +
" " +
498 " AND LETRA = " + DB.SQLString(toDocumentoLin._Letra) +
" " +
499 " AND LINIA = " + DB.SQLString(toDocumentoLin._LineaReal);
502 if (!DB.SQLExec(lcSql, ref ldtOldDades))
505 if (_Viene_Ejercicio_Anterior(toDocumentoLin))
507 int lnPeriodoAnterior = Convert.ToInt32(_cPeriodo) - 1;
510 lcSql =
" UPDATE " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
511 " SET PERIODO = " + DB.SQLString(lnPeriodoAnterior) +
512 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
513 " AND EMPRESA = " + DB.SQLString(toDocumentoLin._Empresa) +
514 " AND NUMERO = " + DB.SQLString(toDocumentoLin._Numero) +
515 " AND LETRA = " + DB.SQLString(toDocumentoLin._Letra) +
516 " AND LINIA = " + DB.SQLString(toDocumentoLin._LineaReal);
521 lcSql =
"DELETE FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
522 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
523 " AND EMPRESA = " + DB.SQLString(toDocumentoLin._Empresa) +
" " +
524 " AND NUMERO = " + DB.SQLString(toDocumentoLin._Numero) +
" " +
525 " AND LETRA = " + DB.SQLString(toDocumentoLin._Letra) +
" " +
526 " AND LINIA = " + DB.SQLString(toDocumentoLin._LineaReal);
530 if (!DB.SQLExec(lcSql))
534 string lcArticulo =
string.Empty;
535 string lcAlmacen =
string.Empty;
536 string lcTalla =
string.Empty;
537 string lcColor =
string.Empty;
539 if (ldtOldDades.Rows.Count > 0)
541 lcArticulo = ldtOldDades.Rows[0][
"ARTICULO"].ToString().Trim();
542 lcAlmacen = ldtOldDades.Rows[0][
"ALMACEN"].ToString().Trim();
543 lcTalla = ldtOldDades.Rows[0][
"TALLA"].ToString().Trim();
544 lcColor = ldtOldDades.Rows[0][
"COLOR"].ToString().Trim();
546 this._Refrescar_Stocks(lcArticulo, lcAlmacen, lcTalla, lcColor);
552 if (lcArticulo != toDocumentoLin._Articulo.Trim() || lcAlmacen != toDocumentoLin._Almacen.Trim() || lcTalla != toDocumentoLin._Talla.Trim() || lcColor != toDocumentoLin._Color.Trim())
553 this._Refrescar_Stocks(toDocumentoLin._Articulo, toDocumentoLin._Almacen, toDocumentoLin._Talla, toDocumentoLin._Color);
566 if (_Existe_Ejercicio_Anterior())
568 DataTable ldtDatos =
new DataTable();
569 string lcSql =
string.Empty;
571 lcSql =
" SELECT * FROM " + DB.SQLDatabase(
"GESTION-1",
"C_ALBDEP") +
572 " WHERE TRASPASADO = 1 " +
573 " AND EMPRESA = " + DB.SQLString(toDocumentoLinea._Empresa) +
574 " AND NUMERO = " + DB.SQLString(toDocumentoLinea._Numero) +
575 " AND LETRA = " + DB.SQLString(toDocumentoLinea._Letra);
578 DB.SQLExec(lcSql, ref ldtDatos);
580 return ldtDatos.Rows.Count > 0;
586 private void _Delete_Linial_Revisar_Depositos(dynamic toDocumentoLinea)
589 DataTable ldtLotes =
new DataTable();
590 DataTable ldtRegs =
new DataTable();
591 string lcSql =
string.Empty;
592 string lcSet =
string.Empty;
594 if (toDocumentoLinea._Doc == 2)
596 lcSql =
"SELECT * FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
597 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
598 " AND EMPRESA = " + DB.SQLString(toDocumentoLinea._Empresa) +
" " +
599 " AND NUMERO = " + DB.SQLString(toDocumentoLinea._Numero) +
" " +
600 " AND LETRA = " + DB.SQLString(toDocumentoLinea._Letra) +
" " +
601 " AND LINIA = " + DB.SQLString(toDocumentoLinea._LineaReal);
604 DB.SQLExec(lcSql, ref ldtLotes);
606 foreach (DataRow ldr
in ldtLotes.Rows)
609 lcSql =
"SELECT * FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
610 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
611 " AND EMPRESA = " + DB.SQLString(toDocumentoLinea._Empresa) +
" " +
612 " AND NUMERO = " + DB.SQLString(toDocumentoLinea._Doc_Num.Substring(0, 10)) +
" " +
613 " AND LETRA = " + DB.SQLString(toDocumentoLinea._Doc_Num.Substring(10, 2)) +
" " +
614 " AND LINIA = " + DB.SQLString(toDocumentoLinea._Doc_Lin) +
" " +
615 " AND LOTE = " + DB.SQLString(ldr[
"lote"]) +
" " +
616 " AND UBICA = " + DB.SQLString(ldr[
"ubica"]) +
" " +
617 " AND TALLA = " + DB.SQLString(ldr[
"talla"]) +
" " +
618 " AND COLOR = " + DB.SQLString(ldr[
"color"]) +
" " +
619 " AND TRASPAS = " + DB.SQLString(0);
620 DB.SQLExec(lcSql, ref ldtRegs);
623 if (ldtRegs != null && ldtRegs.Rows.Count > 0)
625 foreach (DataRow ldrow
in ldtRegs.Rows)
627 lcSet =
", UNIDADES = UNIDADES + " + DB.SQLString(ldtRegs.Rows[0].Field<decimal>(
"unidades"));
628 lcSet +=
", PESO = PESO + " + DB.SQLString(ldtRegs.Rows[0].Field<decimal>(
"peso"));
630 lcSql =
" DELETE FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
631 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
632 " AND EMPRESA = " + DB.SQLString(toDocumentoLinea._Empresa) +
" " +
633 " AND NUMERO = " + DB.SQLString(toDocumentoLinea._Doc_Num.Substring(0, 10)) +
" " +
634 " AND LETRA = " + DB.SQLString(toDocumentoLinea._Doc_Num.Substring(10, 2)) +
" " +
635 " AND LINIA = " + DB.SQLString(toDocumentoLinea._Doc_Lin) +
" " +
636 " AND LOTE = " + DB.SQLString(ldrow[
"lote"]) +
" " +
637 " AND UBICA = " + DB.SQLString(ldrow[
"ubica"]) +
" " +
638 " AND TALLA = " + DB.SQLString(ldrow[
"talla"]) +
" " +
639 " AND COLOR = " + DB.SQLString(ldrow[
"color"]) +
" " +
640 " AND TRASPAS = " + DB.SQLString(0);
646 lcSql =
"UPDATE " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" SET TRASPAS = 0, TFECHA = null " + lcSet +
647 " WHERE ASI = " + DB.SQLString(ldr[
"asi"]) +
" ";
650 lcSet =
string.Empty;
656 #region IVentasExtendidas 669 if (toLinea._UsaLotes)
670 llOk = _Delete_Linial(toLinea);
721 bool llCondicion =
false;
724 llCondicion = llCondicion || teCampo ==
CampsDocVentaLin.Articulo && !String.IsNullOrWhiteSpace(toLinea._Articulo) && String.Compare(toLinea._Articulo, (
string)toValue) != 0;
725 llCondicion = llCondicion || teCampo ==
CampsDocVentaLin.Talla && !String.IsNullOrWhiteSpace(toLinea._Talla) && String.Compare(toLinea._Talla, (
string)toValue) != 0;
726 llCondicion = llCondicion || teCampo ==
CampsDocVentaLin.Color && !String.IsNullOrWhiteSpace(toLinea._Color) && String.Compare(toLinea._Color, (
string)toValue) != 0;
733 string lcDef = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_deflote"));
735 tcMensajeRespuesta =
"No se permite modificar el artículo, trabaja con " + lcDef +
". " + Environment.NewLine +
736 "Pruebe a borrar el artículo e introducir uno de nuevo.";
766 bool llGestionEspecial =
false;
776 _oRestricciones = toRestricciones;
779 if (toValue == null) _ReadOnly =
true;
782 if ((toValue is
bool && (
bool)toValue ==
false) || _ReadOnly)
783 _Iniciar_Asignacion_Lotes(toLinea,
false);
785 _Iniciar_Asignacion_Lotes(toLinea,
true);
787 tcMensajeError = _Error_Message;
788 llGestionEspecial =
true;
795 return llGestionEspecial;
805 throw new NotImplementedException();
808 #endregion IVentasExtendidas 819 public bool _Update(docsven.Docsven.IDocVentaCab toCabecera, IEnumerable<docsven.Docsven.IDocVentaLin> toLineas,
CampsDocVentaCab teCampo,
object toValue)
824 string lcSql = String.Empty;
827 lcSql =
"UPDATE " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
828 " SET PERIODO = " + DB.SQLString(_cPeriodo) +
",FECHA = " + DB.SQLString(loFecha.
_NewVal) +
829 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
" " +
830 " AND EMPRESA = " + DB.SQLString(toLineas.FirstOrDefault()._Empresa) +
831 " AND NUMERO = " + DB.SQLString(toLineas.FirstOrDefault()._Numero) +
832 " AND LETRA = " + DB.SQLString(toLineas.FirstOrDefault()._Letra);
847 return _oLotesConfig._Coste;
857 private string _cPeriodo = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_any"));
876 DataTable table =
new DataTable();
878 DB.SQLExec(
" SELECT 1 FROM " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
879 " WHERE PERIODO = " + DB.SQLString(_cPeriodo) +
880 " AND EMPRESA = " + DB.SQLString(toLinea.
_Empresa) +
881 " AND LETRA = " + DB.SQLString(toLinea.
_Letra) +
882 " AND NUMERO = " + DB.SQLString(toLinea.
_Numero) +
883 " AND LINIA = " + DB.SQLString(toLinea.
_LineaReal) +
884 " AND LOTE = " + DB.SQLString(toLote._Lote) +
885 " AND UBICA = " + DB.SQLString(
"") +
886 " AND TALLA = " + DB.SQLString(toLinea.
_Talla) +
887 " AND COLOR = " + DB.SQLString(toLinea.
_Color), ref table);
889 if (table.Rows.Count == 0)
892 DB.SQLExec(
"INSERT INTO " + DB.SQLDatabase(
"LOTES",
"LTDEPVE") +
" " +
893 "(EMPRESA,LETRA,NUMERO,FECHA,ARTICULO,LINIA,LOTE,UNIDADES,PERIODO,ALMACEN,CADUCIDAD,UBICA,FECHA2,PESO,TALLA,COLOR,ASI) " +
895 DB.SQLString(toLinea.
_Empresa) +
", " +
896 DB.SQLString(toLinea.
_Letra) +
", " +
897 DB.SQLString(toLinea.
_Numero) +
", " +
898 DB.SQLString(toLinea.
_Fecha) +
", " +
899 DB.SQLString(toLote._Articulo) +
", " +
901 DB.SQLString(toLote._Lote) +
", " +
902 DB.SQLString(toLote._Unidades) +
", " +
903 DB.SQLString(_cPeriodo) +
", " +
904 DB.SQLString(toLinea.
_Almacen) +
", " +
905 DB.SQLString(toLote._Caducidad) +
", " +
906 DB.SQLString(toLote._Ubicacion) +
", " +
907 DB.SQLString(DateTime.Now) +
", " +
908 DB.SQLString(toLote._Peso) +
", " +
909 DB.SQLString(toLinea.
_Talla) +
", " +
910 DB.SQLString(toLinea.
_Color) +
", " +
911 DB.SQLString(toLote._Asi) +
") ");
bool _Delete(Docsven.IDocVentaLin toLinea, bool tlAbono)
Método delete
bool _Delete(string tcLote, IDocumentLinea toLinea)
Operaciones de borrado
Clase para controlar toda la gestion de venta de un lote/ubicacion de artículo
override bool _Autoasignacion()
Indica si está activada la autoasignación dependiendo del tipo de documento
override void _Consultar_Stock_Disponible(ref DataTable tdtStockLote)
Consultar stock disponible
bool _ObtenerCosteLinea(Docsven.IDocVentaLin toLinea)
Obtiene el coste de la línea
Clase para la gestión de los lotes
override void _InsertLinDocStockLotes(LinVenDetLotes toDetCodigo)
Nou metode buit que es sobreescriurà per cada document, per insertar els moviments a les taules de lo...
bool _Show(object toPadre, IDocumentLinea toLinea, bool tlReadOnly=false)
Nos presenta el formulario para visualizar/operar con las series
string _Talla
Codigo de la talla
Interficie mínima de las líneas (Mantener lo mas reducida posible)
Clase de lotes para depositos de venta (depoven)
bool _Asignar_Articulos_Lote(sage.ew.lote.Clases.Lote toLote, IDocumentLinea toLinea)
Insertar la información en la tabla LOTES!LTDEPVE
override decimal _Get_Unidades_Linea()
Obtener las unidades en función del tipo de operación
override string _Obtener_Nombre_Articulo()
Obtener el nombre del artículo de la linea actual
Classe campo para las entidades, que permitirá comprobar si se ha cambiado su valor ...
Nullable< DateTime > _Caducidad
Fecha de caducidad del lote (Accepta NULL)
bool _Obtener_Detalle(Docsven.IDocVentaLin toLinea, ref DataTable tdtResultados)
Método para obtener detalle
bool _Se_Puede_Borrar(Docsven.IDocVentaLin toLinea)
Método lineal para comprobar si la línea se puede borrar
override bool _Desactivar_Control_Stock()
Nou metode buit que es sobreescriurà per cada document, per verificar el control d'stock ...
bool _Show(Docsven.IDocVentaLin toLinea, CampsDocVentaLin teCampo, object toValue, object toRestricciones, ref string tcMensajeError)
Método show
override bool _Delete_Linial(dynamic toDocumentoLin)
Borra el lote de la tabla LTDEPVE
string _Color
Codigo de color
bool _Update(Docsven.IDocVentaLin toLinea)
Método update
Classe Robot (Comportamiento) para los depositos de venta
CampsDocVentaLin
Enumera todos los nombres de propiedades (SET) de la LINEA
CampsDocVentaCab
Enumera todos los nombres de propiedades (SET) de la CABECERA
string _Codigo
Código de lote asociado
LoteDocVentaDeposito()
Constructor de la clase LoteDocVentaDeposito
override void _Consultar_Lotes_Documento()
Nou metode buit que es sobreescriurà per cada document
Classe base dels documents.
override bool _Viene_Ejercicio_Anterior(dynamic toDocumentoLinea)
Comprobamos si el documento viene del ejercicio anterior
override bool _Es_Documento_Devolucion_Deposito()
Indica si es un documento de depósito
override void _Nueva_Asignacion_Buscar_Stock()
Buscamos el stock a seleccionar, en los lotes asignados en el deposito
object _NewVal
Valor nuevo
override void _ComprobarBloqueos()
Comprobar si existe alguna restricción, para que se abra el formulario de asignación de lotes...
override bool _Es_Documento_Entrada()
Nos devuelve si el documento es de entrada o salida de stock
decimal _Peso
Peso asignado a la venta
string _Ubicacion
Código de la ubicación
Interficie para operaciones extendidas de lineas de venta
string _Asi
Asi del registro
int _LineaReal
Devuelve el campo linia: para todos los documentos sera el mismo valor que la linea pero en el docume...
override void _DeleteLinDocStockLotes(LinVenDetLotes toDetCodigo)
Nou metode buit que es sobreescriurà per cada document, per eliminar els moviments a les taules de lo...
override decimal _Get_Peso_Linea()
Obtener el peso en función del tipo de operación
static bool _Comprobaciones_Borrado_Series(ewDocVentaDEPOSITO toDocumento)
Realiza las comprobaciones de borrado de documentos relativas al trabajo con series ...
decimal _Unidades
Unidades asignadas a la venta
bool _Operacion_Permitida(Docsven.IDocVentaLin toLinea, CampsDocVentaLin teCampo, object toValue, ref string tcMensajeRespuesta)
Método de comprobación de operaciones permitidas
_Asignar_Articulos_LoteDocVentaDeposito_Behaviour()
Constructor vacio
bool _Update(docsven.Docsven.IDocVentaCab toCabecera, IEnumerable< docsven.Docsven.IDocVentaLin > toLineas, CampsDocVentaCab teCampo, object toValue)
Update general por cambios en campos de la cabecera
LoteDocVentaDeposito(string tcLote, IDocumentLinea toDocumentoLin=null)
Constructor con parámetros (utiliza el constructor base)
Clase de documentos DEPOSITO