Пример #1
0
        public static void Update(tsh_ListasDePreciosExDataset data)
        {
            SqlConnection cnx = dbhelper.Connection.GetConnection();;

            cnx.Open();

            SqlTransaction trx = cnx.BeginTransaction(IsolationLevel.Serializable);

            try
            {
                mz.erp.dataaccess.tsh_ListasDePrecios.Update(data.tsh_ListasDePrecios, trx);
                mz.erp.dataaccess.tsh_ProductosListasDePrecios.Update(data.tsh_ProductosListasDePrecios, trx);

                trx.Commit();
            }
            catch (Exception e)
            {
                trx.Rollback();
                //Debug.WriteLine(e.Message);
            }
            finally
            {
                cnx.Close();
            }
        }
Пример #2
0
        public static void Update(tsh_ListasDePreciosExDataset data)
        {
            ApplicationAssert.Check(data != null, "El argumento datae no debe ser nulo.", ApplicationAssert.LineNumber);


            mz.erp.dataaccess.tsh_ListasDePreciosEx.Update(data);
        }
Пример #3
0
        public void Update(object dataTable)
        {
            //Sabrina 20100727 - Tarea 802
            tsh_ListasDePreciosExDataset dataLPEx = new tsh_ListasDePreciosExDataset();

            dataLPEx.Merge((DataTable)dataTable);

            foreach (tsh_ListasDePreciosExDataset.tsh_ListasDePreciosRow row in dataLPEx.tsh_ListasDePrecios.Rows)
            {
                if (row.RowState.Equals(DataRowState.Added))                //Si es una lista nueva se la agrego a todos los productos
                {
                    CargarListaDePrecioAProductos(row, dataLPEx);
                }
                else if (row.RowState.Equals(DataRowState.Modified))                //Si es una lista modificada para cada producto que la tenga como General y el coeficiente difiera se lo modifico.
                {
                    ModificarCoeficienteListaDePrecioAProductos(row, dataLPEx);
                }
            }
            mz.erp.businessrules.tsh_ListasDePreciosEx.Update(dataLPEx);
            //Fin Sabrina 20100727 - Tarea 802
        }
Пример #4
0
        //Fin Sabrina 20100727 - Tarea 802

        //Sabrina 20100727 - Tarea 802
        private void ModificarCoeficienteListaDePrecioAProductos(tsh_ListasDePreciosExDataset.tsh_ListasDePreciosRow rowLP, tsh_ListasDePreciosExDataset dataLPEx)
        {
            tsh_ProductosDataset.tsh_ProductosDataTable tableProd = mz.erp.businessrules.tsh_Productos.GetList().tsh_Productos;
            foreach (tsh_ProductosDataset.tsh_ProductosRow rowP in tableProd.Rows)
            {
                tsh_ProductosListasDePreciosDataset.tsh_ProductosListasDePreciosRow rowPLP = tsh_ProductosListasDePrecios.GetByPk(rowP.IdProducto, rowLP.IdListaDePrecio);
                if (rowPLP != null)
                {
                    if (rowPLP.ModoDeAplicacion == "G" && rowPLP.Coeficiente != rowLP.Coeficiente)                    // Si la lista es general para el producto y el coeficiente cambio la actualizo con el nuevo coeficiente
                    {
                        rowPLP.Coeficiente        = rowLP.Coeficiente;
                        rowPLP.PrecioDeVentaBruto = rowP.PrecioDeVentaNeto + ((rowP.PrecioDeVentaNeto * rowLP.Coeficiente) / 100);
                        System.Collections.Hashtable formulas = mz.erp.businessrules.comprobantes.FuncionesImpuestos.ObtenerFormulas(null, null, rowP.IdProducto);
                        decimal impuestosBrutos = mz.erp.businessrules.comprobantes.FuncionesImpuestos.Calcular(formulas, rowPLP.PrecioDeVentaBruto);
                        rowPLP.PrecioDeVentaBrutoConImpuesto = rowPLP.PrecioDeVentaBruto + impuestosBrutos;
                        if (rowPLP.PrecioDeVentaBruto != 0)
                        {
                            rowPLP.MaxDescuento           = rowPLP.PrecioDeVentaBruto - rowP.PrecioDeVentaNeto;
                            rowPLP.MaxDescuentoPorcentual = (rowPLP.MaxDescuento * 100) / rowPLP.PrecioDeVentaBruto;
                        }
                        dataLPEx.tsh_ProductosListasDePrecios.ImportRow(rowPLP);
                    }
                }
            }
        }
Пример #5
0
        //Sabrina 20100727 - Tarea 802
        private void CargarListaDePrecioAProductos(tsh_ListasDePreciosExDataset.tsh_ListasDePreciosRow rowLP, tsh_ListasDePreciosExDataset dataLPEx)
        {
            tsh_ProductosDataset.tsh_ProductosDataTable tableProd = mz.erp.businessrules.tsh_Productos.GetList().tsh_Productos;
            foreach (tsh_ProductosDataset.tsh_ProductosRow rowP in tableProd.Rows)
            {
                tsh_ListasDePreciosExDataset.tsh_ProductosListasDePreciosRow rowPLP = dataLPEx.tsh_ProductosListasDePrecios.Newtsh_ProductosListasDePreciosRow();
                rowPLP.IdProducto         = rowP.IdProducto;
                rowPLP.IdListaDePrecio    = rowLP.IdListaDePrecio;
                rowPLP.ModoDeAplicacion   = "G";
                rowPLP.Coeficiente        = rowLP.Coeficiente;
                rowPLP.PrecioDeVentaBruto = rowP.PrecioDeVentaNeto + ((rowP.PrecioDeVentaNeto * rowLP.Coeficiente) / 100);
                System.Collections.Hashtable formulas = mz.erp.businessrules.comprobantes.FuncionesImpuestos.ObtenerFormulas(null, null, rowP.IdProducto);
                decimal impuestosBrutos = mz.erp.businessrules.comprobantes.FuncionesImpuestos.Calcular(formulas, rowPLP.PrecioDeVentaBruto);
                rowPLP.PrecioDeVentaBrutoConImpuesto = rowPLP.PrecioDeVentaBruto + impuestosBrutos;
                if (rowPLP.PrecioDeVentaBruto != 0)
                {
                    rowPLP.MaxDescuento           = rowPLP.PrecioDeVentaBruto - rowP.PrecioDeVentaNeto;
                    rowPLP.MaxDescuentoPorcentual = (rowPLP.MaxDescuento * 100) / rowPLP.PrecioDeVentaBruto;
                }
                rowPLP.FechaCreacion                = DateTime.Now;
                rowPLP.IdConexionCreacion           = Security.IdConexion;
                rowPLP.IdConexionUltimaModificacion = Security.IdConexion;
                rowPLP.IdReservado = 0;
                rowPLP.RowId       = Guid.Empty;
                rowPLP.IdEmpresa   = Security.IdEmpresa;
                rowPLP.IdSucursal  = Security.IdSucursal;

                dataLPEx.tsh_ProductosListasDePrecios.Addtsh_ProductosListasDePreciosRow(rowPLP);
            }
        }