/// <summary>
 /// Deprecated Method for adding a new object to the ajustes_inventario_cafe_x_socio EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToajustes_inventario_cafe_x_socio(ajuste_inventario_cafe_x_socio ajuste_inventario_cafe_x_socio)
 {
     base.AddObject("ajustes_inventario_cafe_x_socio", ajuste_inventario_cafe_x_socio);
 }
Esempio n. 2
0
        /// <summary>
        /// Insertar transacción de la nota de peso en la tabla de inventario de café de socios como ajuste (Ajuste de Inventario).
        /// </summary>
        /// <param name="AjusteDeInventarioDeCafe"></param>
        /// <param name="db"></param>
        public void InsertarTransaccionInventarioDeCafeDeSocio(ajuste_inventario_cafe_x_socio AjusteDeInventarioDeCafe, colinasEntities db)
        {
            try
            {
                reporte_total_inventario_de_cafe_por_socio asocInventory = this.GetReporteTotalInventarioDeCafeDeSocio(AjusteDeInventarioDeCafe.SOCIOS_ID, AjusteDeInventarioDeCafe.CLASIFICACIONES_CAFE_ID);

                decimal cantidad_en_inventario_socio = asocInventory == null ? 0 : asocInventory.INVENTARIO_ENTRADAS_CANTIDAD;
                decimal salidas_de_inventario_socio = asocInventory == null ? 0 : asocInventory.INVENTARIO_SALIDAS_SALDO;

                inventario_cafe_de_socio inventarioDeCafeDeSocio = new inventario_cafe_de_socio();

                inventarioDeCafeDeSocio.SOCIOS_ID = AjusteDeInventarioDeCafe.SOCIOS_ID;
                inventarioDeCafeDeSocio.CLASIFICACIONES_CAFE_ID = AjusteDeInventarioDeCafe.CLASIFICACIONES_CAFE_ID;
                inventarioDeCafeDeSocio.DOCUMENTO_ID = AjusteDeInventarioDeCafe.AJUSTES_INV_CAFE_ID;
                inventarioDeCafeDeSocio.DOCUMENTO_TIPO = "AJUSTE";

                inventarioDeCafeDeSocio.INVENTARIO_ENTRADAS_CANTIDAD = cantidad_en_inventario_socio - AjusteDeInventarioDeCafe.AJUSTES_INV_CAFE_CANTIDAD_LIBRAS;
                inventarioDeCafeDeSocio.INVENTARIO_SALIDAS_SALDO = salidas_de_inventario_socio + AjusteDeInventarioDeCafe.AJUSTES_INV_CAFE_SALDO_TOTAL;

                inventarioDeCafeDeSocio.CREADO_POR = AjusteDeInventarioDeCafe.CREADO_POR;
                inventarioDeCafeDeSocio.FECHA_CREACION = AjusteDeInventarioDeCafe.FECHA_CREACION;

                db.inventario_cafe_de_socio.AddObject(inventarioDeCafeDeSocio);

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al insertar transaccion de inventario de cafe de socio. Ajuste de Inventario de Cafe.", ex);
                throw;
            }
        }
 /// <summary>
 /// Create a new ajuste_inventario_cafe_x_socio object.
 /// </summary>
 /// <param name="aJUSTES_INV_CAFE_ID">Initial value of the AJUSTES_INV_CAFE_ID property.</param>
 /// <param name="sOCIOS_ID">Initial value of the SOCIOS_ID property.</param>
 /// <param name="cLASIFICACIONES_CAFE_ID">Initial value of the CLASIFICACIONES_CAFE_ID property.</param>
 /// <param name="aJUSTES_INV_CAFE_FECHA">Initial value of the AJUSTES_INV_CAFE_FECHA property.</param>
 /// <param name="aJUSTES_INV_CAFE_CANTIDAD_LIBRAS">Initial value of the AJUSTES_INV_CAFE_CANTIDAD_LIBRAS property.</param>
 /// <param name="aJUSTES_INV_CAFE_PRECIO_LIBRAS">Initial value of the AJUSTES_INV_CAFE_PRECIO_LIBRAS property.</param>
 /// <param name="aJUSTES_INV_CAFE_SALDO_TOTAL">Initial value of the AJUSTES_INV_CAFE_SALDO_TOTAL property.</param>
 /// <param name="cREADO_POR">Initial value of the CREADO_POR property.</param>
 /// <param name="fECHA_CREACION">Initial value of the FECHA_CREACION property.</param>
 public static ajuste_inventario_cafe_x_socio Createajuste_inventario_cafe_x_socio(global::System.Int32 aJUSTES_INV_CAFE_ID, global::System.String sOCIOS_ID, global::System.Int32 cLASIFICACIONES_CAFE_ID, global::System.DateTime aJUSTES_INV_CAFE_FECHA, global::System.Decimal aJUSTES_INV_CAFE_CANTIDAD_LIBRAS, global::System.Decimal aJUSTES_INV_CAFE_PRECIO_LIBRAS, global::System.Decimal aJUSTES_INV_CAFE_SALDO_TOTAL, global::System.String cREADO_POR, global::System.DateTime fECHA_CREACION)
 {
     ajuste_inventario_cafe_x_socio ajuste_inventario_cafe_x_socio = new ajuste_inventario_cafe_x_socio();
     ajuste_inventario_cafe_x_socio.AJUSTES_INV_CAFE_ID = aJUSTES_INV_CAFE_ID;
     ajuste_inventario_cafe_x_socio.SOCIOS_ID = sOCIOS_ID;
     ajuste_inventario_cafe_x_socio.CLASIFICACIONES_CAFE_ID = cLASIFICACIONES_CAFE_ID;
     ajuste_inventario_cafe_x_socio.AJUSTES_INV_CAFE_FECHA = aJUSTES_INV_CAFE_FECHA;
     ajuste_inventario_cafe_x_socio.AJUSTES_INV_CAFE_CANTIDAD_LIBRAS = aJUSTES_INV_CAFE_CANTIDAD_LIBRAS;
     ajuste_inventario_cafe_x_socio.AJUSTES_INV_CAFE_PRECIO_LIBRAS = aJUSTES_INV_CAFE_PRECIO_LIBRAS;
     ajuste_inventario_cafe_x_socio.AJUSTES_INV_CAFE_SALDO_TOTAL = aJUSTES_INV_CAFE_SALDO_TOTAL;
     ajuste_inventario_cafe_x_socio.CREADO_POR = cREADO_POR;
     ajuste_inventario_cafe_x_socio.FECHA_CREACION = fECHA_CREACION;
     return ajuste_inventario_cafe_x_socio;
 }
        /// <summary>
        /// Inserta el ajuste de inventario de café de socio.
        /// </summary>
        /// <param name="AJUSTES_INV_CAFE_ID"></param>
        /// <param name="SOCIOS_ID"></param>
        /// <param name="CLASIFICACIONES_CAFE_ID"></param>
        /// <param name="CLASIFICACIONES_CAFE_NOMBRE"></param>
        /// <param name="AJUSTES_INV_CAFE_FECHA"></param>
        /// <param name="FECHA_DESDE"></param>
        /// <param name="FECHA_HASTA"></param>
        /// <param name="AJUSTES_INV_CAFE_CANTIDAD_LIBRAS"></param>
        /// <param name="AJUSTES_INV_CAFE_PRECIO_LIBRAS"></param>
        /// <param name="AJUSTES_INV_CAFE_SALDO_TOTAL"></param>
        /// <param name="CREADO_POR"></param>
        /// <param name="FECHA_CREACION"></param>
        /// <param name="MODIFICADO_POR"></param>
        /// <param name="FECHA_MODIFICACION"></param>
        public void InsertarAjusteDeInventarioDeCafeDeSocio
            (int AJUSTES_INV_CAFE_ID,
            string SOCIOS_ID,
            int CLASIFICACIONES_CAFE_ID,
            string CLASIFICACIONES_CAFE_NOMBRE,
            DateTime AJUSTES_INV_CAFE_FECHA,
            DateTime FECHA_DESDE,
            DateTime FECHA_HASTA,
            decimal AJUSTES_INV_CAFE_CANTIDAD_LIBRAS,
            decimal AJUSTES_INV_CAFE_PRECIO_LIBRAS,
            decimal AJUSTES_INV_CAFE_SALDO_TOTAL,
            string CREADO_POR,
            DateTime FECHA_CREACION,
            string MODIFICADO_POR,
            DateTime FECHA_MODIFICACION)
        {
            try
            {
                using (var db = new colinasEntities())
                {
                    using (var scope1 = new TransactionScope())
                    {
                        ajuste_inventario_cafe_x_socio ajuste_cafe = new ajuste_inventario_cafe_x_socio();

                        ajuste_cafe.SOCIOS_ID = SOCIOS_ID;
                        ajuste_cafe.CLASIFICACIONES_CAFE_ID = CLASIFICACIONES_CAFE_ID;
                        ajuste_cafe.AJUSTES_INV_CAFE_FECHA = AJUSTES_INV_CAFE_FECHA;
                        ajuste_cafe.AJUSTES_INV_CAFE_CANTIDAD_LIBRAS = AJUSTES_INV_CAFE_CANTIDAD_LIBRAS;
                        ajuste_cafe.AJUSTES_INV_CAFE_PRECIO_LIBRAS = AJUSTES_INV_CAFE_PRECIO_LIBRAS;

                        ajuste_cafe.AJUSTES_INV_CAFE_SALDO_TOTAL = AJUSTES_INV_CAFE_CANTIDAD_LIBRAS * AJUSTES_INV_CAFE_PRECIO_LIBRAS;

                        ajuste_cafe.CREADO_POR = ajuste_cafe.MODIFICADO_POR = CREADO_POR;
                        ajuste_cafe.FECHA_CREACION = DateTime.Today;
                        ajuste_cafe.FECHA_MODIFICACION = ajuste_cafe.FECHA_CREACION;

                        db.ajustes_inventario_cafe_x_socio.AddObject(ajuste_cafe);

                        db.SaveChanges();

                        InventarioDeCafeLogic inventariodecafelogic = new InventarioDeCafeLogic();
                        inventariodecafelogic.InsertarTransaccionInventarioDeCafeDeSocio(ajuste_cafe, db);

                        db.SaveChanges();

                        scope1.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al insertar ajuste de inventario de cafe de socio.", ex);
                throw;
            }
        }